59 lines
2.1 KiB
Diff
59 lines
2.1 KiB
Diff
|
|
From 58fe483bf5824db177843675629ed955051078fd Mon Sep 17 00:00:00 2001
|
||
|
|
From: Jinhua Cao <caojinhua1@huawei.com>
|
||
|
|
Date: Sat, 12 Feb 2022 17:22:38 +0800
|
||
|
|
Subject: [PATCH] virtio-net: set the max of queue size to 4096
|
||
|
|
|
||
|
|
set the max of virtio-net queue size to 4096. Now the
|
||
|
|
queue_size of virtio-net is set by rx_queue_size and
|
||
|
|
tx_queue_size
|
||
|
|
|
||
|
|
Signed-off-by: Jinhua Cao <caojinhua1@huawei.com>
|
||
|
|
---
|
||
|
|
hw/net/virtio-net.c | 5 +++--
|
||
|
|
hw/virtio/virtio.c | 2 +-
|
||
|
|
2 files changed, 4 insertions(+), 3 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
|
||
|
|
index 7f69a4b842..0ae2ddc002 100644
|
||
|
|
--- a/hw/net/virtio-net.c
|
||
|
|
+++ b/hw/net/virtio-net.c
|
||
|
|
@@ -710,6 +710,7 @@ static int virtio_net_max_tx_queue_size(VirtIONet *n)
|
||
|
|
|
||
|
|
switch(peer->info->type) {
|
||
|
|
case NET_CLIENT_DRIVER_VHOST_USER:
|
||
|
|
+ return VIRTIO_NET_VQ_MAX_SIZE;
|
||
|
|
case NET_CLIENT_DRIVER_VHOST_VDPA:
|
||
|
|
return VIRTQUEUE_MAX_SIZE;
|
||
|
|
default:
|
||
|
|
@@ -3638,12 +3639,12 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
|
||
|
|
* help from us (using virtio 1 and up).
|
||
|
|
*/
|
||
|
|
if (n->net_conf.rx_queue_size < VIRTIO_NET_RX_QUEUE_MIN_SIZE ||
|
||
|
|
- n->net_conf.rx_queue_size > VIRTQUEUE_MAX_SIZE ||
|
||
|
|
+ n->net_conf.rx_queue_size > VIRTIO_NET_VQ_MAX_SIZE ||
|
||
|
|
!is_power_of_2(n->net_conf.rx_queue_size)) {
|
||
|
|
error_setg(errp, "Invalid rx_queue_size (= %" PRIu16 "), "
|
||
|
|
"must be a power of 2 between %d and %d.",
|
||
|
|
n->net_conf.rx_queue_size, VIRTIO_NET_RX_QUEUE_MIN_SIZE,
|
||
|
|
- VIRTQUEUE_MAX_SIZE);
|
||
|
|
+ VIRTIO_NET_VQ_MAX_SIZE);
|
||
|
|
virtio_cleanup(vdev);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
||
|
|
index 267c1e6fd0..d00effe4d5 100644
|
||
|
|
--- a/hw/virtio/virtio.c
|
||
|
|
+++ b/hw/virtio/virtio.c
|
||
|
|
@@ -2338,7 +2338,7 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
- if (i == VIRTIO_QUEUE_MAX || queue_size > VIRTQUEUE_MAX_SIZE) {
|
||
|
|
+ if (i == VIRTIO_QUEUE_MAX) {
|
||
|
|
qemu_log("unacceptable queue_size (%d) or num (%d)\n",
|
||
|
|
queue_size, i);
|
||
|
|
abort();
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|