netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
@ 2023-03-31  7:48 Arnd Bergmann
  2023-03-31  8:40 ` patchwork-bot+netdevbpf
  2023-03-31 15:08 ` Alexander Lobakin
  0 siblings, 2 replies; 7+ messages in thread
From: Arnd Bergmann @ 2023-03-31  7:48 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Paolo Abeni,
	Nikolay Aleksandrov, Jason Xing, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The type of MAX_SKB_FRAGS has changed recently, so the debug printk
needs to be updated:

drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface':
drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=]
 2084 |                 dev_err(dev, "tx-pool size too small, must be at least %ld\n",
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/ti/netcp_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 1bb596a9d8a2..dfdbcdeb991f 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -2081,7 +2081,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
 	netcp->tx_pool_region_id = temp[1];
 
 	if (netcp->tx_pool_size < MAX_SKB_FRAGS) {
-		dev_err(dev, "tx-pool size too small, must be at least %ld\n",
+		dev_err(dev, "tx-pool size too small, must be at least %d\n",
 			MAX_SKB_FRAGS);
 		ret = -ENODEV;
 		goto quit;
-- 
2.39.2


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

* Re: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
  2023-03-31  7:48 [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int' Arnd Bergmann
@ 2023-03-31  8:40 ` patchwork-bot+netdevbpf
  2023-03-31 21:44   ` Nathan Chancellor
  2023-03-31 15:08 ` Alexander Lobakin
  1 sibling, 1 reply; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-31  8:40 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: kuba, arnd, davem, edumazet, pabeni, razor, kerneljasonxing,
	netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 31 Mar 2023 09:48:56 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The type of MAX_SKB_FRAGS has changed recently, so the debug printk
> needs to be updated:
> 
> drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface':
> drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=]
>  2084 |                 dev_err(dev, "tx-pool size too small, must be at least %ld\n",
>       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> [...]

Here is the summary with links:
  - net: netcp: MAX_SKB_FRAGS is now 'int'
    https://git.kernel.org/netdev/net/c/c5b959eeb7f9

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

* Re: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
  2023-03-31  7:48 [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int' Arnd Bergmann
  2023-03-31  8:40 ` patchwork-bot+netdevbpf
@ 2023-03-31 15:08 ` Alexander Lobakin
  2023-03-31 16:58   ` Eric Dumazet
  1 sibling, 1 reply; 7+ messages in thread
From: Alexander Lobakin @ 2023-03-31 15:08 UTC (permalink / raw)
  To: Arnd Bergmann, Jakub Kicinski
  Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Paolo Abeni,
	Nikolay Aleksandrov, Jason Xing, netdev, linux-kernel

From: Arnd Bergmann <arnd@kernel.org>
Date: Fri, 31 Mar 2023 09:48:56 +0200

> From: Arnd Bergmann <arnd@arndb.de>
> 
> The type of MAX_SKB_FRAGS has changed recently, so the debug printk
> needs to be updated:
> 
> drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface':
> drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=]
>  2084 |                 dev_err(dev, "tx-pool size too small, must be at least %ld\n",
>       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/net/ethernet/ti/netcp_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
> index 1bb596a9d8a2..dfdbcdeb991f 100644
> --- a/drivers/net/ethernet/ti/netcp_core.c
> +++ b/drivers/net/ethernet/ti/netcp_core.c
> @@ -2081,7 +2081,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
>  	netcp->tx_pool_region_id = temp[1];
>  
>  	if (netcp->tx_pool_size < MAX_SKB_FRAGS) {
> -		dev_err(dev, "tx-pool size too small, must be at least %ld\n",
> +		dev_err(dev, "tx-pool size too small, must be at least %d\n",
>  			MAX_SKB_FRAGS);
>  		ret = -ENODEV;
>  		goto quit;

(not related to the actual fix)

I'd personally define %MAX_SKB_FRAGS as `(u32)CONFIG_MAX_SKB_FRAGS`.
It can't be below zero or above %U32_MAX and we have to define it
manually anyway, so why not cast to the type expected from it :D

Thanks,
Olek

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

* Re: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
  2023-03-31 15:08 ` Alexander Lobakin
@ 2023-03-31 16:58   ` Eric Dumazet
  2023-04-01 18:20     ` David Laight
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2023-03-31 16:58 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: Arnd Bergmann, Jakub Kicinski, Arnd Bergmann, David S. Miller,
	Paolo Abeni, Nikolay Aleksandrov, Jason Xing, netdev,
	linux-kernel

On Fri, Mar 31, 2023 at 5:08 PM Alexander Lobakin
<aleksander.lobakin@intel.com> wrote:
>
> From: Arnd Bergmann <arnd@kernel.org>
> Date: Fri, 31 Mar 2023 09:48:56 +0200
>
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The type of MAX_SKB_FRAGS has changed recently, so the debug printk
> > needs to be updated:
> >
> > drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface':
> > drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=]
> >  2084 |                 dev_err(dev, "tx-pool size too small, must be at least %ld\n",
> >       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/net/ethernet/ti/netcp_core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
> > index 1bb596a9d8a2..dfdbcdeb991f 100644
> > --- a/drivers/net/ethernet/ti/netcp_core.c
> > +++ b/drivers/net/ethernet/ti/netcp_core.c
> > @@ -2081,7 +2081,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
> >       netcp->tx_pool_region_id = temp[1];
> >
> >       if (netcp->tx_pool_size < MAX_SKB_FRAGS) {
> > -             dev_err(dev, "tx-pool size too small, must be at least %ld\n",
> > +             dev_err(dev, "tx-pool size too small, must be at least %d\n",
> >                       MAX_SKB_FRAGS);
> >               ret = -ENODEV;
> >               goto quit;
>
> (not related to the actual fix)
>
> I'd personally define %MAX_SKB_FRAGS as `(u32)CONFIG_MAX_SKB_FRAGS`.
> It can't be below zero or above %U32_MAX and we have to define it
> manually anyway, so why not cast to the type expected from it :D
>

Some files have the assumption MAX_SKB_FRAGS can be understood by the
C preprocessor.

#if MAX_SKB_FRAGS > 32
...

Kconfig does not allow to define unsigned int.
That would be the easiest way really...

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

* Re: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
  2023-03-31  8:40 ` patchwork-bot+netdevbpf
@ 2023-03-31 21:44   ` Nathan Chancellor
  2023-04-01  4:20     ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2023-03-31 21:44 UTC (permalink / raw)
  To: patchwork-bot+netdevbpf
  Cc: Arnd Bergmann, kuba, arnd, davem, edumazet, pabeni, razor,
	kerneljasonxing, netdev, linux-kernel

On Fri, Mar 31, 2023 at 08:40:18AM +0000, patchwork-bot+netdevbpf@kernel.org wrote:
> Hello:
> 
> This patch was applied to netdev/net.git (main)
> by David S. Miller <davem@davemloft.net>:
> 
> On Fri, 31 Mar 2023 09:48:56 +0200 you wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > The type of MAX_SKB_FRAGS has changed recently, so the debug printk
> > needs to be updated:
> > 
> > drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface':
> > drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=]
> >  2084 |                 dev_err(dev, "tx-pool size too small, must be at least %ld\n",
> >       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > [...]
> 
> Here is the summary with links:
>   - net: netcp: MAX_SKB_FRAGS is now 'int'
>     https://git.kernel.org/netdev/net/c/c5b959eeb7f9

net now warns:

  In file included from include/linux/device.h:15,
                   from include/linux/dma-mapping.h:7,
                   from include/linux/skbuff.h:28,
                   from include/linux/if_ether.h:19,
                   from include/linux/ethtool.h:18,
                   from include/linux/phy.h:16,
                   from include/linux/of_net.h:9,
                   from drivers/net/ethernet/ti/netcp_core.c:16:
  drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface':
  drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Werror=format=]
   2084 |                 dev_err(dev, "tx-pool size too small, must be at least %d\n",
        |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
    110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
        |                              ^~~
  include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
    144 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
        |                                                        ^~~~~~~
  drivers/net/ethernet/ti/netcp_core.c:2084:17: note: in expansion of macro 'dev_err'
   2084 |                 dev_err(dev, "tx-pool size too small, must be at least %d\n",
        |                 ^~~~~~~
  drivers/net/ethernet/ti/netcp_core.c:2084:73: note: format string is defined here
   2084 |                 dev_err(dev, "tx-pool size too small, must be at least %d\n",
        |                                                                        ~^
        |                                                                         |
        |                                                                         int
        |                                                                        %ld
  cc1: all warnings being treated as errors

The commit this patch is fixing is only in net-next and my patch to fix
this warning is already applied:

https://git.kernel.org/netdev/net-next/c/3292004c90c8

c5b959eeb7f9 should be reverted in net (I am running out of time today
otherwise I would just send a patch).

Cheers,
Nathan

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

* Re: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
  2023-03-31 21:44   ` Nathan Chancellor
@ 2023-04-01  4:20     ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2023-04-01  4:20 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: patchwork-bot+netdevbpf, Arnd Bergmann, arnd, davem, edumazet,
	pabeni, razor, kerneljasonxing, netdev, linux-kernel

On Fri, 31 Mar 2023 14:44:44 -0700 Nathan Chancellor wrote:
> The commit this patch is fixing is only in net-next and my patch to fix
> this warning is already applied:
> 
> https://git.kernel.org/netdev/net-next/c/3292004c90c8
> 
> c5b959eeb7f9 should be reverted in net (I am running out of time today
> otherwise I would just send a patch).

Sorry for the mix-up, cleaned up now.

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

* RE: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
  2023-03-31 16:58   ` Eric Dumazet
@ 2023-04-01 18:20     ` David Laight
  0 siblings, 0 replies; 7+ messages in thread
From: David Laight @ 2023-04-01 18:20 UTC (permalink / raw)
  To: 'Eric Dumazet', Alexander Lobakin
  Cc: Arnd Bergmann, Jakub Kicinski, Arnd Bergmann, David S. Miller,
	Paolo Abeni, Nikolay Aleksandrov, Jason Xing, netdev,
	linux-kernel

From: Eric Dumazet
> Sent: 31 March 2023 17:58
....
> > I'd personally define %MAX_SKB_FRAGS as `(u32)CONFIG_MAX_SKB_FRAGS`.
> > It can't be below zero or above %U32_MAX and we have to define it
> > manually anyway, so why not cast to the type expected from it :D
> >
> 
> Some files have the assumption MAX_SKB_FRAGS can be understood by the
> C preprocessor.
> 
> #if MAX_SKB_FRAGS > 32

...

You could use:
#define MAX_SKB_FRAGS (CONFIG_MAX_SKB_FRAGS + 0u)
to force the type to be 'unsigned int' while still leaving
a value that cpp groks.
(Or add 0ul to get the type back? to 'unsigned long'.)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

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

end of thread, other threads:[~2023-04-01 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31  7:48 [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int' Arnd Bergmann
2023-03-31  8:40 ` patchwork-bot+netdevbpf
2023-03-31 21:44   ` Nathan Chancellor
2023-04-01  4:20     ` Jakub Kicinski
2023-03-31 15:08 ` Alexander Lobakin
2023-03-31 16:58   ` Eric Dumazet
2023-04-01 18:20     ` David Laight

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).