sync modif mem
(cherry picked from commit 49814db46179f7757a09ab5c4a7721a78ec67021)
This commit is contained in:
parent
5e8b65a128
commit
e16732f418
54
0039-build-add-mlx5-pmd-dependency.patch
Normal file
54
0039-build-add-mlx5-pmd-dependency.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From 0f9d05d8fe6e58e199c0885a2808791aebd2bf08 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Sat, 4 Nov 2023 17:13:11 +0800
|
||||
Subject: [PATCH] build: add mlx5 pmd dependency
|
||||
|
||||
---
|
||||
src/lstack/Makefile | 2 ++
|
||||
src/ltran/CMakeLists.txt | 4 ++--
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/Makefile b/src/lstack/Makefile
|
||||
index 30965f8..d5872bb 100644
|
||||
--- a/src/lstack/Makefile
|
||||
+++ b/src/lstack/Makefile
|
||||
@@ -90,6 +90,7 @@ ifeq ($(DPDK_VERSION_1911), 1)
|
||||
$(LIB_PATH)/librte_pmd_bond.so \
|
||||
$(LIB_PATH)/librte_pmd_hinic.so \
|
||||
$(LIB_PATH)/librte_pmd_ixgbe.so \
|
||||
+ $(LIB_PATH)/librte_pmd_mlx5.so \
|
||||
$(LIB_PATH)/librte_pmd_virtio.so
|
||||
ifneq ($(ARCH), loongarch64)
|
||||
LIBRTE_LIB += $(LIB_PATH)/librte_pmd_i40e.so
|
||||
@@ -99,6 +100,7 @@ else
|
||||
$(LIB_PATH)/librte_net_bond.so \
|
||||
$(LIB_PATH)/librte_net_hinic.so \
|
||||
$(LIB_PATH)/librte_net_ixgbe.so \
|
||||
+ $(LIB_PATH)/librte_net_mlx5.so \
|
||||
$(LIB_PATH)/librte_net_virtio.so \
|
||||
$(LIB_PATH)/librte_telemetry.so \
|
||||
$(LIB_PATH)/librte_pcapng.so
|
||||
diff --git a/src/ltran/CMakeLists.txt b/src/ltran/CMakeLists.txt
|
||||
index e098a77..8f5f674 100644
|
||||
--- a/src/ltran/CMakeLists.txt
|
||||
+++ b/src/ltran/CMakeLists.txt
|
||||
@@ -31,14 +31,14 @@ if($ENV{DPDK_VERSION_1911})
|
||||
set(DPDK_DIR /usr/include/dpdk)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDPDK_VERSION_1911=1")
|
||||
set(DPDK_LINK_FLAGS "-Wl,-lrte_pmd_bond -Wl,-lrte_pmd_hinic -Wl,-lrte_pmd_ixgbe \
|
||||
- -Wl,-lrte_pmd_pcap -Wl,-lrte_pmd_virtio")
|
||||
+ -Wl,-lrte_pmd_pcap -Wl,-lrte_pmd_virtio -Wl, -lrte_pmd_mlx5")
|
||||
if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "loongarch64")
|
||||
set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,-lrte_pmd_i40e")
|
||||
endif()
|
||||
else()
|
||||
set(DPDK_DIR /usr/local/include/)
|
||||
set(DPDK_LINK_FLAGS "-Wl,-lrte_net_bond -Wl,-lrte_net_hinic -Wl,-lrte_net_ixgbe \
|
||||
- -Wl,-lpcap -Wl,-lrte_net_pcap -Wl,-lrte_net_virtio -Wl,-lrte_pcapng -Wl,-lrte_telemetry")
|
||||
+ -Wl,-lpcap -Wl,-lrte_net_pcap -Wl,-lrte_net_virtio -Wl,-lrte_net_mlx5 -Wl,-lrte_pcapng -Wl,-lrte_telemetry")
|
||||
if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "loongarch64")
|
||||
set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,-lrte_net_i40e")
|
||||
endif()
|
||||
--
|
||||
2.27.0
|
||||
|
||||
83
0040-when-timeout-occurs-process-exits.patch
Normal file
83
0040-when-timeout-occurs-process-exits.patch
Normal file
@ -0,0 +1,83 @@
|
||||
From 3a0bb8c06789288c7152e439b4eed0007a234134 Mon Sep 17 00:00:00 2001
|
||||
From: hantwofish <hankangkang5@huawei.com>
|
||||
Date: Wed, 1 Nov 2023 20:18:07 +0800
|
||||
Subject: [PATCH] when timeout occurs,process exits.
|
||||
|
||||
---
|
||||
src/common/gazelle_dfx_msg.c | 37 +++++++++++++++++++++++-------------
|
||||
src/common/gazelle_dfx_msg.h | 2 +-
|
||||
2 files changed, 25 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.c b/src/common/gazelle_dfx_msg.c
|
||||
index 2070d5f..b8472be 100644
|
||||
--- a/src/common/gazelle_dfx_msg.c
|
||||
+++ b/src/common/gazelle_dfx_msg.c
|
||||
@@ -14,28 +14,39 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/poll.h>
|
||||
|
||||
#include "gazelle_dfx_msg.h"
|
||||
|
||||
int read_specied_len(int fd, char *buf, size_t target_size)
|
||||
{
|
||||
- ssize_t tmp_size;
|
||||
- char *tmp_pbuf = buf;
|
||||
- while (target_size > 0) {
|
||||
- tmp_size = read(fd, tmp_pbuf, target_size);
|
||||
- if ((tmp_size == -1) && (errno != EINTR)) {
|
||||
- printf("read msg from fd %d failed, errno %d\n", fd, errno);
|
||||
+ size_t total_read = 0;
|
||||
+ struct pollfd fds[1];
|
||||
+ fds[0].fd = fd;
|
||||
+ fds[0].events = POLLIN;
|
||||
+
|
||||
+ while (total_read < target_size) {
|
||||
+ int ret = poll(fds, 1, GAZELLECTL_TIMEOUT);
|
||||
+ if (ret < 0) {
|
||||
+ printf("read_specied_len:: poll ret=%d \n", ret);
|
||||
return -1;
|
||||
- } else if (tmp_size == 0) {
|
||||
- printf("read zero bytes from fd %d, maybe peer is down\n", fd);
|
||||
+ } else if (ret == 0) {
|
||||
+ printf("read_specied_len:: time out");
|
||||
return -1;
|
||||
}
|
||||
-
|
||||
- tmp_size = (tmp_size < 0) ? 0 : tmp_size;
|
||||
- target_size -= (size_t)tmp_size;
|
||||
- tmp_pbuf += tmp_size;
|
||||
+ if (fds[0].revents & POLLIN) {
|
||||
+ int n = read(fd, buf + total_read, target_size - total_read);
|
||||
+ if (n < 0) {
|
||||
+ printf("read_specied_len:: read ret=%d", ret);
|
||||
+ return -1;
|
||||
+ } else if (n == 0) {
|
||||
+ printf("read_specied_len:: Connection closed");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ total_read += n;
|
||||
+ }
|
||||
}
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
|
||||
index 19dddd8..93fe3df 100644
|
||||
--- a/src/common/gazelle_dfx_msg.h
|
||||
+++ b/src/common/gazelle_dfx_msg.h
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#define GAZELLE_CLIENT_NUM_MIN 1
|
||||
#define GAZELLE_LOG_LEVEL_MAX 10
|
||||
-
|
||||
+#define GAZELLECTL_TIMEOUT 5000 // millisecond
|
||||
/* maybe it should be consistent with MEMP_NUM_TCP_PCB */
|
||||
#define GAZELLE_LSTACK_MAX_CONN (20000 + 2000) // same as MAX_CLIENTS + RESERVED_CLIENTS in lwipopts.h
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
260
0041-wrap-support-select.patch
Normal file
260
0041-wrap-support-select.patch
Normal file
@ -0,0 +1,260 @@
|
||||
From 21425705a687706faa642e8b99a9c549d7bcaab6 Mon Sep 17 00:00:00 2001
|
||||
From: yangchen <yangchen145@huawei.com>
|
||||
Date: Thu, 2 Nov 2023 16:10:04 +0800
|
||||
Subject: [PATCH] wrap: support select
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_epoll.c | 88 +++++++++++++++++++++++++
|
||||
src/lstack/api/lstack_rtc_api.c | 7 ++
|
||||
src/lstack/api/lstack_rtw_api.c | 5 ++
|
||||
src/lstack/api/lstack_wrap.c | 19 ++++++
|
||||
src/lstack/include/lstack_rtc_api.h | 2 +
|
||||
src/lstack/include/lstack_rtw_api.h | 3 +
|
||||
src/lstack/include/posix/lstack_epoll.h | 1 +
|
||||
7 files changed, 125 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
|
||||
index a711ae3..f2c4a8b 100644
|
||||
--- a/src/lstack/api/lstack_epoll.c
|
||||
+++ b/src/lstack/api/lstack_epoll.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <securec.h>
|
||||
#include <sys/epoll.h>
|
||||
+#include <sys/select.h>
|
||||
#include <time.h>
|
||||
#include <poll.h>
|
||||
#include <stdatomic.h>
|
||||
@@ -870,3 +871,90 @@ int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||
__atomic_store_n(&wakeup->in_wait, false, __ATOMIC_RELEASE);
|
||||
return lwip_num + kernel_num;
|
||||
}
|
||||
+
|
||||
+static void select_set_revent_fdset(struct pollfd *fds, nfds_t nfds, fd_set *eventfds, uint32_t event)
|
||||
+{
|
||||
+ FD_ZERO(eventfds);
|
||||
+
|
||||
+ /* Set the fd_set parameter based on the actual revents. */
|
||||
+ for (int i = 0; i < nfds; i++) {
|
||||
+ if (fds[i].revents & event) {
|
||||
+ FD_SET(fds[i].fd, eventfds);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void fds_poll2select(struct pollfd *fds, nfds_t nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
|
||||
+{
|
||||
+ if (fds == NULL || nfds == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (readfds) {
|
||||
+ select_set_revent_fdset(fds, nfds, readfds, EPOLLIN);
|
||||
+ }
|
||||
+ if (writefds) {
|
||||
+ select_set_revent_fdset(fds, nfds, writefds, EPOLLOUT);
|
||||
+ }
|
||||
+ if (exceptfds) {
|
||||
+ select_set_revent_fdset(fds, nfds, exceptfds, EPOLLERR);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static inline int timeval_to_ms(struct timeval *timeval)
|
||||
+{
|
||||
+ if (timeval == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return (timeval->tv_sec * 1000 + timeval->tv_usec / 1000);
|
||||
+}
|
||||
+
|
||||
+static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct pollfd **fds)
|
||||
+{
|
||||
+ struct pollfd pollfds[FD_SETSIZE] = { 0 };
|
||||
+ nfds_t nfds = 0;
|
||||
+
|
||||
+ for (int i = 0; i < maxfd; i++) {
|
||||
+ if (readfds && FD_ISSET(i, readfds)) {
|
||||
+ pollfds[nfds].events = POLLIN;
|
||||
+ }
|
||||
+ if (writefds && FD_ISSET(i, writefds)) {
|
||||
+ pollfds[nfds].events |= POLLOUT;
|
||||
+ }
|
||||
+ if (exceptfds && FD_ISSET(i, exceptfds)) {
|
||||
+ pollfds[nfds].events |= POLLERR;
|
||||
+ }
|
||||
+ if (pollfds[nfds].events > 0) {
|
||||
+ pollfds[nfds].fd = i;
|
||||
+ nfds++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ *fds = pollfds;
|
||||
+ return nfds;
|
||||
+}
|
||||
+
|
||||
+int lstack_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeval)
|
||||
+{
|
||||
+ if (maxfd == 0) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (maxfd < 0 || maxfd > FD_SETSIZE || (readfds == NULL && writefds == NULL && exceptfds == NULL)) {
|
||||
+ GAZELLE_RETURN(EINVAL);
|
||||
+ }
|
||||
+
|
||||
+ /* Convert the select parameter to the poll parameter. */
|
||||
+ struct pollfd *fds = NULL;
|
||||
+ nfds_t nfds = fds_select2poll(maxfd, readfds, writefds, exceptfds, &fds);
|
||||
+ int timeout = timeval_to_ms(timeval);
|
||||
+
|
||||
+ int event_num = lstack_poll(fds, nfds, timeout);
|
||||
+
|
||||
+ /* After poll, set select fd_set by fds.revents. */
|
||||
+ fds_poll2select(fds, nfds, readfds, writefds, exceptfds);
|
||||
+
|
||||
+ return event_num;
|
||||
+}
|
||||
+
|
||||
diff --git a/src/lstack/api/lstack_rtc_api.c b/src/lstack/api/lstack_rtc_api.c
|
||||
index 059b518..5fad3e8 100644
|
||||
--- a/src/lstack/api/lstack_rtc_api.c
|
||||
+++ b/src/lstack/api/lstack_rtc_api.c
|
||||
@@ -24,6 +24,13 @@
|
||||
|
||||
int rtc_poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
{
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rtc_poll: rtc currently does not support poll\n");
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+int rtc_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
+{
|
||||
+ LSTACK_LOG(ERR, LSTACK, "rtc_select: rtc currently does not support select\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff --git a/src/lstack/api/lstack_rtw_api.c b/src/lstack/api/lstack_rtw_api.c
|
||||
index 7d14ffa..c524bf9 100644
|
||||
--- a/src/lstack/api/lstack_rtw_api.c
|
||||
+++ b/src/lstack/api/lstack_rtw_api.c
|
||||
@@ -214,6 +214,11 @@ int rtw_poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
return lstack_poll(fds, nfds, timeout);
|
||||
}
|
||||
|
||||
+int rtw_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
+{
|
||||
+ return lstack_select(nfds, readfds, writefds, exceptfds, timeout);
|
||||
+}
|
||||
+
|
||||
int rtw_close(int s)
|
||||
{
|
||||
struct lwip_sock *sock = get_socket(s);
|
||||
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
||||
index a808ee8..5bad513 100644
|
||||
--- a/src/lstack/api/lstack_wrap.c
|
||||
+++ b/src/lstack/api/lstack_wrap.c
|
||||
@@ -76,6 +76,7 @@ void wrap_api_init(void)
|
||||
g_wrap_api->epoll_ctl_fn = rtc_epoll_ctl;
|
||||
g_wrap_api->epoll_create1_fn = rtc_epoll_create1;
|
||||
g_wrap_api->epoll_create_fn = rtc_epoll_create;
|
||||
+ g_wrap_api->select_fn = rtc_select;
|
||||
} else {
|
||||
g_wrap_api->socket_fn = rtw_socket;
|
||||
g_wrap_api->accept_fn = rtw_accept;
|
||||
@@ -103,6 +104,7 @@ void wrap_api_init(void)
|
||||
g_wrap_api->epoll_ctl_fn = rtw_epoll_ctl;
|
||||
g_wrap_api->epoll_create1_fn = rtw_epoll_create1;
|
||||
g_wrap_api->epoll_create_fn = rtw_epoll_create;
|
||||
+ g_wrap_api->select_fn = rtw_select;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,6 +611,15 @@ static int32_t do_sigaction(int32_t signum, const struct sigaction *act, struct
|
||||
return lstack_sigaction(signum, act, oldact);
|
||||
}
|
||||
|
||||
+static int32_t do_select(int32_t nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
+{
|
||||
+ if (select_posix_path() == PATH_KERNEL) {
|
||||
+ return posix_api->select_fn(nfds, readfds, writefds, exceptfds, timeout);
|
||||
+ }
|
||||
+
|
||||
+ return g_wrap_api->select_fn(nfds, readfds, writefds, exceptfds, timeout);
|
||||
+}
|
||||
+
|
||||
#define WRAP_VA_PARAM(_fd, _cmd, _lwip_fcntl, _fcntl_fn) \
|
||||
do { \
|
||||
unsigned long val; \
|
||||
@@ -769,6 +780,10 @@ pid_t fork(void)
|
||||
{
|
||||
return lstack_fork();
|
||||
}
|
||||
+int32_t select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
+{
|
||||
+ return do_select(nfds, readfds, writefds, exceptfds, timeout);
|
||||
+}
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* ------- Compile mode replacement interface -----------
|
||||
@@ -898,3 +913,7 @@ pid_t __wrap_fork(void)
|
||||
{
|
||||
return lstack_fork();
|
||||
}
|
||||
+int32_t __wrap_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
+{
|
||||
+ return do_select(nfds, readfds, writefds, exceptfds, timeout);
|
||||
+}
|
||||
diff --git a/src/lstack/include/lstack_rtc_api.h b/src/lstack/include/lstack_rtc_api.h
|
||||
index 0aff928..dd90e59 100644
|
||||
--- a/src/lstack/include/lstack_rtc_api.h
|
||||
+++ b/src/lstack/include/lstack_rtc_api.h
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef _LSTACK_RTC_API_H_
|
||||
#define _LSTACK_RTC_API_H_
|
||||
#include <sys/epoll.h>
|
||||
+#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* don't include lwip/sockets.h, conflict with sys/socket.h */
|
||||
@@ -51,5 +52,6 @@ int rtc_close(int s);
|
||||
int rtc_epoll_create(int flags);
|
||||
int rtc_epoll_create1(int flags);
|
||||
int rtc_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
|
||||
+int rtc_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
|
||||
|
||||
#endif /* __LSTACK_RTC_API_H_ */
|
||||
diff --git a/src/lstack/include/lstack_rtw_api.h b/src/lstack/include/lstack_rtw_api.h
|
||||
index facf4c0..d0f77b7 100644
|
||||
--- a/src/lstack/include/lstack_rtw_api.h
|
||||
+++ b/src/lstack/include/lstack_rtw_api.h
|
||||
@@ -14,6 +14,7 @@
|
||||
#define _LSTACK_RTW_API_H_
|
||||
|
||||
#include <sys/epoll.h>
|
||||
+#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int rtw_socket(int domain, int type, int protocol);
|
||||
@@ -44,4 +45,6 @@ int rtw_close(int s);
|
||||
int rtw_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
|
||||
int rtw_epoll_create1(int flags);
|
||||
int rtw_epoll_create(int flags);
|
||||
+int rtw_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
|
||||
+
|
||||
#endif /* _LSTACK_RTW_API_H_ */
|
||||
diff --git a/src/lstack/include/posix/lstack_epoll.h b/src/lstack/include/posix/lstack_epoll.h
|
||||
index c42f3a5..9c34eb3 100644
|
||||
--- a/src/lstack/include/posix/lstack_epoll.h
|
||||
+++ b/src/lstack/include/posix/lstack_epoll.h
|
||||
@@ -78,6 +78,7 @@ int32_t lstack_rtc_epoll_ctl(int32_t epfd, int32_t op, int32_t fd, struct epoll_
|
||||
int32_t lstack_rtw_epoll_wait(int32_t epfd, struct epoll_event *events, int32_t maxevents, int32_t timeout);
|
||||
int32_t lstack_rtc_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t maxevents, int32_t timeout);
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
--
|
||||
2.27.0
|
||||
|
||||
152
0042-add-vlan-support.patch
Normal file
152
0042-add-vlan-support.patch
Normal file
@ -0,0 +1,152 @@
|
||||
From 1febf2f274f5bf13004ddde6d20e8744e36fd650 Mon Sep 17 00:00:00 2001
|
||||
From: compile_success <980965867@qq.com>
|
||||
Date: Fri, 3 Nov 2023 14:33:20 +0000
|
||||
Subject: [PATCH] add vlan support
|
||||
|
||||
---
|
||||
src/common/gazelle_opt.h | 4 +++-
|
||||
src/lstack/core/lstack_cfg.c | 13 +++++++++++++
|
||||
src/lstack/core/lstack_lwip.c | 4 ++++
|
||||
src/lstack/include/lstack_cfg.h | 1 +
|
||||
src/lstack/lstack.conf | 3 +++
|
||||
src/lstack/netif/lstack_ethdev.c | 8 +++++++-
|
||||
src/lstack/netif/lstack_vdev.c | 4 +++-
|
||||
7 files changed, 34 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/common/gazelle_opt.h b/src/common/gazelle_opt.h
|
||||
index 7b855f9..0479051 100644
|
||||
--- a/src/common/gazelle_opt.h
|
||||
+++ b/src/common/gazelle_opt.h
|
||||
@@ -52,7 +52,9 @@
|
||||
#define STACK_THREAD_DEFAULT 4
|
||||
#define STACK_NIC_READ_DEFAULT 128
|
||||
|
||||
-#define MBUF_MAX_DATA_LEN 1460
|
||||
+#define MTU_DEFAULT_DATA_LEN 1460
|
||||
+#define VLAN_HEAD_LEN 4
|
||||
+#define MBUF_MAX_DATA_LEN (MTU_DEFAULT_DATA_LEN - VLAN_HEAD_LEN)
|
||||
|
||||
#define DPDK_PKT_BURST_SIZE 512
|
||||
|
||||
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
|
||||
index c4278b5..ac96b1b 100644
|
||||
--- a/src/lstack/core/lstack_cfg.c
|
||||
+++ b/src/lstack/core/lstack_cfg.c
|
||||
@@ -78,6 +78,7 @@ static int32_t parse_udp_enable(void);
|
||||
static int32_t parse_nic_rxqueue_size(void);
|
||||
static int32_t parse_nic_txqueue_size(void);
|
||||
static int32_t parse_stack_thread_mode(void);
|
||||
+static int32_t parse_nic_vlan_mode(void);
|
||||
|
||||
#define PARSE_ARG(_arg, _arg_string, _default_val, _min_val, _max_val, _ret) \
|
||||
do { \
|
||||
@@ -138,6 +139,7 @@ static struct config_vector_t g_config_tbl[] = {
|
||||
{ "nic_rxqueue_size", parse_nic_rxqueue_size},
|
||||
{ "nic_txqueue_size", parse_nic_txqueue_size},
|
||||
{ "stack_thread_mode", parse_stack_thread_mode },
|
||||
+ { "nic_vlan_mode", parse_nic_vlan_mode },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -1224,3 +1226,14 @@ static int32_t parse_stack_thread_mode(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+static int32_t parse_nic_vlan_mode(void)
|
||||
+{
|
||||
+ int32_t ret;
|
||||
+ PARSE_ARG(g_config_params.nic.vlan_mode, "nic_vlan_mode", 0, 0, 4094, ret);
|
||||
+ if (ret != 0) {
|
||||
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid vlan mode value %d ret=%d. only support 0~4094\n", \
|
||||
+ g_config_params.nic.vlan_mode, ret);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index cdb0089..d5c4896 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -196,6 +196,10 @@ void do_lwip_init_sock(int32_t fd)
|
||||
(void)replenish_send_idlembuf(stack, sock);
|
||||
|
||||
sock->stack = stack;
|
||||
+ if (get_global_cfg_params()->nic.vlan_mode > 0 && get_global_cfg_params()->nic.vlan_mode < 4095) {
|
||||
+ sock->conn->pcb.udp->netif_hints.tci = get_global_cfg_params()->nic.vlan_mode;
|
||||
+ }
|
||||
+
|
||||
init_list_node_null(&sock->recv_list);
|
||||
init_list_node_null(&sock->event_list);
|
||||
}
|
||||
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
|
||||
index fc627e3..9dea4c1 100644
|
||||
--- a/src/lstack/include/lstack_cfg.h
|
||||
+++ b/src/lstack/include/lstack_cfg.h
|
||||
@@ -62,6 +62,7 @@ struct secondary_attach_arg {
|
||||
struct cfg_nic_params {
|
||||
uint32_t rxqueue_size;
|
||||
uint32_t txqueue_size;
|
||||
+ uint16_t vlan_mode;
|
||||
};
|
||||
|
||||
struct cfg_params {
|
||||
diff --git a/src/lstack/lstack.conf b/src/lstack/lstack.conf
|
||||
index 48973fe..3eb4685 100644
|
||||
--- a/src/lstack/lstack.conf
|
||||
+++ b/src/lstack/lstack.conf
|
||||
@@ -63,3 +63,6 @@ process_idx=0
|
||||
|
||||
#tuple_filer=0, below cfg valid
|
||||
listen_shadow=0
|
||||
+
|
||||
+#vlan mode; only support 0~4094, 0 is disabled
|
||||
+nic_vlan_mode=0
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index da16e85..383a56b 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -778,7 +778,13 @@ int32_t gazelle_eth_dev_poll(struct protocol_stack *stack, uint8_t use_ltran_fla
|
||||
/* copy arp into other stack */
|
||||
if (!use_ltran_flag) {
|
||||
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)) {
|
||||
+ u16_t type;
|
||||
+ type = ethh->ether_type;
|
||||
+ if (type == PP_HTONS(ETHTYPE_VLAN)) {
|
||||
+ struct eth_vlan_hdr *vlan = (struct eth_vlan_hdr *)(((char *)ethh) + SIZEOF_ETH_HDR);
|
||||
+ type = vlan->tpid;
|
||||
+ }
|
||||
+ if (unlikely(RTE_BE16(RTE_ETHER_TYPE_ARP) == type)) {
|
||||
stack_broadcast_arp(stack->pkts[i], stack);
|
||||
/* copy arp into other process */
|
||||
transfer_arp_to_other_process(stack->pkts[i]);
|
||||
diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
|
||||
index 81b48dc..fb295e0 100644
|
||||
--- a/src/lstack/netif/lstack_vdev.c
|
||||
+++ b/src/lstack/netif/lstack_vdev.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <rte_ethdev.h>
|
||||
#include <rte_gro.h>
|
||||
#include <rte_net.h>
|
||||
+#include <netif/ethernet.h>
|
||||
|
||||
#include "lstack_cfg.h"
|
||||
#include "lstack_dpdk.h"
|
||||
@@ -83,12 +84,13 @@ static uint32_t vdev_rx_poll(struct protocol_stack *stack, struct rte_mbuf **pkt
|
||||
}
|
||||
|
||||
/* skip gro when tcp/ip cksum offloads disable */
|
||||
- if (get_protocol_stack_group()->rx_offload == 0) {
|
||||
+ if (get_protocol_stack_group()->rx_offload == 0 || get_global_cfg_params()->nic.vlan_mode > 0) {
|
||||
return pkt_num;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < pkt_num; i++) {
|
||||
struct rte_ether_hdr *ethh = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
|
||||
+
|
||||
if (unlikely(RTE_BE16(RTE_ETHER_TYPE_IPV4) != ethh->ether_type)) {
|
||||
continue;
|
||||
}
|
||||
--
|
||||
2.27.0
|
||||
|
||||
194
0043-slave-mac-addr.patch
Normal file
194
0043-slave-mac-addr.patch
Normal file
@ -0,0 +1,194 @@
|
||||
From 5e10c47492fef0eef886fa42651d3acef03f4196 Mon Sep 17 00:00:00 2001
|
||||
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
|
||||
Date: Wed, 1 Nov 2023 07:50:16 +0800
|
||||
Subject: [PATCH] slave mac addr
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_cfg.c | 50 ++++++++++++++++-----------------
|
||||
src/lstack/core/lstack_dpdk.c | 47 ++++++++++++++-----------------
|
||||
src/lstack/include/lstack_cfg.h | 4 +--
|
||||
3 files changed, 48 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
|
||||
index c4278b5..5ac6aa7 100644
|
||||
--- a/src/lstack/core/lstack_cfg.c
|
||||
+++ b/src/lstack/core/lstack_cfg.c
|
||||
@@ -1137,40 +1137,40 @@ static int32_t parse_bond_slave_mac(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- int32_t ret;
|
||||
- const char *slave_mac1 = NULL;
|
||||
- const char *slave_mac2 = NULL;
|
||||
+ int32_t ret = 0;
|
||||
+ const char *bond_slave_mac = NULL;
|
||||
const config_setting_t *devs = NULL;
|
||||
|
||||
- devs = config_lookup(&g_config, "slave_mac1");
|
||||
- if (devs == NULL) {
|
||||
- return -EINVAL;
|
||||
- }
|
||||
- slave_mac1 = config_setting_get_string(devs);
|
||||
- if (slave_mac1 == NULL) {
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- devs = config_lookup(&g_config, "slave_mac2");
|
||||
+ devs = config_lookup(&g_config, "bond_slave_mac");
|
||||
if (devs == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
- slave_mac2 = config_setting_get_string(devs);
|
||||
- if (slave_mac2 == NULL) {
|
||||
+ bond_slave_mac = config_setting_get_string(devs);
|
||||
+ if (bond_slave_mac == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
- /* add dev */
|
||||
- ret = str_to_eth_addr(slave_mac1, g_config_params.bond_slave1_mac_addr);
|
||||
- if (ret != 0) {
|
||||
- LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid device name %s ret=%d.\n", slave_mac1, ret);
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- ret = str_to_eth_addr(slave_mac2, g_config_params.bond_slave2_mac_addr);
|
||||
- if (ret != 0) {
|
||||
- LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid device name %s ret=%d.\n", slave_mac2, ret);
|
||||
+ int32_t k = 0;
|
||||
+ char *bond_slave_mac_tmp = strdup(bond_slave_mac);
|
||||
+ char *tmp = NULL;
|
||||
+ const char *delim = ";";
|
||||
+
|
||||
+ char *mac_addr = strtok_s(bond_slave_mac_tmp, delim, &tmp);
|
||||
+ while (mac_addr != NULL) {
|
||||
+ if (k >= GAZELLE_MAX_BOND_NUM) {
|
||||
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg: too many slave mac address. The maximum number of mac address is %d.\n",
|
||||
+ GAZELLE_MAX_BOND_NUM);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ ret = str_to_eth_addr(mac_addr, g_config_params.bond_slave_mac_addr[k].addr_bytes);
|
||||
+ if (ret != 0) {
|
||||
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid device name %s ret=%d.\n", mac_addr, ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ mac_addr = strtok_s(NULL, delim, &tmp);
|
||||
+ k = k + 1;
|
||||
}
|
||||
+ free(bond_slave_mac_tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 1a5b568..4318096 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -496,46 +496,41 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
|
||||
}
|
||||
|
||||
if (bond_port) {
|
||||
- int slave_num = 2;
|
||||
- int32_t slave_port_id[2];
|
||||
- slave_port_id[0] = ethdev_port_id(get_global_cfg_params()->bond_slave1_mac_addr);
|
||||
- if (slave_port_id[0] < 0) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "get slave port id failed port = %d\n", slave_port_id[0]);
|
||||
- return slave_port_id[0];
|
||||
- }
|
||||
-
|
||||
- slave_port_id[1] = ethdev_port_id(get_global_cfg_params()->bond_slave2_mac_addr);
|
||||
- if (slave_port_id[1] < 0) {
|
||||
- LSTACK_LOG(ERR, LSTACK, "get slave port id failed port = %d\n", slave_port_id[1]);
|
||||
- return slave_port_id[1];
|
||||
- }
|
||||
-
|
||||
- for (int i = 0; i < slave_num; i++) {
|
||||
+ int32_t slave_port_id[GAZELLE_MAX_BOND_NUM];
|
||||
+ for (int i = 0; i < GAZELLE_MAX_BOND_NUM; i++) {
|
||||
+ if (rte_is_zero_ether_addr(&get_global_cfg_params()->bond_slave_mac_addr[i])) {
|
||||
+ break;
|
||||
+ }
|
||||
+ slave_port_id[i] = ethdev_port_id(get_global_cfg_params()->bond_slave_mac_addr[i].addr_bytes);
|
||||
+ if (slave_port_id[i] < 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "get slave port id failed port = %d\n", slave_port_id[1]);
|
||||
+ return slave_port_id[i];
|
||||
+ }
|
||||
ret = dpdk_ethdev_init(slave_port_id[i], 0);
|
||||
if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk_ethdev_init failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
ret = rte_eth_promiscuous_enable(slave_port_id[i]);
|
||||
- if (ret != 0) {
|
||||
+ if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk slave enable promiscuous failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = rte_eth_allmulticast_enable(slave_port_id[i]);
|
||||
- if (ret != 0) {
|
||||
+ if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk slave enable allmulticast failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = rte_eth_bond_slave_add(port_id, slave_port_id[i]);
|
||||
- if (ret != 0) {
|
||||
+ if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk add slave port failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = rte_eth_dev_start(slave_port_id[i]);
|
||||
- if (ret != 0) {
|
||||
+ if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "dpdk start slave port failed ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
@@ -550,15 +545,15 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
|
||||
if (bond_port) {
|
||||
struct rte_eth_dev_info slave_dev_info;
|
||||
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);
|
||||
- return slave_id;
|
||||
- }
|
||||
+ if (slave_id < 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "dpdk get bond primary port failed port = %d\n", slave_id);
|
||||
+ 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);
|
||||
+ if (ret != 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "dpdk get bond dev info failed ret = %d\n", ret);
|
||||
return ret;
|
||||
- }
|
||||
+ }
|
||||
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;
|
||||
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
|
||||
index fc627e3..c1a6464 100644
|
||||
--- a/src/lstack/include/lstack_cfg.h
|
||||
+++ b/src/lstack/include/lstack_cfg.h
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <lwip/ip_addr.h>
|
||||
+#include <rte_ether.h>
|
||||
|
||||
#include "lstack_protocol_stack.h"
|
||||
#include "gazelle_opt.h"
|
||||
@@ -111,8 +112,7 @@ struct cfg_params {
|
||||
bool expand_send_ring;
|
||||
bool tuple_filter;
|
||||
int8_t bond_mode;
|
||||
- uint8_t bond_slave1_mac_addr[ETHER_ADDR_LEN];
|
||||
- uint8_t bond_slave2_mac_addr[ETHER_ADDR_LEN];
|
||||
+ struct rte_ether_addr bond_slave_mac_addr[GAZELLE_MAX_BOND_NUM];
|
||||
bool use_sockmap;
|
||||
bool udp_enable;
|
||||
struct cfg_nic_params nic;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
From 69451fc6a5a7ca0f903c82cf8b44bcdbfa2707b6 Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Thu, 16 Nov 2023 17:29:21 +0800
|
||||
Subject: [PATCH] PRE_LOG: modify prelog info transfer to terminal at the same
|
||||
time
|
||||
|
||||
---
|
||||
src/lstack/include/lstack_log.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/include/lstack_log.h b/src/lstack/include/lstack_log.h
|
||||
index 8b4209a..e4bed37 100644
|
||||
--- a/src/lstack/include/lstack_log.h
|
||||
+++ b/src/lstack/include/lstack_log.h
|
||||
@@ -32,7 +32,7 @@ do { \
|
||||
|
||||
static inline void lstack_prelog_init(const char *name)
|
||||
{
|
||||
- openlog(name, LOG_CONS | LOG_PID, LOG_USER);
|
||||
+ openlog(name, LOG_PERROR | LOG_PID, LOG_USER);
|
||||
}
|
||||
static inline void lstack_prelog_uninit(void)
|
||||
{
|
||||
--
|
||||
2.27.0
|
||||
|
||||
64
0045-ethdev-mbuf-data-start-pointer-pbuf-payload.patch
Normal file
64
0045-ethdev-mbuf-data-start-pointer-pbuf-payload.patch
Normal file
@ -0,0 +1,64 @@
|
||||
From b902a2a2f392ab945bedf7d2d9eb22f6a0aa032c Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Wed, 15 Nov 2023 19:15:13 +0800
|
||||
Subject: [PATCH] ethdev: mbuf data start pointer pbuf->payload
|
||||
|
||||
---
|
||||
src/lstack/netif/lstack_ethdev.c | 26 ++++++++++----------------
|
||||
1 file changed, 10 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index da16e85..1d04684 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -809,10 +809,7 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
|
||||
struct rte_mbuf *pre_mbuf = NULL;
|
||||
struct rte_mbuf *first_mbuf = NULL;
|
||||
struct pbuf *first_pbuf = pbuf;
|
||||
- uint16_t header_len = 0;
|
||||
- if (likely(first_pbuf != NULL)) {
|
||||
- header_len = first_pbuf->l2_len + first_pbuf->l3_len + first_pbuf->l4_len;
|
||||
- }
|
||||
+ void *buf_addr;
|
||||
|
||||
while (likely(pbuf != NULL)) {
|
||||
struct rte_mbuf *mbuf = pbuf_to_mbuf(pbuf);
|
||||
@@ -821,26 +818,23 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
|
||||
mbuf->pkt_len = pbuf->tot_len;
|
||||
mbuf->ol_flags = pbuf->ol_flags;
|
||||
mbuf->next = NULL;
|
||||
+ buf_addr = rte_pktmbuf_mtod(mbuf, void *);
|
||||
+
|
||||
+ /*
|
||||
+ * |rte_mbuf | mbuf_private | data_off | data |
|
||||
+ * ^ ^
|
||||
+ * buf_addr payload
|
||||
+ * m->buf_addr pointer pbuf->payload
|
||||
+ */
|
||||
+ mbuf->data_off += (uint8_t *)pbuf->payload - (uint8_t *)buf_addr;
|
||||
|
||||
if (first_mbuf == NULL) {
|
||||
first_mbuf = mbuf;
|
||||
first_pbuf = pbuf;
|
||||
first_mbuf->nb_segs = 1;
|
||||
- if (pbuf->header_off > 0) {
|
||||
- mbuf->data_off -= header_len;
|
||||
- pbuf->header_off = 0;
|
||||
- }
|
||||
} else {
|
||||
first_mbuf->nb_segs++;
|
||||
pre_mbuf->next = mbuf;
|
||||
- if (pbuf->header_off == 0) {
|
||||
- mbuf->data_off += header_len;
|
||||
- pbuf->header_off = header_len;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (first_pbuf->l4_len == 8) {
|
||||
- mbuf->data_off += 12;
|
||||
}
|
||||
|
||||
if (likely(first_mbuf->pkt_len > MBUF_MAX_LEN)) {
|
||||
--
|
||||
2.27.0
|
||||
|
||||
25
0046-build-fix-ltran-build-error.patch
Normal file
25
0046-build-fix-ltran-build-error.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 864192f1b7b7e128400e38585329453fb64a36fe Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Fri, 17 Nov 2023 17:22:37 +0800
|
||||
Subject: [PATCH] build: fix ltran build error
|
||||
|
||||
---
|
||||
src/ltran/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ltran/CMakeLists.txt b/src/ltran/CMakeLists.txt
|
||||
index 8f5f674..6dab9a9 100644
|
||||
--- a/src/ltran/CMakeLists.txt
|
||||
+++ b/src/ltran/CMakeLists.txt
|
||||
@@ -31,7 +31,7 @@ if($ENV{DPDK_VERSION_1911})
|
||||
set(DPDK_DIR /usr/include/dpdk)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDPDK_VERSION_1911=1")
|
||||
set(DPDK_LINK_FLAGS "-Wl,-lrte_pmd_bond -Wl,-lrte_pmd_hinic -Wl,-lrte_pmd_ixgbe \
|
||||
- -Wl,-lrte_pmd_pcap -Wl,-lrte_pmd_virtio -Wl, -lrte_pmd_mlx5")
|
||||
+ -Wl,-lrte_pmd_pcap -Wl,-lrte_pmd_virtio -Wl,-lrte_pmd_mlx5")
|
||||
if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "loongarch64")
|
||||
set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,-lrte_pmd_i40e")
|
||||
endif()
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
From 31a7c86437dcc5c3ea03694f094fef2236021174 Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Fri, 17 Nov 2023 19:52:38 +0800
|
||||
Subject: [PATCH] cfg: fix lstack mempool lookup failed in ltran mode
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_cfg.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
|
||||
index d2d0fc1..441a2dc 100644
|
||||
--- a/src/lstack/core/lstack_cfg.c
|
||||
+++ b/src/lstack/core/lstack_cfg.c
|
||||
@@ -1026,6 +1026,7 @@ static int32_t parse_seperate_sendrecv_args(void)
|
||||
static int32_t parse_num_process(void)
|
||||
{
|
||||
if (g_config_params.use_ltran) {
|
||||
+ g_config_params.num_process = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
29
0048-add-tx-package-timeout.patch
Normal file
29
0048-add-tx-package-timeout.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 80eccdd1bb639a1ea8c186c8c2b7f451b0b38a7e Mon Sep 17 00:00:00 2001
|
||||
From: compile_success <980965867@qq.com>
|
||||
Date: Tue, 31 Oct 2023 11:44:29 +0000
|
||||
Subject: [PATCH] add tx package timeout
|
||||
|
||||
---
|
||||
src/lstack/netif/lstack_vdev.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
|
||||
index 81b48dc..62abe80 100644
|
||||
--- a/src/lstack/netif/lstack_vdev.c
|
||||
+++ b/src/lstack/netif/lstack_vdev.c
|
||||
@@ -142,10 +142,11 @@ static uint32_t vdev_tx_xmit(struct protocol_stack *stack, struct rte_mbuf **pkt
|
||||
stack->stats.tx_prepare_fail++;
|
||||
LSTACK_LOG(INFO, LSTACK, "rte_eth_tx_prepare failed\n");
|
||||
}
|
||||
+ const uint32_t tbegin = sys_now();
|
||||
|
||||
do {
|
||||
sent_pkts += rte_eth_tx_burst(stack->port_id, stack->queue_id, &pkts[sent_pkts], nr_pkts - sent_pkts);
|
||||
- } while (sent_pkts < nr_pkts);
|
||||
+ } while (sent_pkts < nr_pkts && (ENQUEUE_RING_RETRY_TIMEOUT > sys_now() - tbegin));
|
||||
|
||||
return sent_pkts;
|
||||
}
|
||||
--
|
||||
2.27.0
|
||||
|
||||
48
0049-modif-mem.patch
Normal file
48
0049-modif-mem.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From e69c39c7c73abd1245c1f7aecde3333fdb45ca2b Mon Sep 17 00:00:00 2001
|
||||
From: hantwofish <hankangkang5@huawei.com>
|
||||
Date: Sat, 18 Nov 2023 17:07:32 +0800
|
||||
Subject: [PATCH] modif mem
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_epoll.c | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
|
||||
index f2c4a8b..7572918 100644
|
||||
--- a/src/lstack/api/lstack_epoll.c
|
||||
+++ b/src/lstack/api/lstack_epoll.c
|
||||
@@ -910,9 +910,9 @@ static inline int timeval_to_ms(struct timeval *timeval)
|
||||
return (timeval->tv_sec * 1000 + timeval->tv_usec / 1000);
|
||||
}
|
||||
|
||||
-static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct pollfd **fds)
|
||||
+static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct pollfd *fds)
|
||||
{
|
||||
- struct pollfd pollfds[FD_SETSIZE] = { 0 };
|
||||
+ struct pollfd *pollfds = fds;
|
||||
nfds_t nfds = 0;
|
||||
|
||||
for (int i = 0; i < maxfd; i++) {
|
||||
@@ -930,8 +930,6 @@ static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_s
|
||||
nfds++;
|
||||
}
|
||||
}
|
||||
-
|
||||
- *fds = pollfds;
|
||||
return nfds;
|
||||
}
|
||||
|
||||
@@ -946,8 +944,8 @@ 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 = NULL;
|
||||
- nfds_t nfds = fds_select2poll(maxfd, readfds, writefds, exceptfds, &fds);
|
||||
+ struct pollfd fds[FD_SETSIZE] = { 0 };
|
||||
+ nfds_t nfds = fds_select2poll(maxfd, readfds, writefds, exceptfds, fds);
|
||||
int timeout = timeval_to_ms(timeval);
|
||||
|
||||
int event_num = lstack_poll(fds, nfds, timeout);
|
||||
--
|
||||
2.27.0
|
||||
|
||||
26
gazelle.spec
26
gazelle.spec
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.2
|
||||
Release: 12
|
||||
Release: 13
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -54,6 +54,17 @@ Patch9035: 0035-cfg-nic-queue-size-only-support-power-of-2.patch
|
||||
Patch9036: 0036-stack-fix-possible-coredump-when-arp-packet-broadcas.patch
|
||||
Patch9037: 0037-Fix-coredump-issue-and-skip-rte_pdump_init-for-secon.patch
|
||||
Patch9038: 0038-solve-problem-that-rte_pktmbuf_poll_creat-in-same-nu.patch
|
||||
Patch9039: 0039-build-add-mlx5-pmd-dependency.patch
|
||||
Patch9040: 0040-when-timeout-occurs-process-exits.patch
|
||||
Patch9041: 0041-wrap-support-select.patch
|
||||
Patch9042: 0042-add-vlan-support.patch
|
||||
Patch9043: 0043-slave-mac-addr.patch
|
||||
Patch9044: 0044-PRE_LOG-modify-prelog-info-transfer-to-terminal-at-t.patch
|
||||
Patch9045: 0045-ethdev-mbuf-data-start-pointer-pbuf-payload.patch
|
||||
Patch9046: 0046-build-fix-ltran-build-error.patch
|
||||
Patch9047: 0047-cfg-fix-lstack-mempool-lookup-failed-in-ltran-mode.patch
|
||||
Patch9048: 0048-add-tx-package-timeout.patch
|
||||
Patch9049: 0049-modif-mem.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -95,6 +106,19 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Sat Nov 18 2023 yinbin6 <yinbin8@huawei.com> - 1.0.2-13
|
||||
- modif mem
|
||||
- add tx package timeout
|
||||
- cfg: fix lstack mempool lookup failed in ltran mode
|
||||
- build: fix ltran build error
|
||||
- ethdev: mbuf data start pointer pbuf->payload
|
||||
- PRE_LOG: modify prelog info transfer to terminal at the same time
|
||||
- slave mac addr
|
||||
- add vlan support
|
||||
- wrap: support select
|
||||
- when timeout occurs,process exits.
|
||||
- build: add mlx5 pmd dependency
|
||||
|
||||
* Sat Nov 18 2023 hantwofish <hankangkang5@huawei.com> - 1.0.2-12
|
||||
- solve problem that rte_pktmbuf_poll_creat in same numa .
|
||||
- Fix coredump issue and skip rte_pdump_init for secondary process
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user