[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1737014207.587077-2-xuanzhuo@linux.alibaba.com>
Date: Thu, 16 Jan 2025 15:56:47 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: Joe Damato <jdamato@...tly.com>
Cc: gerhard@...leder-embedded.com,
jasowang@...hat.com,
leiyang@...hat.com,
mkarsten@...terloo.ca,
Joe Damato <jdamato@...tly.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Eugenio PĂ©rez <eperezma@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
virtualization@...ts.linux.dev (open list:VIRTIO CORE AND NET DRIVERS),
linux-kernel@...r.kernel.org (open list),
netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 4/4] virtio_net: Use persistent NAPI config
On Thu, 16 Jan 2025 05:52:59 +0000, Joe Damato <jdamato@...tly.com> wrote:
> Use persistent NAPI config so that NAPI IDs are not renumbered as queue
> counts change.
>
> $ sudo ethtool -l ens4 | tail -5 | egrep -i '(current|combined)'
> Current hardware settings:
> Combined: 4
>
> $ ./tools/net/ynl/pyynl/cli.py \
> --spec Documentation/netlink/specs/netdev.yaml \
> --dump queue-get --json='{"ifindex": 2}'
> [{'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'rx'},
> {'id': 1, 'ifindex': 2, 'napi-id': 8194, 'type': 'rx'},
> {'id': 2, 'ifindex': 2, 'napi-id': 8195, 'type': 'rx'},
> {'id': 3, 'ifindex': 2, 'napi-id': 8196, 'type': 'rx'},
> {'id': 0, 'ifindex': 2, 'type': 'tx'},
> {'id': 1, 'ifindex': 2, 'type': 'tx'},
> {'id': 2, 'ifindex': 2, 'type': 'tx'},
> {'id': 3, 'ifindex': 2, 'type': 'tx'}]
>
> Now adjust the queue count, note that the NAPI IDs are not renumbered:
>
> $ sudo ethtool -L ens4 combined 1
> $ ./tools/net/ynl/pyynl/cli.py \
> --spec Documentation/netlink/specs/netdev.yaml \
> --dump queue-get --json='{"ifindex": 2}'
> [{'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'rx'},
> {'id': 0, 'ifindex': 2, 'type': 'tx'}]
>
> $ sudo ethtool -L ens4 combined 8
> $ ./tools/net/ynl/pyynl/cli.py \
> --spec Documentation/netlink/specs/netdev.yaml \
> --dump queue-get --json='{"ifindex": 2}'
> [{'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'rx'},
> {'id': 1, 'ifindex': 2, 'napi-id': 8194, 'type': 'rx'},
> {'id': 2, 'ifindex': 2, 'napi-id': 8195, 'type': 'rx'},
> {'id': 3, 'ifindex': 2, 'napi-id': 8196, 'type': 'rx'},
> {'id': 4, 'ifindex': 2, 'napi-id': 8197, 'type': 'rx'},
> {'id': 5, 'ifindex': 2, 'napi-id': 8198, 'type': 'rx'},
> {'id': 6, 'ifindex': 2, 'napi-id': 8199, 'type': 'rx'},
> {'id': 7, 'ifindex': 2, 'napi-id': 8200, 'type': 'rx'},
> [...]
>
> Signed-off-by: Joe Damato <jdamato@...tly.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> ---
> v2:
> - New in this v2. Adds persistent NAPI config so that NAPI IDs are
> not renumbered and napi_config settings are persisted.
>
> drivers/net/virtio_net.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index c6fda756dd07..52094596e94b 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -6420,8 +6420,9 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
> INIT_DELAYED_WORK(&vi->refill, refill_work);
> for (i = 0; i < vi->max_queue_pairs; i++) {
> vi->rq[i].pages = NULL;
> - netif_napi_add_weight(vi->dev, &vi->rq[i].napi, virtnet_poll,
> - napi_weight);
> + netif_napi_add_config(vi->dev, &vi->rq[i].napi, virtnet_poll,
> + i);
> + vi->rq[i].napi.weight = napi_weight;
> netif_napi_add_tx_weight(vi->dev, &vi->sq[i].napi,
> virtnet_poll_tx,
> napi_tx ? napi_weight : 0);
> --
> 2.25.1
>
Powered by blists - more mailing lists