From: "Michael S. Tsirkin" <mst@redhat.com>
To: Srujana Challa <schalla@marvell.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"virtualization@lists.linux.dev" <virtualization@lists.linux.dev>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"jasowang@redhat.com" <jasowang@redhat.com>,
"xuanzhuo@linux.alibaba.com" <xuanzhuo@linux.alibaba.com>,
"eperezma@redhat.com" <eperezma@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>,
Shiva Shankar Kommula <kshankar@marvell.com>
Subject: Re: [EXTERNAL] Re: [PATCH v2 net-next] virtio_net: Improve RSS key size validation and use NETDEV_RSS_KEY_LEN
Date: Wed, 11 Feb 2026 04:36:59 -0500 [thread overview]
Message-ID: <20260211043542-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CH3PR18MB637977B15CD77E0884DF56B1A063A@CH3PR18MB6379.namprd18.prod.outlook.com>
On Wed, Feb 11, 2026 at 09:33:26AM +0000, Srujana Challa wrote:
> > On Wed, Feb 11, 2026 at 07:44:54AM +0000, Srujana Challa wrote:
> > > > On Fri, Feb 06, 2026 at 07:13:08PM -0800, Jakub Kicinski wrote:
> > > > > On Fri, 6 Feb 2026 17:31:54 +0530 Srujana Challa wrote:
> > > > > > Replace hardcoded RSS max key size limit with NETDEV_RSS_KEY_LEN
> > > > > > to align with kernel's standard RSS key length. Add validation
> > > > > > for RSS key size against spec minimum (40 bytes) and driver
> > > > > > maximum. When validation fails, gracefully disable RSS features
> > > > > > and continue initialization rather than failing completely.
> > > > >
> > > > > Hm, FWIW clang says:
> > > > >
> > > > > drivers/net/virtio_net.c:6841:31: warning: result of comparison of
> > > > > constant
> > > > 256 with expression of type 'u8' (aka 'unsigned char') is always
> > > > false [- Wtautological-constant-out-of-range-compare]
> > > > > 6841 | } else if (vi->rss_key_size >
> > VIRTIO_NET_RSS_MAX_KEY_SIZE)
> > > > {
> > > > > | ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > >
> > > > > Which is kinda annoying because the value was increased in net-next.
> > > > > If Machael wants this backported then we need to keep the check
> > > > > and follow up in net-next? We could try to cast the u32 away but
> > > > > that feels dirty..
> > > >
> > > >
> > > > I'd say yes. the warning is harmless.
> > > > so
> > > > patch 1 - this code
> > > > patch 2 - replace with BUILD_BUG_ON
> > > >
> > > > but i ask then whether this code was actually tested against net-next.
> > > Yes, tested against net-next (before NETDEV_RSS_KEY_LEN was changed to
> > 256).
> > > BUILD_BUG_ON would always fail as-is on net-next since rss_key_size is u8.
> >
> > BUILD_BUG_ON(type_max(vi->rss_key_size) >=
> > VIRTIO_NET_RSS_MAX_KEY_SIZE)
> >
> > why would it fail?
> I was assuming BUILD_BUG_ON was intended to catch the type mismatch
> (when VIRTIO_NET_RSS_MAX_KEY_SIZE exceeds what u8 can hold). I understand
> now - thanks for clarifying!
maybe we should just
#define VIRTIO_NET_RSS_MAX_KEY_SIZE type_max(vi->rss_key_size) + 1
> >
> >
> > > Can we cast the comparison to u32 instead?
> > > Thanks!
> > >
> > > >
> > > > --
> > > > MST
> > >
> >
> > forcing compiler to generate code where we do not need any really seems silly.
> >
> > --
> > MST
>
next prev parent reply other threads:[~2026-02-11 9:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 12:01 [PATCH v2 net-next] virtio_net: Improve RSS key size validation and use NETDEV_RSS_KEY_LEN Srujana Challa
2026-02-06 15:02 ` Michael S. Tsirkin
2026-02-11 7:22 ` [EXTERNAL] " Srujana Challa
2026-02-07 3:13 ` Jakub Kicinski
2026-02-07 9:56 ` Michael S. Tsirkin
2026-02-11 7:44 ` [EXTERNAL] " Srujana Challa
2026-02-11 8:09 ` Michael S. Tsirkin
2026-02-11 9:33 ` Srujana Challa
2026-02-11 9:36 ` Michael S. Tsirkin [this message]
2026-02-11 9:48 ` Srujana Challa
2026-02-07 10:36 ` Michael S. Tsirkin
2026-02-07 5:03 ` kernel test robot
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=20260211043542-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kshankar@marvell.com \
--cc=kuba@kernel.org \
--cc=ndabilpuram@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=schalla@marvell.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/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