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
In this patch series:
Patch-1: Extract interrupt coalescing settings to a structure.
Patch-2: Extract get/set interrupt coalesce to a function.
Patch-3: Support per queue interrupt coalesce command.
Patch-4: Enable per queue interrupt coalesce feature.
Gavin Li (4):
virtio_net: extract interrupt coalescing settings to a structure
virtio_net: extract get/set interrupt coalesce to a function
virtio_net: support per queue interrupt coalesce command
virtio_net: enable per queue interrupt coalesce feature
drivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------
include/uapi/linux/virtio_net.h | 14 +++
2 files changed, 154 insertions(+), 29 deletions(-)
--
2.39.1
Extract get/set interrupt coalesce to a function to be reused by global
and per queue config.
Signed-off-by: Gavin Li <[email protected]>
Reviewed-by: Dragos Tatulea <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
---
drivers/net/virtio_net.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index dd5fec073a27..802ed21453f5 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3093,10 +3093,8 @@ static int virtnet_coal_params_supported(struct ethtool_coalesce *ec)
return 0;
}
-static int virtnet_set_coalesce(struct net_device *dev,
- struct ethtool_coalesce *ec,
- struct kernel_ethtool_coalesce *kernel_coal,
- struct netlink_ext_ack *extack)
+static int virtnet_set_coalesce_one(struct net_device *dev,
+ struct ethtool_coalesce *ec)
{
struct virtnet_info *vi = netdev_priv(dev);
int ret, i, napi_weight;
@@ -3127,10 +3125,16 @@ static int virtnet_set_coalesce(struct net_device *dev,
return ret;
}
-static int virtnet_get_coalesce(struct net_device *dev,
+static int virtnet_set_coalesce(struct net_device *dev,
struct ethtool_coalesce *ec,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
+{
+ return virtnet_set_coalesce_one(dev, ec);
+}
+
+static int virtnet_get_coalesce_one(struct net_device *dev,
+ struct ethtool_coalesce *ec)
{
struct virtnet_info *vi = netdev_priv(dev);
@@ -3149,6 +3153,14 @@ static int virtnet_get_coalesce(struct net_device *dev,
return 0;
}
+static int virtnet_get_coalesce(struct net_device *dev,
+ struct ethtool_coalesce *ec,
+ struct kernel_ethtool_coalesce *kernel_coal,
+ struct netlink_ext_ack *extack)
+{
+ return virtnet_get_coalesce_one(dev, ec);
+}
+
static void virtnet_init_settings(struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);
--
2.39.1
On Mon, 10 Jul 2023 12:58:46 +0300 Gavin Li wrote:
> 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.
Why did you resend this, disobeying the posting rules:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
and what is net-next-mlx5? :|
On 7/11/2023 2:09 AM, Jakub Kicinski wrote:
> External email: Use caution opening links or attachments
>
>
> On Mon, 10 Jul 2023 12:58:46 +0300 Gavin Li wrote:
>> 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.
> Why did you resend this, disobeying the posting rules:
>
> https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
>
> and what is net-next-mlx5? :|
I thought I made a mistake to use a wrong branch net-next. Please ignore
this mail thread then. Sorry for the confusion.