[PATCH net-next v3 08/27] virtio_ring: introduce virtqueue_detach_unused_buf_dma()

2023-12-28 Thread Xuan Zhuo
address of the buffer from the virtio core. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 33 + include/linux/virtio.h | 1 + 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio

[PATCH net-next v3 06/27] virtio_ring: introduce virtqueue_get_buf_ctx_dma()

2023-12-28 Thread Xuan Zhuo
of the buffer from the virtio core. Because the BAD_RING is called (that may set vq->broken), so the relative "const" of vq is removed. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 174 +-- include/linux/virtio.h | 16 2

[PATCH net-next v3 12/27] virtio_net: separate virtnet_tx_resize()

2023-12-28 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/main.c | 35

[PATCH net-next v3 07/27] virtio_ring: virtqueue_disable_and_recycle let the callback detach bufs

2023-12-28 Thread Xuan Zhuo
should complete the work of detaching all the unused buffers. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c| 60 +++- drivers/virtio/virtio_ring.c | 10 +++--- include/linux/virtio.h | 4 +-- 3 files changed, 38 insertions(+), 36 deletions

[PATCH net-next v3 14/27] virtio_net: xsk: prevent disable tx napi

2023-12-28 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/main.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/m

[PATCH net-next v3 15/27] virtio_net: move some api to header

2023-12-28 Thread Xuan Zhuo
__free_old_xmit is_xdp_raw_buffer_queue These two APIs are needed by the xsk part. So this commit move theses to the header. And add prefix "virtnet_". Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 86 +++-- drivers/net/virtio/virtio_

[PATCH net-next v3 13/27] virtio_net: xsk: bind/unbind xsk

2023-12-28 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/Makefile | 2 +- drivers/net/virtio/main.c | 11 +- drivers/net/virtio/virtio_net.h | 17 +++ drivers/net/virtio/xsk.c| 187

[PATCH net-next v3 10/27] virtio_net: sq support premapped mode

2023-12-28 Thread Xuan Zhuo
): |1707107.00 | 1562917.00 | 385667.00 | 373584.00 Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 119 drivers/net/virtio/virtio_net.h | 10 ++- 2 files changed, 116 insertions(+), 13 deletions(-) diff --git a/drivers/net/virtio/main.c b/drivers/net

[PATCH net-next v3 16/27] virtio_net: xsk: tx: support xmit xsk buffer

2023-12-28 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/main.c | 22 ++--- drivers/net/virtio/virtio_net.h

[PATCH net-next v3 17/27] virtio_net: xsk: tx: support wakeup

2023-12-28 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 --- drivers/net/virtio/main.c | 20 ++-- drivers/net

[PATCH net-next v3 18/27] virtio_net: xsk: tx: handle the transmitted xsk buffer

2023-12-28 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/virtio_net.h | 30 ++ drivers/net/virtio/xsk.c| 33 ++--- drivers/net

[PATCH net-next v3 19/27] virtio_net: xsk: tx: free the unused xsk buffer

2023-12-28 Thread Xuan Zhuo
virtnet_sq_free_unused_buf() check xsk buffer. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio/main.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c index 2c82418b0344..ab1970158d85 100644

[PATCH net-next v3 23/27] virtio_net: xsk: rx: support recv merge mode

2023-12-28 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 --- drivers/net/virtio/main.c | 40 -- drivers/net/virtio/virtio_net.h | 8 ++ drivers/net/virtio/xsk.c| 217

[PATCH net-next v3 24/27] virtio_net: xsk: rx: support recv small mode

2023-12-28 Thread Xuan Zhuo
receive the xsk buffer for small mode. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/xsk.c | 33 + 1 file changed, 33 insertions(+) diff --git a/drivers/net/virtio/xsk.c b/drivers/net/virtio/xsk.c index 005bb5f66271..ee09e898a291 100644 --- a/drivers/net

[PATCH net-next v3 20/27] virtio_net: separate receive_mergeable

2023-12-28 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 --- drivers/net/virtio/main.c | 77 --- 1 file changed, 47 insertions

[PATCH net-next v3 25/27] virtio_net: xsk: rx: free the unused xsk buffer

2023-12-28 Thread Xuan Zhuo
Since this will be called in other circumstances(freeze), we must check whether it is xsk's buffer in this function. It cannot be judged outside this function. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/v

[PATCH net-next v3 21/27] virtio_net: separate receive_buf

2023-12-28 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 --- drivers/net/virtio/main.c | 56 ++- 1 file

[PATCH net-next v3 22/27] virtio_net: xsk: rx: support fill with xsk buffer

2023-12-28 Thread Xuan Zhuo
Implement the logic of filling rq with XSK buffers. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 9 +- drivers/net/virtio/virtio_net.h | 2 ++ drivers/net/virtio/xsk.c| 51 - drivers/net/virtio/xsk.h| 2 ++ 4 files changed

[PATCH net-next v3 26/27] virtio_net: update tx timeout record

2023-12-28 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/xsk.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/virtio/xsk.c b/drivers/net/virtio/xsk.c index

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

2023-12-28 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/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c index cc0194c14c98..ec28f87f04a7

Re: [PATCH net-next v1 0/6] virtio-net: support device stats

2024-01-15 Thread Xuan Zhuo
On Tue, 26 Dec 2023 15:30:57 +0800, Xuan Zhuo wrote: > As the spec: > > https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 > > The virtio net supports to get device stats. Hi Jason, Any comments for this? Thanks > > Please revie

[PATCH net-next 1/5] virtio_net: rename free_old_xmit_skbs to free_old_xmit

2024-01-15 Thread Xuan Zhuo
Since free_old_xmit_skbs not only deals with skb, but also xdp frame and subsequent added xsk, so change the name of this function to free_old_xmit. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff

[PATCH net-next 2/5] virtio_net: unify the code for recycling the xmit ptr

2024-01-15 Thread Xuan Zhuo
There are two completely similar and independent implementations. This is inconvenient for the subsequent addition of new types. So extract a function from this piece of code and call this function uniformly to recover old xmit ptr. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net

[PATCH net-next 3/5] virtio_net: independent directory

2024-01-15 Thread Xuan Zhuo
Create a separate directory for virtio-net. AF_XDP support will be added later, then a separate xsk.c file will be added, so we should create a directory for virtio-net. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- MAINTAINERS | 2 +- drivers/net/Kconfig

[PATCH net-next 4/5] virtio_net: move core structures to virtio_net.h

2024-01-15 Thread Xuan Zhuo
Move some core structures (send_queue, receive_queue, virtnet_info) definitions and the relative structures definitions into the virtio_net.h file. That will be used by the other c code files. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio/main.c | 203

[PATCH net-next 0/5] virtio-net: make the virtio-net has independent directory

2024-01-15 Thread Xuan Zhuo
100% and 86%). ## maintain I am currently a reviewer for virtio-net. I commit to maintain AF_XDP support in virtio-net. Please review. Thanks. Xuan Zhuo (5): virtio_net: rename free_old_xmit_skbs to free_old_xmit virtio_net: unify the code for recycling the xmit ptr virtio_net: independen

[PATCH net-next 5/5] virtio_net: add prefix virtnet to all struct inside virtio_net.h

2024-01-15 Thread Xuan Zhuo
We move some structures to the header file, but these structures do not prefixed with virtnet. This patch adds virtnet for these. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 106 drivers/net/virtio/virtio_net.h | 12 ++-- 2 files changed, 59

Re: [PATCH net-next v3 06/27] virtio_ring: introduce virtqueue_get_buf_ctx_dma()

2024-01-15 Thread Xuan Zhuo
On Thu, 11 Jan 2024 16:34:09 +0800, Jason Wang wrote: > On Fri, Dec 29, 2023 at 3:31 PM Xuan Zhuo wrote: > > > > introduce virtqueue_get_buf_ctx_dma() to collect the dma info when > > get buf from virtio core for premapped mode. > > > > If the virtio queue is pr

[PATCH net-next 0/5] virtio-net: sq support premapped mode

2024-01-15 Thread Xuan Zhuo
ps: 2837285936 But AF_XDP consumes more CPU for tx and rx napi(100% and 86%). ## maintain I am currently a reviewer for virtio-net. I commit to maintain AF_XDP support in virtio-net. Please review. Thanks. Xuan Zhuo (5): virtio_ring: introduce virtqueue_get_buf_ctx_dma

[PATCH net-next 1/5] virtio_ring: introduce virtqueue_get_buf_ctx_dma()

2024-01-15 Thread Xuan Zhuo
of the buffer from the virtio core. Because the BAD_RING is called (that may set vq->broken), so the relative "const" of vq is removed. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 174 +-- include/linux/virtio.h | 16 2

[PATCH net-next 2/5] virtio_ring: virtqueue_disable_and_recycle let the callback detach bufs

2024-01-15 Thread Xuan Zhuo
should complete the work of detaching all the unused buffers. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c| 60 +++- drivers/virtio/virtio_ring.c | 10 +++--- include/linux/virtio.h | 4 +-- 3 files changed, 38 insertions(+), 36 deletions

[PATCH net-next 3/5] virtio_ring: introduce virtqueue_detach_unused_buf_dma()

2024-01-15 Thread Xuan Zhuo
address of the buffer from the virtio core. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 33 + include/linux/virtio.h | 1 + 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio

[PATCH net-next 4/5] virtio_ring: introduce virtqueue_get_dma_premapped()

2024-01-16 Thread Xuan Zhuo
Introduce helper virtqueue_get_dma_premapped(), then the driver can know whether dma unmap is needed. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 22 +- drivers/net/virtio/virtio_net.h | 3 --- drivers/virtio/virtio_ring.c| 22

[PATCH net-next 5/5] virtio_net: sq support premapped mode

2024-01-16 Thread Xuan Zhuo
): |1707107.00 | 1562917.00 | 385667.00 | 373584.00 Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 119 drivers/net/virtio/virtio_net.h | 10 ++- 2 files changed, 116 insertions(+), 13 deletions(-) diff --git a/drivers/net/virtio/main.c b/drivers/net

[PATCH net-next 01/17] virtio_net: separate virtnet_rx_resize()

2024-01-16 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/main.c | 29

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

2024-01-16 Thread Xuan Zhuo
add comments for some 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 (17): virtio_net: separate virtnet_rx_resize() virtio_net: separate v

[PATCH net-next 02/17] virtio_net: separate virtnet_tx_resize()

2024-01-16 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/main.c | 35

[PATCH net-next 04/17] virtio_net: xsk: prevent disable tx napi

2024-01-16 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/main.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/m

[PATCH net-next 05/17] virtio_net: move some api to header

2024-01-16 Thread Xuan Zhuo
__free_old_xmit is_xdp_raw_buffer_queue These two APIs are needed by the xsk part. So this commit move theses to the header. And add prefix "virtnet_". Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 86 +++-- drivers/net/virtio/virtio_

[PATCH net-next 06/17] virtio_net: xsk: tx: support xmit xsk buffer

2024-01-16 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/main.c | 22 ++--- drivers/net/virtio/virtio_net.h

[PATCH net-next 07/17] virtio_net: xsk: tx: support wakeup

2024-01-16 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 --- drivers/net/virtio/main.c | 20 ++-- drivers/net

[PATCH net-next 03/17] virtio_net: xsk: bind/unbind xsk

2024-01-16 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/Makefile | 2 +- drivers/net/virtio/main.c | 12 +- drivers/net/virtio/virtio_net.h | 18 +++ drivers/net/virtio/xsk.c| 188

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

2024-01-16 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 --- drivers/net/virtio/main.c | 77 - drivers/net/virtio

[PATCH net-next 09/17] virtio_net: xsk: tx: free the unused xsk buffer

2024-01-16 Thread Xuan Zhuo
virtnet_sq_free_unused_buf() check xsk buffer. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio/main.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c index cb0a1ea712de..e64d52e7d95b 100644

[PATCH net-next 11/17] virtio_net: separate receive_buf

2024-01-16 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 --- drivers/net/virtio/main.c | 56 ++- 1 file

[PATCH net-next 12/17] virtio_net: xsk: rx: support fill with xsk buffer

2024-01-16 Thread Xuan Zhuo
Implement the logic of filling rq with XSK buffers. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 9 +- drivers/net/virtio/virtio_net.h | 2 ++ drivers/net/virtio/xsk.c| 51 - drivers/net/virtio/xsk.h| 2 ++ 4 files changed

[PATCH net-next 08/17] virtio_net: xsk: tx: handle the transmitted xsk buffer

2024-01-16 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/virtio_net.h | 30 ++ drivers/net/virtio/xsk.c| 33 ++--- drivers/net

[PATCH net-next 13/17] virtio_net: xsk: rx: support recv merge mode

2024-01-16 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 --- drivers/net/virtio/main.c | 40 -- drivers/net/virtio/virtio_net.h | 4 + drivers/net/virtio/xsk.c| 216

[PATCH net-next 14/17] virtio_net: xsk: rx: support recv small mode

2024-01-16 Thread Xuan Zhuo
receive the xsk buffer for small mode. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/xsk.c | 33 + 1 file changed, 33 insertions(+) diff --git a/drivers/net/virtio/xsk.c b/drivers/net/virtio/xsk.c index 6f4fa32b1184..a73559faadf6 100644 --- a/drivers/net

[PATCH net-next 15/17] virtio_net: xsk: rx: free the unused xsk buffer

2024-01-16 Thread Xuan Zhuo
Since this will be called in other circumstances(freeze), we must check whether it is xsk's buffer in this function. It cannot be judged outside this function. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/v

[PATCH net-next 16/17] virtio_net: update tx timeout record

2024-01-16 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/xsk.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/virtio/xsk.c b/drivers/net/virtio/xsk.c index

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

2024-01-16 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/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c index 81d390781a4f..176d549b0c80

Re: [PATCH net-next 00/17] virtio-net: support AF_XDP zero copy (3/3)

2024-01-16 Thread Xuan Zhuo
On Tue, 16 Jan 2024 15:46:00 -0500, "Michael S. Tsirkin" wrote: > On Tue, Jan 16, 2024 at 07:07:05AM -0800, Jakub Kicinski wrote: > > On Tue, 16 Jan 2024 13:37:30 +0100 Paolo Abeni wrote: > > > For future submission it would be better if you split this series in > > > smaller chunks: the maximum

Re: [PATCH net-next 00/17] virtio-net: support AF_XDP zero copy (3/3)

2024-01-16 Thread Xuan Zhuo
On Tue, 16 Jan 2024 07:07:05 -0800, Jakub Kicinski wrote: > On Tue, 16 Jan 2024 13:37:30 +0100 Paolo Abeni wrote: > > For future submission it would be better if you split this series in > > smaller chunks: the maximum size allowed is 15 patches. > > Which does not mean you can split it up and pos

Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang

2024-01-18 Thread Xuan Zhuo
On Thu, 18 Jan 2024 08:14:21 -0500, "Michael S. Tsirkin" wrote: > On Tue, Jan 16, 2024 at 01:04:49PM +0100, Paolo Abeni wrote: > > On Mon, 2024-01-15 at 09:29 +0800, Zhu Yanjun wrote: > > > From: Zhu Yanjun > > > > > > Some devices emulate the virtio_net hardwares. When virtio_net > > > driver s

Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang

2024-01-21 Thread Xuan Zhuo
On Mon, 22 Jan 2024 11:14:30 +0800, Jason Wang wrote: > On Mon, Jan 22, 2024 at 10:12 AM Zhu Yanjun wrote: > > > > > > 在 2024/1/20 1:29, Andrew Lunn 写道: > > >while (!virtqueue_get_buf(vi->cvq, &tmp) && > > > - !virtqueue_is_broken(vi->cvq)) > > > + !virtque

Re: [PATCH net-next v3 06/27] virtio_ring: introduce virtqueue_get_buf_ctx_dma()

2024-01-21 Thread Xuan Zhuo
On Mon, 22 Jan 2024 12:18:51 +0800, Jason Wang wrote: > On Tue, Jan 16, 2024 at 3:47 PM Xuan Zhuo wrote: > > > > On Thu, 11 Jan 2024 16:34:09 +0800, Jason Wang wrote: > > > On Fri, Dec 29, 2023 at 3:31 PM Xuan Zhuo > > > wrote: > > > > > > &

Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang

2024-01-21 Thread Xuan Zhuo
On Mon, 22 Jan 2024 12:16:27 +0800, Jason Wang wrote: > On Mon, Jan 22, 2024 at 12:00 PM Xuan Zhuo wrote: > > > > On Mon, 22 Jan 2024 11:14:30 +0800, Jason Wang wrote: > > > On Mon, Jan 22, 2024 at 10:12 AM Zhu Yanjun wrote: > > > > > > &g

Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang

2024-01-21 Thread Xuan Zhuo
On Mon, 22 Jan 2024 14:55:46 +0800, Jason Wang wrote: > On Mon, Jan 22, 2024 at 2:20 PM Xuan Zhuo wrote: > > > > On Mon, 22 Jan 2024 12:16:27 +0800, Jason Wang wrote: > > > On Mon, Jan 22, 2024 at 12:00 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang

2024-01-21 Thread Xuan Zhuo
On Mon, 22 Jan 2024 14:58:09 +0800, Jason Wang wrote: > On Mon, Jan 22, 2024 at 2:55 PM Jason Wang wrote: > > > > On Mon, Jan 22, 2024 at 2:20 PM Xuan Zhuo > > wrote: > > > > > > On Mon, 22 Jan 2024 12:16:27 +0800, Jason Wang > > > wrote: &g

Re: [PATCH net-next 3/3] virtio-net: reduce the CPU consumption of dim worker

2024-01-21 Thread Xuan Zhuo
On Tue, 16 Jan 2024 21:11:33 +0800, Heng Qi wrote: > Accumulate multiple request commands to kick the device once, > and obtain the processing results of the corresponding commands > asynchronously. The batch command method is used to optimize the > CPU overhead of the DIM worker caused by the gue

Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang

2024-01-21 Thread Xuan Zhuo
On Mon, 22 Jan 2024 15:19:12 +0800, Jason Wang wrote: > On Mon, Jan 22, 2024 at 3:07 PM Xuan Zhuo wrote: > > > > On Mon, 22 Jan 2024 14:58:09 +0800, Jason Wang wrote: > > > On Mon, Jan 22, 2024 at 2:55 PM Jason Wang wrote: > > > > > > >

Re: [PATCH net-next 3/3] virtio-net: reduce the CPU consumption of dim worker

2024-01-21 Thread Xuan Zhuo
On Tue, 16 Jan 2024 21:11:33 +0800, Heng Qi wrote: > Accumulate multiple request commands to kick the device once, > and obtain the processing results of the corresponding commands > asynchronously. The batch command method is used to optimize the > CPU overhead of the DIM worker caused by the gue

Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang

2024-01-22 Thread Xuan Zhuo
On Mon, 22 Jan 2024 15:57:08 +0800, Jason Wang wrote: > On Mon, Jan 22, 2024 at 3:36 PM Xuan Zhuo wrote: > > > > On Mon, 22 Jan 2024 15:19:12 +0800, Jason Wang wrote: > > > On Mon, Jan 22, 2024 at 3:07 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH 1/1] virtio_net: Add timeout handler to avoid kernel hang

2024-01-22 Thread Xuan Zhuo
On Mon, 22 Jan 2024 16:32:46 +0800, Jason Wang wrote: > On Mon, Jan 22, 2024 at 4:04 PM Xuan Zhuo wrote: > > > > On Mon, 22 Jan 2024 15:57:08 +0800, Jason Wang wrote: > > > On Mon, Jan 22, 2024 at 3:36 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net-next 0/5] virtio-net: sq support premapped mode

2024-01-24 Thread Xuan Zhuo
On Thu, 25 Jan 2024 11:39:28 +0800, Jason Wang wrote: > On Tue, Jan 16, 2024 at 3:59 PM Xuan Zhuo wrote: > > > > This is the second part of virtio-net support AF_XDP zero copy. > > > > The whole patch set > > http://lore.kernel.org/all/20231229073108.5

Re: [PATCH net-next 0/5] virtio-net: sq support premapped mode

2024-01-24 Thread Xuan Zhuo
On Thu, 25 Jan 2024 13:42:05 +0800, Xuan Zhuo wrote: > On Thu, 25 Jan 2024 11:39:28 +0800, Jason Wang wrote: > > On Tue, Jan 16, 2024 at 3:59 PM Xuan Zhuo > > wrote: > > > > > > This is the second part of virtio-net support AF_XDP zero copy. > >

Re: [PATCH net-next 4/5] virtio_ring: introduce virtqueue_get_dma_premapped()

2024-01-24 Thread Xuan Zhuo
On Thu, 25 Jan 2024 11:39:03 +0800, Jason Wang wrote: > On Tue, Jan 16, 2024 at 3:59 PM Xuan Zhuo wrote: > > > > Introduce helper virtqueue_get_dma_premapped(), then the driver > > can know whether dma unmap is needed. > > > > Signed-off-by: Xuan Zhuo >

Re: [PATCH net-next 5/5] virtio_net: sq support premapped mode

2024-01-24 Thread Xuan Zhuo
On Thu, 25 Jan 2024 11:39:20 +0800, Jason Wang wrote: > On Tue, Jan 16, 2024 at 3:59 PM Xuan Zhuo wrote: > > > > If the xsk is enabling, the xsk tx will share the send queue. > > Any reason for this? Technically, virtio-net can work as other NIC > like 256 queues. There

Re: [PATCH net-next 0/5] virtio-net: sq support premapped mode

2024-01-24 Thread Xuan Zhuo
On Thu, 25 Jan 2024 14:14:58 +0800, Jason Wang wrote: > On Thu, Jan 25, 2024 at 1:52 PM Xuan Zhuo wrote: > > > > On Thu, 25 Jan 2024 13:42:05 +0800, Xuan Zhuo > > wrote: > > > On Thu, 25 Jan 2024 11:39:28 +0800, Jason Wang > > > wrote: > >

Re: [PATCH net-next 5/5] virtio_net: sq support premapped mode

2024-01-28 Thread Xuan Zhuo
On Mon, 29 Jan 2024 11:06:35 +0800, Jason Wang wrote: > On Thu, Jan 25, 2024 at 2:24 PM Xuan Zhuo wrote: > > > > On Thu, 25 Jan 2024 11:39:20 +0800, Jason Wang wrote: > > > On Tue, Jan 16, 2024 at 3:59 PM Xuan Zhuo > > > wrote: > > > > > > &g

Re: [PATCH net-next 4/5] virtio_ring: introduce virtqueue_get_dma_premapped()

2024-01-28 Thread Xuan Zhuo
On Mon, 29 Jan 2024 11:07:50 +0800, Jason Wang wrote: > On Thu, Jan 25, 2024 at 1:58 PM Xuan Zhuo wrote: > > > > On Thu, 25 Jan 2024 11:39:03 +0800, Jason Wang wrote: > > > On Tue, Jan 16, 2024 at 3:59 PM Xuan Zhuo > > > wrote: > > > > > &g

Re: [PATCH net-next 0/5] virtio-net: sq support premapped mode

2024-01-28 Thread Xuan Zhuo
On Mon, 29 Jan 2024 11:14:43 +0800, Jason Wang wrote: > On Thu, Jan 25, 2024 at 2:33 PM Xuan Zhuo wrote: > > > > On Thu, 25 Jan 2024 14:14:58 +0800, Jason Wang wrote: > > > On Thu, Jan 25, 2024 at 1:52 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net-next 0/5] virtio-net: sq support premapped mode

2024-01-28 Thread Xuan Zhuo
On Mon, 29 Jan 2024 11:37:56 +0800, Xuan Zhuo wrote: > On Mon, 29 Jan 2024 11:14:43 +0800, Jason Wang wrote: > > On Thu, Jan 25, 2024 at 2:33 PM Xuan Zhuo > > wrote: > > > > > > On Thu, 25 Jan 2024 14:14:58 +0800, Jason Wang > > > wrote: > &g

Re: [PATCH net-next 0/5] virtio-net: sq support premapped mode

2024-01-29 Thread Xuan Zhuo
On Tue, 30 Jan 2024 10:51:37 +0800, Jason Wang wrote: > On Mon, Jan 29, 2024 at 2:28 PM Xuan Zhuo wrote: > > > > On Mon, 29 Jan 2024 11:37:56 +0800, Xuan Zhuo > > wrote: > > > On Mon, 29 Jan 2024 11:14:43 +0800, Jason Wang > > > wrote: > >

Re: [PATCH net-next 4/5] virtio_ring: introduce virtqueue_get_dma_premapped()

2024-01-29 Thread Xuan Zhuo
On Tue, 30 Jan 2024 10:54:25 +0800, Jason Wang wrote: > On Mon, Jan 29, 2024 at 11:33 AM Xuan Zhuo wrote: > > > > On Mon, 29 Jan 2024 11:07:50 +0800, Jason Wang wrote: > > > On Thu, Jan 25, 2024 at 1:58 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net-next 5/5] virtio_net: sq support premapped mode

2024-01-29 Thread Xuan Zhuo
On Tue, 30 Jan 2024 10:56:25 +0800, Jason Wang wrote: > On Mon, Jan 29, 2024 at 11:28 AM Xuan Zhuo wrote: > > > > On Mon, 29 Jan 2024 11:06:35 +0800, Jason Wang wrote: > > > On Thu, Jan 25, 2024 at 2:24 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net-next v1 0/6] virtio-net: support device stats

2024-01-29 Thread Xuan Zhuo
On Tue, 30 Jan 2024 11:20:10 +0800, Jason Wang wrote: > On Tue, Jan 16, 2024 at 1:56 PM Xuan Zhuo wrote: > > > > On Tue, 26 Dec 2023 15:30:57 +0800, Xuan Zhuo > > wrote: > > > As the spec: > > > > > > https://github.com/oasis-tcs/virtio-spec

Re: [PATCH net-next 5/5] virtio_net: sq support premapped mode

2024-01-29 Thread Xuan Zhuo
On Tue, 30 Jan 2024 11:15:07 +0800, Xuan Zhuo wrote: > On Tue, 30 Jan 2024 10:56:25 +0800, Jason Wang wrote: > > On Mon, Jan 29, 2024 at 11:28 AM Xuan Zhuo > > wrote: > > > > > > On Mon, 29 Jan 2024 11:06:35 +0800, Jason Wang > > > wrote: > &g

[PATCH net-next v2 1/6] virtio_net: introduce device stats feature and structures

2024-01-30 Thread Xuan Zhuo
The virtio-net device stats spec: https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 This commit introduces the relative feature and structures. Signed-off-by: Xuan Zhuo --- include/uapi/linux/virtio_net.h | 137 1 file

[PATCH net-next v2 0/6] virtio-net: support device stats

2024-01-30 Thread Xuan Zhuo
definitions of the marco and the struct Xuan Zhuo (6): virtio_net: introduce device stats feature and structures virtio_net: virtnet_send_command supports command-specific-result virtio_net: support device stats virtio_net: stats map include driver stats virtio_net: add the total stats

[PATCH net-next v2 2/6] virtio_net: virtnet_send_command supports command-specific-result

2024-01-30 Thread Xuan Zhuo
As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 The virtnet cvq supports to get result from the device. This commit implement this. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 47 +++- 1 file

[PATCH net-next v2 3/6] virtio_net: support device stats

2024-01-30 Thread Xuan Zhuo
As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 make virtio-net support getting the stats from the device by ethtool -S . Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 362 ++- 1 file changed

[PATCH net-next v2 4/6] virtio_net: stats map include driver stats

2024-01-30 Thread Xuan Zhuo
In the last commit, we use the stats map to manage the device stats. For the consistency, we let the stats map includes the driver stats. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 195 --- 1 file changed, 100 insertions(+), 95 deletions

[PATCH net-next v2 5/6] virtio_net: add the total stats field

2024-01-30 Thread Xuan Zhuo
Now, we just show the stats of every queue. But for the user, the total values of every stat may are valuable. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 72 ++-- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/drivers/net

[PATCH net-next v2 6/6] virtio_net: rename stat tx_timeout to timeout

2024-01-30 Thread Xuan Zhuo
Now, we have this: tx_queue_0_tx_timeouts This is used to record the tx schedule timeout. But this has two "tx". I think the below is enough. tx_queue_0_timeouts So I rename this field. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 8 1 file changed, 4

Re: [PATCH net-next 0/5] virtio-net: sq support premapped mode

2024-02-22 Thread Xuan Zhuo
On Thu, 22 Feb 2024 14:45:08 -0500, "Michael S. Tsirkin" wrote: > On Tue, Jan 16, 2024 at 03:59:19PM +0800, Xuan Zhuo wrote: > > This is the second part of virtio-net support AF_XDP zero copy. > > My understanding is, there's going to be another version o

[PATCH net-next v3 0/6] virtio-net: support device stats

2024-02-27 Thread Xuan Zhuo
virtnet_stats_map v1: 1. fix some definitions of the marco and the struct Xuan Zhuo (6): virtio_net: introduce device stats feature and structures virtio_net: virtnet_send_command supports command-specific-result virtio_net: support device stats virtio_net: stats map include driver stats

[PATCH net-next v3 1/6] virtio_net: introduce device stats feature and structures

2024-02-27 Thread Xuan Zhuo
The virtio-net device stats spec: https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 This commit introduces the relative feature and structures. Signed-off-by: Xuan Zhuo --- include/uapi/linux/virtio_net.h | 137 1 file

[PATCH net-next v3 3/6] virtio_net: support device stats

2024-02-27 Thread Xuan Zhuo
As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 make virtio-net support getting the stats from the device by ethtool -S . Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 362 ++- 1 file changed

[PATCH net-next v3 2/6] virtio_net: virtnet_send_command supports command-specific-result

2024-02-27 Thread Xuan Zhuo
As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 The virtnet cvq supports to get result from the device. This commit implement this. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 47 +++- 1 file

[PATCH net-next v3 4/6] virtio_net: stats map include driver stats

2024-02-27 Thread Xuan Zhuo
In the last commit, we use the stats map to manage the device stats. For the consistency, we let the stats map includes the driver stats. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 195 --- 1 file changed, 100 insertions(+), 95 deletions

[PATCH net-next v3 5/6] virtio_net: add the total stats field

2024-02-27 Thread Xuan Zhuo
Now, we just show the stats of every queue. But for the user, the total values of every stat may are valuable. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 72 ++-- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/drivers/net

[PATCH net-next v3 6/6] virtio_net: rename stat tx_timeout to timeout

2024-02-27 Thread Xuan Zhuo
Now, we have this: tx_queue_0_tx_timeouts This is used to record the tx schedule timeout. But this has two "tx". I think the below is enough. tx_queue_0_timeouts So I rename this field. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 8 1 file changed, 4

Re: [PATCH net-next v3 5/6] virtio_net: add the total stats field

2024-03-07 Thread Xuan Zhuo
On Tue, 27 Feb 2024 06:54:24 -0800, Jakub Kicinski wrote: > On Tue, 27 Feb 2024 16:03:02 +0800 Xuan Zhuo wrote: > > Now, we just show the stats of every queue. > > > > But for the user, the total values of every stat may are valuable. > > Please wait for this

Re: [PATCH net-next v3 3/6] virtio_net: support device stats

2024-03-11 Thread Xuan Zhuo
On Thu, 7 Mar 2024 08:50:21 -0800, Jakub Kicinski wrote: > CC: Willem and some driver folks for more input, context: extending > https://lore.kernel.org/all/20240306195509.1502746-1-k...@kernel.org/ > to cover virtio stats. > > On Tue, 27 Feb 2024 16:03:00 +0800 Xuan Zhuo wrote: &g

[PATCH vhost v4 00/10] virtio: drivers maintain dma info for premapped vq

2024-03-11 Thread Xuan Zhuo
1. rename transport_vq_config to vq_transport_config 2. virtio-net set dma meta number to (ring-size + 1)(MAX_SKB_FRGAS +2) 3. introduce virtqueue_dma_map_sg_attrs 4. separate vring_create_virtqueue to an independent commit Xuan Zhuo (10): virtio_ring: introduce vring_need_unmap_buffer v

[PATCH vhost v4 01/10] virtio_ring: introduce vring_need_unmap_buffer

2024-03-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 vhost v4 04/10] virtio_ring: split: remove double check of the unmap ops

2024-03-11 Thread Xuan Zhuo
vq->premapped is not needed to check 4. the vq->indirect is not needed to check 5. the state->indir_desc must not be null Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 79 +--- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git

[PATCH vhost v4 03/10] virtio_ring: packed: structure the indirect desc table

2024-03-11 Thread Xuan Zhuo
must record the dma info. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 66 +--- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 0dfbd17e5a87..22a588bba166 100644 --- a

<    1   2   3   4   5   6   7   >