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

2024-01-15 Thread Xuan Zhuo
introduce virtqueue_detach_unused_buf_dma() to collect the dma info when get buf from virtio core for premapped mode. If the virtio queue is premapped mode, the virtio-net send buf may have many desc. Every desc dma address need to be unmap. So here we introduce a new helper to collect the dma add

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

2024-01-15 Thread Xuan Zhuo
Now, inside virtqueue_disable_and_recycle, the recycle() just has two parameters(vq, buf) after detach operate. But if we are in premapped mode, we may need to get some dma info when detach buf like virtqueue_get_buf_ctx_dma(). So we call recycle directly, this callback detaches bufs self. It sho

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

2024-01-15 Thread Xuan Zhuo
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 premapped mode, the virtio-net send buf may have many desc. Every desc dma address need to be unmap. So here we introduce a new helper to collect the dma address o

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

2024-01-15 Thread Xuan Zhuo
This is the second 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 ## About the branch This patch set is pushed to the net-next branch, but some patches are about virtio core. Because the entire patch s

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 premapped mode, the virtio-net send b

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

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

2024-01-15 Thread Xuan Zhuo
This is first 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 support

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

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 review. > > Thanks. > > v1: >

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

2024-01-15 Thread Zhu Yanjun
在 2024/1/15 10:20, Jason Wang 写道: On Mon, Jan 15, 2024 at 9:35 AM 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.