lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Window Size relation with sending buffer (Tuning TCP articl


From: vr roriz
Subject: [lwip-users] Window Size relation with sending buffer (Tuning TCP article)
Date: Thu, 15 Nov 2018 11:12:08 +0100

Dear colleagues, 

I'm  bit confused about the the TCP_WND option parameter.
First I understood that this value is the initial advertised TCP window size. For instance, when I set it to 2*TCP_MSS,  my advertised window in the TCP header of the SYNC segment is matches 2*TCP_MSS. Also, we can se that tcp_recved correctly updates the TCP window size to be advertised with TCP_WND as the upper limit:
pcb->rcv_wnd += len;
  if (pcb->rcv_wnd > TCP_WND_MAX(pcb)) {
    pcb->rcv_wnd = TCP_WND_MAX(pcb);
  }

However, I was reading the Tuning TCP article (http://lwip.wikia.com/wiki/Tuning_TCP), and it states, under "Window size (TCP_WND)" :

"The TCP window size can be adjusted by changing the define TCP_WND. However, do keep in mind that this should be at least twice the size of TCP_MSS (thus on ethernet, where TCP_MSS is 1460, it should be set to at least 2920). If memory allows it, set this as high as possible (16-bit, so 0xFFFF is the highest value), but keep in mind that for every active connection, the full window may have to be buffered until it is acknowledged by the remote side (although this buffer size can still be controlled by TCP_SND_BUF and TCP_SND_QUEUELEN)."

So, I've got confused of the relation with TCP_WND with the sending buffer and queue. I did not find anything relevant in the TCP output functions. Just tcp_connect seems to also be using the value (maybe as a initial parameter for the sending window?) In tcp_connect, we can find the fragment:


  /* Start with a window that does not need scaling. When window scaling is
     enabled and used, the window is enlarged when both sides agree on scaling. */
  pcb->rcv_wnd = pcb->rcv_ann_wnd = TCPWND_MIN16(TCP_WND);
  pcb->rcv_ann_right_edge = pcb->rcv_nxt;
  pcb->snd_wnd = TCP_WND;

Could somebody put some light on the topic for me?

Thank you!
Vitor


reply via email to

[Prev in Thread] Current Thread [Next in Thread]