> 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
Good idea! Yes, then patch 2 also wouldn't be required.
>
>
> > >
> > >
> > > > 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
> >