Window Size relation with sending buffer (Tuning TCP article)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Window Size relation with sending buffer (Tuning TCP article)

vr roriz
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


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Window Size relation with sending buffer (Tuning TCP article)

goldsimon@gmx.de
On 15.11.2018 11:12, vr roriz wrote:
> [..]
> 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?)

tcp_connect only uses TCP_WND to initialize snd_wnd to something. This
will get updated when receiving the first segment from the remote host
(SYN+ACK).

Does that answer all your questions?


Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Window Size relation with sending buffer (Tuning TCP article)

vr roriz
The tcp_connect part is clear. However I still dont understand:

"Window size (TCP_WND): 
[...]
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)"

What TCP_WND has to do with the amount of data to be buffered when transmitting?

Em qui, 15 de nov de 2018 às 11:33, [hidden email] <[hidden email]> escreveu:
On 15.11.2018 11:12, vr roriz wrote:
> [..]
> 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?)

tcp_connect only uses TCP_WND to initialize snd_wnd to something. This
will get updated when receiving the first segment from the remote host
(SYN+ACK).

Does that answer all your questions?


Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Window Size relation with sending buffer (Tuning TCP article)

goldsimon@gmx.de
On 15.11.2018 11:42, vr roriz wrote:

> The tcp_connect part is clear. However I still dont understand:
>
> "Window size (TCP_WND):
> [...]
> 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)"
>
> What TCP_WND has to do with the amount of data to be buffered when
> transmitting?

Yes, that's probably not correct...

Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users