Re: [PATCH v5 20/22] virtio_net: set the default max ring num
From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Date: 2022-02-16 07:53:20
Also in:
bpf, virtualization
On Wed, 16 Feb 2022 12:14:31 +0800, Jason Wang [off-list ref] wrote:
On Mon, Feb 14, 2022 at 4:14 PM Xuan Zhuo [off-list ref] wrote:quoted
Sets the default maximum ring num based on virtio_set_max_ring_num(). The default maximum ring num is 1024.Having a default value is pretty useful, I see 32K is used by default for IFCVF. Rethink this, how about having a different default value based on the speed? Without SPEED_DUPLEX, we use 1024. Otherwise 10g 4096 40g 8192
We can define different default values of tx and rx by the way. This way I can just use it in the new interface of find_vqs(). without SPEED_DUPLEX: tx 512 rx 1024 Thanks.
etc. (The number are just copied from the 10g/40g default parameter from other vendors) Thanksquoted
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> --- drivers/net/virtio_net.c | 4 ++++ 1 file changed, 4 insertions(+)diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a4ffd7cdf623..77e61fe0b2ce 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c@@ -35,6 +35,8 @@ module_param(napi_tx, bool, 0644); #define GOOD_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN) #define GOOD_COPY_LEN 128 +#define VIRTNET_DEFAULT_MAX_RING_NUM 1024 + #define VIRTNET_RX_PAD (NET_IP_ALIGN + NET_SKB_PAD) /* Amount of XDP headroom to prepend to packets for use by xdp_adjust_head */@@ -3045,6 +3047,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi) ctx[rxq2vq(i)] = true; } + virtio_set_max_ring_num(vi->vdev, VIRTNET_DEFAULT_MAX_RING_NUM); + ret = virtio_find_vqs_ctx(vi->vdev, total_vqs, vqs, callbacks, names, ctx, NULL); if (ret) --2.31.0