remove backport patches

remove unused variable in pbuf
sys_mbox_new return error when rte ring create failed
This commit is contained in:
jiangheng 2024-02-18 18:01:04 +08:00
parent e77bf7f0b9
commit 11db080179
8 changed files with 14 additions and 319 deletions

View File

@ -10,10 +10,10 @@ Subject: [PATCH] fix rte_ring_create time consuming
3 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index b7ee304..15053b3 100644
index 0cff4c4..d4cae53 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -2810,7 +2810,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
@@ -2844,7 +2844,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
#endif
break;
case NETCONN_EVT_ERROR:
@ -23,7 +23,7 @@ index b7ee304..15053b3 100644
}
sock->errevent = 1;
diff --git a/src/api/sys_arch.c b/src/api/sys_arch.c
index 1bc3aee..332d460 100644
index 1bc3aee..b80c0a8 100644
--- a/src/api/sys_arch.c
+++ b/src/api/sys_arch.c
@@ -37,6 +37,7 @@
@ -86,7 +86,7 @@ index 1bc3aee..332d460 100644
struct sys_mbox *mbox;
mbox = (struct sys_mbox *)memp_malloc(MEMP_SYS_MBOX);
@@ -100,21 +142,14 @@ err_t sys_mbox_new(struct sys_mbox **mb, int size)
@@ -100,21 +142,15 @@ err_t sys_mbox_new(struct sys_mbox **mb, int size)
}
mbox->flags = RING_F_SP_ENQ | RING_F_SC_DEQ;
@ -103,17 +103,17 @@ index 1bc3aee..332d460 100644
- if (!mbox->ring) {
- RTE_LOG(ERR, EAL, "cannot create rte_ring for mbox\n");
- memp_free(MEMP_SYS_MBOX, mbox);
- return ERR_MEM;
+
+ mbox->ring = gazelle_ring_create_fast(MBOX_NAME_PREFIX, mbox->size, mbox->flags);
+ if (mbox->ring == NULL) {
+ sys_mbox_free(&mbox);
return ERR_MEM;
}
+
mbox->wait_fn = mbox_wait_func;
*mb = mbox;
@@ -125,7 +160,7 @@ void sys_mbox_free(struct sys_mbox **mb)
@@ -125,7 +161,7 @@ void sys_mbox_free(struct sys_mbox **mb)
{
struct sys_mbox *mbox = *mb;
if (mbox->ring != NULL) {

View File

@ -183,10 +183,10 @@ index 38cfb96..115155d 100644
#endif /* GAZELLE_ENABLE */
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index bc29372..012df23 100644
index bc29372..d84c9da 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -225,22 +225,10 @@ struct pbuf {
@@ -225,22 +225,9 @@ struct pbuf {
u8_t if_idx;
#if GAZELLE_ENABLE && CHECKSUM_OFFLOAD_ALL
@ -202,7 +202,7 @@ index bc29372..012df23 100644
- u8_t rexmit;
volatile u8_t allow_in;
- u8_t head;
struct pbuf *last;
- struct pbuf *last;
pthread_spinlock_t pbuf_lock;
struct tcp_pcb *pcb;
- u16_t vlan_tci;

View File

@ -1,143 +0,0 @@
From 95aba99f41333ad430496eab2596bc8b489ae731 Mon Sep 17 00:00:00 2001
From: Dirk Ziegelmeier <dirk@ziegelmeier.net>
Date: Fri, 19 Oct 2018 22:30:17 +0200
Subject: [PATCH] Implement task #11620: Add outgoing VLAN PCP support for
Ethernet level QoS
Apply rebased patch from Timmy Brolin
---
src/core/tcp.c | 29 ++++++++++++++++-------------
src/core/tcp_in.c | 3 +++
src/include/lwip/netif.h | 22 ++++++++++++++--------
src/include/lwip/opt.h | 34 +++++++++++++++++++++++-----------
src/netif/ethernet.c | 12 ++++++++++--
5 files changed, 66 insertions(+), 34 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index ce03c8161..1f91d24ba 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -892,6 +892,9 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
lpcb->ttl = pcb->ttl;
lpcb->tos = pcb->tos;
+#if LWIP_VLAN_PCP
+ lpcb->netif_hints.tci = pcb->netif_hints.tci;
+#endif /* LWIP_VLAN_PCP */
#if GAZELLE_TCP_REUSE_IPPORT
lpcb->connect_num = 0;
lpcb->next_same_port_pcb = NULL;
index 428a6f48d..d1fe067a4 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -690,6 +690,9 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
#if LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG
npcb->listener = pcb;
#endif /* LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG */
+#if LWIP_VLAN_PCP
+ npcb->netif_hints.tci = pcb->netif_hints.tci;
+#endif /* LWIP_VLAN_PCP */
/* inherit socket options */
npcb->so_options = pcb->so_options & SOF_INHERITED;
npcb->netif_idx = pcb->netif_idx;
diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h
index 9e2007a64..013a69b5a 100644
--- a/src/include/lwip/netif.h
+++ b/src/include/lwip/netif.h
@@ -248,14 +248,20 @@ typedef u8_t netif_addr_idx_t;
#define NETIF_ADDR_IDX_MAX 0x7F
#endif
+#if LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP
+ #define LWIP_NETIF_USE_HINTS 1
+ struct netif_hint {
#if LWIP_NETIF_HWADDRHINT
-#define LWIP_NETIF_USE_HINTS 1
-struct netif_hint {
- netif_addr_idx_t addr_hint;
-};
-#else /* LWIP_NETIF_HWADDRHINT */
-#define LWIP_NETIF_USE_HINTS 0
-#endif /* LWIP_NETIF_HWADDRHINT */
+ u8_t addr_hint;
+#endif
+#if LWIP_VLAN_PCP
+ /** VLAN hader is set if this is >= 0 (but must be <= 0xFFFF) */
+ s32_t tci;
+#endif
+ };
+#else /* LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP */
+ #define LWIP_NETIF_USE_HINTS 0
+#endif /* LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP*/
/** Generic data structure used for all lwIP network interfaces.
* The following fields should be filled in by the initialization
#if LWIP_IPV6_AUTOCONFIG
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
index 90fce4f05..fb4b10c8b 100644
--- a/src/include/lwip/opt.h
+++ b/src/include/lwip/opt.h
@@ -677,6 +677,18 @@
#define ETHARP_SUPPORT_VLAN 0
#endif
+/**
+ * LWIP_VLAN_PCP==1: Enable outgoing VLAN taggning of frames on a per-PCB basis
+ * for QoS purposes. With this feature enabled, each PCB has a new variable: "tci".
+ * (Tag Control Identifier). The TCI contains three fields: VID, CFI and PCP.
+ * VID is the VLAN ID, which should be set to zero.
+ * The "CFI" bit is used to enable or disable VLAN tags for the PCB.
+ * PCP (Priority Code Point) is a 3 bit field used for Ethernet level QoS.
+ */
+#ifndef LWIP_VLAN_PCP
+#define LWIP_VLAN_PCP 0
+#endif
+
/** LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled
*/
#if !defined LWIP_ETHERNET || defined __DOXYGEN__
@@ -1548,13 +1560,13 @@
* link level header. The default is 14, the standard value for
* Ethernet.
*/
-#if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
-#if defined LWIP_HOOK_VLAN_SET && !defined __DOXYGEN__
-#define PBUF_LINK_HLEN (18 + ETH_PAD_SIZE)
-#else /* LWIP_HOOK_VLAN_SET */
-#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
-#endif /* LWIP_HOOK_VLAN_SET */
-#endif
+ #if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
+#if (defined LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP) && !defined __DOXYGEN__
+ #define PBUF_LINK_HLEN (18 + ETH_PAD_SIZE)
+#else /* LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP */
+ #define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#endif /* LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP */
+ #endif
/**
* PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index dd171e280..9e367f8cc 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -273,8 +273,16 @@ ethernet_output(struct netif * netif, struct pbuf * p,
struct eth_hdr *ethhdr;
u16_t eth_type_be = lwip_htons(eth_type);
-#if ETHARP_SUPPORT_VLAN && defined(LWIP_HOOK_VLAN_SET)
- s32_t vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
+#if ETHARP_SUPPORT_VLAN
+ s32_t vlan_prio_vid;
+#ifdef LWIP_HOOK_VLAN_SET
+ vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
+#elif LWIP_VLAN_PCP
+ vlan_prio_vid = -1;
+ if (netif->hints && (netif->hints->tci >= 0)) {
+ vlan_prio_vid = (u16_t)netif->hints->tci;
+ }
+#endif
if (vlan_prio_vid >= 0) {
struct eth_vlan_hdr *vlanhdr;

View File

@ -1,33 +0,0 @@
From f72227aadcc1d0d8c46a8b4fe62ba3d03ffa42c3 Mon Sep 17 00:00:00 2001
From: Simon Goldschmidt <goldsimon@gmx.de>
Date: Wed, 7 Nov 2018 10:49:06 +0100
Subject: [PATCH] fix compiling ETHARP_SUPPORT_VLAN without LWIP_HOOK_VLAN_SET
and LWIP_VLAN_PCP
---
src/netif/ethernet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index 9e367f8cc..6db434b46 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -273,7 +273,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
struct eth_hdr *ethhdr;
u16_t eth_type_be = lwip_htons(eth_type);
-#if ETHARP_SUPPORT_VLAN
+#if ETHARP_SUPPORT_VLAN && (defined(LWIP_HOOK_VLAN_SET) || LWIP_VLAN_PCP)
s32_t vlan_prio_vid;
#ifdef LWIP_HOOK_VLAN_SET
vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
@@ -297,7 +297,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
eth_type_be = PP_HTONS(ETHTYPE_VLAN);
} else
-#endif /* ETHARP_SUPPORT_VLAN && defined(LWIP_HOOK_VLAN_SET) */
+#endif /* ETHARP_SUPPORT_VLAN && (defined(LWIP_HOOK_VLAN_SET) || LWIP_VLAN_PCP) */
{
if (pbuf_add_header(p, SIZEOF_ETH_HDR) != 0) {
goto pbuf_header_failed;

View File

@ -1,36 +0,0 @@
From 003d34eebd223c16a3dbf6a970bb6e23cb7d1a24 Mon Sep 17 00:00:00 2001
From: Simon Goldschmidt <goldsimon@gmx.de>
Date: Fri, 27 Mar 2020 22:59:05 +0100
Subject: [PATCH] tcp: fix sequence number comparison
This fixes both undefined behavior (see bug #51447) as well as a possible bug
where sequence numbers in 31 bit distance may come through.
Conflict: NA
Reference: https://git.savannah.gnu.org/cgit/lwip.git/commit/?id=003d34eebd223c16a3dbf6a970bb6e23cb7d1a24
---
src/include/lwip/priv/tcp_priv.h | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index 72f9126d..c84b5be8 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -106,14 +106,11 @@ err_t tcp_process_refused_data(struct tcp_pcb *pcb);
#define tcp_output_nagle(tpcb) (tcp_do_output_nagle(tpcb) ? tcp_output(tpcb) : ERR_OK)
-#define TCP_SEQ_LT(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) < 0)
-#define TCP_SEQ_LEQ(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) <= 0)
-#define TCP_SEQ_GT(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) > 0)
-#define TCP_SEQ_GEQ(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) >= 0)
+#define TCP_SEQ_LT(a,b) (((u32_t)((u32_t)(a) - (u32_t)(b)) & 0x80000000u) != 0)
+#define TCP_SEQ_LEQ(a,b) (!(TCP_SEQ_LT(b,a)))
+#define TCP_SEQ_GT(a,b) TCP_SEQ_LT(b,a)
+#define TCP_SEQ_GEQ(a,b) TCP_SEQ_LEQ(b,a)
/* is b<=a<=c? */
-#if 0 /* see bug #10548 */
-#define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b))
-#endif
#define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c))
#ifndef TCP_TMR_INTERVAL
--
2.28.0.windows.1

View File

@ -1,58 +0,0 @@
From adbc5b5f716d108966bcf606e61de60b83f525a5 Mon Sep 17 00:00:00 2001
From: Simon Goldschmidt <goldsimon@gmx.de>
Date: Thu, 5 Mar 2020 21:20:35 +0100
Subject: [PATCH] tcp: tighten up checks for received SYN
Any malicous segment could contain a SYN up to now (no check).
A SYN in the wrong segment could break OOSEQ queueing.
Fix this by allowing SYN only in states where it is required.
See bug #56397: Assert "tcp_receive: ooseq tcplen > rcv_wnd"
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
Conflict: NA
Reference: https://git.savannah.gnu.org/cgit/lwip.git/commit/?id=adbc5b5f716d108966bcf606e61de60b83f525a5
---
src/core/tcp_in.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 4bfba85f..90061281 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -852,6 +852,13 @@ tcp_process(struct tcp_pcb *pcb)
tcp_parseopt(pcb);
+ if (flags & TCP_SYN) {
+ /* accept SYN only in 2 states: */
+ if ((pcb->state != SYN_SENT) && (pcb->state != SYN_RCVD)) {
+ return ERR_OK;
+ }
+ }
+
/* Do different things depending on the TCP state. */
switch (pcb->state) {
case SYN_SENT:
@@ -924,7 +931,12 @@ tcp_process(struct tcp_pcb *pcb)
}
break;
case SYN_RCVD:
- if (flags & TCP_ACK) {
+ if (flags & TCP_SYN) {
+ if (seqno == pcb->rcv_nxt - 1) {
+ /* Looks like another copy of the SYN - retransmit our SYN-ACK */
+ tcp_rexmit(pcb);
+ }
+ } else if (flags & TCP_ACK) {
/* expected ACK number? */
if (TCP_SEQ_BETWEEN(ackno, pcb->lastack + 1, pcb->snd_nxt)) {
pcb->state = ESTABLISHED;
@@ -975,9 +987,6 @@ tcp_process(struct tcp_pcb *pcb)
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
}
- } else if ((flags & TCP_SYN) && (seqno == pcb->rcv_nxt - 1)) {
- /* Looks like another copy of the SYN - retransmit our SYN-ACK */
- tcp_rexmit(pcb);
}
break;
case CLOSE_WAIT:
--
2.28.0.windows.1

View File

@ -1,39 +0,0 @@
From 574bd6e5aa57b971db7b347b8ad761342be9a02c Mon Sep 17 00:00:00 2001
From: duckpowerMB <ericwudesigner@gmail.com>
Date: Thu, 9 Sep 2021 16:52:55 +0800
Subject: [PATCH] tcp_in : fix ooseq update error
if a pbuf received with the same seqno in ooseq ,
we then check the size and replace the existing one
with the larger one,but if the existing one is the
last segment in ooseq ,it might has been trimed before.
the replacing action will overrun our receive windows
see patch #10106 and bug #56397
---
src/core/tcp_in.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index c7a1f7b7..de64464d 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1687,6 +1687,15 @@ tcp_receive(struct tcp_pcb *pcb)
->ooseq. We check the lengths to see which one to
discard. */
if (inseg.len > next->len) {
+
+ /* If next segment is the last segment in ooseq
+ and smaller than inseg, that means it has been
+ trimmed before to fit our window, so we just
+ break here. */
+ if (next->next == NULL) {
+ break;
+ }
+
/* The incoming segment is larger than the old
segment. We replace some segments with the new
one. */
--
2.27.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: 2
Release: 3
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -151,6 +151,10 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Tue Mar 5 2024 jiangheng <jiangheng14@huawei.com> - 2.2.0-3
- remove backport patches
- sys_mbox_new return error when rte ring create failed
* Tue Mar 5 2024 peng.zou <peng.zou@shingroup.cn> - 2.2.0-2
- add ppc64le support