1 Star 0 Fork 32

hantwofish/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0279-xdp-support-XDP_STATISTICS-by-posix_api-getsockopt_f.patch 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hantwofish/gazelle_1.git
git@gitee.com:hantwofish/gazelle_1.git
hantwofish
gazelle_1
gazelle_1
master

搜索帮助