On Sun, Apr 1, 2018 at 4:06 AM Naruto Nguyen <narutonguyen2...@gmail.com> wrote:
> Hello everyone, > As I know we have a socket option SO_TCP_NODELAY to disable Nagle > Algorithm, and I found it is implemented in TCP/IP stack at > https://elixir.bootlin.com/linux/v4.4.90/source/net/ipv4/tcp.c#L2401 . > However, I do not know where the source code the Nagle Algorithm is > implemented in kernel. If you know, could you please help me? The Linux TCP code for Nagle's algorithm is largely in tcp_output.c in the following functions: tcp_nagle_check(), tcp_minshall_check(), tcp_minshall_update() The variant of the Nagle algorithm that Linux implements is described here: https://tools.ietf.org/html/draft-minshall-nagle-00 Basically, the algorithm avoids having more than one outstanding unacknowledged packet that is less than one MSS in size. The Nagle algorithm is disabled using the TCP_NODELAY socket option. neal