bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heng Qi <hengqi@linux.alibaba.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	Jason Wang <jasowang@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>
Subject: Re: [PATCH net-next 4/4] virtio-net: remove F_GUEST_CSUM check for XDP loading
Date: Mon, 19 Jun 2023 20:41:54 +0800	[thread overview]
Message-ID: <20230619124154.GC74977@h68b04307.sqa.eu95> (raw)
In-Reply-To: <20230619071347-mutt-send-email-mst@kernel.org>

On Mon, Jun 19, 2023 at 07:16:20AM -0400, Michael S. Tsirkin wrote:
> On Mon, Jun 19, 2023 at 06:57:38PM +0800, Heng Qi wrote:
> > Lay the foundation for the subsequent patch
> 
> which subsequent patch? this is the last one in series.
> 
> > to complete the coexistence
> > of XDP and virtio-net guest csum.
> > 
> > Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
> > Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> > ---
> >  drivers/net/virtio_net.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index 25b486ab74db..79471de64b56 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -60,7 +60,6 @@ static const unsigned long guest_offloads[] = {
> >  	VIRTIO_NET_F_GUEST_TSO6,
> >  	VIRTIO_NET_F_GUEST_ECN,
> >  	VIRTIO_NET_F_GUEST_UFO,
> > -	VIRTIO_NET_F_GUEST_CSUM,
> >  	VIRTIO_NET_F_GUEST_USO4,
> >  	VIRTIO_NET_F_GUEST_USO6,
> >  	VIRTIO_NET_F_GUEST_HDRLEN
> 
> What is this doing? Drop support for VIRTIO_NET_F_GUEST_CSUM? Why?

guest_offloads[] is used by the VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET
command to switch features when XDP is loaded/unloaded.

If the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature is negotiated:
1. When XDP is loaded, virtnet_xdp_set() uses virtnet_clear_guest_offloads()
to automatically turn off the features in guest_offloads[].

2. when XDP is unloaded, virtnet_xdp_set() uses virtnet_restore_guest_offloads()
to automatically restore the features in guest_offloads[].

Now, this work no longer makes XDP and _F_GUEST_CSUM mutually
exclusive, so this patch removed the _F_GUEST_CSUM from guest_offloads[].

> This will disable all of guest offloads I think ..

No. This doesn't change the dependencies of other features on
_F_GUEST_CSUM. Removing _F_GUEST_CSUM here does not mean that other
features that depend on it will be turned off at the same time, such as
_F_GUEST_TSO{4,6}, F_GUEST_USO{4,6}, etc.

Thanks.

> 
> 
> > @@ -3522,10 +3521,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog,
> >  	        virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) ||
> >  	        virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) ||
> >  		virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) ||
> > -		virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM) ||
> >  		virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO4) ||
> >  		virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO6))) {
> > -		NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing GRO_HW/CSUM, disable GRO_HW/CSUM first");
> > +		NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing GRO_HW, disable GRO_HW first");
> >  		return -EOPNOTSUPP;
> >  	}
> >  
> > -- 
> > 2.19.1.6.gb485710b

  reply	other threads:[~2023-06-19 12:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19 10:57 [PATCH net-next 0/4] virtio-net: avoid XDP and _F_GUEST_CSUM Heng Qi
2023-06-19 10:57 ` [PATCH net-next 1/4] virtio-net: a helper for probing the pseudo-header checksum Heng Qi
2023-06-19 12:30   ` kernel test robot
2023-06-19 12:30   ` kernel test robot
2023-06-19 10:57 ` [PATCH net-next 2/4] virtio-net: reprobe csum related fields for skb passed by XDP Heng Qi
2023-06-19 11:27   ` Michael S. Tsirkin
2023-06-19 12:29     ` Heng Qi
2023-06-19 13:32   ` kernel test robot
2023-06-19 10:57 ` [PATCH net-next 3/4] virtio-net: support coexistence of XDP and _F_GUEST_CSUM Heng Qi
2023-06-19 11:26   ` Michael S. Tsirkin
2023-06-19 12:31     ` Heng Qi
2023-06-20  3:24     ` Heng Qi
2023-06-20 10:50       ` Michael S. Tsirkin
2023-06-20 11:01         ` Heng Qi
2023-06-20 12:10           ` Michael S. Tsirkin
2023-06-20 14:15             ` Heng Qi
2023-06-19 10:57 ` [PATCH net-next 4/4] virtio-net: remove F_GUEST_CSUM check for XDP loading Heng Qi
2023-06-19 11:16   ` Michael S. Tsirkin
2023-06-19 12:41     ` Heng Qi [this message]
2023-06-19 14:33       ` Michael S. Tsirkin
2023-06-19 15:43         ` Heng Qi
2023-06-19 18:36           ` Michael S. Tsirkin

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=20230619124154.GC74977@h68b04307.sqa.eu95 \
    --to=hengqi@linux.alibaba.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).