On Wed, Feb 25, 2026 at 02:50:27PM +0000, David Laight wrote:
> On Tue, 24 Feb 2026 12:28:50 +0530
> Srujana Challa <[email protected]> wrote:
> 
> > Since NETDEV_RSS_KEY_LEN was increased to 256 in net-next, use
> > BUILD_BUG_ON to enforce the limit at compile time and remove the
> > redundant runtime max check.
> > 
> > Signed-off-by: Srujana Challa <[email protected]>
> > ---
> >  drivers/net/virtio_net.c | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index eeefe8abc122..768ad5523dfa 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -6639,13 +6639,7 @@ static int virtnet_validate(struct virtio_device 
> > *vdev)
> >                     __virtio_clear_bit(vdev, VIRTIO_NET_F_RSS);
> >                     __virtio_clear_bit(vdev, VIRTIO_NET_F_HASH_REPORT);
> >             }
> > -           if (key_sz > NETDEV_RSS_KEY_LEN) {
> > -                   dev_warn(&vdev->dev,
> > -                            "rss_max_key_size=%u exceeds driver limit %u, 
> > disabling RSS\n",
> > -                            key_sz, NETDEV_RSS_KEY_LEN);
> > -                   __virtio_clear_bit(vdev, VIRTIO_NET_F_RSS);
> > -                   __virtio_clear_bit(vdev, VIRTIO_NET_F_HASH_REPORT);
> > -           }
> > +           BUILD_BUG_ON(type_max(key_sz) >= NETDEV_RSS_KEY_LEN);
> 
> type_max is horrid.
> I did read the later discussion (but it has fallen out of my brain)
> but isn't that check broken and/or backwards anyway?

it is just trying to say "i check at build time that hardware
key size will never exceed NETDEV_RSS_KEY_LEN just because it's not
large enough".

> I'd also question why you are using u8 for a local (I didn't find this
> version of the file), it will generate worse code that [unsigned] int.

that's hardware format. but yes it should be config->max_key_size or
whatever it is.

>       David
> 
> >     }
> >  
> >     return 0;


Reply via email to