From: David Laight <David.Laight@ACULAB.COM>
To: 'Eric Dumazet' <edumazet@google.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Arnd Bergmann <arnd@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
"Arnd Bergmann" <arnd@arndb.de>,
"David S. Miller" <davem@davemloft.net>,
"Paolo Abeni" <pabeni@redhat.com>,
Nikolay Aleksandrov <razor@blackwall.org>,
"Jason Xing" <kerneljasonxing@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
Date: Sat, 1 Apr 2023 18:20:54 +0000 [thread overview]
Message-ID: <5c940a6c29674b2986e4e9be1c2e4b39@AcuMS.aculab.com> (raw)
In-Reply-To: <CANn89iLcgesDzLvvoAhDSFgmKz_1VcMNOTA=F8rDXzLmOSuTvw@mail.gmail.com>
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)
prev parent reply other threads:[~2023-04-01 18:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5c940a6c29674b2986e4e9be1c2e4b39@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=aleksander.lobakin@intel.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox