From 0613a7275ed2ed0aefc2f8419adeaadd8fd87de9 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Sat, 29 Jun 2024 17:35:37 +0800
Subject: [PATCH] virtio: mode actual_queue_num

---
 src/lstack/core/lstack_virtio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lstack/core/lstack_virtio.c b/src/lstack/core/lstack_virtio.c
index ad3088d..bc42bb9 100644
--- a/src/lstack/core/lstack_virtio.c
+++ b/src/lstack/core/lstack_virtio.c
@@ -298,9 +298,11 @@ int virtio_port_create(int lstack_net_port)
         return retval;
     }
 
+    uint16_t actual_queue_num = (g_virtio_instance.rx_queue_num < g_virtio_instance.tx_queue_num) ?
+                g_virtio_instance.rx_queue_num : g_virtio_instance.tx_queue_num;
     retval = snprintf(portargs, sizeof(portargs),
                       "path=/dev/vhost-net,queues=%u,queue_size=%u,iface=%s,mac=" RTE_ETHER_ADDR_PRT_FMT,
-                      VIRTIO_MAX_QUEUE_NUM, VIRTIO_TX_RX_RING_SIZE, VIRTIO_USER_NAME, RTE_ETHER_ADDR_BYTES(&addr));
+                      actual_queue_num, VIRTIO_TX_RX_RING_SIZE, VIRTIO_USER_NAME, RTE_ETHER_ADDR_BYTES(&addr));
     if (retval < 0) {
         LSTACK_LOG(ERR, LSTACK, "virtio portargs snprintf failed ret=%d \n", retval);
         return retval;
-- 
2.33.0

