From: Zhud <zhud@hygon.cn>
To: Jason Wang <jasowang@redhat.com>
Cc: "mst@redhat.com" <mst@redhat.com>,
"xuanzhuo@linux.alibaba.com" <xuanzhuo@linux.alibaba.com>,
"eperezma@redhat.com" <eperezma@redhat.com>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"virtualization@lists.linux.dev" <virtualization@lists.linux.dev>,
Jing Li <lijing@hygon.cn>, Zhiwei Ying <yingzhiwei@hygon.cn>
Subject: RE: [PATCH net] virtio-net: clear NETIF_F_GRO_HW if no GRO-related offloads are capable
Date: Fri, 13 Mar 2026 06:22:14 +0000 [thread overview]
Message-ID: <a0aa07c8b6a2423aa1e363c09b54392d@hygon.cn> (raw)
In-Reply-To: <CACGkMEvwR2WWyKvho-WU=_06OmWsYTSDSkML9JS9pSkzOQVkTA@mail.gmail.com>
> On Fri, Mar 13, 2026 at 9:37 AM Di Zhu <zhud@hygon.cn> wrote:
> >
> > Although VIRTIO_NET_F_CTRL_GUEST_OFFLOADS is negotiated, which
> > indicates the device supports dynamic control of guest offloads, it
> > does not necessarily mean the device supports specific hardware GRO features.
> >
> > If none of the features defined in GUEST_OFFLOAD_GRO_HW_MASK (such as
> > TSO4, TSO6, or UFO) are present in vi->guest_offloads_capable, the
> > device effectively lacks the hardware capability to perform GRO.
> >
> > In this case, NETIF_F_GRO_HW should be cleared from dev->hw_features
> > to prevent the stack from attempting to enable an unsupported hardware
> > offload configuration.
> >
> > Fixes: a02e8964eaf9 ("virtio-net: ethtool configurable LRO")
> > Signed-off-by: Di Zhu <zhud@hygon.cn>
> > ---
> > drivers/net/virtio_net.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index
> > 72d6a9c6a5a2..49a60af684d5 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -7058,6 +7058,9 @@ static int virtnet_probe(struct virtio_device *vdev)
> > }
> > vi->guest_offloads_capable = vi->guest_offloads;
> >
> > + if (!(vi->guest_offloads_capable & GUEST_OFFLOAD_GRO_HW_MASK))
> > + dev->hw_features &= ~NETIF_F_GRO_HW;
> > +
>
> It looks to me the root cause is this during probe?
>
> if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS))
> dev->hw_features |= NETIF_F_GRO_HW;
>
> Thanks
Exactly. It seems the code blindly enables NETIF_F_GRO_HW as long as the
control channel is present, without verifying if the backend actually supports the
offload features.
>
> > rtnl_unlock();
> >
> > err = virtnet_cpu_notif_add(vi);
> > --
> > 2.34.1
> >
> >
>
prev parent reply other threads:[~2026-03-13 6:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 1:30 [PATCH net] virtio-net: clear NETIF_F_GRO_HW if no GRO-related offloads are capable Di Zhu
2026-03-13 6:10 ` Jason Wang
2026-03-13 6:22 ` Zhud [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=a0aa07c8b6a2423aa1e363c09b54392d@hygon.cn \
--to=zhud@hygon.cn \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=lijing@hygon.cn \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
--cc=yingzhiwei@hygon.cn \
/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