Re: [PATCH vhost 3/6] virtio_net: replace private by pp struct inside page

2024-04-19 Thread Xuan Zhuo
On Thu, 18 Apr 2024 22:19:33 +0200, Jesper Dangaard Brouer wrote: > > > On 17/04/2024 10.20, Xuan Zhuo wrote: > > On Wed, 17 Apr 2024 12:08:10 +0800, Jason Wang wrote: > >> On Wed, Apr 17, 2024 at 9:38 AM Xuan Zhuo > >> wrote: > >>> > &g

Re: [PATCH vhost 4/6] virtio_net: big mode support premapped

2024-04-19 Thread Xuan Zhuo
On Fri, 19 Apr 2024 15:24:25 +0800, Jason Wang wrote: > On Fri, Apr 19, 2024 at 3:07 PM Xuan Zhuo wrote: > > > > On Fri, 19 Apr 2024 13:46:25 +0800, Jason Wang wrote: > > > On Fri, Apr 19, 2024 at 12:23 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH vhost 4/6] virtio_net: big mode support premapped

2024-04-19 Thread Xuan Zhuo
On Fri, 19 Apr 2024 15:24:25 +0800, Jason Wang wrote: > On Fri, Apr 19, 2024 at 3:07 PM Xuan Zhuo wrote: > > > > On Fri, 19 Apr 2024 13:46:25 +0800, Jason Wang wrote: > > > On Fri, Apr 19, 2024 at 12:23 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH vhost 4/6] virtio_net: big mode support premapped

2024-04-19 Thread Xuan Zhuo
On Fri, 19 Apr 2024 16:12:15 +0800, Jason Wang wrote: > On Fri, Apr 19, 2024 at 3:28 PM Xuan Zhuo wrote: > > > > On Fri, 19 Apr 2024 15:24:25 +0800, Jason Wang wrote: > > > On Fri, Apr 19, 2024 at 3:07 PM Xuan Zhuo > > > wrote: > > > > > >

[PATCH vhost v1 7/7] virtio_net: remove the misleading comment

2024-04-21 Thread Xuan Zhuo
We call the build_skb() actually without copying data. The comment is misleading. So remove it. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index eff8f16a9fe0..a8dac48a1be7 100644

[PATCH vhost v1 3/7] virtio_net: replace private by pp struct inside page

2024-04-21 Thread Xuan Zhuo
unsigned long _pp_mapping_pad; unsigned long dma_addr; atomic_long_t pp_ref_count; }; On the other side, we should use variables from the same sub-struct. So this patch replaces the "private" with "pp". Signed

[PATCH vhost v1 4/7] virtio_net: big mode support premapped

2024-04-21 Thread Xuan Zhuo
while using page pool is unsafe behavior. More: https://lore.kernel.org/all/CACGkMEu=Aok9z2imB_c5qVuujSh=vjj1kx12fy9n7hqyi+m...@mail.gmail.com/ Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 123 ++- 1 file changed, 108 insertions(+), 15 dele

[PATCH vhost v1 2/7] virtio_ring: enable premapped mode whatever use_dma_api

2024-04-21 Thread Xuan Zhuo
Now, we have virtio DMA APIs, the driver can be the premapped mode whatever the virtio core uses dma api or not. So remove the limit of checking use_dma_api from virtqueue_set_dma_premapped(). Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 7 +-- 1 file

[PATCH vhost v1 1/7] virtio_ring: introduce dma map api for page

2024-04-21 Thread Xuan Zhuo
, unsigned long attrs); void virtqueue_dma_unmap_page_attrs(struct virtqueue *_vq, dma_addr_t addr, size_t size, enum dma_data_direction dir, unsigned long attrs); Signed-off-by: Xuan Zhuo Acked-by: Jason

[PATCH vhost v1 5/7] virtio_net: enable premapped by default

2024-04-21 Thread Xuan Zhuo
: Xuan Zhuo --- drivers/net/virtio_net.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 75f33bbfd5fa..1bf49956dce8 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -896,13 +896,9 @@ static

[PATCH vhost v1 0/7] virtio_net: rx enable premapped mode by default

2024-04-21 Thread Xuan Zhuo
lease review. v1: 1. discussed for using page pool 2. use dma sync to replace the unmap for the first page Thanks. Xuan Zhuo (7): virtio_ring: introduce dma map api for page virtio_ring: enable premapped mode whatever use_dma_api virtio_net: replace private by pp struct inside

[PATCH vhost v1 6/7] virtio_net: rx remove premapped failover code

2024-04-21 Thread Xuan Zhuo
Now, the premapped mode can be enabled unconditionally. So we can remove the failover code. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 81 1 file changed, 33 insertions(+), 48 deletions(-) diff --git a/drivers/net

[PATCH vhost v2 0/7] virtio_net: rx enable premapped mode by default

2024-04-22 Thread Xuan Zhuo
lease review. v2: 1. make gcc happy in page_chain_get_dma() http://lore.kernel.org/all/202404221325.sx5chrgp-...@intel.com v1: 1. discussed for using page pool 2. use dma sync to replace the unmap for the first page Thanks. Xuan Zhuo (7): virtio_ring: introduce dma map ap

[PATCH vhost v2 1/7] virtio_ring: introduce dma map api for page

2024-04-22 Thread Xuan Zhuo
, unsigned long attrs); void virtqueue_dma_unmap_page_attrs(struct virtqueue *_vq, dma_addr_t addr, size_t size, enum dma_data_direction dir, unsigned long attrs); Signed-off-by: Xuan Zhuo Acked-by: Jason

[PATCH vhost v2 2/7] virtio_ring: enable premapped mode whatever use_dma_api

2024-04-22 Thread Xuan Zhuo
Now, we have virtio DMA APIs, the driver can be the premapped mode whatever the virtio core uses dma api or not. So remove the limit of checking use_dma_api from virtqueue_set_dma_premapped(). Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 7 +-- 1 file

[PATCH vhost v2 3/7] virtio_net: replace private by pp struct inside page

2024-04-22 Thread Xuan Zhuo
unsigned long _pp_mapping_pad; unsigned long dma_addr; atomic_long_t pp_ref_count; }; On the other side, we should use variables from the same sub-struct. So this patch replaces the "private" with "pp". Signed

[PATCH vhost v2 5/7] virtio_net: enable premapped by default

2024-04-22 Thread Xuan Zhuo
: Xuan Zhuo --- drivers/net/virtio_net.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d4f5e65b247e..f04b10426b8f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -896,13 +896,9 @@ static

[PATCH vhost v2 6/7] virtio_net: rx remove premapped failover code

2024-04-22 Thread Xuan Zhuo
Now, the premapped mode can be enabled unconditionally. So we can remove the failover code. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 81 1 file changed, 33 insertions(+), 48 deletions(-) diff --git a/drivers/net

[PATCH vhost v2 4/7] virtio_net: big mode support premapped

2024-04-22 Thread Xuan Zhuo
while using page pool is unsafe behavior. More: https://lore.kernel.org/all/CACGkMEu=Aok9z2imB_c5qVuujSh=vjj1kx12fy9n7hqyi+m...@mail.gmail.com/ Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 123 ++- 1 file changed, 108 insertions(+), 15 dele

[PATCH vhost v2 7/7] virtio_net: remove the misleading comment

2024-04-22 Thread Xuan Zhuo
We call the build_skb() actually without copying data. The comment is misleading. So remove it. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 848e93ccf2ef..ae15254a673b 100644

Re: [PATCH vhost v2 4/7] virtio_net: big mode support premapped

2024-04-22 Thread Xuan Zhuo
On Tue, 23 Apr 2024 12:36:42 +0800, Jason Wang wrote: > On Mon, Apr 22, 2024 at 3:24 PM Xuan Zhuo wrote: > > > > In big mode, pre-mapping DMA is beneficial because if the pages are not > > used, we can reuse them without needing to unmap and remap. > > > >

Re: [PATCH net-next v5 0/9] virtio-net: support device stats

2024-04-22 Thread Xuan Zhuo
On Mon, 22 Apr 2024 16:33:01 -0400, "Michael S. Tsirkin" wrote: > On Mon, Mar 18, 2024 at 07:05:53PM +0800, Xuan Zhuo wrote: > > As the spec: > > > > https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 > > > >

[PATCH net-next v6 0/8] virtio-net: support device stats

2024-04-23 Thread Xuan Zhuo
irtnet_stats_map v1: 1. fix some definitions of the marco and the struct Xuan Zhuo (8): virtio_net: introduce device stats feature and structures virtio_net: remove "_queue" from ethtool -S virtio_net: support device stats virtio_net: device stats helpers support driv

[PATCH net-next v6 3/8] virtio_net: support device stats

2024-04-23 Thread Xuan Zhuo
, ratelimit_packets), Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 476 ++- 1 file changed, 472 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index bd90f9d3d9b7..acae0c310688 100644 --- a/drivers/net

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

2024-04-23 Thread Xuan Zhuo
The virtio-net device stats spec: https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 We introduce the relative feature and structures. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- include/uapi/linux/virtio_net.h | 143

[PATCH net-next v6 4/8] virtio_net: device stats helpers support driver stats

2024-04-23 Thread Xuan Zhuo
In the last commit, we introduced some helpers for device stats. And the drivers stats are realized by the open code. This commit make the helpers to support driver stats. Then we can have the unify helper for device and driver stats. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 157

[PATCH net-next v6 2/8] virtio_net: remove "_queue" from ethtool -S

2024-04-23 Thread Xuan Zhuo
ame max is 19. That is too short. We will introduce some keys such as "gso_packets_coalesced". So we should change the prefix to "rx0_". Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --

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

2024-04-23 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 Reviewed-by: Jiri Pirko --- drivers/net/virtio_net.c | 8 +

[PATCH net-next v6 8/8] virtio-net: support queue stat

2024-04-23 Thread Xuan Zhuo
'rx-hw-drop-ratelimits': 0, 'rx-hw-drops': 12964, 'rx-packets': 598929}, {'ifindex': 2, 'queue-id': 0, 'queue-type': 'tx', 'tx-bytes': 1938511, 'tx-csum-none': 0, 'tx-hw-drop-errors': 0

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

2024-04-23 Thread Xuan Zhuo
tx0_hw_drops: 0 tx0_hw_drop_malformed: 0 tx0_hw_csum_none: 0 tx0_hw_needs_csum: 32281 tx0_hw_ratelimit_packets: 0 tx0_hw_ratelimit_bytes: 0 Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 81 ++-- 1 file changed, 69

[PATCH net-next v6 7/8] netdev: add queue stats

2024-04-23 Thread Xuan Zhuo
-hw-drop-ratelimits name: tx-hw-drops name: tx-hw-drop-errors name: tx-csum-none name: tx-needs-csum name: tx-hw-gso-packets name: tx-hw-gso-bytes name: tx-hw-gso-wire-packets name: tx-hw-gso-wire-bytes name: tx-hw-drop-ratelimits Signed-off-by: Xuan Zhuo --- Documentation/netlink/specs

Re: [PATCH vhost v2 4/7] virtio_net: big mode support premapped

2024-04-23 Thread Xuan Zhuo
On Tue, 23 Apr 2024 12:36:42 +0800, Jason Wang wrote: > On Mon, Apr 22, 2024 at 3:24 PM Xuan Zhuo wrote: > > > > In big mode, pre-mapping DMA is beneficial because if the pages are not > > used, we can reuse them without needing to unmap and remap. > > > >

Re: [PATCH vhost v2 4/7] virtio_net: big mode support premapped

2024-04-23 Thread Xuan Zhuo
On Wed, 24 Apr 2024 08:43:21 +0800, Jason Wang wrote: > On Tue, Apr 23, 2024 at 8:38 PM Xuan Zhuo wrote: > > > > On Tue, 23 Apr 2024 12:36:42 +0800, Jason Wang wrote: > > > On Mon, Apr 22, 2024 at 3:24 PM Xuan Zhuo > > > wrote: > > > > >

Re: [PATCH vhost v2 4/7] virtio_net: big mode support premapped

2024-04-23 Thread Xuan Zhuo
On Wed, 24 Apr 2024 10:34:56 +0800, Jason Wang wrote: > On Wed, Apr 24, 2024 at 9:10 AM Xuan Zhuo wrote: > > > > On Wed, 24 Apr 2024 08:43:21 +0800, Jason Wang wrote: > > > On Tue, Apr 23, 2024 at 8:38 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH vhost v2 4/7] virtio_net: big mode support premapped

2024-04-23 Thread Xuan Zhuo
On Wed, 24 Apr 2024 10:45:49 +0800, Jason Wang wrote: > On Wed, Apr 24, 2024 at 10:42 AM Xuan Zhuo wrote: > > > > On Wed, 24 Apr 2024 10:34:56 +0800, Jason Wang wrote: > > > On Wed, Apr 24, 2024 at 9:10 AM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH vhost v2 4/7] virtio_net: big mode support premapped

2024-04-23 Thread Xuan Zhuo
On Wed, 24 Apr 2024 11:50:44 +0800, Jason Wang wrote: > On Wed, Apr 24, 2024 at 10:58 AM Xuan Zhuo wrote: > > > > On Wed, 24 Apr 2024 10:45:49 +0800, Jason Wang wrote: > > > On Wed, Apr 24, 2024 at 10:42 AM Xuan Zhuo > > > wrote: > > > > > >

[PATCH vhost v3 0/4] virtio_net: rx enable premapped mode by default

2024-04-24 Thread Xuan Zhuo
s the dma map/unmap v2: 1. make gcc happy in page_chain_get_dma() http://lore.kernel.org/all/202404221325.sx5chrgp-...@intel.com v1: 1. discussed for using page pool 2. use dma sync to replace the unmap for the first page Thanks. Xuan Zhuo (4): virtio_ring: enable prem

[PATCH vhost v3 2/4] virtio_net: big mode skip the unmap check

2024-04-24 Thread Xuan Zhuo
The virtio-net big mode did not enable premapped mode, so we did not need to check the unmap. And the subsequent commit will remove the failover code for failing enable premapped for merge and small mode. So we need to remove the checking do_dma code in the big mode path. Signed-off-by: Xuan Zhuo

[PATCH vhost v3 3/4] virtio_net: rx remove premapped failover code

2024-04-24 Thread Xuan Zhuo
Now, the premapped mode can be enabled unconditionally. So we can remove the failover code for merge and small mode. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 85 +--- 1 file changed, 35 insertions(+), 50 deletions

[PATCH vhost v3 1/4] virtio_ring: enable premapped mode whatever use_dma_api

2024-04-24 Thread Xuan Zhuo
Now, we have virtio DMA APIs, the driver can be the premapped mode whatever the virtio core uses dma api or not. So remove the limit of checking use_dma_api from virtqueue_set_dma_premapped(). Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 7 +-- 1 file

[PATCH vhost v3 4/4] virtio_net: remove the misleading comment

2024-04-24 Thread Xuan Zhuo
We call the build_skb() actually without copying data. The comment is misleading. So remove it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a4b924ba18d3

Re: [PATCH net-next v6 5/8] virtio_net: add the total stats field

2024-04-24 Thread Xuan Zhuo
On Wed, 24 Apr 2024 11:52:12 +0800, Jason Wang wrote: > On Tue, Apr 23, 2024 at 7:32 PM Xuan Zhuo wrote: > > > > Now, we just show the stats of every queue. > > > > But for the user, the total values of every stat may are valuable. > > > > NIC

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

2024-04-24 Thread Xuan Zhuo
On Wed, 24 Apr 2024 11:55:24 +0800, Jason Wang wrote: > On Tue, Apr 23, 2024 at 7:32 PM Xuan Zhuo wrote: > > > > Now, we have this: > > > > tx_queue_0_tx_timeouts > > > > This is used to record the tx schedule timeout. > > But t

Re: [PATCH vhost v3 2/4] virtio_net: big mode skip the unmap check

2024-04-24 Thread Xuan Zhuo
On Thu, 25 Apr 2024 10:11:55 +0800, Jason Wang wrote: > On Wed, Apr 24, 2024 at 4:17 PM Xuan Zhuo wrote: > > > > The virtio-net big mode did not enable premapped mode, > > so we did not need to check the unmap. And the subsequent > > commit will remove the failo

Re: [PATCH net-next v6 8/8] virtio-net: support queue stat

2024-04-25 Thread Xuan Zhuo
On Wed, 24 Apr 2024 20:44:22 -0700, Jakub Kicinski wrote: > On Tue, 23 Apr 2024 19:31:41 +0800 Xuan Zhuo wrote: > > +static void virtnet_get_base_stats(struct net_device *dev, > > + struct netdev_queue_stats_rx *rx, > > +

[PATCH net-next v7 2/8] virtio_net: introduce device stats feature and structures

2024-04-25 Thread Xuan Zhuo
The virtio-net device stats spec: https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 We introduce the relative feature and structures. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- include/uapi/linux/virtio_net.h | 143

[PATCH net-next v7 1/8] virtio_net: introduce ability to get reply info from device

2024-04-25 Thread Xuan Zhuo
). Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7176b956460b..3bc9b1e621db 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net

[PATCH net-next v7 3/8] virtio_net: remove "_queue" from ethtool -S

2024-04-25 Thread Xuan Zhuo
ame max is 19. That is too short. We will introduce some keys such as "gso_packets_coalesced". So we should change the prefix to "rx0_". Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --

[PATCH net-next v7 4/8] virtio_net: support device stats

2024-04-25 Thread Xuan Zhuo
, ratelimit_packets), Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 476 ++- 1 file changed, 472 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 8aa03625ab6c..08639902f94b 100644

[PATCH net-next v7 0/8] virtio-net: support device stats

2024-04-25 Thread Xuan Zhuo
irtnet_stats_map v1: 1. fix some definitions of the marco and the struct Xuan Zhuo (8): virtio_net: introduce ability to get reply info from device virtio_net: introduce device stats feature and structures virtio_net: remove "_queue" from ethtool -S virtio_net: sup

[PATCH net-next v7 5/8] virtio_net: device stats helpers support driver stats

2024-04-25 Thread Xuan Zhuo
In the last commit, we introduced some helpers for device stats. And the drivers stats are realized by the open code. This commit make the helpers to support driver stats. Then we can have the unify helper for device and driver stats. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers

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

2024-04-25 Thread Xuan Zhuo
tx0_hw_drops: 0 tx0_hw_drop_malformed: 0 tx0_hw_csum_none: 0 tx0_hw_needs_csum: 32281 tx0_hw_ratelimit_packets: 0 tx0_hw_ratelimit_bytes: 0 Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 81 ++-- 1 file changed, 69

[PATCH net-next v7 8/8] virtio-net: support queue stat

2024-04-25 Thread Xuan Zhuo
'rx-hw-drop-ratelimits': 0, 'rx-hw-drops': 12964, 'rx-packets': 598929}, {'ifindex': 2, 'queue-id': 0, 'queue-type': 'tx', 'tx-bytes': 1938511, 'tx-csum-none': 0, 'tx-hw-drop-errors': 0

[PATCH net-next v7 7/8] netdev: add queue stats

2024-04-25 Thread Xuan Zhuo
-hw-drop-ratelimits name: tx-hw-drops name: tx-hw-drop-errors name: tx-csum-none name: tx-needs-csum name: tx-hw-gso-packets name: tx-hw-gso-bytes name: tx-hw-gso-wire-packets name: tx-hw-gso-wire-bytes name: tx-hw-drop-ratelimits Signed-off-by: Xuan Zhuo --- Documentation/netlink/specs

Re: [PATCH vhost v3 0/4] virtio_net: rx enable premapped mode by default

2024-04-27 Thread Xuan Zhuo
On Fri, 26 Apr 2024 13:00:08 +0200, Paolo Abeni wrote: > On Wed, 2024-04-24 at 16:16 +0800, Xuan Zhuo wrote: > > Actually, for the virtio drivers, we can enable premapped mode whatever > > the value of use_dma_api. Because we provide the virtio dma apis. > > So the driver

[PATCH vhost 0/5] virtio_net: introduce api to enable/disable premapped mode for sq

2024-05-07 Thread Xuan Zhuo
first four patches can be merged first to reduce the number of patches in the final set. Thanks. Xuan Zhuo (5): virtio_ring: introduce vring_need_unmap_buffer virtio_ring: introduce dma map api for page virtio_ring: introduce virtqueue_dma_map_sg_attrs virtio_ring: virtqueue_set_dma_premapped

[PATCH vhost 1/5] virtio_ring: introduce vring_need_unmap_buffer

2024-05-07 Thread Xuan Zhuo
To make the code readable, introduce vring_need_unmap_buffer() to replace do_unmap. use_dma_api premapped -> vring_need_unmap_buffer() 1. false falsefalse 2. truefalsetrue 3. truetrue false Signed-off-by: Xuan Zhuo Acked-by: Jason W

[PATCH vhost 2/5] virtio_ring: introduce dma map api for page

2024-05-07 Thread Xuan Zhuo
long attrs); Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 52 include/linux/virtio.h | 7 + 2 files changed, 59 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index d7059bacb593..653c7ea24fb7

[PATCH vhost 3/5] virtio_ring: introduce virtqueue_dma_map_sg_attrs

2024-05-07 Thread Xuan Zhuo
Introduce a helper to do dma map for scatterlist. That can be used by other drivers. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 32 include/linux/virtio.h | 3 +++ 2 files changed, 35 insertions(+) diff --git a/drivers/virtio

[PATCH vhost 4/5] virtio_ring: virtqueue_set_dma_premapped() support to disable

2024-05-07 Thread Xuan Zhuo
virtio-net sq will only enable premapped mode when the sq is bound to the af-xdp. So we need the helper (virtqueue_set_dma_premapped) to enable the premapped mode when af-xdp binds to the sq. And to disable the premapped mode when af-xdp unbinds to the sq. Signed-off-by: Xuan Zhuo --- drivers

[PATCH vhost 5/5] virtio_net: sq support premapped mode

2024-05-07 Thread Xuan Zhuo
attempt to use more descriptors, virtnet_add_outbuf() will return an -ENOMEM error. But the af-xdp can work continually. * virtnet_sq_set_premapped(sq, false) is used to disable premapped mode. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 210

[PATCH net-next v4 0/4] virtio_net: rx enable premapped mode by default

2024-05-07 Thread Xuan Zhuo
page Thanks. Xuan Zhuo (4): virtio_ring: enable premapped mode whatever use_dma_api virtio_net: big mode skip the unmap check virtio_net: rx remove premapped failover code virtio_net: remove the misleading comment drivers/net/virtio_net.c

[PATCH net-next v4 1/4] virtio_ring: enable premapped mode whatever use_dma_api

2024-05-07 Thread Xuan Zhuo
Now, we have virtio DMA APIs, the driver can be the premapped mode whatever the virtio core uses dma api or not. So remove the limit of checking use_dma_api from virtqueue_set_dma_premapped(). Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 7 +-- 1 file

[PATCH net-next v4 2/4] virtio_net: big mode skip the unmap check

2024-05-07 Thread Xuan Zhuo
The virtio-net big mode did not enable premapped mode, so we did not need to check the unmap. And the subsequent commit will remove the failover code for failing enable premapped for merge and small mode. So we need to remove the checking do_dma code in the big mode path. Signed-off-by: Xuan Zhuo

[PATCH net-next v4 3/4] virtio_net: rx remove premapped failover code

2024-05-07 Thread Xuan Zhuo
Now, the premapped mode can be enabled unconditionally. So we can remove the failover code for merge and small mode. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 85 +--- 1 file changed, 35 insertions(+), 50 deletions

[PATCH net-next v4 4/4] virtio_net: remove the misleading comment

2024-05-07 Thread Xuan Zhuo
We call the build_skb() actually without copying data. The comment is misleading. So remove it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 070a6ed0d812

[PATCH net-next 1/7] virtio_net: independent directory

2024-05-08 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

[PATCH net-next 2/7] virtio_net: move core structures to virtio_net.h

2024-05-08 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/virtnet.h | 237

[PATCH net-next 3/7] virtio_net: add prefix virtnet to all struct inside virtio_net.h

2024-05-08 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/virtnet.h | 12 ++-- drivers/net/virtio/virtnet_main.c | 110 +++--- 2 files changed

[PATCH net-next 0/7] virtnet_net: prepare for af-xdp

2024-05-08 Thread Xuan Zhuo
subsequent commits Thanks. Xuan Zhuo (7): virtio_net: independent directory virtio_net: move core structures to virtio_net.h virtio_net: add prefix virtnet to all struct inside virtio_net.h virtio_net: separate virtnet_rx_resize() virtio_net: separate virtnet_tx_resize() virtio_net

[PATCH net-next 4/7] virtio_net: separate virtnet_rx_resize()

2024-05-08 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/virtnet.h | 3 +++ drivers/net/virtio

[PATCH net-next 7/7] virtio_net: separate receive_buf

2024-05-08 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/virtnet_main.c | 56 ++- 1 file

[PATCH net-next 6/7] virtio_net: separate receive_mergeable

2024-05-08 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/virtnet.h | 4 ++ drivers/net/virtio/virtnet_main.c | 77

[PATCH net-next 5/7] virtio_net: separate virtnet_tx_resize()

2024-05-08 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/virtnet.h | 2 ++ drivers/net/virtio

Re: [PATCH net-next 0/7] virtnet_net: prepare for af-xdp

2024-05-08 Thread Xuan Zhuo
On Wed, 8 May 2024 08:20:00 -0700, Jakub Kicinski wrote: > On Wed, 8 May 2024 09:53:08 +0100 Simon Horman wrote: > > On Wed, May 08, 2024 at 04:05:07PM +0800, Xuan Zhuo wrote: > > > This patch set prepares for supporting af-xdp zerocopy. > > > There is no feature change

Re: [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work

2024-05-09 Thread Xuan Zhuo
a1b-020f-4f93-94d0-104964566...@kernel.dk/ > Signed-off-by: Daniel Jurgens Reviewed-by: Xuan Zhuo > --- > drivers/net/virtio_net.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index df61

Re: [PATCH net-next 2/2] virtio_net: Add TX stopped and wake counters

2024-05-09 Thread Xuan Zhuo
On Thu, 9 May 2024 11:32:16 -0500, Daniel Jurgens wrote: > Add a tx queue stop and wake counters, they are useful for debugging. > > $ ./tools/net/ynl/cli.py --spec netlink/specs/netdev.yaml \ > --dump qstats-get --json '{"scope": "queue"}' > ... > {'ifindex': 13, > 'queue-id': 0, > 'queue-ty

Re: RE: [PATCH net-next 2/2] virtio_net: Add TX stopped and wake counters

2024-05-09 Thread Xuan Zhuo
On Fri, 10 May 2024 03:35:51 +, Dan Jurgens wrote: > > From: Xuan Zhuo > > Sent: Thursday, May 9, 2024 8:22 PM > > To: Dan Jurgens > > Cc: m...@redhat.com; jasow...@redhat.com; xuanz...@linux.alibaba.com; > > virtualizat...@lists.linux.dev; da...@davemloft.n

[PATCH net-next v5 0/4] virtio_net: rx enable premapped mode by default

2024-05-10 Thread Xuan Zhuo
g/all/202404221325.sx5chrgp-...@intel.com v1: 1. discussed for using page pool 2. use dma sync to replace the unmap for the first page Thanks. Xuan Zhuo (4): virtio_ring: enable premapped mode whatever use_dma_api virtio_net: big mode skip the unmap check virtio_net: rx remove prem

[PATCH net-next v5 1/4] virtio_ring: enable premapped mode whatever use_dma_api

2024-05-10 Thread Xuan Zhuo
Now, we have virtio DMA APIs, the driver can be the premapped mode whatever the virtio core uses dma api or not. So remove the limit of checking use_dma_api from virtqueue_set_dma_premapped(). Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 7 +-- 1 file

[PATCH net-next v5 3/4] virtio_net: rx remove premapped failover code

2024-05-10 Thread Xuan Zhuo
Now, the premapped mode can be enabled unconditionally. So we can remove the failover code for merge and small mode. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang Reviewed-by: Larysa Zaremba --- drivers/net/virtio_net.c | 85 +--- 1 file changed, 35

[PATCH net-next v5 2/4] virtio_net: big mode skip the unmap check

2024-05-10 Thread Xuan Zhuo
The virtio-net big mode did not enable premapped mode, so we did not need to check the unmap. And the subsequent commit will remove the failover code for failing enable premapped for merge and small mode. So we need to remove the checking do_dma code in the big mode path. Signed-off-by: Xuan Zhuo

[PATCH net-next v5 4/4] virtio_net: remove the misleading comment

2024-05-10 Thread Xuan Zhuo
We call the build_skb() actually without copying data. The comment is misleading. So remove it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 3ffcb2e2185f

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

2024-05-20 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 Venka

Re: [PATCH net-next 0/7] virtnet_net: prepare for af-xdp

2024-05-22 Thread Xuan Zhuo
Any comments for this. Thanks. On Wed, 8 May 2024 16:05:07 +0800, Xuan Zhuo wrote: > This patch set prepares for supporting af-xdp zerocopy. > There is no feature change in this patch set. > I just want to reduce the patch num of the final patch set, > so I split the patch set. &

Re: [PATCH net-next 0/7] virtnet_net: prepare for af-xdp

2024-05-27 Thread Xuan Zhuo
On Mon, 27 May 2024 11:38:49 +0800, Jason Wang wrote: > On Thu, May 23, 2024 at 10:27 AM Xuan Zhuo wrote: > > > > Any comments for this. > > > > Thanks. > > Will have a look. > > Btw, does Michael happy with moving files into a dedicated directory? Based

Re: [PATCH net v2] virtio_net: fix missing lock protection on control_buf access

2024-05-29 Thread Xuan Zhuo
k for the command VQ.") > Signed-off-by: Heng Qi > Reviewed-by: Hariprasad Kelam Reviewed-by: Xuan Zhuo > --- > v1->v2: > - Use the ok instead of ret. > > drivers/net/virtio_net.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff -

[PATCH net-next v1 0/7] virtnet_net: prepare for af-xdp

2024-05-30 Thread Xuan Zhuo
subsequent commits Thanks. v1: 1. resend for the new net-next merge window Xuan Zhuo (7): virtio_net: independent directory virtio_net: move core structures to virtio_net.h virtio_net: add prefix virtnet to all struct inside virtio_net.h virtio_net: separate virtnet_rx_resize

[PATCH net-next v1 1/7] virtio_net: independent directory

2024-05-30 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

[PATCH net-next v1 3/7] virtio_net: add prefix virtnet to all struct inside virtio_net.h

2024-05-30 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 Acked-by: Jason Wang --- drivers/net/virtio/virtnet.h | 12 ++-- drivers/net/virtio/virtnet_main.c | 110

[PATCH net-next v1 5/7] virtio_net: separate virtnet_tx_resize()

2024-05-30 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/virtnet.h | 2 ++ drivers/net/virtio

[PATCH net-next v1 4/7] virtio_net: separate virtnet_rx_resize()

2024-05-30 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/virtnet.h | 3 +++ drivers/net/virtio

[PATCH net-next v1 2/7] virtio_net: move core structures to virtio_net.h

2024-05-30 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/virtnet.h | 239

[PATCH net-next v1 6/7] virtio_net: separate receive_mergeable

2024-05-30 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 Acked-by: Jason Wang --- drivers/net/virtio/virtnet.h | 4 ++ drivers/net/virtio/virtnet_main.c

[PATCH net-next v1 7/7] virtio_net: separate receive_buf

2024-05-30 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 Acked-by: Jason Wang --- drivers/net/virtio/virtnet_main.c | 56

Re: [PATCH net-next v1 0/7] virtnet_net: prepare for af-xdp

2024-05-30 Thread Xuan Zhuo
On Thu, 30 May 2024 03:55:35 -0400, "Michael S. Tsirkin" wrote: > On Thu, May 30, 2024 at 03:26:42PM +0800, Xuan Zhuo wrote: > > This patch set prepares for supporting af-xdp zerocopy. > > There is no feature change in this patch set. > > I just want to reduce t

Re: [PATCH net v3 1/2] virtio_net: fix possible dim status unrecoverable

2024-05-30 Thread Xuan Zhuo
_MEASURE. > > Fixes: 6208799553a8 ("virtio-net: support rx netdim") > Signed-off-by: Heng Qi > Reviewed-by: Jiri Pirko Reviewed-by: Xuan Zhuo > --- > drivers/net/virtio_net.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/dr

Re: [PATCH net v3 2/2] virtio_net: fix a spurious deadlock issue

2024-05-30 Thread Xuan Zhuo
/0x8a0 > ? lock_release+0x72/0x140 > ? do_user_addr_fault+0x3a7/0x8a0 > __x64_sys_sendto+0x29/0x30 > do_syscall_64+0x78/0x180 > entry_SYSCALL_64_after_hwframe+0x76/0x7e > > Fixes: 4d4ac2ececd3 ("virtio_net: Add a lock for per queue RX coalesce") > Sign

[PATCH net-next v2 00/12] virtnet_net: prepare for af-xdp

2024-05-30 Thread Xuan Zhuo
the last one refactors distinguishing xmit types. v1: 1. resend for the new net-next merge window Xuan Zhuo (12): virtio_net: independent directory virtio_net: move core structures to virtio_net.h virtio_net: add prefix virtnet to all struct inside virtio_net.h virtio_net: separate

[PATCH net-next v2 02/12] virtio_net: move core structures to virtio_net.h

2024-05-30 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/virtnet.h | 239

<    1   2   3   4   5   6   7   >