2023-07-25 13:47:22

by Gavin Li

[permalink] [raw]
Subject: [PATCH net-next V4 0/3] virtio_net: add per queue interrupt coalescing support

Currently, coalescing parameters are grouped for all transmit and receive
virtqueues. This patch series add support to set or get the parameters for
a specified virtqueue.

When the traffic between virtqueues is unbalanced, for example, one virtqueue
is busy and another virtqueue is idle, then it will be very useful to
control coalescing parameters at the virtqueue granularity.

Example command:
$ ethtool -Q eth5 queue_mask 0x1 --coalesce tx-packets 10
Would set max_packets=10 to VQ 1.
$ ethtool -Q eth5 queue_mask 0x1 --coalesce rx-packets 10
Would set max_packets=10 to VQ 0.
$ ethtool -Q eth5 queue_mask 0x1 --show-coalesce
Queue: 0
Adaptive RX: off TX: off
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0

rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256

tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256

rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0

rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0

Gavin Li (3):
virtio_net: extract interrupt coalescing settings to a structure
virtio_net: support per queue interrupt coalesce command
---
changelog:
v1->v2
- Addressed the comment from Xuan Zhuo
- Allocate memory from heap instead of using stack memory for control vq
messages
v2->v3
- Addressed the comment from Heng Qi
- Use control_buf for control vq messages
v3->v4
- Addressed the comment from Michael S. Tsirkin
- Refactor set_coalesce of both per queue and global config that were
littered with if/else branches
---
virtio_net: enable per queue interrupt coalesce feature

drivers/net/virtio_net.c | 187 ++++++++++++++++++++++++++++----
include/uapi/linux/virtio_net.h | 14 +++
2 files changed, 177 insertions(+), 24 deletions(-)

--
2.39.1



2023-07-25 14:55:09

by Gavin Li

[permalink] [raw]
Subject: [PATCH net-next V4 3/3] virtio_net: enable per queue interrupt coalesce feature

Enable per queue interrupt coalesce feature bit in driver and validate its
dependency with control queue.

Signed-off-by: Gavin Li <[email protected]>
Reviewed-by: Dragos Tatulea <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Heng Qi <[email protected]>
---
drivers/net/virtio_net.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index c185930d7c9d..57cb75f98618 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -4088,6 +4088,8 @@ static bool virtnet_validate_features(struct virtio_device *vdev)
VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_HASH_REPORT,
"VIRTIO_NET_F_CTRL_VQ") ||
VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_NOTF_COAL,
+ "VIRTIO_NET_F_CTRL_VQ") ||
+ VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_VQ_NOTF_COAL,
"VIRTIO_NET_F_CTRL_VQ"))) {
return false;
}
@@ -4512,6 +4514,7 @@ static struct virtio_device_id id_table[] = {
VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, \
VIRTIO_NET_F_SPEED_DUPLEX, VIRTIO_NET_F_STANDBY, \
VIRTIO_NET_F_RSS, VIRTIO_NET_F_HASH_REPORT, VIRTIO_NET_F_NOTF_COAL, \
+ VIRTIO_NET_F_VQ_NOTF_COAL, \
VIRTIO_NET_F_GUEST_HDRLEN

static unsigned int features[] = {
--
2.39.1


2023-07-31 07:19:48

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next V4 3/3] virtio_net: enable per queue interrupt coalesce feature


在 2023/7/25 21:07, Gavin Li 写道:
> Enable per queue interrupt coalesce feature bit in driver and validate its
> dependency with control queue.
>
> Signed-off-by: Gavin Li <[email protected]>
> Reviewed-by: Dragos Tatulea <[email protected]>
> Reviewed-by: Jiri Pirko <[email protected]>
> Acked-by: Michael S. Tsirkin <[email protected]>
> Reviewed-by: Heng Qi <[email protected]>


Acked-by: Jason Wang <[email protected]>

Thanks