1 Star 0 Fork 121

liksh/qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
virtio-net-set-the-max-of-queue-size-to-4096.patch 2.10 KB
一键复制 编辑 原始数据 按行查看 历史
Jiabo Feng 提交于 2024-04-07 10:21 . QEMU update to version 8.2.0-5
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liksh/qemu.git
git@gitee.com:liksh/qemu.git
liksh
qemu
qemu
master

搜索帮助