1 Star 0 Fork 32

hantwofish/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0228-vitio_user-modify-mbuf-index-for-bond4.patch 2.73 KB
一键复制 编辑 原始数据 按行查看 历史
From 0f841d29ed2f17f54bc4c13ef01f364ef4c633ac Mon Sep 17 00:00:00 2001
From: hkk <hankangkang5@huawei.com>
Date: Sat, 20 Jul 2024 16:52:52 +0800
Subject: [PATCH] vitio_user: modify mbuf index for bond4
---
src/lstack/core/lstack_virtio.c | 6 ++++--
src/ltran/ltran_dfx.c | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/lstack/core/lstack_virtio.c b/src/lstack/core/lstack_virtio.c
index 36159c9..f907a99 100644
--- a/src/lstack/core/lstack_virtio.c
+++ b/src/lstack/core/lstack_virtio.c
@@ -205,6 +205,7 @@ static int virtio_port_init(uint16_t port)
int retval;
uint16_t rx_queue_num = g_virtio_instance.rx_queue_num;
uint16_t tx_queue_num = g_virtio_instance.tx_queue_num;
+ int mbuf_total_num = get_global_cfg_params()->num_cpu * get_global_cfg_params()->num_process;
LSTACK_LOG(INFO, LSTACK, "virtio_port_init port= %u rx_queue_num=%u tx_queue_num=%u \n",
port, rx_queue_num, tx_queue_num);
@@ -226,7 +227,8 @@ static int virtio_port_init(uint16_t port)
}
for (uint16_t q = 0; q < tx_queue_num; q++) {
- retval = rte_eth_tx_queue_setup(port, q, VIRTIO_TX_RX_RING_SIZE, rte_eth_dev_socket_id(port), NULL);
+ retval = rte_eth_tx_queue_setup(port, q % mbuf_total_num, VIRTIO_TX_RX_RING_SIZE,
+ rte_eth_dev_socket_id(port), NULL);
if (retval < 0) {
LSTACK_LOG(ERR, LSTACK, "rte_eth_tx_queue_setup failed (queue %u) retval=%d \n", q, retval);
return retval;
@@ -341,4 +343,4 @@ bool virtio_distribute_pkg_to_kernel(uint16_t dst_port)
}
return (port_map_get(dst_port) == 0);
-}
\ No newline at end of file
+}
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 005b09c..1bf5451 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -1177,11 +1177,11 @@ static void gazelle_print_lstack_stat_virtio(void *buf, const struct gazelle_sta
struct gazelle_stat_lstack_virtio *virtio = &stat->data.virtio;
printf("\nStatistics of lstack virtio:\n");
- printf("\nlstack_port_id =%u virtio_port_id =%u rx_queue_num =%u tx_queue_num =%u \n",
+ printf("\nlstack_port_id: %u virtio_port_id: %u rx_queue_num: %u tx_queue_num: %u \n",
virtio->lstack_port_id, virtio->virtio_port_id, virtio->rx_queue_num,
virtio->tx_queue_num);
- printf("\n%-8s %-8s %-8s %-8s %-8s\n", "queue_id", "rx_pkg", "rx_drop", "tx_pkg", "tx_drop");
+ printf("\n%-8s %-8s %-8s %-8s %-8s\n", "queue_id", "rx_pkg", "rx_drop", "tx_pkg", "tx_drop");
for (int i = 0; i < virtio->rx_queue_num; i++) {
printf("%-8d %-8lu %-8lu %-8lu %-8lu\n", i,
virtio->rx_pkg[i], virtio->rx_drop[i], virtio->tx_pkg[i], virtio->tx_drop[i]);
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hantwofish/gazelle_1.git
git@gitee.com:hantwofish/gazelle_1.git
hantwofish
gazelle_1
gazelle_1
master

搜索帮助