distinguish tcp/udp get_from_sendring

(cherry picked from commit 681985d73e187b12d221d7adb1d3f1ffee269579)
This commit is contained in:
jiangheng 2024-06-11 14:24:36 +08:00 committed by openeuler-sync-bot
parent c91e5d71c1
commit 4843569b94
2 changed files with 77 additions and 1 deletions

View File

@ -0,0 +1,72 @@
From b3a058a46a27beadb5976d4618e2f33a69909c9b Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Tue, 18 Jun 2024 09:31:12 +0800
Subject: [PATCH] distinguish tcp/udp get_from_sendring
---
src/core/tcp_out.c | 3 ++-
src/core/udp.c | 4 +---
src/include/lwip/pbuf.h | 2 +-
src/include/lwipsock.h | 3 ++-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 8a9016b..839e904 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -907,8 +907,9 @@ tcp_write_from_stack(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apifl
u16_t max_len = mss_local - optlen;
u16_t seglen = LWIP_MIN(left, max_len);
- p = do_lwip_get_from_sendring((struct lwip_sock *)arg, len - pos, &apiflags);
+ p = do_lwip_tcp_get_from_sendring((struct lwip_sock *)arg, len - pos);
if (p == NULL) {
+ apiflags &= ~TCP_WRITE_FLAG_MORE;
break;
}
seglen = p->tot_len;
diff --git a/src/core/udp.c b/src/core/udp.c
index 1fae8b6..086e7e0 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -702,9 +702,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
return ERR_RTE;
}
#if GAZELLE_UDP_ENABLE
- uint8_t apiflags = 0;
-
- struct pbuf *udp_pbuf = do_lwip_get_from_sendring((struct lwip_sock *)(p->payload), p->tot_len, &apiflags);
+ struct pbuf *udp_pbuf = do_lwip_udp_get_from_sendring((struct lwip_sock *)(p->payload), p->tot_len);
do_lwip_get_from_sendring_over((struct lwip_sock *)(p->payload));
p = udp_pbuf;
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index d84c9da..2bb9675 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -225,7 +225,7 @@ struct pbuf {
u8_t if_idx;
#if GAZELLE_ENABLE && CHECKSUM_OFFLOAD_ALL
- volatile u8_t allow_in;
+ volatile u8_t allow_append;
pthread_spinlock_t pbuf_lock;
struct tcp_pcb *pcb;
#if GAZELLE_UDP_ENABLE
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index d700cee..7ba685a 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -174,7 +174,8 @@ 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 struct pbuf *do_lwip_udp_get_from_sendring(struct lwip_sock *sock, uint16_t remain_size);
+extern struct pbuf *do_lwip_tcp_get_from_sendring(struct lwip_sock *sock, uint16_t remain_size);
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);
--
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: 31
Release: 32
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -150,6 +150,7 @@ 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
Patch9138: 0139-distinguish-tcp-udp-get_from_sendring.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -179,6 +180,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Mon Jun 17 2024 jiangheng <jiangheng14@huawei.com> - 2.2.0-32
- distinguish tcp/udp from sendring
* Mon Jun 17 2024 yangchen <yangchen145@huawei.com> - 2.2.0-31
- lwip_sock: add sock_time_stamp