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

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

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

2024-11-11 Thread Xuan Zhuo
ff-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 179 --- 1 file changed, 168 insertions(+), 11 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d5b8567f77d0..57642bd83b7b 100644 --- a/drivers/net/virtio_

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

2024-11-11 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 v4 13/13] virtio_net: xdp_features add NETDEV_XDP_ACT_XSK_ZEROCOPY

2024-11-11 Thread Xuan Zhuo
Now, we support AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to xdp_features. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- 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 7db586770249

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

2024-11-11 Thread Xuan Zhuo
virtio-net rq submits premapped per-buffer by setting sg page to NULL; Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c

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

2024-11-11 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 v4 01/13] virtio_ring: introduce vring_need_unmap_buffer

2024-11-11 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 v4 05/13] virtio_ring: introduce add api for premapped

2024-11-11 Thread Xuan Zhuo
, gfp_t gfp); int virtqueue_add_outbuf_premapped(struct virtqueue *vq, struct scatterlist *sg, unsigned int num, void *data, gfp_t gfp); Signed-off-by: Xuan Zhuo Acked-by: Jason Wang

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

2024-11-11 Thread Xuan Zhuo
Suggested-by: Jason Wang Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 101 ++- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cfe70c40f630..fe

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

2024-11-11 Thread Xuan Zhuo
DP tx Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 90 +++- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 183ad5e6bef0..539a43777f86 100644 --- a/driver

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

2024-11-11 Thread Xuan Zhuo
Tx-bps: 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: record extras for indirect buffers virtio_ring: packed: recor

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

2024-11-11 Thread Xuan Zhuo
Now, this API is useless. remove it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 13 -- drivers/virtio/virtio_ring.c | 48 include/linux/virtio.h | 2 -- 3 files changed, 63 deletions(-) diff --git a

[PATCH net-next v4 02/13] virtio_ring: split: record extras for indirect buffers

2024-11-11 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 112

[PATCH net-next v4 03/13] virtio_ring: packed: record extras for indirect buffers

2024-11-11 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 60

Re: [PATCH net-next v3 03/13] virtio_ring: packed: record extras for indirect buffers

2024-11-10 Thread Xuan Zhuo
On Thu, 7 Nov 2024 16:54:54 +0800, Xuan Zhuo wrote: > The subsequent commit needs to know whether every indirect buffer is > premapped or not. So we need to introduce an extra struct for every > indirect buffer to record this info. > > Signed-off-by: Xuan Zhuo Hi, Jason Th

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

2024-11-07 Thread Xuan Zhuo
Suggested-by: Jason Wang Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 101 ++- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cfe70c40f630..fe

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

2024-11-07 Thread Xuan Zhuo
Now, this API is useless. remove it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 13 -- drivers/virtio/virtio_ring.c | 48 include/linux/virtio.h | 2 -- 3 files changed, 63 deletions(-) diff --git a

[PATCH net-next v3 03/13] virtio_ring: packed: record extras for indirect buffers

2024-11-07 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 60 +--- 1 file changed, 36

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

2024-11-07 Thread Xuan Zhuo
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: record extras for indirect buffers virtio_ring: packed: record extras for indirect buffers virtio_ring: perform premapped op

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

2024-11-07 Thread Xuan Zhuo
Now, we support AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to xdp_features. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- 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 7cd6f1d74710

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

2024-11-07 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 v3 11/13] virtio_net: xsk: tx: support xmit xsk buffer

2024-11-07 Thread Xuan Zhuo
ff-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 179 --- 1 file changed, 168 insertions(+), 11 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 3fc8e71cfba9..67d33cc913cc 100644 --- a/drivers/net/virtio_

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

2024-11-07 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 v3 09/13] virtio_net: xsk: bind/unbind xsk for tx

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

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

2024-11-07 Thread Xuan Zhuo
virtio-net rq submits premapped per-buffer by setting sg page to NULL; Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 4b27ded8fc16

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

2024-11-07 Thread Xuan Zhuo
DP tx Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 90 +++- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index e4ebf3ffbf02..079d4a213fda 100644 --- a/driver

[PATCH net-next v3 05/13] virtio_ring: introduce add api for premapped

2024-11-07 Thread Xuan Zhuo
, gfp_t gfp); int virtqueue_add_outbuf_premapped(struct virtqueue *vq, struct scatterlist *sg, unsigned int num, void *data, gfp_t gfp); Signed-off-by: Xuan Zhuo --- drivers/virtio

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

2024-11-07 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 v3 02/13] virtio_ring: split: record extras for indirect buffers

2024-11-07 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 112 --- 1 file changed, 52

Re: [PATCH net-next v1 0/4] virtio_net: enable premapped mode by default

2024-11-06 Thread Xuan Zhuo
On Wed, 6 Nov 2024 02:38:40 -0500, "Michael S. Tsirkin" wrote: > On Mon, Nov 04, 2024 at 06:46:41PM -0800, Jakub Kicinski wrote: > > On Tue, 29 Oct 2024 16:46:11 +0800 Xuan Zhuo wrote: > > > In the last linux version, we disabled this feature to fix the > > >

Re: [PATCH net-next v2 02/13] virtio_ring: split: record extras for indirect buffers

2024-11-05 Thread Xuan Zhuo
On Wed, 6 Nov 2024 09:44:39 +0800, Jason Wang wrote: > On Tue, Nov 5, 2024 at 2:53 PM Xuan Zhuo wrote: > > > > On Tue, 5 Nov 2024 11:42:09 +0800, Jason Wang wrote: > > > On Wed, Oct 30, 2024 at 4:25 PM Xuan Zhuo > > > wrote: > > > > > > &g

Re: [PATCH net-next v2 06/13] virtio-net: rq submits premapped per-buffer

2024-11-05 Thread Xuan Zhuo
On Wed, 6 Nov 2024 09:56:55 +0800, Jason Wang wrote: > On Tue, Nov 5, 2024 at 3:23 PM Xuan Zhuo wrote: > > > > On Tue, 5 Nov 2024 11:23:50 +0800, Jason Wang wrote: > > > On Wed, Oct 30, 2024 at 4:25 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net-next v2 02/13] virtio_ring: split: record extras for indirect buffers

2024-11-05 Thread Xuan Zhuo
On Tue, 5 Nov 2024 11:42:09 +0800, Jason Wang wrote: > On Wed, Oct 30, 2024 at 4:25 PM Xuan Zhuo wrote: > > > > The subsequent commit needs to know whether every indirect buffer is > > premapped or not. So we need to introduce an extra struct for every > > indirect

Re: [PATCH net-next v2 06/13] virtio-net: rq submits premapped per-buffer

2024-11-04 Thread Xuan Zhuo
On Tue, 5 Nov 2024 11:23:50 +0800, Jason Wang wrote: > On Wed, Oct 30, 2024 at 4:25 PM Xuan Zhuo wrote: > > > > virtio-net rq submits premapped per-buffer by setting sg page to NULL; > > > > Signed-off-by: Xuan Zhuo > > --- > > drivers/net/virtio_net.c |

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

2024-10-30 Thread Xuan Zhuo
Now, we support AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to xdp_features. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- 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 091e3ed0cafa

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

2024-10-30 Thread Xuan Zhuo
Suggested-by: Jason Wang Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 79 ++-- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 628e01af1c9a..a89295b79e66 100644 ---

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

2024-10-30 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 v2 07/13] virtio_ring: remove API virtqueue_set_dma_premapped

2024-10-30 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

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

2024-10-30 Thread Xuan Zhuo
ff-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 179 --- 1 file changed, 168 insertions(+), 11 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a5bad8a5f642..4d00d73d8088 100644 --- a/drivers/net/virtio_

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

2024-10-30 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 v2 01/13] virtio_ring: introduce vring_need_unmap_buffer

2024-10-30 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 v2 09/13] virtio_net: xsk: bind/unbind xsk for tx

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

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

2024-10-30 Thread Xuan Zhuo
DP tx Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 90 +++- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 09757fa408bd..37e86e0a1d8e 100644 --- a/driver

[PATCH net-next v2 05/13] virtio_ring: introduce add api for premapped

2024-10-30 Thread Xuan Zhuo
premapped, gfp_t gfp); Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 48 include/linux/virtio.h | 13 ++ 2 files changed, 61 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio

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

2024-10-30 Thread Xuan Zhuo
6333227 Tx-bps: 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: re

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

2024-10-30 Thread Xuan Zhuo
virtio-net rq submits premapped per-buffer by setting sg page to NULL; Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 792e9eadbfc3

[PATCH net-next v2 03/13] virtio_ring: packed: record extras for indirect buffers

2024-10-30 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 60 +--- 1 file changed, 36

[PATCH net-next v2 02/13] virtio_ring: split: record extras for indirect buffers

2024-10-30 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 112 --- 1 file changed, 52

[PATCH net-next v1 4/4] virtio_net: rx remove premapped failover code

2024-10-29 Thread Xuan Zhuo
Now, the premapped mode can be enabled unconditionally. So we can remove the failover code for merge and small mode. The virtnet_rq_xxx() helper would be only used if the mode is using pre mapping. A check is added to prevent misusing of these API. Tested-by: Darren Kenny Signed-off-by: Xuan

[PATCH net-next v1 3/4] virtio_net: enable premapped mode for merge and small by default

2024-10-29 Thread Xuan Zhuo
Tested-by: Darren Kenny Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7557808e8c1f..ea433e9650eb 100644 --- a/drivers/net/virtio_net.c

[PATCH net-next v1 2/4] virtio_net: big mode skip the unmap check

2024-10-29 Thread Xuan Zhuo
Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- 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 d50c1940eb23..7557808e8c1f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net

[PATCH net-next v1 0/4] virtio_net: enable premapped mode by default

2024-10-29 Thread Xuan Zhuo
68004-1-xuanz...@linux.alibaba.com Thanks. [1]: http://lore.kernel.org/all/8b20cc28-45a9-4643-8e87-ba164a540...@oracle.com Xuan Zhuo (4): virtio-net: fix overflow inside virtnet_rq_alloc virtio_net: big mode skip the unmap check virtio_net: enable premapped mode for merge and small by default

[PATCH net-next v1 1/4] virtio-net: fix overflow inside virtnet_rq_alloc

2024-10-29 Thread Xuan Zhuo
quot;Si-Wei Liu" Tested-by: Darren Kenny 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 792e9eadbfc3..d50c1940eb23 100644 --- a/drivers/net/virtio

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

2024-10-24 Thread Xuan Zhuo
On Fri, 18 Oct 2024 15:41:41 +0800, Jason Wang wrote: > On Mon, Oct 14, 2024 at 11:12 AM Xuan Zhuo wrote: > > > > When the frag just got a page, then may lead to regression on VM. > > Specially if the sysctl net.core.high_order_alloc_disable value is 1, > > then the

Re: [PATCH 4/5] virtio_net: enable premapped mode for merge and small by default

2024-10-24 Thread Xuan Zhuo
On Fri, 18 Oct 2024 16:00:07 +0800, Jason Wang wrote: > On Mon, Oct 14, 2024 at 11:12 AM Xuan Zhuo wrote: > > > > Currently, the virtio core will perform a dma operation for each > > buffer. Although, the same page may be operated multiple times. > > > > In prema

Re: [PATCH 2/5] virtio_net: introduce vi->mode

2024-10-24 Thread Xuan Zhuo
On Fri, 18 Oct 2024 15:48:38 +0800, Jason Wang wrote: > On Mon, Oct 14, 2024 at 11:12 AM Xuan Zhuo wrote: > > > > Now, if we want to judge the rx work mode, we have to use such codes: > > > > 1. merge mode: vi->mergeable_rx_bufs > > 2. big mode: vi->big_

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

2024-10-24 Thread Xuan Zhuo
On Thu, 17 Oct 2024 15:42:59 +0200, Paolo Abeni wrote: > > > On 10/14/24 05:12, Xuan Zhuo wrote: > > When the frag just got a page, then may lead to regression on VM. > > Specially if the sysctl net.core.high_order_alloc_disable value is 1, > > then the frag alway

[PATCH 5/5] virtio_net: rx remove premapped failover code

2024-10-13 Thread Xuan Zhuo
Now, the premapped mode can be enabled unconditionally. So we can remove the failover code for merge and small mode. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 80 +--- 1 file changed, 33 insertions(+), 47 deletions(-) diff --git a/drivers/net

[PATCH 4/5] virtio_net: enable premapped mode for merge and small by default

2024-10-13 Thread Xuan Zhuo
Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index cd90e77881df..8cf24b7b58bd 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -6133,6

[PATCH 2/5] virtio_net: introduce vi->mode

2024-10-13 Thread Xuan Zhuo
lso have this use case: if (vi->mergeable_rx_bufs) else if (vi->big_packets) else For this case, I think switch-case is the better choice. So here I introduce vi->mode to record the virtio-net work mode. That is helpful to judge the work mode and choose the branches. Si

[PATCH 3/5] virtio_net: big mode skip the unmap check

2024-10-13 Thread Xuan Zhuo
The virtio-net big mode did not enable premapped mode, so we did not need to check the unmap. And the subsequent commit will remove the failover code for failing enable premapped for merge and small mode. So we need to remove the checking do_dma code in the big mode path. Signed-off-by: Xuan Zhuo

[PATCH 1/5] virtio-net: fix overflow inside virtnet_rq_alloc

2024-10-13 Thread Xuan Zhuo
, we reduce the buffer len to fix this problem. Fixes: f9dac92ba908 ("virtio_ring: enable premapped mode whatever use_dma_api") Reported-by: "Si-Wei Liu" Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-)

[PATCH 0/5] virtio_net: enable premapped mode by default

2024-10-13 Thread Xuan Zhuo
-ba164a540...@oracle.com Xuan Zhuo (5): virtio-net: fix overflow inside virtnet_rq_alloc virtio_net: introduce vi->mode virtio_net: big mode skip the unmap check virtio_net: enable premapped mode for merge and small by default virtio_net: rx remove premapped failover code drivers/

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

2024-10-09 Thread Xuan Zhuo
On Wed, 9 Oct 2024 05:29:35 -0400, "Michael S. Tsirkin" wrote: > On Fri, Sep 06, 2024 at 08:31:34PM +0800, Xuan Zhuo wrote: > > Regression: > > http://lore.kernel.org/all/8b20cc28-45a9-4643-8e87-ba164a540...@oracle.com > > > > I still think that the patch c

Re: [RFC net-next v1 10/12] virtio_net: xsk: tx: support xmit xsk buffer

2024-09-24 Thread Xuan Zhuo
On Tue, 24 Sep 2024 15:35:08 +0800, Jason Wang wrote: > On Tue, Sep 24, 2024 at 9:32 AM 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

Re: [RFC net-next v1 07/12] virtio_net: refactor the xmit type

2024-09-24 Thread Xuan Zhuo
On Tue, 24 Sep 2024 15:35:03 +0800, Jason Wang wrote: > On Tue, Sep 24, 2024 at 9:32 AM Xuan Zhuo wrote: > > > > Because the af-xdp will introduce a new xmit type, so I refactor the > > xmit type mechanism first. > > > > In general, pointers are aligned to 4 o

Re: [RFC net-next v1 08/12] virtio_net: xsk: bind/unbind xsk for tx

2024-09-24 Thread Xuan Zhuo
On Tue, 24 Sep 2024 15:35:05 +0800, Jason Wang wrote: > On Tue, Sep 24, 2024 at 9:32 AM Xuan Zhuo wrote: > > > > This patch implement the logic of bind/unbind xsk pool to sq and rq. > > > > Signed-off-by: Xuan Zhuo > > --- &

Re: [RFC net-next v1 02/12] virtio_ring: split: record extras for indirect buffers

2024-09-24 Thread Xuan Zhuo
Will fix for all commets in next version. Thanks. On Tue, 24 Sep 2024 15:34:57 +0800, Jason Wang wrote: > On Tue, Sep 24, 2024 at 9:32 AM Xuan Zhuo wrote: > > > > The subsequent commit needs to know whether every indirect buffer is > > premapped or not. So we need to intr

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

2024-09-24 Thread Xuan Zhuo
On Tue, 24 Sep 2024 15:35:01 +0800, Jason Wang wrote: > On Tue, Sep 24, 2024 at 9:32 AM 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

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

2024-09-23 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 v1 10/12] virtio_net: xsk: tx: support xmit xsk buffer

2024-09-23 Thread Xuan Zhuo
ff-by: Xuan Zhuo --- drivers/net/virtio_net.c | 176 --- 1 file changed, 166 insertions(+), 10 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 3ad4c6e3ef18..1a870f1df910 100644 --- a/drivers/net/virtio_net.c +++ b/driver

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

2024-09-23 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 v1 05/12] virtio-net: rq submits premapped per-buffer

2024-09-23 Thread Xuan Zhuo
virtio-net rq submits premapped per-buffer by setting sg page to NULL; Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 6f4781ec2b36..630e5b21ad69

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

2024-09-23 Thread Xuan Zhuo
Now, we support AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to xdp_features. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- 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 a1ef0277c550

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

2024-09-23 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 v1 03/12] virtio_ring: packed: record extras for indirect buffers

2024-09-23 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 67 1 file changed, 37

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

2024-09-23 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 v1 02/12] virtio_ring: split: record extras for indirect buffers

2024-09-23 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 126 +-- 1 file changed, 61

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

2024-09-23 Thread Xuan Zhuo
CPU for tx and rx napi(100% and 86%). Please review. Thanks. Xuan Zhuo (12): virtio_ring: introduce vring_need_unmap_buffer virtio_ring: split: record extras for indirect buffers virtio_ring: packed: record extras for indirect buffers virtio_ring: perform premapped operations based on

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

2024-09-23 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 v1 08/12] virtio_net: xsk: bind/unbind xsk for tx

2024-09-23 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 | 53 1 file changed, 53 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 41a5ea9b788d

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

2024-09-23 Thread Xuan Zhuo
And 2 bits is enough for 4 types: 00 for skb 01 for SKB_ORPHAN 10 for XDP 11 for af-xdp tx Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 90 +++- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/drivers/net/virtio_ne

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

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 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 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 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 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 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 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 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] 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 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-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-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

[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

[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 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 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

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

  1   2   3   4   5   6   7   >