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