• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 590873482f9b6a5e2635a95720acb37b5f516ab0 Mon Sep 17 00:00:00 2001
2From: kircher <majun65@huawei.com>
3Date: Tue, 21 Feb 2023 15:05:41 +0800
4Subject: [PATCH] lwip add need_tso_send
5
6---
7 src/api/api_msg.c      | 1 +
8 src/core/tcp_out.c     | 5 ++++-
9 src/include/lwip/tcp.h | 2 ++
10 3 files changed, 7 insertions(+), 1 deletion(-)
11
12diff --git a/src/api/api_msg.c b/src/api/api_msg.c
13index 1fedaad..3a4a473 100644
14--- a/src/api/api_msg.c
15+++ b/src/api/api_msg.c
16@@ -1744,6 +1744,7 @@ lwip_netconn_do_writemore(struct netconn *conn  WRITE_DELAYED_PARAM)
17       write_more = 0;
18       err = tcp_write(conn->pcb.tcp, conn->current_msg->msg.w.vector->ptr, len, apiflags);
19       conn->current_msg->msg.w.len = len;
20+      conn->pcb.tcp->need_tso_send = 1;
21 #else
22       err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags);
23 #endif
24diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
25index c538f2a..bf23381 100644
26--- a/src/core/tcp_out.c
27+++ b/src/core/tcp_out.c
28@@ -1473,7 +1473,7 @@ tcp_output(struct tcp_pcb *pcb)
29
30   u32_t send_len = 0;
31 #if USE_LIBOS
32-  if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_TSO) {
33+  if ((get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_TSO) && pcb->need_tso_send) {
34     while(seg && send_len < 0xffff) {
35       /**
36        * 1) walk unsent queue, find all seg witch wait to send. chain buf in these segs.
37@@ -1529,6 +1529,7 @@ tcp_output(struct tcp_pcb *pcb)
38         if (err != ERR_OK) {
39           if (pcb->unsent == NULL)
40             pcb->last_unsent = NULL;
41+	  pcb->need_tso_send = 0;
42           return err;
43         }
44         pcb->unsent = seg->next;
45@@ -1552,6 +1553,7 @@ tcp_output(struct tcp_pcb *pcb)
46       pbuf_remove_header(new_seg.p, new_seg.p->tot_len - new_seg.len - TCPH_HDRLEN_BYTES(new_seg.tcphdr));
47       new_seg.p->tot_len = new_seg.p->len;
48     }
49+  pcb->need_tso_send = 0;
50   } else
51 #endif
52 {
53@@ -1647,6 +1649,7 @@ tcp_output(struct tcp_pcb *pcb)
54 #endif /* TCP_OVERSIZE */
55
56 output_done:
57+  pcb->need_tso_send = 0;
58   if (pcb->unsent == NULL)
59     pcb->last_unsent = NULL;
60   tcp_clear_flags(pcb, TF_NAGLEMEMERR);
61diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
62index 0b65b01..2fc683d 100644
63--- a/src/include/lwip/tcp.h
64+++ b/src/include/lwip/tcp.h
65@@ -409,6 +409,8 @@ struct tcp_pcb {
66   u8_t snd_scale;
67   u8_t rcv_scale;
68 #endif
69+
70+  u8_t need_tso_send;
71 };
72
73 #if TCP_PCB_HASH
74--
752.33.0
76
77