Re: [PATCH net] net: check the minimum value of gso size in virtio_net_hdr_to_skb()

2025-07-25 Thread Xuan Zhuo
On Thu, 24 Jul 2025 16:30:05 +0800, Wang Liang wrote: > When sending a packet with virtio_net_hdr to tun device, if the gso_type > in virtio_net_hdr is SKB_GSO_UDP and the gso_size is less than udphdr > size, below crash may happen. > > [ cut here ] > kernel BUG at net/

Re: [PATCH net v2 2/2] virtio-net: xsk: rx: move the xdp->data adjustment to buf_to_xdp()

2025-06-24 Thread Xuan Zhuo
On Sat, 21 Jun 2025 21:49:52 +0700, Bui Quang Minh wrote: > This commit does not do any functional changes. It moves xdp->data > adjustment for buffer other than first buffer to buf_to_xdp() helper so > that the xdp_buff adjustment does not scatter over different functions. > > Signed-off-by: Bui

Re: [PATCH net v2 2/2] virtio-net: xsk: rx: move the xdp->data adjustment to buf_to_xdp()

2025-06-24 Thread Xuan Zhuo
> Signed-off-by: Bui Quang Minh Reviewed-by: Xuan Zhuo > --- > drivers/net/virtio_net.c | 16 ++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 1eb237cd5d0b..4e942ea1bfa3 100644 >

Re: [PATCH net v2 1/2] virtio-net: xsk: rx: fix the frame's length check

2025-06-24 Thread Xuan Zhuo
->hdr_len > > like in the current check. > > This commit adds an additional argument to buf_to_xdp differentiate > between the first buffer and other ones to correctly calculate the maximum > frame's length. > > Fixes: a4e7ba702701 ("virtio_net: xsk: rx:

Re: [PATCH] virtio: virtio_dma_buf: fix missing parameter documentation

2025-06-24 Thread Xuan Zhuo
proper parameter documentation > following kernel-doc format. > > Signed-off-by: WangYuli Reviewed-by: Xuan Zhuo > --- > drivers/virtio/virtio_dma_buf.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/virtio/virtio_dma_buf.c b/drivers/virtio/virtio_

Re: [PATCH] virtio: document ENOSPC

2025-06-12 Thread Xuan Zhuo
On Tue, 27 May 2025 10:27:19 -0400, "Michael S. Tsirkin" wrote: > drivers handle ENOSPC specially since it's an error one can > get from a working VQ. Document the semantics. > > Reported-by: Parav Pandit > Signed-off-by: Michael S. Tsirkin Reviewed-by: Xuan

Re: [PATCH net] virtio-net: drop the multi-buffer XDP packet in zerocopy

2025-06-12 Thread Xuan Zhuo
XDP_PASS. As a result, the packet is passed to normal network > stack which is an incorrect behavior. This commit instead returns > XDP_DROP in that case. > > Fixes: 99c861b44eb1 ("virtio_net: xsk: rx: support recv merge mode") > Cc: sta...@vger.kernel.org > Signed-off-by:

Re: [PATCH v2 1/3] virtio: Fix typo in register_virtio_device() doc comment

2025-06-12 Thread Xuan Zhuo
On Thu, 29 May 2025 01:42:39 -0700, Alok Tiwari wrote: > Corrected "suceess" to "success" in the function documentation > for clarity. > > Signed-off-by: Alok Tiwari > Acked-by: Jason Wang Reviewed-by: Xuan Zhuo > --- > v1 -> v2 &

Re: [PATCH] virtio-net: disable delayed refill when pausing rx

2025-04-06 Thread Xuan Zhuo
On Fri, 4 Apr 2025 16:39:03 +0700, Bui Quang Minh wrote: > When pausing rx (e.g. set up xdp, xsk pool, rx resize), we call > napi_disable() on the receive queue's napi. In delayed refill_work, it > also calls napi_disable() on the receive queue's napi. This can leads to > deadlock when napi_disa

Re: [PATCH 00/19] virtio_ring in order support

2025-04-05 Thread Xuan Zhuo
For series: Reviewed-by: Xuan Zhuo Thanks. On Mon, 24 Mar 2025 13:43:14 +0800, Jason Wang wrote: > Hello all: > > This sereis tries to implement the VIRTIO_F_IN_ORDER to > virtio_ring. This is done by introducing virtqueue ops so we can > implement separate helpers for diff

Re: [PATCH net-next v2 0/4] virtio_net: Fixes and improvements

2025-03-21 Thread Xuan Zhuo
xes a few minor bugs I found > when writing patches. > > Signed-off-by: Akihiko Odaki Reviewed-by: Xuan Zhuo > --- > Changes in v2: > - Replaced kmalloc() with kzalloc() to initialize the reserved fields. > - Link to v1: > https://lore.kernel.org/r/20250318-virtio-v1-0-34

Re: [PATCH net-next 3/4] virtio_net: Use new RSS config structs

2025-03-18 Thread Xuan Zhuo
On Tue, 18 Mar 2025 18:56:53 +0900, Akihiko Odaki wrote: > The new RSS configuration structures allow easily constructing data for > VIRTIO_NET_CTRL_MQ_RSS_CONFIG as they strictly follow the order of data > for the command. > > Signed-off-by: Akihiko Odaki > --- > drivers/net/virtio_net.c | 117

Re: [PATCH net-next v6 0/4] virtio-net: Link queues to NAPIs

2025-03-06 Thread Xuan Zhuo
Reviewed-by: Xuan Zhuo On Fri, 7 Mar 2025 01:12:08 +, Joe Damato wrote: > Greetings: > > Welcome to v6. Only patch updated is patch 3. See changelog below. > > Jakub recently commented [1] that I should not hold this series on > virtio-net linking queues to NAPIs behi

Re: [PATCH net-next v2 4/4] virtio_net: Use persistent NAPI config

2025-01-15 Thread Xuan Zhuo
ls/net/ynl/pyynl/cli.py \ > --spec Documentation/netlink/specs/netdev.yaml \ > --dump queue-get --json='{"ifindex": 2}' > [{'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'rx'}, > {'id': 1, 'if

Re: [PATCH net-next v2 3/4] virtio_net: Map NAPIs to queues

2025-01-15 Thread Xuan Zhuo
On Thu, 16 Jan 2025 05:52:58 +, Joe Damato wrote: > Use netif_queue_set_napi to map NAPIs to queue IDs so that the mapping > can be accessed by user apps. > > $ ethtool -i ens4 | grep driver > driver: virtio_net > > $ sudo ethtool -L ens4 combined 4 > > $ ./tools/net/ynl/pyynl/cli.py \ >

Re: [PATCH] virtio: fix reference leak in register_virtio_device()

2024-12-16 Thread Xuan Zhuo
On Tue, 17 Dec 2024 11:54:32 +0800, Ma Ke wrote: > When device_add(&dev->dev) failed, calling put_device() to explicitly > release dev->dev. Otherwise, it could cause double free problem. Who frees it doublely? If device_add() failed, the put_device is called inside device_add(), why we need to c

Re: [PATCH net v4 0/6] virtio_net: correct netdev_tx_reset_queue() invocation points

2024-12-09 Thread Xuan Zhuo
For the series, Reviewed-by: Xuan Zhuo Thanks On Fri, 6 Dec 2024 10:10:41 +0900, Koichiro Den wrote: > When virtnet_close is followed by virtnet_open, some TX completions can > possibly remain unconsumed, until they are finally processed during the > first NAPI poll

Re: drivers/virtio/virtio_ring.c:1162:11: error: 'struct vring_virtqueue' has no member named 'premapped'

2024-11-27 Thread Xuan Zhuo
On Wed, 27 Nov 2024 13:30:59 +0530, Naresh Kamboju wrote: > The following build errors were noticed for arm64, arm, x86_64 and riscv. > > First seen on Sasha Linus-next 441d2975754ad94f3ce2e29f672824bc2dc5120c. > Good: 07e98e730a08081b6d0b5c3a173b0487c36ed27f > Bad: 441d2975754ad94f3ce2e29f6

Re: [PATCH] virtio: remove the duplicate might_sleep()

2024-11-18 Thread Xuan Zhuo
On Mon, 18 Nov 2024 20:40:56 +0800, "xiaowuding_jaguarmicro" wrote: > From: Xiaowu Ding > > The virtio_add_status function have done might_sleep(),so we can remove > the duplicate calls. Is there any problem here? If not, I think we can keep it. Thanks. > > Signed-off-by: Xiaowu Ding > ---

Re: [PATCH] virtio_ring: skip cpu sync when mapping fails

2024-11-10 Thread Xuan Zhuo
On Mon, 11 Nov 2024 10:55:38 +0800, Jason Wang wrote: > There's no need to sync DMA for CPU on mapping errors. So this patch > skips the CPU sync in the error handling path of DMA mapping. > > Signed-off-by: Jason Wang Reviewed-by: Xuan Zhuo > --- > drivers/vi

Re: [PATCH net 0/4] virtio_net: Make RSS interact properly with queue number

2024-11-06 Thread Xuan Zhuo
Hi Jason, could you review this firstly? Thanks. On Mon, 4 Nov 2024 16:57:02 +0800, Philo Lu wrote: > With this patch set, RSS updates with queue_pairs changing: > - When virtnet_probe, init default rss and commit > - When queue_pairs changes _without_ user rss configuration, update rss > wit

Re: [RESEND PATCH v3] virtio_net: Fix mismatched buf address when unmapping for small packets

2024-09-19 Thread Xuan Zhuo
assed to the virtio core in small > and merge mode. > Changes from v1: Use ctx to get xdp_headroom. > > Fixes: 295525e29a5b ("virtio_net: merge dma operations when filling mergeable > buffers") > Signed-off-by: Wenbo Li > Signed-off-by: Jiahui Cen > Signed-off-by:

Re: [RESEND PATCH v3] virtio_net: Fix mismatched buf address when unmapping for small packets

2024-09-19 Thread Xuan Zhuo
On Thu, 19 Sep 2024 16:32:45 +0800, Xuan Zhuo wrote: > On Thu, 19 Sep 2024 16:13:51 +0800, Wenbo Li > wrote: > > Currently, the virtio-net driver will perform a pre-dma-mapping for > > small or mergeable RX buffer. But for small packets, a mismatched address > > wi

Re: [RESEND PATCH v3] virtio_net: Fix mismatched buf address when unmapping for small packets

2024-09-19 Thread Xuan Zhuo
On Thu, 19 Sep 2024 11:52:14 +0800, Wenbo Li wrote: > Currently, the virtio-net driver will perform a pre-dma-mapping for > small or mergeable RX buffer. But for small packets, a mismatched address > without VIRTNET_RX_PAD and xdp_headroom is used for unmapping. > > That will result in unsynchron

Re: [RFC PATCH v2 5/7] Revert "virtio_net: rx remove premapped failover code"

2024-09-06 Thread Xuan Zhuo
On Fri, 6 Sep 2024 05:52:36 -0400, "Michael S. Tsirkin" wrote: > This reverts commit defd28aa5acb0fd7c15adc6bc40a8ac277d04dea. > > leads to crashes with no ACCESS_PLATFORM when > sysctl net.core.high_order_alloc_disable=1 > > Cc: Xuan Zhuo > Reported-by: Si-Wei

Re: [External] Re: [PATCH v2] virtio_net: Fix mismatched buf address when unmapping for small packets

2024-09-04 Thread Xuan Zhuo
mon_hdr *)buf)->hdr.flags; So I think it is time to unify the buf that passed to the virtio core into a pointer pointed to the virtnet header. Thanks. > > Thanks. > > On Wed, Sep 4, 2024 at 2:46 PM Xuan Zhuo wrote: > > > > On Wed, 4 Sep 2024 14:10:09 +0800, Wenbo Li

Re: [PATCH v2] virtio_net: Fix mismatched buf address when unmapping for small packets

2024-09-03 Thread Xuan Zhuo
On Wed, 4 Sep 2024 14:10:09 +0800, Wenbo Li wrote: > Currently, the virtio-net driver will perform a pre-dma-mapping for > small or mergeable RX buffer. But for small packets, a mismatched address > without VIRTNET_RX_PAD and xdp_headroom is used for unmapping. Will used virt_to_head_page(), so

Re: [PATCH] tools/virtio:Fix the wrong format specifier

2024-07-29 Thread Xuan Zhuo
On Wed, 24 Jul 2024 00:41:08 -0700, Zhu Jun wrote: > The unsigned int should use "%u" instead of "%d". > > Signed-off-by: Zhu Jun Reviewed-by: Xuan Zhuo > --- > tools/virtio/ringtest/main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH net-next v3 3/3] virtio-net: synchronize operstate with admin state on up/down

2024-07-09 Thread Xuan Zhuo
; DEFAULT group default qlen 1000 > link/ether 00:00:05:00:00:09 brd ff:ff:ff:ff:ff:ff > ... > 5: macvlan0@enp0s3: mtu 1500 qdisc > noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 > link/ether b2:a9:c5:04:da:53 brd ff:ff:ff:ff:ff:ff > > Cc: Venkat Venkatsubra > C

Re: [PATCH net-next v3 3/3] virtio-net: synchronize operstate with admin state on up/down

2024-07-09 Thread Xuan Zhuo
On Tue, 9 Jul 2024 16:02:14 +0800, Jason Wang wrote: > This patch synchronize operstate with admin state per RFC2863. > > This is done by trying to toggle the carrier upon open/close and > synchronize with the config change work. This allows propagate status > correctly to stacked devices like: >

Re: [PATCH net-next v3 2/3] virtio: allow driver to disable the configure change notification

2024-07-09 Thread Xuan Zhuo
a-Khanh Nguyen > Signed-off-by: Jason Wang Reviewed-by: Xuan Zhuo > --- > drivers/virtio/virtio.c | 39 --- > include/linux/virtio.h | 7 +++ > 2 files changed, 43 insertions(+), 3 deletions(-) > > diff --git a/drivers/vir

Re: [PATCH net-next v3 2/3] virtio: allow driver to disable the configure change notification

2024-07-09 Thread Xuan Zhuo
On Tue, 9 Jul 2024 16:02:13 +0800, Jason Wang wrote: > Sometime, it would be useful to disable the configure change > notification from the driver. So this patch allows this by introducing > a variable config_change_driver_disabled and only allow the configure > change notification callback to be

Re: [PATCH net-next v3 1/3] virtio: rename virtio_config_enabled to virtio_config_core_enabled

2024-07-09 Thread Xuan Zhuo
Venkatsubra > Cc: Gia-Khanh Nguyen > Signed-off-by: Jason Wang Reviewed-by: Xuan Zhuo Thanks. > --- > drivers/virtio/virtio.c | 22 +++--- > include/linux/virtio.h | 4 ++-- > 2 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/drivers

Re: [PATCH net-next] net: virtio: unify code to init stats

2024-06-20 Thread Xuan Zhuo
s struct. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Xuan Zhuo > --- > > Especially important now that Jiri's patch for BQL has been merged. > Lightly tested. > > drivers/net/virtio_net.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > >

Re: [syzbot] [net?] [virt?] upstream test error: KMSAN: uninit-value in receive_buf

2024-06-17 Thread Xuan Zhuo
On Mon, 17 Jun 2024 16:15:54 +0900, Tetsuo Handa wrote: > Bisection reached commit f9dac92ba908 ("virtio_ring: enable premapped mode > whatever use_dma_api"). > > On 2024/05/26 1:12, syzbot wrote: > > Hello, > > > > syzbot found the following issue on: > > > > HEAD commit:56fb6f92854f Merge t

Re: [GIT PULL] virtio: features, fixes, cleanups

2024-05-22 Thread Xuan Zhuo
On Wed, 22 May 2024 07:38:01 -0400, "Michael S. Tsirkin" wrote: > On Wed, May 22, 2024 at 06:22:45PM +0800, Xuan Zhuo wrote: > > On Wed, 22 May 2024 06:03:01 -0400, "Michael S. Tsirkin" > > wrote: > > > Things to note here: > > > > > &

Re: [GIT PULL] virtio: features, fixes, cleanups

2024-05-22 Thread Xuan Zhuo
t; Merge tag 'for_linus' into vhost > > Mike Christie (9): > vhost-scsi: Handle vhost_vq_work_queue failures for events > vhost-scsi: Handle vhost_vq_work_queue failures for cmds > vhost-scsi: Use system wq to flush dev for TMFs >

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

2024-05-12 Thread Xuan Zhuo
; codes. > > 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 Th

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

2024-04-07 Thread Xuan Zhuo
realizes that the > 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

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 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] 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] 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-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 probl

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: 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 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. > > Signed-off-

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

2024-02-02 Thread Xuan Zhuo
sing in 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 > > > > > > Si

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

2024-01-30 Thread Xuan Zhuo
_to_cpu(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(stru

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 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 > --- > drivers/net/virtio_

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 Ch

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, vdp

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 M

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