[PATCH net-next v8 01/10] virtio_net: replace VIRTIO_XDP_HEADROOM by XDP_PACKET_HEADROOM

2024-07-08 Thread Xuan Zhuo
. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 0b4747e81464..d99898e44456 100644 --- a/drivers/net/virtio_net.c +++ b

[PATCH net-next v8 02/10] virtio_net: separate virtnet_rx_resize()

2024-07-08 Thread Xuan Zhuo
This patch separates two sub-functions from virtnet_rx_resize(): * virtnet_rx_pause * virtnet_rx_resume Then the subsequent reset rx for xsk can share these two functions. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 29 + 1 file

[PATCH net-next v8 03/10] virtio_net: separate virtnet_tx_resize()

2024-07-08 Thread Xuan Zhuo
This patch separates two sub-functions from virtnet_tx_resize(): * virtnet_tx_pause * virtnet_tx_resume Then the subsequent virtnet_tx_reset() can share these two functions. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 35 +-- 1

[PATCH net-next v8 04/10] virtio_net: separate receive_buf

2024-07-08 Thread Xuan Zhuo
This commit separates the function receive_buf(), then we wrap the logic of handling the skb to an independent function virtnet_receive_done(). The subsequent commit will reuse it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 62

[PATCH net-next v8 00/10] virtio-net: support AF_XDP zero copy

2024-07-08 Thread Xuan Zhuo
me code v1: 1. remove two virtio commits. Push this patchset to net-next 2. squash "virtio_net: virtnet_poll_tx support rescheduled" to xsk: support tx 3. fix some warnings Xuan Zhuo (10): virtio_net: replace VIRTIO_XDP_HEADROOM by XDP_PACKET_HEADROOM virtio_net: s

[PATCH net-next v8 08/10] virtio_net: xsk: rx: support fill with xsk buffer

2024-07-08 Thread Xuan Zhuo
Implement the logic of filling rq with XSK buffers. Signed-off-by: Xuan Zhuo --- v8: 1. update comment 2. return err from virtnet_add_recvbuf_xsk() when encounters error drivers/net/virtio_net.c | 70 +--- 1 file changed, 66 insertions(+), 4 deletions

[PATCH net-next v8 09/10] virtio_net: xsk: rx: support recv small mode

2024-07-08 Thread Xuan Zhuo
scattered inside merge and small (and big). So I think it is a good choice for us to put the xsk code into an independent function. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 176 +-- 1 file changed, 168 insertions(+), 8

[PATCH net-next v8 05/10] virtio_net: separate receive_mergeable

2024-07-08 Thread Xuan Zhuo
This commit separates the function receive_mergeable(), put the logic of appending frag to the skb as an independent function. The subsequent commit will reuse it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 77 1 file

[PATCH net-next v8 06/10] virtio_net: xsk: bind/unbind xsk for rx

2024-07-08 Thread Xuan Zhuo
This patch implement the logic of bind/unbind xsk pool to rq. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 134 +++ 1 file changed, 134 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index

[PATCH net-next v8 10/10] virtio_net: xsk: rx: support recv merge mode

2024-07-08 Thread Xuan Zhuo
Support AF-XDP for merge mode. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 144 +++ 1 file changed, 144 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index c9c65948b71f..b6323346208d 100644

[PATCH net-next v8 07/10] virtio_net: xsk: support wakeup

2024-07-08 Thread Xuan Zhuo
xsk wakeup is used to trigger the logic for xsk xmit by xsk framework or user. Virtio-net does not support to actively generate an interruption, so it tries to trigger tx NAPI on the local cpu. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 24

[RFC net-next 00/13] virtio-net: support AF_XDP zero copy (tx)

2024-07-15 Thread Xuan Zhuo
2837285936 But AF_XDP consumes more CPU for tx and rx napi(100% and 86%). Please review. Thanks. Xuan Zhuo (13): virtio_ring: introduce vring_need_unmap_buffer virtio_ring: split: harden dma unmap for indirect virtio_r

[RFC net-next 08/13] virtio_net: xsk: bind/unbind xsk for tx

2024-07-15 Thread Xuan Zhuo
This patch implement the logic of bind/unbind xsk pool to sq and rq. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 54 1 file changed, 54 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f5edd8be4668

[RFC net-next 03/13] virtio_ring: packed: harden dma unmap for indirect

2024-07-15 Thread Xuan Zhuo
1. this commit hardens dma unmap for indirect 2. the subsequent commit uses the struct extra to record whether the buffers need to be unmapped or not. So we need a struct extra for every desc, whatever it is indirect or not. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 57

[RFC net-next 02/13] virtio_ring: split: harden dma unmap for indirect

2024-07-15 Thread Xuan Zhuo
1. this commit hardens dma unmap for indirect 2. the subsequent commit uses the struct extra to record whether the buffers need to be unmapped or not. So we need a struct extra for every desc, whatever it is indirect or not. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 122

[RFC net-next 04/13] virtio_ring: perform premapped operations based on per-buffer

2024-07-15 Thread Xuan Zhuo
NULL, this indicates that the driver has performed DMA mapping in advance, allowing the Virtio core to directly utilize sg_dma_address(sg) without conducting any internal DMA mapping. Additionally, DMA unmap operations for this buffer will be bypassed. Suggested-by: Jason Wang Signed-off-by: Xuan

[RFC net-next 10/13] virtio_net: xsk: tx: support xmit xsk buffer

2024-07-15 Thread Xuan Zhuo
The driver's tx napi is very important for XSK. It is responsible for obtaining data from the XSK queue and sending it out. At the beginning, we need to trigger tx napi. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 127 ++- 1 file changed

[RFC net-next 11/13] virtio_net: xsk: tx: handle the transmitted xsk buffer

2024-07-15 Thread Xuan Zhuo
virtnet_free_old_xmit distinguishes three type ptr(skb, xdp frame, xsk buffer) by the last bits of the pointer. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 85 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/drivers/net

[RFC net-next 12/13] virtio_net: update tx timeout record

2024-07-15 Thread Xuan Zhuo
If send queue sent some packets, we update the tx timeout record to prevent the tx timeout. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index

[RFC net-next 05/13] virtio-net: rq submits premapped buffer per buffer

2024-07-15 Thread Xuan Zhuo
virtio-net rq submits premapped buffer per buffer. And removes the call of the virtnet_rq_set_premapped(). Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 31 --- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/net/virtio_net.c b

[RFC net-next 06/13] virtio_ring: remove API virtqueue_set_dma_premapped

2024-07-15 Thread Xuan Zhuo
Now, this API is useless. remove it. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 48 include/linux/virtio.h | 2 -- 2 files changed, 50 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index

[RFC net-next 07/13] virtio_net: refactor the xmit type

2024-07-15 Thread Xuan Zhuo
Because the af-xdp will introduce a new xmit type, so I refactor the xmit type mechanism first. We use the last two bits of the pointer to distinguish the xmit type, so we can distinguish four xmit types. Now we have three types: skb, orphan and xdp. Signed-off-by: Xuan Zhuo --- drivers/net

[RFC net-next 09/13] virtio_net: xsk: prevent disable tx napi

2024-07-15 Thread Xuan Zhuo
Since xsk's TX queue is consumed by TX NAPI, if sq is bound to xsk, then we must stop tx napi from being disabled. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_ne

[RFC net-next 01/13] virtio_ring: introduce vring_need_unmap_buffer

2024-07-15 Thread Xuan Zhuo
To make the code readable, introduce vring_need_unmap_buffer() to replace do_unmap. use_dma_api premapped -> vring_need_unmap_buffer() 1. false falsefalse 2. truefalsetrue 3. truetrue false Signed-off-by: Xuan Zhuo Acked-by: Jason W

[RFC net-next 13/13] virtio_net: xdp_features add NETDEV_XDP_ACT_XSK_ZEROCOPY

2024-07-15 Thread Xuan Zhuo
Now, we supported AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to xdp_features. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 38af9f0b632e..79bfc5231426 100644

Re: [RFC net-next 00/13] virtio-net: support AF_XDP zero copy (tx)

2024-07-22 Thread Xuan Zhuo
On Mon, 22 Jul 2024 17:42:04 -0700, Jakub Kicinski wrote: > On Mon, 22 Jul 2024 15:27:42 +0800 Jason Wang wrote: > > I wonder why this series is tagged as "RFC"? > > I guess it's because net-next is closed during merge window. YES. As I know, we can not post "PATCH" during merge window. So, I po

Re: [PATCH net] virtio_net: Avoid sending unnecessary vq coalescing commands

2024-07-29 Thread Xuan Zhuo
iver must not send vq notification coalescing commands if > VIRTIO_NET_F_VQ_NOTF_COAL is not negotiated. This limitation of course > applies to vq resize. > > Fixes: f61fe5f081cf ("virtio-net: fix the vq coalescing setting for vq > resize") > Signed-off-by: Heng Q

Re: [PATCH net-next v5 1/4] virtio_ring: enable premapped mode whatever use_dma_api

2024-08-17 Thread Xuan Zhuo
Hi, guys, I have a fix patch for this. Could anybody test it? Thanks. diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index af474cc191d0..426d68c2d01d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2492,13 +2492,15 @@ static unsigned int get_mergeable_bu

Re: [PATCH net-next v5 1/4] virtio_ring: enable premapped mode whatever use_dma_api

2024-08-19 Thread Xuan Zhuo
> and off are needed. I will post a PATCH, let we discuss under that. Thanks. > > Thanks, > -Siwei > > On 8/17/2024 6:20 AM, Xuan Zhuo wrote: > > Hi, guys, I have a fix patch for this. > > Could anybody test it? > > > > Thanks. > > > > diff

[PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-08-20 Thread Xuan Zhuo
..@oracle.com Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index c6af18948092..e5286a6da863 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_ne

[PATCH net-next 01/13] virtio_ring: introduce vring_need_unmap_buffer

2024-08-20 Thread Xuan Zhuo
To make the code readable, introduce vring_need_unmap_buffer() to replace do_unmap. use_dma_api premapped -> vring_need_unmap_buffer() 1. false falsefalse 2. truefalsetrue 3. truetrue false Signed-off-by: Xuan Zhuo Acked-by: Jason W

[PATCH net-next 00/13] virtio-net: support AF_XDP zero copy (tx)

2024-08-20 Thread Xuan Zhuo
2837285936 But AF_XDP consumes more CPU for tx and rx napi(100% and 86%). Please review. Thanks. Xuan Zhuo (13): virtio_ring: introduce vring_need_unmap_buffer virtio_ring: split: harden dma unmap for indirect virtio_r

[PATCH net-next 02/13] virtio_ring: split: harden dma unmap for indirect

2024-08-20 Thread Xuan Zhuo
1. this commit hardens dma unmap for indirect 2. the subsequent commit uses the struct extra to record whether the buffers need to be unmapped or not. So we need a struct extra for every desc, whatever it is indirect or not. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 122

[PATCH net-next 05/13] virtio-net: rq submits premapped buffer per buffer

2024-08-20 Thread Xuan Zhuo
virtio-net rq submits premapped buffer per buffer. And removes the call of the virtnet_rq_set_premapped(). Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 31 --- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/net/virtio_net.c b

[PATCH net-next 04/13] virtio_ring: perform premapped operations based on per-buffer

2024-08-20 Thread Xuan Zhuo
NULL, this indicates that the driver has performed DMA mapping in advance, allowing the Virtio core to directly utilize sg_dma_address(sg) without conducting any internal DMA mapping. Additionally, DMA unmap operations for this buffer will be bypassed. Suggested-by: Jason Wang Signed-off-by: Xuan

[PATCH net-next 07/13] virtio_net: refactor the xmit type

2024-08-20 Thread Xuan Zhuo
Because the af-xdp will introduce a new xmit type, so I refactor the xmit type mechanism first. We use the last two bits of the pointer to distinguish the xmit type, so we can distinguish four xmit types. Now we have three types: skb, orphan and xdp. Signed-off-by: Xuan Zhuo --- drivers/net

[PATCH net-next 09/13] virtio_net: xsk: prevent disable tx napi

2024-08-20 Thread Xuan Zhuo
Since xsk's TX queue is consumed by TX NAPI, if sq is bound to xsk, then we must stop tx napi from being disabled. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_ne

[PATCH net-next 10/13] virtio_net: xsk: tx: support xmit xsk buffer

2024-08-20 Thread Xuan Zhuo
The driver's tx napi is very important for XSK. It is responsible for obtaining data from the XSK queue and sending it out. At the beginning, we need to trigger tx napi. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 127 ++- 1 file changed

[PATCH net-next 08/13] virtio_net: xsk: bind/unbind xsk for tx

2024-08-20 Thread Xuan Zhuo
This patch implement the logic of bind/unbind xsk pool to sq and rq. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 54 1 file changed, 54 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 96abee36738b

[PATCH net-next 03/13] virtio_ring: packed: harden dma unmap for indirect

2024-08-20 Thread Xuan Zhuo
1. this commit hardens dma unmap for indirect 2. the subsequent commit uses the struct extra to record whether the buffers need to be unmapped or not. So we need a struct extra for every desc, whatever it is indirect or not. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 57

[PATCH net-next 13/13] virtio_net: xdp_features add NETDEV_XDP_ACT_XSK_ZEROCOPY

2024-08-20 Thread Xuan Zhuo
Now, we supported AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to xdp_features. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 28c5f9e77fa3..8e4578ec1937 100644

[PATCH net-next 12/13] virtio_net: update tx timeout record

2024-08-20 Thread Xuan Zhuo
If send queue sent some packets, we update the tx timeout record to prevent the tx timeout. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index

[PATCH net-next 11/13] virtio_net: xsk: tx: handle the transmitted xsk buffer

2024-08-20 Thread Xuan Zhuo
virtnet_free_old_xmit distinguishes three type ptr(skb, xdp frame, xsk buffer) by the last bits of the pointer. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 85 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/drivers/net

[PATCH net-next 06/13] virtio_ring: remove API virtqueue_set_dma_premapped

2024-08-20 Thread Xuan Zhuo
Now, this API is useless. remove it. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 48 include/linux/virtio.h | 2 -- 2 files changed, 50 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-08-28 Thread Xuan Zhuo
On Tue, 27 Aug 2024 11:38:45 +0800, Jason Wang wrote: > On Tue, Aug 20, 2024 at 3:19 PM Xuan Zhuo wrote: > > > > leads to regression on VM with the sysctl value of: > > > > - net.core.high_order_alloc_disable=1 > > > > which could see reliable crashes

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-08-28 Thread Xuan Zhuo
/2024 9:47 AM, Darren Kenny wrote: > > Hi Michael, > > > > On Tuesday, 2024-08-20 at 12:50:39 -04, Michael S. Tsirkin wrote: > >> On Tue, Aug 20, 2024 at 03:19:13PM +0800, Xuan Zhuo wrote: > >>> leads to regression on VM with the sysctl value of: > >>>

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-08-28 Thread Xuan Zhuo
On Thu, 29 Aug 2024 12:51:31 +0800, Jason Wang wrote: > On Wed, Aug 28, 2024 at 7:21 PM Xuan Zhuo wrote: > > > > On Tue, 27 Aug 2024 11:38:45 +0800, Jason Wang wrote: > > > On Tue, Aug 20, 2024 at 3:19 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-08-29 Thread Xuan Zhuo
On Thu, 29 Aug 2024 12:51:31 +0800, Jason Wang wrote: > On Wed, Aug 28, 2024 at 7:21 PM Xuan Zhuo wrote: > > > > On Tue, 27 Aug 2024 11:38:45 +0800, Jason Wang wrote: > > > On Tue, Aug 20, 2024 at 3:19 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-08-29 Thread Xuan Zhuo
On Thu, 29 Aug 2024 03:35:58 -0400, "Michael S. Tsirkin" wrote: > On Thu, Aug 29, 2024 at 03:26:00PM +0800, Xuan Zhuo wrote: > > On Thu, 29 Aug 2024 12:51:31 +0800, Jason Wang wrote: > > > On Wed, Aug 28, 2024 at 7:21 PM Xuan Zhuo > > > wrote: > &g

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-08-29 Thread Xuan Zhuo
On Wed, 21 Aug 2024 17:47:06 +0100, Darren Kenny wrote: > > Hi Michael, > > On Tuesday, 2024-08-20 at 12:50:39 -04, Michael S. Tsirkin wrote: > > On Tue, Aug 20, 2024 at 03:19:13PM +0800, Xuan Zhuo wrote: > >> leads to regression on

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-09-06 Thread Xuan Zhuo
On Fri, 6 Sep 2024 04:43:29 -0400, "Michael S. Tsirkin" wrote: > On Tue, Aug 20, 2024 at 03:19:13PM +0800, Xuan Zhuo wrote: > > leads to regression on VM with the sysctl value of: > > > > - net.core.high_order_alloc_disable=1 > > > > which could see

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-09-06 Thread Xuan Zhuo
On Fri, 6 Sep 2024 05:08:56 -0400, "Michael S. Tsirkin" wrote: > On Fri, Sep 06, 2024 at 04:53:38PM +0800, Xuan Zhuo wrote: > > On Fri, 6 Sep 2024 04:43:29 -0400, "Michael S. Tsirkin" > > wrote: > > > On Tue, Aug 20, 2024 at 03:19:13PM +0800, Xuan Z

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-09-06 Thread Xuan Zhuo
On Fri, 6 Sep 2024 05:44:27 -0400, "Michael S. Tsirkin" wrote: > On Fri, Sep 06, 2024 at 05:25:36PM +0800, Xuan Zhuo wrote: > > On Fri, 6 Sep 2024 05:08:56 -0400, "Michael S. Tsirkin" > > wrote: > > > On Fri, Sep 06, 2024 at 04:53:38PM +0800, Xuan Zhu

[PATCH 0/3] Revert "virtio_net: rx enable premapped mode by default"

2024-09-06 Thread Xuan Zhuo
Darren can not reply in time, Michael you can try this patch set. Thanks. Xuan Zhuo (3): Revert "virtio_net: rx remove premapped failover code" Revert "virtio_net: big mode skip the unmap check" virtio_net: disable premapped mode by default drivers/n

[PATCH 2/3] Revert "virtio_net: big mode skip the unmap check"

2024-09-06 Thread Xuan Zhuo
This reverts commit a377ae542d8d0a20a3173da3bbba72e045bea7a9. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 36a7781979b7..b68e64e8c7b6 100644 --- a/drivers

[PATCH 3/3] virtio_net: disable premapped mode by default

2024-09-06 Thread Xuan Zhuo
a_api") Reported-by: "Si-Wei Liu" Closes: http://lore.kernel.org/all/8b20cc28-45a9-4643-8e87-ba164a540...@oracle.com Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 18 -- 1 file changed, 18 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/ne

[PATCH 1/3] Revert "virtio_net: rx remove premapped failover code"

2024-09-06 Thread Xuan Zhuo
This reverts commit defd28aa5acb0fd7c15adc6bc40a8ac277d04dea. Recover the code to disable premapped mode. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 85 +++- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/drivers/net

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-09-08 Thread Xuan Zhuo
On Sun, 8 Sep 2024 15:40:32 -0400, "Michael S. Tsirkin" wrote: > On Tue, Aug 20, 2024 at 03:19:13PM +0800, Xuan Zhuo wrote: > > leads to regression on VM with the sysctl value of: > > > > - net.core.high_order_alloc_disable=1 > > > > which could see

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-09-09 Thread Xuan Zhuo
On Mon, 9 Sep 2024 16:38:16 +0800, Jason Wang wrote: > On Fri, Sep 6, 2024 at 5:32 PM Xuan Zhuo wrote: > > > > On Fri, 6 Sep 2024 05:08:56 -0400, "Michael S. Tsirkin" > > wrote: > > > On Fri, Sep 06, 2024 at 04:53:38PM +0800, Xuan Zhuo wrote: > > &

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-09-09 Thread Xuan Zhuo
On Mon, 9 Sep 2024 16:47:02 +0800, Jason Wang wrote: > On Mon, Sep 9, 2024 at 11:16 AM Xuan Zhuo wrote: > > > > On Sun, 8 Sep 2024 15:40:32 -0400, "Michael S. Tsirkin" > > wrote: > > > On Tue, Aug 20, 2024 at 03:19:13PM +0800, Xuan Zhuo wrote: > >

Re: [PATCH net] virtio-net: fix overflow inside virtnet_rq_alloc

2024-09-10 Thread Xuan Zhuo
On Tue, 10 Sep 2024 14:18:37 +0800, Jason Wang wrote: > On Mon, Sep 9, 2024 at 4:50 PM Xuan Zhuo wrote: > > > > On Mon, 9 Sep 2024 16:38:16 +0800, Jason Wang wrote: > > > On Fri, Sep 6, 2024 at 5:32 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH 0/3] Revert "virtio_net: rx enable premapped mode by default"

2024-09-11 Thread Xuan Zhuo
On Wed, 11 Sep 2024 12:30:49 -0700, "Si-Wei Liu" wrote: > > > On 9/11/2024 7:22 AM, Michael S. Tsirkin wrote: > > Thanks a lot! > > Could you retest Xuan Zhuo original patch > Which one? I thought Darren already did so? This one[1]. Now, we revert these pa

Re: [PATCH net-next 03/13] virtio_ring: packed: harden dma unmap for indirect

2024-09-11 Thread Xuan Zhuo
On Wed, 11 Sep 2024 07:28:36 -0400, "Michael S. Tsirkin" wrote: > As gcc luckily noted: > > On Tue, Aug 20, 2024 at 03:33:20PM +0800, Xuan Zhuo wrote: > > @@ -1617,23 +1617,24 @@ static void detach_buf_packed(struct > > vring_virtqueue *vq, > &g

Re: [PATCH net-next 02/13] virtio_ring: split: harden dma unmap for indirect

2024-09-12 Thread Xuan Zhuo
On Wed, 11 Sep 2024 11:46:30 +0800, Jason Wang wrote: > On Tue, Aug 20, 2024 at 3:33 PM Xuan Zhuo wrote: > > > > 1. this commit hardens dma unmap for indirect > > I think we need to explain why we need such hardening. For example > indirect use stream mapping which is r

Re: [PATCH net-next 04/13] virtio_ring: perform premapped operations based on per-buffer

2024-09-12 Thread Xuan Zhuo
On Wed, 11 Sep 2024 11:54:25 +0800, Jason Wang wrote: > On Tue, Aug 20, 2024 at 3:33 PM Xuan Zhuo wrote: > > > > The current configuration sets the virtqueue (vq) to premapped mode, > > implying that all buffers submitted to this queue must be mapped ahead > > of time

Re: [PATCH net-next 03/13] virtio_ring: packed: harden dma unmap for indirect

2024-09-12 Thread Xuan Zhuo
On Thu, 12 Sep 2024 03:38:12 -0400, "Michael S. Tsirkin" wrote: > On Thu, Sep 12, 2024 at 02:55:38PM +0800, Xuan Zhuo wrote: > > On Wed, 11 Sep 2024 07:28:36 -0400, "Michael S. Tsirkin" > > wrote: > > > As gcc luckily noted: > > > > >

Re: [PATCH net-next 07/13] virtio_net: refactor the xmit type

2024-09-12 Thread Xuan Zhuo
On Wed, 11 Sep 2024 12:04:16 +0800, Jason Wang wrote: > On Tue, Aug 20, 2024 at 3:33 PM Xuan Zhuo wrote: > > > > Because the af-xdp will introduce a new xmit type, so I refactor the > > xmit type mechanism first. > > > > We use the last two bits of the poi

Re: [PATCH net-next 11/13] virtio_net: xsk: tx: handle the transmitted xsk buffer

2024-09-12 Thread Xuan Zhuo
On Wed, 11 Sep 2024 12:32:54 +0800, Jason Wang wrote: > On Tue, Aug 20, 2024 at 3:34 PM Xuan Zhuo wrote: > > > > virtnet_free_old_xmit distinguishes three type ptr(skb, xdp frame, xsk > > buffer) by the last bits of the pointer. > > > > Signed-off-by: Xuan Zhuo

Re: [PATCH net-next 08/13] virtio_net: xsk: bind/unbind xsk for tx

2024-09-12 Thread Xuan Zhuo
On Wed, 11 Sep 2024 12:08:06 +0800, Jason Wang wrote: > On Tue, Aug 20, 2024 at 3:33 PM Xuan Zhuo wrote: > > > > This patch implement the logic of bind/unbind xsk pool to sq and rq. > > > > Signed-off-by: Xuan Zhuo > > --- &

Re: [PATCH net-next 10/13] virtio_net: xsk: tx: support xmit xsk buffer

2024-09-12 Thread Xuan Zhuo
On Wed, 11 Sep 2024 12:31:32 +0800, Jason Wang wrote: > On Tue, Aug 20, 2024 at 3:33 PM Xuan Zhuo wrote: > > > > The driver's tx napi is very important for XSK. It is responsible for > > obtaining data from the XSK queue and sending it out. > > > > At the

[PATCH v2 net-next] virtio-net: support XDP_TX when not more queues

2021-02-25 Thread Xuan Zhuo
are not enough queues. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 48 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ba8e637..c66ce4c

[PATCH v3 net-next] virtio-net: support XDP_TX when not more queues

2021-02-28 Thread Xuan Zhuo
are not enough queues. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 45 - 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ba8e637..a3116bc 100644

[PATCH v4 net-next] virtio-net: support XDP_TX when not more queues

2021-02-28 Thread Xuan Zhuo
are not enough queues. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 53 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ba8e637..55f1dd1

[PATCH v5 net-next] virtio-net: support XDP when not more queues

2021-02-28 Thread Xuan Zhuo
. This patch allows XDP_TX/XDP_REDIRECT to run by reuse the existing SQ with __netif_tx_lock() hold when there are not enough queues. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- v5: change subject from 'support XDP_TX when not more queues' v4: make sparse happy suggested by Jaku

[PATCH net-next v3 2/8] xsk: support get page by addr

2021-03-31 Thread Xuan Zhuo
xsk adds an interface and returns the page corresponding to data. virtio-net does not initialize dma, so it needs page to construct scatterlist to pass to vring. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- include/net/xdp_sock_drv.h | 11 +++ 1 file changed, 11 insertions

[PATCH net-next v3 1/8] xsk: XDP_SETUP_XSK_POOL support option check_dma

2021-03-31 Thread Xuan Zhuo
: Xuan Zhuo Reviewed-by: Dust Li --- include/linux/netdevice.h | 1 + net/xdp/xsk_buff_pool.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f57b70fc251f..47666b5d2dff 100644 --- a/include/linux/netdevice.h +++ b

[PATCH net-next v3 3/8] virtio-net: xsk zero copy xmit setup

2021-03-31 Thread Xuan Zhuo
operation is under the protection of rtnl_lock Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 66 1 file changed, 66 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index bb4ea9dbc16b

[PATCH net-next v3 4/8] virtio-net: xsk zero copy xmit implement wakeup and xmit

2021-03-31 Thread Xuan Zhuo
. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 183 +++ 1 file changed, 183 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 4e25408a2b37..c8a317a93ef7 100644 --- a/drivers/net/virtio_net.c

[PATCH net-next v3 0/8] virtio-net support xdp socket zero copy xmit

2021-03-31 Thread Xuan Zhuo
1500 81.5% Xuan Zhuo (8): xsk: XDP_SETUP_XSK_POOL support option check_dma xsk: support get page by addr virtio-net: xsk zero copy xmit setup virtio-net: xsk zero copy xmit implement wakeup and xmit virtio-net: xsk zero copy xmit support xsk unaligned mode virtio-net: xsk zero copy

[PATCH net-next v3 8/8] virtio-net: free old xmit handle xsk

2021-03-31 Thread Xuan Zhuo
need_wakeup is set. If __free_old_xmit is called first by start_xmit, we can quickly wake up napi to execute xsk xmit work. When recycling, we need to count the number of bytes sent, so put xsk desc->len into the ptr pointer. Because ptr does not point to meaningful objects in xsk. Signed-off-by: X

[PATCH net-next v3 6/8] virtio-net: xsk zero copy xmit kick by threshold

2021-03-31 Thread Xuan Zhuo
-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 259fafcf6028..d7e95f55478d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers

[PATCH net-next v3 5/8] virtio-net: xsk zero copy xmit support xsk unaligned mode

2021-03-31 Thread Xuan Zhuo
In xsk unaligned mode, the frame pointed to by desc may span two consecutive pages, but not more than two pages. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 30 -- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a

[PATCH net-next v3 7/8] virtio-net: poll tx call xsk zerocopy xmit

2021-03-31 Thread Xuan Zhuo
poll tx call virtnet_xsk_run, then the data in the xsk tx queue will be continuously consumed by napi. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b

[PATCH net-next] virtio-net: page_to_skb() use build_skb when there's sufficient tailroom

2021-04-06 Thread Xuan Zhuo
1: no build_skb: 956864.00 rxpck/s build_skb:1158465.00 rxpck/s Signed-off-by: Xuan Zhuo Suggested-by: Jason Wang --- drivers/net/virtio_net.c | 51 ++-- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/v

[PATCH net-next v4 01/10] netdevice: priv_flags extend to 64bit

2021-04-12 Thread Xuan Zhuo
aligned based on the cache line. But there is a 4-byte hole left here. Since the fields before and after priv_flags are read mostly, I did not adjust the order of the fields here. Signed-off-by: Xuan Zhuo --- include/linux/netdevice.h | 136 -- 1 file changed, 71

[PATCH net-next v4 00/10] virtio-net support xdp socket zero copy xmit

2021-04-12 Thread Xuan Zhuo
priv_flags IFF_NOT_USE_DMA_ADDR 2. more reasonable patch split Xuan Zhuo (10): netdevice: priv_flags extend to 64bit netdevice: add priv_flags IFF_NOT_USE_DMA_ADDR virtio-net: add priv_flags IFF_NOT_USE_DMA_ADDR xsk: support get page by addr xsk: XDP_SETUP_XSK_POOL supp

[PATCH net-next v4 02/10] netdevice: add priv_flags IFF_NOT_USE_DMA_ADDR

2021-04-12 Thread Xuan Zhuo
Some driver devices, such as virtio-net, do not directly use dma addr. For upper-level frameworks such as xdp socket, that need to be aware of this. So add a new priv_flag IFF_NOT_USE_DMA_ADDR. Signed-off-by: Xuan Zhuo --- include/linux/netdevice.h | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH net-next v4 03/10] virtio-net: add priv_flags IFF_NOT_USE_DMA_ADDR

2021-04-12 Thread Xuan Zhuo
virtio-net not use dma addr directly. So add this priv_flags IFF_NOT_USE_DMA_ADDR. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index bb4ea9dbc16b..52653e234a20

[PATCH net-next v4 06/10] virtio-net: unify the code for recycling the xmit ptr

2021-04-12 Thread Xuan Zhuo
uniformly to recover old xmit ptr. Rename free_old_xmit_skbs() to free_old_xmit(). Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 86 ++-- 1 file changed, 38 insertions(+), 48 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.

[PATCH net-next v4 05/10] xsk: XDP_SETUP_XSK_POOL support option IFF_NOT_USE_DMA_ADDR

2021-04-12 Thread Xuan Zhuo
Some devices, such as virtio-net, do not directly use dma addr. These devices do not initialize dma after completing the xsk setup, so the dma check is skipped here. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- net/xdp/xsk_buff_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH net-next v4 09/10] virtio-net: xsk zero copy xmit implement wakeup and xmit

2021-04-12 Thread Xuan Zhuo
the ptr pointer. Because ptr does not point to meaningful objects in xsk. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 296 ++- 1 file changed, 292 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/

[PATCH net-next v4 07/10] virtio-net: virtnet_poll_tx support budget check

2021-04-12 Thread Xuan Zhuo
api schedule again, and no conflicts with the logic of napi_poll(). When work == budget, virtnet_poll_tx() will return the var 'work', and the napi_poll() in dev.c will re-add napi to the queue. The purpose of this patch is to support xsk xmit in virtio_poll_tx for subsequent patch. Signed

[PATCH net-next v4 04/10] xsk: support get page by addr

2021-04-12 Thread Xuan Zhuo
xsk adds an interface and returns the page corresponding to data. virtio-net does not initialize dma, so it needs page to construct scatterlist to pass to vring. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- include/net/xdp_sock_drv.h | 11 +++ 1 file changed, 11 insertions

[PATCH net-next v4 10/10] virtio-net: xsk zero copy xmit kick by threshold

2021-04-12 Thread Xuan Zhuo
cpu on the host has also reached 100%. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index c441d6bf1510..4e360bfc2cf0 100644

[PATCH net-next v4 08/10] virtio-net: xsk zero copy xmit setup

2021-04-12 Thread Xuan Zhuo
operation is under the protection of rtnl_lock. If xsk is active, it will prevent ethtool from modifying tx napi. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 78 +++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a

[PATCH net-next v2] virtio-net: page_to_skb() use build_skb when there's sufficient tailroom

2021-04-13 Thread Xuan Zhuo
1: no build_skb: 956864.00 rxpck/s build_skb:1158465.00 rxpck/s Signed-off-by: Xuan Zhuo Suggested-by: Jason Wang --- v2: conflict resolution drivers/net/virtio_net.c | 51 ++-- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/drivers/n

[PATCH net-next v3] virtio-net: page_to_skb() use build_skb when there's sufficient tailroom

2021-04-16 Thread Xuan Zhuo
1: no build_skb: 956864.00 rxpck/s build_skb:1158465.00 rxpck/s Signed-off-by: Xuan Zhuo Suggested-by: Jason Wang --- v3: fix the truesize when headroom > 0 v2: conflict resolution drivers/net/virtio_net.c | 69 1 file changed, 48 insertions(+), 2

[PATCH v6 net-next] virtio-net: support XDP when not more queues

2021-03-05 Thread Xuan Zhuo
. This patch allows XDP_TX/XDP_REDIRECT to run by reuse the existing SQ with __netif_tx_lock() hold when there are not enough queues. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- v6: 1. use __netif_tx_acquire()/__netif_tx_release(). (suggested by Jason Wang) 2. add note for why not lock

[PATCH v7 net-next] virtio-net: support XDP when not more queues

2021-03-08 Thread Xuan Zhuo
. This patch allows XDP_TX/XDP_REDIRECT to run by reuse the existing SQ with __netif_tx_lock() hold when there are not enough queues. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- v7: 1. use macros to implement get/put 2. remove 'flag'. (suggested by Jason Wang)

[PATCH v8 net-next] virtio-net: support XDP when not more queues

2021-03-09 Thread Xuan Zhuo
. This patch allows XDP_TX/XDP_REDIRECT to run by reuse the existing SQ with __netif_tx_lock() hold when there are not enough queues. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li Acked-by: Jason Wang --- v8: 1. explain why use macros not inline functions. (suggested by Michael S. Tsirkin) 2

<    1   2   3   4   5   6   7   >