108 lines
3.7 KiB
Diff
108 lines
3.7 KiB
Diff
From d9e656c6ca48367fdc174b00c64d6f3fb0584a38 Mon Sep 17 00:00:00 2001
|
|
From: jiangheng <jiangheng14@huawei.com>
|
|
Date: Mon, 5 Feb 2024 15:09:14 +0800
|
|
Subject: [PATCH] add huge snd_buf
|
|
|
|
---
|
|
src/core/init.c | 2 +-
|
|
src/core/pbuf.c | 9 ++++++---
|
|
src/include/lwip/opt.h | 2 +-
|
|
src/include/lwip/pbuf.h | 2 +-
|
|
src/include/lwipopts.h | 2 +-
|
|
5 files changed, 10 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/core/init.c b/src/core/init.c
|
|
index 5b60ed8..6841857 100644
|
|
--- a/src/core/init.c
|
|
+++ b/src/core/init.c
|
|
@@ -312,7 +312,7 @@ PACK_STRUCT_END
|
|
#if TCP_MSS >= ((16 * 1024) - 1)
|
|
#error "lwip_sanity_check: WARNING: TCP_MSS must be <= 16382 to prevent u16_t underflow in TCP_SNDLOWAT calculation!"
|
|
#endif
|
|
-#if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS))
|
|
+#if TCP_SNDLOWAT >= (0xFFFFFFFF - (4 * TCP_MSS))
|
|
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must at least be 4*MSS below u16_t overflow!"
|
|
#endif
|
|
#if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN
|
|
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
|
|
index 69a52b6..bea0e81 100644
|
|
--- a/src/core/pbuf.c
|
|
+++ b/src/core/pbuf.c
|
|
@@ -871,13 +871,13 @@ pbuf_cat(struct pbuf *h, struct pbuf *t)
|
|
/* proceed to last pbuf of chain */
|
|
for (p = h; p->next != NULL; p = p->next) {
|
|
/* add total length of second chain to all totals of first chain */
|
|
- p->tot_len = (u16_t)(p->tot_len + t->tot_len);
|
|
+ p->tot_len = p->tot_len + t->tot_len;
|
|
}
|
|
/* { p is last pbuf of first h chain, p->next == NULL } */
|
|
LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);
|
|
LWIP_ASSERT("p->next == NULL", p->next == NULL);
|
|
/* add total length of second chain to last pbuf total of first chain */
|
|
- p->tot_len = (u16_t)(p->tot_len + t->tot_len);
|
|
+ p->tot_len = p->tot_len + t->tot_len;
|
|
/* chain last pbuf of head (p) with first of tail (t) */
|
|
p->next = t;
|
|
/* p->next now references t, but the caller will drop its reference to t,
|
|
@@ -1178,7 +1178,7 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest)
|
|
if (r != NULL) {
|
|
/* Update the tot_len field in the first part */
|
|
for (i = p; i != NULL; i = i->next) {
|
|
- i->tot_len = (u16_t)(i->tot_len - r->tot_len);
|
|
+ i->tot_len = tot_len_front;
|
|
LWIP_ASSERT("tot_len/len mismatch in last pbuf",
|
|
(i->next != NULL) || (i->tot_len == i->len));
|
|
}
|
|
@@ -1189,6 +1189,9 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest)
|
|
/* tot_len field in rest does not need modifications */
|
|
/* reference counters do not need modifications */
|
|
*rest = r;
|
|
+ r->tot_len = r->len;
|
|
+ }else{
|
|
+ p->tot_len = tot_len_front;
|
|
}
|
|
}
|
|
}
|
|
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
|
|
index b738460..570d2de 100644
|
|
--- a/src/include/lwip/opt.h
|
|
+++ b/src/include/lwip/opt.h
|
|
@@ -1533,7 +1533,7 @@
|
|
* send window while having a small receive window only.
|
|
*/
|
|
#if !defined LWIP_WND_SCALE || defined __DOXYGEN__
|
|
-#define LWIP_WND_SCALE 0
|
|
+#define LWIP_WND_SCALE 1
|
|
#define TCP_RCV_SCALE 0
|
|
#endif
|
|
|
|
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
|
|
index b362007..60d8d1a 100644
|
|
--- a/src/include/lwip/pbuf.h
|
|
+++ b/src/include/lwip/pbuf.h
|
|
@@ -197,7 +197,7 @@ struct pbuf {
|
|
* For non-queue packet chains this is the invariant:
|
|
* p->tot_len == p->len + (p->next? p->next->tot_len: 0)
|
|
*/
|
|
- u16_t tot_len;
|
|
+ u32_t tot_len;
|
|
|
|
/** length of this buffer */
|
|
u16_t len;
|
|
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
|
index 7c819d0..d7b9635 100644
|
|
--- a/src/include/lwipopts.h
|
|
+++ b/src/include/lwipopts.h
|
|
@@ -97,7 +97,7 @@
|
|
|
|
#define TCP_WND (40 * TCP_MSS)
|
|
|
|
-#define TCP_SND_BUF (40 * TCP_MSS)
|
|
+#define TCP_SND_BUF (2500 * TCP_MSS)
|
|
|
|
#define TCP_SND_QUEUELEN (8191)
|
|
|
|
--
|
|
2.33.0
|
|
|