!745 [sync] PR-742: sync patch from openEuler/gazelle
From: @openeuler-sync-bot Reviewed-by: @jiangheng12 Signed-off-by: @jiangheng12
This commit is contained in:
commit
58487cef2e
120
0164-dfx-support-get-nic-bond-status.patch
Normal file
120
0164-dfx-support-get-nic-bond-status.patch
Normal file
@ -0,0 +1,120 @@
|
||||
From 819f74f014592b8af93eb45fd13681caa2cb662a Mon Sep 17 00:00:00 2001
|
||||
From: zhangmengxuan <zhangmengxuan@kylinos.cn>
|
||||
Date: Thu, 28 Mar 2024 21:24:05 +0800
|
||||
Subject: [PATCH] dfx: support get nic bond status
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 9 +++++++++
|
||||
src/lstack/core/lstack_dpdk.c | 27 +++++++++++++++++++++++++++
|
||||
src/ltran/ltran_dfx.c | 14 ++++++++++++++
|
||||
3 files changed, 50 insertions(+)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index d7ba80f..4929ae7 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -256,15 +256,24 @@ struct gazelle_stat_low_power_info {
|
||||
|
||||
#define RTE_ETH_XSTATS_NAME_SIZE 64
|
||||
#define RTE_ETH_XSTATS_MAX_LEN 256
|
||||
+#define RTE_MAX_ETHPORTS 32
|
||||
struct nic_eth_xstats_name {
|
||||
char name[RTE_ETH_XSTATS_NAME_SIZE];
|
||||
};
|
||||
|
||||
+struct bonding {
|
||||
+ int8_t mode;
|
||||
+ int32_t miimon;
|
||||
+ uint16_t primary_port_id;
|
||||
+ uint16_t slaves[RTE_MAX_ETHPORTS];
|
||||
+};
|
||||
+
|
||||
struct nic_eth_xstats {
|
||||
struct nic_eth_xstats_name xstats_name[RTE_ETH_XSTATS_MAX_LEN];
|
||||
uint64_t values[RTE_ETH_XSTATS_MAX_LEN];
|
||||
uint32_t len;
|
||||
uint16_t port_id;
|
||||
+ struct bonding bonding;
|
||||
};
|
||||
|
||||
struct nic_eth_features {
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index a774d45..cd87026 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -870,6 +870,31 @@ static int dpdk_nic_xstats_name_get(struct nic_eth_xstats_name *names, uint16_t
|
||||
return len;
|
||||
}
|
||||
|
||||
+void dpdk_nic_bond_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id, uint16_t *slaves, int count)
|
||||
+{
|
||||
+ dfx->data.nic_xstats.bonding.mode = rte_eth_bond_mode_get(port_id);
|
||||
+ if (dfx->data.nic_xstats.bonding.mode < 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rte_eth_bond_mode_get failed.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ dfx->data.nic_xstats.bonding.primary_port_id = rte_eth_bond_primary_get(port_id);
|
||||
+ if (dfx->data.nic_xstats.bonding.primary_port_id < 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rte_eth_bond_primary_get failed.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ dfx->data.nic_xstats.bonding.miimon = rte_eth_bond_link_monitoring_get(port_id);
|
||||
+ if (dfx->data.nic_xstats.bonding.miimon <= 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rte_eth_bond_link_monitoring_get failed.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < count; i++) {
|
||||
+ dfx->data.nic_xstats.bonding.slaves[i] = slaves[i];
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void dpdk_nic_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id)
|
||||
{
|
||||
struct rte_eth_dev_info dev_info;
|
||||
@@ -878,6 +903,7 @@ void dpdk_nic_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id)
|
||||
|
||||
dfx->data.nic_xstats.len = -1;
|
||||
dfx->data.nic_xstats.port_id = port_id;
|
||||
+ dfx->data.nic_xstats.bonding.mode = -1;
|
||||
ret = rte_eth_dev_info_get(port_id, &dev_info);
|
||||
if (ret < 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "rte_eth_dev_info_get failed.\n");
|
||||
@@ -904,6 +930,7 @@ void dpdk_nic_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id)
|
||||
if (dpdk_nic_xstats_value_get(dfx->data.nic_xstats.values, len, slaves, slave_count) != 0) {
|
||||
return;
|
||||
}
|
||||
+ dpdk_nic_bond_xstats_get(dfx, port_id, slaves, slave_count);
|
||||
} else {
|
||||
len = dpdk_nic_xstats_name_get(dfx->data.nic_xstats.xstats_name, port_id);
|
||||
if (len <= 0) {
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index 073dfa7..88d11bd 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -200,6 +200,20 @@ 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 = "########################";
|
||||
|
||||
+ if (xstats->bonding.mode >= 0) {
|
||||
+ printf("############# NIC bonding mode display #############\n");
|
||||
+ 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("%d ", xstats->bonding.slaves[i]);
|
||||
+ }
|
||||
+ printf("%d]\n", xstats->bonding.slaves[xstats->port_id - 1]);
|
||||
+ printf("Primary: [%d]\n", xstats->bonding.primary_port_id);
|
||||
+ printf("%s############################\n", nic_stats_border);
|
||||
+ }
|
||||
+
|
||||
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) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
54
0165-remove-dpdk_skip_nic_init-for-dpdk-23.11.patch
Normal file
54
0165-remove-dpdk_skip_nic_init-for-dpdk-23.11.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From aae704235da3299fb2d6920aef46afd560ab2c01 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Tue, 9 Apr 2024 17:50:46 +0800
|
||||
Subject: [PATCH] remove dpdk_skip_nic_init for dpdk-23.11
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_init.c | 4 ++++
|
||||
src/lstack/include/lstack_dpdk.h | 4 +++-
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_init.c b/src/lstack/core/lstack_init.c
|
||||
index f1ef134..79b4060 100644
|
||||
--- a/src/lstack/core/lstack_init.c
|
||||
+++ b/src/lstack/core/lstack_init.c
|
||||
@@ -144,7 +144,9 @@ static void create_control_thread(void)
|
||||
pthread_t tid;
|
||||
if (use_ltran()) {
|
||||
/* The function call here should be in strict order. */
|
||||
+#if RTE_VERSION < RTE_VERSION_NUM(23, 11, 0, 0)
|
||||
dpdk_skip_nic_init();
|
||||
+#endif
|
||||
if (control_init_client(false) != 0) {
|
||||
LSTACK_EXIT(1, "control_init_client failed\n");
|
||||
}
|
||||
@@ -279,7 +281,9 @@ __attribute__((constructor)) void gazelle_network_init(void)
|
||||
|
||||
/* Init control plane and dpdk init */
|
||||
create_control_thread();
|
||||
+#if RTE_VERSION < RTE_VERSION_NUM(23, 11, 0, 0)
|
||||
dpdk_restore_pci();
|
||||
+#endif
|
||||
|
||||
/* cancel the core binding from DPDK initialization */
|
||||
if (!get_global_cfg_params()->main_thread_affinity) {
|
||||
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
|
||||
index c7cfbdf..fe3d07b 100644
|
||||
--- a/src/lstack/include/lstack_dpdk.h
|
||||
+++ b/src/lstack/include/lstack_dpdk.h
|
||||
@@ -48,9 +48,11 @@ int32_t create_shared_ring(struct protocol_stack *stack);
|
||||
void lstack_log_level_init(void);
|
||||
int dpdk_ethdev_init(int port_id, bool bond_port);
|
||||
int dpdk_ethdev_start(void);
|
||||
+#if RTE_VERSION < RTE_VERSION_NUM(23, 11, 0, 0)
|
||||
void dpdk_skip_nic_init(void);
|
||||
-int32_t dpdk_init_lstack_kni(void);
|
||||
void dpdk_restore_pci(void);
|
||||
+#endif
|
||||
+int32_t dpdk_init_lstack_kni(void);
|
||||
bool port_in_stack_queue(gz_addr_t *src_ip, gz_addr_t *dst_ip, uint16_t src_port, uint16_t dst_port);
|
||||
struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,
|
||||
uint32_t mbuf_cache_size, uint16_t queue_id, unsigned numa_id);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
317
0166-gazellectl-add-lwip-stats_proto-print.patch
Normal file
317
0166-gazellectl-add-lwip-stats_proto-print.patch
Normal file
@ -0,0 +1,317 @@
|
||||
From 3beb273528f360c7d6863990a5d0cdcb5ebcb407 Mon Sep 17 00:00:00 2001
|
||||
From: ningjin <ningjin@kylinos.cn>
|
||||
Date: Thu, 28 Mar 2024 16:05:01 +0800
|
||||
Subject: [PATCH] gazellectl add lwip stats_proto print
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 23 ++++++++++
|
||||
src/lstack/core/lstack_control_plane.c | 2 +-
|
||||
src/lstack/core/lstack_stack_stat.c | 41 +++++++++++++++--
|
||||
src/lstack/include/lstack_stack_stat.h | 3 +-
|
||||
src/ltran/ltran_dfx.c | 61 +++++++++++++++++++++++++-
|
||||
src/ltran/ltran_monitor.c | 1 +
|
||||
6 files changed, 124 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index d7ba80f..6cd90b1 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#define GAZELLE_CLIENT_NUM_MIN 1
|
||||
#define GAZELLE_LOG_LEVEL_MAX 10
|
||||
+#define MAX_PROTOCOL_LENGTH 20
|
||||
#define GAZELLECTL_TIMEOUT 5000 // millisecond
|
||||
/* maybe it should be consistent with MEMP_NUM_TCP_PCB */
|
||||
#define GAZELLE_LSTACK_MAX_CONN (20000 + 2000) // same as MAX_CLIENTS + RESERVED_CLIENTS in lwipopts.h
|
||||
@@ -46,6 +47,7 @@ enum GAZELLE_STAT_MODE {
|
||||
GAZELLE_STAT_LTRAN_SHOW_SOCKTABLE,
|
||||
GAZELLE_STAT_LTRAN_SHOW_CONNTABLE,
|
||||
GAZELLE_STAT_LTRAN_SHOW_LSTACK,
|
||||
+ GAZELLE_STAT_LSTACK_SHOW_PROTOCOL,
|
||||
|
||||
GAZELLE_STAT_LSTACK_SHOW,
|
||||
GAZELLE_STAT_LSTACK_LOG_LEVEL_SET,
|
||||
@@ -193,6 +195,24 @@ struct gazelle_stat_lstack_snmp {
|
||||
uint32_t icmp_out_echo_reps;
|
||||
};
|
||||
|
||||
+/* same as define in lwip/stats.h - struct stats_proto */
|
||||
+struct gazelle_stat_lstack_proto {
|
||||
+ /* data */
|
||||
+ uint16_t xmit; /* Transmitted packets. */
|
||||
+ uint16_t recv; /* Received packets. */
|
||||
+ uint16_t fw; /* Forwarded packets. */
|
||||
+ uint16_t drop; /* Dropped packets. */
|
||||
+ uint16_t chkerr; /* Checksum error. */
|
||||
+ uint16_t lenerr; /* Invalid length error. */
|
||||
+ uint16_t memerr; /* Out of memory error. */
|
||||
+ uint16_t rterr; /* Routing error. */
|
||||
+ uint16_t proterr; /* Protocol error. */
|
||||
+ uint16_t opterr; /* Error in options. */
|
||||
+ uint16_t err; /* Misc error. */
|
||||
+ uint16_t cachehit;
|
||||
+};
|
||||
+
|
||||
+
|
||||
/* same as define in lwip/tcp.h - struct tcp_pcb_dp */
|
||||
struct gazelle_stat_lstack_conn_info {
|
||||
uint32_t state;
|
||||
@@ -288,6 +308,8 @@ struct gazelle_stack_dfx_data {
|
||||
struct gazelle_stat_lstack_snmp snmp;
|
||||
struct nic_eth_xstats nic_xstats;
|
||||
struct nic_eth_features nic_features;
|
||||
+ struct gazelle_stat_lstack_proto proto_data;
|
||||
+
|
||||
#ifdef GAZELLE_FAULT_INJECT_ENABLE
|
||||
struct gazelle_fault_inject_data inject;
|
||||
#endif /* GAZELLE_FAULT_INJECT_ENABLE */
|
||||
@@ -321,6 +343,7 @@ struct gazelle_stat_msg_request {
|
||||
union stat_param {
|
||||
char log_level[GAZELLE_LOG_LEVEL_MAX];
|
||||
uint16_t low_power_mod;
|
||||
+ char protocol[MAX_PROTOCOL_LENGTH];
|
||||
#ifdef GAZELLE_FAULT_INJECT_ENABLE
|
||||
struct gazelle_fault_inject_data inject;
|
||||
#endif /* GAZELLE_FAULT_INJECT_ENABLE */
|
||||
diff --git a/src/lstack/core/lstack_control_plane.c b/src/lstack/core/lstack_control_plane.c
|
||||
index 9f0c313..04858c7 100644
|
||||
--- a/src/lstack/core/lstack_control_plane.c
|
||||
+++ b/src/lstack/core/lstack_control_plane.c
|
||||
@@ -601,7 +601,7 @@ static int32_t handle_stat_request(int32_t sockfd)
|
||||
msg.stat_mode == GAZELLE_STAT_LSTACK_SHOW_NIC_FEATURES) {
|
||||
return handle_dpdk_cmd(sockfd, msg.stat_mode);
|
||||
} else {
|
||||
- ret = handle_stack_cmd(sockfd, msg.stat_mode);
|
||||
+ ret = handle_stack_cmd(sockfd, &msg);
|
||||
if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "get_stats failed ret=%d\n", ret);
|
||||
}
|
||||
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
|
||||
index 3e016b7..d439357 100644
|
||||
--- a/src/lstack/core/lstack_stack_stat.c
|
||||
+++ b/src/lstack/core/lstack_stack_stat.c
|
||||
@@ -210,11 +210,42 @@ static void get_stack_stats(struct gazelle_stack_dfx_data *dfx, struct protocol_
|
||||
dfx->data.pkts.conn_num = stack->conn_num;
|
||||
}
|
||||
|
||||
+static void get_stack_dfx_data_proto(struct gazelle_stack_dfx_data *dfx, struct protocol_stack *stack,
|
||||
+ struct gazelle_stat_msg_request *msg)
|
||||
+{
|
||||
+ int32_t ret = 0;
|
||||
+ msg->data.protocol[MAX_PROTOCOL_LENGTH - 1] = '\0';
|
||||
+ const char* proto_mode = msg->data.protocol;
|
||||
+
|
||||
+ if (strcmp(proto_mode, "UDP") == 0) {
|
||||
+ ret = memcpy_s(&dfx->data.proto_data, sizeof(dfx->data.proto_data),
|
||||
+ &stack->lwip_stats->udp, sizeof(stack->lwip_stats->udp));
|
||||
+ } else if (strcmp(proto_mode, "TCP") == 0) {
|
||||
+ ret = memcpy_s(&dfx->data.proto_data, sizeof(dfx->data.proto_data),
|
||||
+ &stack->lwip_stats->tcp, sizeof(stack->lwip_stats->tcp));
|
||||
+ } else if (strcmp(proto_mode, "IP") == 0) {
|
||||
+ ret = memcpy_s(&dfx->data.proto_data, sizeof(dfx->data.proto_data),
|
||||
+ &stack->lwip_stats->ip, sizeof(stack->lwip_stats->ip));
|
||||
+ } else if (strcmp(proto_mode, "ICMP") == 0) {
|
||||
+ ret = memcpy_s(&dfx->data.proto_data, sizeof(dfx->data.proto_data),
|
||||
+ &stack->lwip_stats->icmp, sizeof(stack->lwip_stats->icmp));
|
||||
+ } else if (strcmp(proto_mode, "ETHARP") == 0) {
|
||||
+ ret = memcpy_s(&dfx->data.proto_data, sizeof(dfx->data.proto_data),
|
||||
+ &stack->lwip_stats->etharp, sizeof(stack->lwip_stats->etharp));
|
||||
+ } else {
|
||||
+ printf("Error: Invalid protocol\n");
|
||||
+ }
|
||||
+ if (ret != EOK) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "memcpy_s err ret=%d \n", ret);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void get_stack_dfx_data(struct gazelle_stack_dfx_data *dfx, struct protocol_stack *stack,
|
||||
- enum GAZELLE_STAT_MODE stat_mode)
|
||||
+ struct gazelle_stat_msg_request *msg)
|
||||
{
|
||||
int32_t rpc_call_result;
|
||||
int32_t ret;
|
||||
+ enum GAZELLE_STAT_MODE stat_mode = msg->stat_mode;
|
||||
|
||||
switch (stat_mode) {
|
||||
case GAZELLE_STAT_LSTACK_SHOW:
|
||||
@@ -255,6 +286,9 @@ static void get_stack_dfx_data(struct gazelle_stack_dfx_data *dfx, struct protoc
|
||||
case GAZELLE_STAT_LTRAN_STOP_LATENCY:
|
||||
set_latency_start_flag(false);
|
||||
break;
|
||||
+ case GAZELLE_STAT_LSTACK_SHOW_PROTOCOL:
|
||||
+ get_stack_dfx_data_proto(dfx, stack, msg);
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -298,16 +332,17 @@ int handle_dpdk_cmd(int fd, enum GAZELLE_STAT_MODE stat_mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int handle_stack_cmd(int fd, enum GAZELLE_STAT_MODE stat_mode)
|
||||
+int handle_stack_cmd(int fd, struct gazelle_stat_msg_request *msg)
|
||||
{
|
||||
struct gazelle_stack_dfx_data dfx;
|
||||
struct protocol_stack_group *stack_group = get_protocol_stack_group();
|
||||
+ enum GAZELLE_STAT_MODE stat_mode = msg->stat_mode;
|
||||
|
||||
for (uint32_t i = 0; i < stack_group->stack_num; i++) {
|
||||
struct protocol_stack *stack = stack_group->stacks[i];
|
||||
|
||||
memset_s(&dfx, sizeof(dfx), 0, sizeof(dfx));
|
||||
- get_stack_dfx_data(&dfx, stack, stat_mode);
|
||||
+ get_stack_dfx_data(&dfx, stack, msg);
|
||||
|
||||
if (!use_ltran() &&
|
||||
(stat_mode == GAZELLE_STAT_LTRAN_START_LATENCY || stat_mode == GAZELLE_STAT_LTRAN_STOP_LATENCY)) {
|
||||
diff --git a/src/lstack/include/lstack_stack_stat.h b/src/lstack/include/lstack_stack_stat.h
|
||||
index 87951aa..867f35b 100644
|
||||
--- a/src/lstack/include/lstack_stack_stat.h
|
||||
+++ b/src/lstack/include/lstack_stack_stat.handle
|
||||
@@ -21,13 +21,14 @@ struct wakeup_poll;
|
||||
struct protocol_stack;
|
||||
enum GAZELLE_LATENCY_TYPE;
|
||||
enum GAZELLE_STAT_MODE;
|
||||
+struct gazelle_stat_msg_request;
|
||||
|
||||
void calculate_lstack_latency(struct gazelle_stack_latency *stack_latency, const struct pbuf *pbuf,
|
||||
enum GAZELLE_LATENCY_TYPE type, uint64_t time_record);
|
||||
void calculate_rpcmsg_latency(struct gazelle_stack_latency *stack_latency, struct rpc_msg *msg,
|
||||
enum GAZELLE_LATENCY_TYPE type);
|
||||
void stack_stat_init(void);
|
||||
-int handle_stack_cmd(int fd, enum GAZELLE_STAT_MODE stat_mode);
|
||||
+int handle_stack_cmd(int fd, struct gazelle_stat_msg_request *msg);
|
||||
int handle_dpdk_cmd(int fd, enum GAZELLE_STAT_MODE stat_mode);
|
||||
uint64_t get_current_time(void);
|
||||
void lstack_get_low_power_info(struct gazelle_stat_low_power_info *low_power_info);
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index 073dfa7..717744a 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -136,6 +136,7 @@ static void gazelle_print_ltran_conn(void *buf, const struct gazelle_stat_msg_re
|
||||
static void gazelle_print_lstack_xstats(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
static void gazelle_print_lstack_aggregate(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
static void gazelle_print_lstack_nic_features(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
+static void gazelle_print_lstack_stat_proto(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
|
||||
#ifdef GAZELLE_FAULT_INJECT_ENABLE
|
||||
static void gazelle_print_fault_inject_set_status(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
@@ -168,7 +169,8 @@ static struct gazelle_dfx_list g_gazelle_dfx_tbl[] = {
|
||||
{GAZELLE_STAT_LSTACK_SHOW_XSTATS, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_xstats},
|
||||
{GAZELLE_STAT_LSTACK_SHOW_AGGREGATE, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_aggregate},
|
||||
{GAZELLE_STAT_LSTACK_SHOW_NIC_FEATURES, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_nic_features},
|
||||
-
|
||||
+ {GAZELLE_STAT_LSTACK_SHOW_PROTOCOL, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_proto},
|
||||
+
|
||||
#ifdef GAZELLE_FAULT_INJECT_ENABLE
|
||||
{GAZELLE_STAT_FAULT_INJECT_SET, sizeof(struct gazelle_stack_dfx_data), gazelle_print_fault_inject_set_status},
|
||||
{GAZELLE_STAT_FAULT_INJECT_UNSET, sizeof(struct gazelle_stack_dfx_data), gazelle_print_fault_inject_unset_status},
|
||||
@@ -1083,6 +1085,20 @@ static void gazelle_print_lstack_stat_snmp_core(const struct gazelle_stack_dfx_d
|
||||
printf("icmp_out_echo_reps: %u\n", snmp->icmp_out_echo_reps);
|
||||
}
|
||||
|
||||
+static void gazelle_print_lstack_stat_proto_core(const struct gazelle_stack_dfx_data *stat,
|
||||
+ const struct gazelle_stat_lstack_proto *proto)
|
||||
+{
|
||||
+ printf("\n------ stack tid: %6u ------\n", stat->tid);
|
||||
+ printf("xmit: %u\n", proto->xmit);
|
||||
+ printf("recv: %u\n", proto->recv);
|
||||
+ printf("fw: %u\n", proto->fw);
|
||||
+ printf("drop: %u\n", proto->drop);
|
||||
+ printf("chkerr: %u\n", proto->chkerr);
|
||||
+ printf("lenerr: %u\n", proto->lenerr);
|
||||
+ printf("memerr: %u\n", proto->memerr);
|
||||
+ printf("rterr: %u\n", proto->rterr);
|
||||
+}
|
||||
+
|
||||
static void gazelle_print_lstack_stat_snmp(void *buf, const struct gazelle_stat_msg_request *req_msg)
|
||||
{
|
||||
int32_t ret;
|
||||
@@ -1102,6 +1118,26 @@ static void gazelle_print_lstack_stat_snmp(void *buf, const struct gazelle_stat_
|
||||
} while (true);
|
||||
}
|
||||
|
||||
+static void gazelle_print_lstack_stat_proto(void *buf, const struct gazelle_stat_msg_request *req_msg)
|
||||
+{
|
||||
+ int32_t ret;
|
||||
+ struct gazelle_stack_dfx_data *stat = (struct gazelle_stack_dfx_data *)buf;
|
||||
+ struct gazelle_stat_lstack_proto *proto = NULL;
|
||||
+
|
||||
+ proto = &stat->data.proto_data;
|
||||
+ printf("Statistics of lstack proto:\n");
|
||||
+ do {
|
||||
+ gazelle_print_lstack_stat_proto_core(stat, proto);
|
||||
+ if (stat->eof != 0) {
|
||||
+ break;
|
||||
+ }
|
||||
+ ret = dfx_stat_read_from_ltran(buf, sizeof(struct gazelle_stack_dfx_data), req_msg->stat_mode);
|
||||
+ if (ret != GAZELLE_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+ } while (true);
|
||||
+}
|
||||
+
|
||||
static void gazelle_keepalive_string(char* str, int buff_len, struct gazelle_stat_lstack_conn_info *conn_info)
|
||||
{
|
||||
if (conn_info->keepalive == 0) {
|
||||
@@ -1240,6 +1276,7 @@ static void show_usage(void)
|
||||
" loglevel {error | info | debug} set lstack loglevel \n"
|
||||
" lowpower {0 | 1} set lowpower enable \n"
|
||||
" [time] measure latency time default 1S, maximum 30mins \n\n"
|
||||
+ " -p, protocol {UDP | TCP | ICMP | IP | ETHARP | IP_FRAG} show lstack protocol statistics \n"
|
||||
#ifdef GAZELLE_FAULT_INJECT_ENABLE
|
||||
" *inject params*\n"
|
||||
" |inject_type | digit_param_1 | digit_param_2 | inject_rule |\n"
|
||||
@@ -1444,6 +1481,25 @@ static int parse_delay_arg(int32_t argc, char *argv[], long int delay)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int32_t parse_dfx_lstack_show_proto_args(int32_t argc, char *argv[], struct gazelle_stat_msg_request *req_msg)
|
||||
+{
|
||||
+ int32_t cmd_index = 0;
|
||||
+ int32_t ret;
|
||||
+
|
||||
+ char *param = argv[GAZELLE_OPTIONS2_ARG_IDX];
|
||||
+ if (strcmp(param, "UDP") != 0 && strcmp(param, "TCP") != 0 && strcmp(param, "IP") &&
|
||||
+ strcmp(param, "ICMP") && strcmp(param, "ETHARP") != 0) {
|
||||
+ return cmd_index;
|
||||
+ }
|
||||
+ ret = strncpy_s(req_msg[cmd_index].data.protocol, MAX_PROTOCOL_LENGTH, argv[GAZELLE_OPTIONS2_ARG_IDX],
|
||||
+ MAX_PROTOCOL_LENGTH - 1);
|
||||
+ if (ret != EOK) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_PROTOCOL;
|
||||
+ return cmd_index;
|
||||
+}
|
||||
+
|
||||
static int32_t parse_dfx_lstack_show_args(int32_t argc, char *argv[], struct gazelle_stat_msg_request *req_msg)
|
||||
{
|
||||
int32_t cmd_index = 0;
|
||||
@@ -1490,8 +1546,9 @@ static int32_t parse_dfx_lstack_show_args(int32_t argc, char *argv[], struct gaz
|
||||
}
|
||||
} else if (strcmp(param, "-k") == 0 || strcmp(param, "nic-features") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_NIC_FEATURES;
|
||||
+ } else if (strcmp(param, "protocol") == 0 || strcmp(param, "-p") == 0) {
|
||||
+ cmd_index = parse_dfx_lstack_show_proto_args(argc, argv, req_msg);
|
||||
}
|
||||
-
|
||||
return cmd_index;
|
||||
}
|
||||
|
||||
diff --git a/src/ltran/ltran_monitor.c b/src/ltran/ltran_monitor.c
|
||||
index ea31e84..457e8c8 100644
|
||||
--- a/src/ltran/ltran_monitor.c
|
||||
+++ b/src/ltran/ltran_monitor.c
|
||||
@@ -347,6 +347,7 @@ static int32_t lstack_req_mode_process(int32_t fd, const struct gazelle_stat_msg
|
||||
case GAZELLE_STAT_LSTACK_SHOW_CONN:
|
||||
case GAZELLE_STAT_LSTACK_SHOW_LATENCY:
|
||||
case GAZELLE_STAT_LSTACK_LOW_POWER_MDF:
|
||||
+ case GAZELLE_STAT_LSTACK_SHOW_PROTOCOL:
|
||||
handle_resp_lstack_transfer(req_msg, fd);
|
||||
break;
|
||||
default:
|
||||
--
|
||||
2.33.0
|
||||
|
||||
26
0167-fix-port-not-support-vlan-filter.patch
Normal file
26
0167-fix-port-not-support-vlan-filter.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 3171100d06146791ab9d22523805b8ed580daf3f Mon Sep 17 00:00:00 2001
|
||||
From: yinbin6 <yinbin8@huawei.com>
|
||||
Date: Fri, 12 Apr 2024 15:09:12 +0800
|
||||
Subject: [PATCH] fix port not support vlan filter
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_dpdk.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index a6a8a01..5d90408 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -624,7 +624,8 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
|
||||
}
|
||||
|
||||
/* after rte_eth_dev_configure */
|
||||
- if (get_global_cfg_params()->nic.vlan_mode != -1) {
|
||||
+ if ((get_global_cfg_params()->nic.vlan_mode != -1) &&
|
||||
+ ((stack_group->rx_offload & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) == RTE_ETH_RX_OFFLOAD_VLAN_FILTER)) {
|
||||
ret = rte_eth_dev_vlan_filter(port_id, get_global_cfg_params()->nic.vlan_mode, 1);
|
||||
if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk add vlan filter failed ret = %d\n", ret);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
12
gazelle.spec
12
gazelle.spec
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.2
|
||||
Release: 31
|
||||
Release: 32
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -180,6 +180,10 @@ Patch9160: 0160-warp-add-configuration-check-with-host_addr-and-serv.patch
|
||||
Patch9161: 0161-add-latency-nodes-READ_APP_CALL-WRITE_RPC_MSG.patch
|
||||
Patch9162: 0162-fix-vlan-filter-can-be-added-when-vlan_mode-1.patch
|
||||
Patch9163: 0163-Add-support-for-arch-ppc64le.patch
|
||||
Patch9164: 0164-dfx-support-get-nic-bond-status.patch
|
||||
Patch9165: 0165-remove-dpdk_skip_nic_init-for-dpdk-23.11.patch
|
||||
Patch9166: 0166-gazellectl-add-lwip-stats_proto-print.patch
|
||||
Patch9167: 0167-fix-port-not-support-vlan-filter.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -221,6 +225,12 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Fri Apr 12 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-32
|
||||
- fix port not support vlan filter
|
||||
- gazellectl add lwip stats_proto print
|
||||
- remove dpdk_skip_nic_init for dpdk-23.11
|
||||
- dfx: support get nic bond status
|
||||
|
||||
* Sun Apr 7 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-31
|
||||
- Add support for arch ppc64le
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user