69 lines
2.8 KiB
Diff
69 lines
2.8 KiB
Diff
From dcfd85d26a09a516a924350fa6404ec4237c2514 Mon Sep 17 00:00:00 2001
|
|
From: jiangheng12 <jiangheng14@huawei.com>
|
|
Date: Fri, 31 Mar 2023 16:05:46 +0800
|
|
Subject: [PATCH] fix gazellectl -x error when multiplt user nic config
|
|
|
|
---
|
|
src/lstack/core/lstack_dpdk.c | 3 ++-
|
|
src/lstack/core/lstack_stack_stat.c | 2 +-
|
|
src/lstack/include/lstack_dpdk.h | 2 +-
|
|
src/ltran/ltran_dfx.c | 2 +-
|
|
4 files changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
|
index ebfebaa..e386dfc 100644
|
|
--- a/src/lstack/core/lstack_dpdk.c
|
|
+++ b/src/lstack/core/lstack_dpdk.c
|
|
@@ -298,7 +298,8 @@ void lstack_log_level_init(void)
|
|
}
|
|
|
|
// get port id
|
|
-inline uint16_t get_port_id(){
|
|
+inline uint16_t get_port_id(void)
|
|
+{
|
|
uint16_t port_id = get_global_cfg_params()->port_id;
|
|
return port_id;
|
|
}
|
|
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
|
|
index eed7fbf..d1c749a 100644
|
|
--- a/src/lstack/core/lstack_stack_stat.c
|
|
+++ b/src/lstack/core/lstack_stack_stat.c
|
|
@@ -260,7 +260,7 @@ int32_t handle_stack_cmd(int32_t fd, enum GAZELLE_STAT_MODE stat_mode)
|
|
struct protocol_stack_group *stack_group = get_protocol_stack_group();
|
|
|
|
if (stat_mode == GAZELLE_STAT_LSTACK_SHOW_XSTATS) {
|
|
- dpdk_nic_xstats_get(&dfx, 0);
|
|
+ dpdk_nic_xstats_get(&dfx, get_port_id());
|
|
dfx.tid = 0;
|
|
dfx.eof = 1;
|
|
send_control_cmd_data(fd, &dfx);
|
|
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
|
|
index 7c222ca..a896903 100644
|
|
--- a/src/lstack/include/lstack_dpdk.h
|
|
+++ b/src/lstack/include/lstack_dpdk.h
|
|
@@ -52,7 +52,7 @@ void dpdk_skip_nic_init(void);
|
|
int32_t dpdk_init_lstack_kni(void);
|
|
void dpdk_restore_pci(void);
|
|
bool port_in_stack_queue(uint32_t src_ip, uint32_t dst_ip, uint16_t src_port, uint16_t dst_port);
|
|
-uint16_t get_port_id();
|
|
+uint16_t get_port_id(void);
|
|
struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,uint32_t mbuf_cache_size, uint16_t queue_id);
|
|
|
|
void dpdk_nic_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id);
|
|
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
|
index 9180e89..761bbb7 100644
|
|
--- a/src/ltran/ltran_dfx.c
|
|
+++ b/src/ltran/ltran_dfx.c
|
|
@@ -137,7 +137,7 @@ static void gazelle_print_lstack_xstats(void *buf, const struct gazelle_stat_msg
|
|
struct nic_eth_xstats *xstats = &stat->data.nic_xstats;
|
|
static const char *nic_stats_border = "########################";
|
|
|
|
- printf("###### NIC extended statistics for port %-2d #########\n", 0);
|
|
+ printf("###### NIC extended statistics for port %-2d #########\n", xstats->port_id);
|
|
printf("%s############################\n",nic_stats_border);
|
|
if (xstats->len <= 0 || xstats->len > RTE_ETH_XSTATS_MAX_LEN) {
|
|
printf("xstats item(%d) num error!\n", xstats->len);
|
|
--
|
|
2.33.0
|
|
|