virtio_net: add per queue interrupt coalescing support
Subsystems (5)
PATCH 1/4 virtio_net: extract interrupt coalescing settings to a structure
In reply to Gavin LiExtract interrupt coalescing settings to a structure so that it could be reused in other data structures.
--- drivers/net/virtio_net.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-)
drivers/net/virtio_net.c +19 -16
@@ -126,6 +126,11 @@ static const struct virtnet_stat_desc virtnet_rq_stats_desc[] = {#define VIRTNET_SQ_STATS_LEN ARRAY_SIZE(virtnet_sq_stats_desc)#define VIRTNET_RQ_STATS_LEN ARRAY_SIZE(virtnet_rq_stats_desc) +struct virtnet_interrupt_coalesce { +u32 max_packets; +u32 max_usecs; +}; +/* Internal representation of a send virtqueue */ struct send_queue {/* Virtqueue associated with this send _queue */
@@ -281,10 +286,8 @@ struct virtnet_info {u32 speed;/* Interrupt coalescing settings */ -u32 tx_usecs; -u32 rx_usecs; -u32 tx_max_packets; -u32 rx_max_packets; +struct virtnet_interrupt_coalesce intr_coal_tx; +struct virtnet_interrupt_coalesce intr_coal_rx;unsigned long guest_offloads;unsigned long guest_offloads_capable;
@@ -3056,8 +3059,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,return -EINVAL ;/* Save parameters */ - vi->tx_usecs = ec->tx_coalesce_usecs; - vi->tx_max_packets = ec->tx_max_coalesced_frames; + vi->intr_coal_tx.max_usecs = ec->tx_coalesce_usecs; + vi->intr_coal_tx.max_packets = ec->tx_max_coalesced_frames; vi->ctrl->coal_rx.rx_usecs =cpu_to_le32 (ec->rx_coalesce_usecs); vi->ctrl->coal_rx.rx_max_packets =cpu_to_le32 (ec->rx_max_coalesced_frames);
@@ -3069,8 +3072,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,return -EINVAL ;/* Save parameters */ - vi->rx_usecs = ec->rx_coalesce_usecs; - vi->rx_max_packets = ec->rx_max_coalesced_frames; + vi->intr_coal_rx.max_usecs = ec->rx_coalesce_usecs; + vi->intr_coal_rx.max_packets = ec->rx_max_coalesced_frames;return 0 ; }
@@ -3132,10 +3135,10 @@ static int virtnet_get_coalesce(struct net_device *dev,struct virtnet_info *vi =netdev_priv (dev);if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { - ec->rx_coalesce_usecs = vi->rx_usecs; - ec->tx_coalesce_usecs = vi->tx_usecs; - ec->tx_max_coalesced_frames = vi->tx_max_packets; - ec->rx_max_coalesced_frames = vi->rx_max_packets; + ec->rx_coalesce_usecs = vi->intr_coal_rx.max_usecs; + ec->tx_coalesce_usecs = vi->intr_coal_tx.max_usecs; + ec->tx_max_coalesced_frames = vi->intr_coal_tx.max_packets; + ec->rx_max_coalesced_frames = vi->intr_coal_rx.max_packets; }else { ec->rx_max_coalesced_frames =1 ;
@@ -4119,10 +4122,10 @@ static int virtnet_probe(struct virtio_device *vdev) }if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { - vi->rx_usecs =0 ; - vi->tx_usecs =0 ; - vi->tx_max_packets =0 ; - vi->rx_max_packets =0 ; + vi->intr_coal_rx.max_usecs =0 ; + vi->intr_coal_tx.max_usecs =0 ; + vi->intr_coal_tx.max_packets =0 ; + vi->intr_coal_rx.max_packets =0 ; }if (virtio_has_feature (vdev,VIRTIO_NET_F_HASH_REPORT ))
Signature · 1 line
2.39.1
cover 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
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(-)
Signature · 1 line
2.39.1
PATCH 2/4 virtio_net: extract get/set interrupt coalesce to a function
Extract get/set interrupt coalesce to a function to be reused by global and per queue config.
--- drivers/net/virtio_net.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/net/virtio_net.c +17 -5
@@ -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);
Signature · 1 line
2.39.1
PATCH 3/4 virtio_net: support per queue interrupt coalesce command
In reply to Gavin LiAdd interrupt_coalesce config in send_queue and receive_queue to cache user config.
Send per virtqueue interrupt moderation config to underline device in order to have more efficient interrupt moderation and cpu utilization of guest VM.
--- drivers/net/virtio_net.c | 117 ++++++++++++++++++++++++++++---- include/uapi/linux/virtio_net.h | 14 ++++ 2 files changed, 119 insertions(+), 12 deletions(-)
drivers/net/virtio_net.c +105 -12
@@ -144,6 +144,8 @@ struct send_queue {struct virtnet_sq_stats stats; +struct virtnet_interrupt_coalesce intr_coal; +struct napi_struct napi;/* Record whether sq is in reset state. */
@@ -161,6 +163,8 @@ struct receive_queue {struct virtnet_rq_stats stats; +struct virtnet_interrupt_coalesce intr_coal; +/* Chain pages by the private ptr. */ struct page *pages;
@@ -3078,6 +3082,56 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,return 0 ; } +static int virtnet_send_ctrl_coal_vq_cmd (struct virtnet_info *vi, +u16 vqn,u32 max_usecs,u32 max_packets) +{ +struct virtio_net_ctrl_coal_vq coal_vq = {}; +struct scatterlist sgs; + + coal_vq.vqn =cpu_to_le16 (vqn); + coal_vq.coal.max_usecs =cpu_to_le32 (max_usecs); + coal_vq.coal.max_packets =cpu_to_le32 (max_packets); +sg_init_one (&sgs, &coal_vq,sizeof (coal_vq)); + +if (!virtnet_send_command (vi,VIRTIO_NET_CTRL_NOTF_COAL , +VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET , + &sgs)) +return -EINVAL ; + +return 0 ; +} + +static int virtnet_send_notf_coal_vq_cmds (struct virtnet_info *vi, +struct ethtool_coalesce *ec, +u16 queue) +{ +int err; + +if (ec->rx_coalesce_usecs || ec->rx_max_coalesced_frames) { + err =virtnet_send_ctrl_coal_vq_cmd (vi,rxq2vq (queue), + ec->rx_coalesce_usecs, + ec->rx_max_coalesced_frames); +if (err) +return err; +/* Save parameters */ + vi->rq[queue].intr_coal.max_usecs = ec->rx_coalesce_usecs; + vi->rq[queue].intr_coal.max_packets = ec->rx_max_coalesced_frames; + } + +if (ec->tx_coalesce_usecs || ec->tx_max_coalesced_frames) { + err =virtnet_send_ctrl_coal_vq_cmd (vi,txq2vq (queue), + ec->tx_coalesce_usecs, + ec->tx_max_coalesced_frames); +if (err) +return err; +/* Save parameters */ + vi->sq[queue].intr_coal.max_usecs = ec->tx_coalesce_usecs; + vi->sq[queue].intr_coal.max_packets = ec->tx_max_coalesced_frames; + } + +return 0 ; +} +static int virtnet_coal_params_supported (struct ethtool_coalesce *ec) {/* usecs coalescing is supported only if VIRTIO_NET_F_NOTF_COAL
@@ -3094,23 +3148,36 @@ static int virtnet_coal_params_supported(struct ethtool_coalesce *ec) }static int virtnet_set_coalesce_one (struct net_device *dev, -struct ethtool_coalesce *ec) +struct ethtool_coalesce *ec, +bool per_queue, +u32 queue) {struct virtnet_info *vi =netdev_priv (dev); -int ret, i, napi_weight; +int queue_count = per_queue ?1 : vi->max_queue_pairs; +int queue_number = per_queue ? queue :0 ;bool update_napi = false; +int ret, i, napi_weight; + +if (queue >= vi->max_queue_pairs) +return -EINVAL ;/* Can't change NAPI weight if the link is up */ napi_weight = ec->tx_max_coalesced_frames ?NAPI_POLL_WEIGHT :0 ; -if (napi_weight ^ vi->sq[0 ].napi.weight) { -if (dev->flags &IFF_UP ) -return -EBUSY ; -else +for (i = queue_number; i < queue_count; i++) { +if (napi_weight ^ vi->sq[i].napi.weight) { +if (dev->flags &IFF_UP ) +return -EBUSY ; + update_napi = true; + queue_number = i; +break ; + } } -if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) +if (!per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) ret =virtnet_send_notf_coal_cmds (vi, ec); +else if (per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_VQ_NOTF_COAL )) + ret =virtnet_send_notf_coal_vq_cmds (vi, ec, queue);else ret =virtnet_coal_params_supported (ec);
@@ -3118,7 +3185,7 @@ static int virtnet_set_coalesce_one(struct net_device *dev,return ret;if (update_napi) { -for (i =0 ; i < vi->max_queue_pairs; i++) +for (i = queue_number; i < queue_count; i++) vi->sq[i].napi.weight = napi_weight; }
@@ -3130,19 +3197,29 @@ static int virtnet_set_coalesce(struct net_device *dev,struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { - return virtnet_set_coalesce_one(dev, ec); + return virtnet_set_coalesce_one(dev, ec, false, 0); }static int virtnet_get_coalesce_one (struct net_device *dev, -struct ethtool_coalesce *ec) +struct ethtool_coalesce *ec, +bool per_queue, +u32 queue) {struct virtnet_info *vi =netdev_priv (dev); -if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { +if (queue >= vi->max_queue_pairs) +return -EINVAL ; + +if (!per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { ec->rx_coalesce_usecs = vi->intr_coal_rx.max_usecs; ec->tx_coalesce_usecs = vi->intr_coal_tx.max_usecs; ec->tx_max_coalesced_frames = vi->intr_coal_tx.max_packets; ec->rx_max_coalesced_frames = vi->intr_coal_rx.max_packets; + }else if (per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_VQ_NOTF_COAL )) { + ec->rx_coalesce_usecs = vi->rq[queue].intr_coal.max_usecs; + ec->tx_coalesce_usecs = vi->sq[queue].intr_coal.max_usecs; + ec->tx_max_coalesced_frames = vi->sq[queue].intr_coal.max_packets; + ec->rx_max_coalesced_frames = vi->rq[queue].intr_coal.max_packets; }else { ec->rx_max_coalesced_frames =1 ;
@@ -3158,7 +3235,21 @@ static int virtnet_get_coalesce(struct net_device *dev,struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { - return virtnet_get_coalesce_one(dev, ec); + return virtnet_get_coalesce_one(dev, ec, false, 0); +} + +static int virtnet_set_per_queue_coalesce (struct net_device *dev, +u32 queue, +struct ethtool_coalesce *ec) +{ +return virtnet_set_coalesce_one (dev, ec, true, queue); +} + +static int virtnet_get_per_queue_coalesce (struct net_device *dev, +u32 queue, +struct ethtool_coalesce *ec) +{ +return virtnet_get_coalesce_one (dev, ec, true, queue); }static void virtnet_init_settings (struct net_device *dev)
@@ -3291,6 +3382,8 @@ static const struct ethtool_ops virtnet_ethtool_ops = { .set_link_ksettings = virtnet_set_link_ksettings, .set_coalesce = virtnet_set_coalesce, .get_coalesce = virtnet_get_coalesce, + .set_per_queue_coalesce = virtnet_set_per_queue_coalesce, + .get_per_queue_coalesce = virtnet_get_per_queue_coalesce, .get_rxfh_key_size = virtnet_get_rxfh_key_size, .get_rxfh_indir_size = virtnet_get_rxfh_indir_size, .get_rxfh = virtnet_get_rxfh,
include/uapi/linux/virtio_net.h +14 -0
@@ -56,6 +56,7 @@#define VIRTIO_NET_F_MQ 22/* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23/* Set MAC address */ +#define VIRTIO_NET_F_VQ_NOTF_COAL 52/* Device supports virtqueue notification coalescing */ #define VIRTIO_NET_F_NOTF_COAL 53/* Device supports notifications coalescing */ #define VIRTIO_NET_F_GUEST_USO4 54/* Guest can handle USOv4 in. */ #define VIRTIO_NET_F_GUEST_USO6 55/* Guest can handle USOv6 in. */
@@ -391,5 +392,18 @@ struct virtio_net_ctrl_coal_rx { };#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 2 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 3 + +struct virtio_net_ctrl_coal { +__le32 max_packets; +__le32 max_usecs; +}; + +struct virtio_net_ctrl_coal_vq { +__le16 vqn; +__le16 reserved; +struct virtio_net_ctrl_coal coal; +};#endif /* _UAPI_LINUX_VIRTIO_NET_H */
Signature · 1 line
2.39.1
PATCH 4/4 virtio_net: enable per queue interrupt coalesce feature
In reply to Gavin LiEnable per queue interrupt coalesce feature bit in driver and validate its dependency with control queue.
--- drivers/net/virtio_net.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/virtio_net.c +3 -0
@@ -4060,6 +4060,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; }
@@ -4484,6 +4486,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[] = {
Signature · 1 line
2.39.1
Xuan Zhuo
reviewerOn Mon, 10 Jul 2023 12:20:01 +0300, Gavin Li <[email protected]> wrote:
As far as I know, Heng Qi does that. I'm not sure, it's the same piece.
cc @Heng Qi
Thanks.
Quoted 60 lines
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: 0rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0In 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 featuredrivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------ include/uapi/linux/virtio_net.h | 14 +++ 2 files changed, 154 insertions(+), 29 deletions(-)--
2.39.1
Quoted 10 lines · Xuan Zhuo
External email: Use caution opening links or attachments
On Mon, 10 Jul 2023 12:20:01 +0300, Gavin Li <[email protected]> wrote:
As far as I know, Heng Qi does that. I'm not sure, it's the same piece.
cc @Heng Qi
Thanks.
Do you mean the one below?
https://lists.oasis-open.org/archives/virtio-dev/202303/msg00415.html
The code is to implement what it described and I don't have better words. So, I copied the text from Heng Qi's.
Quoted 62 lines
Quoted 62 lines
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: 0rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0In 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 featuredrivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------ include/uapi/linux/virtio_net.h | 14 +++ 2 files changed, 154 insertions(+), 29 deletions(-)--
2.39.1
Xuan Zhuo
reviewerQuoted 5 lines · Gavin Li
Quoted 3 lines · Xuan Zhuo
External email: Use caution opening links or attachments
Quoted 8 lines
Quoted 7 lines · Gavin Li
As far as I know, Heng Qi does that. I'm not sure, it's the same piece.
cc @Heng Qi
Thanks.
Do you mean the one below?
YES
Quoted 5 lines
https://lists.oasis-open.org/archives/virtio-dev/202303/msg00415.html
The code is to implement what it described and I don't have better words. So, I copied the text from Heng Qi's.
Maybe he wrote code for it. I think you should ask him about his plans first.
Thanks.
Quoted 63 lines
Quoted 63 lines
Quoted 63 lines
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: 0rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0In 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 featuredrivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------ include/uapi/linux/virtio_net.h | 14 +++ 2 files changed, 154 insertions(+), 29 deletions(-)--
2.39.1
Re: [PATCH net-next V1 1/4] virtio_net: extract interrupt coalescing settings to a structure
In reply to Gavin LiQuoted 10 lines · Gavin Li
Extract interrupt coalescing settings to a structure so that it could be reused in other data structures.
Signed-off-by Gavin Li <[email protected]>Reviewed-by Dragos Tatulea <[email protected]>Reviewed-by Jiri Pirko <[email protected]>--- drivers/net/virtio_net.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-)
Thanks
Quoted 87 lines
drivers/net/virtio_net.c +5
-0@@ -126,6 +126,11 @@ static const struct virtnet_stat_desc virtnet_rq_stats_desc[] = {#define VIRTNET_SQ_STATS_LEN ARRAY_SIZE(virtnet_sq_stats_desc)#define VIRTNET_RQ_STATS_LEN ARRAY_SIZE(virtnet_rq_stats_desc) +struct virtnet_interrupt_coalesce { +u32 max_packets; +u32 max_usecs; +}; +/* Internal representation of a send virtqueue */ struct send_queue {/* Virtqueue associated with this send _queue */drivers/net/virtio_net.c +4
-6@@ -281,10 +286,8 @@ struct virtnet_info {u32 speed;/* Interrupt coalescing settings */ -u32 tx_usecs; -u32 rx_usecs; -u32 tx_max_packets; -u32 rx_max_packets; +struct virtnet_interrupt_coalesce intr_coal_tx; +struct virtnet_interrupt_coalesce intr_coal_rx;unsigned long guest_offloads;unsigned long guest_offloads_capable;@@ -3056,8 +3059,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, return -EINVAL ;/* Save parameters */ - vi->tx_usecs = ec->tx_coalesce_usecs; - vi->tx_max_packets = ec->tx_max_coalesced_frames; + vi->intr_coal_tx.max_usecs = ec->tx_coalesce_usecs; + vi->intr_coal_tx.max_packets = ec->tx_max_coalesced_frames; vi->ctrl->coal_rx.rx_usecs =cpu_to_le32 (ec->rx_coalesce_usecs);vi->ctrl->coal_rx.rx_max_packets =
cpu_to_le32(ec->rx_max_coalesced_frames);drivers/net/virtio_net.c +2
-2@@ -3069,8 +3072,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, return -EINVAL ;/* Save parameters */ - vi->rx_usecs = ec->rx_coalesce_usecs; - vi->rx_max_packets = ec->rx_max_coalesced_frames; + vi->intr_coal_rx.max_usecs = ec->rx_coalesce_usecs; + vi->intr_coal_rx.max_packets = ec->rx_max_coalesced_frames;return 0 ;}
drivers/net/virtio_net.c +8
-8@@ -3132,10 +3135,10 @@ static int virtnet_get_coalesce(struct net_device *dev, struct virtnet_info *vi = netdev_priv(dev);if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { - ec->rx_coalesce_usecs = vi->rx_usecs; - ec->tx_coalesce_usecs = vi->tx_usecs; - ec->tx_max_coalesced_frames = vi->tx_max_packets; - ec->rx_max_coalesced_frames = vi->rx_max_packets; + ec->rx_coalesce_usecs = vi->intr_coal_rx.max_usecs; + ec->tx_coalesce_usecs = vi->intr_coal_tx.max_usecs; + ec->tx_max_coalesced_frames = vi->intr_coal_tx.max_packets; + ec->rx_max_coalesced_frames = vi->intr_coal_rx.max_packets; }else { ec->rx_max_coalesced_frames =1 ;@@ -4119,10 +4122,10 @@ static int virtnet_probe(struct virtio_device *vdev) }if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { - vi->rx_usecs =0 ; - vi->tx_usecs =0 ; - vi->tx_max_packets =0 ; - vi->rx_max_packets =0 ; + vi->intr_coal_rx.max_usecs =0 ; + vi->intr_coal_tx.max_usecs =0 ; + vi->intr_coal_tx.max_packets =0 ; + vi->intr_coal_rx.max_packets =0 ; }
Quoted 5 lines
if (
virtio_has_feature(vdev, VIRTIO_NET_F_HASH_REPORT))
--
2.39.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH net-next V1 2/4] virtio_net: extract get/set interrupt coalesce to a function
In reply to Gavin LiQuoted 10 lines · Gavin Li
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(-)
Thanks
Quoted 57 lines
drivers/net/virtio_net.c +2
-4@@ -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;drivers/net/virtio_net.c +7
-1@@ -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);drivers/net/virtio_net.c +8
-0@@ -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);
Quoted 4 lines
--
2.39.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH net-next V1 3/4] virtio_net: support per queue interrupt coalesce command
In reply to Gavin LiQuoted 124 lines · Gavin Li
Add
interrupt_coalesceconfig insend_queueandreceive_queueto cache user config.Send per virtqueue interrupt moderation config to underline device in order to have more efficient interrupt moderation and cpu utilization of guest VM.
Signed-off-by Gavin Li <[email protected]>Reviewed-by Dragos Tatulea <[email protected]>Reviewed-by Jiri Pirko <[email protected]>--- drivers/net/virtio_net.c | 117 ++++++++++++++++++++++++++++---- include/uapi/linux/virtio_net.h | 14 ++++ 2 files changed, 119 insertions(+), 12 deletions(-)drivers/net/virtio_net.c +38
-0@@ -144,6 +144,8 @@ struct send_queue {struct virtnet_sq_stats stats; +struct virtnet_interrupt_coalesce intr_coal; +struct napi_struct napi;/* Record whether sq is in reset state. */ @@ -161,6 +163,8 @@ struct receive_queue {struct virtnet_rq_stats stats; +struct virtnet_interrupt_coalesce intr_coal; +/* Chain pages by the private ptr. */ struct page *pages;@@ -3078,6 +3082,56 @@ static int virtnet_send_notf_coal_cmds(structvirtnet_info *vi, return 0; } +static int virtnet_send_ctrl_coal_vq_cmd (struct virtnet_info *vi, +u16 vqn,u32 max_usecs,u32 max_packets) +{ +struct virtio_net_ctrl_coal_vq coal_vq = {}; +struct scatterlist sgs; + + coal_vq.vqn =cpu_to_le16 (vqn); + coal_vq.coal.max_usecs =cpu_to_le32 (max_usecs); + coal_vq.coal.max_packets =cpu_to_le32 (max_packets); +sg_init_one (&sgs, &coal_vq,sizeof (coal_vq)); + +if (!virtnet_send_command (vi,VIRTIO_NET_CTRL_NOTF_COAL , +VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET , + &sgs)) +return -EINVAL ; + +return 0 ; +} + +static int virtnet_send_notf_coal_vq_cmds (struct virtnet_info *vi, +struct ethtool_coalesce *ec, +u16 queue) +{ +int err; + +if (ec->rx_coalesce_usecs || ec->rx_max_coalesced_frames) { + err =virtnet_send_ctrl_coal_vq_cmd (vi,rxq2vq (queue), + ec->rx_coalesce_usecs, + ec->rx_max_coalesced_frames); +if (err) +return err; +/* Save parameters */ + vi->rq[queue].intr_coal.max_usecs = ec->rx_coalesce_usecs; + vi->rq[queue].intr_coal.max_packets =
ec->rx_max_coalesced_frames;drivers/net/virtio_net.c +11
-0+ } + +if (ec->tx_coalesce_usecs || ec->tx_max_coalesced_frames) { + err =virtnet_send_ctrl_coal_vq_cmd (vi,txq2vq (queue), + ec->tx_coalesce_usecs, + ec->tx_max_coalesced_frames); +if (err) +return err; +/* Save parameters */ + vi->sq[queue].intr_coal.max_usecs = ec->tx_coalesce_usecs; + vi->sq[queue].intr_coal.max_packets =
ec->tx_max_coalesced_frames;drivers/net/virtio_net.c +14
-4+ } + +return 0 ; +} +static int virtnet_coal_params_supported (struct ethtool_coalesce *ec) {/* usecs coalescing is supported only if VIRTIO_NET_F_NOTF_COAL @@ -3094,23 +3148,36 @@ static int virtnet_coal_params_supported(struct ethtool_coalesce *ec) }static int virtnet_set_coalesce_one (struct net_device *dev, -struct ethtool_coalesce *ec) +struct ethtool_coalesce *ec, +bool per_queue, +u32 queue) {struct virtnet_info *vi =netdev_priv (dev); -int ret, i, napi_weight; +int queue_count = per_queue ?1 : vi->max_queue_pairs; +int queue_number = per_queue ? queue :0 ;bool update_napi = false; +int ret, i, napi_weight; + +if (queue >= vi->max_queue_pairs) +return -EINVAL ;/* Can't change NAPI weight if the link is up */ napi_weight = ec->tx_max_coalesced_frames ?NAPI_POLL_WEIGHT :0 ; -if (napi_weight ^ vi->sq[0 ].napi.weight) { -if (dev->flags &IFF_UP )
drivers/net/virtio_net.c static int virtnet_coal_params_supported(struct · line 3174
Quoted 10 lines
drivers/net/virtio_net.c +6
-2-return -EBUSY ; - else +for (i = queue_number; i < queue_count; i++) { +if (napi_weight ^ vi->sq[i].napi.weight) { +if (dev->flags &IFF_UP ) +return -EBUSY ; + update_napi = true; + queue_number = i;
This seems to assume all queues that belong to [queue_number, queue_count) need an updating of the NAPI which is not necessarily the case. Worth a comment to mention that the updating of the NAPI might not be necessary.
Thanks
Quoted 135 lines
drivers/net/virtio_net.c +4
-1+break ; + } } -if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) +if (!per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) ret =virtnet_send_notf_coal_cmds (vi, ec); + else if (per_queue && virtio_has_feature(vi->vdev,
VIRTIO_NET_F_VQ_NOTF_COAL))drivers/net/virtio_net.c +11
-4+ ret =virtnet_send_notf_coal_vq_cmds (vi, ec, queue); else ret =virtnet_coal_params_supported (ec);@@ -3118,7 +3185,7 @@ static int virtnet_set_coalesce_one(structnet_device *dev, return ret;if (update_napi) { -for (i =0 ; i < vi->max_queue_pairs; i++) +for (i = queue_number; i < queue_count; i++) vi->sq[i].napi.weight = napi_weight; }@@ -3130,19 +3197,29 @@ static int virtnet_set_coalesce(struct net_device *dev, struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { -return virtnet_set_coalesce_one (dev, ec); + return virtnet_set_coalesce_one(dev, ec, false, 0); } static int virtnet_get_coalesce_one(struct net_device *dev, -struct ethtool_coalesce *ec) + struct ethtool_coalesce *ec, + bool per_queue, + u32 queue) { struct virtnet_info *vi = netdev_priv(dev); -if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { + if (queue >= vi->max_queue_pairs) + return -EINVAL; + + if (!per_queue && virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { ec->rx_coalesce_usecs = vi->intr_coal_rx.max_usecs; ec->tx_coalesce_usecs = vi->intr_coal_tx.max_usecs; ec->tx_max_coalesced_frames = vi->intr_coal_tx.max_packets; ec->rx_max_coalesced_frames = vi->intr_coal_rx.max_packets; + } else if (per_queue && virtio_has_feature(vi->vdev,
VIRTIO_NET_F_VQ_NOTF_COAL)) {drivers/net/virtio_net.c +3
-0+ ec->rx_coalesce_usecs = vi->rq[queue].intr_coal.max_usecs; + ec->tx_coalesce_usecs = vi->sq[queue].intr_coal.max_usecs; + ec->tx_max_coalesced_frames =vi->sq[queue].intr_coal.max_packets;
+ec->rx_max_coalesced_frames=vi->rq[queue].intr_coal.max_packets; } else { ec->rx_max_coalesced_frames = 1;drivers/net/virtio_net.c +15
-1@@ -3158,7 +3235,21 @@ static int virtnet_get_coalesce(struct net_device *dev, struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { -return virtnet_get_coalesce_one (dev, ec); +return virtnet_get_coalesce_one (dev, ec, false,0 ); +} + +static int virtnet_set_per_queue_coalesce (struct net_device *dev, +u32 queue, +struct ethtool_coalesce *ec) +{ +return virtnet_set_coalesce_one (dev, ec, true, queue); +} + +static int virtnet_get_per_queue_coalesce (struct net_device *dev, +u32 queue, +struct ethtool_coalesce *ec) +{ +return virtnet_get_coalesce_one (dev, ec, true, queue); }static void
virtnet_init_settings(struct net_device *dev)drivers/net/virtio_net.c +2
-0@@ -3291,6 +3382,8 @@ static const struct ethtool_ops virtnet_ethtool_ops = { .set_link_ksettings = virtnet_set_link_ksettings, .set_coalesce = virtnet_set_coalesce, .get_coalesce = virtnet_get_coalesce, + .set_per_queue_coalesce = virtnet_set_per_queue_coalesce, + .get_per_queue_coalesce = virtnet_get_per_queue_coalesce, .get_rxfh_key_size = virtnet_get_rxfh_key_size, .get_rxfh_indir_size = virtnet_get_rxfh_indir_size,.get_rxfh =
virtnet_get_rxfh,include/uapi/linux/virtio_net.h +1
-0@@ -56,6 +56,7 @@#define VIRTIO_NET_F_MQ 22/* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23/* Set MAC address */ +#define VIRTIO_NET_F_VQ_NOTF_COAL 52/* Device supports virtqueue notification coalescing */
#defineVIRTIO_NET_F_NOTF_COAL53 /* Device supports notifications
coalescing */
#defineVIRTIO_NET_F_GUEST_USO454 /* Guest can handle USOv4
in. */
#defineVIRTIO_NET_F_GUEST_USO655 /* Guest can handle USOv6
in. */include/uapi/linux/virtio_net.h +13
-1@@ -391,5 +392,18 @@ struct virtio_net_ctrl_coal_rx { };#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 2 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 3 + +struct virtio_net_ctrl_coal { +__le32 max_packets; +__le32 max_usecs; +}; + +struct virtio_net_ctrl_coal_vq { +__le16 vqn; +__le16 reserved; +struct virtio_net_ctrl_coal coal; +};#endif /* _UAPI_LINUX_VIRTIO_NET_H */ --
Quoted 3 lines
2.39.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 7 lines · Gavin Li
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.
We definitely did the same thing, and I'm waiting for our hardware implementation to be ready to push the ethtool + netdim implementation.
Since this commit log is completely copied from the implementation of the virtio spec, consulting each other's scheduling plan in advance can be friendly to avoid us doing the same thing and consuming an extra effort.
Thanks.
Quoted 50 lines
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: 0rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0In 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 featuredrivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------ include/uapi/linux/virtio_net.h | 14 +++ 2 files changed, 154 insertions(+), 29 deletions(-)
Xuan Zhuo
reviewerRe: [PATCH net-next V1 3/4] virtio_net: support per queue interrupt coalesce command
In reply to Gavin LiQuoted 38 lines · Gavin Li
Add
interrupt_coalesceconfig insend_queueandreceive_queueto cache user config.Send per virtqueue interrupt moderation config to underline device in order to have more efficient interrupt moderation and cpu utilization of guest VM.
Signed-off-by Gavin Li <[email protected]>Reviewed-by Dragos Tatulea <[email protected]>Reviewed-by Jiri Pirko <[email protected]>--- drivers/net/virtio_net.c | 117 ++++++++++++++++++++++++++++---- include/uapi/linux/virtio_net.h | 14 ++++ 2 files changed, 119 insertions(+), 12 deletions(-)drivers/net/virtio_net.c +4
-0@@ -144,6 +144,8 @@ struct send_queue {struct virtnet_sq_stats stats; +struct virtnet_interrupt_coalesce intr_coal; +struct napi_struct napi;/* Record whether sq is in reset state. */ @@ -161,6 +163,8 @@ struct receive_queue {struct virtnet_rq_stats stats; +struct virtnet_interrupt_coalesce intr_coal; +/* Chain pages by the private ptr. */ struct page *pages;
drivers/net/virtio_net.c static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, · line 3088
Quoted 7 lines
drivers/net/virtio_net.c +4
-0@@ -3078,6 +3082,56 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,return 0 ; } +static int virtnet_send_ctrl_coal_vq_cmd (struct virtnet_info *vi, +u16 vqn,u32 max_usecs,u32 max_packets) +{ +struct virtio_net_ctrl_coal_vq coal_vq = {};
We should alloc this on the heap.
Thanks.
Quoted 201 lines
drivers/net/virtio_net.c +97
-12+struct scatterlist sgs; + + coal_vq.vqn =cpu_to_le16 (vqn); + coal_vq.coal.max_usecs =cpu_to_le32 (max_usecs); + coal_vq.coal.max_packets =cpu_to_le32 (max_packets); +sg_init_one (&sgs, &coal_vq,sizeof (coal_vq)); + +if (!virtnet_send_command (vi,VIRTIO_NET_CTRL_NOTF_COAL , +VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET , + &sgs)) +return -EINVAL ; + +return 0 ; +} + +static int virtnet_send_notf_coal_vq_cmds (struct virtnet_info *vi, +struct ethtool_coalesce *ec, +u16 queue) +{ +int err; + +if (ec->rx_coalesce_usecs || ec->rx_max_coalesced_frames) { + err =virtnet_send_ctrl_coal_vq_cmd (vi,rxq2vq (queue), + ec->rx_coalesce_usecs, + ec->rx_max_coalesced_frames); +if (err) +return err; +/* Save parameters */ + vi->rq[queue].intr_coal.max_usecs = ec->rx_coalesce_usecs; + vi->rq[queue].intr_coal.max_packets = ec->rx_max_coalesced_frames; + } + +if (ec->tx_coalesce_usecs || ec->tx_max_coalesced_frames) { + err =virtnet_send_ctrl_coal_vq_cmd (vi,txq2vq (queue), + ec->tx_coalesce_usecs, + ec->tx_max_coalesced_frames); +if (err) +return err; +/* Save parameters */ + vi->sq[queue].intr_coal.max_usecs = ec->tx_coalesce_usecs; + vi->sq[queue].intr_coal.max_packets = ec->tx_max_coalesced_frames; + } + +return 0 ; +} +static int virtnet_coal_params_supported (struct ethtool_coalesce *ec) {/* usecs coalescing is supported only if VIRTIO_NET_F_NOTF_COAL @@ -3094,23 +3148,36 @@ static int virtnet_coal_params_supported(struct ethtool_coalesce *ec) }static int virtnet_set_coalesce_one (struct net_device *dev, -struct ethtool_coalesce *ec) +struct ethtool_coalesce *ec, +bool per_queue, +u32 queue) {struct virtnet_info *vi =netdev_priv (dev); -int ret, i, napi_weight; +int queue_count = per_queue ?1 : vi->max_queue_pairs; +int queue_number = per_queue ? queue :0 ;bool update_napi = false; +int ret, i, napi_weight; + +if (queue >= vi->max_queue_pairs) +return -EINVAL ;/* Can't change NAPI weight if the link is up */ napi_weight = ec->tx_max_coalesced_frames ?NAPI_POLL_WEIGHT :0 ; -if (napi_weight ^ vi->sq[0 ].napi.weight) { -if (dev->flags &IFF_UP ) -return -EBUSY ; -else +for (i = queue_number; i < queue_count; i++) { +if (napi_weight ^ vi->sq[i].napi.weight) { +if (dev->flags &IFF_UP ) +return -EBUSY ; + update_napi = true; + queue_number = i; +break ; + } } -if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) +if (!per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) ret =virtnet_send_notf_coal_cmds (vi, ec); +else if (per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_VQ_NOTF_COAL )) + ret =virtnet_send_notf_coal_vq_cmds (vi, ec, queue);else ret =virtnet_coal_params_supported (ec);@@ -3118,7 +3185,7 @@ static int virtnet_set_coalesce_one(struct net_device *dev,return ret;if (update_napi) { -for (i =0 ; i < vi->max_queue_pairs; i++) +for (i = queue_number; i < queue_count; i++) vi->sq[i].napi.weight = napi_weight; }@@ -3130,19 +3197,29 @@ static int virtnet_set_coalesce(struct net_device *dev,struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { - return virtnet_set_coalesce_one(dev, ec); + return virtnet_set_coalesce_one(dev, ec, false, 0); }static int virtnet_get_coalesce_one (struct net_device *dev, -struct ethtool_coalesce *ec) +struct ethtool_coalesce *ec, +bool per_queue, +u32 queue) {struct virtnet_info *vi =netdev_priv (dev); -if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { +if (queue >= vi->max_queue_pairs) +return -EINVAL ; + +if (!per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { ec->rx_coalesce_usecs = vi->intr_coal_rx.max_usecs; ec->tx_coalesce_usecs = vi->intr_coal_tx.max_usecs; ec->tx_max_coalesced_frames = vi->intr_coal_tx.max_packets; ec->rx_max_coalesced_frames = vi->intr_coal_rx.max_packets; + }else if (per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_VQ_NOTF_COAL )) { + ec->rx_coalesce_usecs = vi->rq[queue].intr_coal.max_usecs; + ec->tx_coalesce_usecs = vi->sq[queue].intr_coal.max_usecs; + ec->tx_max_coalesced_frames = vi->sq[queue].intr_coal.max_packets; + ec->rx_max_coalesced_frames = vi->rq[queue].intr_coal.max_packets; }else { ec->rx_max_coalesced_frames =1 ;@@ -3158,7 +3235,21 @@ static int virtnet_get_coalesce(struct net_device *dev,struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { - return virtnet_get_coalesce_one(dev, ec); + return virtnet_get_coalesce_one(dev, ec, false, 0); +} + +static int virtnet_set_per_queue_coalesce (struct net_device *dev, +u32 queue, +struct ethtool_coalesce *ec) +{ +return virtnet_set_coalesce_one (dev, ec, true, queue); +} + +static int virtnet_get_per_queue_coalesce (struct net_device *dev, +u32 queue, +struct ethtool_coalesce *ec) +{ +return virtnet_get_coalesce_one (dev, ec, true, queue); }static void virtnet_init_settings (struct net_device *dev)@@ -3291,6 +3382,8 @@ static const struct ethtool_ops virtnet_ethtool_ops = { .set_link_ksettings = virtnet_set_link_ksettings, .set_coalesce = virtnet_set_coalesce, .get_coalesce = virtnet_get_coalesce, + .set_per_queue_coalesce = virtnet_set_per_queue_coalesce, + .get_per_queue_coalesce = virtnet_get_per_queue_coalesce, .get_rxfh_key_size = virtnet_get_rxfh_key_size, .get_rxfh_indir_size = virtnet_get_rxfh_indir_size, .get_rxfh = virtnet_get_rxfh,include/uapi/linux/virtio_net.h +14
-1@@ -56,6 +56,7 @@#define VIRTIO_NET_F_MQ 22/* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23/* Set MAC address */ +#define VIRTIO_NET_F_VQ_NOTF_COAL 52/* Device supports virtqueue notification coalescing */ #define VIRTIO_NET_F_NOTF_COAL 53/* Device supports notifications coalescing */ #define VIRTIO_NET_F_GUEST_USO4 54/* Guest can handle USOv4 in. */ #define VIRTIO_NET_F_GUEST_USO6 55/* Guest can handle USOv6 in. */ @@ -391,5 +392,18 @@ struct virtio_net_ctrl_coal_rx { };#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 2 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 3 + +struct virtio_net_ctrl_coal { +__le32 max_packets; +__le32 max_usecs; +}; + +struct virtio_net_ctrl_coal_vq { +__le16 vqn; +__le16 reserved; +struct virtio_net_ctrl_coal coal; +};#endif /* _UAPI_LINUX_VIRTIO_NET_H */ --2.39.1
Re: [PATCH net-next V1 3/4] virtio_net: support per queue interrupt coalesce command
Quoted 42 lines · Xuan Zhuo
Quoted 41 lines · Gavin Li
Add
interrupt_coalesceconfig insend_queueandreceive_queueto cache user config.Send per virtqueue interrupt moderation config to underline device in order to have more efficient interrupt moderation and cpu utilization of guest VM.
Signed-off-by Gavin Li <[email protected]>Reviewed-by Dragos Tatulea <[email protected]>Reviewed-by Jiri Pirko <[email protected]>--- drivers/net/virtio_net.c | 117 ++++++++++++++++++++++++++++---- include/uapi/linux/virtio_net.h | 14 ++++ 2 files changed, 119 insertions(+), 12 deletions(-)drivers/net/virtio_net.c +4
-0@@ -144,6 +144,8 @@ struct send_queue {struct virtnet_sq_stats stats; +struct virtnet_interrupt_coalesce intr_coal; +struct napi_struct napi;/* Record whether sq is in reset state. */ @@ -161,6 +163,8 @@ struct receive_queue {struct virtnet_rq_stats stats; +struct virtnet_interrupt_coalesce intr_coal; +/* Chain pages by the private ptr. */ struct page *pages;@@ -3078,6 +3082,56 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,return 0 ; }
Quoted 7 lines
drivers/net/virtio_net.c static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, · line 3088
Quoted 4 lines
drivers/net/virtio_net.c +4
-0+static int virtnet_send_ctrl_coal_vq_cmd (struct virtnet_info *vi, +u16 vqn,u32 max_usecs,u32 max_packets) +{ +struct virtio_net_ctrl_coal_vq coal_vq = {};We should alloc this on the heap.
Thanks.
ACK
Quoted 203 lines
Quoted 203 lines
drivers/net/virtio_net.c +97
-12+struct scatterlist sgs; + + coal_vq.vqn =cpu_to_le16 (vqn); + coal_vq.coal.max_usecs =cpu_to_le32 (max_usecs); + coal_vq.coal.max_packets =cpu_to_le32 (max_packets); +sg_init_one (&sgs, &coal_vq,sizeof (coal_vq)); + +if (!virtnet_send_command (vi,VIRTIO_NET_CTRL_NOTF_COAL , +VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET , + &sgs)) +return -EINVAL ; + +return 0 ; +} + +static int virtnet_send_notf_coal_vq_cmds (struct virtnet_info *vi, +struct ethtool_coalesce *ec, +u16 queue) +{ +int err; + +if (ec->rx_coalesce_usecs || ec->rx_max_coalesced_frames) { + err =virtnet_send_ctrl_coal_vq_cmd (vi,rxq2vq (queue), + ec->rx_coalesce_usecs, + ec->rx_max_coalesced_frames); +if (err) +return err; +/* Save parameters */ + vi->rq[queue].intr_coal.max_usecs = ec->rx_coalesce_usecs; + vi->rq[queue].intr_coal.max_packets = ec->rx_max_coalesced_frames; + } + +if (ec->tx_coalesce_usecs || ec->tx_max_coalesced_frames) { + err =virtnet_send_ctrl_coal_vq_cmd (vi,txq2vq (queue), + ec->tx_coalesce_usecs, + ec->tx_max_coalesced_frames); +if (err) +return err; +/* Save parameters */ + vi->sq[queue].intr_coal.max_usecs = ec->tx_coalesce_usecs; + vi->sq[queue].intr_coal.max_packets = ec->tx_max_coalesced_frames; + } + +return 0 ; +} +static int virtnet_coal_params_supported (struct ethtool_coalesce *ec) {/* usecs coalescing is supported only if VIRTIO_NET_F_NOTF_COAL @@ -3094,23 +3148,36 @@ static int virtnet_coal_params_supported(struct ethtool_coalesce *ec) }static int virtnet_set_coalesce_one (struct net_device *dev, -struct ethtool_coalesce *ec) +struct ethtool_coalesce *ec, +bool per_queue, +u32 queue) {struct virtnet_info *vi =netdev_priv (dev); -int ret, i, napi_weight; +int queue_count = per_queue ?1 : vi->max_queue_pairs; +int queue_number = per_queue ? queue :0 ;bool update_napi = false; +int ret, i, napi_weight; + +if (queue >= vi->max_queue_pairs) +return -EINVAL ;/* Can't change NAPI weight if the link is up */ napi_weight = ec->tx_max_coalesced_frames ?NAPI_POLL_WEIGHT :0 ; -if (napi_weight ^ vi->sq[0 ].napi.weight) { -if (dev->flags &IFF_UP ) -return -EBUSY ; -else +for (i = queue_number; i < queue_count; i++) { +if (napi_weight ^ vi->sq[i].napi.weight) { +if (dev->flags &IFF_UP ) +return -EBUSY ; + update_napi = true; + queue_number = i; +break ; + } } -if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) +if (!per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) ret =virtnet_send_notf_coal_cmds (vi, ec); +else if (per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_VQ_NOTF_COAL )) + ret =virtnet_send_notf_coal_vq_cmds (vi, ec, queue);else ret =virtnet_coal_params_supported (ec);@@ -3118,7 +3185,7 @@ static int virtnet_set_coalesce_one(struct net_device *dev,return ret;if (update_napi) { -for (i =0 ; i < vi->max_queue_pairs; i++) +for (i = queue_number; i < queue_count; i++) vi->sq[i].napi.weight = napi_weight; }@@ -3130,19 +3197,29 @@ static int virtnet_set_coalesce(struct net_device *dev,struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { - return virtnet_set_coalesce_one(dev, ec); + return virtnet_set_coalesce_one(dev, ec, false, 0); }static int virtnet_get_coalesce_one (struct net_device *dev, -struct ethtool_coalesce *ec) +struct ethtool_coalesce *ec, +bool per_queue, +u32 queue) {struct virtnet_info *vi =netdev_priv (dev); -if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { +if (queue >= vi->max_queue_pairs) +return -EINVAL ; + +if (!per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_NOTF_COAL )) { ec->rx_coalesce_usecs = vi->intr_coal_rx.max_usecs; ec->tx_coalesce_usecs = vi->intr_coal_tx.max_usecs; ec->tx_max_coalesced_frames = vi->intr_coal_tx.max_packets; ec->rx_max_coalesced_frames = vi->intr_coal_rx.max_packets; + }else if (per_queue &&virtio_has_feature (vi->vdev,VIRTIO_NET_F_VQ_NOTF_COAL )) { + ec->rx_coalesce_usecs = vi->rq[queue].intr_coal.max_usecs; + ec->tx_coalesce_usecs = vi->sq[queue].intr_coal.max_usecs; + ec->tx_max_coalesced_frames = vi->sq[queue].intr_coal.max_packets; + ec->rx_max_coalesced_frames = vi->rq[queue].intr_coal.max_packets; }else { ec->rx_max_coalesced_frames =1 ;@@ -3158,7 +3235,21 @@ static int virtnet_get_coalesce(struct net_device *dev,struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { - return virtnet_get_coalesce_one(dev, ec); + return virtnet_get_coalesce_one(dev, ec, false, 0); +} + +static int virtnet_set_per_queue_coalesce (struct net_device *dev, +u32 queue, +struct ethtool_coalesce *ec) +{ +return virtnet_set_coalesce_one (dev, ec, true, queue); +} + +static int virtnet_get_per_queue_coalesce (struct net_device *dev, +u32 queue, +struct ethtool_coalesce *ec) +{ +return virtnet_get_coalesce_one (dev, ec, true, queue); }static void virtnet_init_settings (struct net_device *dev)@@ -3291,6 +3382,8 @@ static const struct ethtool_ops virtnet_ethtool_ops = { .set_link_ksettings = virtnet_set_link_ksettings, .set_coalesce = virtnet_set_coalesce, .get_coalesce = virtnet_get_coalesce, + .set_per_queue_coalesce = virtnet_set_per_queue_coalesce, + .get_per_queue_coalesce = virtnet_get_per_queue_coalesce, .get_rxfh_key_size = virtnet_get_rxfh_key_size, .get_rxfh_indir_size = virtnet_get_rxfh_indir_size, .get_rxfh = virtnet_get_rxfh,include/uapi/linux/virtio_net.h +14
-1@@ -56,6 +56,7 @@#define VIRTIO_NET_F_MQ 22/* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23/* Set MAC address */ +#define VIRTIO_NET_F_VQ_NOTF_COAL 52/* Device supports virtqueue notification coalescing */ #define VIRTIO_NET_F_NOTF_COAL 53/* Device supports notifications coalescing */ #define VIRTIO_NET_F_GUEST_USO4 54/* Guest can handle USOv4 in. */ #define VIRTIO_NET_F_GUEST_USO6 55/* Guest can handle USOv6 in. */ @@ -391,5 +392,18 @@ struct virtio_net_ctrl_coal_rx { };#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 2 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 3 + +struct virtio_net_ctrl_coal { +__le32 max_packets; +__le32 max_usecs; +}; + +struct virtio_net_ctrl_coal_vq { +__le16 vqn; +__le16 reserved; +struct virtio_net_ctrl_coal coal; +};#endif /* _UAPI_LINUX_VIRTIO_NET_H */ --2.39.1
Quoted 12 lines · Heng Qi
Quoted 7 lines · Gavin Li
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.
Quoted 8 lines
We definitely did the same thing, and I'm waiting for our hardware implementation to be ready to push the ethtool + netdim implementation.
Since this commit log is completely copied from the implementation of the virtio spec, consulting each other's scheduling plan in advance can be friendly to avoid us doing the same thing and consuming an extra effort.
Thanks.
I didn't know about the effort you made and the progress of it. Since the code has been done and tested, I'll continue submission.
Quoted 51 lines
Quoted 50 lines
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: 0rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0In 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 featuredrivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------
include/uapi/linux/virtio_net.h| 14 +++2 files changed, 154 insertions(+), 29 deletions(-)
Quoted 7 lines · Gavin Li
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.
series:
Quoted 45 lines
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: 0rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0In 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
Quoted 6 lines
drivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------ include/uapi/linux/virtio_net.h | 14 +++ 2 files changed, 154 insertions(+), 29 deletions(-)Signature · 1 line
2.39.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Xuan Zhuo
reviewerQuoted 5 lines · Michael S. Tsirkin
Quoted 4 lines · Gavin Li
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.
Quoted 7 lines
Quoted 3 lines
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.
series:
Why?
This series has the bug I reported.
Are you thinking that is ok? Or this is not a bug?
Thanks.
Quoted 55 lines
Quoted 54 lines
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: 0rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0In 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 featuredrivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------ include/uapi/linux/virtio_net.h | 14 +++ 2 files changed, 154 insertions(+), 29 deletions(-)--
2.39.1
Michael S. Tsirkin
maintainerQuoted 15 lines · Xuan Zhuo
Quoted 5 lines · Michael S. Tsirkin
Quoted 4 lines · Gavin Li
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.
Quoted 7 lines
Quoted 3 lines
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.
series:
Quoted 9 lines
Why?
This series has the bug I reported.
Are you thinking that is ok? Or this is not a bug?
Thanks.
I missed that mail. What's the bug?
Quoted 48 lines
Quoted 48 lines
Quoted 48 lines
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: 0rx-usecs: 222
rx-frames: 0
rx-usecs-irq: 0
rx-frames-irq: 256tx-usecs: 222
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 256rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0In 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
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/net/virtio_net.c | 169 ++++++++++++++++++++++++++------ include/uapi/linux/virtio_net.h | 14 +++ 2 files changed, 154 insertions(+), 29 deletions(-)--
2.39.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization