Skip to contentSkip to conversation

net: fec: properly guard irq coalesce setup

PATCH Applied Rasmus Villemoes 4 participants 5 messages Dec 5, 2022 – Dec 7, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fec: properly guard irq coalesce setup

Prior to the Fixes: commit, the initialization code went through the same fec_enet_set_coalesce() function as used by ethtool, and that function correctly checks whether the current variant has support for irq coalescing.

Now that the initialization code instead calls fec_enet_itr_coal_set() directly, that call needs to be guarded by a check for the FEC_QUIRK_HAS_COALESCE bit.

Fixes df727d4547de (net: fec: don't reset irq coalesce settings to defaults on "ip link up")
---
 drivers/net/ethernet/freescale/fec_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +2 -1
index 2ca2b61b451f..23e1a94b9ce4 100644
@@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev)
 		writel(0, fep->hwp + FEC_IMASK);
 
 	/* Init the interrupt coalescing */
-	fec_enet_itr_coal_set(ndev);
+	if (fep->quirks & FEC_QUIRK_HAS_COALESCE)
+		fec_enet_itr_coal_set(ndev);
 }
 
 static int fec_enet_ipc_handle_init(struct fec_enet_private *fep)
Signature · 1 line
2.37.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Rasmus Villemoes

Prior to the Fixes: commit, the initialization code went through the same fec_enet_set_coalesce() function as used by ethtool, and that function correctly checks whether the current variant has support for irq coalescing.

Quoted 7 lines

Now that the initialization code instead calls fec_enet_itr_coal_set() directly, that call needs to be guarded by a check for the FEC_QUIRK_HAS_COALESCE bit.

Fixes df727d4547de (net: fec: don't reset irq coalesce settings to defaults on "ip link up")
Quoted 9 lines
---
  drivers/net/ethernet/freescale/fec_main.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +0 -0
index 2ca2b61b451f..23e1a94b9ce4 100644

drivers/net/ethernet/freescale/fec_main.c fec_restart(struct net_device *ndev) · line 1224

Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c +2 -1
@@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev)
  		writel(0, fep->hwp + FEC_IMASK);
 
  	/* Init the interrupt coalescing */
-	fec_enet_itr_coal_set(ndev);
+	if (fep->quirks & FEC_QUIRK_HAS_COALESCE)
+		fec_enet_itr_coal_set(ndev);

There is already a guard in fec_enet_set_coalesce() so this makes sense, thanks!

Signature · 1 line
Florian
#2 lore raw
In reply to Rasmus Villemoes

Am Montag, 5. Dezember 2022, 21:46:04 CET schrieb Rasmus Villemoes:

Quoted 22 lines

Prior to the Fixes: commit, the initialization code went through the same fec_enet_set_coalesce() function as used by ethtool, and that function correctly checks whether the current variant has support for irq coalescing.

Now that the initialization code instead calls fec_enet_itr_coal_set() directly, that call needs to be guarded by a check for the FEC_QUIRK_HAS_COALESCE bit.

Fixes df727d4547de (net: fec: don't reset irq coalesce settings to defaults

on "ip link up") Reported-by: Greg Ungerer <[email protected]>

---
 drivers/net/ethernet/freescale/fec_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/ethernet/freescale/fec_main.c index
2ca2b61b451f..23e1a94b9ce4 100644

drivers/net/ethernet/freescale/fec_main.c fec_restart(struct net_device *ndev) · line 1227

Quoted 9 lines
drivers/net/ethernet/freescale/fec_main.c +2 -1
@@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev)
 		writel(0, fep->hwp + FEC_IMASK);
 
 	/* Init the interrupt coalescing */
-	fec_enet_itr_coal_set(ndev);
+	if (fep->quirks & FEC_QUIRK_HAS_COALESCE)
+		fec_enet_itr_coal_set(ndev);
 }
 
 static int fec_enet_ipc_handle_init(struct fec_enet_private *fep)

I'm wondering if this check should be added to fec_enet_itr_coal_set() instead. Right now any additional caller has to do it's own check for FEC_QUIRK_HAS_COALESCE, so why not do check in fec_enet_itr_coal_set? But I'm okay with this change as well.

Best regards,
Alexander

#3 lore raw
Quoted 31 lines · Alexander Stein

Am Montag, 5. Dezember 2022, 21:46:04 CET schrieb Rasmus Villemoes:

Quoted 30 lines

Prior to the Fixes: commit, the initialization code went through the same fec_enet_set_coalesce() function as used by ethtool, and that function correctly checks whether the current variant has support for irq coalescing.

Now that the initialization code instead calls fec_enet_itr_coal_set() directly, that call needs to be guarded by a check for the FEC_QUIRK_HAS_COALESCE bit.

Fixes df727d4547de (net: fec: don't reset irq coalesce settings to defaults

on "ip link up") Reported-by: Greg Ungerer <[email protected]>

---
 drivers/net/ethernet/freescale/fec_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/ethernet/freescale/fec_main.c index
2ca2b61b451f..23e1a94b9ce4 100644

drivers/net/ethernet/freescale/fec_main.c +2 -1
@@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev)
 		writel(0, fep->hwp + FEC_IMASK);
 
 	/* Init the interrupt coalescing */
-	fec_enet_itr_coal_set(ndev);
+	if (fep->quirks & FEC_QUIRK_HAS_COALESCE)
+		fec_enet_itr_coal_set(ndev);
 }
 
Quoted 5 lines

drivers/net/ethernet/freescale/fec_main.c fec_restart(struct net_device *ndev) · line 1227

Quoted 1 line
drivers/net/ethernet/freescale/fec_main.c +0 -0
 static int fec_enet_ipc_handle_init(struct fec_enet_private *fep)

I'm wondering if this check should be added to fec_enet_itr_coal_set() instead. Right now any additional caller has to do it's own check for FEC_QUIRK_HAS_COALESCE, so why not do check in fec_enet_itr_coal_set?

Yeah, I did consider that (see
https://lore.kernel.org/netdev/[email protected]/).
But in the end I decided against it, for various small reasons. Primarily my thinking was that while this caller is obviously ok with fec_enet_itr_coal_set() just silently being a no-op, it's not clear that some future caller wouldn't have to check the bit themselves and return -EOPNOTSUPP or some other error just like the ethtool method does. Of course we could also make fec_enet_itr_coal_set() not return void, but then it's a whole different refactoring and definitely not for post-rc8.

But also, the above was what I had sent out as a "something like this?" and tested on my own hardware before heading home, and due to the imminent release, I wanted to send out the patch ASAP.

Rasmus

#4 lore raw
In reply to Rasmus Villemoes
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 5 Dec 2022 21:46:04 +0100 you wrote:

Prior to the Fixes: commit, the initialization code went through the same fec_enet_set_coalesce() function as used by ethtool, and that function correctly checks whether the current variant has support for irq coalescing.

Now that the initialization code instead calls fec_enet_itr_coal_set() directly, that call needs to be guarded by a check for the FEC_QUIRK_HAS_COALESCE bit.

[...]

Here is the summary with links:
- net: fec: properly guard irq coalesce setup

    https://git.kernel.org/netdev/net/c/7e6303567ce3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html