computing-offload/generic_vdpa/qemu/virtio-net-set-the-max-of-queue-size-to-4096.patch
jiangdongxu 79c4324644 add generic_vdpa basecode
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
2024-09-19 17:19:46 +08:00

69 lines
2.5 KiB
Diff

From 7beaecc21a8a573d43c7ad7604ac77cdf5bbf405 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
Signed-off-by: Jinhua Cao <caojinhua1@huawei.com>
---
hw/net/virtio-net.c | 10 +++++-----
hw/virtio/virtio.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 6874c88bc0..009dc9f3d1 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -637,7 +637,7 @@ static int virtio_net_max_tx_queue_size(VirtIONet *n)
return VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE;
}
- return VIRTQUEUE_MAX_SIZE;
+ return VIRTIO_NET_VQ_MAX_SIZE;
}
static int peer_attach(VirtIONet *n, int index)
@@ -3394,23 +3394,23 @@ 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;
}
if (n->net_conf.tx_queue_size < VIRTIO_NET_TX_QUEUE_MIN_SIZE ||
- n->net_conf.tx_queue_size > VIRTQUEUE_MAX_SIZE ||
+ n->net_conf.tx_queue_size > VIRTIO_NET_VQ_MAX_SIZE ||
!is_power_of_2(n->net_conf.tx_queue_size)) {
error_setg(errp, "Invalid tx_queue_size (= %" PRIu16 "), "
"must be a power of 2 between %d and %d",
n->net_conf.tx_queue_size, VIRTIO_NET_TX_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 b08fff9419..120672672e 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2401,7 +2401,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