sync upstream patch
(cherry picked from commit 377d2a41acacfae6d887d58dc7c63224bfdee54b)
This commit is contained in:
parent
7c2282a200
commit
79980c367d
487
0066-gazellectl-fix-gazellectl-lstack-show-1-r-error.patch
Normal file
487
0066-gazellectl-fix-gazellectl-lstack-show-1-r-error.patch
Normal file
@ -0,0 +1,487 @@
|
||||
From 1a43d75144d7fc4f052758aceadf47535ef3262e Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Mon, 20 Nov 2023 21:15:51 +0800
|
||||
Subject: [PATCH] gazellectl: fix gazellectl lstack show 1 -r error
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 28 +++--
|
||||
src/lstack/core/lstack_stack_stat.c | 15 +--
|
||||
src/ltran/ltran_dfx.c | 188 ++++++++++++++++------------
|
||||
src/ltran/ltran_monitor.c | 5 +-
|
||||
4 files changed, 131 insertions(+), 105 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index bfc4992..ac6ea5e 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -25,6 +25,7 @@
|
||||
enum GAZELLE_STAT_MODE {
|
||||
GAZELLE_STAT_LTRAN_SHOW = 0,
|
||||
GAZELLE_STAT_LTRAN_SHOW_RATE,
|
||||
+ GAZELLE_STAT_LTRAN_SHOW_LB_RATE,
|
||||
GAZELLE_STAT_LTRAN_SHOW_INSTANCE,
|
||||
GAZELLE_STAT_LTRAN_SHOW_BURST,
|
||||
GAZELLE_STAT_LTRAN_SHOW_LATENCY,
|
||||
@@ -78,6 +79,18 @@ struct gazelle_wakeup_stat {
|
||||
uint64_t kernel_events;
|
||||
};
|
||||
|
||||
+struct gazelle_stack_aggregate_stats {
|
||||
+ /* 0: RX, 1: TX, 2: APP_TX */
|
||||
+ uint32_t size_1_64[3];
|
||||
+ uint32_t size_65_512[3];
|
||||
+ uint32_t size_513_1460[3];
|
||||
+ uint32_t size_1461_8192[3];
|
||||
+ uint32_t size_8193_max[3];
|
||||
+
|
||||
+ uint64_t rx_bytes;
|
||||
+ uint64_t tx_bytes;
|
||||
+};
|
||||
+
|
||||
struct gazelle_stat_pkts {
|
||||
uint16_t conn_num;
|
||||
uint32_t mempool_freecnt;
|
||||
@@ -86,6 +99,7 @@ struct gazelle_stat_pkts {
|
||||
uint64_t call_alloc_fail;
|
||||
struct gazelle_stack_stat stack_stat;
|
||||
struct gazelle_wakeup_stat wakeup_stat;
|
||||
+ struct gazelle_stack_aggregate_stats aggregate_stats;
|
||||
};
|
||||
|
||||
/* same as define in lwip/stats.h - struct stats_mib2 */
|
||||
@@ -218,23 +232,12 @@ struct nic_eth_xstats {
|
||||
uint16_t port_id;
|
||||
};
|
||||
|
||||
-struct gazelle_stack_aggregate_stats {
|
||||
- /* 0: RX, 1: TX, 2: APP_TX */
|
||||
- uint32_t size_1_64[3];
|
||||
- uint32_t size_65_512[3];
|
||||
- uint32_t size_513_1460[3];
|
||||
- uint32_t size_1461_8192[3];
|
||||
- uint32_t size_8193_max[3];
|
||||
-
|
||||
- uint64_t rx_bytes;
|
||||
- uint64_t tx_bytes;
|
||||
-};
|
||||
-
|
||||
struct gazelle_stack_dfx_data {
|
||||
/* indicates whether the current message is the last */
|
||||
uint32_t eof;
|
||||
uint32_t tid;
|
||||
int32_t loglevel;
|
||||
+ uint32_t stack_id;
|
||||
struct gazelle_stat_low_power_info low_power_info;
|
||||
|
||||
union lstack_msg {
|
||||
@@ -243,7 +246,6 @@ struct gazelle_stack_dfx_data {
|
||||
struct gazelle_stat_lstack_conn conn;
|
||||
struct gazelle_stat_lstack_snmp snmp;
|
||||
struct nic_eth_xstats nic_xstats;
|
||||
- struct gazelle_stack_aggregate_stats aggregate_stats;
|
||||
} data;
|
||||
};
|
||||
|
||||
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
|
||||
index 18548ab..3fd5903 100644
|
||||
--- a/src/lstack/core/lstack_stack_stat.c
|
||||
+++ b/src/lstack/core/lstack_stack_stat.c
|
||||
@@ -198,6 +198,13 @@ static void get_stack_dfx_data(struct gazelle_stack_dfx_data *dfx, struct protoc
|
||||
case GAZELLE_STAT_LSTACK_SHOW:
|
||||
case GAZELLE_STAT_LSTACK_SHOW_RATE:
|
||||
get_stack_stats(dfx, stack);
|
||||
+ /* fall through */
|
||||
+ case GAZELLE_STAT_LSTACK_SHOW_AGGREGATE:
|
||||
+ ret = memcpy_s(&dfx->data.pkts.aggregate_stats, sizeof(dfx->data.pkts.aggregate_stats),
|
||||
+ &stack->aggregate_stats, sizeof(stack->aggregate_stats));
|
||||
+ if (ret != EOK) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "memcpy_s err ret=%d \n", ret);
|
||||
+ }
|
||||
break;
|
||||
case GAZELLE_STAT_LSTACK_SHOW_SNMP:
|
||||
ret = memcpy_s(&dfx->data.snmp, sizeof(dfx->data.snmp), &stack->lwip_stats->mib2,
|
||||
@@ -218,13 +225,6 @@ static void get_stack_dfx_data(struct gazelle_stack_dfx_data *dfx, struct protoc
|
||||
LSTACK_LOG(ERR, LSTACK, "memcpy_s err ret=%d \n", ret);
|
||||
}
|
||||
break;
|
||||
- case GAZELLE_STAT_LSTACK_SHOW_AGGREGATE:
|
||||
- ret = memcpy_s(&dfx->data.aggregate_stats, sizeof(dfx->data.aggregate_stats),
|
||||
- &stack->aggregate_stats, sizeof(stack->aggregate_stats));
|
||||
- if (ret != EOK) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "memcpy_s err ret=%d \n", ret);
|
||||
- }
|
||||
- break;
|
||||
case GAZELLE_STAT_LTRAN_START_LATENCY:
|
||||
set_latency_start_flag(true);
|
||||
break;
|
||||
@@ -287,6 +287,7 @@ int handle_stack_cmd(int fd, enum GAZELLE_STAT_MODE stat_mode)
|
||||
}
|
||||
|
||||
dfx.tid = stack->tid;
|
||||
+ dfx.stack_id = i;
|
||||
if (i == stack_group->stack_num - 1) {
|
||||
dfx.eof = 1;
|
||||
}
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index 3bd120c..d3ff527 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -45,6 +45,7 @@
|
||||
#define GAZELLE_LSTACK_SET_MINNUM 6
|
||||
|
||||
#define GAZELLE_CMD_MAX 5
|
||||
+#define CMD_WAIT_TIME 1 // sec
|
||||
|
||||
#define GAZELLE_RESULT_LEN 8291
|
||||
#define GAZELLE_MAX_LATENCY_TIME 1800 // max latency time 30mins
|
||||
@@ -55,6 +56,7 @@ static int32_t g_unix_fd = -1;
|
||||
static int32_t g_ltran_rate_show_flag = GAZELLE_OFF; // not show when first get total statistics
|
||||
static struct gazelle_stat_ltran_total g_last_ltran_total;
|
||||
static struct gazelle_stat_lstack_total g_last_lstack_total[GAZELLE_MAX_STACK_ARRAY_SIZE];
|
||||
+static struct gazelle_stack_dfx_data g_last_lstack_data[GAZELLE_MAX_STACK_ARRAY_SIZE];
|
||||
|
||||
static bool g_use_ltran = false;
|
||||
|
||||
@@ -73,6 +75,7 @@ struct gazelle_dfx_list {
|
||||
|
||||
static void gazelle_print_ltran_stat_total(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
static void gazelle_print_ltran_stat_rate(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
+static void gazelle_print_ltran_stat_lb_rate(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
static void gazelle_print_ltran_stat_client(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
static void gazelle_print_ltran_stat_burst(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
static void gazelle_print_ltran_stat_latency(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
@@ -92,6 +95,7 @@ static void gazelle_print_lstack_aggregate(void *buf, const struct gazelle_stat_
|
||||
static struct gazelle_dfx_list g_gazelle_dfx_tbl[] = {
|
||||
{GAZELLE_STAT_LTRAN_SHOW, sizeof(struct gazelle_stat_ltran_total), gazelle_print_ltran_stat_total},
|
||||
{GAZELLE_STAT_LTRAN_SHOW_RATE, sizeof(struct gazelle_stat_ltran_total), gazelle_print_ltran_stat_rate},
|
||||
+ {GAZELLE_STAT_LTRAN_SHOW_LB_RATE, sizeof(struct gazelle_stat_ltran_total), gazelle_print_ltran_stat_lb_rate},
|
||||
{GAZELLE_STAT_LTRAN_SHOW_INSTANCE, sizeof(struct gazelle_stat_ltran_client), gazelle_print_ltran_stat_client},
|
||||
{GAZELLE_STAT_LTRAN_SHOW_BURST, sizeof(struct gazelle_stat_ltran_total), gazelle_print_ltran_stat_burst},
|
||||
{GAZELLE_STAT_LTRAN_SHOW_LATENCY, sizeof(struct in_addr), gazelle_print_ltran_stat_latency},
|
||||
@@ -103,7 +107,7 @@ static struct gazelle_dfx_list g_gazelle_dfx_tbl[] = {
|
||||
{GAZELLE_STAT_LTRAN_SHOW_CONNTABLE, sizeof(struct gazelle_stat_forward_table), gazelle_print_ltran_conn},
|
||||
{GAZELLE_STAT_LSTACK_LOG_LEVEL_SET, 0, gazelle_print_ltran_wait},
|
||||
{GAZELLE_STAT_LSTACK_SHOW, sizeof(struct gazelle_stat_lstack_total), gazelle_print_lstack_stat_total},
|
||||
- {GAZELLE_STAT_LSTACK_SHOW_RATE, sizeof(struct gazelle_stat_lstack_total), gazelle_print_lstack_stat_rate},
|
||||
+ {GAZELLE_STAT_LSTACK_SHOW_RATE, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_rate},
|
||||
{GAZELLE_STAT_LSTACK_SHOW_SNMP, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_snmp},
|
||||
{GAZELLE_STAT_LSTACK_SHOW_CONN, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_conn},
|
||||
{GAZELLE_STAT_LSTACK_SHOW_LATENCY, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_latency},
|
||||
@@ -422,7 +426,7 @@ static void gazelle_print_ltran_wait(void *buf, const struct gazelle_stat_msg_re
|
||||
{
|
||||
(void)buf;
|
||||
(void)req_msg;
|
||||
- sleep(1); // give ltran time to read cmd
|
||||
+ sleep(CMD_WAIT_TIME); // give ltran time to read cmd
|
||||
}
|
||||
|
||||
static void gazelle_print_ltran_start_latency(void *buf, const struct gazelle_stat_msg_request *req_msg)
|
||||
@@ -774,44 +778,39 @@ static void gazelle_print_lstack_stat_rate(void *buf, const struct gazelle_stat_
|
||||
{
|
||||
int32_t ret;
|
||||
double rate;
|
||||
- uint32_t stack_index;
|
||||
+ uint32_t index;
|
||||
char *rate_type = NULL;
|
||||
- struct gazelle_stat_lstack_total *stats = (struct gazelle_stat_lstack_total *)buf;
|
||||
+ uint32_t total_wait_time = g_wait_reply + CMD_WAIT_TIME; /* STOP_LATENCY would sleep */
|
||||
+ struct gazelle_stack_dfx_data *stats = (struct gazelle_stack_dfx_data *)buf;
|
||||
/* not show when first get total statistics */
|
||||
static int32_t g_lstack_rate_show_flag[GAZELLE_MAX_STACK_ARRAY_SIZE] = {0};
|
||||
|
||||
do {
|
||||
- stack_index = stats->index;
|
||||
- if (stack_index >= GAZELLE_MAX_STACK_ARRAY_SIZE) {
|
||||
+ index = stats->stack_id;
|
||||
+ if (index >= GAZELLE_MAX_STACK_ARRAY_SIZE) {
|
||||
break;
|
||||
}
|
||||
|
||||
- if (g_lstack_rate_show_flag[stack_index] == GAZELLE_ON) {
|
||||
+ if (g_lstack_rate_show_flag[index] == GAZELLE_ON) {
|
||||
printf("------ Statistics of lstack rate stack tid: %6u ------\n", stats->tid);
|
||||
- printf("rx_pkts: %-15"PRIu64" ", (stats->rx - g_last_lstack_total[stack_index].rx) /
|
||||
- GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
- rate = rate_convert_type((stats->rx_bytes - g_last_lstack_total[stack_index].rx_bytes) /
|
||||
- GAZELLE_DFX_REQ_INTERVAL_S, &rate_type);
|
||||
+ printf("rx_pkts: %-15"PRIu64" ", (stats->data.pkts.stack_stat.rx -
|
||||
+ g_last_lstack_data[index].data.pkts.stack_stat.rx) / total_wait_time);
|
||||
+ rate = rate_convert_type((stats->data.pkts.aggregate_stats.rx_bytes / g_wait_reply), &rate_type);
|
||||
printf("rx_bytes: %7.2lf%s ", rate, rate_type);
|
||||
- printf("rx_err: %-15"PRIu64" ", (stats->rx_err - g_last_lstack_total[stack_index].rx_err) /
|
||||
- GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
- printf("rx_drop: %-15"PRIu64"\n", (stats->rx_drop - g_last_lstack_total[stack_index].rx_drop) /
|
||||
- GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
- printf("tx_pkts: %-15"PRIu64" ", (stats->tx - g_last_lstack_total[stack_index].tx) /
|
||||
- GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
- rate = rate_convert_type((stats->tx_bytes - g_last_lstack_total[stack_index].tx_bytes) /
|
||||
- GAZELLE_DFX_REQ_INTERVAL_S, &rate_type);
|
||||
+ printf("rx_drop: %-15"PRIu64"\n", (stats->data.pkts.stack_stat.rx_drop -
|
||||
+ g_last_lstack_data[index].data.pkts.stack_stat.rx_drop) /total_wait_time);
|
||||
+ printf("tx_pkts: %-15"PRIu64" ", (stats->data.pkts.stack_stat.tx -
|
||||
+ g_last_lstack_data[index].data.pkts.stack_stat.tx) / total_wait_time);
|
||||
+ rate = rate_convert_type((stats->data.pkts.aggregate_stats.tx_bytes / g_wait_reply), &rate_type);
|
||||
printf("tx_bytes: %7.2lf%s ", rate, rate_type);
|
||||
- printf("tx_err: %-15"PRIu64" ", (stats->tx_err - g_last_lstack_total[stack_index].tx_err) /
|
||||
- GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
- printf("tx_drop: %-15"PRIu64"\n\n", (stats->tx_drop - g_last_lstack_total[stack_index].tx_drop) /
|
||||
- GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ printf("tx_drop: %-15"PRIu64"\n\n", (stats->data.pkts.stack_stat.tx_drop -
|
||||
+ g_last_lstack_data[index].data.pkts.stack_stat.tx_drop) / total_wait_time);
|
||||
} else {
|
||||
- g_lstack_rate_show_flag[stack_index] = GAZELLE_ON;
|
||||
+ g_lstack_rate_show_flag[index] = GAZELLE_ON;
|
||||
}
|
||||
|
||||
- ret = memcpy_s(&g_last_lstack_total[stack_index], sizeof(*stats), stats,
|
||||
- sizeof(struct gazelle_stat_lstack_total));
|
||||
+ ret = memcpy_s(&g_last_lstack_data[index], sizeof(*stats), stats,
|
||||
+ sizeof(struct gazelle_stack_dfx_data));
|
||||
if (ret != EOK) {
|
||||
printf("%s:%d memcpy_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||
}
|
||||
@@ -820,7 +819,7 @@ static void gazelle_print_lstack_stat_rate(void *buf, const struct gazelle_stat_
|
||||
break;
|
||||
}
|
||||
|
||||
- ret = dfx_stat_read_from_ltran(buf, sizeof(struct gazelle_stat_lstack_total), req_msg->stat_mode);
|
||||
+ ret = dfx_stat_read_from_ltran(buf, sizeof(struct gazelle_stack_dfx_data), req_msg->stat_mode);
|
||||
if (ret != GAZELLE_OK) {
|
||||
return;
|
||||
}
|
||||
@@ -846,6 +845,63 @@ static void gazelle_print_lstack_tcp_stat(const struct gazelle_stat_lstack_snmp
|
||||
printf("tcp_listen_drops: %u\n", snmp->tcp_listen_drops);
|
||||
}
|
||||
|
||||
+static void gazelle_print_ltran_stat_lb_rate(void *buf, const struct gazelle_stat_msg_request *req_msg)
|
||||
+{
|
||||
+ int32_t ret;
|
||||
+ double rate;
|
||||
+ uint32_t stack_index;
|
||||
+ char *rate_type = NULL;
|
||||
+ struct gazelle_stat_lstack_total *stats = (struct gazelle_stat_lstack_total *)buf;
|
||||
+ /* not show when first get total statistics */
|
||||
+ static int32_t g_ltran_lb_rate_show_flag[GAZELLE_MAX_STACK_ARRAY_SIZE] = {0};
|
||||
+
|
||||
+ do {
|
||||
+ stack_index = stats->index;
|
||||
+ if (stack_index >= GAZELLE_MAX_STACK_ARRAY_SIZE) {
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (g_ltran_lb_rate_show_flag[stack_index] == GAZELLE_ON) {
|
||||
+ printf("------ Statistics of lstack rate stack tid: %6u ------\n", stats->tid);
|
||||
+ printf("rx_pkts: %-15"PRIu64" ", (stats->rx - g_last_lstack_total[stack_index].rx) /
|
||||
+ GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ rate = rate_convert_type((stats->rx_bytes - g_last_lstack_total[stack_index].rx_bytes) /
|
||||
+ GAZELLE_DFX_REQ_INTERVAL_S, &rate_type);
|
||||
+ printf("rx_bytes: %7.2lf%s ", rate, rate_type);
|
||||
+ printf("rx_err: %-15"PRIu64" ", (stats->rx_err - g_last_lstack_total[stack_index].rx_err) /
|
||||
+ GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ printf("rx_drop: %-15"PRIu64"\n", (stats->rx_drop - g_last_lstack_total[stack_index].rx_drop) /
|
||||
+ GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ printf("tx_pkts: %-15"PRIu64" ", (stats->tx - g_last_lstack_total[stack_index].tx) /
|
||||
+ GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ rate = rate_convert_type((stats->tx_bytes - g_last_lstack_total[stack_index].tx_bytes) /
|
||||
+ GAZELLE_DFX_REQ_INTERVAL_S, &rate_type);
|
||||
+ printf("tx_bytes: %7.2lf%s ", rate, rate_type);
|
||||
+ printf("tx_err: %-15"PRIu64" ", (stats->tx_err - g_last_lstack_total[stack_index].tx_err) /
|
||||
+ GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ printf("tx_drop: %-15"PRIu64"\n\n", (stats->tx_drop - g_last_lstack_total[stack_index].tx_drop) /
|
||||
+ GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ } else {
|
||||
+ g_ltran_lb_rate_show_flag[stack_index] = GAZELLE_ON;
|
||||
+ }
|
||||
+
|
||||
+ ret = memcpy_s(&g_last_lstack_total[stack_index], sizeof(*stats), stats,
|
||||
+ sizeof(struct gazelle_stat_lstack_total));
|
||||
+ if (ret != EOK) {
|
||||
+ printf("%s:%d memcpy_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||
+ }
|
||||
+
|
||||
+ if (stats->eof != 0) {
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ret = dfx_stat_read_from_ltran(buf, sizeof(struct gazelle_stat_lstack_total), req_msg->stat_mode);
|
||||
+ if (ret != GAZELLE_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+ } while (true);
|
||||
+}
|
||||
+
|
||||
static void gazelle_print_lstack_stat_snmp_core(const struct gazelle_stack_dfx_data *stat,
|
||||
const struct gazelle_stat_lstack_snmp *snmp)
|
||||
{
|
||||
@@ -1048,15 +1104,12 @@ static int32_t parse_dfx_ltran_show_args(int32_t argc, char *argv[], struct gaze
|
||||
if (strcmp(param, "rate") == 0 || strcmp(param, "-r") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_SHOW_RATE;
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_MODE_MAX;
|
||||
- }
|
||||
- if (strcmp(param, "instance") == 0 || strcmp(param, "-i") == 0) {
|
||||
+ } else if (strcmp(param, "instance") == 0 || strcmp(param, "-i") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_SHOW_INSTANCE;
|
||||
- }
|
||||
- if (strcmp(param, "burst") == 0 || strcmp(param, "-b") == 0) {
|
||||
+ } else if (strcmp(param, "burst") == 0 || strcmp(param, "-b") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_SHOW_BURST;
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_MODE_MAX;
|
||||
- }
|
||||
- if (strcmp(param, "table") == 0 || strcmp(param, "-t") == 0) {
|
||||
+ } else if (strcmp(param, "table") == 0 || strcmp(param, "-t") == 0) {
|
||||
if (argc < GAZELLE_OPT_LPM_ARG_IDX1) {
|
||||
return cmd_index;
|
||||
}
|
||||
@@ -1067,8 +1120,7 @@ static int32_t parse_dfx_ltran_show_args(int32_t argc, char *argv[], struct gaze
|
||||
if (strcmp(param, "conntable") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_SHOW_CONNTABLE;
|
||||
}
|
||||
- }
|
||||
- if (strcmp(param, "latency") == 0 || strcmp(param, "-l") == 0) {
|
||||
+ } else if (strcmp(param, "latency") == 0 || strcmp(param, "-l") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_START_LATENCY;
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_STOP_LATENCY;
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_SHOW_LATENCY;
|
||||
@@ -1092,7 +1144,7 @@ static int32_t parse_dfx_ltran_show_args(int32_t argc, char *argv[], struct gaze
|
||||
static void gazelle_print_lstack_aggregate(void *buf, const struct gazelle_stat_msg_request *req_msg)
|
||||
{
|
||||
struct gazelle_stack_dfx_data *dfx = (struct gazelle_stack_dfx_data *)buf;
|
||||
- struct gazelle_stack_aggregate_stats *stats = &dfx->data.aggregate_stats;
|
||||
+ struct gazelle_stack_aggregate_stats *stats = &dfx->data.pkts.aggregate_stats;
|
||||
char *rate_type = NULL;
|
||||
double rate;
|
||||
int32_t ret = 0;
|
||||
@@ -1219,19 +1271,21 @@ static int32_t parse_dfx_lstack_show_args(int32_t argc, char *argv[], struct gaz
|
||||
|
||||
char *param = argv[GAZELLE_OPTIONS1_ARG_IDX];
|
||||
if (strcmp(param, "rate") == 0 || strcmp(param, "-r") == 0) {
|
||||
- req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_RATE;
|
||||
+ if (g_use_ltran) {
|
||||
+ req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_SHOW_LB_RATE;
|
||||
+ } else {
|
||||
+ req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_START_LATENCY;
|
||||
+ req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_STOP_LATENCY;
|
||||
+ req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_RATE;
|
||||
+ }
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_MODE_MAX;
|
||||
- }
|
||||
- if (strcmp(param, "snmp") == 0 || strcmp(param, "-s") == 0) {
|
||||
+ } else if (strcmp(param, "snmp") == 0 || strcmp(param, "-s") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_SNMP;
|
||||
- }
|
||||
- if (strcmp(param, "connect") == 0 || strcmp(param, "-c") == 0) {
|
||||
+ } else if (strcmp(param, "connect") == 0 || strcmp(param, "-c") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_CONN;
|
||||
- }
|
||||
- if (strcmp(param, "xstats") == 0 || strcmp(param, "-x") == 0) {
|
||||
+ } else if (strcmp(param, "xstats") == 0 || strcmp(param, "-x") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_XSTATS;
|
||||
- }
|
||||
- if (strcmp(param, "latency") == 0 || strcmp(param, "-l") == 0) {
|
||||
+ } else if (strcmp(param, "latency") == 0 || strcmp(param, "-l") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_START_LATENCY;
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_STOP_LATENCY;
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_LATENCY;
|
||||
@@ -1242,8 +1296,7 @@ static int32_t parse_dfx_lstack_show_args(int32_t argc, char *argv[], struct gaz
|
||||
if (parse_delay_arg(argc, argv, delay) != 0) {
|
||||
return 0;
|
||||
}
|
||||
- }
|
||||
- if (strcmp(param, "aggragate") == 0 || strcmp(param, "-a") == 0) {
|
||||
+ } else if (strcmp(param, "aggragate") == 0 || strcmp(param, "-a") == 0) {
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_START_LATENCY;
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LTRAN_STOP_LATENCY;
|
||||
req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_AGGREGATE;
|
||||
@@ -1314,31 +1367,6 @@ static int32_t parse_dfx_cmd_args(int32_t argc, char *argv[], struct gazelle_sta
|
||||
return num_cmd;
|
||||
}
|
||||
|
||||
-static int32_t check_cmd_support(struct gazelle_stat_msg_request *req_msg, int32_t req_msg_num)
|
||||
-{
|
||||
- switch (req_msg[0].stat_mode) {
|
||||
- case GAZELLE_STAT_LSTACK_LOG_LEVEL_SET:
|
||||
- case GAZELLE_STAT_LSTACK_SHOW:
|
||||
- case GAZELLE_STAT_LSTACK_SHOW_SNMP:
|
||||
- case GAZELLE_STAT_LSTACK_SHOW_CONN:
|
||||
- case GAZELLE_STAT_LSTACK_SHOW_LATENCY:
|
||||
- case GAZELLE_STAT_LSTACK_LOW_POWER_MDF:
|
||||
- case GAZELLE_STAT_LSTACK_SHOW_XSTATS:
|
||||
- case GAZELLE_STAT_LSTACK_SHOW_AGGREGATE:
|
||||
- return 0;
|
||||
- default:
|
||||
- if (req_msg[0].stat_mode == GAZELLE_STAT_LTRAN_START_LATENCY &&
|
||||
- (req_msg[req_msg_num - 1].stat_mode == GAZELLE_STAT_LSTACK_SHOW_LATENCY ||
|
||||
- req_msg[req_msg_num - 1].stat_mode == GAZELLE_STAT_LSTACK_SHOW_AGGREGATE)) {
|
||||
- return 0;
|
||||
- }
|
||||
- /* keep output consistency */
|
||||
- printf("connect ltran failed. errno: 111 ret=-1\n");
|
||||
- printf("You may need to use the -u parameter to specify the UNIX_PREFIX that matches the configuration.\n");
|
||||
- return -1;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
int32_t dfx_loop(struct gazelle_stat_msg_request *req_msg, int32_t req_msg_num)
|
||||
{
|
||||
int32_t ret;
|
||||
@@ -1377,8 +1405,10 @@ int32_t dfx_loop(struct gazelle_stat_msg_request *req_msg, int32_t req_msg_num)
|
||||
|
||||
// stat_mode = GAZELLE_STAT_MODE_MAX need repeat command
|
||||
if (req_msg[msg_index].stat_mode == GAZELLE_STAT_MODE_MAX) {
|
||||
- msg_index--;
|
||||
- sleep(GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ if (req_msg[msg_index - 1].stat_mode != GAZELLE_STAT_LSTACK_SHOW_RATE) {
|
||||
+ sleep(GAZELLE_DFX_REQ_INTERVAL_S);
|
||||
+ }
|
||||
+ msg_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1388,7 +1418,7 @@ int32_t dfx_loop(struct gazelle_stat_msg_request *req_msg, int32_t req_msg_num)
|
||||
int32_t main(int32_t argc, char *argv[])
|
||||
{
|
||||
struct gazelle_stat_msg_request req_msg[GAZELLE_CMD_MAX] = {0};
|
||||
- int32_t req_msg_num, ret;
|
||||
+ int32_t req_msg_num;
|
||||
|
||||
int unix_arg = 0;
|
||||
for (int32_t i = 1; i < argc; i++) {
|
||||
@@ -1418,13 +1448,5 @@ int32_t main(int32_t argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (!g_use_ltran) {
|
||||
- g_gazelle_dfx_tbl[GAZELLE_STAT_LSTACK_SHOW].recv_size = sizeof(struct gazelle_stack_dfx_data);
|
||||
- ret = check_cmd_support(req_msg, req_msg_num);
|
||||
- if (ret < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
return dfx_loop(req_msg, req_msg_num);
|
||||
}
|
||||
diff --git a/src/ltran/ltran_monitor.c b/src/ltran/ltran_monitor.c
|
||||
index d163a47..792db89 100644
|
||||
--- a/src/ltran/ltran_monitor.c
|
||||
+++ b/src/ltran/ltran_monitor.c
|
||||
@@ -335,14 +335,15 @@ static int32_t lstack_req_mode_process(int32_t fd, const struct gazelle_stat_msg
|
||||
case GAZELLE_STAT_LSTACK_LOG_LEVEL_SET:
|
||||
handle_resp_lstack_transfer(req_msg, -1);
|
||||
break;
|
||||
- case GAZELLE_STAT_LSTACK_SHOW_RATE:
|
||||
+ case GAZELLE_STAT_LTRAN_SHOW_LB_RATE:
|
||||
handle_resp_lstack_total(req_msg, fd);
|
||||
break;
|
||||
case GAZELLE_STAT_LSTACK_SHOW:
|
||||
handle_resp_lstack_total(req_msg, fd);
|
||||
handle_resp_lstack_transfer(req_msg, fd);
|
||||
break;
|
||||
- case GAZELLE_STAT_LSTACK_SHOW_SNMP: // fall through
|
||||
+ case GAZELLE_STAT_LSTACK_SHOW_RATE: // fall through
|
||||
+ case GAZELLE_STAT_LSTACK_SHOW_SNMP:
|
||||
case GAZELLE_STAT_LSTACK_SHOW_CONN:
|
||||
case GAZELLE_STAT_LSTACK_SHOW_LATENCY:
|
||||
case GAZELLE_STAT_LSTACK_LOW_POWER_MDF:
|
||||
--
|
||||
2.27.0
|
||||
|
||||
129
0067-fix-coredump-because-sock-closed-before-send-data-fu.patch
Normal file
129
0067-fix-coredump-because-sock-closed-before-send-data-fu.patch
Normal file
@ -0,0 +1,129 @@
|
||||
From 1a6c2c86c51997d541c6243a80580c9f54f99bb2 Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Tue, 28 Nov 2023 11:30:49 +0800
|
||||
Subject: [PATCH] fix coredump because sock closed before send data fully
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_protocol_stack.c | 15 ++++++++++-----
|
||||
src/lstack/core/lstack_thread_rpc.c | 20 +++++++++++---------
|
||||
src/lstack/include/lstack_thread_rpc.h | 3 ++-
|
||||
3 files changed, 23 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index 54cf9e8..71e7bcc 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -696,7 +696,15 @@ void stack_socket(struct rpc_msg *msg)
|
||||
void stack_close(struct rpc_msg *msg)
|
||||
{
|
||||
int32_t fd = msg->args[MSG_ARG_0].i;
|
||||
-
|
||||
+ struct protocol_stack *stack = get_protocol_stack_by_fd(fd);
|
||||
+ struct lwip_sock *sock = get_socket(fd);
|
||||
+
|
||||
+ if (NETCONN_IS_DATAOUT(sock)) {
|
||||
+ msg->recall_flag = 1;
|
||||
+ rpc_call(&stack->rpc_queue, msg); /* until stack_send recall finish */
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
msg->result = lwip_close(fd);
|
||||
if (msg->result != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d failed %ld\n", get_stack_tid(), msg->args[MSG_ARG_0].i, msg->result);
|
||||
@@ -842,15 +850,12 @@ void stack_send(struct rpc_msg *msg)
|
||||
replenish_again = do_lwip_send(stack, sock->conn->socket, sock, len, 0);
|
||||
__sync_fetch_and_sub(&sock->call_num, 1);
|
||||
if (!NETCONN_IS_DATAOUT(sock) && !replenish_again) {
|
||||
- rpc_msg_free(msg);
|
||||
return;
|
||||
} else {
|
||||
if (__atomic_load_n(&sock->call_num, __ATOMIC_ACQUIRE) == 0) {
|
||||
+ msg->recall_flag = 1;
|
||||
rpc_call(&stack->rpc_queue, msg);
|
||||
__sync_fetch_and_add(&sock->call_num, 1);
|
||||
- } else {
|
||||
- rpc_msg_free(msg);
|
||||
- return;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
|
||||
index 92c58df..03e014d 100644
|
||||
--- a/src/lstack/core/lstack_thread_rpc.c
|
||||
+++ b/src/lstack/core/lstack_thread_rpc.c
|
||||
@@ -71,8 +71,8 @@ static struct rpc_msg *rpc_msg_alloc(struct protocol_stack *stack, rpc_msg_func
|
||||
|
||||
pthread_spin_init(&msg->lock, PTHREAD_PROCESS_PRIVATE);
|
||||
msg->func = func;
|
||||
- msg->self_release = 1;
|
||||
-
|
||||
+ msg->sync_flag = 1;
|
||||
+ msg->recall_flag = 0;
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ static inline __attribute__((always_inline)) int32_t rpc_sync_call(lockless_queu
|
||||
void poll_rpc_msg(struct protocol_stack *stack, uint32_t max_num)
|
||||
{
|
||||
struct rpc_msg *msg = NULL;
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
|
||||
while (max_num--) {
|
||||
lockless_queue_node *node = lockless_queue_mpsc_pop(&stack->rpc_queue);
|
||||
@@ -109,14 +110,15 @@ void poll_rpc_msg(struct protocol_stack *stack, uint32_t max_num)
|
||||
stack->stats.call_null++;
|
||||
}
|
||||
|
||||
- /* stack_send free msg in stack_send */
|
||||
- if (msg->func != stack_send) {
|
||||
- if (msg->self_release) {
|
||||
+ if (!msg->recall_flag) {
|
||||
+ if (msg->sync_flag) {
|
||||
pthread_spin_unlock(&msg->lock);
|
||||
} else {
|
||||
rpc_msg_free(msg);
|
||||
}
|
||||
- }
|
||||
+ } else {
|
||||
+ msg->recall_flag = 0;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +226,7 @@ int32_t rpc_call_arp(struct protocol_stack *stack, struct rte_mbuf *mbuf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- msg->self_release = 0;
|
||||
+ msg->sync_flag = 0;
|
||||
msg->args[MSG_ARG_0].p = mbuf;
|
||||
msg->args[MSG_ARG_1].p = stack;
|
||||
|
||||
@@ -458,8 +460,8 @@ int32_t rpc_call_send(int fd, const void *buf, size_t len, int flags)
|
||||
msg->args[MSG_ARG_1].size = len;
|
||||
msg->args[MSG_ARG_2].i = flags;
|
||||
msg->args[MSG_ARG_3].p = stack;
|
||||
- msg->self_release = 0;
|
||||
-
|
||||
+ msg->sync_flag = 0;
|
||||
+
|
||||
rpc_call(&stack->rpc_queue, msg);
|
||||
|
||||
return 0;
|
||||
diff --git a/src/lstack/include/lstack_thread_rpc.h b/src/lstack/include/lstack_thread_rpc.h
|
||||
index bcb40dd..80e254f 100644
|
||||
--- a/src/lstack/include/lstack_thread_rpc.h
|
||||
+++ b/src/lstack/include/lstack_thread_rpc.h
|
||||
@@ -44,7 +44,8 @@ union rpc_msg_arg {
|
||||
struct rpc_msg_pool;
|
||||
struct rpc_msg {
|
||||
pthread_spinlock_t lock; /* msg handler unlock notice sender msg process done */
|
||||
- int32_t self_release; /* 0:msg handler release msg 1:msg sender release msg */
|
||||
+ int8_t sync_flag : 1;
|
||||
+ int8_t recall_flag : 1;
|
||||
int64_t result; /* func return val */
|
||||
lockless_queue_node queue_node;
|
||||
struct rpc_msg_pool *pool;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
39
0068-fix-compilation-error.patch
Normal file
39
0068-fix-compilation-error.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 876393a2263c2d5de441d357a22db0db0e80a81f Mon Sep 17 00:00:00 2001
|
||||
From: wuchangye <wuchangye@huawei.com>
|
||||
Date: Sat, 2 Dec 2023 13:46:03 +0800
|
||||
Subject: [PATCH] fix compilation error
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_thread_rpc.c | 1 -
|
||||
src/lstack/include/lstack_thread_rpc.h | 3 ---
|
||||
2 files changed, 4 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
|
||||
index 03e014d..f23d935 100644
|
||||
--- a/src/lstack/core/lstack_thread_rpc.c
|
||||
+++ b/src/lstack/core/lstack_thread_rpc.c
|
||||
@@ -94,7 +94,6 @@ static inline __attribute__((always_inline)) int32_t rpc_sync_call(lockless_queu
|
||||
void poll_rpc_msg(struct protocol_stack *stack, uint32_t max_num)
|
||||
{
|
||||
struct rpc_msg *msg = NULL;
|
||||
- struct lwip_sock *sock = NULL;
|
||||
|
||||
while (max_num--) {
|
||||
lockless_queue_node *node = lockless_queue_mpsc_pop(&stack->rpc_queue);
|
||||
diff --git a/src/lstack/include/lstack_thread_rpc.h b/src/lstack/include/lstack_thread_rpc.h
|
||||
index 80e254f..aa8c451 100644
|
||||
--- a/src/lstack/include/lstack_thread_rpc.h
|
||||
+++ b/src/lstack/include/lstack_thread_rpc.h
|
||||
@@ -96,9 +96,6 @@ static inline __attribute__((always_inline)) void rpc_call(lockless_queue *queue
|
||||
static inline __attribute__((always_inline)) void rpc_msg_free(struct rpc_msg *msg)
|
||||
{
|
||||
pthread_spin_destroy(&msg->lock);
|
||||
-
|
||||
- msg->self_release = 0;
|
||||
-
|
||||
rte_mempool_put(msg->pool->rpc_pool, (void *)msg);
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
From 7ad97d182db49ae91e9044f4d50e52f8633b2b1c Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Fri, 1 Dec 2023 15:58:09 +0800
|
||||
Subject: [PATCH] fix coredump because of addr null in lwip_fill_sendring
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_protocol_stack.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index c087098..27eeafb 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -699,7 +699,7 @@ void stack_close(struct rpc_msg *msg)
|
||||
struct protocol_stack *stack = get_protocol_stack_by_fd(fd);
|
||||
struct lwip_sock *sock = get_socket(fd);
|
||||
|
||||
- if (NETCONN_IS_DATAOUT(sock)) {
|
||||
+ if (sock && NETCONN_IS_DATAOUT(sock)) {
|
||||
msg->recall_flag = 1;
|
||||
rpc_call(&stack->rpc_queue, msg); /* until stack_send recall finish */
|
||||
return;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
97
0070-add-struct-gz_addr_t.patch
Normal file
97
0070-add-struct-gz_addr_t.patch
Normal file
@ -0,0 +1,97 @@
|
||||
From 7d721f7c7e5b1ac5265a8a7a30158e81f0e45b9b Mon Sep 17 00:00:00 2001
|
||||
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
|
||||
Date: Mon, 4 Dec 2023 20:28:41 +0800
|
||||
Subject: [PATCH] add struct gz_addr_t
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
日期: Tue Dec 5 9:30:41 2023 +0800
|
||||
---
|
||||
src/lstack/core/lstack_dpdk.c | 14 ++++++--------
|
||||
src/lstack/include/lstack_dpdk.h | 4 ++--
|
||||
src/ltran/ltran_timer.c | 8 --------
|
||||
3 files changed, 8 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 839516e..a742335 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -766,7 +766,7 @@ int32_t init_dpdk_ethdev(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-bool port_in_stack_queue(ip_addr_t src_ip, ip_addr_t dst_ip, uint16_t src_port, uint16_t dst_port)
|
||||
+bool port_in_stack_queue(gz_addr_t *src_ip, gz_addr_t *dst_ip, uint16_t src_port, uint16_t dst_port)
|
||||
{
|
||||
struct protocol_stack_group *stack_group = get_protocol_stack_group();
|
||||
if (stack_group->reta_mask == 0 || stack_group->nb_queues <= 1) {
|
||||
@@ -775,19 +775,17 @@ bool port_in_stack_queue(ip_addr_t src_ip, ip_addr_t dst_ip, uint16_t src_port,
|
||||
|
||||
union rte_thash_tuple tuple;
|
||||
uint32_t hash = 0;
|
||||
- if (IP_IS_V4_VAL(src_ip)) {
|
||||
- tuple.v4.src_addr = rte_be_to_cpu_32(ip_2_ip4(&src_ip)->addr);
|
||||
- tuple.v4.dst_addr = rte_be_to_cpu_32(ip_2_ip4(&dst_ip)->addr);
|
||||
+ if (IP_IS_V4_VAL(*src_ip)) {
|
||||
+ tuple.v4.src_addr = rte_be_to_cpu_32(src_ip->u_addr.ip4.addr);
|
||||
+ tuple.v4.dst_addr = rte_be_to_cpu_32(dst_ip->u_addr.ip4.addr);
|
||||
tuple.v4.sport = src_port;
|
||||
tuple.v4.dport = dst_port;
|
||||
hash = rte_softrss((uint32_t *)&tuple, RTE_THASH_V4_L4_LEN, g_default_rss_key);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
- *((uint32_t *)tuple.v6.src_addr + i) =
|
||||
- rte_be_to_cpu_32(*((const uint32_t *)src_ip.u_addr.ip6.addr + i));
|
||||
- *((uint32_t *)tuple.v6.dst_addr + i) =
|
||||
- rte_be_to_cpu_32(*((const uint32_t *)dst_ip.u_addr.ip6.addr + i));
|
||||
+ *((uint32_t *)tuple.v6.src_addr + i) = rte_be_to_cpu_32(*(src_ip->u_addr.ip6.addr + i));
|
||||
+ *((uint32_t *)tuple.v6.dst_addr + i) = rte_be_to_cpu_32(*(dst_ip->u_addr.ip6.addr + i));
|
||||
}
|
||||
tuple.v6.sport = src_port;
|
||||
tuple.v6.dport = dst_port;
|
||||
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
|
||||
index 6554a7e..724ab24 100644
|
||||
--- a/src/lstack/include/lstack_dpdk.h
|
||||
+++ b/src/lstack/include/lstack_dpdk.h
|
||||
@@ -13,7 +13,7 @@
|
||||
#ifndef _GAZELLE_DPDK_H_
|
||||
#define _GAZELLE_DPDK_H_
|
||||
|
||||
-#include <lwip/ip_addr.h>
|
||||
+#include <lwip/reg_sock.h>
|
||||
#include "gazelle_opt.h"
|
||||
#include "gazelle_dfx_msg.h"
|
||||
|
||||
@@ -54,7 +54,7 @@ int dpdk_ethdev_start(void);
|
||||
void dpdk_skip_nic_init(void);
|
||||
int32_t dpdk_init_lstack_kni(void);
|
||||
void dpdk_restore_pci(void);
|
||||
-bool port_in_stack_queue(ip_addr_t src_ip, ip_addr_t dst_ip, uint16_t src_port, uint16_t dst_port);
|
||||
+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);
|
||||
|
||||
diff --git a/src/ltran/ltran_timer.c b/src/ltran/ltran_timer.c
|
||||
index 749b8e0..85ea324 100644
|
||||
--- a/src/ltran/ltran_timer.c
|
||||
+++ b/src/ltran/ltran_timer.c
|
||||
@@ -24,14 +24,6 @@
|
||||
#include "ltran_tcp_conn.h"
|
||||
#include "ltran_instance.h"
|
||||
#include "ltran_timer.h"
|
||||
-/* undefine lwip_ntohs in lwip/def.h */
|
||||
-#ifdef ntohs
|
||||
-#undef ntohs
|
||||
-#endif
|
||||
-#ifdef htons
|
||||
-#undef htons
|
||||
-#endif
|
||||
-
|
||||
|
||||
static uint64_t g_cycles_per_us = 0;
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
305
0071-wrap-support-shutdown.patch
Normal file
305
0071-wrap-support-shutdown.patch
Normal file
@ -0,0 +1,305 @@
|
||||
From e1bdd31e6f4ec0aa426cdc2e24b2c78fb7903cfe Mon Sep 17 00:00:00 2001
|
||||
From: yangchen <yangchen145@huawei.com>
|
||||
Date: Wed, 6 Dec 2023 09:26:45 +0800
|
||||
Subject: [PATCH] wrap: support shutdown
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_rtc_api.c | 5 +++
|
||||
src/lstack/api/lstack_rtw_api.c | 13 +++++++
|
||||
src/lstack/api/lstack_wrap.c | 24 ++++++++++++
|
||||
src/lstack/core/lstack_dpdk.c | 2 +-
|
||||
src/lstack/core/lstack_protocol_stack.c | 45 ++++++++++++++++++++++
|
||||
src/lstack/core/lstack_thread_rpc.c | 16 ++++++++
|
||||
src/lstack/include/lstack_protocol_stack.h | 3 ++
|
||||
src/lstack/include/lstack_rtc_api.h | 1 +
|
||||
src/lstack/include/lstack_rtw_api.h | 1 +
|
||||
src/lstack/include/lstack_thread_rpc.h | 1 +
|
||||
10 files changed, 110 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_rtc_api.c b/src/lstack/api/lstack_rtc_api.c
|
||||
index 5fad3e8..50d72bc 100644
|
||||
--- a/src/lstack/api/lstack_rtc_api.c
|
||||
+++ b/src/lstack/api/lstack_rtc_api.c
|
||||
@@ -65,6 +65,11 @@ int rtc_close(int s)
|
||||
return lwip_close(s);
|
||||
}
|
||||
|
||||
+int rtc_shutdown(int fd, int how)
|
||||
+{
|
||||
+ return lwip_shutdown(fd, how);
|
||||
+}
|
||||
+
|
||||
int rtc_epoll_create(int flags)
|
||||
{
|
||||
if (stack_setup_app_thread() < 0) {
|
||||
diff --git a/src/lstack/api/lstack_rtw_api.c b/src/lstack/api/lstack_rtw_api.c
|
||||
index c524bf9..04944d5 100644
|
||||
--- a/src/lstack/api/lstack_rtw_api.c
|
||||
+++ b/src/lstack/api/lstack_rtw_api.c
|
||||
@@ -22,8 +22,10 @@
|
||||
#include "lstack_protocol_stack.h"
|
||||
#include "lstack_cfg.h"
|
||||
#include "lstack_lwip.h"
|
||||
+#include "gazelle_base_func.h"
|
||||
#include "lstack_rtw_api.h"
|
||||
|
||||
+
|
||||
int rtw_socket(int domain, int type, int protocol)
|
||||
{
|
||||
return rpc_call_socket(domain, type, protocol);
|
||||
@@ -228,6 +230,16 @@ int rtw_close(int s)
|
||||
return stack_broadcast_close(s);
|
||||
}
|
||||
|
||||
+int rtw_shutdown(int fd, int how)
|
||||
+{
|
||||
+ struct lwip_sock *sock = get_socket_by_fd(fd);
|
||||
+ if (sock && sock->wakeup && sock->wakeup->epollfd == fd) {
|
||||
+ GAZELLE_RETURN(ENOTSOCK);
|
||||
+ }
|
||||
+
|
||||
+ return stack_broadcast_shutdown(fd, how);
|
||||
+}
|
||||
+
|
||||
int rtw_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
|
||||
{
|
||||
return lstack_rtw_epoll_ctl(epfd, op, fd, event);
|
||||
@@ -242,3 +254,4 @@ int rtw_epoll_create(int flags)
|
||||
{
|
||||
return lstack_epoll_create(flags);
|
||||
}
|
||||
+
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index abbf8a1..07d5f27 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -75,6 +75,7 @@ void wrap_api_init(void)
|
||||
g_wrap_api->epoll_wait_fn = rtc_epoll_wait;
|
||||
g_wrap_api->poll_fn = rtc_poll;
|
||||
g_wrap_api->close_fn = rtc_close;
|
||||
+ g_wrap_api->shutdown_fn = rtc_shutdown;
|
||||
g_wrap_api->epoll_ctl_fn = rtc_epoll_ctl;
|
||||
g_wrap_api->epoll_create1_fn = rtc_epoll_create1;
|
||||
g_wrap_api->epoll_create_fn = rtc_epoll_create;
|
||||
@@ -103,6 +104,7 @@ void wrap_api_init(void)
|
||||
g_wrap_api->epoll_wait_fn = rtw_epoll_wait;
|
||||
g_wrap_api->poll_fn = rtw_poll;
|
||||
g_wrap_api->close_fn = rtw_close;
|
||||
+ g_wrap_api->shutdown_fn = rtw_shutdown;
|
||||
g_wrap_api->epoll_ctl_fn = rtw_epoll_ctl;
|
||||
g_wrap_api->epoll_create1_fn = rtw_epoll_create1;
|
||||
g_wrap_api->epoll_create_fn = rtw_epoll_create;
|
||||
@@ -554,6 +556,20 @@ static inline int32_t do_close(int32_t s)
|
||||
return g_wrap_api->close_fn(s);
|
||||
}
|
||||
|
||||
+static int32_t do_shutdown(int fd, int how)
|
||||
+{
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_posix_path() == PATH_KERNEL || select_fd_posix_path(fd, &sock) == PATH_KERNEL) {
|
||||
+ if (posix_api != NULL && !posix_api->ues_posix && g_wrap_api->shutdown_fn(fd, how) == 0) {
|
||||
+ return 0;
|
||||
+ } else {
|
||||
+ return posix_api->shutdown_fn(fd, how);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return g_wrap_api->shutdown_fn(fd, how);
|
||||
+}
|
||||
+
|
||||
static int32_t do_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||
{
|
||||
if ((select_posix_path() == PATH_KERNEL) || fds == NULL || nfds == 0) {
|
||||
@@ -742,6 +758,10 @@ int32_t close(int32_t s)
|
||||
{
|
||||
return do_close(s);
|
||||
}
|
||||
+int32_t shutdown(int fd, int how)
|
||||
+{
|
||||
+ return do_shutdown(fd, how);
|
||||
+}
|
||||
int32_t poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||
{
|
||||
return do_poll(fds, nfds, timeout);
|
||||
@@ -875,6 +895,10 @@ int32_t __wrap_close(int32_t s)
|
||||
{
|
||||
return do_close(s);
|
||||
}
|
||||
+int32_t __wrap_shutdown(int fd, int how)
|
||||
+{
|
||||
+ return do_shutdown(fd, how);
|
||||
+}
|
||||
int32_t __wrap_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||
{
|
||||
return do_poll(fds, nfds, timeout);
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index a742335..1811a9d 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -294,7 +294,7 @@ int32_t dpdk_alloc_pktmbuf(struct rte_mempool *pool, struct rte_mbuf **mbufs, ui
|
||||
{
|
||||
int32_t ret = rte_pktmbuf_alloc_bulk(pool, mbufs, num);
|
||||
if (ret != 0) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "rte_pktmbuf_alloc_bulk fail allocNum=%d, ret=%d, info:=%s \n",
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rte_pktmbuf_alloc_bulk fail allocNum=%d, ret=%d, info:%s \n",
|
||||
num, ret, rte_strerror(-ret));
|
||||
return ret;
|
||||
}
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index 27eeafb..dc8f143 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -715,6 +715,27 @@ void stack_close(struct rpc_msg *msg)
|
||||
posix_api->close_fn(fd);
|
||||
}
|
||||
|
||||
+void stack_shutdown(struct rpc_msg *msg)
|
||||
+{
|
||||
+ int fd = msg->args[MSG_ARG_0].i;
|
||||
+ int how = msg->args[MSG_ARG_1].i;
|
||||
+ struct protocol_stack *stack = get_protocol_stack_by_fd(fd);
|
||||
+ struct lwip_sock *sock = get_socket(fd);
|
||||
+
|
||||
+ if (sock && NETCONN_IS_DATAOUT(sock)) {
|
||||
+ msg->recall_flag = 1;
|
||||
+ rpc_call(&stack->rpc_queue, msg);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ msg->result = lwip_shutdown(fd, how);
|
||||
+ if (msg->result != 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d fail %ld\n", get_stack_tid(), fd, msg->result);
|
||||
+ }
|
||||
+
|
||||
+ posix_api->shutdown_fn(fd, how);
|
||||
+}
|
||||
+
|
||||
void stack_bind(struct rpc_msg *msg)
|
||||
{
|
||||
msg->result = lwip_bind(msg->args[MSG_ARG_0].i, msg->args[MSG_ARG_1].cp, msg->args[MSG_ARG_2].socklen);
|
||||
@@ -1041,6 +1062,29 @@ int32_t stack_broadcast_close(int32_t fd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int stack_broadcast_shutdown(int fd, int how)
|
||||
+{
|
||||
+ int32_t ret = 0;
|
||||
+ struct lwip_sock *sock = get_socket(fd);
|
||||
+ if (sock == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ do {
|
||||
+ sock = sock->listen_next;
|
||||
+ if (rpc_call_shutdown(fd, how)) {
|
||||
+ ret = -1;
|
||||
+ }
|
||||
+
|
||||
+ if (sock == NULL || sock->conn == NULL) {
|
||||
+ break;
|
||||
+ }
|
||||
+ fd = sock->conn->socket;
|
||||
+ } while (sock);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/* choice one stack listen */
|
||||
int32_t stack_single_listen(int32_t fd, int32_t backlog)
|
||||
{
|
||||
@@ -1204,3 +1248,4 @@ int32_t stack_broadcast_accept(int32_t fd, struct sockaddr *addr, socklen_t *add
|
||||
{
|
||||
return stack_broadcast_accept4(fd, addr, addrlen, 0);
|
||||
}
|
||||
+
|
||||
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
|
||||
index f23d935..4dc3da3 100644
|
||||
--- a/src/lstack/core/lstack_thread_rpc.c
|
||||
+++ b/src/lstack/core/lstack_thread_rpc.c
|
||||
@@ -262,6 +262,21 @@ int32_t rpc_call_close(int fd)
|
||||
return rpc_sync_call(&stack->rpc_queue, msg);
|
||||
}
|
||||
|
||||
+int32_t rpc_call_shutdown(int fd, int how)
|
||||
+{
|
||||
+ struct protocol_stack *stack = get_protocol_stack_by_fd(fd);
|
||||
+
|
||||
+ struct rpc_msg *msg = rpc_msg_alloc(stack, stack_shutdown);
|
||||
+ if (msg == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ msg->args[MSG_ARG_0].i = fd;
|
||||
+ msg->args[MSG_ARG_1].i = how;
|
||||
+
|
||||
+ return rpc_sync_call(&stack->rpc_queue, msg);
|
||||
+}
|
||||
+
|
||||
void rpc_call_clean_epoll(struct protocol_stack *stack, struct wakeup_poll *wakeup)
|
||||
{
|
||||
struct rpc_msg *msg = rpc_msg_alloc(stack, stack_clean_epoll);
|
||||
@@ -465,3 +480,4 @@ int32_t rpc_call_send(int fd, const void *buf, size_t len, int flags)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
|
||||
index 2c581b3..e339b8d 100644
|
||||
--- a/src/lstack/include/lstack_protocol_stack.h
|
||||
+++ b/src/lstack/include/lstack_protocol_stack.h
|
||||
@@ -126,6 +126,8 @@ void stack_broadcast_arp(struct rte_mbuf *mbuf, struct protocol_stack *cur_stack
|
||||
/* when fd is listenfd, listenfd of all protocol stack thread will be closed */
|
||||
int32_t stack_broadcast_close(int32_t fd);
|
||||
|
||||
+int stack_broadcast_shutdown(int fd, int how);
|
||||
+
|
||||
/* listen sync to all protocol stack thread, so that any protocol stack thread can build connect */
|
||||
int32_t stack_broadcast_listen(int32_t fd, int backlog);
|
||||
int32_t stack_single_listen(int32_t fd, int32_t backlog);
|
||||
@@ -152,6 +154,7 @@ void stack_clean_epoll(struct rpc_msg *msg);
|
||||
void stack_arp(struct rpc_msg *msg);
|
||||
void stack_socket(struct rpc_msg *msg);
|
||||
void stack_close(struct rpc_msg *msg);
|
||||
+void stack_shutdown(struct rpc_msg *msg);
|
||||
void stack_bind(struct rpc_msg *msg);
|
||||
void stack_listen(struct rpc_msg *msg);
|
||||
void stack_accept(struct rpc_msg *msg);
|
||||
diff --git a/src/lstack/include/lstack_rtc_api.h b/src/lstack/include/lstack_rtc_api.h
|
||||
index dd90e59..3a41e6f 100644
|
||||
--- a/src/lstack/include/lstack_rtc_api.h
|
||||
+++ b/src/lstack/include/lstack_rtc_api.h
|
||||
@@ -49,6 +49,7 @@ int rtc_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
int rtc_epoll_wait(int epfd, struct epoll_event* events, int maxevents, int timeout);
|
||||
int rtc_socket(int domain, int type, int protocol);
|
||||
int rtc_close(int s);
|
||||
+int rtc_shutdown(int fd, int how);
|
||||
int rtc_epoll_create(int flags);
|
||||
int rtc_epoll_create1(int flags);
|
||||
int rtc_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
|
||||
diff --git a/src/lstack/include/lstack_rtw_api.h b/src/lstack/include/lstack_rtw_api.h
|
||||
index d0f77b7..a38b656 100644
|
||||
--- a/src/lstack/include/lstack_rtw_api.h
|
||||
+++ b/src/lstack/include/lstack_rtw_api.h
|
||||
@@ -42,6 +42,7 @@ ssize_t rtw_sendto(int sockfd, const void *buf, size_t len, int flags,
|
||||
int rtw_epoll_wait(int epfd, struct epoll_event* events, int maxevents, int timeout);
|
||||
int rtw_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
int rtw_close(int s);
|
||||
+int rtw_shutdown(int fd, int how);
|
||||
int rtw_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
|
||||
int rtw_epoll_create1(int flags);
|
||||
int rtw_epoll_create(int flags);
|
||||
diff --git a/src/lstack/include/lstack_thread_rpc.h b/src/lstack/include/lstack_thread_rpc.h
|
||||
index aa8c451..13f5ec2 100644
|
||||
--- a/src/lstack/include/lstack_thread_rpc.h
|
||||
+++ b/src/lstack/include/lstack_thread_rpc.h
|
||||
@@ -74,6 +74,7 @@ int32_t rpc_call_connnum(struct protocol_stack *stack);
|
||||
int32_t rpc_call_arp(struct protocol_stack *stack, struct rte_mbuf *mbuf);
|
||||
int32_t rpc_call_socket(int32_t domain, int32_t type, int32_t protocol);
|
||||
int32_t rpc_call_close(int32_t fd);
|
||||
+int32_t rpc_call_shutdown(int fd, int how);
|
||||
int32_t rpc_call_bind(int32_t fd, const struct sockaddr *addr, socklen_t addrlen);
|
||||
int32_t rpc_call_listen(int s, int backlog);
|
||||
int32_t rpc_call_accept(int fd, struct sockaddr *addr, socklen_t *addrlen, int flags);
|
||||
--
|
||||
2.27.0
|
||||
|
||||
395
0072-1.solve-the-problem-of-1w-connection-not-being-able-.patch
Normal file
395
0072-1.solve-the-problem-of-1w-connection-not-being-able-.patch
Normal file
@ -0,0 +1,395 @@
|
||||
From 17d320fa7a978de0d76ae13d0afb1744cf456250 Mon Sep 17 00:00:00 2001
|
||||
From: hantwofish <hankangkang5@huawei.com>
|
||||
Date: Mon, 4 Dec 2023 15:45:09 +0800
|
||||
Subject: [PATCH] 1.solve the problem of 1w connection not being able to ping
|
||||
2.add debug info : rpc_mempool availd size
|
||||
|
||||
3.mod struct member name
|
||||
3.1 rxtx_pktmbuf_pool -> rxtx_mbufpool
|
||||
3.2 pool -> rpcpool; rpc_pool -> mempool
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 3 ++-
|
||||
src/lstack/core/lstack_dpdk.c | 15 +++++++++------
|
||||
src/lstack/core/lstack_lwip.c | 8 ++++----
|
||||
src/lstack/core/lstack_protocol_stack.c | 12 +++++++++---
|
||||
src/lstack/core/lstack_stack_stat.c | 7 +++++--
|
||||
src/lstack/core/lstack_thread_rpc.c | 20 +++++++++++++++-----
|
||||
src/lstack/include/lstack_protocol_stack.h | 5 ++++-
|
||||
src/lstack/include/lstack_thread_rpc.h | 11 ++++++-----
|
||||
src/lstack/netif/lstack_ethdev.c | 10 +++++-----
|
||||
src/lstack/netif/lstack_vdev.c | 2 +-
|
||||
src/ltran/ltran_dfx.c | 3 ++-
|
||||
11 files changed, 62 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index ac6ea5e..81d3426 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -93,7 +93,8 @@ struct gazelle_stack_aggregate_stats {
|
||||
|
||||
struct gazelle_stat_pkts {
|
||||
uint16_t conn_num;
|
||||
- uint32_t mempool_freecnt;
|
||||
+ uint32_t mbufpool_avail_cnt;
|
||||
+ uint32_t rpcpool_avail_cnt;
|
||||
uint64_t call_msg_cnt;
|
||||
uint64_t recv_list_cnt;
|
||||
uint64_t call_alloc_fail;
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 1811a9d..5107f1a 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -207,16 +207,16 @@ static struct reg_ring_msg *create_reg_mempool(const char *name, uint16_t queue_
|
||||
|
||||
int32_t pktmbuf_pool_init(struct protocol_stack *stack)
|
||||
{
|
||||
- stack->rxtx_pktmbuf_pool = get_pktmbuf_mempool("rxtx_mbuf", stack->queue_id);
|
||||
- if (stack->rxtx_pktmbuf_pool == NULL) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "rxtx_pktmbuf_pool is NULL\n");
|
||||
+ stack->rxtx_mbuf_pool = get_pktmbuf_mempool("rxtx_mbuf", stack->queue_id);
|
||||
+ if (stack->rxtx_mbuf_pool == NULL) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rxtx_mbuf_pool is NULL\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (use_ltran()) {
|
||||
stack->reg_buf = create_reg_mempool("reg_ring_msg", stack->queue_id);
|
||||
if (stack->reg_buf == NULL) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "rxtx_pktmbuf_pool is NULL\n");
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rxtx_mbuf_pool is NULL\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -292,6 +292,9 @@ int32_t create_shared_ring(struct protocol_stack *stack)
|
||||
|
||||
int32_t dpdk_alloc_pktmbuf(struct rte_mempool *pool, struct rte_mbuf **mbufs, uint32_t num)
|
||||
{
|
||||
+ if (rte_mempool_avail_count(pool) < MBUFPOOL_RESERVE_NUM + num) {
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
int32_t ret = rte_pktmbuf_alloc_bulk(pool, mbufs, num);
|
||||
if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "rte_pktmbuf_alloc_bulk fail allocNum=%d, ret=%d, info:%s \n",
|
||||
@@ -607,7 +610,7 @@ static int32_t dpdk_ethdev_setup(const struct eth_params *eth_params, uint16_t i
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
- struct rte_mempool *rxtx_pktmbuf_pool = get_protocol_stack_group()->total_rxtx_pktmbuf_pool[idx];
|
||||
+ struct rte_mempool *rxtx_mbuf_pool = get_protocol_stack_group()->total_rxtx_pktmbuf_pool[idx];
|
||||
|
||||
uint16_t socket_id = 0;
|
||||
struct cfg_params *cfg = get_global_cfg_params();
|
||||
@@ -617,7 +620,7 @@ static int32_t dpdk_ethdev_setup(const struct eth_params *eth_params, uint16_t i
|
||||
socket_id = cfg->process_numa[idx];
|
||||
}
|
||||
ret = rte_eth_rx_queue_setup(eth_params->port_id, idx, eth_params->nb_rx_desc, socket_id,
|
||||
- ð_params->rx_conf, rxtx_pktmbuf_pool);
|
||||
+ ð_params->rx_conf, rxtx_mbuf_pool);
|
||||
if (ret < 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "cannot setup rx_queue %hu: %s\n", idx, rte_strerror(-ret));
|
||||
return -1;
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index af9bf73..5d5ad73 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -143,7 +143,7 @@ static bool replenish_send_idlembuf(struct protocol_stack *stack, struct lwip_so
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbuf, replenish_cnt) != 0) {
|
||||
+ if (dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, (struct rte_mbuf **)pbuf, replenish_cnt) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
return true;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ struct pbuf *do_lwip_alloc_pbuf(pbuf_layer layer, uint16_t length, pbuf_type typ
|
||||
struct rte_mbuf *mbuf;
|
||||
struct protocol_stack *stack = get_protocol_stack();
|
||||
|
||||
- if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, &mbuf, 1) != 0) {
|
||||
+ if (dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, &mbuf, 1) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
return NULL;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ static inline ssize_t app_direct_write(struct protocol_stack *stack, struct lwip
|
||||
}
|
||||
|
||||
/* first pbuf get from send_ring. and malloc pbufs attach to first pbuf */
|
||||
- if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)&pbufs[1], write_num - 1) != 0) {
|
||||
+ if (dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, (struct rte_mbuf **)&pbufs[1], write_num - 1) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
free(pbufs);
|
||||
return 0;
|
||||
@@ -401,7 +401,7 @@ static inline ssize_t app_direct_attach(struct protocol_stack *stack, struct pbu
|
||||
}
|
||||
|
||||
/* first pbuf get from send_ring. and malloc pbufs attach to first pbuf */
|
||||
- if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbufs, write_num) != 0) {
|
||||
+ if (dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, (struct rte_mbuf **)pbufs, write_num) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
free(pbufs);
|
||||
return 0;
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index dc8f143..f61e7a8 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -902,7 +902,7 @@ void stack_broadcast_arp(struct rte_mbuf *mbuf, struct protocol_stack *cur_stack
|
||||
continue;
|
||||
}
|
||||
|
||||
- ret = dpdk_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
+ ret = dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, &mbuf_copy, 1);
|
||||
if (ret != 0) {
|
||||
stack->stats.rx_allocmbuf_fail++;
|
||||
return;
|
||||
@@ -914,7 +914,7 @@ void stack_broadcast_arp(struct rte_mbuf *mbuf, struct protocol_stack *cur_stack
|
||||
return;
|
||||
}
|
||||
}
|
||||
- ret = dpdk_alloc_pktmbuf(cur_stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
+ ret = dpdk_alloc_pktmbuf(cur_stack->rxtx_mbuf_pool, &mbuf_copy, 1);
|
||||
if (ret != 0) {
|
||||
cur_stack->stats.rx_allocmbuf_fail++;
|
||||
return;
|
||||
@@ -947,7 +947,13 @@ void stack_mempool_size(struct rpc_msg *msg)
|
||||
{
|
||||
struct protocol_stack *stack = (struct protocol_stack*)msg->args[MSG_ARG_0].p;
|
||||
|
||||
- msg->result = rte_mempool_avail_count(stack->rxtx_pktmbuf_pool);
|
||||
+ msg->result = rte_mempool_avail_count(stack->rxtx_mbuf_pool);
|
||||
+}
|
||||
+
|
||||
+void stack_rpcpool_size(struct rpc_msg *msg)
|
||||
+{
|
||||
+ struct rpc_msg_pool *rpc_mem_pool = (struct rpc_msg_pool*)msg->args[MSG_ARG_0].p;
|
||||
+ msg->result = rte_mempool_avail_count(rpc_mem_pool->mempool);
|
||||
}
|
||||
|
||||
void stack_create_shadow_fd(struct rpc_msg *msg)
|
||||
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
|
||||
index 3fd5903..45237b0 100644
|
||||
--- a/src/lstack/core/lstack_stack_stat.c
|
||||
+++ b/src/lstack/core/lstack_stack_stat.c
|
||||
@@ -179,12 +179,15 @@ static void get_stack_stats(struct gazelle_stack_dfx_data *dfx, struct protocol_
|
||||
int32_t rpc_call_result = rpc_call_msgcnt(stack);
|
||||
dfx->data.pkts.call_msg_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
|
||||
|
||||
- rpc_call_result = rpc_call_mempoolsize(stack);
|
||||
- dfx->data.pkts.mempool_freecnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
|
||||
+ rpc_call_result = rpc_call_mbufpoolsize(stack);
|
||||
+ dfx->data.pkts.mbufpool_avail_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
|
||||
|
||||
rpc_call_result = rpc_call_recvlistcnt(stack);
|
||||
dfx->data.pkts.recv_list_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
|
||||
|
||||
+ rpc_call_result = rpc_call_rpcpool_size(stack);
|
||||
+ dfx->data.pkts.rpcpool_avail_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
|
||||
+
|
||||
dfx->data.pkts.conn_num = stack->conn_num;
|
||||
}
|
||||
|
||||
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
|
||||
index 4dc3da3..473e908 100644
|
||||
--- a/src/lstack/core/lstack_thread_rpc.c
|
||||
+++ b/src/lstack/core/lstack_thread_rpc.c
|
||||
@@ -29,7 +29,7 @@ static inline __attribute__((always_inline)) struct rpc_msg *get_rpc_msg(struct
|
||||
{
|
||||
int ret;
|
||||
struct rpc_msg *msg = NULL;
|
||||
- ret = rte_mempool_get(rpc_pool->rpc_pool, (void **)&msg);
|
||||
+ ret = rte_mempool_get(rpc_pool->mempool, (void **)&msg);
|
||||
if (ret < 0) {
|
||||
LSTACK_LOG(INFO, LSTACK, "rpc pool empty!\n");
|
||||
errno = ENOMEM;
|
||||
@@ -54,9 +54,9 @@ static struct rpc_msg *rpc_msg_alloc(struct protocol_stack *stack, rpc_msg_func
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- g_rpc_pool->rpc_pool = create_mempool("rpc_pool", RPC_MSG_MAX, sizeof(struct rpc_msg),
|
||||
+ g_rpc_pool->mempool = create_mempool("rpc_pool", RPC_MSG_MAX, sizeof(struct rpc_msg),
|
||||
0, rte_gettid());
|
||||
- if (g_rpc_pool->rpc_pool == NULL) {
|
||||
+ if (g_rpc_pool->mempool == NULL) {
|
||||
get_protocol_stack_group()->call_alloc_fail++;
|
||||
return NULL;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ static struct rpc_msg *rpc_msg_alloc(struct protocol_stack *stack, rpc_msg_func
|
||||
get_protocol_stack_group()->call_alloc_fail++;
|
||||
return NULL;
|
||||
}
|
||||
- msg->pool = g_rpc_pool;
|
||||
+ msg->rpcpool = g_rpc_pool;
|
||||
|
||||
pthread_spin_init(&msg->lock, PTHREAD_PROCESS_PRIVATE);
|
||||
msg->func = func;
|
||||
@@ -194,7 +194,7 @@ int32_t rpc_call_thread_regphase2(struct protocol_stack *stack, void *conn)
|
||||
return rpc_sync_call(&stack->rpc_queue, msg);
|
||||
}
|
||||
|
||||
-int32_t rpc_call_mempoolsize(struct protocol_stack *stack)
|
||||
+int32_t rpc_call_mbufpoolsize(struct protocol_stack *stack)
|
||||
{
|
||||
struct rpc_msg *msg = rpc_msg_alloc(stack, stack_mempool_size);
|
||||
if (msg == NULL) {
|
||||
@@ -206,6 +206,16 @@ int32_t rpc_call_mempoolsize(struct protocol_stack *stack)
|
||||
return rpc_sync_call(&stack->rpc_queue, msg);
|
||||
}
|
||||
|
||||
+int32_t rpc_call_rpcpool_size(struct protocol_stack *stack)
|
||||
+{
|
||||
+ struct rpc_msg *msg = rpc_msg_alloc(stack, stack_rpcpool_size);
|
||||
+ if (msg == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ msg->args[MSG_ARG_0].p = g_rpc_pool;
|
||||
+ return rpc_sync_call(&stack->rpc_queue, msg);
|
||||
+}
|
||||
+
|
||||
int32_t rpc_call_recvlistcnt(struct protocol_stack *stack)
|
||||
{
|
||||
struct rpc_msg *msg = rpc_msg_alloc(stack, stack_recvlist_count);
|
||||
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
|
||||
index e339b8d..6638984 100644
|
||||
--- a/src/lstack/include/lstack_protocol_stack.h
|
||||
+++ b/src/lstack/include/lstack_protocol_stack.h
|
||||
@@ -31,6 +31,8 @@
|
||||
#define SOCK_SEND_REPLENISH_THRES (16)
|
||||
#define WAKEUP_MAX_NUM (32)
|
||||
|
||||
+#define MBUFPOOL_RESERVE_NUM 5000
|
||||
+
|
||||
struct rte_mempool;
|
||||
struct rte_ring;
|
||||
struct rte_mbuf;
|
||||
@@ -45,7 +47,7 @@ struct protocol_stack {
|
||||
cpu_set_t idle_cpuset; /* idle cpu in numa of stack, app thread bind to it */
|
||||
int32_t epollfd; /* kernel event thread epoll fd */
|
||||
|
||||
- struct rte_mempool *rxtx_pktmbuf_pool;
|
||||
+ struct rte_mempool *rxtx_mbuf_pool;
|
||||
struct rte_ring *rx_ring;
|
||||
struct rte_ring *tx_ring;
|
||||
struct rte_ring *reg_ring;
|
||||
@@ -168,6 +170,7 @@ void stack_fcntl(struct rpc_msg *msg);
|
||||
void stack_ioctl(struct rpc_msg *msg);
|
||||
void stack_send(struct rpc_msg *msg);
|
||||
void stack_mempool_size(struct rpc_msg *msg);
|
||||
+void stack_rpcpool_size(struct rpc_msg *msg);
|
||||
void stack_create_shadow_fd(struct rpc_msg *msg);
|
||||
void stack_replenish_sendring(struct rpc_msg *msg);
|
||||
void stack_get_conntable(struct rpc_msg *msg);
|
||||
diff --git a/src/lstack/include/lstack_thread_rpc.h b/src/lstack/include/lstack_thread_rpc.h
|
||||
index 13f5ec2..ca8a510 100644
|
||||
--- a/src/lstack/include/lstack_thread_rpc.h
|
||||
+++ b/src/lstack/include/lstack_thread_rpc.h
|
||||
@@ -26,7 +26,7 @@
|
||||
#define MSG_ARG_4 (4)
|
||||
#define RPM_MSG_ARG_SIZE (5)
|
||||
|
||||
-#define RPC_MSG_MAX 2048
|
||||
+#define RPC_MSG_MAX 4096
|
||||
#define RPC_MSG_MASK (RPC_MSG_MAX - 1)
|
||||
|
||||
struct rpc_msg;
|
||||
@@ -48,14 +48,14 @@ struct rpc_msg {
|
||||
int8_t recall_flag : 1;
|
||||
int64_t result; /* func return val */
|
||||
lockless_queue_node queue_node;
|
||||
- struct rpc_msg_pool *pool;
|
||||
+ struct rpc_msg_pool *rpcpool;
|
||||
|
||||
rpc_msg_func func; /* msg handle func hook */
|
||||
union rpc_msg_arg args[RPM_MSG_ARG_SIZE]; /* resolve by type */
|
||||
};
|
||||
|
||||
struct rpc_msg_pool {
|
||||
- struct rte_mempool *rpc_pool;
|
||||
+ struct rte_mempool *mempool;
|
||||
};
|
||||
|
||||
struct protocol_stack;
|
||||
@@ -87,7 +87,8 @@ int32_t rpc_call_setsockopt(int fd, int level, int optname, const void *optval,
|
||||
int32_t rpc_call_fcntl(int fd, int cmd, long val);
|
||||
int32_t rpc_call_ioctl(int fd, long cmd, void *argp);
|
||||
int32_t rpc_call_replenish(struct protocol_stack *stack, struct lwip_sock *sock);
|
||||
-int32_t rpc_call_mempoolsize(struct protocol_stack *stack);
|
||||
+int32_t rpc_call_mbufpoolsize(struct protocol_stack *stack);
|
||||
+int32_t rpc_call_rpcpool_size(struct protocol_stack *stack);
|
||||
|
||||
static inline __attribute__((always_inline)) void rpc_call(lockless_queue *queue, struct rpc_msg *msg)
|
||||
{
|
||||
@@ -97,7 +98,7 @@ static inline __attribute__((always_inline)) void rpc_call(lockless_queue *queue
|
||||
static inline __attribute__((always_inline)) void rpc_msg_free(struct rpc_msg *msg)
|
||||
{
|
||||
pthread_spin_destroy(&msg->lock);
|
||||
- rte_mempool_put(msg->pool->rpc_pool, (void *)msg);
|
||||
+ rte_mempool_put(msg->rpcpool->mempool, (void *)msg);
|
||||
}
|
||||
|
||||
#endif
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index 31856f2..2e11670 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -542,9 +542,9 @@ void parse_arp_and_transefer(char* buf)
|
||||
int32_t ret;
|
||||
for (int32_t i = 0; i < stack_group->stack_num; i++) {
|
||||
stack = stack_group->stacks[i];
|
||||
- ret = dpdk_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
+ ret = dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, &mbuf_copy, 1);
|
||||
while (ret != 0) {
|
||||
- ret = dpdk_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
+ ret = dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, &mbuf_copy, 1);
|
||||
stack->stats.rx_allocmbuf_fail++;
|
||||
}
|
||||
copy_mbuf(mbuf_copy, mbuf);
|
||||
@@ -571,9 +571,9 @@ void parse_tcp_and_transefer(char* buf)
|
||||
struct rte_mbuf *mbuf_copy = NULL;
|
||||
struct protocol_stack *stack = stack_group->stacks[stk_index];
|
||||
|
||||
- int32_t ret = dpdk_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
+ int32_t ret = dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, &mbuf_copy, 1);
|
||||
while (ret != 0) {
|
||||
- ret = dpdk_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
+ ret = dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, &mbuf_copy, 1);
|
||||
stack->stats.rx_allocmbuf_fail++;
|
||||
}
|
||||
|
||||
@@ -944,7 +944,7 @@ int32_t ethdev_init(struct protocol_stack *stack)
|
||||
|
||||
if (use_ltran()) {
|
||||
stack->rx_ring_used = 0;
|
||||
- int32_t ret = fill_mbuf_to_ring(stack->rxtx_pktmbuf_pool, stack->rx_ring, RING_SIZE(VDEV_RX_QUEUE_SZ));
|
||||
+ int32_t ret = fill_mbuf_to_ring(stack->rxtx_mbuf_pool, stack->rx_ring, RING_SIZE(VDEV_RX_QUEUE_SZ));
|
||||
if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "fill mbuf to rx_ring failed ret=%d\n", ret);
|
||||
return ret;
|
||||
diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
|
||||
index e1438da..ccf664a 100644
|
||||
--- a/src/lstack/netif/lstack_vdev.c
|
||||
+++ b/src/lstack/netif/lstack_vdev.c
|
||||
@@ -57,7 +57,7 @@ static uint32_t ltran_rx_poll(struct protocol_stack *stack, struct rte_mbuf **pk
|
||||
stack->rx_ring_used += rcvd_pkts;
|
||||
if (unlikely(stack->rx_ring_used >= USED_RX_PKTS_WATERMARK)) {
|
||||
uint32_t free_cnt = LWIP_MIN(stack->rx_ring_used, RING_SIZE(DPDK_PKT_BURST_SIZE));
|
||||
- int32_t ret = dpdk_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)free_buf, free_cnt);
|
||||
+ int32_t ret = dpdk_alloc_pktmbuf(stack->rxtx_mbuf_pool, (struct rte_mbuf **)free_buf, free_cnt);
|
||||
if (likely(ret == 0)) {
|
||||
nr_pkts = gazelle_ring_sp_enqueue(stack->rx_ring, (void **)free_buf, free_cnt);
|
||||
stack->rx_ring_used -= nr_pkts;
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index d3ff527..58ab14c 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -618,7 +618,8 @@ static void show_lstack_stats(struct gazelle_stack_dfx_data *lstack_stat)
|
||||
printf("call_alloc_fail: %-12"PRIu64" ", lstack_stat->data.pkts.call_alloc_fail);
|
||||
printf("call_null: %-18"PRIu64" \n", lstack_stat->data.pkts.stack_stat.call_null);
|
||||
printf("send_pkts_fail: %-13"PRIu64" ", lstack_stat->data.pkts.stack_stat.send_pkts_fail);
|
||||
- printf("mempool_freecnt: %-12"PRIu32" \n", lstack_stat->data.pkts.mempool_freecnt);
|
||||
+ printf("mbuf_pool_freecnt: %-10"PRIu32" ", lstack_stat->data.pkts.mbufpool_avail_cnt);
|
||||
+ printf("rpc_pool_freecnt: %-12"PRIu32" \n", lstack_stat->data.pkts.rpcpool_avail_cnt);
|
||||
}
|
||||
|
||||
static void gazelle_print_lstack_stat_detail(struct gazelle_stack_dfx_data *lstack_stat,
|
||||
--
|
||||
2.27.0
|
||||
|
||||
181
0073-dfx-gazellectl-c-support-ipv6.patch
Normal file
181
0073-dfx-gazellectl-c-support-ipv6.patch
Normal file
@ -0,0 +1,181 @@
|
||||
From 61bf27272a56a426909a809a8a20dcf4220a3273 Mon Sep 17 00:00:00 2001
|
||||
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
|
||||
Date: Wed, 29 Nov 2023 11:10:51 +0800
|
||||
Subject: [PATCH] dfx: gazellectl -c support ipv6
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
日期: Thu Dec 7 14:28:51 2023 +0800
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 6 ++--
|
||||
src/common/gazelle_opt.h | 4 +++
|
||||
src/lstack/core/lstack_control_plane.c | 4 +--
|
||||
src/lstack/core/lstack_lwip.c | 8 +++---
|
||||
src/ltran/ltran_dfx.c | 39 ++++++++++++++++----------
|
||||
5 files changed, 38 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index ac6ea5e..698846f 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+#include <lwip/reg_sock.h>
|
||||
+
|
||||
#define GAZELLE_CLIENT_NUM_MIN 1
|
||||
#define GAZELLE_LOG_LEVEL_MAX 10
|
||||
#define GAZELLECTL_TIMEOUT 5000 // millisecond
|
||||
@@ -170,8 +172,8 @@ struct gazelle_stat_lstack_snmp {
|
||||
/* same as define in lwip/tcp.h - struct tcp_pcb_dp */
|
||||
struct gazelle_stat_lstack_conn_info {
|
||||
uint32_t state;
|
||||
- uint32_t rip;
|
||||
- uint32_t lip;
|
||||
+ gz_addr_t rip;
|
||||
+ gz_addr_t lip;
|
||||
uint16_t r_port;
|
||||
uint16_t l_port;
|
||||
uint32_t in_send;
|
||||
diff --git a/src/common/gazelle_opt.h b/src/common/gazelle_opt.h
|
||||
index 7316fc6..bb540f4 100644
|
||||
--- a/src/common/gazelle_opt.h
|
||||
+++ b/src/common/gazelle_opt.h
|
||||
@@ -52,6 +52,10 @@
|
||||
#define STACK_THREAD_DEFAULT 4
|
||||
#define STACK_NIC_READ_DEFAULT 128
|
||||
|
||||
+/* same as define in lwip/ip_addr.h */
|
||||
+#define GZ_ADDR_TYPE_V4 0
|
||||
+#define GZ_ADDR_TYPE_V6 6
|
||||
+
|
||||
#define MTU_DEFAULT_DATA_LEN 1460
|
||||
#define VLAN_HEAD_LEN 4
|
||||
#define IPV6_EXTRA_HEAD_LEN 20
|
||||
diff --git a/src/lstack/core/lstack_control_plane.c b/src/lstack/core/lstack_control_plane.c
|
||||
index 4633834..e7fcd26 100644
|
||||
--- a/src/lstack/core/lstack_control_plane.c
|
||||
+++ b/src/lstack/core/lstack_control_plane.c
|
||||
@@ -361,9 +361,9 @@ static int32_t reg_conn(enum tcp_list_state table_state, enum reg_ring_type reg_
|
||||
continue;
|
||||
}
|
||||
qtuple.protocol = 0;
|
||||
- qtuple.src_ip = conn->conn_list[i].lip;
|
||||
+ qtuple.src_ip = conn->conn_list[i].lip.u_addr.ip4.addr;
|
||||
qtuple.src_port = lwip_htons(conn->conn_list[i].l_port);
|
||||
- qtuple.dst_ip = conn->conn_list[i].rip;
|
||||
+ qtuple.dst_ip = conn->conn_list[i].rip.u_addr.ip4.addr;
|
||||
qtuple.dst_port = lwip_htons(conn->conn_list[i].r_port);
|
||||
|
||||
if ((table_state == LISTEN_LIST) && (!match_host_addr(qtuple.src_ip))) {
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index af9bf73..5a3b703 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -1135,8 +1135,8 @@ static void copy_pcb_to_conn(struct gazelle_stat_lstack_conn_info *conn, const s
|
||||
{
|
||||
struct netconn *netconn = (struct netconn *)pcb->callback_arg;
|
||||
|
||||
- conn->lip = ip_2_ip4(&pcb->local_ip)->addr;
|
||||
- conn->rip = ip_2_ip4(&pcb->remote_ip)->addr;
|
||||
+ conn->lip = *((gz_addr_t *)&pcb->local_ip);
|
||||
+ conn->rip = *((gz_addr_t *)&pcb->remote_ip);
|
||||
conn->l_port = pcb->local_port;
|
||||
conn->r_port = pcb->remote_port;
|
||||
conn->in_send = pcb->snd_queuelen;
|
||||
@@ -1229,11 +1229,11 @@ uint32_t do_lwip_get_conntable(struct gazelle_stat_lstack_conn_info *conn,
|
||||
for (struct tcp_pcb_listen *pcbl = tcp_listen_pcbs.listen_pcbs; pcbl != NULL && conn_num < max_num;
|
||||
pcbl = pcbl->next) {
|
||||
conn[conn_num].state = LISTEN_LIST;
|
||||
- conn[conn_num].lip = ip_2_ip4(&pcbl->local_ip)->addr;
|
||||
+ conn[conn_num].lip = *((gz_addr_t *)&pcbl->local_ip);
|
||||
conn[conn_num].l_port = pcbl->local_port;
|
||||
conn[conn_num].tcp_sub_state = pcbl->state;
|
||||
struct netconn *netconn = (struct netconn *)pcbl->callback_arg;
|
||||
- conn[conn_num].fd = netconn != NULL ? netconn->socket : -1;
|
||||
+ conn[conn_num].fd = netconn != NULL ? netconn->socket : -1;
|
||||
if (netconn != NULL && netconn->acceptmbox != NULL) {
|
||||
conn[conn_num].recv_cnt = rte_ring_count(netconn->acceptmbox->ring);
|
||||
}
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index d3ff527..273eeaa 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -233,6 +233,7 @@ static int32_t dfx_connect_ltran(bool use_ltran, bool probe)
|
||||
strlen(GAZELLE_DFX_SOCK_FILENAME) + 1);
|
||||
if (ret != EOK) {
|
||||
printf("%s:%d strncat_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||
+ goto END;
|
||||
}
|
||||
} else {
|
||||
ret = strncat_s(addr.sun_path, sizeof(addr.sun_path), GAZELLE_REG_SOCK_FILENAME,
|
||||
@@ -973,10 +974,11 @@ static void gazelle_print_lstack_stat_snmp(void *buf, const struct gazelle_stat_
|
||||
static void gazelle_print_lstack_stat_conn(void *buf, const struct gazelle_stat_msg_request *req_msg)
|
||||
{
|
||||
uint32_t i;
|
||||
- struct in_addr rip;
|
||||
- struct in_addr lip;
|
||||
- char str_ip[GAZELLE_SUBNET_LENGTH_MAX] = {0};
|
||||
- char str_rip[GAZELLE_SUBNET_LENGTH_MAX] = {0};
|
||||
+ char str_ip[INET6_ADDRSTRLEN] = {0};
|
||||
+ char str_rip[INET6_ADDRSTRLEN] = {0};
|
||||
+ /* ip:port, 6 is the length reserved for port */
|
||||
+ char str_laddr[INET6_ADDRSTRLEN + 6] = {0};
|
||||
+ char str_raddr[INET6_ADDRSTRLEN + 6] = {0};
|
||||
struct gazelle_stack_dfx_data *stat = (struct gazelle_stack_dfx_data *)buf;
|
||||
struct gazelle_stat_lstack_conn *conn = &stat->data.conn;
|
||||
struct timeval time = {0};
|
||||
@@ -986,30 +988,37 @@ static void gazelle_print_lstack_stat_conn(void *buf, const struct gazelle_stat_
|
||||
do {
|
||||
printf("\n------ stack tid: %6u ------time=%lu\n", stat->tid, time.tv_sec * 1000000 + time.tv_usec);
|
||||
printf("No. Proto lwip_recv recv_ring in_send send_ring cwn rcv_wnd snd_wnd snd_buf snd_nxt"
|
||||
- " lastack rcv_nxt events epoll_ev evlist fd Local Address "
|
||||
- "Foreign Address State\n");
|
||||
+ " lastack rcv_nxt events epoll_ev evlist fd Local Address"
|
||||
+ " Foreign Address State\n");
|
||||
uint32_t unread_pkts = 0;
|
||||
uint32_t unsend_pkts = 0;
|
||||
for (i = 0; i < conn->conn_num && i < GAZELLE_LSTACK_MAX_CONN; i++) {
|
||||
struct gazelle_stat_lstack_conn_info *conn_info = &conn->conn_list[i];
|
||||
|
||||
- rip.s_addr = conn_info->rip;
|
||||
- lip.s_addr = conn_info->lip;
|
||||
+ uint32_t domain = conn_info->lip.type == GZ_ADDR_TYPE_V4 ? AF_INET : AF_INET6;
|
||||
+ void *lip = (void *)&conn_info->lip;
|
||||
+ void *rip = (void *)&conn_info->rip;
|
||||
+
|
||||
if ((conn_info->state == GAZELLE_ACTIVE_LIST) || (conn_info->state == GAZELLE_TIME_WAIT_LIST)) {
|
||||
+ inet_ntop(domain, lip, str_ip, sizeof(str_ip));
|
||||
+ inet_ntop(domain, rip, str_rip, sizeof(str_rip));
|
||||
+ sprintf_s(str_laddr, sizeof(str_laddr), "%s:%hu", str_ip, conn_info->l_port);
|
||||
+ sprintf_s(str_raddr, sizeof(str_raddr), "%s:%hu", str_rip, conn_info->r_port);
|
||||
printf("%-6utcp %-10u%-10u%-8u%-10u%-9d%-9d%-10d%-10d%-15u%-15u%-15u%-10x%-10x%-7d%-7d"
|
||||
- "%s:%hu %s:%hu %s\n", i, conn_info->recv_cnt, conn_info->recv_ring_cnt, conn_info->in_send,
|
||||
+ "%-52s %-52s %s\n", i, conn_info->recv_cnt, conn_info->recv_ring_cnt, conn_info->in_send,
|
||||
conn_info->send_ring_cnt, conn_info->cwn, conn_info->rcv_wnd, conn_info->snd_wnd,
|
||||
conn_info->snd_buf, conn_info->snd_nxt, conn_info->lastack, conn_info->rcv_nxt, conn_info->events,
|
||||
conn_info->epoll_events, conn_info->eventlist, conn_info->fd,
|
||||
- inet_ntop(AF_INET, &lip, str_ip, sizeof(str_ip)), conn_info->l_port,
|
||||
- inet_ntop(AF_INET, &rip, str_rip, sizeof(str_rip)), conn_info->r_port,
|
||||
- tcp_state_to_str(conn_info->tcp_sub_state));
|
||||
+ str_laddr, str_raddr, tcp_state_to_str(conn_info->tcp_sub_state));
|
||||
} else if (conn_info->state == GAZELLE_LISTEN_LIST) {
|
||||
- printf("%-6utcp %-147u%-7d%s:%hu 0.0.0.0:* LISTEN\n", i, conn_info->recv_cnt,
|
||||
- conn_info->fd, inet_ntop(AF_INET, &lip, str_ip, sizeof(str_ip)), conn_info->l_port);
|
||||
+ inet_ntop(domain, lip, str_ip, sizeof(str_ip));
|
||||
+ sprintf_s(str_laddr, sizeof(str_laddr), "%s:%hu", str_ip, conn_info->l_port);
|
||||
+ sprintf_s(str_raddr, sizeof(str_raddr), "%s:*", domain == AF_INET ? "0.0.0.0" : "::0");
|
||||
+ printf("%-6utcp %-147u%-7d%-52s %-52s LISTEN\n", i, conn_info->recv_cnt,
|
||||
+ conn_info->fd, str_laddr, str_raddr);
|
||||
} else {
|
||||
printf("Got unknow tcp conn::%s:%5hu, state:%u\n",
|
||||
- inet_ntop(AF_INET, &lip, str_ip, sizeof(str_ip)), conn_info->l_port, conn_info->state);
|
||||
+ inet_ntop(domain, lip, str_ip, sizeof(str_ip)), conn_info->l_port, conn_info->state);
|
||||
}
|
||||
unread_pkts += conn_info->recv_ring_cnt + conn_info->recv_cnt;
|
||||
unsend_pkts += conn_info->send_ring_cnt + conn_info->in_send;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
From ef311f5a6c9d9c3578db836d68a3ad15727bdc15 Mon Sep 17 00:00:00 2001
|
||||
From: wuchangye <wuchangye@huawei.com>
|
||||
Date: Thu, 7 Dec 2023 14:17:49 +0800
|
||||
Subject: [PATCH] The call stack is not printed in the proactive exit scenario.
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_signal.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_signal.c b/src/lstack/api/lstack_signal.c
|
||||
index 03118f5..285aaf3 100644
|
||||
--- a/src/lstack/api/lstack_signal.c
|
||||
+++ b/src/lstack/api/lstack_signal.c
|
||||
@@ -64,7 +64,10 @@ static void lstack_sig_default_handler(int sig)
|
||||
dpdk_kni_release();
|
||||
}
|
||||
control_fd_close();
|
||||
- dump_stack();
|
||||
+ /* When operations such as pressing Ctrl+C or Kill, the call stack exit is not displayed. */
|
||||
+ if (sig != SIGINT && sig != SIGTERM && sig != SIGKILL) {
|
||||
+ dump_stack();
|
||||
+ }
|
||||
lwip_exit();
|
||||
(void)kill(getpid(), sig);
|
||||
}
|
||||
--
|
||||
2.27.0
|
||||
|
||||
69
0075-dfx-fix-gazellectl-lstack-show-ip-failed.patch
Normal file
69
0075-dfx-fix-gazellectl-lstack-show-ip-failed.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From f2080c02b864d6ce7f07b874e489bb5ea98b837a Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Wed, 6 Dec 2023 20:33:13 +0800
|
||||
Subject: [PATCH] dfx: fix 'gazellectl lstack show ip' failed
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 3 ++-
|
||||
src/ltran/ltran_dfx.c | 7 +++++--
|
||||
src/ltran/ltran_monitor.c | 2 +-
|
||||
3 files changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index ac6ea5e..d2c6ef9 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -35,9 +35,10 @@ enum GAZELLE_STAT_MODE {
|
||||
GAZELLE_STAT_LTRAN_LOG_LEVEL_SET,
|
||||
GAZELLE_STAT_LTRAN_SHOW_SOCKTABLE,
|
||||
GAZELLE_STAT_LTRAN_SHOW_CONNTABLE,
|
||||
+ GAZELLE_STAT_LTRAN_SHOW_LSTACK,
|
||||
|
||||
- GAZELLE_STAT_LSTACK_LOG_LEVEL_SET,
|
||||
GAZELLE_STAT_LSTACK_SHOW,
|
||||
+ GAZELLE_STAT_LSTACK_LOG_LEVEL_SET,
|
||||
GAZELLE_STAT_LSTACK_SHOW_RATE,
|
||||
GAZELLE_STAT_LSTACK_SHOW_SNMP,
|
||||
GAZELLE_STAT_LSTACK_SHOW_CONN,
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index d3ff527..c200b1d 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -105,8 +105,11 @@ static struct gazelle_dfx_list g_gazelle_dfx_tbl[] = {
|
||||
{GAZELLE_STAT_LTRAN_LOG_LEVEL_SET, 0, gazelle_print_ltran_wait},
|
||||
{GAZELLE_STAT_LTRAN_SHOW_SOCKTABLE, sizeof(struct gazelle_stat_forward_table), gazelle_print_ltran_sock},
|
||||
{GAZELLE_STAT_LTRAN_SHOW_CONNTABLE, sizeof(struct gazelle_stat_forward_table), gazelle_print_ltran_conn},
|
||||
+
|
||||
+ {GAZELLE_STAT_LTRAN_SHOW_LSTACK, sizeof(struct gazelle_stat_lstack_total), gazelle_print_lstack_stat_total},
|
||||
+ {GAZELLE_STAT_LSTACK_SHOW, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_total},
|
||||
+
|
||||
{GAZELLE_STAT_LSTACK_LOG_LEVEL_SET, 0, gazelle_print_ltran_wait},
|
||||
- {GAZELLE_STAT_LSTACK_SHOW, sizeof(struct gazelle_stat_lstack_total), gazelle_print_lstack_stat_total},
|
||||
{GAZELLE_STAT_LSTACK_SHOW_RATE, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_rate},
|
||||
{GAZELLE_STAT_LSTACK_SHOW_SNMP, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_snmp},
|
||||
{GAZELLE_STAT_LSTACK_SHOW_CONN, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_conn},
|
||||
@@ -1265,7 +1268,7 @@ static int32_t parse_dfx_lstack_show_args(int32_t argc, char *argv[], struct gaz
|
||||
long int delay = 1;
|
||||
|
||||
if (argc == GAZELLE_LSTACK_PARAM_NUM) {
|
||||
- req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW;
|
||||
+ req_msg[cmd_index++].stat_mode = g_use_ltran ? GAZELLE_STAT_LTRAN_SHOW_LSTACK : GAZELLE_STAT_LSTACK_SHOW;
|
||||
return cmd_index;
|
||||
}
|
||||
|
||||
diff --git a/src/ltran/ltran_monitor.c b/src/ltran/ltran_monitor.c
|
||||
index 792db89..b2bcc07 100644
|
||||
--- a/src/ltran/ltran_monitor.c
|
||||
+++ b/src/ltran/ltran_monitor.c
|
||||
@@ -338,7 +338,7 @@ static int32_t lstack_req_mode_process(int32_t fd, const struct gazelle_stat_msg
|
||||
case GAZELLE_STAT_LTRAN_SHOW_LB_RATE:
|
||||
handle_resp_lstack_total(req_msg, fd);
|
||||
break;
|
||||
- case GAZELLE_STAT_LSTACK_SHOW:
|
||||
+ case GAZELLE_STAT_LTRAN_SHOW_LSTACK:
|
||||
handle_resp_lstack_total(req_msg, fd);
|
||||
handle_resp_lstack_transfer(req_msg, fd);
|
||||
break;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
69
0076-gazellectl-add-connect-para.patch
Normal file
69
0076-gazellectl-add-connect-para.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From 175f3818dc8ea64b37c4aa804375ef1216601813 Mon Sep 17 00:00:00 2001
|
||||
From: hantwofish <hankangkang5@huawei.com>
|
||||
Date: Thu, 7 Dec 2023 00:38:00 +0800
|
||||
Subject: [PATCH] gazellectl add connect para
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 2 ++
|
||||
src/lstack/core/lstack_lwip.c | 2 ++
|
||||
src/ltran/ltran_dfx.c | 8 +++++---
|
||||
3 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index e2485ef..f91a661 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -194,6 +194,8 @@ struct gazelle_stat_lstack_conn_info {
|
||||
uint32_t events;
|
||||
uint32_t epoll_events;
|
||||
uint32_t eventlist;
|
||||
+ uint32_t keepalive;
|
||||
+ uint32_t keep_idle;
|
||||
};
|
||||
|
||||
struct gazelle_stat_lstack_conn {
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 7fb164c..5a719ea 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -1148,6 +1148,8 @@ static void copy_pcb_to_conn(struct gazelle_stat_lstack_conn_info *conn, const s
|
||||
conn->lastack = pcb->lastack;
|
||||
conn->snd_nxt = pcb->snd_nxt;
|
||||
conn->rcv_nxt = pcb->rcv_nxt;
|
||||
+ conn->keepalive = (ip_get_option(pcb, SOF_KEEPALIVE) != 0);
|
||||
+ conn->keep_idle = pcb->keep_idle;
|
||||
|
||||
if (netconn != NULL && netconn->recvmbox != NULL) {
|
||||
conn->recv_cnt = rte_ring_count(netconn->recvmbox->ring);
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index b999d20..fcbe857 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -993,7 +993,8 @@ static void gazelle_print_lstack_stat_conn(void *buf, const struct gazelle_stat_
|
||||
printf("\n------ stack tid: %6u ------time=%lu\n", stat->tid, time.tv_sec * 1000000 + time.tv_usec);
|
||||
printf("No. Proto lwip_recv recv_ring in_send send_ring cwn rcv_wnd snd_wnd snd_buf snd_nxt"
|
||||
" lastack rcv_nxt events epoll_ev evlist fd Local Address"
|
||||
- " Foreign Address State\n");
|
||||
+ " Foreign Address State"
|
||||
+ " keep-alive keep-idle\n");
|
||||
uint32_t unread_pkts = 0;
|
||||
uint32_t unsend_pkts = 0;
|
||||
for (i = 0; i < conn->conn_num && i < GAZELLE_LSTACK_MAX_CONN; i++) {
|
||||
@@ -1009,11 +1010,12 @@ static void gazelle_print_lstack_stat_conn(void *buf, const struct gazelle_stat_
|
||||
sprintf_s(str_laddr, sizeof(str_laddr), "%s:%hu", str_ip, conn_info->l_port);
|
||||
sprintf_s(str_raddr, sizeof(str_raddr), "%s:%hu", str_rip, conn_info->r_port);
|
||||
printf("%-6utcp %-10u%-10u%-8u%-10u%-9d%-9d%-10d%-10d%-15u%-15u%-15u%-10x%-10x%-7d%-7d"
|
||||
- "%-52s %-52s %s\n", i, conn_info->recv_cnt, conn_info->recv_ring_cnt, conn_info->in_send,
|
||||
+ "%-52s %-52s %s %-5d %-9u\n", i, conn_info->recv_cnt, conn_info->recv_ring_cnt, conn_info->in_send,
|
||||
conn_info->send_ring_cnt, conn_info->cwn, conn_info->rcv_wnd, conn_info->snd_wnd,
|
||||
conn_info->snd_buf, conn_info->snd_nxt, conn_info->lastack, conn_info->rcv_nxt, conn_info->events,
|
||||
conn_info->epoll_events, conn_info->eventlist, conn_info->fd,
|
||||
- str_laddr, str_raddr, tcp_state_to_str(conn_info->tcp_sub_state));
|
||||
+ str_laddr, str_raddr, tcp_state_to_str(conn_info->tcp_sub_state),
|
||||
+ conn_info->keepalive, conn_info->keep_idle);
|
||||
} else if (conn_info->state == GAZELLE_LISTEN_LIST) {
|
||||
inet_ntop(domain, lip, str_ip, sizeof(str_ip));
|
||||
sprintf_s(str_laddr, sizeof(str_laddr), "%s:%hu", str_ip, conn_info->l_port);
|
||||
--
|
||||
2.27.0
|
||||
|
||||
51
0077-log-optimize-lstack-log.patch
Normal file
51
0077-log-optimize-lstack-log.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 10db670bcca6be723361e710625452c42249002a Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Sat, 9 Dec 2023 22:31:02 +0800
|
||||
Subject: [PATCH] add
|
||||
|
||||
---
|
||||
src/common/gazelle_reg_msg.h | 2 +-
|
||||
src/lstack/core/lstack_lwip.c | 1 -
|
||||
src/lstack/core/lstack_thread_rpc.c | 1 -
|
||||
3 files changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_reg_msg.h b/src/common/gazelle_reg_msg.h
|
||||
index a944d80..d849cea 100644
|
||||
--- a/src/common/gazelle_reg_msg.h
|
||||
+++ b/src/common/gazelle_reg_msg.h
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#define GAZELLE_MAX_REG_ARGS 32
|
||||
|
||||
-#define ENQUEUE_RING_RETRY_TIMEOUT 500 // ms
|
||||
+#define ENQUEUE_RING_RETRY_TIMEOUT 10 // ms
|
||||
|
||||
#define OPT_BASE_VIRTADDR "--base-virtaddr"
|
||||
#define OPT_FILE_PREFIX "--file-prefix"
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 5a719ea..026c870 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -797,7 +797,6 @@ static inline void notice_stack_send(struct lwip_sock *sock, int32_t fd, int32_t
|
||||
if (__atomic_load_n(&sock->call_num, __ATOMIC_ACQUIRE) < 2) {
|
||||
while (rpc_call_send(fd, NULL, len, flags) < 0) {
|
||||
usleep(1000); // 1000: wait 1ms to exec again
|
||||
- LSTACK_LOG(INFO, LSTACK, "rpc_call_send failed, try again\n");
|
||||
}
|
||||
__sync_fetch_and_add(&sock->call_num, 1);
|
||||
}
|
||||
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
|
||||
index 473e908..4aceee6 100644
|
||||
--- a/src/lstack/core/lstack_thread_rpc.c
|
||||
+++ b/src/lstack/core/lstack_thread_rpc.c
|
||||
@@ -31,7 +31,6 @@ static inline __attribute__((always_inline)) struct rpc_msg *get_rpc_msg(struct
|
||||
struct rpc_msg *msg = NULL;
|
||||
ret = rte_mempool_get(rpc_pool->mempool, (void **)&msg);
|
||||
if (ret < 0) {
|
||||
- LSTACK_LOG(INFO, LSTACK, "rpc pool empty!\n");
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
--
|
||||
2.27.0
|
||||
|
||||
209
0078-support-show-nic-offload-and-features.patch
Normal file
209
0078-support-show-nic-offload-and-features.patch
Normal file
@ -0,0 +1,209 @@
|
||||
From e38f829d0c2f0e46b4c026044ed69ebbb4d2821d Mon Sep 17 00:00:00 2001
|
||||
From: wuchangye <wuchangye@huawei.com>
|
||||
Date: Fri, 8 Dec 2023 01:23:14 +0800
|
||||
Subject: [PATCH] support show nic offload and features
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 8 ++++++++
|
||||
src/lstack/Makefile | 4 ++--
|
||||
src/lstack/core/lstack_control_plane.c | 3 ++-
|
||||
src/lstack/core/lstack_dpdk.c | 17 +++++++++++++++++
|
||||
src/lstack/core/lstack_stack_stat.c | 10 +++++++---
|
||||
src/lstack/include/lstack_dpdk.h | 1 +
|
||||
src/ltran/ltran_dfx.c | 23 +++++++++++++++++++++++
|
||||
8 files changed, 61 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index e2485ef..04fe996 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -48,6 +48,7 @@ enum GAZELLE_STAT_MODE {
|
||||
GAZELLE_STAT_LSTACK_LOW_POWER_MDF,
|
||||
GAZELLE_STAT_LSTACK_SHOW_XSTATS,
|
||||
GAZELLE_STAT_LSTACK_SHOW_AGGREGATE,
|
||||
+ GAZELLE_STAT_LSTACK_SHOW_NIC_FEATURES,
|
||||
|
||||
GAZELLE_STAT_MODE_MAX,
|
||||
};
|
||||
@@ -236,6 +237,12 @@ struct nic_eth_xstats {
|
||||
uint16_t port_id;
|
||||
};
|
||||
|
||||
+struct nic_eth_features {
|
||||
+ uint16_t port_id;
|
||||
+ uint64_t rx_offload;
|
||||
+ uint64_t tx_offload;
|
||||
+};
|
||||
+
|
||||
struct gazelle_stack_dfx_data {
|
||||
/* indicates whether the current message is the last */
|
||||
uint32_t eof;
|
||||
@@ -250,6 +257,7 @@ struct gazelle_stack_dfx_data {
|
||||
struct gazelle_stat_lstack_conn conn;
|
||||
struct gazelle_stat_lstack_snmp snmp;
|
||||
struct nic_eth_xstats nic_xstats;
|
||||
+ struct nic_eth_features nic_features;
|
||||
} data;
|
||||
};
|
||||
|
||||
diff --git a/src/lstack/Makefile b/src/lstack/Makefile
|
||||
index 30965f8..d585040 100644
|
||||
--- a/src/lstack/Makefile
|
||||
+++ b/src/lstack/Makefile
|
||||
@@ -29,9 +29,9 @@ LDFLAGS = -shared -ldl -lm -lpthread -lrt -lnuma -lconfig -lboundscheck
|
||||
ARCH := $(shell uname -m)
|
||||
|
||||
ifneq ($(CC),clang)
|
||||
- SEC_FLAGS = -fstack-protector-strong -Werror -Wall -Wl,-z,relro, -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIC -D_FORTIFY_SOURCE=2
|
||||
+ SEC_FLAGS = -fstack-protector-strong -Werror -Wall -Wno-deprecated-declarations -Wl,-z,relro, -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIC -D_FORTIFY_SOURCE=2
|
||||
else
|
||||
- SEC_FLAGS = -fstack-protector-strong -Werror -Wall -fPIC
|
||||
+ SEC_FLAGS = -fstack-protector-strong -Werror -Wall -Wno-deprecated-declarations -fPIC
|
||||
endif
|
||||
$(info $(CC):$(SEC_FLAGS))
|
||||
|
||||
diff --git a/src/lstack/core/lstack_control_plane.c b/src/lstack/core/lstack_control_plane.c
|
||||
index e7fcd26..668ff80 100644
|
||||
--- a/src/lstack/core/lstack_control_plane.c
|
||||
+++ b/src/lstack/core/lstack_control_plane.c
|
||||
@@ -586,7 +586,8 @@ static int32_t handle_stat_request(int32_t sockfd)
|
||||
if (msg.stat_mode == GAZELLE_STAT_LSTACK_LOG_LEVEL_SET ||
|
||||
msg.stat_mode == GAZELLE_STAT_LSTACK_LOW_POWER_MDF) {
|
||||
return handle_proc_cmd(sockfd, &msg);
|
||||
- } else if (msg.stat_mode == GAZELLE_STAT_LSTACK_SHOW_XSTATS) {
|
||||
+ } else if (msg.stat_mode == GAZELLE_STAT_LSTACK_SHOW_XSTATS ||
|
||||
+ 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);
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 5eff915..936fd89 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -881,3 +881,20 @@ void dpdk_nic_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id)
|
||||
}
|
||||
dfx->data.nic_xstats.len = len;
|
||||
}
|
||||
+
|
||||
+void dpdk_nic_features_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id)
|
||||
+{
|
||||
+ int ret;
|
||||
+ struct rte_eth_conf dev_conf;
|
||||
+
|
||||
+ ret = rte_eth_dev_conf_get(port_id, &dev_conf);
|
||||
+ if (ret != 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rte_eth_dev_conf_get failed:%d.\n", ret);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ dfx->data.nic_features.port_id = port_id;
|
||||
+ dfx->data.nic_features.tx_offload = dev_conf.txmode.offloads;
|
||||
+ dfx->data.nic_features.rx_offload = dev_conf.rxmode.offloads;
|
||||
+ return;
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
|
||||
index 45237b0..2d85efa 100644
|
||||
--- a/src/lstack/core/lstack_stack_stat.c
|
||||
+++ b/src/lstack/core/lstack_stack_stat.c
|
||||
@@ -265,11 +265,15 @@ int handle_dpdk_cmd(int fd, enum GAZELLE_STAT_MODE stat_mode)
|
||||
|
||||
if (stat_mode == GAZELLE_STAT_LSTACK_SHOW_XSTATS) {
|
||||
dpdk_nic_xstats_get(&dfx, get_protocol_stack_group()->port_id);
|
||||
- dfx.tid = 0;
|
||||
- dfx.eof = 1;
|
||||
- send_control_cmd_data(fd, &dfx);
|
||||
+ } else if (stat_mode == GAZELLE_STAT_LSTACK_SHOW_NIC_FEATURES) {
|
||||
+ dpdk_nic_features_get(&dfx, get_protocol_stack_group()->port_id);
|
||||
+ } else {
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
+ dfx.tid = 0;
|
||||
+ dfx.eof = 1;
|
||||
+ send_control_cmd_data(fd, &dfx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
|
||||
index 724ab24..05f5bc6 100644
|
||||
--- a/src/lstack/include/lstack_dpdk.h
|
||||
+++ b/src/lstack/include/lstack_dpdk.h
|
||||
@@ -60,4 +60,5 @@ struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,
|
||||
|
||||
void dpdk_nic_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id);
|
||||
int32_t dpdk_alloc_pktmbuf(struct rte_mempool *pool, struct rte_mbuf **mbufs, uint32_t num);
|
||||
+void dpdk_nic_features_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id);
|
||||
#endif /* GAZELLE_DPDK_H */
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index b999d20..dfcdc0c 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <securec.h>
|
||||
#include <unistd.h>
|
||||
#include <rte_log.h>
|
||||
+#include <rte_ethdev.h>
|
||||
|
||||
#include "ltran_stat.h"
|
||||
#include "ltran_base.h"
|
||||
@@ -91,6 +92,7 @@ static void gazelle_print_ltran_sock(void *buf, const struct gazelle_stat_msg_re
|
||||
static void gazelle_print_ltran_conn(void *buf, const struct gazelle_stat_msg_request *req_msg);
|
||||
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 struct gazelle_dfx_list g_gazelle_dfx_tbl[] = {
|
||||
{GAZELLE_STAT_LTRAN_SHOW, sizeof(struct gazelle_stat_ltran_total), gazelle_print_ltran_stat_total},
|
||||
@@ -117,6 +119,7 @@ static struct gazelle_dfx_list g_gazelle_dfx_tbl[] = {
|
||||
{GAZELLE_STAT_LSTACK_LOW_POWER_MDF, sizeof(struct gazelle_stack_dfx_data), gazelle_print_lstack_stat_lpm},
|
||||
{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},
|
||||
};
|
||||
|
||||
static int32_t g_wait_reply = 1;
|
||||
@@ -158,6 +161,23 @@ static void gazelle_print_lstack_xstats(void *buf, const struct gazelle_stat_msg
|
||||
printf("%s############################\n", nic_stats_border);
|
||||
}
|
||||
|
||||
+static void gazelle_print_lstack_nic_features(void *buf, const struct gazelle_stat_msg_request *req_msg)
|
||||
+{
|
||||
+ struct nic_eth_features *f = &(((struct gazelle_stack_dfx_data *)buf)->data.nic_features);
|
||||
+ printf("###### NIC offload and other features for port %-2d #########\n", f->port_id);
|
||||
+
|
||||
+ printf("tx-ipv4-checksum: %s\n", (f->tx_offload & DEV_TX_OFFLOAD_IPV4_CKSUM) ? "on" : "off");
|
||||
+ printf("tx-tcp_checksum: %s\n", (f->tx_offload & DEV_TX_OFFLOAD_TCP_CKSUM) ? "on" : "off");
|
||||
+ printf("tx-tcp-tso: %s\n", (f->tx_offload & DEV_TX_OFFLOAD_TCP_TSO) ? "on" : "off");
|
||||
+ printf("tx-udp-checksum: %s\n", (f->tx_offload & DEV_TX_OFFLOAD_UDP_CKSUM) ? "on" : "off");
|
||||
+ printf("tx-vlan-insert: %s\n", (f->tx_offload & DEV_TX_OFFLOAD_VLAN_INSERT) ? "on" : "off");
|
||||
+
|
||||
+ printf("rx-ipv4-checksum: %s\n", (f->rx_offload & DEV_RX_OFFLOAD_IPV4_CKSUM) ? "on" : "off");
|
||||
+ printf("rx-tcp-checksum: %s\n", (f->rx_offload & DEV_RX_OFFLOAD_TCP_CKSUM) ? "on" : "off");
|
||||
+ printf("rx-udp-checksum: %s\n", (f->rx_offload & DEV_RX_OFFLOAD_UDP_CKSUM) ? "on" : "off");
|
||||
+ printf("rx-vlan-strip: %s\n", (f->rx_offload & DEV_RX_OFFLOAD_VLAN_STRIP) ? "on" : "off");
|
||||
+}
|
||||
+
|
||||
static void gazelle_print_ltran_conn(void *buf, const struct gazelle_stat_msg_request *req_msg)
|
||||
{
|
||||
struct gazelle_stat_forward_table *table = (struct gazelle_stat_forward_table *)buf;
|
||||
@@ -1069,6 +1089,7 @@ static void show_usage(void)
|
||||
" -c, connect show lstack connect \n"
|
||||
" -l, latency [time] show lstack latency \n"
|
||||
" -x, xstats show lstack xstats \n"
|
||||
+ " -k, nic-features show state of protocol offload and other features \n"
|
||||
" -a, aggregatin [time] show lstack send/recv aggregation \n"
|
||||
" set: \n"
|
||||
" loglevel {error | info | debug} set lstack loglevel \n"
|
||||
@@ -1316,6 +1337,8 @@ static int32_t parse_dfx_lstack_show_args(int32_t argc, char *argv[], struct gaz
|
||||
if (parse_delay_arg(argc, argv, delay) != 0) {
|
||||
return 0;
|
||||
}
|
||||
+ } else if (strcmp(param, "-k") == 0 || strcmp(param, "nic-features") == 0) {
|
||||
+ req_msg[cmd_index++].stat_mode = GAZELLE_STAT_LSTACK_SHOW_NIC_FEATURES;
|
||||
}
|
||||
|
||||
return cmd_index;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
From b8f23521a5454ba0b7b1d262dfad8aa59eb328ed Mon Sep 17 00:00:00 2001
|
||||
From: wuchangye <wuchangye@huawei.com>
|
||||
Date: Fri, 8 Dec 2023 09:43:43 +0800
|
||||
Subject: [PATCH] Fixed an issue where no packet is sent or received when UDP
|
||||
traffic is sent
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_lwip.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 026c870..c4b1ebc 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -443,6 +443,7 @@ static inline ssize_t app_buff_write(struct lwip_sock *sock, void *buf, size_t l
|
||||
for (int i = 0; i < write_num; i++) {
|
||||
pbufs[i]->addr.u_addr.ip4.addr = saddr->sin_addr.s_addr;
|
||||
pbufs[i]->port = lwip_ntohs((saddr)->sin_port);
|
||||
+ IP_SET_TYPE(&pbufs[i]->addr, IPADDR_TYPE_V4);
|
||||
}
|
||||
} else if (addr->sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *saddr = (struct sockaddr_in6 *)addr;
|
||||
@@ -450,6 +451,7 @@ static inline ssize_t app_buff_write(struct lwip_sock *sock, void *buf, size_t l
|
||||
memcpy_s(pbufs[i]->addr.u_addr.ip6.addr, sizeof(pbufs[i]->addr.u_addr.ip6.addr),
|
||||
saddr->sin6_addr.s6_addr, sizeof(saddr->sin6_addr.s6_addr));
|
||||
pbufs[i]->port = lwip_ntohs((saddr)->sin6_port);
|
||||
+ IP_SET_TYPE(&pbufs[i]->addr, IPADDR_TYPE_V6);
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
46
0080-fix-example-print-error.patch
Normal file
46
0080-fix-example-print-error.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 881bf800f35c79f778b1cdb401ad7ff780b010e9 Mon Sep 17 00:00:00 2001
|
||||
From: yangchen <yangchen145@huawei.com>
|
||||
Date: Wed, 6 Dec 2023 12:23:51 +0800
|
||||
Subject: [PATCH] fix example print error
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_epoll.c | 7 +------
|
||||
src/lstack/api/lstack_wrap.c | 4 ++++
|
||||
2 files changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
|
||||
index a2d2a9b..7825bed 100644
|
||||
--- a/src/lstack/api/lstack_epoll.c
|
||||
+++ b/src/lstack/api/lstack_epoll.c
|
||||
@@ -941,12 +941,7 @@ static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_s
|
||||
|
||||
int lstack_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeval)
|
||||
{
|
||||
- if (maxfd == 0) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "select maxfd is zero\n");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if (maxfd < 0 || maxfd > FD_SETSIZE || (readfds == NULL && writefds == NULL && exceptfds == NULL)) {
|
||||
+ if (maxfd < 0 || maxfd > FD_SETSIZE) {
|
||||
LSTACK_LOG(ERR, LSTACK, "select input param error, fd num=%d\n", maxfd);
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
}
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index abbf8a1..69a1409 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -595,6 +595,10 @@ static int32_t do_sigaction(int32_t signum, const struct sigaction *act, struct
|
||||
|
||||
static int32_t do_select(int32_t nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
{
|
||||
+ if ((select_posix_path() == PATH_KERNEL) || !(readfds || writefds || exceptfds) || nfds == 0) {
|
||||
+ return posix_api->select_fn(nfds, readfds, writefds, exceptfds, timeout);
|
||||
+ }
|
||||
+
|
||||
return posix_api->select_fn(nfds, readfds, writefds, exceptfds, timeout);
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
33
gazelle.spec
33
gazelle.spec
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.2
|
||||
Release: 17
|
||||
Release: 18
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -79,6 +79,21 @@ Patch9062: 0062-stack-fix-coredump-caused-by-gazelleclt-in-rtc-mode.patch
|
||||
Patch9063: 0063-dfx-add-tcp-exception-and-kernel-event-statistics.patch
|
||||
Patch9064: 0064-add-vlan_id-in-netif.patch
|
||||
Patch9065: 0065-support-vlan-offload.patch
|
||||
Patch9066: 0066-gazellectl-fix-gazellectl-lstack-show-1-r-error.patch
|
||||
Patch9067: 0067-fix-coredump-because-sock-closed-before-send-data-fu.patch
|
||||
Patch9068: 0068-fix-compilation-error.patch
|
||||
Patch9069: 0069-fix-coredump-because-of-addr-null-in-lwip_fill_sendr.patch
|
||||
Patch9070: 0070-add-struct-gz_addr_t.patch
|
||||
Patch9071: 0071-wrap-support-shutdown.patch
|
||||
Patch9072: 0072-1.solve-the-problem-of-1w-connection-not-being-able-.patch
|
||||
Patch9073: 0073-dfx-gazellectl-c-support-ipv6.patch
|
||||
Patch9074: 0074-The-call-stack-is-not-printed-in-the-proactive-exit-.patch
|
||||
Patch9075: 0075-dfx-fix-gazellectl-lstack-show-ip-failed.patch
|
||||
Patch9076: 0076-gazellectl-add-connect-para.patch
|
||||
Patch9077: 0077-log-optimize-lstack-log.patch
|
||||
Patch9078: 0078-support-show-nic-offload-and-features.patch
|
||||
Patch9079: 0079-Fixed-an-issue-where-no-packet-is-sent-or-received-w.patch
|
||||
Patch9080: 0080-fix-example-print-error.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -120,6 +135,22 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Sat Dec 9 2023 yinbin6 <yinbin8@huawei.com> - 1.0.2-18
|
||||
- Fixed an issue where no packet is sent or received when UDP traffic is sent
|
||||
- support show nic offload and features
|
||||
- log: optimize lstack log
|
||||
- gazellectl add connect para
|
||||
- dfx: fix 'gazellectl lstack show ip' failed
|
||||
- The call stack is not printed in the proactive exit scenario.
|
||||
- dfx: gazellectl -c support ipv6
|
||||
- 1.solve the problem of 1w connection not being able to ping 2.add debug info : rpc_mempool availd size
|
||||
- wrap: support shutdown
|
||||
- add struct gz_addr_t
|
||||
- fix coredump because of addr null in lwip_fill_sendring
|
||||
- fix compilation error
|
||||
- fix coredump because sock closed before send data fully
|
||||
- gazellectl: fix gazellectl lstack show 1 -r error
|
||||
|
||||
* Wed Nov 29 2023 yinbin6 <yinbin8@huawei.com> - 1.0.2-17
|
||||
- support vlan offload
|
||||
- add vlan_id in netif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user