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 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 3/3] virtio-net: reduce the CPU consumption of dim worker

2024-01-16 Thread Heng Qi
在 2024/1/17 上午3:56, Simon Horman 写道: On Tue, Jan 16, 2024 at 09:11:33PM +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 over

Re: [PATCH net-next 2/3] virtio-net: batch dim request

2024-01-16 Thread Heng Qi
在 2024/1/17 上午3:49, Simon Horman 写道: On Tue, Jan 16, 2024 at 09:11:32PM +0800, Heng Qi wrote: Currently, when each time the driver attempts to update the coalescing parameters for a vq, it needs to kick the device. The following path is observed: 1. Driver kicks the device; 2. After the

Re: [PATCH net-next 1/3] virtio-net: fix possible dim status unrecoverable

2024-01-16 Thread Heng Qi
在 2024/1/16 下午9:15, Michael S. Tsirkin 写道: On Tue, Jan 16, 2024 at 09:11:31PM +0800, Heng Qi wrote: When the dim worker is scheduled, if it fails to acquire the lock, dim may not be able to return to the working state later. For example, the following single queue scenario: 1. The dim wor

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

2024-01-16 Thread Michael S. Tsirkin
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 size allowed is 15 patches. > > Which does not mean you can split it up a

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

2024-01-16 Thread Simon Horman
On Tue, Jan 16, 2024 at 09:11:33PM +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 th

Re: [PATCH net-next 2/3] virtio-net: batch dim request

2024-01-16 Thread Simon Horman
On Tue, Jan 16, 2024 at 09:11:32PM +0800, Heng Qi wrote: > Currently, when each time the driver attempts to update the coalescing > parameters for a vq, it needs to kick the device. > The following path is observed: > 1. Driver kicks the device; > 2. After the device receives the kick, CPU sche

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

2024-01-16 Thread Jakub Kicinski
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 post them all at the same time, FWIW.

Re: [PATCH net-next 1/3] virtio-net: fix possible dim status unrecoverable

2024-01-16 Thread Michael S. Tsirkin
On Tue, Jan 16, 2024 at 09:11:31PM +0800, Heng Qi wrote: > When the dim worker is scheduled, if it fails to acquire the lock, > dim may not be able to return to the working state later. > > For example, the following single queue scenario: > 1. The dim worker of rxq0 is scheduled, and the dim st

[PATCH net-next 2/3] virtio-net: batch dim request

2024-01-16 Thread Heng Qi
Currently, when each time the driver attempts to update the coalescing parameters for a vq, it needs to kick the device. The following path is observed: 1. Driver kicks the device; 2. After the device receives the kick, CPU scheduling occurs and DMA multiple buffers multiple times; 3. Th

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

2024-01-16 Thread Heng Qi
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 guest being busy waiting for the command response result. On a

[PATCH net-next 1/3] virtio-net: fix possible dim status unrecoverable

2024-01-16 Thread Heng Qi
When the dim worker is scheduled, if it fails to acquire the lock, dim may not be able to return to the working state later. For example, the following single queue scenario: 1. The dim worker of rxq0 is scheduled, and the dim status is changed to DIM_APPLY_NEW_PROFILE; 2. The ethtool com

[PATCH net-next 0/3] virtio-net: a fix and some updates for virtio dim

2024-01-16 Thread Heng Qi
Patch 1 fixes an existing bug. Belongs to the net branch. Patch 2 requires updating the virtio spec. Patch 3 only attempts to modify the sending of dim cmd to an asynchronous way, and does not affect the synchronization way of ethtool cmd. Heng Qi (3): virtio-net: fix possible dim status unrecov

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

2024-01-16 Thread Paolo Abeni
On Tue, 2024-01-16 at 17:42 +0800, Xuan Zhuo wrote: > This is the third part of virtio-net support AF_XDP zero copy. > > The whole patch set > http://lore.kernel.org/all/20231229073108.57778-1-xuanz...@linux.alibaba.com > > ## AF_XDP > > XDP socket(AF_XDP) is an excellent bypass kernel

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

2024-01-16 Thread Paolo Abeni
On Tue, 2024-01-16 at 14:28 +0800, Xuan Zhuo wrote: > This is first part of virtio-net support AF_XDP zero copy. For future submissions, unless explcitly requested otherwise, please wait for a series being processed before posting the follow-ups. Otherwise any change requested to earlier patches c

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

2024-01-16 Thread Paolo Abeni
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 sends commands to the emulated hardware, normally the > hardware needs time to response. Sometimes the time is very > long. Thus, the following will

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

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

[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/virtio/ma

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

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

2024-01-16 Thread Xuan Zhuo
The virtnet_xdp_handler() is re-used. But 1. We need to copy data to create skb for XDP_PASS. 2. We need to call xsk_buff_free() to release the buffer. 3. The handle for xdp_buff is difference. If we pushed this logic into existing receive handle(merge and small), we would have to maintain code s

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

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

[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 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/virtio_net.h

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

[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 | 4 ++ drivers

[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_net.h | 72 +

[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/main.c

[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 00/17] virtio-net: support AF_XDP zero copy (3/3)

2024-01-16 Thread Xuan Zhuo
This is the third part of virtio-net support AF_XDP zero copy. The whole patch set http://lore.kernel.org/all/20231229073108.57778-1-xuanz...@linux.alibaba.com ## AF_XDP XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero copy feature of xsk (XDP socket) needs to be supp

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

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

2024-01-16 Thread Xuan Zhuo
If the xsk is enabling, the xsk tx will share the send queue. But the xsk requires that the send queue use the premapped mode. So the send queue must support premapped mode. command: pktgen_sample01_simple.sh -i eth0 -s 16/1400 -d 10.0.0.123 -m 00:16:3e:12:e1:3e -n 0 -p 100 machine: ecs.ebmg6e.2

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