From 3c48ccc4fc485d97ac6b4276a9eec810f3507565 Mon Sep 17 00:00:00 2001 From: tangzhongrui Date: Sat, 9 Oct 2021 21:56:21 +0800 Subject: [PATCH] increase VIRTQUEUE_MAX_SIZE to reduce packet loss. Signed-off-by: Zhongrui Tang --- ...QUEUE_MAX_SIZE-to-reduce-packet-loss.patch | 47 +++++++++++++++++++ qemu.spec | 6 ++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 increase-VIRTQUEUE_MAX_SIZE-to-reduce-packet-loss.patch diff --git a/increase-VIRTQUEUE_MAX_SIZE-to-reduce-packet-loss.patch b/increase-VIRTQUEUE_MAX_SIZE-to-reduce-packet-loss.patch new file mode 100644 index 00000000..fba4b120 --- /dev/null +++ b/increase-VIRTQUEUE_MAX_SIZE-to-reduce-packet-loss.patch @@ -0,0 +1,47 @@ +From 2374c2adc981ba16c6016a1bf927a8963111ecff Mon Sep 17 00:00:00 2001 +From: tangzhongrui +Date: Sat, 5 Jun 2021 11:18:11 +0800 +Subject: [PATCH] increase VIRTQUEUE_MAX_SIZE to reduce packet loss + +Code Source From: Self Code +Description: + We can experience packet loss at high packet rates +above 3.5 million packets per second (mpps) for many reasons. + To prevent packet loss, increase the queue size from the default +maximum of 1024 to 4096. + +Signed-off-by: tangzhongrui +--- + contrib/libvhost-user/libvhost-user.h | 2 +- + include/hw/virtio/virtio.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/libvhost-user.h +index 46b60079..bf73b38c 100644 +--- a/contrib/libvhost-user/libvhost-user.h ++++ b/contrib/libvhost-user/libvhost-user.h +@@ -25,7 +25,7 @@ + #define VHOST_USER_F_PROTOCOL_FEATURES 30 + #define VHOST_LOG_PAGE 4096 + +-#define VIRTQUEUE_MAX_SIZE 1024 ++#define VIRTQUEUE_MAX_SIZE 4096 + + #define VHOST_MEMORY_MAX_NREGIONS 8 + +diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h +index f9f62370..78b8b63a 100644 +--- a/include/hw/virtio/virtio.h ++++ b/include/hw/virtio/virtio.h +@@ -54,7 +54,7 @@ size_t virtio_feature_get_config_size(VirtIOFeature *features, + + typedef struct VirtQueue VirtQueue; + +-#define VIRTQUEUE_MAX_SIZE 1024 ++#define VIRTQUEUE_MAX_SIZE 4096 + + typedef struct VirtQueueElement + { +-- +2.12.2 + diff --git a/qemu.spec b/qemu.spec index a473290a..c1a2867c 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 4.1.0 -Release: 59 +Release: 60 Epoch: 2 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -334,6 +334,7 @@ Patch0321: usbredir-fix-free-call.patch Patch0322: hw-arm-virt-Init-PMU-for-hotplugged-vCPU.patch Patch0323: uas-add-stream-number-sanity-checks.patch Patch0324: virtio-net-fix-use-after-unmap-free-for-sg.patch +Patch0325: increase-VIRTQUEUE_MAX_SIZE-to-reduce-packet-loss.patch BuildRequires: flex BuildRequires: bison @@ -731,6 +732,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Sat Oct 9 2021 Zhongrui Tang +- increase virtqueue max size + * Sun Sep 26 2021 Chen Qun - virtio-net: fix use after unmap/free for sg -- Gitee