[PATCH net-next v2 2/2] virtio_net: get init coalesce value when probe

2024-04-25 Thread Heng Qi
Currently, virtio-net lacks a way to obtain the default coalesce values of the device during the probe phase. That is, the device may have default experience values, but the user uses "ethtool -c" to query that the values are still 0. Therefore, we reuse VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET to complet

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

2024-04-25 Thread Heng Qi
From: Xuan Zhuo As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 Based on the description provided in the above specification, we have enabled the virtio-net driver to support acquiring some response information from the device via the CVQ (Co

[PATCH net-next v2 0/2] virtio_net: support getting initial value of irq coalesce

2024-04-25 Thread Heng Qi
Patch 1 from Xuan: the virtnet cvq supports to get result from the device. Patch 2 reuses the VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET cmd to get init coalesce value. Changelog == v1->v2: - Update patch1's commit log. Heng Qi (1): virtio_net: get init coalesce value when probe Xuan Zhuo (1)

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

2024-04-25 Thread Xuan Zhuo
These stats are commonly. Support reporting those via netdev-genl queue stats. name: rx-hw-drops name: rx-hw-drop-overruns name: rx-csum-unnecessary name: rx-csum-none name: rx-csum-bad name: rx-hw-gro-packets name: rx-hw-gro-bytes name: rx-hw-gro-wire-packets name: rx-hw-gro-wire-bytes name: rx-h

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

2024-04-25 Thread Xuan Zhuo
To enhance functionality, we now support reporting statistics through the netdev-generic netlink (netdev-genl) queue stats interface. However, this does not extend to all statistics, so a new field, qstat_offset, has been introduced. This field determines which statistics should be reported via net

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

2024-04-25 Thread Xuan Zhuo
Now, we just show the stats of every queue. But for the user, the total values of every stat may are valuable. NIC statistics: rx_packets: 373522 rx_bytes: 85919736 rx_drops: 0 rx_xdp_packets: 0 rx_xdp_tx: 0 rx_xdp_redirects: 0 rx_xdp_drops: 0 rx_kicks: 111

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

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

2024-04-25 Thread Xuan Zhuo
As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 make virtio-net support getting the stats from the device by ethtool -S . NIC statistics: rx0_packets: 582951 rx0_bytes: 155307077 rx0_drops: 0 rx0_xdp_packets: 0 rx0_xdp

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

2024-04-25 Thread Xuan Zhuo
As the spec: https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 The virtio net supports to get device stats. Please review. Thanks. v6: 1. remove 'maps'. check stats by if-else. v5: 1. Fix some small problems in last version 2. Not report stat

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

2024-04-25 Thread Xuan Zhuo
The key size of ethtool -S is controlled by this macro. ETH_GSTRING_LEN 32 That includes the \0 at the end. So the max length of the key name must is 31. But the length of the prefix "rx_queue_0_" is 11. If the queue num is larger than 10, the length of the prefix is 12. So the key name max is 19

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

2024-04-25 Thread Xuan Zhuo
As the spec https://github.com/oasis-tcs/virtio-spec/commit/42f389989823039724f95bbbd243291ab0064f82 Based on the description provided in the above specification, we have enabled the virtio-net driver to support acquiring some response information from the device via the CVQ (Control Virtqueue).

[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

Re: [PATCH net-next 2/3] virtio_net: fix possible dim status unrecoverable

2024-04-25 Thread Heng Qi
在 2024/4/26 上午10:21, Jakub Kicinski 写道: On Thu, 25 Apr 2024 20:58:54 +0800 Heng Qi wrote: When the dim worker is scheduled, if it no longer needs to issue commands, dim may not be able to return to the working state later. For example, the following single queue scenario: 1. The dim worker

Re: [PATCH net-next 2/3] virtio_net: fix possible dim status unrecoverable

2024-04-25 Thread Jakub Kicinski
On Thu, 25 Apr 2024 20:58:54 +0800 Heng Qi wrote: > When the dim worker is scheduled, if it no longer needs to issue > commands, dim may not be able to return to the working state later. > > For example, the following single queue scenario: > 1. The dim worker of rxq0 is scheduled, and the dim s

[PATCH net-next 3/3] virtio_net: improve dim command request efficiency

2024-04-25 Thread Heng Qi
Currently, ctrlq processes commands in a synchronous manner, which increases the delay of dim commands when configuring multi-queue VMs, which in turn causes the CPU utilization to increase and interferes with the performance of dim. Therefore we asynchronously process ctlq's dim commands. Signed

[PATCH net-next 0/3] virtio_net: enable the irq for ctrlq

2024-04-25 Thread Heng Qi
Ctrlq in polling mode may cause the virtual machine to hang and occupy additional CPU resources. Enabling the irq for ctrlq alleviates this problem and allows commands to be requested concurrently. This patch set is on top of https://lore.kernel.org/all/20240423035746.699466-1-dani...@nvidia.com/

[PATCH net-next 1/3] virtio_net: enable irq for the control vq

2024-04-25 Thread Heng Qi
Control vq polling request results consume more CPU. Especially when dim issues more control requests to the device, it's beneficial to the guest to enable control vq's irq. Suggested-by: Jason Wang Signed-off-by: Heng Qi --- drivers/net/virtio_net.c | 45 ++-

[PATCH net-next 2/3] virtio_net: fix possible dim status unrecoverable

2024-04-25 Thread Heng Qi
When the dim worker is scheduled, if it no longer needs to issue commands, dim may not be able to return to the working state later. For example, the following single queue scenario: 1. The dim worker of rxq0 is scheduled, and the dim status is changed to DIM_APPLY_NEW_PROFILE; 2. dim is

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, > > + struct netdev_queu