Linux CAN drivers development
 help / color / mirror / Atom feed
* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
       [not found] <20220927132753.750069-1-kuba@kernel.org>
@ 2022-09-27 13:31 ` Marc Kleine-Budde
  2022-09-27 15:54 ` Jason A. Donenfeld
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2022-09-27 13:31 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, kvalo, johannes, linux-wireless,
	linux-can

[-- Attachment #1: Type: text/plain, Size: 877 bytes --]

On 27.09.2022 06:27:53, Jakub Kicinski wrote:
> We tell driver developers to always pass NAPI_POLL_WEIGHT
> as the weight to netif_napi_add(). This may be confusing
> to newcomers, drop the weight argument, those who really
> need to tweak the weight can use netif_napi_add_weight().
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  drivers/net/can/ctucanfd/ctucanfd_base.c      |  2 +-
>  drivers/net/can/ifi_canfd/ifi_canfd.c         |  2 +-
>  drivers/net/can/m_can/m_can.c                 |  3 +--

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for CAN

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
       [not found] <20220927132753.750069-1-kuba@kernel.org>
  2022-09-27 13:31 ` [PATCH net-next] net: drop the weight argument from netif_napi_add Marc Kleine-Budde
@ 2022-09-27 15:54 ` Jason A. Donenfeld
  2022-09-27 17:54 ` Eric Dumazet
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-09-27 15:54 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, kvalo, johannes, linux-wireless,
	mkl, linux-can

On Tue, Sep 27, 2022 at 06:27:53AM -0700, Jakub Kicinski wrote:
> We tell driver developers to always pass NAPI_POLL_WEIGHT
> as the weight to netif_napi_add(). This may be confusing
> to newcomers, drop the weight argument, those who really
> need to tweak the weight can use netif_napi_add_weight().
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  drivers/net/wireguard/peer.c                  |  3 +--
>
> diff --git a/drivers/net/wireguard/peer.c b/drivers/net/wireguard/peer.c
> index 1acd00ab2fbc..1cb502a932e0 100644
> --- a/drivers/net/wireguard/peer.c
> +++ b/drivers/net/wireguard/peer.c
> @@ -54,8 +54,7 @@ struct wg_peer *wg_peer_create(struct wg_device *wg,
>  	skb_queue_head_init(&peer->staged_packet_queue);
>  	wg_noise_reset_last_sent_handshake(&peer->last_sent_handshake);
>  	set_bit(NAPI_STATE_NO_BUSY_POLL, &peer->napi.state);
> -	netif_napi_add(wg->dev, &peer->napi, wg_packet_rx_poll,
> -		       NAPI_POLL_WEIGHT);
> +	netif_napi_add(wg->dev, &peer->napi, wg_packet_rx_poll);
>  	napi_enable(&peer->napi);
>  	list_add_tail(&peer->peer_list, &wg->peer_list);
>  	INIT_LIST_HEAD(&peer->allowedips_list);

For the wireguard part,

   Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>

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

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
       [not found] <20220927132753.750069-1-kuba@kernel.org>
  2022-09-27 13:31 ` [PATCH net-next] net: drop the weight argument from netif_napi_add Marc Kleine-Budde
  2022-09-27 15:54 ` Jason A. Donenfeld
@ 2022-09-27 17:54 ` Eric Dumazet
  2022-09-27 18:17   ` Jakub Kicinski
  2022-09-27 18:26   ` Dave Taht
  2022-09-29  2:20 ` patchwork-bot+netdevbpf
  2022-10-02 17:24 ` Guenter Roeck
  4 siblings, 2 replies; 10+ messages in thread
From: Eric Dumazet @ 2022-09-27 17:54 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: David Miller, netdev, Paolo Abeni, kvalo, Johannes Berg,
	linux-wireless, Marc Kleine-Budde, linux-can

On Tue, Sep 27, 2022 at 6:28 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> We tell driver developers to always pass NAPI_POLL_WEIGHT
> as the weight to netif_napi_add(). This may be confusing
> to newcomers, drop the weight argument, those who really
> need to tweak the weight can use netif_napi_add_weight().
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Sure, but this kind of patch makes backports harder.
Not sure how confused are newcomers about this NAPI_POLL_WEIGHT....

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

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
  2022-09-27 17:54 ` Eric Dumazet
@ 2022-09-27 18:17   ` Jakub Kicinski
  2022-09-27 18:38     ` Eric Dumazet
  2022-09-27 18:26   ` Dave Taht
  1 sibling, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2022-09-27 18:17 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, netdev, Paolo Abeni, kvalo, Johannes Berg,
	linux-wireless, Marc Kleine-Budde, linux-can, Jiri Pirko

On Tue, 27 Sep 2022 10:54:49 -0700 Eric Dumazet wrote:
> On Tue, Sep 27, 2022 at 6:28 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > We tell driver developers to always pass NAPI_POLL_WEIGHT
> > as the weight to netif_napi_add(). This may be confusing
> > to newcomers, drop the weight argument, those who really
> > need to tweak the weight can use netif_napi_add_weight().
> >
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>  
> 
> Sure, but this kind of patch makes backports harder.
> Not sure how confused are newcomers about this NAPI_POLL_WEIGHT....

I maintained this patch in my tree for a couple of releases (because 
I was waiting for the _weight() version to propagate to non-netdev
trees) and the conflicts were minor. Three or so cases of new features
added to drivers which touched the NAPI calls (WiFi and embedded) and
the strlcpy -> strscpy patch, and, well, why did we take that in if we
worry about backports...

NAPI weight was already dead when I started hacking on the kernel
10 years ago. I don't think it's reasonable to keep dead stuff 
in our APIs for backport's sake. Adding Jiri to CC in case I need
someone to back me up :)

The idea for this patch came because I was reviewing a driver which 
was trying to do something clever with the weight.


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

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
  2022-09-27 17:54 ` Eric Dumazet
  2022-09-27 18:17   ` Jakub Kicinski
@ 2022-09-27 18:26   ` Dave Taht
  1 sibling, 0 replies; 10+ messages in thread
From: Dave Taht @ 2022-09-27 18:26 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Jakub Kicinski, David Miller, netdev, Paolo Abeni, Kalle Valo,
	Johannes Berg, linux-wireless, Marc Kleine-Budde, linux-can

On Tue, Sep 27, 2022 at 11:21 AM Eric Dumazet <edumazet@google.com> wrote:
>
> On Tue, Sep 27, 2022 at 6:28 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > We tell driver developers to always pass NAPI_POLL_WEIGHT
> > as the weight to netif_napi_add(). This may be confusing
> > to newcomers, drop the weight argument, those who really
> > need to tweak the weight can use netif_napi_add_weight().
> >
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>
> Sure, but this kind of patch makes backports harder.
> Not sure how confused are newcomers about this NAPI_POLL_WEIGHT....

Ironically we've been fiddling with dramatically reducing the
NAPI_POLL_WEIGHT (8) on
several multicore arm systems, with good results, especially on ath10k.


-- 
FQ World Domination pending: https://blog.cerowrt.org/post/state_of_fq_codel/
Dave Täht CEO, TekLibre, LLC

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

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
  2022-09-27 18:17   ` Jakub Kicinski
@ 2022-09-27 18:38     ` Eric Dumazet
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Dumazet @ 2022-09-27 18:38 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: David Miller, netdev, Paolo Abeni, kvalo, Johannes Berg,
	linux-wireless, Marc Kleine-Budde, linux-can, Jiri Pirko

On Tue, Sep 27, 2022 at 11:18 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Tue, 27 Sep 2022 10:54:49 -0700 Eric Dumazet wrote:
> > On Tue, Sep 27, 2022 at 6:28 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > > We tell driver developers to always pass NAPI_POLL_WEIGHT
> > > as the weight to netif_napi_add(). This may be confusing
> > > to newcomers, drop the weight argument, those who really
> > > need to tweak the weight can use netif_napi_add_weight().
> > >
> > > Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> >
> > Sure, but this kind of patch makes backports harder.
> > Not sure how confused are newcomers about this NAPI_POLL_WEIGHT....
>
> I maintained this patch in my tree for a couple of releases (because
> I was waiting for the _weight() version to propagate to non-netdev
> trees) and the conflicts were minor. Three or so cases of new features
> added to drivers which touched the NAPI calls (WiFi and embedded) and
> the strlcpy -> strscpy patch, and, well, why did we take that in if we
> worry about backports...
>
> NAPI weight was already dead when I started hacking on the kernel
> 10 years ago. I don't think it's reasonable to keep dead stuff
> in our APIs for backport's sake. Adding Jiri to CC in case I need
> someone to back me up :)
>
> The idea for this patch came because I was reviewing a driver which
> was trying to do something clever with the weight.
>

No hard feelings, but the recent removal of netif_tx_napi_add() added
extra work for some of us ;)

Keeping around few helpers to keep API a bit stable would help I think.

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

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
       [not found] <20220927132753.750069-1-kuba@kernel.org>
                   ` (2 preceding siblings ...)
  2022-09-27 17:54 ` Eric Dumazet
@ 2022-09-29  2:20 ` patchwork-bot+netdevbpf
  2022-10-02 17:24 ` Guenter Roeck
  4 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-29  2:20 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, kvalo, johannes, linux-wireless,
	mkl, linux-can

Hello:

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

On Tue, 27 Sep 2022 06:27:53 -0700 you wrote:
> We tell driver developers to always pass NAPI_POLL_WEIGHT
> as the weight to netif_napi_add(). This may be confusing
> to newcomers, drop the weight argument, those who really
> need to tweak the weight can use netif_napi_add_weight().
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> 
> [...]

Here is the summary with links:
  - [net-next] net: drop the weight argument from netif_napi_add
    https://git.kernel.org/netdev/net-next/c/b48b89f9c189

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] 10+ messages in thread

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
       [not found] <20220927132753.750069-1-kuba@kernel.org>
                   ` (3 preceding siblings ...)
  2022-09-29  2:20 ` patchwork-bot+netdevbpf
@ 2022-10-02 17:24 ` Guenter Roeck
  2022-10-02 17:59   ` Jakub Kicinski
  4 siblings, 1 reply; 10+ messages in thread
From: Guenter Roeck @ 2022-10-02 17:24 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, kvalo, johannes, linux-wireless,
	mkl, linux-can

On Tue, Sep 27, 2022 at 06:27:53AM -0700, Jakub Kicinski wrote:
> We tell driver developers to always pass NAPI_POLL_WEIGHT
> as the weight to netif_napi_add(). This may be confusing
> to newcomers, drop the weight argument, those who really
> need to tweak the weight can use netif_napi_add_weight().
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

That seems to have missed some (or at least one) file(s).

Building mips:cavium_octeon_defconfig ... failed
--------------
Error log:
drivers/net/ethernet/cavium/octeon/octeon_mgmt.c: In function 'octeon_mgmt_probe':
drivers/net/ethernet/cavium/octeon/octeon_mgmt.c:1399:9: error: too many arguments to function 'netif_napi_add'
 1399 |         netif_napi_add(netdev, &p->napi, octeon_mgmt_napi_poll,
      |         ^~~~~~~~~~~~~~
In file included from include/linux/etherdevice.h:21,
                 from drivers/net/ethernet/cavium/octeon/octeon_mgmt.c:11:
include/linux/netdevice.h:2562:1: note: declared here
 2562 | netif_napi_add(struct net_device *dev, struct napi_struct *napi,

Guenter

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

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
  2022-10-02 17:24 ` Guenter Roeck
@ 2022-10-02 17:59   ` Jakub Kicinski
  2022-10-02 23:02     ` Guenter Roeck
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2022-10-02 17:59 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: davem, netdev, edumazet, pabeni, kvalo, johannes, linux-wireless,
	mkl, linux-can

On Sun, 2 Oct 2022 10:24:27 -0700 Guenter Roeck wrote:
> On Tue, Sep 27, 2022 at 06:27:53AM -0700, Jakub Kicinski wrote:
> > We tell driver developers to always pass NAPI_POLL_WEIGHT
> > as the weight to netif_napi_add(). This may be confusing
> > to newcomers, drop the weight argument, those who really
> > need to tweak the weight can use netif_napi_add_weight().
> > 
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>  
> 
> That seems to have missed some (or at least one) file(s).
> 
> Building mips:cavium_octeon_defconfig ... failed
> --------------
> Error log:
> drivers/net/ethernet/cavium/octeon/octeon_mgmt.c: In function 'octeon_mgmt_probe':
> drivers/net/ethernet/cavium/octeon/octeon_mgmt.c:1399:9: error: too many arguments to function 'netif_napi_add'
>  1399 |         netif_napi_add(netdev, &p->napi, octeon_mgmt_napi_poll,
>       |         ^~~~~~~~~~~~~~
> In file included from include/linux/etherdevice.h:21,
>                  from drivers/net/ethernet/cavium/octeon/octeon_mgmt.c:11:
> include/linux/netdevice.h:2562:1: note: declared here
>  2562 | netif_napi_add(struct net_device *dev, struct napi_struct *napi,

Fix sent, sorry. I don't see any more problems grepping again now..

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

* Re: [PATCH net-next] net: drop the weight argument from netif_napi_add
  2022-10-02 17:59   ` Jakub Kicinski
@ 2022-10-02 23:02     ` Guenter Roeck
  0 siblings, 0 replies; 10+ messages in thread
From: Guenter Roeck @ 2022-10-02 23:02 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, kvalo, johannes, linux-wireless,
	mkl, linux-can

On 10/2/22 10:59, Jakub Kicinski wrote:
> On Sun, 2 Oct 2022 10:24:27 -0700 Guenter Roeck wrote:
>> On Tue, Sep 27, 2022 at 06:27:53AM -0700, Jakub Kicinski wrote:
>>> We tell driver developers to always pass NAPI_POLL_WEIGHT
>>> as the weight to netif_napi_add(). This may be confusing
>>> to newcomers, drop the weight argument, those who really
>>> need to tweak the weight can use netif_napi_add_weight().
>>>
>>> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>>
>> That seems to have missed some (or at least one) file(s).
>>
>> Building mips:cavium_octeon_defconfig ... failed
>> --------------
>> Error log:
>> drivers/net/ethernet/cavium/octeon/octeon_mgmt.c: In function 'octeon_mgmt_probe':
>> drivers/net/ethernet/cavium/octeon/octeon_mgmt.c:1399:9: error: too many arguments to function 'netif_napi_add'
>>   1399 |         netif_napi_add(netdev, &p->napi, octeon_mgmt_napi_poll,
>>        |         ^~~~~~~~~~~~~~
>> In file included from include/linux/etherdevice.h:21,
>>                   from drivers/net/ethernet/cavium/octeon/octeon_mgmt.c:11:
>> include/linux/netdevice.h:2562:1: note: declared here
>>   2562 | netif_napi_add(struct net_device *dev, struct napi_struct *napi,
> 
> Fix sent, sorry. I don't see any more problems grepping again now..

I think that was the only one. The following coccinelle script helps.

Guenter

---
virtual report

@s@
expression a, b, c, d;
position p;
@@

   netif_napi_add@p(a, b, c, d);

@script:python depends on report@
p << s.p;
@@
print "Bad netif_napi_add() call at %s:%s" % (p[0].file, p[0].line)

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

end of thread, other threads:[~2022-10-02 23:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220927132753.750069-1-kuba@kernel.org>
2022-09-27 13:31 ` [PATCH net-next] net: drop the weight argument from netif_napi_add Marc Kleine-Budde
2022-09-27 15:54 ` Jason A. Donenfeld
2022-09-27 17:54 ` Eric Dumazet
2022-09-27 18:17   ` Jakub Kicinski
2022-09-27 18:38     ` Eric Dumazet
2022-09-27 18:26   ` Dave Taht
2022-09-29  2:20 ` patchwork-bot+netdevbpf
2022-10-02 17:24 ` Guenter Roeck
2022-10-02 17:59   ` Jakub Kicinski
2022-10-02 23:02     ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox