加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0179-dfx-fix-gazellectl-x-for-bond.patch 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2024-05-16 19:50 . sync dfx: fix gazellectl -x for bond
From 3c3f69c0ca77b3d05df27aeda2fb7daa9757f50c Mon Sep 17 00:00:00 2001
From: zhangmengxuan <zhangmengxuan@kylinos.cn>
Date: Mon, 13 May 2024 14:51:18 +0800
Subject: [PATCH] dfx: fix gazellectl -x for bond
---
src/common/gazelle_dfx_msg.h | 1 +
src/lstack/core/lstack_dpdk.c | 2 ++
src/ltran/ltran_dfx.c | 7 ++++---
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
index 17e1662..9f88203 100644
--- a/src/common/gazelle_dfx_msg.h
+++ b/src/common/gazelle_dfx_msg.h
@@ -296,6 +296,7 @@ struct bonding {
int32_t miimon;
uint16_t primary_port_id;
uint16_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t slave_count;
};
struct nic_eth_xstats {
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index ec35f9c..f1a22ea 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -905,6 +905,8 @@ void dpdk_nic_bond_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_
return;
}
+ dfx->data.nic_xstats.bonding.slave_count = count;
+
for (int i = 0; i < count; i++) {
dfx->data.nic_xstats.bonding.slaves[i] = slaves[i];
}
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index f4e55e3..aa08f25 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -207,11 +207,12 @@ static void gazelle_print_lstack_xstats(void *buf, const struct gazelle_stat_msg
printf("%s############################\n", nic_stats_border);
printf("Bonding mode: [%d]\n", xstats->bonding.mode);
printf("Bonding miimon: [%d]\n", xstats->bonding.miimon);
- printf("Slaves(%d): [", xstats->port_id);
- for (int i = 0; i < xstats->port_id - 1; i++) {
+ printf("Port range: 0->%d; Bonding port is %d\n", xstats->port_id, xstats->port_id);
+ printf("Slaves(%d): [", xstats->bonding.slave_count);
+ for (int i = 0; i < xstats->bonding.slave_count - 1; i++) {
printf("%d ", xstats->bonding.slaves[i]);
}
- printf("%d]\n", xstats->bonding.slaves[xstats->port_id - 1]);
+ printf("%d]\n", xstats->bonding.slaves[xstats->bonding.slave_count - 1]);
printf("Primary: [%d]\n", xstats->bonding.primary_port_id);
printf("%s############################\n", nic_stats_border);
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化