]> granicus.if.org Git - esp-idf/commitdiff
lwip: fix tcp rx abnormal issue(tw8242)
authorLiu Zhi Fu <liuzhifu@espressif.com>
Mon, 31 Oct 2016 09:50:09 +0000 (17:50 +0800)
committerLiu Zhi Fu <liuzhifu@espressif.com>
Mon, 31 Oct 2016 09:50:09 +0000 (17:50 +0800)
In tcp_alloc(), initialize per_soc_tcp_wnd before initializing recv_wnd because recv_wnd depends on per_soc_tcp_wnd.

components/lwip/core/tcp.c
components/lwip/core/tcp_out.c
components/lwip/include/lwip/port/lwipopts.h

index 87ddf5f1a761e52059d5a763aea84b049051ac84..627df6d293fd234efd05b964289a6a58aad2b5c4 100755 (executable)
@@ -1532,6 +1532,12 @@ tcp_alloc(u8_t prio)
   }
   if (pcb != NULL) {
     memset(pcb, 0, sizeof(struct tcp_pcb));
+
+#if ESP_PER_SOC_TCP_WND
+    pcb->per_soc_tcp_wnd = TCP_WND_DEFAULT;
+    pcb->per_soc_tcp_snd_buf = TCP_SND_BUF_DEFAULT;
+#endif
+
     pcb->prio = prio;
     pcb->snd_buf = TCP_SND_BUF_DEFAULT;
     pcb->snd_queuelen = 0;
@@ -1575,11 +1581,6 @@ tcp_alloc(u8_t prio)
 #endif /* LWIP_TCP_KEEPALIVE */
 
     pcb->keep_cnt_sent = 0;
-
-#if ESP_PER_SOC_TCP_WND
-    pcb->per_soc_tcp_wnd = TCP_WND_DEFAULT;
-    pcb->per_soc_tcp_snd_buf = TCP_SND_BUF_DEFAULT;
-#endif
   }
 
   return pcb;
index f189623f5c2f2a83400b52695d51d49eb049e447..35a8aa145da8c3ab142f8fe18554f71dd190d2cd 100755 (executable)
@@ -1320,9 +1320,9 @@ tcp_rst(u32_t seqno, u32_t ackno,
 #endif
 #else
 #if LWIP_WND_SCALE
-  tcphdr->wnd = PP_HTONS(((TCP_WND >> TCP_RCV_SCALE) & 0xFFFF));
+  tcphdr->wnd = PP_HTONS(((TCP_WND_DEFAULT >> TCP_RCV_SCALE) & 0xFFFF));
 #else
-  tcphdr->wnd = PP_HTONS(TCP_WND);
+  tcphdr->wnd = PP_HTONS(TCP_WND_DEFAULT);
 #endif
 #endif
   tcphdr->chksum = 0;
index 35c2800ed3f3f6442fd75f22df26a5bbc7d8c2c4..b8811813d1dd38666854695afbdaca2410213ef3 100755 (executable)
@@ -240,26 +240,6 @@ extern unsigned long os_random(void);
    ---------- TCP options ----------
    ---------------------------------
 */
-/**
- * TCP_WND: The size of a TCP window.  This must be at least
- * (2 * TCP_MSS) for things to work well
- */
-
-#define ESP_PER_SOC_TCP_WND             1
-#if ESP_PER_SOC_TCP_WND
-#define TCP_WND_DEFAULT                      (4*TCP_MSS)
-#define TCP_SND_BUF_DEFAULT                  (2*TCP_MSS)
-
-#define TCP_WND(pcb)                         (pcb->per_soc_tcp_wnd)
-#define TCP_SND_BUF(pcb)                     (pcb->per_soc_tcp_snd_buf)
-#else
-#ifdef PERF
-extern unsigned char misc_prof_get_tcpw(void);
-extern unsigned char misc_prof_get_tcp_snd_buf(void);
-#define TCP_WND(pcb)                         (misc_prof_get_tcpw()*TCP_MSS)
-#define TCP_SND_BUF(pcb)                     (misc_prof_get_tcp_snd_buf()*TCP_MSS)
-#endif
-#endif
 
 
 /**