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

2021-01-13 Thread Xuan Zhuo
are not enough queues. Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c | 47 +++ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ba8e637..7a3b2a7

[PATCH bpf-next] xsk: build skb by page

2021-01-15 Thread Xuan Zhuo
10241500 copy1916747 1775988 1600203 1440054 page1974058 1953655 1945463 1904478 percent 3.0%10.0% 21.58% 32.3% Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- drivers/net/virtio_net.c| 2 +- include/linux/netdev_features.h | 5 +- net/ethtool/

[PATCH net-next v2 0/7] virtio-net support xdp socket zero copy xmit

2021-01-15 Thread Xuan Zhuo
SGSIZE 100% 713274 64 100% 701024 512 100% 695832 1456 Xuan Zhuo (7): xsk: support get page for drv virtio-net, xsk: distinguish XDP_TX and XSK XMIT ctx xsk, virtio-net: prepare for support xsk zerocopy xmit virtio-net, xsk: support xsk enable/disable virtio-net, xs

[PATCH net-next v2 6/7] virtio-net, xsk: implement xsk wakeup callback

2021-01-15 Thread Xuan Zhuo
-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 51 1 file changed, 51 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 42aa9ad..e552c2d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c

[PATCH net-next v2 3/7] xsk, virtio-net: prepare for support xsk zerocopy xmit

2021-01-15 Thread Xuan Zhuo
hen adding xsk support. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 95 ++-- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index e707c31..9013328 100644 --- a/drivers/net/vi

[PATCH net-next v2 5/7] virtio-net, xsk: realize the function of xsk packet sending

2021-01-15 Thread Xuan Zhuo
. Because the virtio interface does not use the dma address. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 200 ++- 1 file changed, 197 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a62d456

[PATCH net-next v2 2/7] virtio-net, xsk: distinguish XDP_TX and XSK XMIT ctx

2021-01-15 Thread Xuan Zhuo
virtnet_xdp_type.offset is used to record the offset between "true ctx" and virtnet_xdp_type. The newly added virtnet_xsk_hdr will be used for xsk. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 75 ++-- 1 file changed, 60 inserti

[PATCH net-next v2 4/7] virtio-net, xsk: support xsk enable/disable

2021-01-15 Thread Xuan Zhuo
idered that the device is busy. * xsk_num_max: the xsk.hdr max num * xsk_num_percent: the max hdr num be the percent of the virtio ring size. The real xsk hdr num will the min of xsk_num_max and the percent of the num of virtio ring * xsk_budget: the budget for xsk run Signed-off-by: Xua

[PATCH net-next v2 1/7] xsk: support get page for drv

2021-01-15 Thread Xuan Zhuo
to get the page based on addr in drv. Signed-off-by: Xuan Zhuo --- include/linux/netdevice.h | 1 + include/net/xdp_sock_drv.h | 10 ++ include/net/xsk_buff_pool.h | 1 + net/xdp/xsk_buff_pool.c | 10 +- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a

[PATCH net-next v2 7/7] virtio-net, xsk: set xsk completed when packet sent done

2021-01-15 Thread Xuan Zhuo
When recycling packets that have been sent, call xsk_tx_completed to inform xsk which packets have been sent. If necessary, start napi to process the packets in the xsk queue. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 49 1 file

[PATCH bpf-next v2 1/3] net: add priv_flags for allow tx skb without linear

2021-01-19 Thread Xuan Zhuo
supports this feature. Signed-off-by: Xuan Zhuo Suggested-by: Alexander Lobakin --- include/linux/netdevice.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 02dcef4..54501eb 100644 --- a/include/linux/netdevice.h +++ b/include

[PATCH bpf-next v2 3/3] xsk: build skb by page

2021-01-19 Thread Xuan Zhuo
1945463 1904478 percent 3.0%10.0% 21.58% 32.3% Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- net/xdp/xsk.c | 112 -- 1 file changed, 94 insertions(+), 18 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 8037b04..8c291f8

[PATCH bpf-next v2 0/3] xsk: build skb by page

2021-01-19 Thread Xuan Zhuo
Test cmd: ``` xdpsock -i eth0 -t -S -s ``` Test result data: size64 512 10241500 copy1916747 1775988 1600203 1440054 page1974058 1953655 1945463 1904478 percent 3.0%10.0% 21.58% 32.3% Xuan Zhuo (3): net: add priv_flags for allow tx skb without linear virtio-net:

[PATCH bpf-next v2 2/3] virtio-net: support IFF_TX_SKB_NO_LINEAR

2021-01-19 Thread Xuan Zhuo
Virtio net supports the case where the skb linear space is empty, so add priv_flags. 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 ba8e637..80d637f 100644

[PATCH net-next v2 2/3] virtio-net: support IFF_TX_SKB_NO_LINEAR

2021-01-19 Thread Xuan Zhuo
Virtio net supports the case where the skb linear space is empty, so add priv_flags. 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 ba8e637..f2ff6c3 100644

[PATCH net-next v2 3/3] xsk: build skb by page

2021-01-19 Thread Xuan Zhuo
1945463 1904478 percent 3.0%10.0% 21.58% 32.3% Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- net/xdp/xsk.c | 104 -- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 8037b04..817a3a5

[PATCH net-next v2 3/3] xsk: build skb by page

2021-01-20 Thread Xuan Zhuo
1945463 1904478 percent 3.0%10.0% 21.58% 32.3% Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- net/xdp/xsk.c | 104 -- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 8037b04..40bac11

[PATCH bpf-next v3 0/3] xsk: build skb by page

2021-01-21 Thread Xuan Zhuo
iyun ECS server. Test cmd: ``` xdpsock -i eth0 -t -S -s ``` Test result data: size64 512 10241500 copy1916747 1775988 1600203 1440054 page1974058 1953655 1945463 1904478 percent 3.0%10.0% 21.58% 32.3% Xuan Zhuo (3): net: add priv_flags for allow tx skb withou

[PATCH bpf-next v3 1/3] net: add priv_flags for allow tx skb without linear

2021-01-21 Thread Xuan Zhuo
supports this feature. Signed-off-by: Xuan Zhuo Suggested-by: Alexander Lobakin --- include/linux/netdevice.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ef51725..135db8f 100644 --- a/include/linux/netdevice.h +++ b/include

[PATCH bpf-next v3 2/3] virtio-net: support IFF_TX_SKB_NO_LINEAR

2021-01-21 Thread Xuan Zhuo
Virtio net supports the case where the skb linear space is empty, so add priv_flags. 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 ba8e637..f2ff6c3 100644

[PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-21 Thread Xuan Zhuo
1945463 1904478 percent 3.0%10.0% 21.58% 32.3% Signed-off-by: Xuan Zhuo Reviewed-by: Dust Li --- net/xdp/xsk.c | 104 -- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 4a83117..38af7f1

[PATCH bpf-next] xsk: save the undone skb

2020-12-11 Thread Xuan Zhuo
xskq_prod_reserve has been updated. Signed-off-by: Xuan Zhuo --- include/net/xdp_sock.h | 3 +++ net/xdp/xsk.c | 36 +++- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h index 4f4e93b..fead0c9

[PATCH bpf-next] xsk: build skb by page

2020-12-23 Thread Xuan Zhuo
This patch is used to construct skb based on page to save memory copy overhead. Taking into account the problem of addr unaligned, and the possibility of frame size greater than page in the future. Signed-off-by: Xuan Zhuo --- net/xdp/xsk.c | 68

[PATCH bpf V3 2/2] xsk: change the tx writeable condition

2020-12-01 Thread Xuan Zhuo
. Signed-off-by: Xuan Zhuo Acked-by: Magnus Karlsson --- net/xdp/xsk.c | 16 +--- net/xdp/xsk_queue.h | 6 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 9bbfd8a..6250447 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c

[PATCH bpf V3 1/2] xsk: replace datagram_poll by sock_poll_wait

2020-12-01 Thread Xuan Zhuo
datagram_poll will judge the current socket status (EPOLLIN, EPOLLOUT) based on the traditional socket information (eg: sk_wmem_alloc), but this does not apply to xsk. So this patch uses sock_poll_wait instead of datagram_poll, and the mask is calculated by xsk_poll. Signed-off-by: Xuan Zhuo

[PATCH bpf V3 0/2] xsk: fix for xsk_poll writeable

2020-12-01 Thread Xuan Zhuo
V2: #2 patch made some changes following magnus' opinions. V3: Regarding the function xskq_cons_present_entries, I think daniel are right, I have modified it. Xuan Zhuo (2): xsk: replace datagram_poll by sock_poll_wait xsk: change the tx writeable condition net/xdp/

[PATCH 3/3] xsk: set tx/rx the min entries

2020-11-18 Thread Xuan Zhuo
not cause packet loss because it cannot receive the packets uploaded by the network card at one time. Of course, the 1024 here is only an estimated value, and the number of packets sent by each network card at a time may be different. Signed-off-by: Xuan Zhuo --- include/uapi/linux/if_xdp.h | 2

[PATCH 2/3] xsk: change the tx writeable condition

2020-11-18 Thread Xuan Zhuo
. Signed-off-by: Xuan Zhuo --- net/xdp/xsk.c | 20 +--- net/xdp/xsk_queue.h | 6 ++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 7f0353e..bc3d4ece 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -211,6 +211,17

[PATCH 0/3] xsk: fix for xsk_poll writeable

2020-11-18 Thread Xuan Zhuo
in the cq queue from nic. In this way, as long as the tx configured by the user is larger, we won't have the situation that tx is already in the writeable state but cannot get the item from cq. Xuan Zhuo (3): xsk: replace datagram_poll by sock_poll_wait xsk: change the tx writeable condi

[PATCH 1/3] xsk: replace datagram_poll by sock_poll_wait

2020-11-18 Thread Xuan Zhuo
datagram_poll will judge the current socket status (EPOLLIN, EPOLLOUT) based on the traditional socket information (eg: sk_wmem_alloc), but this does not apply to xsk. So this patch uses sock_poll_wait instead of datagram_poll, and the mask is calculated by xsk_poll. Signed-off-by: Xuan Zhuo

[PATCH bpf v2 2/2] xsk: change the tx writeable condition

2020-11-24 Thread Xuan Zhuo
. Signed-off-by: Xuan Zhuo --- net/xdp/xsk.c | 16 +--- net/xdp/xsk_queue.h | 6 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 0df8651..22e35e9 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -211,6 +211,14 @@ static

[PATCH bpf v2 0/2] xsk: fix for xsk_poll writeable

2020-11-24 Thread Xuan Zhuo
Thanks for magnus very much. V2: #2 patch made some changes following magnus' opinions. Xuan Zhuo (2): xsk: replace datagram_poll by sock_poll_wait xsk: change the tx writeable condition net/xdp/xsk.c | 20 net/xdp/xsk_queue.h | 6 ++ 2 files change

[PATCH bpf v2 1/2] xsk: replace datagram_poll by sock_poll_wait

2020-11-24 Thread Xuan Zhuo
datagram_poll will judge the current socket status (EPOLLIN, EPOLLOUT) based on the traditional socket information (eg: sk_wmem_alloc), but this does not apply to xsk. So this patch uses sock_poll_wait instead of datagram_poll, and the mask is calculated by xsk_poll. Signed-off-by: Xuan Zhuo

[PATCH] xsk: add cq event

2020-11-16 Thread Xuan Zhuo
ription of this event, I think it can also be 'readable', although it is indeed different from the 'readable' of the new data. But the overhead of xsk checking whether cq or rx is readable is small. Signed-off-by: Xuan Zhuo --- include/net/xdp_sock.h | 1 + include/uapi/

[PATCH bpf-next] xsk: build skb by page

2020-12-29 Thread Xuan Zhuo
result data: size64 512 10241500 copy1916747 1775988 1600203 1440054 page1974058 1953655 1945463 1904478 percent 3.0%10.0% 21.58% 32.3% Signed-off-by: Xuan Zhuo --- net/xdp/xsk.c | 68 --- 1 file changed, 51

mlx5 error when the skb linear space is empty

2021-01-04 Thread Xuan Zhuo
hi In the process of developing xdp socket, we tried to directly use page to construct skb directly, to avoid data copy. And the MAC information is also in the page, which caused the linear space of skb to be empty. In this case, I encountered a problem : mlx5_core :3b:00.1 eth1: Error cqe on

[PATCH netdev 2/5] virtio-net: support XDP_TX when not more queues

2021-01-05 Thread Xuan Zhuo
The number of queues implemented by many virtio backends is limited, especially some machines have a large number of CPUs. In this case, it is often impossible to allocate a separate queue for XDP_TX. This patch allows XDP_TX to run by lock when not enough queue. Signed-off-by: Xuan Zhuo

[PATCH netdev 0/5] virtio-net support xdp socket zero copy xmit

2021-01-05 Thread Xuan Zhuo
virtio-net supporting xsk's zero copy rx, I am also developing it, but I found that the modification may be relatively large, so I consider this patch set to be separated from the code related to xsk zero copy rx. Xuan Zhuo (5): xsk: support get page for drv virtio-net: support XDP_TX when not

[PATCH netdev 4/5] xsk, virtio-net: prepare for support xsk

2021-01-05 Thread Xuan Zhuo
hen adding xsk support. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 95 ++-- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index df38a9f..e744dce 100644 --- a/drivers/net/vi

[PATCH netdev 1/5] xsk: support get page for drv

2021-01-05 Thread Xuan Zhuo
to get the page based on addr in drv. Signed-off-by: Xuan Zhuo --- include/linux/netdevice.h | 1 + include/net/xdp_sock_drv.h | 10 ++ include/net/xsk_buff_pool.h | 1 + net/xdp/xsk_buff_pool.c | 10 +- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a

[PATCH netdev 3/5] virtio-net, xsk: distinguish XDP_TX and XSK XMIT ctx

2021-01-05 Thread Xuan Zhuo
virtnet_xdp_type.offset is used to record the offset between "true ctx" and virtnet_xdp_type. The newly added virtnet_xsk_hdr will be used for xsk. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 77 ++-- 1 file changed, 62 inserti

[PATCH netdev 5/5] virtio-net, xsk: virtio-net support xsk zero copy tx

2021-01-05 Thread Xuan Zhuo
ax and the percent of the num of virtio ring * xsk_budget: the budget for xsk run Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 437 ++- 1 file changed, 434 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_n

[PATCH] xdp: auto off xdp by bond fd

2020-11-05 Thread Xuan Zhuo
through netlink. In this way, when the app closes fd or the process exits, the release callback of fd can trigger to off xdp. Signed-off-by: Xuan Zhuo --- include/uapi/linux/if_link.h | 1 + include/uapi/linux/rtnetlink.h | 1 + net/core/rtnetlink.c | 71

Re: [PATCH net-next v2 00/21] virtio-net: support AF_XDP zero copy

2023-11-07 Thread Xuan Zhuo
On Tue, 7 Nov 2023 10:01:48 -0800, Jakub Kicinski wrote: > On Tue, 7 Nov 2023 11:12:06 +0800 Xuan Zhuo wrote: > > Please review. > > ## Form letter - net-next-closed > > The merge window for v6.7 has begun and we have already posted our pull > request. Therefore ne

Re: [PATCH net-next v2 00/21] virtio-net: support AF_XDP zero copy

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 03:19:04 -0500, "Michael S. Tsirkin" wrote: > On Tue, Nov 07, 2023 at 11:12:06AM +0800, Xuan Zhuo wrote: > > ## AF_XDP > > > > XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero > > copy feature of xsk (XDP socket

Re: [PATCH net-next v2 08/21] virtio_net: sq support premapped mode

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 14:37:38 +0800, Jason Wang wrote: > On Tue, Nov 7, 2023 at 11:12 AM Xuan Zhuo wrote: > > > > 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

Re: [PATCH net-next v2 12/21] virtio_net: xsk: tx: support tx

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 03:09:00 -0500, "Michael S. Tsirkin" wrote: > On Tue, Nov 07, 2023 at 11:12:18AM +0800, 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. > &

Re: [PATCH net-next v2 17/21] virtio_net: xsk: rx: skip dma unmap when rq is bind with AF_XDP

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 03:15:03 -0500, "Michael S. Tsirkin" wrote: > On Tue, Nov 07, 2023 at 11:12:23AM +0800, Xuan Zhuo wrote: > > When rq is bound with AF_XDP, the buffer dma is managed > > by the AF_XDP APIs. So the buffer got from the virtio core should > &g

Re: [PATCH net-next v2 16/21] virtio_net: xsk: rx: introduce add_recvbuf_xsk()

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 03:12:27 -0500, "Michael S. Tsirkin" wrote: > On Tue, Nov 07, 2023 at 11:12:22AM +0800, Xuan Zhuo wrote: > > Implement the logic of filling rq with XSK buffers. > > > > Signed-off-by: Xuan Zhuo > > --- > > drivers/net/virtio/ma

Re: [PATCH net-next v2 14/21] virtio_net: xsk: tx: virtnet_free_old_xmit() distinguishes xsk buffer

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 06:11:49 -0500, "Michael S. Tsirkin" wrote: > On Tue, Nov 07, 2023 at 11:12:20AM +0800, Xuan Zhuo wrote: > > virtnet_free_old_xmit distinguishes three type ptr(skb, xdp frame, xsk > > buffer) by the last bits of the pointer. > &g

Re: [PATCH net-next v2 14/21] virtio_net: xsk: tx: virtnet_free_old_xmit() distinguishes xsk buffer

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 06:59:48 -0500, "Michael S. Tsirkin" wrote: > On Thu, Nov 09, 2023 at 07:16:08PM +0800, Xuan Zhuo wrote: > > On Thu, 9 Nov 2023 06:11:49 -0500, "Michael S. Tsirkin" > > wrote: > > > On Tue, Nov 07, 2023 at 11:12:20AM +0800, Xu

Re: [PATCH net-next v2 17/21] virtio_net: xsk: rx: skip dma unmap when rq is bind with AF_XDP

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 07:00:51 -0500, "Michael S. Tsirkin" wrote: > On Thu, Nov 09, 2023 at 07:10:02PM +0800, Xuan Zhuo wrote: > > On Thu, 9 Nov 2023 03:15:03 -0500, "Michael S. Tsirkin" > > wrote: > > > On Tue, Nov 07, 2023 at 11:12:23AM +0800, Xu

Re: [PATCH net-next v2 12/21] virtio_net: xsk: tx: support tx

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 06:58:48 -0500, "Michael S. Tsirkin" wrote: > On Thu, Nov 09, 2023 at 07:06:23PM +0800, Xuan Zhuo wrote: > > On Thu, 9 Nov 2023 03:09:00 -0500, "Michael S. Tsirkin" > > wrote: > > > On Tue, Nov 07, 2023 at 11:12:18AM +0800, Xuan

Re: [PATCH net] virtio_net: fix missing dma unmap for resize

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 07:06:16 -0500, "Michael S. Tsirkin" wrote: > On Mon, Nov 06, 2023 at 04:18:32PM +0800, Xuan Zhuo wrote: > > For rq, we have three cases getting buffers from virtio core: > > > > 1. virtqueue_get_buf{,_ctx} > > 2. virtqueue_detach_unused_buf

Re: [PATCH net-next v2 16/21] virtio_net: xsk: rx: introduce add_recvbuf_xsk()

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 17:26:33 +0100, Maciej Fijalkowski wrote: > On Thu, Nov 09, 2023 at 07:11:46PM +0800, Xuan Zhuo wrote: > > On Thu, 9 Nov 2023 03:12:27 -0500, "Michael S. Tsirkin" > > wrote: > > > On Tue, Nov 07, 2023 at 11:12:22AM +0800, Xuan Zhuo wro

Re: [PATCH net-next v2 16/21] virtio_net: xsk: rx: introduce add_recvbuf_xsk()

2023-11-09 Thread Xuan Zhuo
On Thu, 9 Nov 2023 03:12:27 -0500, "Michael S. Tsirkin" wrote: > On Tue, Nov 07, 2023 at 11:12:22AM +0800, Xuan Zhuo wrote: > > Implement the logic of filling rq with XSK buffers. > > > > Signed-off-by: Xuan Zhuo > > --- > > drivers/net/virtio/ma

Re: [PATCH net] virtio_net: fix missing dma unmap for resize

2023-11-09 Thread Xuan Zhuo
On Fri, 10 Nov 2023 00:37:32 -0500, "Michael S. Tsirkin" wrote: > On Fri, Nov 10, 2023 at 09:58:45AM +0800, Xuan Zhuo wrote: > > On Thu, 9 Nov 2023 07:06:16 -0500, "Michael S. Tsirkin" > > wrote: > > > On Mon, Nov 06, 2023 at 04:18:32PM +0800, Xu

Re: [PATCH net-next v2 14/21] virtio_net: xsk: tx: virtnet_free_old_xmit() distinguishes xsk buffer

2023-11-09 Thread Xuan Zhuo
On Fri, 10 Nov 2023 00:32:50 -0500, "Michael S. Tsirkin" wrote: > On Fri, Nov 10, 2023 at 09:44:32AM +0800, Xuan Zhuo wrote: > > On Thu, 9 Nov 2023 06:59:48 -0500, "Michael S. Tsirkin" > > wrote: > > > On Thu, Nov 09, 2023 at 07:16:08PM +0800, Xuan

Re: [PATCH net-next v2 17/21] virtio_net: xsk: rx: skip dma unmap when rq is bind with AF_XDP

2023-11-09 Thread Xuan Zhuo
On Fri, 10 Nov 2023 00:33:27 -0500, "Michael S. Tsirkin" wrote: > On Fri, Nov 10, 2023 at 09:47:16AM +0800, Xuan Zhuo wrote: > > On Thu, 9 Nov 2023 07:00:51 -0500, "Michael S. Tsirkin" > > wrote: > > > On Thu, Nov 09, 2023 at 07:10:02PM +0800, Xuan

Re: [PATCH net-next v2 16/21] virtio_net: xsk: rx: introduce add_recvbuf_xsk()

2023-11-13 Thread Xuan Zhuo
On Mon, 13 Nov 2023 17:00:50 +0100, Maciej Fijalkowski wrote: > On Fri, Nov 10, 2023 at 10:38:04AM +0800, Xuan Zhuo wrote: > > On Thu, 9 Nov 2023 17:26:33 +0100, Maciej Fijalkowski > > wrote: > > > On Thu, Nov 09, 2023 at 07:11:46PM +0800, Xuan Zhuo wrote: > > &

Re: [PATCH net-next v2 08/21] virtio_net: sq support premapped mode

2023-11-13 Thread Xuan Zhuo
On Tue, 14 Nov 2023 11:26:42 +0800, Jason Wang wrote: > On Thu, Nov 9, 2023 at 7:06 PM Xuan Zhuo wrote: > > > > On Thu, 9 Nov 2023 14:37:38 +0800, Jason Wang wrote: > > > On Tue, Nov 7, 2023 at 11:12 AM Xuan Zhuo > > > wrote: > > > > > > &g

Re: [PATCH net-next v2 18/21] virtio_net: xsk: rx: introduce receive_xsk() to recv xsk buffer

2023-11-13 Thread Xuan Zhuo
On Mon, 13 Nov 2023 17:11:04 +0100, Maciej Fijalkowski wrote: > On Tue, Nov 07, 2023 at 11:12:24AM +0800, Xuan Zhuo wrote: > > 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() t

Re: [PATCH net-next v2 08/21] virtio_net: sq support premapped mode

2023-11-13 Thread Xuan Zhuo
On Tue, 14 Nov 2023 11:55:52 +0800, Jason Wang wrote: > On Tue, Nov 14, 2023 at 11:42 AM Xuan Zhuo wrote: > > > > On Tue, 14 Nov 2023 11:26:42 +0800, Jason Wang wrote: > > > On Thu, Nov 9, 2023 at 7:06 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net-next v2 08/21] virtio_net: sq support premapped mode

2023-11-13 Thread Xuan Zhuo
On Tue, 14 Nov 2023 12:27:20 +0800, Jason Wang wrote: > On Tue, Nov 14, 2023 at 11:59 AM Xuan Zhuo wrote: > > > > On Tue, 14 Nov 2023 11:55:52 +0800, Jason Wang wrote: > > > On Tue, Nov 14, 2023 at 11:42 AM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH net-next v1 16/19] virtio_net: xsk: rx: introduce receive_xsk() to recv xsk buffer

2023-11-14 Thread Xuan Zhuo
On Fri, 20 Oct 2023 14:57:06 +0800, Jason Wang wrote: > On Mon, Oct 16, 2023 at 8:01 PM Xuan Zhuo wrote: > > > > Implementing the logic of xsk rx. If this packet is not for XSK > > determined in XDP, then we need to copy once to generate a SKB. > > If it is for XS

Re: [PATCH vhost v13 11/12] virtio_ring: introduce dma sync api for virtqueue

2023-11-30 Thread Xuan Zhuo
On Thu, 30 Nov 2023 05:10:42 -0500, "Michael S. Tsirkin" wrote: > On Thu, Nov 30, 2023 at 05:49:38PM +0800, Xuan Zhuo wrote: > > On Thu, 30 Nov 2023 04:45:58 -0500, "Michael S. Tsirkin" > > wrote: > > > On Thu, Aug 10, 2023 at 08:30:56PM +0800,

[PATCH v1] virtio_net: fix missing dma unmap for resize

2023-12-12 Thread Xuan Zhuo
quot;virtio_net: merge dma operations when filling mergeable buffers") Signed-off-by: Xuan Zhuo --- v1: rename to virtnet_rq_free_buf_check_dma() drivers/net/virtio_net.c | 60 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/driver

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

2023-12-21 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 2/6] virtio_net: virtnet_send_command supports command-specific-result

2023-12-21 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 0/6] virtio-net: support device stats

2023-12-21 Thread Xuan Zhuo
As the spec: https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 The virtio net supports to get device stats. Please review. Thanks. Xuan Zhuo (6): virtio_net: introduce device stats feature and structures virtio_net: virtnet_send_command supports

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

2023-12-21 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 3/6] virtio_net: support device stats

2023-12-21 Thread Xuan Zhuo
As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 Virtio-net supports to get the stats from the device by ethtool -S . Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 354 ++- 1 file changed, 350

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

2023-12-21 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 | 194 --- 1 file changed, 102 insertions(+), 92 deletions

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

2023-12-21 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 v1] virtio_net: fix missing dma unmap for resize

2023-12-25 Thread Xuan Zhuo
On Tue, 12 Dec 2023 03:26:41 -0500, "Michael S. Tsirkin" wrote: > On Tue, Dec 12, 2023 at 04:11:41PM +0800, Xuan Zhuo wrote: > > For rq, we have three cases getting buffers from virtio core: > > > > 1. virtqueue_get_buf{,_ctx} > > 2. virtqueue_

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

2023-12-25 Thread Xuan Zhuo
On Mon, 25 Dec 2023 16:01:39 +0800, Zhu Yanjun wrote: > 在 2023/12/22 11:30, Xuan Zhuo 写道: > > The virtio-net device stats spec: > > > > https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 > > > > This commit introduces th

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

2023-12-25 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 v1 0/6] virtio-net: support device stats

2023-12-25 Thread Xuan Zhuo
As the spec: https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 The virtio net supports to get device stats. Please review. Thanks. v1: 1. fix some definitions of the marco and the struct Xuan Zhuo (6): virtio_net: introduce device stats feature

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

2023-12-25 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 v1 2/6] virtio_net: virtnet_send_command supports command-specific-result

2023-12-25 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 v1 6/6] virtio_net: rename stat tx_timeout to timeout

2023-12-25 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

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

2023-12-25 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 | 194 --- 1 file changed, 102 insertions(+), 92 deletions

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

2023-12-25 Thread Xuan Zhuo
As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 Virtio-net supports to get the stats from the device by ethtool -S . Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 354 ++- 1 file changed, 350

Re: [PATCH v1] virtio_net: fix missing dma unmap for resize

2023-12-26 Thread Xuan Zhuo
On Tue, 26 Dec 2023 03:57:27 -0500, "Michael S. Tsirkin" wrote: > On Tue, Dec 26, 2023 at 01:57:09PM +0800, Xuan Zhuo wrote: > > On Tue, 12 Dec 2023 03:26:41 -0500, "Michael S. Tsirkin" > > wrote: > > > On Tue, Dec 12, 2023 at 04:11:41PM +0800, Xu

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

2023-12-26 Thread Xuan Zhuo
On Tue, 26 Dec 2023 03:58:37 -0500, "Michael S. Tsirkin" wrote: > On Tue, Dec 26, 2023 at 02:17:43PM +0800, Xuan Zhuo wrote: > > On Mon, 25 Dec 2023 16:01:39 +0800, Zhu Yanjun wrote: > > > 在 2023/12/22 11:30, Xuan Zhuo 写道: > > > > The virtio-net

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

2023-12-26 Thread Xuan Zhuo
On Tue, 26 Dec 2023 04:08:01 -0500, "Michael S. Tsirkin" wrote: > On Tue, Dec 26, 2023 at 05:00:25PM +0800, Xuan Zhuo wrote: > > On Tue, 26 Dec 2023 03:58:37 -0500, "Michael S. Tsirkin" > > wrote: > > > On Tue, Dec 26, 2023 at 02:17:43PM +0800, Xua

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

2023-12-26 Thread Xuan Zhuo
On Tue, 26 Dec 2023 04:19:26 -0500, "Michael S. Tsirkin" wrote: > On Tue, Dec 26, 2023 at 05:09:21PM +0800, Xuan Zhuo wrote: > > On Tue, 26 Dec 2023 04:08:01 -0500, "Michael S. Tsirkin" > > wrote: > > > On Tue, Dec 26, 2023 at 05:00:25PM +0800, Xua

[PATCH v2] virtio_net: fix missing dma unmap for resize

2023-12-26 Thread Xuan Zhuo
quot;virtio_net: merge dma operations when filling mergeable buffers") Signed-off-by: Xuan Zhuo --- v2: rename to virtnet_rq_unmap_free_buf() drivers/net/virtio_net.c | 60 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/net/vi

Re: [PATCH 1/1] virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings

2023-12-26 Thread Xuan Zhuo
; drivers/net/virtio_net.c:4552:17: note: ‘sprintf’ output between 9 and > 19 bytes into a destination of size 16 >  4552 | sprintf(vi->sq[i].name, "output.%d", i); > > " > > Please review. Please put this to the git msg. Reviewed-by: Xuan Z

Re: [PATCH v2 1/1] virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings

2023-12-27 Thread Xuan Zhuo
sprintf’ output between 9 and 19 > > bytes into a destination of size 16 > > 4552 | sprintf(vi->sq[i].name, "output.%d", i); > > > > " > > Hi, all > > V1->V2: Add commit logs. Format string is changed. > > Best Re

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

2023-12-27 Thread Xuan Zhuo
On Wed, 27 Dec 2023 16:08:47 -0500, "Michael S. Tsirkin" wrote: > On Tue, Dec 26, 2023 at 03:31:00PM +0800, Xuan Zhuo wrote: > > As the spec > > https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 > > > > Virtio-net supp

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

2023-12-27 Thread Xuan Zhuo
On Wed, 27 Dec 2023 16:05:25 -0500, "Michael S. Tsirkin" wrote: > On Tue, Dec 26, 2023 at 03:30:58PM +0800, Xuan Zhuo wrote: > > The virtio-net device stats spec: > > > > https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 >

[PATCH net-next v3 01/27] virtio_net: rename free_old_xmit_skbs to free_old_xmit

2023-12-28 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 v3 05/27] virtio_net: add prefix virtnet to all struct inside virtio_net.h

2023-12-28 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 | 100 drivers/net/virtio/virtio_net.h | 12 ++-- 2 files changed, 56

[PATCH net-next v3 00/27] virtio-net: support AF_XDP zero copy

2023-12-28 Thread Xuan Zhuo
quot; to xsk: support tx 3. fix some warnings Xuan Zhuo (27): virtio_net: rename free_old_xmit_skbs to free_old_xmit virtio_net: unify the code for recycling the xmit ptr virtio_net: independent directory virtio_net: move core structures to virtio_net.h virtio_net: add pref

[PATCH net-next v3 09/27] virtio_ring: introduce virtqueue_get_dma_premapped()

2023-12-28 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 v3 03/27] virtio_net: independent directory

2023-12-28 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 v3 02/27] virtio_net: unify the code for recycling the xmit ptr

2023-12-28 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 v3 11/27] virtio_net: separate virtnet_rx_resize()

2023-12-28 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 v3 04/27] virtio_net: move core structures to virtio_net.h

2023-12-28 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 | 189

  1   2   3   4   5   6   7   >