!735 [sync] PR-732: sync patch from openEuler/gazelle
From: @openeuler-sync-bot Reviewed-by: @jiangheng12 Signed-off-by: @jiangheng12
This commit is contained in:
commit
d727ef182f
@ -0,0 +1,24 @@
|
||||
From f8321fa815ca33267bd5b829fd8c06b75ab215d1 Mon Sep 17 00:00:00 2001
|
||||
From: zhangmengxuan <zhangmengxuan@kylinos.cn>
|
||||
Date: Tue, 12 Mar 2024 19:51:57 +0800
|
||||
Subject: [PATCH] ensure the bond interface flow_type_rss_offloads match slave
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_dpdk.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 5811918..a774d45 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -584,6 +584,7 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
|
||||
dev_info.rx_offload_capa = slave_dev_info.rx_offload_capa;
|
||||
dev_info.tx_offload_capa = slave_dev_info.tx_offload_capa;
|
||||
dev_info.reta_size = slave_dev_info.reta_size;
|
||||
+ dev_info.flow_type_rss_offloads = slave_dev_info.flow_type_rss_offloads;
|
||||
}
|
||||
|
||||
eth_params_checksum(ð_params->conf, &dev_info);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
315
0150-FAULT-INJECT-add-duplicate-and-reorder-methods.patch
Normal file
315
0150-FAULT-INJECT-add-duplicate-and-reorder-methods.patch
Normal file
@ -0,0 +1,315 @@
|
||||
From 1929cc2a07a8e6d6a81b13a8338d816d7f09e709 Mon Sep 17 00:00:00 2001
|
||||
From: yinbin6 <yinbin8@huawei.com>
|
||||
Date: Wed, 6 Mar 2024 10:51:42 +0800
|
||||
Subject: [PATCH] FAULT INJECT: add duplicate and reorder methods
|
||||
|
||||
---
|
||||
src/common/gazelle_fault_inject_common.h | 4 +-
|
||||
src/lstack/netif/lstack_fault_inject.c | 162 ++++++++++++++++++++++-
|
||||
src/ltran/ltran_dfx.c | 20 ++-
|
||||
3 files changed, 174 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_fault_inject_common.h b/src/common/gazelle_fault_inject_common.h
|
||||
index 3a77f39..72d778c 100644
|
||||
--- a/src/common/gazelle_fault_inject_common.h
|
||||
+++ b/src/common/gazelle_fault_inject_common.h
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
enum GAZELLE_FAULT_INJECT_TYPE {
|
||||
GAZELLE_FAULT_INJECT_TYPE_ERR = 0,
|
||||
- GAZELLE_FAULT_INJECT_PACKET_DELAY,
|
||||
GAZELLE_FAULT_INJECT_PACKET_LOSS,
|
||||
- GAZELLE_FAULT_INJECT_PACKAET_DUPLICATE,
|
||||
GAZELLE_FAULT_INJECT_PACKET_REORDER,
|
||||
+ GAZELLE_FAULT_INJECT_PACKET_DELAY,
|
||||
+ GAZELLE_FAULT_INJECT_PACKAET_DUPLICATE,
|
||||
GAZELLE_FAULT_INJECT_TYPE_MAX,
|
||||
};
|
||||
|
||||
diff --git a/src/lstack/netif/lstack_fault_inject.c b/src/lstack/netif/lstack_fault_inject.c
|
||||
index 41e7d95..4edc6cc 100644
|
||||
--- a/src/lstack/netif/lstack_fault_inject.c
|
||||
+++ b/src/lstack/netif/lstack_fault_inject.c
|
||||
@@ -9,7 +9,7 @@
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
-
|
||||
+#include <pthread.h>
|
||||
#include <securec.h>
|
||||
#include <rte_gro.h>
|
||||
#include <rte_net.h>
|
||||
@@ -31,6 +31,15 @@ struct inject_tbl {
|
||||
};
|
||||
static struct inject_tbl g_inject_tbl[GAZELLE_FAULT_INJECT_TYPE_MAX];
|
||||
|
||||
+struct reorder_stat {
|
||||
+ int32_t enable;
|
||||
+ int32_t arr_size;
|
||||
+ int32_t cur_cnt;
|
||||
+ struct rte_mbuf **array;
|
||||
+};
|
||||
+
|
||||
+static struct reorder_stat g_reorder[PROTOCOL_STACK_MAX];
|
||||
+
|
||||
struct inject_func_tbl {
|
||||
enum GAZELLE_FAULT_INJECT_TYPE type;
|
||||
enum GAZELLE_FAULT_INJECT_RULE rule;
|
||||
@@ -41,10 +50,16 @@ static int32_t inject_packet_delay_random(struct protocol_stack *stack, struct r
|
||||
uint32_t nr_pkts, struct gazelle_fault_inject_data data);
|
||||
static int32_t inject_packet_loss_random(struct protocol_stack *stack, struct rte_mbuf **pkts,
|
||||
uint32_t nr_pkts, struct gazelle_fault_inject_data data);
|
||||
+static int32_t inject_packet_duplicate_random(struct protocol_stack *stack, struct rte_mbuf **pkts,
|
||||
+ uint32_t nr_pkts, struct gazelle_fault_inject_data data);
|
||||
+static int32_t inject_packet_reorder_random(struct protocol_stack *stack, struct rte_mbuf **pkts,
|
||||
+ uint32_t nr_pkts, struct gazelle_fault_inject_data data);
|
||||
|
||||
static struct inject_func_tbl g_inject_func_tbl[] = {
|
||||
{GAZELLE_FAULT_INJECT_PACKET_LOSS, INJECT_LOSS_RANDOM, inject_packet_loss_random},
|
||||
{GAZELLE_FAULT_INJECT_PACKET_DELAY, INJECT_DELAY_RANDOM, inject_packet_delay_random},
|
||||
+ {GAZELLE_FAULT_INJECT_PACKAET_DUPLICATE, INJECT_DUPLICATE_RANDOM, inject_packet_duplicate_random},
|
||||
+ {GAZELLE_FAULT_INJECT_PACKET_REORDER, INJECT_REORDER_RANDOM, inject_packet_reorder_random},
|
||||
};
|
||||
|
||||
static int32_t inject_func_tbl_update()
|
||||
@@ -68,16 +83,16 @@ static int32_t inject_func_tbl_update()
|
||||
static uint32_t inject_tx_xmit(struct protocol_stack *stack, struct rte_mbuf **pkts, uint32_t nr_pkts)
|
||||
{
|
||||
for (int32_t i = 0; i < GAZELLE_FAULT_INJECT_TYPE_MAX; ++i) {
|
||||
- if (g_inject_tbl[i].inject_data.fault_inject_on) {
|
||||
+ if (g_inject_tbl[i].inject_data.fault_inject_on && g_inject_tbl[i].inject_func) {
|
||||
int32_t xmit_pkts = 0;
|
||||
- xmit_pkts = g_inject_tbl[i].inject_func(stack, pkts, nr_pkts,
|
||||
- g_inject_tbl[i].inject_data);
|
||||
+ xmit_pkts = g_inject_tbl[i].inject_func(stack, pkts, nr_pkts, g_inject_tbl[i].inject_data);
|
||||
if (xmit_pkts == nr_pkts) {
|
||||
continue;
|
||||
}
|
||||
return xmit_pkts;
|
||||
}
|
||||
}
|
||||
+
|
||||
if (rte_mbuf_refcnt_read(*pkts) == 1) {
|
||||
return nr_pkts;
|
||||
}
|
||||
@@ -105,7 +120,7 @@ static int32_t inject_strategy_update()
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
-
|
||||
+
|
||||
for (uint32_t i = 0; i < stack_group->stack_num; ++i) {
|
||||
struct protocol_stack *stack = stack_group->stacks[i];
|
||||
vdev_dev_ops_init(&stack->dev_ops);
|
||||
@@ -150,6 +165,132 @@ static int32_t inject_packet_loss_random(struct protocol_stack *stack, struct rt
|
||||
return nr_pkts;
|
||||
}
|
||||
|
||||
+static int32_t inject_packet_duplicate_random(struct protocol_stack *stack, struct rte_mbuf **pkts,
|
||||
+ uint32_t nr_pkts, struct gazelle_fault_inject_data data)
|
||||
+{
|
||||
+ if (rte_mbuf_refcnt_read(*pkts) == 1) {
|
||||
+ return nr_pkts;
|
||||
+ }
|
||||
+
|
||||
+ double duplicate_rate = data.inject_data.duplicate.duplicate_rate;
|
||||
+ int32_t boundary = (int32_t) (duplicate_rate * INJECT_MODULO);
|
||||
+ int32_t count_max = data.inject_data.duplicate.duplicate_sigle_count;
|
||||
+
|
||||
+ uint32_t rand_num = rte_rand() % INJECT_MODULO;
|
||||
+ if (rand_num > boundary) {
|
||||
+ return nr_pkts;
|
||||
+ }
|
||||
+
|
||||
+ struct rte_mempool *mp = stack->rxtx_mbuf_pool;
|
||||
+ struct rte_mbuf *mbuf_clone = NULL;
|
||||
+ int32_t ret = 0;
|
||||
+
|
||||
+ for (int32_t i = 0; i < nr_pkts; ++i) {
|
||||
+ int32_t count = count_max;
|
||||
+ while (count--) {
|
||||
+ mbuf_clone = rte_pktmbuf_clone(pkts[i], mp);
|
||||
+ rte_pktmbuf_free(pkts[i]);
|
||||
+ if (mbuf_clone == NULL) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "fault inject mbuf_clone fail.\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ ret = vdev_tx_xmit(stack, &mbuf_clone, 1);
|
||||
+ if (ret < 1) {
|
||||
+ rte_pktmbuf_free(mbuf_clone);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return nr_pkts;
|
||||
+}
|
||||
+
|
||||
+static int32_t send_reorder_array(struct protocol_stack *stack)
|
||||
+{
|
||||
+ int32_t idx = stack->stack_idx;
|
||||
+ int32_t ret = 0;
|
||||
+
|
||||
+ for (int32_t i = 0; i < g_reorder[idx].cur_cnt; ++i) {
|
||||
+ ret = vdev_tx_xmit(stack, g_reorder[idx].array + i, 1);
|
||||
+ if (ret < 1) {
|
||||
+ rte_pktmbuf_free(*(g_reorder[idx].array + i));
|
||||
+ }
|
||||
+ }
|
||||
+ g_reorder[idx].cur_cnt = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int32_t inject_packet_reorder_random(struct protocol_stack *stack, struct rte_mbuf **pkts,
|
||||
+ uint32_t nr_pkts, struct gazelle_fault_inject_data data)
|
||||
+{
|
||||
+ if (rte_mbuf_refcnt_read(*pkts) == 1) {
|
||||
+ return nr_pkts;
|
||||
+ }
|
||||
+
|
||||
+ double reorder_rate = data.inject_data.reorder.reorder_rate;
|
||||
+ int32_t boundary = (int32_t) (reorder_rate * INJECT_MODULO);
|
||||
+ int32_t count_max = data.inject_data.reorder.reorder_sigle_count;
|
||||
+
|
||||
+ uint32_t rand_num = rte_rand() % INJECT_MODULO;
|
||||
+ if (rand_num > boundary) {
|
||||
+ return nr_pkts;
|
||||
+ }
|
||||
+
|
||||
+ struct rte_mempool *mp = stack->rxtx_mbuf_pool;
|
||||
+ struct rte_mbuf *mbuf_clone = NULL;
|
||||
+ int32_t idx = stack->stack_idx;
|
||||
+ for (int32_t i = 0; i < nr_pkts; ++i) {
|
||||
+ if (g_reorder[idx].cur_cnt < count_max) {
|
||||
+ mbuf_clone = rte_pktmbuf_clone(pkts[i], mp);
|
||||
+ if (mbuf_clone == NULL) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "fault inject mbuf_clone fail.\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ *(g_reorder[idx].array + g_reorder[idx].cur_cnt++) = mbuf_clone;
|
||||
+ /* func rte_pktmbuf_clone will add refcnt of mbuf, so following operation will free mbuf double */
|
||||
+ rte_pktmbuf_free(pkts[i]);
|
||||
+ rte_pktmbuf_free(pkts[i]);
|
||||
+ } else {
|
||||
+ send_reorder_array(stack);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return nr_pkts;
|
||||
+}
|
||||
+
|
||||
+static int32_t inject_reorder_mem_release()
|
||||
+{
|
||||
+ struct protocol_stack_group *stack_group = get_protocol_stack_group();
|
||||
+
|
||||
+ for (uint32_t i = 0; i < stack_group->stack_num; ++i) {
|
||||
+ struct protocol_stack *stack = stack_group->stacks[i];
|
||||
+ if (!g_reorder[i].enable) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ send_reorder_array(stack);
|
||||
+ free(g_reorder[i].array);
|
||||
+ g_reorder[i].enable = 0;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int32_t inject_reorder_mem_alloc()
|
||||
+{
|
||||
+ struct protocol_stack_group *stack_group = get_protocol_stack_group();
|
||||
+
|
||||
+ for (uint32_t i = 0; i < stack_group->stack_num; ++i) {
|
||||
+ g_reorder[i].enable = 1;
|
||||
+
|
||||
+ g_reorder[i].arr_size =
|
||||
+ g_inject_tbl[GAZELLE_FAULT_INJECT_PACKET_REORDER].inject_data.inject_data.reorder.reorder_sigle_count;
|
||||
+ g_reorder[i].cur_cnt = 0;
|
||||
+ g_reorder[i].array =
|
||||
+ (struct rte_mbuf**) malloc(sizeof(struct rte_mbuf**) * (g_reorder[i].arr_size));
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int32_t inject_respond_msg(int32_t sockfd)
|
||||
{
|
||||
struct gazelle_stack_dfx_data rsp = {0};
|
||||
@@ -192,6 +333,10 @@ static int32_t inject_unset_cmd(int32_t sockfd, struct gazelle_fault_inject_data
|
||||
}
|
||||
}
|
||||
|
||||
+ if (!g_inject_tbl[GAZELLE_FAULT_INJECT_PACKET_REORDER].inject_data.fault_inject_on) {
|
||||
+ inject_reorder_mem_release();
|
||||
+ }
|
||||
+
|
||||
inject_strategy_update();
|
||||
|
||||
return inject_respond_msg(sockfd);
|
||||
@@ -208,8 +353,13 @@ static int32_t inject_set_cmd(int32_t sockfd, struct gazelle_fault_inject_data i
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (inject.inject_type == GAZELLE_FAULT_INJECT_PACKET_REORDER) {
|
||||
+ inject_reorder_mem_release();
|
||||
+ inject_reorder_mem_alloc();
|
||||
+ }
|
||||
+
|
||||
inject_strategy_update();
|
||||
-
|
||||
+
|
||||
return inject_respond_msg(sockfd);
|
||||
}
|
||||
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index 96509e5..2cc3504 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -77,10 +77,10 @@ struct gazelle_fault_inject_type_list {
|
||||
};
|
||||
|
||||
static struct gazelle_fault_inject_type_list inject_type_list[] = {
|
||||
- {"delay", GAZELLE_FAULT_INJECT_PACKET_DELAY, parse_inject_packet_delay_digit},
|
||||
{"loss", GAZELLE_FAULT_INJECT_PACKET_LOSS, parse_inject_packet_loss_digit},
|
||||
- {"duplicate", GAZELLE_FAULT_INJECT_PACKAET_DUPLICATE, parse_inject_packet_duplicate_digit},
|
||||
{"reorder", GAZELLE_FAULT_INJECT_PACKET_REORDER, parse_inject_packet_reorder_digit},
|
||||
+ {"delay", GAZELLE_FAULT_INJECT_PACKET_DELAY, parse_inject_packet_delay_digit},
|
||||
+ {"duplicate", GAZELLE_FAULT_INJECT_PACKAET_DUPLICATE, parse_inject_packet_duplicate_digit},
|
||||
};
|
||||
|
||||
struct gazelle_fault_inject_rule_list {
|
||||
@@ -1514,7 +1514,7 @@ static void gazelle_print_fault_inject_type_info(struct gazelle_fault_inject_dat
|
||||
}
|
||||
|
||||
if (inject->inject_type == GAZELLE_FAULT_INJECT_PACKET_DELAY) {
|
||||
- printf("\t| inject_type: delay | delay_time: %-7d | delay_range: %-3d | "
|
||||
+ printf("\t| inject_type: delay | delay_time: %-7d | delay_range: %-3d | "
|
||||
"inject_rule: random |\n", inject->inject_data.delay.delay_time,
|
||||
inject->inject_data.delay.delay_range);
|
||||
}
|
||||
@@ -1522,10 +1522,22 @@ static void gazelle_print_fault_inject_type_info(struct gazelle_fault_inject_dat
|
||||
#define INJECT_PERCENT 100
|
||||
|
||||
if (inject->inject_type == GAZELLE_FAULT_INJECT_PACKET_LOSS) {
|
||||
- printf("\t| inject_type: loss | loss_rate: %-3.1f%% | loss_single_count: %-3d | "
|
||||
+ printf("\t| inject_type: loss | loss_rate: %-4.1f%% | loss_single_count: %-3d | "
|
||||
"inject_rule: random |\n", inject->inject_data.loss.loss_rate * INJECT_PERCENT,
|
||||
inject->inject_data.loss.loss_sigle_count);
|
||||
}
|
||||
+
|
||||
+ if (inject->inject_type == GAZELLE_FAULT_INJECT_PACKAET_DUPLICATE) {
|
||||
+ printf("\t| inject_type: duplicate | duplicate_rate: %-4.1f%% | duplicate_single_count: %-3d | "
|
||||
+ "inject_rule: random |\n", inject->inject_data.duplicate.duplicate_rate * INJECT_PERCENT,
|
||||
+ inject->inject_data.duplicate.duplicate_sigle_count);
|
||||
+ }
|
||||
+
|
||||
+ if (inject->inject_type == GAZELLE_FAULT_INJECT_PACKET_REORDER) {
|
||||
+ printf("\t| inject_type: reorder | reorder_rate: %-4.1f%% | reorder_sigle_count: %-3d | "
|
||||
+ "inject_rule: random |\n", inject->inject_data.reorder.reorder_rate * INJECT_PERCENT,
|
||||
+ inject->inject_data.reorder.reorder_sigle_count);
|
||||
+ }
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
51
0151-select-timeout-arguments-check.patch
Normal file
51
0151-select-timeout-arguments-check.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From fbd169eb504f5edc905f07f33785ba3df5812b4c Mon Sep 17 00:00:00 2001
|
||||
From: li_yunqing <liyunqing@kylinos.cn>
|
||||
Date: Thu, 14 Mar 2024 16:37:27 +0800
|
||||
Subject: [PATCH] select timeout arguments check
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_epoll.c | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
|
||||
index 7dbef9d..c9d1f0c 100644
|
||||
--- a/src/lstack/api/lstack_epoll.c
|
||||
+++ b/src/lstack/api/lstack_epoll.c
|
||||
@@ -927,13 +927,17 @@ static void fds_poll2select(struct pollfd *fds, nfds_t nfds, fd_set *readfds, fd
|
||||
}
|
||||
}
|
||||
|
||||
-static inline int timeval_to_ms(struct timeval *timeval)
|
||||
+static inline int timeval_to_ms(struct timeval *timeval, int32_t *timeout)
|
||||
{
|
||||
- if (timeval == NULL) {
|
||||
+ if (!timeval) {
|
||||
+ *timeout = -1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (unlikely((timeval->tv_sec < 0 || timeval->tv_usec < 0 || timeval->tv_usec >= 1000000))) {
|
||||
return -1;
|
||||
}
|
||||
-
|
||||
- return (timeval->tv_sec * 1000 + timeval->tv_usec / 1000);
|
||||
+ *timeout = timeval->tv_sec * 1000 + timeval->tv_usec / 1000;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct pollfd *fds)
|
||||
@@ -969,7 +973,11 @@ int lstack_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfd
|
||||
/* Convert the select parameter to the poll parameter. */
|
||||
struct pollfd fds[FD_SETSIZE] = { 0 };
|
||||
nfds_t nfds = fds_select2poll(maxfd, readfds, writefds, exceptfds, fds);
|
||||
- int timeout = timeval_to_ms(timeval);
|
||||
+ int timeout = 0;
|
||||
+ if (timeval_to_ms(timeval, &timeout)) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "select input param timeout error.\n");
|
||||
+ GAZELLE_RETURN(EINVAL);
|
||||
+ }
|
||||
|
||||
int event_num = lstack_poll(fds, nfds, timeout);
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
213
0152-recvfrom-support-timeout.patch
Normal file
213
0152-recvfrom-support-timeout.patch
Normal file
@ -0,0 +1,213 @@
|
||||
From e19bb18fad80ed95fb68318fc6ec7f2f892942dd Mon Sep 17 00:00:00 2001
|
||||
From: li_yunqing <liyunqing@kylinos.cn>
|
||||
Date: Tue, 19 Mar 2024 21:06:07 +0800
|
||||
Subject: [PATCH] recvfrom support timeout
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_epoll.c | 57 ++++++++++++++++---------
|
||||
src/lstack/api/lstack_wrap.c | 1 -
|
||||
src/lstack/core/lstack_lwip.c | 28 +++++-------
|
||||
src/lstack/core/lstack_protocol_stack.c | 2 +-
|
||||
src/lstack/include/posix/lstack_epoll.h | 10 +----
|
||||
5 files changed, 50 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
|
||||
index 7dbef9d..1b68c36 100644
|
||||
--- a/src/lstack/api/lstack_epoll.c
|
||||
+++ b/src/lstack/api/lstack_epoll.c
|
||||
@@ -586,6 +586,41 @@ static void ms_to_timespec(struct timespec *timespec, int32_t timeout)
|
||||
timespec->tv_nsec = timespec->tv_nsec % SEC_TO_NSEC;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * Block lstack thread
|
||||
+ *
|
||||
+ * @param wakeup
|
||||
+ * The pointer to the wakeup_poll.
|
||||
+ * @param timeout
|
||||
+ * The time to wait, if 'timeout <= 0' will block until unlock
|
||||
+ *
|
||||
+ * @return
|
||||
+ * - return '0' on unlock
|
||||
+ * - return 'ETIMEDOUT' on timeout
|
||||
+ */
|
||||
+int32_t lstack_block_wait(struct wakeup_poll *wakeup, int32_t timeout)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+ if (wakeup == NULL) {
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ __atomic_store_n(&wakeup->in_wait, true, __ATOMIC_RELEASE);
|
||||
+ if (timeout > 0) {
|
||||
+ struct timespec timespec;
|
||||
+ ms_to_timespec(×pec, timeout);
|
||||
+ ret = pthread_mutex_timedlock(&wakeup->wait, ×pec);
|
||||
+ } else {
|
||||
+ ret = pthread_mutex_lock(&wakeup->wait);
|
||||
+ }
|
||||
+
|
||||
+ if (__atomic_load_n(&wakeup->in_wait, __ATOMIC_ACQUIRE)) {
|
||||
+ __atomic_store_n(&wakeup->in_wait, false, __ATOMIC_RELEASE);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
int32_t lstack_rtc_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t maxevents, int32_t timeout)
|
||||
{
|
||||
struct lwip_sock *sock = get_socket_by_fd(epfd);
|
||||
@@ -645,7 +680,6 @@ int32_t lstack_rtw_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t
|
||||
struct wakeup_poll *wakeup = sock->wakeup;
|
||||
int32_t kernel_num = 0;
|
||||
int32_t lwip_num = 0;
|
||||
- int32_t ret = 0;
|
||||
|
||||
if (get_global_cfg_params()->app_bind_numa) {
|
||||
epoll_bind_statck(sock->wakeup);
|
||||
@@ -669,15 +703,7 @@ int32_t lstack_rtw_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t
|
||||
if (timeout == 0) {
|
||||
break;
|
||||
}
|
||||
-
|
||||
- if (timeout < 0) {
|
||||
- ret = pthread_mutex_lock(&wakeup->wait);
|
||||
- } else {
|
||||
- struct timespec epoll_time;
|
||||
- ms_to_timespec(&epoll_time, timeout);
|
||||
- ret = pthread_mutex_timedlock(&wakeup->wait, &epoll_time);
|
||||
- }
|
||||
- } while (ret == 0);
|
||||
+ } while (lstack_block_wait(wakeup, timeout) == 0);
|
||||
|
||||
__atomic_store_n(&wakeup->in_wait, false, __ATOMIC_RELEASE);
|
||||
wakeup->stat.app_events += lwip_num;
|
||||
@@ -857,7 +883,6 @@ int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||
|
||||
int32_t kernel_num = 0;
|
||||
int32_t lwip_num = 0;
|
||||
- int32_t ret;
|
||||
|
||||
do {
|
||||
__atomic_store_n(&wakeup->in_wait, true, __ATOMIC_RELEASE);
|
||||
@@ -881,15 +906,7 @@ int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||
if (timeout == 0) {
|
||||
break;
|
||||
}
|
||||
-
|
||||
- if (timeout < 0) {
|
||||
- ret = pthread_mutex_lock(&wakeup->wait);
|
||||
- } else {
|
||||
- struct timespec epoll_time;
|
||||
- ms_to_timespec(&epoll_time, timeout);
|
||||
- ret = pthread_mutex_timedlock(&wakeup->wait, &epoll_time);
|
||||
- }
|
||||
- } while (ret == 0);
|
||||
+ } while (lstack_block_wait(wakeup, timeout) == 0);
|
||||
|
||||
__atomic_store_n(&wakeup->in_wait, false, __ATOMIC_RELEASE);
|
||||
wakeup->stat.app_events += lwip_num;
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index 49bbf91..0dac82e 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -380,7 +380,6 @@ static bool unsupport_socket_optname(int32_t optname)
|
||||
if ((optname == SO_BROADCAST) ||
|
||||
(optname == SO_PROTOCOL) ||
|
||||
(optname == SO_SNDTIMEO) ||
|
||||
- (optname == SO_RCVTIMEO) ||
|
||||
(optname == SO_SNDBUF) ||
|
||||
(optname == SO_RCVBUF) ||
|
||||
(optname == SO_DONTROUTE)) {
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 8aae433..d0dea80 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -859,39 +859,33 @@ static bool recv_break_for_err(struct lwip_sock *sock)
|
||||
return break_wait;
|
||||
}
|
||||
|
||||
-static void recv_block_wait(struct lwip_sock *sock)
|
||||
-{
|
||||
- lstack_block_wait(sock->wakeup);
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* return 0 on success, -1 on error
|
||||
* pbuf maybe NULL(tcp fin packet)
|
||||
*/
|
||||
static int recv_ring_get_one(struct lwip_sock *sock, bool noblock, struct pbuf **pbuf)
|
||||
{
|
||||
+ int32_t expect = 1; // only get one pbuf
|
||||
+
|
||||
if (sock->recv_lastdata != NULL) {
|
||||
*pbuf = sock->recv_lastdata;
|
||||
sock->recv_lastdata = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (noblock) {
|
||||
- if (gazelle_ring_read(sock->recv_ring, (void **)pbuf, 1) != 1) {
|
||||
- errno = EAGAIN;
|
||||
+ while (gazelle_ring_read(sock->recv_ring, (void **)pbuf, expect) != expect) {
|
||||
+ if (noblock) {
|
||||
+ GAZELLE_RETURN(EAGAIN);
|
||||
+ }
|
||||
+ if (recv_break_for_err(sock)) {
|
||||
return -1;
|
||||
- } else {
|
||||
- return 0;
|
||||
}
|
||||
- } else {
|
||||
- while (gazelle_ring_read(sock->recv_ring, (void **)pbuf, 1) != 1) {
|
||||
- if (recv_break_for_err(sock)) {
|
||||
- return -1;
|
||||
- }
|
||||
- recv_block_wait(sock);
|
||||
+ if (lstack_block_wait(sock->wakeup, sock->conn->recv_timeout) == ETIMEDOUT) {
|
||||
+ noblock = true;
|
||||
}
|
||||
- return 0;
|
||||
}
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/* return true: fin is read to user, false: pend fin */
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index a545b73..7c4af64 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -1270,7 +1270,7 @@ int32_t stack_broadcast_accept4(int32_t fd, struct sockaddr *addr, socklen_t *ad
|
||||
min_sock = get_min_accept_sock(fd);
|
||||
} else {
|
||||
while ((min_sock = get_min_accept_sock(fd)) == NULL) {
|
||||
- lstack_block_wait(sock->wakeup);
|
||||
+ lstack_block_wait(sock->wakeup, 0);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/lstack/include/posix/lstack_epoll.h b/src/lstack/include/posix/lstack_epoll.h
|
||||
index 7591f0f..59b5ef7 100644
|
||||
--- a/src/lstack/include/posix/lstack_epoll.h
|
||||
+++ b/src/lstack/include/posix/lstack_epoll.h
|
||||
@@ -80,15 +80,7 @@ int32_t lstack_rtc_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t
|
||||
int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout);
|
||||
int lstack_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeval);
|
||||
|
||||
-static inline void lstack_block_wait(struct wakeup_poll *wakeup)
|
||||
-{
|
||||
- if (wakeup == NULL) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- __atomic_store_n(&wakeup->in_wait, true, __ATOMIC_RELEASE);
|
||||
- pthread_mutex_lock(&wakeup->wait);
|
||||
-}
|
||||
+int32_t lstack_block_wait(struct wakeup_poll *wakeup, int32_t timeout);
|
||||
|
||||
static inline void lstack_block_wakeup(struct wakeup_poll *wakeup)
|
||||
{
|
||||
--
|
||||
2.33.0
|
||||
|
||||
42
0153-fix-netperf-setsockopt-fail.patch
Normal file
42
0153-fix-netperf-setsockopt-fail.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From 33efdf6e98d223f44a0168ae2e17e95cb7f27402 Mon Sep 17 00:00:00 2001
|
||||
From: yangchen <yangchen145@huawei.com>
|
||||
Date: Thu, 14 Mar 2024 13:16:58 +0800
|
||||
Subject: [PATCH] fix netperf setsockopt fail
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_wrap.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index 49bbf91..1bec08b 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -364,6 +364,14 @@ static inline int32_t do_getsockname(int32_t s, struct sockaddr *name, socklen_t
|
||||
return posix_api->getsockname_fn(s, name, namelen);
|
||||
}
|
||||
|
||||
+static bool unsupport_ip_optname(int32_t optname)
|
||||
+{
|
||||
+ if (optname == IP_RECVERR) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static bool unsupport_tcp_optname(int32_t optname)
|
||||
{
|
||||
if ((optname == TCP_QUICKACK) ||
|
||||
@@ -391,6 +399,10 @@ static bool unsupport_socket_optname(int32_t optname)
|
||||
|
||||
static bool unsupport_optname(int32_t level, int32_t optname)
|
||||
{
|
||||
+ if (level == SOL_IP) {
|
||||
+ return unsupport_ip_optname(optname);
|
||||
+ }
|
||||
+
|
||||
if (level == SOL_TCP) {
|
||||
return unsupport_tcp_optname(optname);
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
134
0154-fix-LATENCY_WRITE-increase-in-recv-process.patch
Normal file
134
0154-fix-LATENCY_WRITE-increase-in-recv-process.patch
Normal file
@ -0,0 +1,134 @@
|
||||
From c3d84d821fcdc15245f7cc9838cf97b4947a48e2 Mon Sep 17 00:00:00 2001
|
||||
From: yangchen <yangchen145@huawei.com>
|
||||
Date: Wed, 13 Mar 2024 13:01:38 +0800
|
||||
Subject: [PATCH] fix LATENCY_WRITE increase in recv process
|
||||
|
||||
---
|
||||
src/common/dpdk_common.h | 5 +++++
|
||||
src/common/gazelle_dfx_msg.h | 2 ++
|
||||
src/lstack/core/lstack_lwip.c | 4 ++++
|
||||
src/lstack/core/lstack_stack_stat.c | 20 +++++++++++++++++++-
|
||||
src/lstack/include/lstack_stack_stat.h | 1 +
|
||||
5 files changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/common/dpdk_common.h b/src/common/dpdk_common.h
|
||||
index a79a0f2..cb41747 100644
|
||||
--- a/src/common/dpdk_common.h
|
||||
+++ b/src/common/dpdk_common.h
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#define GAZELLE_KNI_NAME "kni" // will be removed during dpdk update
|
||||
|
||||
+#define GAZELLE_LATENCY_RD 0
|
||||
+#define GAZELLE_LATENCY_WR 1
|
||||
|
||||
/* Layout:
|
||||
* | rte_mbuf | mbuf_private | payload |
|
||||
@@ -31,6 +33,7 @@
|
||||
struct latency_timestamp {
|
||||
uint64_t stamp; // time stamp
|
||||
uint64_t check; // just for later vaild check
|
||||
+ uint16_t type; // latency type
|
||||
};
|
||||
struct mbuf_private {
|
||||
/* struct pbuf_custom must at first */
|
||||
@@ -92,6 +95,7 @@ static __rte_always_inline void time_stamp_into_mbuf(uint32_t rx_count, struct r
|
||||
lt = &mbuf_to_private(buf[i])->lt;
|
||||
lt->stamp = time_stamp;
|
||||
lt->check = ~(time_stamp);
|
||||
+ lt->type = GAZELLE_LATENCY_RD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +106,7 @@ static __rte_always_inline void time_stamp_into_pbuf(uint32_t tx_count, struct p
|
||||
lt = &pbuf_to_private(buf[i])->lt;
|
||||
lt->stamp = time_stamp;
|
||||
lt->check = ~(time_stamp);
|
||||
+ lt->type = GAZELLE_LATENCY_WR;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index 8d528d6..d7ba80f 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -69,6 +69,8 @@ enum GAZELLE_STAT_MODE {
|
||||
enum GAZELLE_LATENCY_TYPE {
|
||||
GAZELLE_LATENCY_READ_LWIP,
|
||||
GAZELLE_LATENCY_READ_LSTACK,
|
||||
+ GAZELLE_LATENCY_READ_MAX,
|
||||
+
|
||||
GAZELLE_LATENCY_WRITE_LWIP,
|
||||
GAZELLE_LATENCY_WRITE_LSTACK,
|
||||
GAZELLE_LATENCY_MAX,
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 8aae433..f9b83c7 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -257,6 +257,10 @@ struct pbuf *do_lwip_get_from_sendring(struct lwip_sock *sock, uint16_t remain_s
|
||||
int size = (remain_size + MBUF_MAX_DATA_LEN - 1) / MBUF_MAX_DATA_LEN - 1;
|
||||
struct pbuf *pbuf_used[size];
|
||||
gazelle_ring_sc_dequeue(sock->send_ring, (void **)&pbuf_used, size);
|
||||
+
|
||||
+ for (uint32_t i = 0; get_protocol_stack_group()->latency_start && i < size; i++) {
|
||||
+ calculate_lstack_latency(&sock->stack->latency, pbuf_used[i], GAZELLE_LATENCY_WRITE_LWIP);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (get_protocol_stack_group()->latency_start) {
|
||||
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
|
||||
index 25b5557..3e016b7 100644
|
||||
--- a/src/lstack/core/lstack_stack_stat.c
|
||||
+++ b/src/lstack/core/lstack_stack_stat.c
|
||||
@@ -48,10 +48,27 @@ uint64_t get_current_time(void)
|
||||
return (rte_rdtsc() / g_cycles_per_us);
|
||||
}
|
||||
|
||||
+void time_stamp_transfer_pbuf(struct pbuf *pbuf_old, struct pbuf *pbuf_new)
|
||||
+{
|
||||
+ if (!get_protocol_stack_group()->latency_start) {
|
||||
+ return;
|
||||
+ }
|
||||
+ struct latency_timestamp *lt_old;
|
||||
+ struct latency_timestamp *lt_new;
|
||||
+
|
||||
+ lt_old = &pbuf_to_private(pbuf_old)->lt;
|
||||
+ lt_new = &pbuf_to_private(pbuf_new)->lt;
|
||||
+
|
||||
+ lt_new->stamp = lt_old->stamp;
|
||||
+ lt_new->check = lt_old->check;
|
||||
+ lt_new->type = lt_old->type;
|
||||
+}
|
||||
+
|
||||
void calculate_lstack_latency(struct gazelle_stack_latency *stack_latency, const struct pbuf *pbuf,
|
||||
enum GAZELLE_LATENCY_TYPE type)
|
||||
{
|
||||
uint64_t latency;
|
||||
+ uint16_t lt_type;
|
||||
const struct latency_timestamp *lt;
|
||||
struct stack_latency *latency_stat;
|
||||
|
||||
@@ -60,7 +77,8 @@ void calculate_lstack_latency(struct gazelle_stack_latency *stack_latency, const
|
||||
}
|
||||
|
||||
lt = &pbuf_to_private(pbuf)->lt;
|
||||
- if (lt->stamp != ~(lt->check) || lt->stamp < stack_latency->start_time) {
|
||||
+ lt_type = (type / GAZELLE_LATENCY_READ_MAX) ? GAZELLE_LATENCY_WR : GAZELLE_LATENCY_RD;
|
||||
+ if (lt->stamp != ~(lt->check) || lt->stamp < stack_latency->start_time || lt_type != lt->type) {
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/src/lstack/include/lstack_stack_stat.h b/src/lstack/include/lstack_stack_stat.h
|
||||
index d5a4ec7..87951aa 100644
|
||||
--- a/src/lstack/include/lstack_stack_stat.h
|
||||
+++ b/src/lstack/include/lstack_stack_stat.h
|
||||
@@ -30,5 +30,6 @@ uint64_t get_current_time(void);
|
||||
void lstack_get_low_power_info(struct gazelle_stat_low_power_info *low_power_info);
|
||||
void unregister_wakeup(struct protocol_stack *stack, struct wakeup_poll *wakeup);
|
||||
void lstack_calculate_aggregate(int type, uint32_t len);
|
||||
+void time_stamp_transfer_pbuf(struct pbuf *pbuf_old, struct pbuf *pbuf_new);
|
||||
|
||||
#endif /* GAZELLE_STACK_STAT_H */
|
||||
--
|
||||
2.33.0
|
||||
|
||||
95
0155-dpdk-add-vlan-filter.patch
Normal file
95
0155-dpdk-add-vlan-filter.patch
Normal file
@ -0,0 +1,95 @@
|
||||
From 3d8a848dde959ef95796e8215cdb1882a3496ce4 Mon Sep 17 00:00:00 2001
|
||||
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
|
||||
Date: Thu, 21 Mar 2024 11:24:26 +0800
|
||||
Subject: [PATCH] dpdk add vlan filter
|
||||
|
||||
---
|
||||
src/common/dpdk_common.c | 6 ++++++
|
||||
src/lstack/core/lstack_dpdk.c | 19 +++++++++++++------
|
||||
2 files changed, 19 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/common/dpdk_common.c b/src/common/dpdk_common.c
|
||||
index c0c4f63..c03b2ec 100644
|
||||
--- a/src/common/dpdk_common.c
|
||||
+++ b/src/common/dpdk_common.c
|
||||
@@ -223,6 +223,12 @@ void eth_params_checksum(struct rte_eth_conf *conf, struct rte_eth_dev_info *dev
|
||||
COMMON_INFO("RTE_ETH_RX_OFFLOAD_VLAN_STRIP\n");
|
||||
}
|
||||
|
||||
+ // rx vlan filter
|
||||
+ if (rx_ol_capa & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) {
|
||||
+ rx_ol |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER;
|
||||
+ COMMON_INFO("RTE_ETH_RX_OFFLOAD_VLAN_STRIP\n");
|
||||
+ }
|
||||
+
|
||||
// tx ip
|
||||
if (tx_ol_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
|
||||
tx_ol |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index a774d45..42981f4 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -572,13 +572,13 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
|
||||
int slave_id = rte_eth_bond_primary_get(port_id);
|
||||
if (slave_id < 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk get bond primary port failed port = %d\n", slave_id);
|
||||
- free(eth_params);
|
||||
+ free(eth_params);
|
||||
return slave_id;
|
||||
}
|
||||
ret = rte_eth_dev_info_get(slave_id, &slave_dev_info);
|
||||
if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk get bond dev info failed ret = %d\n", ret);
|
||||
- free(eth_params);
|
||||
+ free(eth_params);
|
||||
return ret;
|
||||
}
|
||||
dev_info.rx_offload_capa = slave_dev_info.rx_offload_capa;
|
||||
@@ -623,6 +623,13 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
|
||||
}
|
||||
}
|
||||
|
||||
+ /* after rte_eth_dev_configure */
|
||||
+ ret = rte_eth_dev_vlan_filter(port_id, get_global_cfg_params()->nic.vlan_mode, 1);
|
||||
+ if (ret != 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "dpdk add vlan filter failed ret = %d\n", ret);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
rte_eth_allmulticast_enable(port_id);
|
||||
|
||||
return 0;
|
||||
@@ -733,7 +740,7 @@ int32_t init_dpdk_ethdev(void)
|
||||
}
|
||||
|
||||
ret = dpdk_ethdev_init(bond_port_id, 1);
|
||||
- if (ret != 0) {
|
||||
+ if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk_ethdev_init failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
@@ -765,18 +772,18 @@ int32_t init_dpdk_ethdev(void)
|
||||
|
||||
ret = rte_eth_promiscuous_enable(bond_port_id);
|
||||
if (ret < 0) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "dpdk enable promiscuous failed ret = %d\n", ret);
|
||||
+ LSTACK_LOG(ERR, LSTACK, "dpdk enable promiscuous failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = rte_eth_allmulticast_enable(bond_port_id);
|
||||
if (ret < 0) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "dpdk enable allmulticast failed ret = %d\n", ret);
|
||||
+ LSTACK_LOG(ERR, LSTACK, "dpdk enable allmulticast failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = rte_eth_dev_start(bond_port_id);
|
||||
- if (ret < 0) {
|
||||
+ if (ret < 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk start bond port failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
25
0156-Correcting-spelling-errors.patch
Normal file
25
0156-Correcting-spelling-errors.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From b766b84a25e9099e67ebacffed7ff96024af2268 Mon Sep 17 00:00:00 2001
|
||||
From: gaojiazhen <gaojiazhen_yewu@cmss.chinamobile.com>
|
||||
Date: Fri, 22 Mar 2024 17:33:59 +0800
|
||||
Subject: [PATCH] Correcting spelling errors
|
||||
|
||||
---
|
||||
src/ltran/ltran_ethdev.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ltran/ltran_ethdev.c b/src/ltran/ltran_ethdev.c
|
||||
index 2fb7fab..2f08d4a 100644
|
||||
--- a/src/ltran/ltran_ethdev.c
|
||||
+++ b/src/ltran/ltran_ethdev.c
|
||||
@@ -378,7 +378,7 @@ static int32_t ltran_bond_port_attr_set(uint16_t port_num, uint16_t bond_port_id
|
||||
|
||||
struct rte_eth_dev_info dev_info;
|
||||
if (rte_eth_dev_info_get(bond_port_id, &dev_info) != 0) {
|
||||
- LTRAN_ERR("faile rte_eth_dev_info_get\n");
|
||||
+ LTRAN_ERR("rte_eth_dev_info_get failed\n");
|
||||
return GAZELLE_ERR;
|
||||
}
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
41
0157-perftool-add-lhist-statstic-tool.patch
Normal file
41
0157-perftool-add-lhist-statstic-tool.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 34c2f6cc1e1059ffe3e5edd7cebeb758e4ba9f36 Mon Sep 17 00:00:00 2001
|
||||
From: wuchangye <wuchangye@huawei.com>
|
||||
Date: Sun, 24 Mar 2024 00:10:08 +0800
|
||||
Subject: [PATCH] perftool: add lhist statstic tool
|
||||
|
||||
---
|
||||
tools/perf/glhist.bt | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
create mode 100644 tools/perf/glhist.bt
|
||||
|
||||
diff --git a/tools/perf/glhist.bt b/tools/perf/glhist.bt
|
||||
new file mode 100644
|
||||
index 0000000..757f6e9
|
||||
--- /dev/null
|
||||
+++ b/tools/perf/glhist.bt
|
||||
@@ -0,0 +1,21 @@
|
||||
+#!/usr/bin/env bpftrace
|
||||
+/*
|
||||
+reference: https://github.com/bpftrace/bpftrace/blob/master/man/adoc/bpftrace.adoc
|
||||
+prepare: yum install bpftrace
|
||||
+example: ./glhist.bt rpc_poll_msg
|
||||
+*/
|
||||
+
|
||||
+uprobe:/usr/lib64/liblstack.so:$1
|
||||
+{
|
||||
+ @t_start[tid] = nsecs;
|
||||
+}
|
||||
+
|
||||
+uretprobe:/usr/lib64/liblstack.so:$1
|
||||
+{
|
||||
+ @t_dur[tid] = nsecs - @t_start[tid];
|
||||
+ @t_count[tid] = count();
|
||||
+ if (@t_dur[tid] < 1000000000) {
|
||||
+ // lhist(int64 n, int64 min, int64 max, int64 step)
|
||||
+ @t_hist[tid] = lhist(@t_dur[tid], 0, 4000, 100);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.33.0
|
||||
|
||||
47
0158-add-udp-poll.patch
Normal file
47
0158-add-udp-poll.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 776ff89196c1fb5bc0193ea746119e40f80fed46 Mon Sep 17 00:00:00 2001
|
||||
From: compile_success <980965867@qq.com>
|
||||
Date: Fri, 22 Mar 2024 08:31:28 +0000
|
||||
Subject: [PATCH] add udp poll
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_lwip.c | 8 ++++++++
|
||||
src/lstack/core/lstack_protocol_stack.c | 4 ++++
|
||||
2 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index a604a62..c5161b4 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -1307,6 +1307,14 @@ void netif_poll(struct netif *netif)
|
||||
/* processes on same node handshake packet use this function */
|
||||
err_t netif_loop_output(struct netif *netif, struct pbuf *p)
|
||||
{
|
||||
+ if (p != NULL) {
|
||||
+ const struct ip_hdr *iphdr;
|
||||
+ iphdr = (const struct ip_hdr *)p->payload;
|
||||
+ if (IPH_PROTO(iphdr) == IP_PROTO_UDP) {
|
||||
+ return udp_netif_loop_output(netif, p);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
struct tcp_pcb *pcb = p->pcb;
|
||||
struct pbuf *head = NULL;
|
||||
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index 7c4af64..138ac2b 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -491,6 +491,10 @@ int stack_polling(uint32_t wakeup_tick)
|
||||
}
|
||||
}
|
||||
|
||||
+ if (cfg->udp_enable) {
|
||||
+ udp_netif_poll(&stack->netif);
|
||||
+ }
|
||||
+
|
||||
#if RTE_VERSION < RTE_VERSION_NUM(23, 11, 0, 0)
|
||||
/* run to completion mode currently does not support kni */
|
||||
/* KNI requests are generally low-rate I/Os,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
39
0159-DFX-adapt-testcase-for-gazellectl-connect-failed.patch
Normal file
39
0159-DFX-adapt-testcase-for-gazellectl-connect-failed.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From f082b20ee9bab301fb21f2a40c32ca031f6177af Mon Sep 17 00:00:00 2001
|
||||
From: yinbin6 <yinbin8@huawei.com>
|
||||
Date: Tue, 26 Mar 2024 10:40:00 +0800
|
||||
Subject: [PATCH] DFX: adapt testcase for gazellectl connect failed
|
||||
|
||||
---
|
||||
src/ltran/ltran_dfx.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index 91c6063..073dfa7 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -361,10 +361,10 @@ static int dfx_connect_probe(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- printf("Connect lstack(path:%s), errno: %d; Connect ltran(path:%s) failed, errno: %d\n",
|
||||
+ printf("Connect lstack(path:%s) failed, errno: %d; Connect ltran(path:%s) failed, errno: %d\n",
|
||||
g_lstack_unix_path, -ret2, g_ltran_unix_path, -ret1);
|
||||
- printf("Please ensure the process is started; If use ltran mode, \
|
||||
- set use_ltran=1 in lstack.conf, otherwise set use_ltran=0\n");
|
||||
+ printf("Please ensure the process is started; If use ltran mode, "
|
||||
+ "set use_ltran=1 in lstack.conf, otherwise set use_ltran=0\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1860,7 +1860,7 @@ static int32_t parse_dfx_cmd_args(int32_t argc, char *argv[], struct gazelle_sta
|
||||
if (strcmp(param, "lstack") == 0) {
|
||||
ret = dfx_connect_probe();
|
||||
if (ret < 0) {
|
||||
- exit(0);
|
||||
+ exit(-1);
|
||||
}
|
||||
g_use_ltran = ret;
|
||||
num_cmd = parse_dfx_lstack_args(argc, argv, req_msg);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
From 7604fb6e3917bd2b745f9dd5591de5a3b244c51e Mon Sep 17 00:00:00 2001
|
||||
From: hantwofish <hankangkang5@huawei.com>
|
||||
Date: Mon, 25 Mar 2024 16:07:09 +0800
|
||||
Subject: [PATCH] warp: add configuration check with host_addr and server_ip
|
||||
for ipv6
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_wrap.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index 49bbf91..2d5ef83 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -259,6 +259,11 @@ bool is_dst_ip_localhost(const struct sockaddr *addr)
|
||||
if (get_global_cfg_params()->host_addr.addr == ((struct sockaddr_in *)addr)->sin_addr.s_addr) {
|
||||
return true;
|
||||
}
|
||||
+ } else if (addr->sa_family == AF_INET6) {
|
||||
+ if (memcmp(get_global_cfg_params()->host_addr6.addr, &((struct sockaddr_in6 *)addr)->sin6_addr,
|
||||
+ sizeof(struct in6_addr)) == 0) {
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (getifaddrs(&ifap) == -1) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
380
0161-add-latency-nodes-READ_APP_CALL-WRITE_RPC_MSG.patch
Normal file
380
0161-add-latency-nodes-READ_APP_CALL-WRITE_RPC_MSG.patch
Normal file
@ -0,0 +1,380 @@
|
||||
From 286e9a267e2d106d05c5fec80a932ed605d4b006 Mon Sep 17 00:00:00 2001
|
||||
From: yangchen <yangchen145@huawei.com>
|
||||
Date: Mon, 1 Apr 2024 09:15:56 +0800
|
||||
Subject: [PATCH] add latency nodes: READ_APP_CALL & WRITE_RPC_MSG
|
||||
|
||||
---
|
||||
src/common/dpdk_common.h | 2 +
|
||||
src/common/gazelle_dfx_msg.h | 18 ++++---
|
||||
src/lstack/core/lstack_lwip.c | 23 ++++++---
|
||||
src/lstack/core/lstack_protocol_stack.c | 4 ++
|
||||
src/lstack/core/lstack_stack_stat.c | 68 +++++++++++++++++++++----
|
||||
src/lstack/core/lstack_thread_rpc.c | 8 ++-
|
||||
src/lstack/include/lstack_stack_stat.h | 4 ++
|
||||
src/lstack/include/lstack_thread_rpc.h | 2 +
|
||||
src/lstack/netif/lstack_ethdev.c | 2 +-
|
||||
src/ltran/ltran_dfx.c | 21 ++++++--
|
||||
10 files changed, 124 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/src/common/dpdk_common.h b/src/common/dpdk_common.h
|
||||
index cb41747..7a05342 100644
|
||||
--- a/src/common/dpdk_common.h
|
||||
+++ b/src/common/dpdk_common.h
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <lwip/pbuf.h>
|
||||
#include <lwip/dpdk_version.h>
|
||||
|
||||
+#include "gazelle_dfx_msg.h"
|
||||
#include "gazelle_opt.h"
|
||||
|
||||
#define GAZELLE_KNI_NAME "kni" // will be removed during dpdk update
|
||||
@@ -33,6 +34,7 @@
|
||||
struct latency_timestamp {
|
||||
uint64_t stamp; // time stamp
|
||||
uint64_t check; // just for later vaild check
|
||||
+ uint16_t stamp_seg[GAZELLE_LATENCY_MAX]; // time stamp segment
|
||||
uint16_t type; // latency type
|
||||
};
|
||||
struct mbuf_private {
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index d7ba80f..c2ff760 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -62,17 +62,23 @@ enum GAZELLE_STAT_MODE {
|
||||
GAZELLE_STAT_FAULT_INJECT_SET,
|
||||
GAZELLE_STAT_FAULT_INJECT_UNSET,
|
||||
#endif /* GAZELLE_FAULT_INJECT_ENABLE */
|
||||
-
|
||||
+
|
||||
GAZELLE_STAT_MODE_MAX,
|
||||
};
|
||||
|
||||
enum GAZELLE_LATENCY_TYPE {
|
||||
- GAZELLE_LATENCY_READ_LWIP,
|
||||
- GAZELLE_LATENCY_READ_LSTACK,
|
||||
- GAZELLE_LATENCY_READ_MAX,
|
||||
+ GAZELLE_LATENCY_READ_LWIP, // t0 -> t1
|
||||
+ GAZELLE_LATENCY_READ_APP_CALL, // t1 -> t2
|
||||
+ GAZELLE_LATENCY_READ_LSTACK, // t2 -> t3
|
||||
+ GAZELLE_LATENCY_READ_MAX, // t0 -> t3
|
||||
+
|
||||
+ GAZELLE_LATENCY_WRITE_INTO_RING, // t0 -> t1
|
||||
+ GAZELLE_LATENCY_WRITE_LWIP, // t1 -> t2
|
||||
+ GAZELLE_LATENCY_WRITE_LSTACK, // t2 -> t3
|
||||
+ GAZELLE_LATENCY_WRITE_MAX, // t0 -> t3
|
||||
+
|
||||
+ GAZELLE_LATENCY_WRITE_RPC_MSG, // rpc_call_send
|
||||
|
||||
- GAZELLE_LATENCY_WRITE_LWIP,
|
||||
- GAZELLE_LATENCY_WRITE_LSTACK,
|
||||
GAZELLE_LATENCY_MAX,
|
||||
};
|
||||
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index a604a62..1d27938 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -259,12 +259,12 @@ struct pbuf *do_lwip_get_from_sendring(struct lwip_sock *sock, uint16_t remain_s
|
||||
gazelle_ring_sc_dequeue(sock->send_ring, (void **)&pbuf_used, size);
|
||||
|
||||
for (uint32_t i = 0; get_protocol_stack_group()->latency_start && i < size; i++) {
|
||||
- calculate_lstack_latency(&sock->stack->latency, pbuf_used[i], GAZELLE_LATENCY_WRITE_LWIP);
|
||||
+ calculate_lstack_latency(&sock->stack->latency, pbuf_used[i], GAZELLE_LATENCY_WRITE_LWIP, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (get_protocol_stack_group()->latency_start) {
|
||||
- calculate_lstack_latency(&sock->stack->latency, pbuf, GAZELLE_LATENCY_WRITE_LWIP);
|
||||
+ calculate_lstack_latency(&sock->stack->latency, pbuf, GAZELLE_LATENCY_WRITE_LWIP, 0);
|
||||
}
|
||||
|
||||
sock->send_pre_del = pbuf;
|
||||
@@ -362,6 +362,12 @@ static inline ssize_t app_buff_write(struct lwip_sock *sock, void *buf, size_t l
|
||||
}
|
||||
}
|
||||
|
||||
+ for (int i = 0; get_protocol_stack_group()->latency_start && i < write_num; i++) {
|
||||
+ if (pbufs[i] != NULL) {
|
||||
+ calculate_lstack_latency(&sock->stack->latency, pbufs[i], GAZELLE_LATENCY_WRITE_INTO_RING, 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
gazelle_ring_read_over(sock->send_ring);
|
||||
|
||||
sock->remain_len = MBUF_MAX_DATA_LEN - pbufs[write_num - 1]->len;
|
||||
@@ -611,7 +617,7 @@ ssize_t do_lwip_read_from_lwip(struct lwip_sock *sock, int32_t flags, u8_t apifl
|
||||
|
||||
for (uint32_t i = 0; get_protocol_stack_group()->latency_start && i < read_count; i++) {
|
||||
if (pbufs[i] != NULL) {
|
||||
- calculate_lstack_latency(&sock->stack->latency, pbufs[i], GAZELLE_LATENCY_READ_LWIP);
|
||||
+ calculate_lstack_latency(&sock->stack->latency, pbufs[i], GAZELLE_LATENCY_READ_LWIP, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,6 +876,7 @@ static bool recv_break_for_err(struct lwip_sock *sock)
|
||||
static int recv_ring_get_one(struct lwip_sock *sock, bool noblock, struct pbuf **pbuf)
|
||||
{
|
||||
int32_t expect = 1; // only get one pbuf
|
||||
+ uint64_t time_stamp = get_current_time();
|
||||
|
||||
if (sock->recv_lastdata != NULL) {
|
||||
*pbuf = sock->recv_lastdata;
|
||||
@@ -888,7 +895,11 @@ static int recv_ring_get_one(struct lwip_sock *sock, bool noblock, struct pbuf *
|
||||
noblock = true;
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
+ if (get_protocol_stack_group()->latency_start) {
|
||||
+ calculate_lstack_latency(&sock->stack->latency, *pbuf, GAZELLE_LATENCY_READ_APP_CALL, time_stamp);
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -954,7 +965,7 @@ static ssize_t recv_ring_tcp_read(struct lwip_sock *sock, void *buf, size_t len,
|
||||
}
|
||||
|
||||
if (get_protocol_stack_group()->latency_start) {
|
||||
- calculate_lstack_latency(&sock->stack->latency, pbuf, GAZELLE_LATENCY_READ_LSTACK);
|
||||
+ calculate_lstack_latency(&sock->stack->latency, pbuf, GAZELLE_LATENCY_READ_LSTACK, 0);
|
||||
}
|
||||
|
||||
gazelle_ring_read_over(sock->recv_ring);
|
||||
@@ -1001,7 +1012,7 @@ static ssize_t recv_ring_udp_read(struct lwip_sock *sock, void *buf, size_t len,
|
||||
sock->wakeup->stat.app_read_cnt++;
|
||||
}
|
||||
if (get_protocol_stack_group()->latency_start) {
|
||||
- calculate_lstack_latency(&sock->stack->latency, pbuf, GAZELLE_LATENCY_READ_LSTACK);
|
||||
+ calculate_lstack_latency(&sock->stack->latency, pbuf, GAZELLE_LATENCY_READ_LSTACK, 0);
|
||||
}
|
||||
|
||||
return copy_len;
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index 7c4af64..079bba0 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -876,6 +876,10 @@ void stack_send(struct rpc_msg *msg)
|
||||
struct protocol_stack *stack = get_protocol_stack();
|
||||
int replenish_again;
|
||||
|
||||
+ if (get_protocol_stack_group()->latency_start) {
|
||||
+ calculate_rpcmsg_latency(&stack->latency, msg, GAZELLE_LATENCY_WRITE_RPC_MSG);
|
||||
+ }
|
||||
+
|
||||
struct lwip_sock *sock = get_socket(fd);
|
||||
if (sock == NULL) {
|
||||
msg->result = -1;
|
||||
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
|
||||
index 3e016b7..80d4998 100644
|
||||
--- a/src/lstack/core/lstack_stack_stat.c
|
||||
+++ b/src/lstack/core/lstack_stack_stat.c
|
||||
@@ -62,16 +62,53 @@ void time_stamp_transfer_pbuf(struct pbuf *pbuf_old, struct pbuf *pbuf_new)
|
||||
lt_new->stamp = lt_old->stamp;
|
||||
lt_new->check = lt_old->check;
|
||||
lt_new->type = lt_old->type;
|
||||
+ for (int i = 0; i < GAZELLE_LATENCY_MAX; i++) {
|
||||
+ lt_new->stamp_seg[i] = lt_old->stamp_seg[i];
|
||||
+ }
|
||||
}
|
||||
|
||||
-void calculate_lstack_latency(struct gazelle_stack_latency *stack_latency, const struct pbuf *pbuf,
|
||||
+void time_stamp_into_rpcmsg(struct rpc_msg *msg)
|
||||
+{
|
||||
+ msg->time_stamp = get_current_time();
|
||||
+}
|
||||
+
|
||||
+void calculate_rpcmsg_latency(struct gazelle_stack_latency *stack_latency, struct rpc_msg *msg,
|
||||
enum GAZELLE_LATENCY_TYPE type)
|
||||
{
|
||||
uint64_t latency;
|
||||
- uint16_t lt_type;
|
||||
- const struct latency_timestamp *lt;
|
||||
+ struct stack_latency *latency_stat;
|
||||
+ if (msg == NULL || msg->time_stamp < stack_latency->start_time || type >= GAZELLE_LATENCY_MAX) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ latency = get_current_time() - msg->time_stamp;
|
||||
+ latency_stat = &stack_latency->latency[type];
|
||||
+
|
||||
+ latency_stat->latency_total += latency;
|
||||
+ latency_stat->latency_max = (latency_stat->latency_max > latency) ? latency_stat->latency_max : latency;
|
||||
+ latency_stat->latency_min = (latency_stat->latency_min < latency) ? latency_stat->latency_min : latency;
|
||||
+ latency_stat->latency_pkts++;
|
||||
+}
|
||||
+
|
||||
+void calculate_latency_stat(struct gazelle_stack_latency *stack_latency, uint64_t latency,
|
||||
+ enum GAZELLE_LATENCY_TYPE type)
|
||||
+{
|
||||
struct stack_latency *latency_stat;
|
||||
|
||||
+ latency_stat = &stack_latency->latency[type];
|
||||
+ latency_stat->latency_total += latency;
|
||||
+ latency_stat->latency_max = (latency_stat->latency_max > latency) ? latency_stat->latency_max : latency;
|
||||
+ latency_stat->latency_min = (latency_stat->latency_min < latency) ? latency_stat->latency_min : latency;
|
||||
+ latency_stat->latency_pkts++;
|
||||
+}
|
||||
+
|
||||
+void calculate_lstack_latency(struct gazelle_stack_latency *stack_latency, const struct pbuf *pbuf,
|
||||
+ enum GAZELLE_LATENCY_TYPE type, uint64_t time_record)
|
||||
+{
|
||||
+ uint64_t latency;
|
||||
+ uint16_t lt_type;
|
||||
+ struct latency_timestamp *lt;
|
||||
+
|
||||
if (pbuf == NULL || type >= GAZELLE_LATENCY_MAX) {
|
||||
return;
|
||||
}
|
||||
@@ -82,13 +119,26 @@ void calculate_lstack_latency(struct gazelle_stack_latency *stack_latency, const
|
||||
return;
|
||||
}
|
||||
|
||||
- latency = get_current_time() - lt->stamp;
|
||||
- latency_stat = &stack_latency->latency[type];
|
||||
+ if (time_record == 0) {
|
||||
+ lt->stamp_seg[type] = get_current_time() - lt->stamp;
|
||||
+ } else {
|
||||
+ lt->stamp_seg[type] = time_record > (lt->stamp_seg[type - 1] + lt->stamp) ?
|
||||
+ (time_record - lt->stamp) : lt->stamp_seg[type - 1];
|
||||
+ }
|
||||
|
||||
- latency_stat->latency_total += latency;
|
||||
- latency_stat->latency_max = (latency_stat->latency_max > latency) ? latency_stat->latency_max : latency;
|
||||
- latency_stat->latency_min = (latency_stat->latency_min < latency) ? latency_stat->latency_min : latency;
|
||||
- latency_stat->latency_pkts++;
|
||||
+ latency = lt->stamp_seg[type];
|
||||
+ if (((lt_type == GAZELLE_LATENCY_RD && type > GAZELLE_LATENCY_READ_LWIP) ||
|
||||
+ (lt_type == GAZELLE_LATENCY_WR && type > GAZELLE_LATENCY_WRITE_INTO_RING)) &&
|
||||
+ latency >= lt->stamp_seg[type - 1]) {
|
||||
+ latency -= lt->stamp_seg[type - 1];
|
||||
+ }
|
||||
+
|
||||
+ /* calculate the time of the entire read/write process */
|
||||
+ if (type == GAZELLE_LATENCY_READ_MAX - 1 || type == GAZELLE_LATENCY_WRITE_MAX - 1) {
|
||||
+ calculate_latency_stat(stack_latency, lt->stamp_seg[type], type + 1);
|
||||
+ }
|
||||
+
|
||||
+ calculate_latency_stat(stack_latency, latency, type);
|
||||
}
|
||||
|
||||
void lstack_calculate_aggregate(int type, uint32_t len)
|
||||
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
|
||||
index 20c5a43..30bd827 100644
|
||||
--- a/src/lstack/core/lstack_thread_rpc.c
|
||||
+++ b/src/lstack/core/lstack_thread_rpc.c
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "lstack_log.h"
|
||||
#include "lstack_dpdk.h"
|
||||
#include "lstack_rpc_proc.h"
|
||||
+#include "lstack_stack_stat.h"
|
||||
+#include "lstack_protocol_stack.h"
|
||||
#include "lstack_thread_rpc.h"
|
||||
|
||||
static PER_THREAD struct rpc_msg_pool *g_rpc_pool = NULL;
|
||||
@@ -467,11 +469,15 @@ int32_t rpc_call_send(rpc_queue *queue, int fd, const void *buf, size_t len, int
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (get_protocol_stack_group()->latency_start) {
|
||||
+ time_stamp_into_rpcmsg(msg);
|
||||
+ }
|
||||
+
|
||||
msg->args[MSG_ARG_0].i = fd;
|
||||
msg->args[MSG_ARG_1].size = len;
|
||||
msg->args[MSG_ARG_2].i = flags;
|
||||
msg->sync_flag = 0;
|
||||
-
|
||||
+
|
||||
rpc_call(queue, msg);
|
||||
|
||||
return 0;
|
||||
diff --git a/src/lstack/include/lstack_stack_stat.h b/src/lstack/include/lstack_stack_stat.h
|
||||
index 87951aa..f901982 100644
|
||||
--- a/src/lstack/include/lstack_stack_stat.h
|
||||
+++ b/src/lstack/include/lstack_stack_stat.h
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
struct gazelle_stack_latency;
|
||||
struct pbuf;
|
||||
+struct rpc_msg;
|
||||
struct gazelle_stat_low_power_info;
|
||||
struct wakeup_poll;
|
||||
struct protocol_stack;
|
||||
@@ -22,6 +23,8 @@ enum GAZELLE_LATENCY_TYPE;
|
||||
enum GAZELLE_STAT_MODE;
|
||||
|
||||
void calculate_lstack_latency(struct gazelle_stack_latency *stack_latency, const struct pbuf *pbuf,
|
||||
+ enum GAZELLE_LATENCY_TYPE type, uint64_t time_record);
|
||||
+void calculate_rpcmsg_latency(struct gazelle_stack_latency *stack_latency, struct rpc_msg *msg,
|
||||
enum GAZELLE_LATENCY_TYPE type);
|
||||
void stack_stat_init(void);
|
||||
int handle_stack_cmd(int fd, enum GAZELLE_STAT_MODE stat_mode);
|
||||
@@ -31,5 +34,6 @@ void lstack_get_low_power_info(struct gazelle_stat_low_power_info *low_power_inf
|
||||
void unregister_wakeup(struct protocol_stack *stack, struct wakeup_poll *wakeup);
|
||||
void lstack_calculate_aggregate(int type, uint32_t len);
|
||||
void time_stamp_transfer_pbuf(struct pbuf *pbuf_old, struct pbuf *pbuf_new);
|
||||
+void time_stamp_into_rpcmsg(struct rpc_msg *msg);
|
||||
|
||||
#endif /* GAZELLE_STACK_STAT_H */
|
||||
diff --git a/src/lstack/include/lstack_thread_rpc.h b/src/lstack/include/lstack_thread_rpc.h
|
||||
index 4d89604..8e97c11 100644
|
||||
--- a/src/lstack/include/lstack_thread_rpc.h
|
||||
+++ b/src/lstack/include/lstack_thread_rpc.h
|
||||
@@ -60,6 +60,8 @@ struct rpc_msg {
|
||||
|
||||
rpc_msg_func func; /* msg handle func hook */
|
||||
union rpc_msg_arg args[RPM_MSG_ARG_SIZE]; /* resolve by type */
|
||||
+
|
||||
+ uint64_t time_stamp; /* rpc_call_* start time */
|
||||
};
|
||||
|
||||
static inline void rpc_queue_init(rpc_queue *queue)
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index 8fe11c4..23edc19 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -224,7 +224,7 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
|
||||
rte_mbuf_refcnt_update(mbuf, 1);
|
||||
|
||||
if (get_protocol_stack_group()->latency_start) {
|
||||
- calculate_lstack_latency(&stack->latency, pbuf, GAZELLE_LATENCY_WRITE_LSTACK);
|
||||
+ calculate_lstack_latency(&stack->latency, pbuf, GAZELLE_LATENCY_WRITE_LSTACK, 0);
|
||||
}
|
||||
pbuf = pbuf->next;
|
||||
}
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index 91c6063..79c172b 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -881,11 +881,22 @@ static void gazelle_print_lstack_stat_latency(void *buf, const struct gazelle_st
|
||||
gazelle_show_latency_result_total(buf, req_msg, res);
|
||||
|
||||
printf("Statistics of lstack latency pkts min(us) max(us) average(us)\n");
|
||||
- printf("range: t0--->t3\n%s", res[GAZELLE_LATENCY_READ_LSTACK].latency_stat_result);
|
||||
- printf("range: t0--->t2\n%s", res[GAZELLE_LATENCY_READ_LWIP].latency_stat_result);
|
||||
- printf("range: t3--->t0\n%s", res[GAZELLE_LATENCY_WRITE_LSTACK].latency_stat_result);
|
||||
- printf("range: t2--->t0\n%s", res[GAZELLE_LATENCY_WRITE_LWIP].latency_stat_result);
|
||||
- printf("t0:read form/send to nic t1:into/out of lstask queue t2:into/out of app queue t3:app read/send\n");
|
||||
+ printf("Recv:\n");
|
||||
+ printf("range: t0--->t1\n%s", res[GAZELLE_LATENCY_READ_LWIP].latency_stat_result);
|
||||
+ printf("range: t1--->t2\n%s", res[GAZELLE_LATENCY_READ_APP_CALL].latency_stat_result);
|
||||
+ printf("range: t2--->t3\n%s", res[GAZELLE_LATENCY_READ_LSTACK].latency_stat_result);
|
||||
+ printf("range: t0--->t3\n%s", res[GAZELLE_LATENCY_READ_MAX].latency_stat_result);
|
||||
+ printf("t0: read from nic t1: into recv ring t2: app read start t3: app read end\n");
|
||||
+
|
||||
+ printf("Send:\n");
|
||||
+ printf("range: t0--->t1\n%s", res[GAZELLE_LATENCY_WRITE_INTO_RING].latency_stat_result);
|
||||
+ printf("range: t1--->t2\n%s", res[GAZELLE_LATENCY_WRITE_LWIP].latency_stat_result);
|
||||
+ printf("range: t2--->t3\n%s", res[GAZELLE_LATENCY_WRITE_LSTACK].latency_stat_result);
|
||||
+ printf("range: t0--->t3\n%s", res[GAZELLE_LATENCY_WRITE_MAX].latency_stat_result);
|
||||
+ printf("t0: app send t1: into send ring t2: out of send ring t3: send to nic\n");
|
||||
+
|
||||
+ printf("Rpc:\n");
|
||||
+ printf("rpc_call_send \n%s", res[GAZELLE_LATENCY_WRITE_RPC_MSG].latency_stat_result);
|
||||
|
||||
free(res);
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
33
0162-fix-vlan-filter-can-be-added-when-vlan_mode-1.patch
Normal file
33
0162-fix-vlan-filter-can-be-added-when-vlan_mode-1.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From c392e263cb5f5392713600174d3b8955f2d26759 Mon Sep 17 00:00:00 2001
|
||||
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
|
||||
Date: Wed, 3 Apr 2024 14:33:57 +0800
|
||||
Subject: [PATCH] fix vlan filter can be added when vlan_mode=-1
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_dpdk.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 42981f4..b972c00 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -624,10 +624,12 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
|
||||
}
|
||||
|
||||
/* after rte_eth_dev_configure */
|
||||
- ret = rte_eth_dev_vlan_filter(port_id, get_global_cfg_params()->nic.vlan_mode, 1);
|
||||
- if (ret != 0) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "dpdk add vlan filter failed ret = %d\n", ret);
|
||||
- return -1;
|
||||
+ if (get_global_cfg_params()->nic.vlan_mode != -1) {
|
||||
+ ret = rte_eth_dev_vlan_filter(port_id, get_global_cfg_params()->nic.vlan_mode, 1);
|
||||
+ if (ret != 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "dpdk add vlan filter failed ret = %d\n", ret);
|
||||
+ return -1;
|
||||
+ }
|
||||
}
|
||||
|
||||
rte_eth_allmulticast_enable(port_id);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
32
gazelle.spec
32
gazelle.spec
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.2
|
||||
Release: 29
|
||||
Release: 30
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -162,6 +162,20 @@ Patch9145: 0145-add-limit-with-level-for-sockopt.patch
|
||||
Patch9146: 0146-udp-add-restriction-message-too-long.patch
|
||||
Patch9147: 0147-dfx-improve-log-readability-when-connect-ltran-lstac.patch
|
||||
Patch9148: 0148-fix-rpc_pool-create-failed-coredump.patch
|
||||
Patch9149: 0149-ensure-the-bond-interface-flow_type_rss_offloads-mat.patch
|
||||
Patch9150: 0150-FAULT-INJECT-add-duplicate-and-reorder-methods.patch
|
||||
Patch9151: 0151-select-timeout-arguments-check.patch
|
||||
Patch9152: 0152-recvfrom-support-timeout.patch
|
||||
Patch9153: 0153-fix-netperf-setsockopt-fail.patch
|
||||
Patch9154: 0154-fix-LATENCY_WRITE-increase-in-recv-process.patch
|
||||
Patch9155: 0155-dpdk-add-vlan-filter.patch
|
||||
Patch9156: 0156-Correcting-spelling-errors.patch
|
||||
Patch9157: 0157-perftool-add-lhist-statstic-tool.patch
|
||||
Patch9158: 0158-add-udp-poll.patch
|
||||
Patch9159: 0159-DFX-adapt-testcase-for-gazellectl-connect-failed.patch
|
||||
Patch9160: 0160-warp-add-configuration-check-with-host_addr-and-serv.patch
|
||||
Patch9161: 0161-add-latency-nodes-READ_APP_CALL-WRITE_RPC_MSG.patch
|
||||
Patch9162: 0162-fix-vlan-filter-can-be-added-when-vlan_mode-1.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -203,6 +217,22 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Sun Apr 7 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-30
|
||||
- fix vlan filter can be added when vlan_mode=-1
|
||||
- add latency nodes: READ_APP_CALL & WRITE_RPC_MSG
|
||||
- warp: add configuration check with host_addr and server_ip for ipv6
|
||||
- DFX: adapt testcase for gazellectl connect failed
|
||||
- add udp poll
|
||||
- perftool: add lhist statstic tool
|
||||
- Correcting spelling errors
|
||||
- dpdk add vlan filter
|
||||
- fix LATENCY_WRITE increase in recv process
|
||||
- fix netperf setsockopt fail
|
||||
- recvfrom support timeout
|
||||
- select timeout arguments check
|
||||
- FAULT INJECT: add duplicate and reorder methods
|
||||
- ensure the bond interface flow_type_rss_offloads match slave
|
||||
|
||||
* Thu Mar 14 2024 yinbin6 <jiangheng14@huawei.com> - 1.0.2-29
|
||||
- fix rpc_pool create failed coredump
|
||||
- dfx: improve log readability when connect ltran/lstack failed
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user