64 lines
1.8 KiB
Diff
64 lines
1.8 KiB
Diff
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
|
|
|