1 Star 0 Fork 48

yinbin6/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0059-fix-last_unsent-last_unacked.patch 2.48 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2024-02-06 10:45 . adapt lwip-2.2.0
From f1692b0c380241699f70adbf7796cb2c7b3a5c94 Mon Sep 17 00:00:00 2001
From: jiangheng12 <jiangheng14@huawei.com>
Date: Sat, 1 Apr 2023 16:59:28 +0800
Subject: [PATCH] fix last_unsent/last_unacked
---
src/core/tcp_in.c | 25 +++++++++++++------------
src/core/tcp_out.c | 18 +++++++++++++-----
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 7aad1b8..f6ec4f8 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1447,10 +1447,7 @@ tcp_output(struct tcp_pcb *pcb)
pcb->persist_backoff = 0;
/* useg should point to last segment on unacked queue */
- useg = pcb->unacked;
- if (useg != NULL) {
- for (; useg->next != NULL; useg = useg->next);
- }
+ useg = pcb->last_unacked;
/* data available and window allows it to be sent? */
#if GAZELLE_ENABLE
@@ -1518,7 +1515,11 @@ tcp_output(struct tcp_pcb *pcb)
return err;
}
+ if (pcb->last_unsent == pcb->unsent) {
+ pcb->last_unsent = last_seg->next;
+ }
pcb->unsent = last_seg->next;
+
if (pcb->state != SYN_SENT) {
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
}
@@ -1538,6 +1539,7 @@ tcp_output(struct tcp_pcb *pcb)
if (TCP_TCPLEN(tmp_seg) > 0) {
tmp_seg->next = NULL;
if (pcb->unacked == NULL) {
+ pcb->last_unacked = tmp_seg;
pcb->unacked = tmp_seg;
useg = tmp_seg;
} else {
@@ -1553,6 +1555,9 @@ tcp_output(struct tcp_pcb *pcb)
} else {
/* add segment to tail of unacked list */
useg->next = tmp_seg;
+ if (pcb->last_unacked == useg) {
+ pcb->last_unacked = tmp_seg;
+ }
useg = useg->next;
}
}
@@ -1606,6 +1611,9 @@ end_loop:
#if TCP_OVERSIZE_DBGCHECK
seg->oversize_left = 0;
#endif /* TCP_OVERSIZE_DBGCHECK */
+ if (pcb->last_unsent == pcb->unsent) {
+ pcb->last_unsent = seg->next;
+ }
pcb->unsent = seg->next;
if (pcb->state != SYN_SENT) {
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
@@ -1712,7 +1720,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
int seg_chksum_was_swapped = 0;
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
lstack_calculate_aggregate(1, seg->len);
#endif
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yinbin6/lwip.git
git@gitee.com:yinbin6/lwip.git
yinbin6
lwip
lwip
master

搜索帮助