!359 [sync] PR-357: sync fix build err with dpdk-21.11
From: @openeuler-sync-bot Reviewed-by: @jiangheng12 Signed-off-by: @jiangheng12
This commit is contained in:
commit
5270c12dee
@ -0,0 +1,25 @@
|
||||
From 3a2712ef47155848817409ebf550fefb7bc3d944 Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Tue, 21 Mar 2023 20:05:45 +0800
|
||||
Subject: [PATCH] do not transfer broadcast arp pkts to other process
|
||||
|
||||
---
|
||||
src/lstack/netif/lstack_ethdev.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index 532f006..b35852b 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -733,7 +733,7 @@ int32_t gazelle_eth_dev_poll(struct protocol_stack *stack, uint8_t use_ltran_fla
|
||||
struct rte_ether_hdr *ethh = rte_pktmbuf_mtod(stack->pkts[i], struct rte_ether_hdr *);
|
||||
if (unlikely(RTE_BE16(RTE_ETHER_TYPE_ARP) == ethh->ether_type)) {
|
||||
stack_broadcast_arp(stack->pkts[i], stack);
|
||||
- if (!use_ltran_flag) {
|
||||
+ if (!use_ltran_flag && !rte_is_broadcast_ether_addr(ðh->d_addr)) {
|
||||
// copy arp into other process
|
||||
transfer_arp_to_other_process(stack->pkts[i]);
|
||||
transfer_type = TRANSFER_KERNEL;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
204
0219-revert-select_thread_path-and-optimize-app-thread-wh.patch
Normal file
204
0219-revert-select_thread_path-and-optimize-app-thread-wh.patch
Normal file
@ -0,0 +1,204 @@
|
||||
From f93092054d3fbf55d522a16c888fefeee00b5da0 Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Wed, 22 Mar 2023 20:07:28 +0800
|
||||
Subject: [PATCH] revert select_thread_path and optimize app thread when
|
||||
sendmsg
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_wrap.c | 26 ++++++-----------
|
||||
src/lstack/core/lstack_init.c | 53 -----------------------------------
|
||||
src/lstack/core/lstack_lwip.c | 4 +--
|
||||
3 files changed, 11 insertions(+), 72 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index e1b82fc..5234c19 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -49,9 +49,7 @@ enum KERNEL_LWIP_PATH {
|
||||
PATH_UNKNOW,
|
||||
};
|
||||
|
||||
-bool select_thread_path(void);
|
||||
-
|
||||
-static enum KERNEL_LWIP_PATH select_path(int fd)
|
||||
+static inline enum KERNEL_LWIP_PATH select_path(int fd)
|
||||
{
|
||||
if (unlikely(posix_api == NULL)) {
|
||||
/*
|
||||
@@ -64,29 +62,21 @@ static enum KERNEL_LWIP_PATH select_path(int fd)
|
||||
return PATH_KERNEL;
|
||||
}
|
||||
|
||||
- if (!select_thread_path()) {
|
||||
- return PATH_KERNEL;
|
||||
- }
|
||||
-
|
||||
if (unlikely(posix_api->ues_posix)) {
|
||||
return PATH_KERNEL;
|
||||
}
|
||||
|
||||
- struct lwip_sock *sock = posix_api->get_socket(fd);
|
||||
+ struct lwip_sock *sock = get_socket_by_fd(fd);
|
||||
|
||||
/* AF_UNIX case */
|
||||
- if (!sock) {
|
||||
+ if (!sock || !sock->conn || CONN_TYPE_IS_HOST(sock->conn)) {
|
||||
return PATH_KERNEL;
|
||||
}
|
||||
|
||||
- if (CONN_TYPE_IS_LIBOS(sock->conn)) {
|
||||
+ if (likely(CONN_TYPE_IS_LIBOS(sock->conn))) {
|
||||
return PATH_LWIP;
|
||||
}
|
||||
|
||||
- if (CONN_TYPE_IS_HOST(sock->conn)) {
|
||||
- return PATH_KERNEL;
|
||||
- }
|
||||
-
|
||||
struct tcp_pcb *pcb = sock->conn->pcb.tcp;
|
||||
/* after lwip connect, call send immediately, pcb->state is SYN_SENT, need return PATH_LWIP */
|
||||
/* pcb->state default value is CLOSED when call socket, need return PATH_UNKNOW */
|
||||
@@ -133,7 +123,7 @@ static inline int32_t do_epoll_create(int32_t size)
|
||||
|
||||
static inline int32_t do_epoll_ctl(int32_t epfd, int32_t op, int32_t fd, struct epoll_event* event)
|
||||
{
|
||||
- if (unlikely(posix_api->ues_posix) || !select_thread_path()) {
|
||||
+ if (unlikely(posix_api->ues_posix)) {
|
||||
return posix_api->epoll_ctl_fn(epfd, op, fd, event);
|
||||
}
|
||||
|
||||
@@ -142,7 +132,7 @@ static inline int32_t do_epoll_ctl(int32_t epfd, int32_t op, int32_t fd, struct
|
||||
|
||||
static inline int32_t do_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t maxevents, int32_t timeout)
|
||||
{
|
||||
- if (unlikely(posix_api->ues_posix) || !select_thread_path()) {
|
||||
+ if (unlikely(posix_api->ues_posix)) {
|
||||
return posix_api->epoll_wait_fn(epfd, events, maxevents, timeout);
|
||||
}
|
||||
|
||||
@@ -291,8 +281,10 @@ static int32_t do_connect(int32_t s, const struct sockaddr *name, socklen_t name
|
||||
snprintf(listen_ring_name, sizeof(listen_ring_name), "listen_rx_ring_%u", remote_port);
|
||||
if (is_dst_ip_localhost(name) && rte_ring_lookup(listen_ring_name) == NULL) {
|
||||
ret = posix_api->connect_fn(s, name, namelen);
|
||||
+ SET_CONN_TYPE_HOST(sock->conn);
|
||||
} else {
|
||||
ret = rpc_call_connect(s, name, namelen);
|
||||
+ SET_CONN_TYPE_LIBOS(sock->conn);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -524,7 +516,7 @@ static inline int32_t do_close(int32_t s)
|
||||
|
||||
static int32_t do_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||
{
|
||||
- if (unlikely(posix_api->ues_posix) || fds == NULL || nfds == 0 || !select_thread_path()) {
|
||||
+ if (unlikely(posix_api->ues_posix) || fds == NULL || nfds == 0) {
|
||||
return posix_api->poll_fn(fds, nfds, timeout);
|
||||
}
|
||||
|
||||
diff --git a/src/lstack/core/lstack_init.c b/src/lstack/core/lstack_init.c
|
||||
index 3537002..c40938d 100644
|
||||
--- a/src/lstack/core/lstack_init.c
|
||||
+++ b/src/lstack/core/lstack_init.c
|
||||
@@ -51,10 +51,8 @@
|
||||
#define LSTACK_SO_NAME "liblstack.so"
|
||||
#define LSTACK_PRELOAD_NAME_LEN PATH_MAX
|
||||
#define LSTACK_PRELOAD_ENV_PROC "GAZELLE_BIND_PROCNAME"
|
||||
-#define LSTACK_ENV_THREAD "GAZELLE_THREAD_NAME"
|
||||
|
||||
static volatile bool g_init_fail = false;
|
||||
-static PER_THREAD int32_t g_thread_path = -1;
|
||||
|
||||
void set_init_fail(void)
|
||||
{
|
||||
@@ -69,34 +67,14 @@ bool get_init_fail(void)
|
||||
struct lstack_preload {
|
||||
int32_t preload_switch;
|
||||
char env_procname[LSTACK_PRELOAD_NAME_LEN];
|
||||
- bool get_thread_name;
|
||||
- char env_threadname[LSTACK_PRELOAD_NAME_LEN];
|
||||
};
|
||||
static struct lstack_preload g_preload_info = {0};
|
||||
|
||||
-static void get_select_thread_name(void)
|
||||
-{
|
||||
- g_preload_info.get_thread_name = true;
|
||||
-
|
||||
- char *enval = NULL;
|
||||
- enval = getenv(LSTACK_ENV_THREAD);
|
||||
- if (enval == NULL) {
|
||||
- return;
|
||||
- }
|
||||
- if (strcpy_s(g_preload_info.env_threadname, LSTACK_PRELOAD_NAME_LEN, enval) != EOK) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- LSTACK_PRE_LOG(LSTACK_INFO, "thread name=%s ok\n", g_preload_info.env_threadname);
|
||||
-}
|
||||
-
|
||||
static int32_t preload_info_init(void)
|
||||
{
|
||||
char *enval = NULL;
|
||||
|
||||
g_preload_info.preload_switch = 0;
|
||||
-
|
||||
- get_select_thread_name();
|
||||
|
||||
enval = getenv(LSTACK_PRELOAD_ENV_SYS);
|
||||
if (enval == NULL) {
|
||||
@@ -120,37 +98,6 @@ static int32_t preload_info_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-bool select_thread_path(void)
|
||||
-{
|
||||
- if (g_thread_path >= 0) {
|
||||
- return g_thread_path;
|
||||
- }
|
||||
-
|
||||
- if (!g_preload_info.get_thread_name) {
|
||||
- get_select_thread_name();
|
||||
- }
|
||||
-
|
||||
- /* not set GAZELLE_THREAD_NAME, select all thread */
|
||||
- if (g_preload_info.env_threadname[0] == '\0') {
|
||||
- g_thread_path = 1;
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- char thread_name[PATH_MAX] = {0};
|
||||
- if (pthread_getname_np(pthread_self(), thread_name, PATH_MAX) != 0) {
|
||||
- g_thread_path = 0;
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (strstr(thread_name, g_preload_info.env_threadname) == NULL) {
|
||||
- g_thread_path = 0;
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- g_thread_path = 1;
|
||||
- return true;
|
||||
-}
|
||||
-
|
||||
static void check_process_start(void) {
|
||||
if (get_global_cfg_params()->is_primary) {
|
||||
return;
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 7355d7b..b4a08ea 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -886,8 +886,8 @@ ssize_t gazelle_same_node_ring_send(struct lwip_sock *sock, const void *buf, siz
|
||||
PER_THREAD uint16_t stack_sock_num[GAZELLE_MAX_STACK_NUM] = {0};
|
||||
PER_THREAD uint16_t max_sock_stack = 0;
|
||||
|
||||
-static void thread_bind_stack(struct lwip_sock *sock) {
|
||||
- if (likely(!sock->stack || sock->already_bind_numa)) {
|
||||
+static inline void thread_bind_stack(struct lwip_sock *sock) {
|
||||
+ if (likely(sock->already_bind_numa || !sock->stack)) {
|
||||
return;
|
||||
}
|
||||
sock->already_bind_numa = 1;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
471
0220-check-primary-process-idx-and-secondary-lstack-num.patch
Normal file
471
0220-check-primary-process-idx-and-secondary-lstack-num.patch
Normal file
@ -0,0 +1,471 @@
|
||||
From fa4c8d298f37e7dad01d91cec6834238841d81b3 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng12 <jiangheng14@huawei.com>
|
||||
Date: Fri, 24 Mar 2023 11:12:34 +0800
|
||||
Subject: [PATCH] check primary process idx and secondary lstack num
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 5 +-
|
||||
src/lstack/api/lstack_wrap.c | 9 ++-
|
||||
src/lstack/core/lstack_cfg.c | 5 ++
|
||||
src/lstack/core/lstack_init.c | 8 ++
|
||||
src/lstack/core/lstack_lwip.c | 20 ++---
|
||||
src/lstack/include/lstack_cfg.h | 1 +
|
||||
src/lstack/include/lstack_ethdev.h | 1 +
|
||||
src/lstack/netif/lstack_ethdev.c | 126 ++++++++++++++++++-----------
|
||||
src/ltran/ltran_dfx.c | 4 +-
|
||||
9 files changed, 112 insertions(+), 67 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index 1863837..9105871 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -200,13 +200,14 @@ struct gazelle_stat_low_power_info {
|
||||
};
|
||||
|
||||
#define RTE_ETH_XSTATS_NAME_SIZE 64
|
||||
+#define RTE_ETH_XSTATS_MAX_LEN 128
|
||||
struct nic_eth_xstats_name {
|
||||
char name[RTE_ETH_XSTATS_NAME_SIZE];
|
||||
};
|
||||
|
||||
struct nic_eth_xstats {
|
||||
- struct nic_eth_xstats_name xstats_name[128];
|
||||
- uint64_t values[128];
|
||||
+ struct nic_eth_xstats_name xstats_name[RTE_ETH_XSTATS_MAX_LEN];
|
||||
+ uint64_t values[RTE_ETH_XSTATS_MAX_LEN];
|
||||
uint32_t len;
|
||||
uint16_t port_id;
|
||||
};
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index 5234c19..5132ee9 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <sys/epoll.h>
|
||||
#include <unistd.h>
|
||||
#include <net/if.h>
|
||||
+#include <securec.h>
|
||||
|
||||
#include <lwip/posix_api.h>
|
||||
#include <lwip/lwipsock.h>
|
||||
@@ -187,8 +188,8 @@ static int get_addr(struct sockaddr_in *sin, char *interface)
|
||||
|
||||
if ((sockfd = posix_api->socket_fn(AF_INET, SOCK_STREAM, 0)) < 0) return -1;
|
||||
|
||||
- memset(&ifr, 0, sizeof(ifr));
|
||||
- snprintf(ifr.ifr_name, (sizeof(ifr.ifr_name) - 1), "%s", interface);
|
||||
+ memset_s(&ifr, sizeof(ifr), 0, sizeof(ifr));
|
||||
+ snprintf_s(ifr.ifr_name, sizeof(ifr.ifr_name), (sizeof(ifr.ifr_name) - 1), "%s", interface);
|
||||
|
||||
if(posix_api->ioctl_fn(sockfd, SIOCGIFADDR, &ifr) < 0){
|
||||
posix_api->close_fn(sockfd);
|
||||
@@ -243,7 +244,7 @@ bool is_dst_ip_localhost(const struct sockaddr *addr)
|
||||
char interface[20] = {0};
|
||||
strncpy(interface, p, n);
|
||||
|
||||
- memset(sin, 0, sizeof(struct sockaddr_in));
|
||||
+ memset_s(sin, sizeof(struct sockaddr_in), 0, sizeof(struct sockaddr_in));
|
||||
int ret = get_addr(sin, interface);
|
||||
if (ret == 0) {
|
||||
if(sin->sin_addr.s_addr == servaddr->sin_addr.s_addr){
|
||||
@@ -278,7 +279,7 @@ static int32_t do_connect(int32_t s, const struct sockaddr *name, socklen_t name
|
||||
int32_t ret = 0;
|
||||
char listen_ring_name[RING_NAME_LEN];
|
||||
int remote_port = htons(((struct sockaddr_in *)name)->sin_port);
|
||||
- snprintf(listen_ring_name, sizeof(listen_ring_name), "listen_rx_ring_%u", remote_port);
|
||||
+ snprintf_s(listen_ring_name, sizeof(listen_ring_name), sizeof(listen_ring_name) - 1, "listen_rx_ring_%u", remote_port);
|
||||
if (is_dst_ip_localhost(name) && rte_ring_lookup(listen_ring_name) == NULL) {
|
||||
ret = posix_api->connect_fn(s, name, namelen);
|
||||
SET_CONN_TYPE_HOST(sock->conn);
|
||||
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
|
||||
index f033fa7..95590e2 100644
|
||||
--- a/src/lstack/core/lstack_cfg.c
|
||||
+++ b/src/lstack/core/lstack_cfg.c
|
||||
@@ -1040,5 +1040,10 @@ static int parse_tuple_filter(void)
|
||||
if (g_config_params.use_ltran || g_config_params.listen_shadow) {
|
||||
return -EINVAL;
|
||||
}
|
||||
+
|
||||
+ // check primary process_idx
|
||||
+ if (g_config_params.is_primary && g_config_params.process_idx != 0) {
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
diff --git a/src/lstack/core/lstack_init.c b/src/lstack/core/lstack_init.c
|
||||
index c40938d..76dd384 100644
|
||||
--- a/src/lstack/core/lstack_init.c
|
||||
+++ b/src/lstack/core/lstack_init.c
|
||||
@@ -324,6 +324,14 @@ __attribute__((constructor)) void gazelle_network_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * check lstack num, and get process idx
|
||||
+ */
|
||||
+ if (check_params_from_primary() < 0) {
|
||||
+ LSTACK_PRE_LOG(LSTACK_ERR, "lstack num error, not same to primary process!\n");
|
||||
+ LSTACK_EXIT(1, "lstack num error, not same to primary process!\n");
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* save initial affinity */
|
||||
if (!get_global_cfg_params()->main_thread_affinity) {
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index b4a08ea..a4e6e0b 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -1386,7 +1386,7 @@ err_t netif_loop_output(struct netif *netif, struct pbuf *p)
|
||||
if ((flags & TCP_SYN) && !(flags & TCP_ACK)) {
|
||||
/* SYN packet, send to listen_ring */
|
||||
char ring_name[RING_NAME_LEN] = {0};
|
||||
- snprintf(ring_name, sizeof(ring_name), "listen_rx_ring_%d", pcb->remote_port);
|
||||
+ snprintf_s(ring_name, sizeof(ring_name), sizeof(ring_name) - 1, "listen_rx_ring_%d", pcb->remote_port);
|
||||
struct rte_ring *ring = rte_ring_lookup(ring_name);
|
||||
if (ring == NULL) {
|
||||
LSTACK_LOG(INFO, LSTACK, "netif_loop_output: cant find listen_rx_ring %d\n", pcb->remote_port);
|
||||
@@ -1411,7 +1411,7 @@ err_t netif_loop_output(struct netif *netif, struct pbuf *p)
|
||||
err_t find_same_node_memzone(struct tcp_pcb *pcb, struct lwip_sock *nsock)
|
||||
{
|
||||
char name[RING_NAME_LEN];
|
||||
- snprintf(name, sizeof(name), "rte_mz_rx_%u", pcb->remote_port);
|
||||
+ snprintf_s(name, sizeof(name), sizeof(name) - 1, "rte_mz_rx_%u", pcb->remote_port);
|
||||
if ((nsock->same_node_tx_ring_mz = rte_memzone_lookup(name)) == NULL) {
|
||||
LSTACK_LOG(INFO, LSTACK, "lwip_accept: can't find %s\n",name);
|
||||
return -1;
|
||||
@@ -1420,13 +1420,13 @@ err_t find_same_node_memzone(struct tcp_pcb *pcb, struct lwip_sock *nsock)
|
||||
}
|
||||
nsock->same_node_tx_ring = (struct same_node_ring *)nsock->same_node_tx_ring_mz->addr;
|
||||
|
||||
- snprintf(name, sizeof(name), "rte_mz_buf_rx_%u", pcb->remote_port);
|
||||
+ snprintf_s(name, sizeof(name), sizeof(name) - 1, "rte_mz_buf_rx_%u", pcb->remote_port);
|
||||
if ((nsock->same_node_tx_ring->mz = rte_memzone_lookup(name)) == NULL) {
|
||||
LSTACK_LOG(INFO, LSTACK, "lwip_accept: can't find %s\n",name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
- snprintf(name, sizeof(name), "rte_mz_tx_%u", pcb->remote_port);
|
||||
+ snprintf_s(name, sizeof(name), sizeof(name) - 1, "rte_mz_tx_%u", pcb->remote_port);
|
||||
if ((nsock->same_node_rx_ring_mz = rte_memzone_lookup(name)) == NULL) {
|
||||
LSTACK_LOG(INFO, LSTACK, "lwip_accept: can't find %s\n",name);
|
||||
return -1;
|
||||
@@ -1435,7 +1435,7 @@ err_t find_same_node_memzone(struct tcp_pcb *pcb, struct lwip_sock *nsock)
|
||||
}
|
||||
nsock->same_node_rx_ring = (struct same_node_ring *)nsock->same_node_rx_ring_mz->addr;
|
||||
|
||||
- snprintf(name, sizeof(name), "rte_mz_buf_tx_%u", pcb->remote_port);
|
||||
+ snprintf_s(name, sizeof(name), sizeof(name) - 1,"rte_mz_buf_tx_%u", pcb->remote_port);
|
||||
if ((nsock->same_node_rx_ring->mz = rte_memzone_lookup(name)) == NULL) {
|
||||
LSTACK_LOG(INFO, LSTACK, "lwip_accept: can't find %s\n",name);
|
||||
return -1;
|
||||
@@ -1450,7 +1450,7 @@ err_t find_same_node_memzone(struct tcp_pcb *pcb, struct lwip_sock *nsock)
|
||||
err_t same_node_memzone_create(const struct rte_memzone **zone, int size, int port, char *name, char *rx)
|
||||
{
|
||||
char mem_name[RING_NAME_LEN] = {0};
|
||||
- snprintf(mem_name, sizeof(mem_name), "%s_%s_%u", name, rx, port);
|
||||
+ snprintf_s(mem_name, sizeof(mem_name), sizeof(mem_name) - 1, "%s_%s_%u", name, rx, port);
|
||||
|
||||
*zone = rte_memzone_reserve_aligned(mem_name, size, rte_socket_id(), 0, RTE_CACHE_LINE_SIZE);
|
||||
if (*zone == NULL) {
|
||||
@@ -1473,7 +1473,7 @@ err_t same_node_ring_create(struct rte_ring **ring, int size, int port, char *na
|
||||
flags = RING_F_SP_ENQ | RING_F_SC_DEQ;
|
||||
}
|
||||
|
||||
- snprintf(ring_name, sizeof(ring_name), "%s_%s_ring_%u", name, rx, port);
|
||||
+ snprintf_s(ring_name, sizeof(ring_name), sizeof(ring_name) - 1, "%s_%s_ring_%u", name, rx, port);
|
||||
*ring = rte_ring_create(ring_name, size, rte_socket_id(), flags);
|
||||
if (*ring == NULL) {
|
||||
LSTACK_LOG(ERR, LSTACK, "cannot create rte_ring %s, errno is %d\n", ring_name, rte_errno);
|
||||
@@ -1550,10 +1550,10 @@ END:
|
||||
err_t find_same_node_ring(struct tcp_pcb *npcb)
|
||||
{
|
||||
char name[RING_NAME_LEN] = {0};
|
||||
- snprintf(name, sizeof(name), "client_tx_ring_%u", npcb->remote_port);
|
||||
+ snprintf_s(name, sizeof(name), sizeof(name) - 1, "client_tx_ring_%u", npcb->remote_port);
|
||||
npcb->client_rx_ring = rte_ring_lookup(name);
|
||||
- memset(name, 0, sizeof(name));
|
||||
- snprintf(name, sizeof(name), "client_rx_ring_%u", npcb->remote_port);
|
||||
+ memset_s(name, sizeof(name), 0, sizeof(name));
|
||||
+ snprintf_s(name, sizeof(name), sizeof(name) - 1, "client_rx_ring_%u", npcb->remote_port);
|
||||
npcb->client_tx_ring = rte_ring_lookup(name);
|
||||
npcb->free_ring = 0;
|
||||
if (npcb->client_tx_ring == NULL ||
|
||||
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
|
||||
index 16f37b4..a4170ca 100644
|
||||
--- a/src/lstack/include/lstack_cfg.h
|
||||
+++ b/src/lstack/include/lstack_cfg.h
|
||||
@@ -34,6 +34,7 @@
|
||||
#define LOG_DIR_PATH PATH_MAX
|
||||
#define LOG_LEVEL_LEN 16
|
||||
#define GAZELLE_MAX_NUMA_NODES 8
|
||||
+#define MAX_PROCESS_NUM 32
|
||||
|
||||
/* Default value of low power mode parameters */
|
||||
#define LSTACK_LPM_DETECT_MS_MIN (5 * 1000)
|
||||
diff --git a/src/lstack/include/lstack_ethdev.h b/src/lstack/include/lstack_ethdev.h
|
||||
index 39a972d..7f944eb 100644
|
||||
--- a/src/lstack/include/lstack_ethdev.h
|
||||
+++ b/src/lstack/include/lstack_ethdev.h
|
||||
@@ -45,6 +45,7 @@ int32_t gazelle_eth_dev_poll(struct protocol_stack *stack, uint8_t use_ltran_fla
|
||||
void eth_dev_recv(struct rte_mbuf *mbuf, struct protocol_stack *stack);
|
||||
|
||||
int recv_pkts_from_other_process(int process_index, void* arg);
|
||||
+int32_t check_params_from_primary(void);
|
||||
void kni_handle_rx(uint16_t port_id);
|
||||
void delete_user_process_port(uint16_t dst_port, enum port_type type);
|
||||
void add_user_process_port(uint16_t dst_port, uint8_t process_idx, enum port_type type);
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index b35852b..8d05bdd 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -58,6 +58,9 @@
|
||||
#define ERROR_REPLY "error"
|
||||
#define PACKET_READ_SIZE 32
|
||||
|
||||
+#define GET_LSTACK_NUM 14
|
||||
+#define GET_LSTACK_NUM_STRING "get_lstack_num"
|
||||
+
|
||||
char *client_path = "/var/run/gazelle/client.socket";
|
||||
char *server_path = "/var/run/gazelle/server.socket";
|
||||
const char *split_delim = ",";
|
||||
@@ -171,7 +174,7 @@ void add_rule(char* rule_key, struct rte_flow *flow)
|
||||
HASH_FIND_STR(g_flow_rules, rule_key, rule);
|
||||
if (rule == NULL) {
|
||||
rule = (struct flow_rule*)malloc(sizeof(struct flow_rule));
|
||||
- strcpy(rule->rule_key, rule_key);
|
||||
+ strcpy_s(rule->rule_key, RULE_KEY_LEN, rule_key);
|
||||
HASH_ADD_STR(g_flow_rules, rule_key, rule);
|
||||
}
|
||||
rule->flow = flow;
|
||||
@@ -202,20 +205,26 @@ int transfer_pkt_to_other_process(char *buf, int process_index, int write_len, b
|
||||
|
||||
sockfd = posix_api->socket_fn(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
- memset(&serun, 0, sizeof(serun));
|
||||
+ memset_s(&serun, sizeof(serun), 0, sizeof(serun));
|
||||
serun.sun_family = AF_UNIX;
|
||||
sprintf_s(serun.sun_path, PATH_MAX,"%s%d", server_path, process_index);
|
||||
- int len = offsetof(struct sockaddr_un, sun_path) + strlen(serun.sun_path);
|
||||
+ int32_t len = offsetof(struct sockaddr_un, sun_path) + strlen(serun.sun_path);
|
||||
if (posix_api->connect_fn(sockfd, (struct sockaddr *)&serun, len) < 0){
|
||||
return CONNECT_ERROR;
|
||||
}
|
||||
posix_api->write_fn(sockfd, buf, write_len);
|
||||
if (need_reply) {
|
||||
char reply_message[REPLY_LEN];
|
||||
- posix_api->read_fn(sockfd, reply_message, REPLY_LEN);
|
||||
- if (strcmp(reply_message, SUCCESS_REPLY) == 0) {
|
||||
- ret = TRANSFER_SUCESS;
|
||||
- }else {
|
||||
+ int32_t read_result = posix_api->read_fn(sockfd, reply_message, REPLY_LEN);
|
||||
+ if (read_result > 0) {
|
||||
+ if (strcmp(reply_message, SUCCESS_REPLY) == 0) {
|
||||
+ ret = TRANSFER_SUCESS;
|
||||
+ } else if (strcmp(reply_message, ERROR_REPLY) == 0) {
|
||||
+ ret = REPLY_ERROR;
|
||||
+ } else {
|
||||
+ ret = atoi(reply_message);
|
||||
+ }
|
||||
+ } else {
|
||||
ret = REPLY_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -224,6 +233,21 @@ int transfer_pkt_to_other_process(char *buf, int process_index, int write_len, b
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int32_t check_params_from_primary(void){
|
||||
+ struct cfg_params *cfg = get_global_cfg_params();
|
||||
+ if (cfg->is_primary) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // check lstack num
|
||||
+ char get_lstack_num[GET_LSTACK_NUM];
|
||||
+ sprintf_s(get_lstack_num, GET_LSTACK_NUM, "%s", GET_LSTACK_NUM_STRING);
|
||||
+ int32_t ret = transfer_pkt_to_other_process(get_lstack_num, 0, GET_LSTACK_NUM, true);
|
||||
+ if (ret != cfg->num_cpu) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
struct rte_flow *
|
||||
create_flow_director(uint16_t port_id, uint16_t queue_id, uint32_t src_ip, uint32_t dst_ip,
|
||||
uint16_t src_port, uint16_t dst_port, struct rte_flow_error *error)
|
||||
@@ -240,14 +264,14 @@ create_flow_director(uint16_t port_id, uint16_t queue_id, uint32_t src_ip, uint3
|
||||
struct rte_flow_item_tcp tcp_mask;
|
||||
int res;
|
||||
|
||||
- memset(pattern, 0, sizeof(pattern));
|
||||
- memset(action, 0, sizeof(action));
|
||||
+ memset_s(pattern, sizeof(pattern), 0, sizeof(pattern));
|
||||
+ memset_s(action, sizeof(action), 0, sizeof(action));
|
||||
|
||||
/*
|
||||
* set the rule attribute.
|
||||
* in this case only ingress packets will be checked.
|
||||
*/
|
||||
- memset(&attr, 0, sizeof(struct rte_flow_attr));
|
||||
+ memset_s(&attr, sizeof(struct rte_flow_attr), 0, sizeof(struct rte_flow_attr));
|
||||
attr.ingress = 1;
|
||||
|
||||
/*
|
||||
@@ -262,8 +286,8 @@ create_flow_director(uint16_t port_id, uint16_t queue_id, uint32_t src_ip, uint3
|
||||
pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
|
||||
|
||||
// ip header
|
||||
- memset(&ip_spec, 0, sizeof(struct rte_flow_item_ipv4));
|
||||
- memset(&ip_mask, 0, sizeof(struct rte_flow_item_ipv4));
|
||||
+ memset_s(&ip_spec, sizeof(struct rte_flow_item_ipv4), 0, sizeof(struct rte_flow_item_ipv4));
|
||||
+ memset_s(&ip_mask, sizeof(struct rte_flow_item_ipv4), 0, sizeof(struct rte_flow_item_ipv4));
|
||||
ip_spec.hdr.dst_addr = dst_ip;
|
||||
ip_mask.hdr.dst_addr = FULL_MASK;
|
||||
ip_spec.hdr.src_addr = src_ip;
|
||||
@@ -273,8 +297,8 @@ create_flow_director(uint16_t port_id, uint16_t queue_id, uint32_t src_ip, uint3
|
||||
pattern[1].mask = &ip_mask;
|
||||
|
||||
// tcp header, full mask 0xffff
|
||||
- memset(&tcp_spec, 0, sizeof(struct rte_flow_item_tcp));
|
||||
- memset(&tcp_mask, 0, sizeof(struct rte_flow_item_tcp));
|
||||
+ memset_s(&tcp_spec, sizeof(struct rte_flow_item_tcp), 0, sizeof(struct rte_flow_item_tcp));
|
||||
+ memset_s(&tcp_mask, sizeof(struct rte_flow_item_tcp), 0, sizeof(struct rte_flow_item_tcp));
|
||||
pattern[2].type = RTE_FLOW_ITEM_TYPE_TCP;
|
||||
tcp_spec.hdr.src_port = src_port;
|
||||
tcp_spec.hdr.dst_port = dst_port;
|
||||
@@ -392,7 +416,7 @@ static int str_to_array(char *args, uint32_t *array, int size)
|
||||
char *elem = NULL;
|
||||
char *next_token = NULL;
|
||||
|
||||
- memset(array, 0, sizeof(*array) * size);
|
||||
+ memset_s(array, sizeof(*array) * size, 0, sizeof(*array) * size);
|
||||
elem = strtok_s((char *)args, split_delim, &next_token);
|
||||
while (elem != NULL) {
|
||||
if (cnt >= size) {
|
||||
@@ -548,50 +572,50 @@ int recv_pkts_from_other_process(int process_index, void* arg){
|
||||
int listenfd, connfd, size;
|
||||
char buf[132];
|
||||
/* socket */
|
||||
- if ((listenfd = posix_api->socket_fn(AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
- perror("socket error");
|
||||
- return -1;
|
||||
- }
|
||||
+ if ((listenfd = posix_api->socket_fn(AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
+ perror("socket error");
|
||||
+ return -1;
|
||||
+ }
|
||||
/* bind */
|
||||
- memset(&serun, 0, sizeof(serun));
|
||||
- serun.sun_family = AF_UNIX;
|
||||
+ memset_s(&serun, sizeof(serun), 0, sizeof(serun));
|
||||
+ serun.sun_family = AF_UNIX;
|
||||
char process_server_path[PATH_MAX];
|
||||
sprintf_s(process_server_path, sizeof(process_server_path), "%s%d", server_path, process_index);
|
||||
- strcpy(serun.sun_path, process_server_path);
|
||||
- size = offsetof(struct sockaddr_un, sun_path) + strlen(serun.sun_path);
|
||||
- unlink(process_server_path);
|
||||
+ strcpy_s(serun.sun_path, sizeof(serun.sun_path),process_server_path);
|
||||
+ size = offsetof(struct sockaddr_un, sun_path) + strlen(serun.sun_path);
|
||||
+ unlink(process_server_path);
|
||||
if (posix_api->bind_fn(listenfd, (struct sockaddr *)&serun, size) < 0) {
|
||||
- perror("bind error");
|
||||
- return -1;
|
||||
+ perror("bind error");
|
||||
+ return -1;
|
||||
}
|
||||
- if (posix_api->listen_fn(listenfd, 20) < 0) {
|
||||
+ if (posix_api->listen_fn(listenfd, 20) < 0) { /* 20: max backlog */
|
||||
perror("listen error");
|
||||
- return -1;
|
||||
+ return -1;
|
||||
}
|
||||
sem_post((sem_t *)arg);
|
||||
/* block */
|
||||
while(1) {
|
||||
- cliun_len = sizeof(cliun);
|
||||
- if ((connfd = posix_api->accept_fn(listenfd, (struct sockaddr *)&cliun, &cliun_len)) < 0){
|
||||
- perror("accept error");
|
||||
- continue;
|
||||
- }
|
||||
- while(1) {
|
||||
- int n = posix_api->read_fn(connfd, buf, sizeof(buf));
|
||||
- if (n < 0) {
|
||||
- perror("read error");
|
||||
- break;
|
||||
- } else if(n == 0) {
|
||||
- break;
|
||||
+ cliun_len = sizeof(cliun);
|
||||
+ if ((connfd = posix_api->accept_fn(listenfd, (struct sockaddr *)&cliun, &cliun_len)) < 0){
|
||||
+ perror("accept error");
|
||||
+ continue;
|
||||
+ }
|
||||
+ while(1) {
|
||||
+ int n = posix_api->read_fn(connfd, buf, sizeof(buf));
|
||||
+ if (n < 0) {
|
||||
+ perror("read error");
|
||||
+ break;
|
||||
+ } else if(n == 0) {
|
||||
+ break;
|
||||
}
|
||||
|
||||
if(n == LSTACK_MBUF_LEN){
|
||||
/* arp */
|
||||
parse_arp_and_transefer(buf);
|
||||
- }else if(n == TRANSFER_TCP_MUBF_LEN) {
|
||||
+ } else if (n == TRANSFER_TCP_MUBF_LEN) {
|
||||
/* tcp. lstack_mbuf_queue_id */
|
||||
parse_tcp_and_transefer(buf);
|
||||
- }else if (n == DELETE_FLOWS_PARAMS_LENGTH) {
|
||||
+ } else if (n == DELETE_FLOWS_PARAMS_LENGTH) {
|
||||
/* delete rule */
|
||||
parse_and_delete_rule(buf);
|
||||
}else if(n == CREATE_FLOWS_PARAMS_LENGTH){
|
||||
@@ -599,20 +623,24 @@ int recv_pkts_from_other_process(int process_index, void* arg){
|
||||
parse_and_create_rule(buf);
|
||||
char reply_buf[REPLY_LEN];
|
||||
sprintf_s(reply_buf, sizeof(reply_buf), "%s", SUCCESS_REPLY);
|
||||
- posix_api->write_fn(connfd, reply_buf, REPLY_LEN);
|
||||
- }else {
|
||||
+ posix_api->write_fn(connfd, reply_buf, REPLY_LEN);
|
||||
+ }else if (n == GET_LSTACK_NUM) {
|
||||
+ char reply_buf[REPLY_LEN];
|
||||
+ sprintf_s(reply_buf, sizeof(reply_buf), "%d", get_global_cfg_params()->num_cpu);
|
||||
+ posix_api->write_fn(connfd, reply_buf, REPLY_LEN);
|
||||
+ }else{
|
||||
/* add port */
|
||||
parse_and_add_or_delete_listen_port(buf);
|
||||
char reply_buf[REPLY_LEN];
|
||||
sprintf_s(reply_buf, sizeof(reply_buf), "%s", SUCCESS_REPLY);
|
||||
- posix_api->write_fn(connfd, reply_buf, REPLY_LEN);
|
||||
+ posix_api->write_fn(connfd, reply_buf, REPLY_LEN);
|
||||
}
|
||||
|
||||
- }
|
||||
- posix_api->close_fn(connfd);
|
||||
+ }
|
||||
+ posix_api->close_fn(connfd);
|
||||
}
|
||||
- posix_api->close_fn(listenfd);
|
||||
- return 0;
|
||||
+ posix_api->close_fn(listenfd);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
void concat_mbuf_and_queue_id(struct rte_mbuf *mbuf, uint16_t queue_id, char* mbuf_and_queue_id, int write_len){
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index 331a23c..9180e89 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -139,8 +139,8 @@ static void gazelle_print_lstack_xstats(void *buf, const struct gazelle_stat_msg
|
||||
|
||||
printf("###### NIC extended statistics for port %-2d #########\n", 0);
|
||||
printf("%s############################\n",nic_stats_border);
|
||||
- if (xstats->len <= 0) {
|
||||
- printf("Cannot get xstats\n");
|
||||
+ if (xstats->len <= 0 || xstats->len > RTE_ETH_XSTATS_MAX_LEN) {
|
||||
+ printf("xstats item(%d) num error!\n", xstats->len);
|
||||
return;
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
322
0221-optimite-select_path-and-pbuf_take.patch
Normal file
322
0221-optimite-select_path-and-pbuf_take.patch
Normal file
@ -0,0 +1,322 @@
|
||||
From ff2512a2ac5000b3e0bedc4fd194d5f8a2b07887 Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Fri, 24 Mar 2023 19:30:09 +0800
|
||||
Subject: [PATCH] optimite select_path and pbuf_take
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_wrap.c | 65 +++++++++++++++++++++-----------
|
||||
src/lstack/core/lstack_lwip.c | 22 ++++++++---
|
||||
src/lstack/include/lstack_lwip.h | 2 +-
|
||||
3 files changed, 60 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index 5132ee9..1fe576f 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -50,7 +50,7 @@ enum KERNEL_LWIP_PATH {
|
||||
PATH_UNKNOW,
|
||||
};
|
||||
|
||||
-static inline enum KERNEL_LWIP_PATH select_path(int fd)
|
||||
+static inline enum KERNEL_LWIP_PATH select_path(int fd, struct lwip_sock **socket)
|
||||
{
|
||||
if (unlikely(posix_api == NULL)) {
|
||||
/*
|
||||
@@ -75,6 +75,7 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd)
|
||||
}
|
||||
|
||||
if (likely(CONN_TYPE_IS_LIBOS(sock->conn))) {
|
||||
+ *socket = sock;
|
||||
return PATH_LWIP;
|
||||
}
|
||||
|
||||
@@ -82,6 +83,7 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd)
|
||||
/* after lwip connect, call send immediately, pcb->state is SYN_SENT, need return PATH_LWIP */
|
||||
/* pcb->state default value is CLOSED when call socket, need return PATH_UNKNOW */
|
||||
if (pcb != NULL && pcb->state <= ESTABLISHED && pcb->state >= LISTEN) {
|
||||
+ *socket = sock
|
||||
return PATH_LWIP;
|
||||
}
|
||||
|
||||
@@ -150,7 +152,8 @@ static inline int32_t do_epoll_wait(int32_t epfd, struct epoll_event* events, in
|
||||
|
||||
static inline int32_t do_accept(int32_t s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
{
|
||||
- if (select_path(s) == PATH_KERNEL) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_KERNEL) {
|
||||
return posix_api->accept_fn(s, addr, addrlen);
|
||||
}
|
||||
|
||||
@@ -168,7 +171,8 @@ static int32_t do_accept4(int32_t s, struct sockaddr *addr, socklen_t *addrlen,
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_KERNEL) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_KERNEL) {
|
||||
return posix_api->accept4_fn(s, addr, addrlen, flags);
|
||||
}
|
||||
|
||||
@@ -208,7 +212,8 @@ static int32_t do_bind(int32_t s, const struct sockaddr *name, socklen_t namelen
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_KERNEL) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_KERNEL) {
|
||||
return posix_api->bind_fn(s, name, namelen);
|
||||
}
|
||||
|
||||
@@ -263,11 +268,11 @@ static int32_t do_connect(int32_t s, const struct sockaddr *name, socklen_t name
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_KERNEL) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_KERNEL) {
|
||||
return posix_api->connect_fn(s, name, namelen);
|
||||
}
|
||||
|
||||
- struct lwip_sock *sock = get_socket(s);
|
||||
if (sock == NULL) {
|
||||
return posix_api->connect_fn(s, name, namelen);
|
||||
}
|
||||
@@ -293,7 +298,8 @@ static int32_t do_connect(int32_t s, const struct sockaddr *name, socklen_t name
|
||||
|
||||
static inline int32_t do_listen(int32_t s, int32_t backlog)
|
||||
{
|
||||
- if (select_path(s) == PATH_KERNEL) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_KERNEL) {
|
||||
return posix_api->listen_fn(s, backlog);
|
||||
}
|
||||
|
||||
@@ -317,7 +323,8 @@ static inline int32_t do_getpeername(int32_t s, struct sockaddr *name, socklen_t
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_LWIP) {
|
||||
return rpc_call_getpeername(s, name, namelen);
|
||||
}
|
||||
|
||||
@@ -330,7 +337,8 @@ static inline int32_t do_getsockname(int32_t s, struct sockaddr *name, socklen_t
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_LWIP) {
|
||||
return rpc_call_getsockname(s, name, namelen);
|
||||
}
|
||||
|
||||
@@ -351,7 +359,8 @@ static bool unsupport_optname(int32_t optname)
|
||||
|
||||
static inline int32_t do_getsockopt(int32_t s, int32_t level, int32_t optname, void *optval, socklen_t *optlen)
|
||||
{
|
||||
- if (select_path(s) == PATH_LWIP && !unsupport_optname(optname)) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_LWIP && !unsupport_optname(optname)) {
|
||||
return rpc_call_getsockopt(s, level, optname, optval, optlen);
|
||||
}
|
||||
|
||||
@@ -360,7 +369,8 @@ static inline int32_t do_getsockopt(int32_t s, int32_t level, int32_t optname, v
|
||||
|
||||
static inline int32_t do_setsockopt(int32_t s, int32_t level, int32_t optname, const void *optval, socklen_t optlen)
|
||||
{
|
||||
- if (select_path(s) == PATH_KERNEL || unsupport_optname(optname)) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_KERNEL || unsupport_optname(optname)) {
|
||||
return posix_api->setsockopt_fn(s, level, optname, optval, optlen);
|
||||
}
|
||||
|
||||
@@ -393,7 +403,8 @@ static inline ssize_t do_recv(int32_t sockfd, void *buf, size_t len, int32_t fla
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (select_path(sockfd) == PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(sockfd, &sock) == PATH_LWIP) {
|
||||
return read_stack_data(sockfd, buf, len, flags);
|
||||
}
|
||||
|
||||
@@ -410,7 +421,8 @@ static inline ssize_t do_read(int32_t s, void *mem, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_LWIP) {
|
||||
return read_stack_data(s, mem, len, 0);
|
||||
}
|
||||
return posix_api->read_fn(s, mem, len);
|
||||
@@ -418,7 +430,8 @@ static inline ssize_t do_read(int32_t s, void *mem, size_t len)
|
||||
|
||||
static inline ssize_t do_readv(int32_t s, const struct iovec *iov, int iovcnt)
|
||||
{
|
||||
- if (select_path(s) != PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) != PATH_LWIP) {
|
||||
return posix_api->readv_fn(s, iov, iovcnt);
|
||||
}
|
||||
|
||||
@@ -441,7 +454,8 @@ static inline ssize_t do_readv(int32_t s, const struct iovec *iov, int iovcnt)
|
||||
|
||||
static inline ssize_t do_send(int32_t sockfd, const void *buf, size_t len, int32_t flags)
|
||||
{
|
||||
- if (select_path(sockfd) != PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(sockfd, &sock) != PATH_LWIP) {
|
||||
return posix_api->send_fn(sockfd, buf, len, flags);
|
||||
}
|
||||
|
||||
@@ -450,7 +464,8 @@ static inline ssize_t do_send(int32_t sockfd, const void *buf, size_t len, int32
|
||||
|
||||
static inline ssize_t do_write(int32_t s, const void *mem, size_t size)
|
||||
{
|
||||
- if (select_path(s) != PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) != PATH_LWIP) {
|
||||
return posix_api->write_fn(s, mem, size);
|
||||
}
|
||||
|
||||
@@ -459,7 +474,8 @@ static inline ssize_t do_write(int32_t s, const void *mem, size_t size)
|
||||
|
||||
static inline ssize_t do_writev(int32_t s, const struct iovec *iov, int iovcnt)
|
||||
{
|
||||
- if (select_path(s) != PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) != PATH_LWIP) {
|
||||
return posix_api->writev_fn(s, iov, iovcnt);
|
||||
}
|
||||
|
||||
@@ -472,7 +488,7 @@ static inline ssize_t do_writev(int32_t s, const struct iovec *iov, int iovcnt)
|
||||
msg.msg_control = NULL;
|
||||
msg.msg_controllen = 0;
|
||||
msg.msg_flags = 0;
|
||||
- return sendmsg_to_stack(s, &msg, 0);
|
||||
+ return sendmsg_to_stack(sock, s, &msg, 0);
|
||||
}
|
||||
|
||||
static inline ssize_t do_recvmsg(int32_t s, struct msghdr *message, int32_t flags)
|
||||
@@ -481,7 +497,8 @@ static inline ssize_t do_recvmsg(int32_t s, struct msghdr *message, int32_t flag
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_LWIP) {
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_LWIP) {
|
||||
return recvmsg_from_stack(s, message, flags);
|
||||
}
|
||||
|
||||
@@ -494,8 +511,9 @@ static inline ssize_t do_sendmsg(int32_t s, const struct msghdr *message, int32_
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_LWIP) {
|
||||
- return sendmsg_to_stack(s, message, flags);
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
+ if (select_path(s, &sock) == PATH_LWIP) {
|
||||
+ return sendmsg_to_stack(sock, s, message, flags);
|
||||
}
|
||||
|
||||
return posix_api->send_msg(s, message, flags);
|
||||
@@ -508,7 +526,7 @@ static inline int32_t do_close(int32_t s)
|
||||
return lstack_epoll_close(s);
|
||||
}
|
||||
|
||||
- if (select_path(s) == PATH_KERNEL) {
|
||||
+ if (select_path(s, &sock) == PATH_KERNEL) {
|
||||
return posix_api->close_fn(s);
|
||||
}
|
||||
|
||||
@@ -561,7 +579,8 @@ static int32_t do_sigaction(int32_t signum, const struct sigaction *act, struct
|
||||
va_start(ap, _cmd); \
|
||||
val = va_arg(ap, typeof(val)); \
|
||||
va_end(ap); \
|
||||
- if (select_path(_fd) == PATH_KERNEL) \
|
||||
+ struct lwip_sock *sock = NULL; \
|
||||
+ if (select_path(_fd, &sock) == PATH_KERNEL) \
|
||||
return _fcntl_fn(_fd, _cmd, val); \
|
||||
int32_t ret = _fcntl_fn(_fd, _cmd, val); \
|
||||
if (ret == -1) \
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index a4e6e0b..71abbc6 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -344,19 +344,28 @@ static ssize_t do_app_write(struct pbuf *pbufs[], void *buf, size_t len, uint32_
|
||||
{
|
||||
ssize_t send_len = 0;
|
||||
uint32_t i = 0;
|
||||
+ uint32_t expand_send_ring = get_global_cfg_params()->expand_send_ring;
|
||||
|
||||
for (i = 0; i < write_num - 1; i++) {
|
||||
rte_prefetch0(pbufs[i + 1]);
|
||||
rte_prefetch0(pbufs[i + 1]->payload);
|
||||
rte_prefetch0((char *)buf + send_len + MBUF_MAX_DATA_LEN);
|
||||
- pbuf_take(pbufs[i], (char *)buf + send_len, MBUF_MAX_DATA_LEN);
|
||||
+ if (expand_send_ring) {
|
||||
+ pbuf_take(pbufs[i], (char *)buf + send_len, MBUF_MAX_DATA_LEN);
|
||||
+ } else {
|
||||
+ rte_memcpy((char *)pbufs[i]->payload, (char *)buf + send_len, MBUF_MAX_DATA_LEN);
|
||||
+ }
|
||||
pbufs[i]->tot_len = pbufs[i]->len = MBUF_MAX_DATA_LEN;
|
||||
send_len += MBUF_MAX_DATA_LEN;
|
||||
}
|
||||
|
||||
/* reduce the branch in loop */
|
||||
uint16_t copy_len = len - send_len;
|
||||
- pbuf_take(pbufs[i], (char *)buf + send_len, copy_len);
|
||||
+ if (expand_send_ring) {
|
||||
+ pbuf_take(pbufs[i], (char *)buf + send_len, copy_len);
|
||||
+ } else {
|
||||
+ rte_memcpy((char *)pbufs[i]->payload, (char *)buf + send_len, copy_len);
|
||||
+ }
|
||||
pbufs[i]->tot_len = pbufs[i]->len = copy_len;
|
||||
send_len += copy_len;
|
||||
|
||||
@@ -500,7 +509,11 @@ static inline size_t merge_data_lastpbuf(struct lwip_sock *sock, void *buf, size
|
||||
|
||||
uint16_t offset = last_pbuf->len;
|
||||
last_pbuf->tot_len = last_pbuf->len = offset + send_len;
|
||||
- pbuf_take_at(last_pbuf, buf, send_len, offset);
|
||||
+ if (get_global_cfg_params()->expand_send_ring) {
|
||||
+ pbuf_take_at(last_pbuf, buf, send_len, offset);
|
||||
+ } else {
|
||||
+ rte_memcpy((char *)last_pbuf->payload + offset, buf, send_len);
|
||||
+ }
|
||||
|
||||
gazelle_ring_lastover(last_pbuf);
|
||||
|
||||
@@ -924,12 +937,11 @@ ssize_t gazelle_send(int32_t fd, const void *buf, size_t len, int32_t flags)
|
||||
return send;
|
||||
}
|
||||
|
||||
-ssize_t sendmsg_to_stack(int32_t s, const struct msghdr *message, int32_t flags)
|
||||
+ssize_t sendmsg_to_stack(struct lwip_sock *sock, int32_t s, const struct msghdr *message, int32_t flags)
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t i;
|
||||
ssize_t buflen = 0;
|
||||
- struct lwip_sock *sock = get_socket_by_fd(s);
|
||||
|
||||
if (check_msg_vaild(message)) {
|
||||
GAZELLE_RETURN(EINVAL);
|
||||
diff --git a/src/lstack/include/lstack_lwip.h b/src/lstack/include/lstack_lwip.h
|
||||
index d52a06d..0b29e71 100644
|
||||
--- a/src/lstack/include/lstack_lwip.h
|
||||
+++ b/src/lstack/include/lstack_lwip.h
|
||||
@@ -43,7 +43,7 @@ void stack_send(struct rpc_msg *msg);
|
||||
void app_rpc_write(struct rpc_msg *msg);
|
||||
int32_t gazelle_alloc_pktmbuf(struct rte_mempool *pool, struct rte_mbuf **mbufs, uint32_t num);
|
||||
void gazelle_free_pbuf(struct pbuf *pbuf);
|
||||
-ssize_t sendmsg_to_stack(int32_t s, const struct msghdr *message, int32_t flags);
|
||||
+ssize_t sendmsg_to_stack(struct lwip_sock *sock, int32_t s, const struct msghdr *message, int32_t flags);
|
||||
ssize_t recvmsg_from_stack(int32_t s, struct msghdr *message, int32_t flags);
|
||||
ssize_t gazelle_send(int32_t fd, const void *buf, size_t len, int32_t flags);
|
||||
void rpc_replenish(struct rpc_msg *msg);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
25
0222-fix-build-err-on-select_path.patch
Normal file
25
0222-fix-build-err-on-select_path.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From c721d637a8a387b53ec614705238714412cfe1be Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Mon, 27 Mar 2023 20:05:59 +0800
|
||||
Subject: [PATCH] fix build err on select_path
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_wrap.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index 1fe576f..aacb30c 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -83,7 +83,7 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd, struct lwip_sock **socke
|
||||
/* after lwip connect, call send immediately, pcb->state is SYN_SENT, need return PATH_LWIP */
|
||||
/* pcb->state default value is CLOSED when call socket, need return PATH_UNKNOW */
|
||||
if (pcb != NULL && pcb->state <= ESTABLISHED && pcb->state >= LISTEN) {
|
||||
- *socket = sock
|
||||
+ *socket = sock;
|
||||
return PATH_LWIP;
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
27
0223-set-kni_switch-valid-only-in-primary-process.patch
Normal file
27
0223-set-kni_switch-valid-only-in-primary-process.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 17120ad1d57365d2980d4d60742b25cf76ac35bd Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng12 <jiangheng14@huawei.com>
|
||||
Date: Mon, 27 Mar 2023 20:16:00 +0800
|
||||
Subject: [PATCH] set kni_switch valid only in primary process
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_cfg.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
|
||||
index 95590e2..168aa49 100644
|
||||
--- a/src/lstack/core/lstack_cfg.c
|
||||
+++ b/src/lstack/core/lstack_cfg.c
|
||||
@@ -855,6 +855,10 @@ static int32_t parse_kni_switch(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (!g_config_params.use_ltran && !g_config_params.is_primary) {
|
||||
+ g_config_params.kni_switch = 0;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
36
0224-optimize-do_close.patch
Normal file
36
0224-optimize-do_close.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From 22405fd936105e4178a617d46077c871835ac6d5 Mon Sep 17 00:00:00 2001
|
||||
From: wangweizZZ <wangwei7_yewu@cmss.chinamobile.com>
|
||||
Date: Mon, 27 Mar 2023 21:46:59 +0800
|
||||
Subject: [PATCH] optimize do_close
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_wrap.c | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index aacb30c..ae08bfe 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -521,15 +521,13 @@ static inline ssize_t do_sendmsg(int32_t s, const struct msghdr *message, int32_
|
||||
|
||||
static inline int32_t do_close(int32_t s)
|
||||
{
|
||||
- struct lwip_sock *sock = get_socket_by_fd(s);
|
||||
- if (likely(posix_api->ues_posix == 0) && sock && sock->wakeup && sock->wakeup->epollfd == s) {
|
||||
- return lstack_epoll_close(s);
|
||||
- }
|
||||
-
|
||||
+ struct lwip_sock *sock = NULL;
|
||||
if (select_path(s, &sock) == PATH_KERNEL) {
|
||||
return posix_api->close_fn(s);
|
||||
}
|
||||
-
|
||||
+ if (sock && sock->wakeup && sock->wakeup->epollfd == s) {
|
||||
+ return lstack_epoll_close(s);
|
||||
+ }
|
||||
return stack_broadcast_close(s);
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
46
0225-add-socket-check-before-write-it.patch
Normal file
46
0225-add-socket-check-before-write-it.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From da9f7797985fe2cc7bd6a5f1a5837bd833838982 Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Mon, 27 Mar 2023 22:15:48 +0800
|
||||
Subject: [PATCH] add socket check before write it
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_wrap.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index aacb30c..f81328d 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -75,7 +75,9 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd, struct lwip_sock **socke
|
||||
}
|
||||
|
||||
if (likely(CONN_TYPE_IS_LIBOS(sock->conn))) {
|
||||
- *socket = sock;
|
||||
+ if (socket) {
|
||||
+ *socket = sock;
|
||||
+ }
|
||||
return PATH_LWIP;
|
||||
}
|
||||
|
||||
@@ -83,7 +85,9 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd, struct lwip_sock **socke
|
||||
/* after lwip connect, call send immediately, pcb->state is SYN_SENT, need return PATH_LWIP */
|
||||
/* pcb->state default value is CLOSED when call socket, need return PATH_UNKNOW */
|
||||
if (pcb != NULL && pcb->state <= ESTABLISHED && pcb->state >= LISTEN) {
|
||||
- *socket = sock;
|
||||
+ if (socket) {
|
||||
+ *socket = sock;
|
||||
+ }
|
||||
return PATH_LWIP;
|
||||
}
|
||||
|
||||
@@ -273,6 +277,7 @@ static int32_t do_connect(int32_t s, const struct sockaddr *name, socklen_t name
|
||||
return posix_api->connect_fn(s, name, namelen);
|
||||
}
|
||||
|
||||
+ sock = get_socket(s);
|
||||
if (sock == NULL) {
|
||||
return posix_api->connect_fn(s, name, namelen);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
30
0226-update-lstack.Makefile.patch
Normal file
30
0226-update-lstack.Makefile.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From c7a8bc37c1aa0fcb33005e49e4b84e46478b2c3c Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng12 <jiangheng14@huawei.com>
|
||||
Date: Thu, 30 Mar 2023 11:29:33 +0800
|
||||
Subject: [PATCH] update lstack.Makefile
|
||||
|
||||
---
|
||||
src/lstack/lstack.Makefile | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/lstack.Makefile b/src/lstack/lstack.Makefile
|
||||
index dc98a1b..7da439d 100644
|
||||
--- a/src/lstack/lstack.Makefile
|
||||
+++ b/src/lstack/lstack.Makefile
|
||||
@@ -40,7 +40,12 @@ WRAP_API := epoll_ctl \
|
||||
close \
|
||||
ioctl \
|
||||
sigaction \
|
||||
- fork
|
||||
+ fork \
|
||||
+ epoll_create1 \
|
||||
+ readv \
|
||||
+ writev \
|
||||
+ poll \
|
||||
+ ppoll
|
||||
|
||||
WRAP_LDFLAGS = $(patsubst %, $(WRAP_PREFIX)%, $(WRAP_API))
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
121
0227-fix-config-flow-rule-race.patch
Normal file
121
0227-fix-config-flow-rule-race.patch
Normal file
@ -0,0 +1,121 @@
|
||||
From b393509c3e7352ddc2457bca766a7dcff579b3f0 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng12 <jiangheng14@huawei.com>
|
||||
Date: Thu, 30 Mar 2023 16:20:34 +0800
|
||||
Subject: [PATCH] fix config flow rule race
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.h | 2 +-
|
||||
src/lstack/netif/lstack_ethdev.c | 6 +++---
|
||||
src/lstack/netif/lstack_vdev.c | 21 ++++++++++-----------
|
||||
3 files changed, 14 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index 9105871..e4da687 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -200,7 +200,7 @@ struct gazelle_stat_low_power_info {
|
||||
};
|
||||
|
||||
#define RTE_ETH_XSTATS_NAME_SIZE 64
|
||||
-#define RTE_ETH_XSTATS_MAX_LEN 128
|
||||
+#define RTE_ETH_XSTATS_MAX_LEN 256
|
||||
struct nic_eth_xstats_name {
|
||||
char name[RTE_ETH_XSTATS_NAME_SIZE];
|
||||
};
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index 8d05bdd..52aa9a8 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -152,7 +152,7 @@ int32_t eth_dev_poll(void)
|
||||
}
|
||||
|
||||
/* flow rule map */
|
||||
-#define RULE_KEY_LEN 22
|
||||
+#define RULE_KEY_LEN 23
|
||||
struct flow_rule {
|
||||
char rule_key[RULE_KEY_LEN];
|
||||
struct rte_flow *flow;
|
||||
@@ -322,7 +322,7 @@ create_flow_director(uint16_t port_id, uint16_t queue_id, uint32_t src_ip, uint3
|
||||
void config_flow_director(uint16_t queue_id, uint32_t src_ip, uint32_t dst_ip, uint16_t src_port, uint16_t dst_port){
|
||||
|
||||
uint16_t port_id = get_port_id();
|
||||
- char rule_key[RULE_KEY_LEN];
|
||||
+ char rule_key[RULE_KEY_LEN] = {0};
|
||||
sprintf(rule_key,"%u_%u_%u",src_ip,src_port,dst_port);
|
||||
struct flow_rule *fl_exist = find_rule(rule_key);
|
||||
if(fl_exist != NULL){
|
||||
@@ -346,7 +346,7 @@ void config_flow_director(uint16_t queue_id, uint32_t src_ip, uint32_t dst_ip, u
|
||||
void delete_flow_director(uint32_t dst_ip, uint16_t src_port, uint16_t dst_port)
|
||||
{
|
||||
uint16_t port_id = get_port_id();
|
||||
- char rule_key[RULE_KEY_LEN];
|
||||
+ char rule_key[RULE_KEY_LEN] = {0};
|
||||
sprintf(rule_key,"%u_%u_%u",dst_ip,dst_port,src_port);
|
||||
struct flow_rule *fl = find_rule(rule_key);
|
||||
|
||||
diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
|
||||
index ba0db39..aef6035 100644
|
||||
--- a/src/lstack/netif/lstack_vdev.c
|
||||
+++ b/src/lstack/netif/lstack_vdev.c
|
||||
@@ -152,10 +152,10 @@ int32_t vdev_reg_xmit(enum reg_ring_type type, struct gazelle_quintuple *qtuple)
|
||||
}
|
||||
|
||||
if (!use_ltran() && get_global_cfg_params()->tuple_filter) {
|
||||
- if(type == REG_RING_TCP_LISTEN_CLOSE){
|
||||
+ if (type == REG_RING_TCP_LISTEN_CLOSE) {
|
||||
if (get_global_cfg_params()->is_primary) {
|
||||
delete_user_process_port(qtuple->src_port, PORT_LISTEN);
|
||||
- }else{
|
||||
+ } else {
|
||||
transfer_add_or_delete_listen_port_to_process0(qtuple->src_port,get_global_cfg_params()->process_idx, 0);
|
||||
}
|
||||
}
|
||||
@@ -165,10 +165,10 @@ int32_t vdev_reg_xmit(enum reg_ring_type type, struct gazelle_quintuple *qtuple)
|
||||
delete_user_process_port(qtuple->src_port, PORT_CONNECT);
|
||||
uint16_t queue_id = get_protocol_stack()->queue_id;
|
||||
if (queue_id != 0) {
|
||||
- delete_flow_director(qtuple->dst_ip, qtuple->src_port, qtuple->dst_port);
|
||||
+ transfer_delete_rule_info_to_process0(qtuple->dst_ip, qtuple->src_port, qtuple->dst_port);
|
||||
}
|
||||
- }else{
|
||||
- transfer_delete_rule_info_to_process0(qtuple->dst_ip,qtuple->src_port,qtuple->dst_port);
|
||||
+ } else {
|
||||
+ transfer_delete_rule_info_to_process0(qtuple->dst_ip, qtuple->src_port, qtuple->dst_port);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,18 +177,18 @@ int32_t vdev_reg_xmit(enum reg_ring_type type, struct gazelle_quintuple *qtuple)
|
||||
if (get_global_cfg_params()->is_primary){
|
||||
add_user_process_port(qtuple->src_port, get_global_cfg_params()->process_idx, PORT_CONNECT);
|
||||
if (queue_id != 0) {
|
||||
- config_flow_director(queue_id, qtuple->dst_ip, qtuple->src_ip, qtuple->dst_port, qtuple->src_port);
|
||||
+ transfer_create_rule_info_to_process0(queue_id, qtuple->src_ip, qtuple->dst_ip, qtuple->src_port, qtuple->dst_port);
|
||||
}
|
||||
- }else {
|
||||
+ } else {
|
||||
transfer_create_rule_info_to_process0(queue_id, qtuple->src_ip, qtuple->dst_ip, qtuple->src_port, qtuple->dst_port);
|
||||
}
|
||||
}
|
||||
|
||||
- if (type == REG_RING_TCP_LISTEN){
|
||||
+ if (type == REG_RING_TCP_LISTEN) {
|
||||
if (get_global_cfg_params()->is_primary) {
|
||||
add_user_process_port(qtuple->src_port, get_global_cfg_params()->process_idx, PORT_LISTEN);
|
||||
- }else {
|
||||
- transfer_add_or_delete_listen_port_to_process0(qtuple->src_port,get_global_cfg_params()->process_idx, 1);
|
||||
+ } else {
|
||||
+ transfer_add_or_delete_listen_port_to_process0(qtuple->src_port, get_global_cfg_params()->process_idx, 1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -197,7 +197,6 @@ int32_t vdev_reg_xmit(enum reg_ring_type type, struct gazelle_quintuple *qtuple)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-
|
||||
int32_t ret;
|
||||
uint32_t sent_pkts = 0;
|
||||
void *free_buf[VDEV_REG_QUEUE_SZ];
|
||||
--
|
||||
2.23.0
|
||||
|
||||
25
0228-fix-build-err-with-dpdk-21.11.patch
Normal file
25
0228-fix-build-err-with-dpdk-21.11.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 9a14d507fbad2f7f6875abf2d9cd45031f86d523 Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Thu, 30 Mar 2023 20:43:43 +0800
|
||||
Subject: [PATCH] fix build err with dpdk-21.11
|
||||
|
||||
---
|
||||
src/lstack/netif/lstack_ethdev.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index 52aa9a8..e26fe30 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -761,7 +761,7 @@ int32_t gazelle_eth_dev_poll(struct protocol_stack *stack, uint8_t use_ltran_fla
|
||||
struct rte_ether_hdr *ethh = rte_pktmbuf_mtod(stack->pkts[i], struct rte_ether_hdr *);
|
||||
if (unlikely(RTE_BE16(RTE_ETHER_TYPE_ARP) == ethh->ether_type)) {
|
||||
stack_broadcast_arp(stack->pkts[i], stack);
|
||||
- if (!use_ltran_flag && !rte_is_broadcast_ether_addr(ðh->d_addr)) {
|
||||
+ if (!use_ltran_flag && !rte_is_broadcast_ether_addr(ðh->dst_addr)) {
|
||||
// copy arp into other process
|
||||
transfer_arp_to_other_process(stack->pkts[i]);
|
||||
transfer_type = TRANSFER_KERNEL;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
26
gazelle.spec
26
gazelle.spec
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.1
|
||||
Release: 55
|
||||
Release: 56
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -232,6 +232,17 @@ Patch9214: 0214-fix-parse-args-error.patch
|
||||
Patch9215: 0215-gazelle-send-recv-thread-bind-numa.patch
|
||||
Patch9216: 0216-waiting-when-primary-process-not-start-already.patch
|
||||
Patch9217: 0217-sepeate_string_to-array-add-error-args-handle.patch
|
||||
Patch9218: 0218-do-not-transfer-broadcast-arp-pkts-to-other-process.patch
|
||||
Patch9219: 0219-revert-select_thread_path-and-optimize-app-thread-wh.patch
|
||||
Patch9220: 0220-check-primary-process-idx-and-secondary-lstack-num.patch
|
||||
Patch9221: 0221-optimite-select_path-and-pbuf_take.patch
|
||||
Patch9222: 0222-fix-build-err-on-select_path.patch
|
||||
Patch9223: 0223-set-kni_switch-valid-only-in-primary-process.patch
|
||||
Patch9224: 0224-optimize-do_close.patch
|
||||
Patch9225: 0225-add-socket-check-before-write-it.patch
|
||||
Patch9226: 0226-update-lstack.Makefile.patch
|
||||
Patch9227: 0227-fix-config-flow-rule-race.patch
|
||||
Patch9228: 0228-fix-build-err-with-dpdk-21.11.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -272,6 +283,19 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Sat May 13 2023 jiangheng12 <jiangheng14@huawei.com> - 1.0.1-56
|
||||
- fix build err with dpdk-21.11
|
||||
- fix config flow rule race
|
||||
- update lstack.Makefile
|
||||
- add socket check before write it
|
||||
- optimize do_close
|
||||
- set kni_switch valid only in primary process
|
||||
- fix build err on select_path
|
||||
- optimite select_path and pbuf_take
|
||||
- check primary process idx and secondary lstack num
|
||||
- revert select_thread_path and optimize app thread when sendmsg
|
||||
- do not transfer broadcast arp pkts to other process
|
||||
|
||||
* Thu Apr 20 2023 sunsuwan <sunsuwan3@huawei.com> - 1.0.1-55
|
||||
- sepeate_string_to array add error args handle
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user