!1095 [sync] PR-1083: lwip_sock: add sock_time_stamp

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2024-06-20 08:19:41 +00:00 committed by Gitee
commit 8a135804f9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 85 additions and 1 deletions

View File

@ -0,0 +1,79 @@
From e864f391bc48bd2473ac66356fe08370385f7b40 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 17 Jun 2024 16:49:55 +0800
Subject: [PATCH] lwip_sock: add sock_time_stamp
---
src/api/api_msg.c | 2 ++
src/include/lwipsock.h | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 9da4869..0d33c67 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -331,6 +331,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
#if GAZELLE_UDP_ENABLE
+ time_stamp_record(conn->callback_arg.socket, p);
do_lwip_add_recvlist(conn->callback_arg.socket);
#endif /* GAZELLE_UDP_ENABLE */
/* Register event with callback */
@@ -393,6 +394,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
#if GAZELLE_ENABLE
+ time_stamp_record(conn->callback_arg.socket, p);
do_lwip_add_recvlist(conn->callback_arg.socket);
#endif
/* Register event with callback */
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index dc2e9d3..d700cee 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -76,6 +76,11 @@ struct same_node_ring {
unsigned long long sndbegin;
unsigned long long sndend;
};
+
+struct sock_time_stamp {
+ uint64_t rpc_time_stamp;
+ uint64_t mbox_time_stamp;
+};
#endif
/** Contains all internal pointers and states used for a socket */
@@ -138,6 +143,8 @@ struct lwip_sock {
struct same_node_ring *same_node_tx_ring;
const struct rte_memzone *same_node_tx_ring_mz;
uint8_t already_bind_numa;
+
+ struct sock_time_stamp stamp;
#endif
};
@@ -167,11 +174,9 @@ extern struct lwip_sock *sockets;
extern void do_lwip_init_sock(int32_t fd);
extern void do_lwip_clean_sock(int32_t fd);
extern void do_lwip_connected_callback(struct netconn *conn);
-
extern struct pbuf *do_lwip_get_from_sendring(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags);
extern void do_lwip_get_from_sendring_over(struct lwip_sock *sock);
extern ssize_t do_lwip_read_from_lwip(struct lwip_sock *sock, int32_t flags, u8_t apiflags);
-
extern void do_lwip_add_recvlist(int32_t fd);
extern void netif_poll(struct netif *netif);
@@ -183,6 +188,8 @@ extern err_t create_same_node_ring(struct tcp_pcb *pcb);
extern err_t find_same_node_ring(struct tcp_pcb *pcb);
extern void lstack_calculate_aggregate(int type, uint32_t len);
extern void time_stamp_transfer_pbuf(struct pbuf *pbuf_old, struct pbuf *pbuf_new);
+extern void time_stamp_record(int fd, struct pbuf *pbuf);
+
#endif /* GAZELLE_ENABLE */
struct lwip_sock *get_socket(int s);
--
2.33.0

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.2.0
Release: 30
Release: 31
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -149,6 +149,8 @@ Patch9133: 0134-mod-checksum-of-ip_hdr-and-udp_hdr.patch
Patch9134: 0135-change-STAT_COUNTER-from-u16-to-u64.patch
Patch9135: 0136-fix-vlan-filter-bug.patch
Patch9136: 0137-reduce-pbuf-pool-size.patch
Patch9137: 0138-lwip_sock-add-sock_time_stamp.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
#Requires:
@ -177,6 +179,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Mon Jun 17 2024 yangchen <yangchen145@huawei.com> - 2.2.0-31
- lwip_sock: add sock_time_stamp
* Sat Jun 15 2024 yinbin <yinbin8@huawei.com> - 2.2.0-30
- reduce pbuf pool size