From: David Laight <david.laight.linux@gmail.com>
To: Srujana Challa <schalla@marvell.com>
Cc: <netdev@vger.kernel.org>, <virtualization@lists.linux.dev>,
<pabeni@redhat.com>, <mst@redhat.com>, <jasowang@redhat.com>,
<xuanzhuo@linux.alibaba.com>, <eperezma@redhat.com>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<ndabilpuram@marvell.com>, <kshankar@marvell.com>
Subject: Re: [PATCH net-next,2/2] virtio_net: replace RSS key size max check with BUILD_BUG_ON
Date: Wed, 25 Feb 2026 14:50:27 +0000 [thread overview]
Message-ID: <20260225145027.29d666ac@pumpkin> (raw)
In-Reply-To: <20260224065850.962826-2-schalla@marvell.com>
On Tue, 24 Feb 2026 12:28:50 +0530
Srujana Challa <schalla@marvell.com> 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 <schalla@marvell.com>
> ---
> 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?
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.
David
> }
>
> return 0;
next prev parent reply other threads:[~2026-02-25 14:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 6:58 [PATCH net,v4,1/2] virtio_net: Improve RSS key size validation and use NETDEV_RSS_KEY_LEN Srujana Challa
2026-02-24 6:58 ` [PATCH net-next,2/2] virtio_net: replace RSS key size max check with BUILD_BUG_ON Srujana Challa
2026-02-25 9:11 ` Xuan Zhuo
2026-02-25 9:24 ` Michael S. Tsirkin
2026-02-25 9:30 ` Xuan Zhuo
2026-02-25 9:33 ` Michael S. Tsirkin
2026-02-25 9:36 ` Xuan Zhuo
2026-02-25 9:47 ` Michael S. Tsirkin
2026-02-25 9:52 ` Xuan Zhuo
2026-02-25 10:01 ` Michael S. Tsirkin
2026-02-25 10:05 ` Michael S. Tsirkin
2026-02-25 12:13 ` [EXTERNAL] " Srujana Challa
2026-02-25 12:18 ` Michael S. Tsirkin
2026-02-25 12:29 ` Srujana Challa
2026-02-25 12:35 ` Michael S. Tsirkin
2026-02-25 14:50 ` David Laight [this message]
2026-02-25 14:52 ` Michael S. Tsirkin
2026-02-25 10:03 ` [PATCH net,v4,1/2] virtio_net: Improve RSS key size validation and use NETDEV_RSS_KEY_LEN Michael S. Tsirkin
2026-02-25 12:22 ` [EXTERNAL] " Srujana Challa
2026-02-25 12:24 ` Michael S. Tsirkin
2026-02-25 12:34 ` Srujana Challa
2026-02-25 12:37 ` Michael S. Tsirkin
2026-02-25 12:47 ` Srujana Challa
2026-02-25 12:52 ` Michael S. Tsirkin
2026-02-25 12:56 ` Srujana Challa
2026-02-25 13:21 ` Michael S. Tsirkin
2026-02-25 13:31 ` Srujana Challa
2026-02-25 13:57 ` Michael S. Tsirkin
2026-02-26 12:38 ` Srujana Challa
-- strict thread matches above, loose matches on Subject: below --
2026-02-24 4:52 Srujana Challa
2026-02-24 4:52 ` [PATCH net-next,2/2] virtio_net: replace RSS key size max check with BUILD_BUG_ON Srujana Challa
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=20260225145027.29d666ac@pumpkin \
--to=david.laight.linux@gmail.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=mst@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.