Reputation: 178
Here's my understanding of incoming data flow in TCP/IP
I'm a little bit confused about where does the sliding window locate, or is it the same as socket buffer
Upvotes: 6
Views: 10576
Reputation: 431
Linux does not handle TCP's sliding window as a separate buffer, rather as several indices indicating how much has already been received / read. The Linux kernel packet handling process can be described in many ways and can be divided to small parts as yo go deeper, but the general flow is as follows:
struct tcp_sock
member u32 rcv_wnd
which is then used in tp->rcvq_space.space
as the per-connection space left in window.tcp_recvmsg()
The important thing to remember here is that copies is the worst thing regarding performance. Therefore, the kernel will always (unless absolutely necessary) will avoid copies and use pointers instead.
Upvotes: 11