linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fec: properly guard irq coalesce setup
@ 2022-12-05 20:46 Rasmus Villemoes
  2022-12-05 21:08 ` Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rasmus Villemoes @ 2022-12-05 20:46 UTC (permalink / raw)
  To: Joakim Zhang, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rasmus Villemoes, Andrew Lunn
  Cc: Greg Ungerer, netdev, linux-kernel

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 <gregungerer@westnet.com.au>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/net/ethernet/freescale/fec_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 2ca2b61b451f..23e1a94b9ce4 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -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)
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: fec: properly guard irq coalesce setup
  2022-12-05 20:46 [PATCH] net: fec: properly guard irq coalesce setup Rasmus Villemoes
@ 2022-12-05 21:08 ` Florian Fainelli
  2022-12-06  6:16 ` Alexander Stein
  2022-12-07  4:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2022-12-05 21:08 UTC (permalink / raw)
  To: Rasmus Villemoes, Joakim Zhang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Andrew Lunn
  Cc: Greg Ungerer, netdev, linux-kernel

On 12/5/22 12:46, Rasmus Villemoes 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.
> 
> Fixes: df727d4547de (net: fec: don't reset irq coalesce settings to defaults on "ip link up")
> Reported-by: Greg Ungerer <gregungerer@westnet.com.au>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>   drivers/net/ethernet/freescale/fec_main.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 2ca2b61b451f..23e1a94b9ce4 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -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!
-- 
Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: fec: properly guard irq coalesce setup
  2022-12-05 20:46 [PATCH] net: fec: properly guard irq coalesce setup Rasmus Villemoes
  2022-12-05 21:08 ` Florian Fainelli
@ 2022-12-06  6:16 ` Alexander Stein
  2022-12-06  8:23   ` Rasmus Villemoes
  2022-12-07  4:30 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Alexander Stein @ 2022-12-06  6:16 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Joakim Zhang, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Rasmus Villemoes, Greg Ungerer, netdev,
	linux-kernel

Am Montag, 5. Dezember 2022, 21:46:04 CET schrieb 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.
> 
> 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 <gregungerer@westnet.com.au>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c index
> 2ca2b61b451f..23e1a94b9ce4 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: fec: properly guard irq coalesce setup
  2022-12-06  6:16 ` Alexander Stein
@ 2022-12-06  8:23   ` Rasmus Villemoes
  0 siblings, 0 replies; 5+ messages in thread
From: Rasmus Villemoes @ 2022-12-06  8:23 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Joakim Zhang, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Greg Ungerer, netdev, linux-kernel

On 06/12/2022 07.16, Alexander Stein wrote:
> Am Montag, 5. Dezember 2022, 21:46:04 CET schrieb 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.
>>
>> 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 <gregungerer@westnet.com.au>
>> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>> ---
>>  drivers/net/ethernet/freescale/fec_main.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>> b/drivers/net/ethernet/freescale/fec_main.c index
>> 2ca2b61b451f..23e1a94b9ce4 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -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?

Yeah, I did consider that (see
https://lore.kernel.org/netdev/72eb4e63-10a8-702b-1113-7588fcade9fc@rasmusvillemoes.dk/).
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: fec: properly guard irq coalesce setup
  2022-12-05 20:46 [PATCH] net: fec: properly guard irq coalesce setup Rasmus Villemoes
  2022-12-05 21:08 ` Florian Fainelli
  2022-12-06  6:16 ` Alexander Stein
@ 2022-12-07  4:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-07  4:30 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: qiangqing.zhang, davem, edumazet, kuba, pabeni, andrew,
	gregungerer, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-07  4:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 20:46 [PATCH] net: fec: properly guard irq coalesce setup Rasmus Villemoes
2022-12-05 21:08 ` Florian Fainelli
2022-12-06  6:16 ` Alexander Stein
2022-12-06  8:23   ` Rasmus Villemoes
2022-12-07  4:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).