Message ID | 20240618075643.24867-11-xuanzhuo@linux.alibaba.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | virtio-net: support AF_XDP zero copy | expand |
On Tue, 2024-06-18 at 15:56 +0800, Xuan Zhuo wrote: > Release the xsk buffer, when the queue is releasing or the queue is > resizing. > > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> > --- > drivers/net/virtio_net.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index cfa106aa8039..33695b86bd99 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -967,6 +967,11 @@ static void virtnet_rq_unmap_free_buf(struct virtqueue *vq, void *buf) > > rq = &vi->rq[i]; > > + if (rq->xsk.pool) { > + xsk_buff_free((struct xdp_buff *)buf); > + return; > + } > + > if (!vi->big_packets || vi->mergeable_rx_bufs) > virtnet_rq_unmap(rq, buf, 0); I'm under the impression this should be squashed in a previous patch, likely "virtio_net: xsk: bind/unbind xsk for rx" Thanks, Paolo
On Thu, Jun 20, 2024 at 12:46:24PM +0200, Paolo Abeni wrote: > On Tue, 2024-06-18 at 15:56 +0800, Xuan Zhuo wrote: > > Release the xsk buffer, when the queue is releasing or the queue is > > resizing. > > > > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> > > --- > > drivers/net/virtio_net.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > index cfa106aa8039..33695b86bd99 100644 > > --- a/drivers/net/virtio_net.c > > +++ b/drivers/net/virtio_net.c > > @@ -967,6 +967,11 @@ static void virtnet_rq_unmap_free_buf(struct virtqueue *vq, void *buf) > > > > rq = &vi->rq[i]; > > > > + if (rq->xsk.pool) { > > + xsk_buff_free((struct xdp_buff *)buf); > > + return; > > + } > > + > > if (!vi->big_packets || vi->mergeable_rx_bufs) > > virtnet_rq_unmap(rq, buf, 0); > > > I'm under the impression this should be squashed in a previous patch, > likely "virtio_net: xsk: bind/unbind xsk for rx" > > Thanks, > > Paolo agreed, looks weird.
On Thu, 20 Jun 2024 12:46:24 +0200, Paolo Abeni <pabeni@redhat.com> wrote: > On Tue, 2024-06-18 at 15:56 +0800, Xuan Zhuo wrote: > > Release the xsk buffer, when the queue is releasing or the queue is > > resizing. > > > > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> > > --- > > drivers/net/virtio_net.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > index cfa106aa8039..33695b86bd99 100644 > > --- a/drivers/net/virtio_net.c > > +++ b/drivers/net/virtio_net.c > > @@ -967,6 +967,11 @@ static void virtnet_rq_unmap_free_buf(struct virtqueue *vq, void *buf) > > > > rq = &vi->rq[i]; > > > > + if (rq->xsk.pool) { > > + xsk_buff_free((struct xdp_buff *)buf); > > + return; > > + } > > + > > if (!vi->big_packets || vi->mergeable_rx_bufs) > > virtnet_rq_unmap(rq, buf, 0); > > > I'm under the impression this should be squashed in a previous patch, > likely "virtio_net: xsk: bind/unbind xsk for rx" OK. Thanks. > > Thanks, > > Paolo >
On Tue, Jun 18, 2024 at 3:57 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote: > > Release the xsk buffer, when the queue is releasing or the queue is > resizing. > > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> > --- > drivers/net/virtio_net.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index cfa106aa8039..33695b86bd99 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -967,6 +967,11 @@ static void virtnet_rq_unmap_free_buf(struct virtqueue *vq, void *buf) > > rq = &vi->rq[i]; > > + if (rq->xsk.pool) { > + xsk_buff_free((struct xdp_buff *)buf); > + return; > + } It seems it needs to be squashed into previous patches? Thanks > + > if (!vi->big_packets || vi->mergeable_rx_bufs) > virtnet_rq_unmap(rq, buf, 0); > > -- > 2.32.0.3.g01195cf9f >
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index cfa106aa8039..33695b86bd99 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -967,6 +967,11 @@ static void virtnet_rq_unmap_free_buf(struct virtqueue *vq, void *buf) rq = &vi->rq[i]; + if (rq->xsk.pool) { + xsk_buff_free((struct xdp_buff *)buf); + return; + } + if (!vi->big_packets || vi->mergeable_rx_bufs) virtnet_rq_unmap(rq, buf, 0);
Release the xsk buffer, when the queue is releasing or the queue is resizing. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> --- drivers/net/virtio_net.c | 5 +++++ 1 file changed, 5 insertions(+)