[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 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-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] xsk: save the undone skb

2020-12-11 Thread Xuan Zhuo
that 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 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
of 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 more

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

2021-01-05 Thread Xuan Zhuo
, and 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
sk_num_max 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 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

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

2021-01-05 Thread Xuan Zhuo
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/virtio_net.c

[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

[PATCH] xsk: add cq event

2020-11-16 Thread Xuan Zhuo
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/linux/if_xdp.h | 1 + net/xdp

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

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

2020-11-18 Thread Xuan Zhuo
will 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 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 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/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 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 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 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 changed, 22

Re: [PATCH] virtio_net: Support RX hash XDP hint

2024-01-23 Thread Xuan Zhuo
On Wed, 24 Jan 2024 10:04:51 +0800, Liang Chen wrote: > On Mon, Jan 22, 2024 at 7:10 PM Heng Qi wrote: > > > > Hi Liang Chen, > > > > 在 2024/1/22 下午6:22, Liang Chen 写道: > > > The RSS hash report is a feature that's part of the virtio specification. > > > Currently, virtio backends like qemu,

Re: [PATCH v2 2/3] virtio_net: Add missing virtio header in skb for XDP_PASS

2024-01-24 Thread Xuan Zhuo
On Wed, 24 Jan 2024 16:57:20 +0800, Liang Chen wrote: > For the XDP_PASS scenario of the XDP path, the skb constructed with > xdp_buff does not include the virtio header. Adding the virtio header > information back when creating the skb. > > Signed-off-by: Liang Chen > --- >

Re: [PATCH v2 1/3] virtio_net: Preserve virtio header before XDP program execution

2024-01-24 Thread Xuan Zhuo
On Wed, 24 Jan 2024 16:57:19 +0800, Liang Chen wrote: > The xdp program may overwrite the inline virtio header. To ensure the > integrity of the virtio header, it is saved in a data structure that > wraps both the xdp_buff and the header before running the xdp program. > > Signed-off-by: Liang

Re: [PATCH net-next 1/2] xsk: Remove non-zero 'dma_page' check in xp_assign_dev

2024-02-21 Thread Xuan Zhuo
On Wed, 24 Jan 2024 17:37:38 +0800, Yunjian Wang wrote: > Now dma mappings are used by the physical NICs. However the vNIC > maybe do not need them. So remove non-zero 'dma_page' check in > xp_assign_dev. Could you tell me which one nic can work with AF_XDP without DMA? Thanks. > >

Re: RE: [PATCH net-next 1/2] xsk: Remove non-zero 'dma_page' check in xp_assign_dev

2024-02-21 Thread Xuan Zhuo
On Wed, 21 Feb 2024 11:37:22 +, wangyunjian wrote: > > -Original Message- > > From: Xuan Zhuo [mailto:xuanz...@linux.alibaba.com] > > Sent: Wednesday, February 21, 2024 5:53 PM > > To: wangyunjian > > Cc: net...@vger.kernel.org; linux-kernel@vger.kernel

Re: [PATCH net-next 2/5] virtio_net: Add page_pool support to improve performance

2023-11-30 Thread Xuan Zhuo
On Thu, 30 Nov 2023 13:30:40 +0800, Zhu Yanjun wrote: > > 在 2023/11/30 10:34, Xuan Zhuo 写道: > > On Wed, 29 Nov 2023 23:29:10 +0800, Zhu Yanjun wrote: > >> 在 2023/11/29 23:22, Zhu Yanjun 写道: > >>> 在 2023/11/29 22:59, Michael S. Tsirkin 写道: > >>>&g

Re: [PATCH net-next 2/5] virtio_net: Add page_pool support to improve performance

2023-11-29 Thread Xuan Zhuo
On Wed, 29 Nov 2023 23:29:10 +0800, Zhu Yanjun wrote: > > 在 2023/11/29 23:22, Zhu Yanjun 写道: > > > > 在 2023/11/29 22:59, Michael S. Tsirkin 写道: > >> On Wed, Nov 29, 2023 at 10:50:57PM +0800, Zhu Yanjun wrote: > >>> 在 2023/5/26 13:46, Liang Chen 写道: > >> > >> what made you respond to a patch from

Re: [PATCH net-next] tcp: add tracepoints for data send/recv/acked

2023-12-04 Thread Xuan Zhuo
On Mon, 4 Dec 2023 13:28:21 +0100, Eric Dumazet wrote: > On Mon, Dec 4, 2023 at 12:43 PM Philo Lu wrote: > > > > Add 3 tracepoints, namely tcp_data_send/tcp_data_recv/tcp_data_acked, > > which will be called every time a tcp data packet is sent, received, and > > acked. > > tcp_data_send: called

Re: [PATCH net-next] tcp: add tracepoints for data send/recv/acked

2023-12-06 Thread Xuan Zhuo
On Tue, 5 Dec 2023 20:39:28 +0100, Eric Dumazet wrote: > On Tue, Dec 5, 2023 at 3:11 AM Xuan Zhuo wrote: > > > > On Mon, 4 Dec 2023 13:28:21 +0100, Eric Dumazet wrote: > > > On Mon, Dec 4, 2023 at 12:43 PM Philo Lu wrote: > > > > > > > > Add 3

Re: [PATCH v4] virtio_net: Support RX hash XDP hint

2024-02-02 Thread Xuan Zhuo
the XDP path. Therefore, we are introducing > > > XDP hints through kfuncs to allow XDP programs to access the RSS hash. > > > > > > 1. > > > https://lore.kernel.org/all/20231015141644.260646-1-akihiko.od...@daynix.com/#r > > > > > > Signed-of

Re: [PATCH v2 2/3] virtio_net: Add missing virtio header in skb for XDP_PASS

2024-01-24 Thread Xuan Zhuo
On Thu, 25 Jan 2024 11:48:18 +0800, Jason Wang wrote: > On Wed, Jan 24, 2024 at 5:16 PM Xuan Zhuo wrote: > > > > On Wed, 24 Jan 2024 16:57:20 +0800, Liang Chen > > wrote: > > > For the XDP_PASS scenario of the XDP path, the skb constructed with > > > xdp_

Re: [PATCH v3] virtio_net: Support RX hash XDP hint

2024-01-30 Thread Xuan Zhuo
(hdr_hash->hash_value); > + virtnet_xdp->hash_report = __le16_to_cpu(hdr_hash->hash_report); Could we put the __leXX_to_cpu to virtnet_xdp_rx_hash? Other looks good to me. Reviewed-by: Xuan Zhuo Thanks. > + } > +} > + > static int virtnet_xdp_handler(struct bpf_pro

Re: [PATCH net-next v5] virtio_net: Support RX hash XDP hint

2024-02-22 Thread Xuan Zhuo
On Fri, 09 Feb 2024 13:57:25 +0100, Paolo Abeni wrote: > On Fri, 2024-02-09 at 18:39 +0800, Liang Chen wrote: > > On Wed, Feb 7, 2024 at 10:27 PM Paolo Abeni wrote: > > > > > > On Wed, 2024-02-07 at 10:54 +0800, Liang Chen wrote: > > > > On Tue, Feb 6, 2024 at 6:44 PM Paolo Abeni wrote: > > > >

Re: [PATCH] virtio_net: Do not send RSS key if it is not supported

2024-03-21 Thread Xuan Zhuo
On Thu, 21 Mar 2024 09:54:30 -0700, Breno Leitao wrote: > There is a bug when setting the RSS options in virtio_net that can break > the whole machine, getting the kernel into an infinite loop. > > Running the following command in any QEMU virtual machine with virtionet > will reproduce this

Re: [PATCH] virtio_net: Do not send RSS key if it is not supported

2024-03-25 Thread Xuan Zhuo
On Fri, 22 Mar 2024 03:21:21 -0700, Breno Leitao wrote: > Hello Xuan, > > On Fri, Mar 22, 2024 at 10:00:22AM +0800, Xuan Zhuo wrote: > > On Thu, 21 Mar 2024 09:54:30 -0700, Breno Leitao wrote: > > > > 4) Since the command above does not have a key, then the last &g

Re: [PATCH] virtio_net: Do not send RSS key if it is not supported

2024-03-25 Thread Xuan Zhuo
On Mon, 25 Mar 2024 04:26:08 -0700, Breno Leitao wrote: > Hello Xuan, > > On Mon, Mar 25, 2024 at 01:57:53PM +0800, Xuan Zhuo wrote: > > On Fri, 22 Mar 2024 03:21:21 -0700, Breno Leitao wrote: > > > Hello Xuan, > > > > > > On Fri, Mar 22, 2024 at 10:00:2

Re: [PATCH net v2 1/2] virtio_net: Do not set rss_indir if RSS is not supported

2024-03-26 Thread Xuan Zhuo
On Tue, 26 Mar 2024 08:19:08 -0700, Breno Leitao wrote: > Do not set virtnet_info->rss_indir_table_size if RSS is not available > for the device. > > Currently, rss_indir_table_size is set if either has_rss or > has_rss_hash_report is available, but, it should only be set if has_rss > is set. > >

Re: [PATCH net v4] virtio_net: Do not send RSS key if it is not supported

2024-04-07 Thread Xuan Zhuo
he > vitio is broken at QEMU side. > > Fix it by not sending RSS commands if the feature is not available in > the device. > > Fixes: c7114b1249fa ("drivers/net/virtio_net: Added basic RSS support.") > Cc: sta...@vger.kernel.org > Cc: qemu-de...@nongnu.org > Sig

Re: [PATCH net v2 1/2] virtio_net: Do not set rss_indir if RSS is not supported

2024-03-27 Thread Xuan Zhuo
On Wed, 27 Mar 2024 06:51:25 -0700, Breno Leitao wrote: > Hello Xuan, > > On Wed, Mar 27, 2024 at 09:37:43AM +0800, Xuan Zhuo wrote: > > On Tue, 26 Mar 2024 08:19:08 -0700, Breno Leitao wrote: > > > Do not set virtnet_info->rss_indir_table_size if RSS is not ava

Re: [PATCH net-next] virtio_net: Fix error code in __virtnet_get_hw_stats()

2024-05-12 Thread Xuan Zhuo
gt; > Fix the bug and clean things up so that it's clear that > __virtnet_get_hw_stats() returns zero on success or negative error codes > on failure. > > Fixes: 941168f8b40e ("virtio_net: support device stats") > Signed-off-by: Dan Carpenter That confused me