60 lines
2.3 KiB
Diff
60 lines
2.3 KiB
Diff
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
|
||
|