sync xdp: support XDP_STATISTICS by posix_api->getsockopt_fn

(cherry picked from commit 014b7488cbb047b935ae0c87acf6d1e24511597c)
This commit is contained in:
yinbin6 2024-11-01 16:46:09 +08:00 committed by openeuler-sync-bot
parent 1dde4ef3d7
commit 40a2960a4c
6 changed files with 242 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From e2ab6a041aa5587c6e6d021c32da2ce4d98522b2 Mon Sep 17 00:00:00 2001
From: hankangkang <hankangkang5@huawei.com>
Date: Wed, 30 Oct 2024 11:15:55 +0800
Subject: [PATCH] bugfix: start fail when executing the popen command for the
second time in openGauss
---
src/lstack/core/lstack_init.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/lstack/core/lstack_init.c b/src/lstack/core/lstack_init.c
index a72af84..8ffc3a1 100644
--- a/src/lstack/core/lstack_init.c
+++ b/src/lstack/core/lstack_init.c
@@ -98,7 +98,6 @@ static int32_t check_process_conflict(void)
}
ret = flock((fileno(fp)), LOCK_EX | LOCK_NB);
- (void)fclose(fp);
if (ret < 0) {
return -1;
}
--
2.33.0

View File

@ -0,0 +1,73 @@
From 1005ad274d1a59d8a2d60fc280eae38f43c90dbe Mon Sep 17 00:00:00 2001
From: lixiang <lixiang_yewu@cmss.chinamobile.com>
Date: Fri, 11 Oct 2024 09:58:44 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/inc/server.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/examples/inc/server.h b/examples/inc/server.h
index 4631a28..35773e1 100644
--- a/examples/inc/server.h
+++ b/examples/inc/server.h
@@ -33,7 +33,7 @@ struct ServerMumUnit
uint64_t recv_bytes; ///< total receive bytes
struct ServerIpInfo server_ip_info;
uint16_t port; ///< server port
- uint32_t pktlen; ///< the length of peckage
+ uint32_t pktlen; ///< the length of package
char* domain; ///< communication domain
char* api; ///< the type of api
bool debug; ///< if we print the debug information
@@ -65,7 +65,7 @@ struct ServerMudWorker
int32_t epfd; ///< the worker epoll file descriptor
struct epoll_event *epevs; ///< the epoll events
uint64_t recv_bytes; ///< total receive bytes
- uint32_t pktlen; ///< the length of peckage
+ uint32_t pktlen; ///< the length of package
ip_addr_t ip; ///< client ip
uint16_t port; ///< client port
char* api; ///< the type of api
@@ -88,7 +88,7 @@ struct ServerMud
struct epoll_event *epevs; ///< the epoll events
struct ServerIpInfo server_ip_info;
bool* port; ///< server port point to parameter's port
- uint32_t pktlen; ///< the length of peckage
+ uint32_t pktlen; ///< the length of package
char* domain; ///< communication domain
char* api; ///< the type of api
bool debug; ///< if we print the debug information
@@ -184,7 +184,7 @@ void *sermud_listener_create_and_run(void *arg);
int32_t sermud_create_and_run(struct ProgramParams *params);
/**
- * @brief the multi thread, unblock, mutliplexing IO server prints informations
+ * @brief the multi thread, unblock, multiplexing IO server prints informations
* The multi thread, unblock, mutliplexing IO server prints informations.
* @param server_mum the server information
*/
@@ -199,7 +199,7 @@ void sermum_info_print(struct ServerMum *server_mum);
int32_t sersum_create_epfd_and_reg(struct ServerMumUnit *server_unit);
/**
- * @brief the single thread, unblock, mutliplexing IO server accepts the connections
+ * @brief the single thread, unblock, multiplexing IO server accepts the connections
* The single thread, unblock, mutliplexing IO server accepts the connections.
* @param server_unit the server unit
* @param server_handler the server handler
@@ -208,7 +208,7 @@ int32_t sersum_create_epfd_and_reg(struct ServerMumUnit *server_unit);
int32_t sersum_accept_connects(struct epoll_event *cur_epev, struct ServerMumUnit *server_unit);
/**
- * @brief the single thread, unblock, mutliplexing IO server processes the events
+ * @brief the single thread, unblock, multiplexing IO server processes the events
* The single thread, unblock, mutliplexing IO server processes the events.
* @param server_unit the server unit
* @return the result pointer
--
2.33.0

View File

@ -0,0 +1,40 @@
From 1494a9e8d7b461301476be05a6b9cbc170b4d51d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E6=A5=9A=E5=90=9B?=
<zhangchujun@cmss.chinamobile.com>
Date: Fri, 11 Oct 2024 14:56:06 +0800
Subject: [PATCH] remove the unused return variable.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
因为kni_config_network_interface函数始终返回0此提交移除了ret变量化简了函数的返回逻辑
Signed-off-by:zhangchujun <zhangchujun@cmss.chinamobile.com>
---
src/common/dpdk_common.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/common/dpdk_common.c b/src/common/dpdk_common.c
index 66ad529..fafd266 100644
--- a/src/common/dpdk_common.c
+++ b/src/common/dpdk_common.c
@@ -55,7 +55,6 @@ struct rte_kni* get_gazelle_kni(void)
static int32_t kni_config_network_interface(uint16_t port_id, uint8_t if_up)
{
- int32_t ret = 0;
static bool g_bond_dev_started = false;
if (port_id >= rte_eth_dev_count_avail() || port_id >= GAZELLE_MAX_ETHPORTS) {
@@ -82,7 +81,7 @@ static int32_t kni_config_network_interface(uint16_t port_id, uint8_t if_up)
}
COMMON_INFO("Configure network interface of %hu %s \n", port_id, if_up ? "up" : "down");
- return ret;
+ return 0;
}
int32_t dpdk_kni_init(uint16_t port, struct rte_mempool *pool)
--
2.33.0

View File

@ -0,0 +1,28 @@
From f62692f99e2d10803a667202694b5e38fa335edb Mon Sep 17 00:00:00 2001
From: hankangkang <hankangkang5@huawei.com>
Date: Thu, 31 Oct 2024 10:37:06 +0800
Subject: [PATCH] add SO_NUMA_ID(optname) for adapting opneGauss
---
src/lstack/api/lstack_wrap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 8f80f98..e0e8244 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -381,7 +381,11 @@ static bool unsupport_optname(int32_t level, int32_t optname)
static inline int32_t do_getsockopt(int32_t s, int32_t level, int32_t optname, void *optval, socklen_t *optlen)
{
+#define SO_NUMA_ID 0x100c
if (select_sock_posix_path(lwip_get_socket(s)) == POSIX_LWIP && !unsupport_optname(level, optname)) {
+ if (level == IPPROTO_IP && optname == SO_NUMA_ID) {
+ return lwip_get_socket(s)->stack->socket_id;
+ }
return g_wrap_api->getsockopt_fn(s, level, optname, optval, optlen);
}
--
2.33.0

View File

@ -0,0 +1,63 @@
From e1cd2f3205eb6ebcf63ee931c48c54dc49417708 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Fri, 1 Nov 2024 09:12:52 +0800
Subject: [PATCH] xdp: support XDP_STATISTICS by posix_api->getsockopt_fn
---
src/lstack/api/lstack_wrap.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 8f80f98..98bb8a1 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -14,6 +14,7 @@
#include <ifaddrs.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
+#include <linux/if_xdp.h>
#include <lwip/lwipgz_posix_api.h>
#include <lwip/lwipgz_sock.h>
@@ -363,20 +364,28 @@ static bool unsupport_socket_optname(int32_t optname)
return false;
}
-static bool unsupport_optname(int32_t level, int32_t optname)
+static bool unsupport_xdp_optname(int32_t optname)
{
- if (level == SOL_IP) {
- return unsupport_ip_optname(optname);
- }
-
- if (level == SOL_TCP) {
- return unsupport_tcp_optname(optname);
+ if (optname == XDP_STATISTICS) {
+ return true;
}
+ return false;
+}
- if (level == SOL_SOCKET) {
- return unsupport_socket_optname(optname);
+static bool unsupport_optname(int32_t level, int32_t optname)
+{
+ switch (level) {
+ case SOL_IP:
+ return unsupport_ip_optname(optname);
+ case SOL_TCP:
+ return unsupport_tcp_optname(optname);
+ case SOL_SOCKET:
+ return unsupport_socket_optname(optname);
+ case SOL_XDP:
+ return unsupport_xdp_optname(optname);
+ default:
+ return false;
}
- return false;
}
static inline int32_t do_getsockopt(int32_t s, int32_t level, int32_t optname, void *optval, socklen_t *optlen)
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.2
Release: 72
Release: 73
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -291,6 +291,11 @@ Patch9271: 0271-fix-the-coredump-when-gazellectl-l.patch
Patch9272: 0272-control-call-epoll_ctl-delete-fd-when-fd-close.patch
Patch9273: 0273-epoll-remove-unnecessary-judgment-code.patch
Patch9274: 0274-slove-compile-err-when-GAZELLE_TCP_REUSE_IPPORT-is-o.patch
Patch9275: 0275-bugfix-start-fail-when-executing-the-popen-command-f.patch
Patch9276: 0276-Fix-annotation-errors.patch
Patch9277: 0277-remove-the-unused-return-variable.patch
Patch9278: 0278-add-SO_NUMA_ID-optname-for-adapting-opneGauss.patch
Patch9279: 0279-xdp-support-XDP_STATISTICS-by-posix_api-getsockopt_f.patch
%description
%{name} is a high performance user-mode stack.
@ -332,6 +337,13 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Fri Nov 01 2024 hantwofish <yinbin8@huawei.com> - 1.0.2-73
- xdp: support XDP_STATISTICS by posix_api->getsockopt_fn
- add SO_NUMA_ID(optname) for adapting opneGauss
- remove the unused return variable.
- Fix annotation errors
- bugfix: start fail when executing the popen command for the second time in openGauss
* Sat Oct 26 2024 hantwofish <hankangkang5@huawei.com> - 1.0.2-72
- slove compile err when GAZELLE_TCP_REUSE_IPPORT is off