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 > > > > The virtio net supports to get device stats. > > >

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. > > > > We require space to store the DMA addres

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

2024-04-22 Thread Jason Wang
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. > > We require space to store the DMA address. I use the page.dma_addr to > store the DMA address from the pp s

[PATCH net-next v5 5/6] virtio_net: Add a lock for per queue RX coalesce

2024-04-22 Thread Daniel Jurgens
Once the RTNL locking around the control buffer is removed there can be contention on the per queue RX interrupt coalescing data. Use a mutex per queue. A mutex is required because virtnet_send_command can sleep. Signed-off-by: Daniel Jurgens --- drivers/net/virtio_net.c | 53 +++

[PATCH net-next v5 6/6] virtio_net: Remove rtnl lock protection of command buffers

2024-04-22 Thread Daniel Jurgens
The rtnl lock is no longer needed to protect the control buffer and command VQ. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko --- drivers/net/virtio_net.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net

[PATCH net-next v5 4/6] virtio_net: Do DIM update for specified queue only

2024-04-22 Thread Daniel Jurgens
Since we no longer have to hold the RTNL lock here just do updates for the specified queue. Signed-off-by: Daniel Jurgens --- drivers/net/virtio_net.c | 40 +++- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers

[PATCH net-next v5 3/6] virtio_net: Add a lock for the command VQ.

2024-04-22 Thread Daniel Jurgens
The command VQ will no longer be protected by the RTNL lock. Use a mutex to protect the control buffer header and the VQ. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko --- drivers/net/virtio_net.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/

[PATCH net-next v5 1/6] virtio_net: Store RSS setting in virtnet_info

2024-04-22 Thread Daniel Jurgens
Stop storing RSS setting in the control buffer. This is prep work for removing RTNL lock protection of the control buffer. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko --- drivers/net/virtio_net.c | 40 1 file changed, 20 insertions(+), 20 delet

[PATCH net-next v5 2/6] virtio_net: Remove command data from control_buf

2024-04-22 Thread Daniel Jurgens
Allocate memory for the data when it's used. Ideally the could be on the stack, but we can't DMA stack memory. With this change only the header and status memory are shared between commands, which will allow using a tighter lock than RTNL. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko --

[PATCH net-next v5 0/6] Remove RTNL lock protection of CVQ

2024-04-22 Thread Daniel Jurgens
Currently the buffer used for control VQ commands is protected by the RTNL lock. Previously this wasn't a major concern because the control VQ was only used during device setup and user interaction. With the recent addition of dynamic interrupt moderation the control VQ may be used frequently durin

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

2024-04-22 Thread Jason Wang
On Mon, Apr 22, 2024 at 3:24 PM Xuan Zhuo wrote: > > 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 Thanks > --- > drivers/net/virtio_net.c | 1 - > 1 file changed, 1 deletion(-) > > diff --g

Re: (subset) [PATCH io_uring-next/net-next v2 0/4] implement io_uring notification (ubuf_info) stacking

2024-04-22 Thread Jens Axboe
On Fri, 19 Apr 2024 12:08:38 +0100, Pavel Begunkov wrote: > Please, don't take directly, conflicts with io_uring. > > To have per request buffer notifications each zerocopy io_uring send > request allocates a new ubuf_info. However, as an skb can carry only > one uarg, it may force the stack to

Re: [PATCH io_uring-next/net-next v2 0/4] implement io_uring notification (ubuf_info) stacking

2024-04-22 Thread patchwork-bot+netdevbpf
Hello: This series was applied to netdev/net-next.git (main) by Jakub Kicinski : On Fri, 19 Apr 2024 12:08:38 +0100 you wrote: > Please, don't take directly, conflicts with io_uring. > > To have per request buffer notifications each zerocopy io_uring send > request allocates a new ubuf_info. How

Re: [patch net-next v4 0/6] selftests: virtio_net: introduce initial testing infrastructure

2024-04-22 Thread Michael S. Tsirkin
On Thu, Apr 18, 2024 at 06:08:24PM +0200, Jiri Pirko wrote: > From: Jiri Pirko > > This patchset aims at introducing very basic initial infrastructure > for virtio_net testing, namely it focuses on virtio feature testing. > > The first patch adds support for debugfs for virtio devices, allowing

Re: [PATCH RESEND net-next v7 0/4] ethtool: provide the dim profile fine-tuning channel

2024-04-22 Thread Michael S. Tsirkin
On Mon, Apr 15, 2024 at 09:38:03PM +0800, Heng Qi wrote: > The NetDIM library provides excellent acceleration for many modern > network cards. However, the default profiles of DIM limits its maximum > capabilities for different NICs, so providing a way which the NIC can > be custom configured is ne

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

2024-04-22 Thread Michael S. Tsirkin
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 > > The virtio net supports to get device stats. > > Please review. series: Acked-by: Michael S. Tsirkin I think you can now

Re: [patch net-next v5 3/5] selftests: forwarding: add check_driver() helper

2024-04-22 Thread Benjamin Poirier
On 2024-04-22 17:32 +0200, Jiri Pirko wrote: > From: Jiri Pirko > > Add a helper to be used to check if the netdevice is backed by specified > driver. > > Signed-off-by: Jiri Pirko > Reviewed-by: Petr Machata > --- > tools/testing/selftests/net/forwarding/lib.sh | 15 +++ > 1 file

Re: [PATCH io_uring-next/net-next v2 2/4] net: add callback for setting a ubuf_info to skb

2024-04-22 Thread Willem de Bruijn
Pavel Begunkov wrote: > At the moment an skb can only have one ubuf_info associated with it, > which might be a performance problem for zerocopy sends in cases like > TCP via io_uring. Add a callback for assigning ubuf_info to skb, this > way we will implement smarter assignment later like linking

Re: [PATCH io_uring-next/net-next v2 1/4] net: extend ubuf_info callback to ops structure

2024-04-22 Thread Willem de Bruijn
Pavel Begunkov wrote: > We'll need to associate additional callbacks with ubuf_info, introduce > a structure holding ubuf_info callbacks. Apart from a more smarter > io_uring notification management introduced in next patches, it can be > used to generalise msg_zerocopy_put_abort() and also store >

[patch net-next v5 5/5] selftests: virtio_net: add initial tests

2024-04-22 Thread Jiri Pirko
From: Jiri Pirko Introduce initial tests for virtio_net driver. Focus on feature testing leveraging previously introduced debugfs feature filtering infrastructure. Add very basic ping and F_MAC feature tests. To run this, do: $ make -C tools/testing/selftests/ TARGETS=drivers/net/virtio_net/ run

[patch net-next v5 4/5] selftests: forwarding: add wait_for_dev() helper

2024-04-22 Thread Jiri Pirko
From: Jiri Pirko The existing setup_wait*() helper family check the status of the interface to be up. Introduce wait_for_dev() to wait for the netdevice to appear, for example after test script does manual device bind. Signed-off-by: Jiri Pirko Reviewed-by: Petr Machata --- v3->v4: - removed "

[patch net-next v5 3/5] selftests: forwarding: add check_driver() helper

2024-04-22 Thread Jiri Pirko
From: Jiri Pirko Add a helper to be used to check if the netdevice is backed by specified driver. Signed-off-by: Jiri Pirko Reviewed-by: Petr Machata --- tools/testing/selftests/net/forwarding/lib.sh | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/te

[patch net-next v5 2/5] selftests: forwarding: add ability to assemble NETIFS array by driver name

2024-04-22 Thread Jiri Pirko
From: Jiri Pirko Allow driver tests to work without specifying the netdevice names. Introduce a possibility to search for available netdevices according to set driver name. Allow test to specify the name by setting NETIF_FIND_DRIVER variable. Note that user overrides this either by passing netde

[patch net-next v5 1/5] virtio: add debugfs infrastructure to allow to debug virtio features

2024-04-22 Thread Jiri Pirko
From: Jiri Pirko Currently there is no way for user to set what features the driver should obey or not, it is hard wired in the code. In order to be able to debug the device behavior in case some feature is disabled, introduce a debugfs infrastructure with couple of files allowing user to see wh

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

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

2024-04-22 Thread Xuan Zhuo
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. We require space to store the DMA address. I use the page.dma_addr to store the DMA address from the pp structure inside the page. Every page retrieved from get_a_pa

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

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

2024-04-22 Thread Xuan Zhuo
Currently, big, merge, and small modes all support the premapped mode. We can now enable premapped mode by default. Furthermore, virtqueue_set_dma_premapped() must succeed when called immediately after find_vqs(). Consequently, we can assume that premapped mode is always enabled. Signed-off-by: Xu

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

2024-04-22 Thread Xuan Zhuo
Now, we chain the pages of big mode by the page's private variable. But a subsequent patch aims to make the big mode to support premapped mode. This requires additional space to store the dma addr. Within the sub-struct that contains the 'private', there is no suitable variable for storing the DMA

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

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

2024-04-22 Thread Xuan Zhuo
The virtio-net big mode sq will use these APIs to map the pages. dma_addr_t virtqueue_dma_map_page_attrs(struct virtqueue *_vq, struct page *page, size_t offset, size_t size, enum dma_data_direction dir,

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

2024-04-22 Thread Xuan Zhuo
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 can enable premapped mode unconditionally. This patch set makes the big mode of virtio-net to support premapped mode. And enable premapped mode fo