11

I can manipulate such value with:

ip route change ... initcwnd 10

and then have a feedback with:

ip route show

But what about the default value before any modification? Is there a way to query that value from the system?

Alternatively, can you provide a valid reference that shows the default hardcoded value for each kernel version?

3 Answers 3

12
+50

I don't really know for sure, but this seems like a legit reference

Hunch:

$ grep -A 2 initcwnd `find /usr/src/linux/include -type f -iname '*h'`

out:

/usr/src/linux/include/net/tcp.h:
/* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */
#define TCP_INIT_CWND          10
1
  • Yes, grepping the code is always a good idea!
    – cYrus
    Mar 3, 2013 at 11:59
8

Well, I can't say I'm 100 % sure this should be the answer, buuut, as it often comes, ss is the good choice to get some info revealed, for e. g.:

 ss -nli|fgrep cwnd
     westwood rto:1000 mss:536 cwnd:10
     westwood rto:1000 mss:536 cwnd:10
     westwood rto:1000 mss:536 cwnd:10

-n is typical to get rid of annoying DNS resolving, -l is we stick to listening sockets only and -i (the key) is "Show internal TCP information". As it can be seen, both congestion algorithm and default cwnd are shown.

3

If I understood you correctly, you're looking for the initial value of the snd_cwnd parameter set when a TCP socket is initialized.

It looks like starting with linux kernel 2.6.39, a macro TCP_INIT_CWND has been introduced in linux/include/net/tcp.h which populates the value of snd_cwnd when initializing a TCP socket.

I know where this code is in the kernel for IPv4, and unfortunately it does not seem to use any macro to populate the value for kernels older than 2.6.39

/* net/ipv4/tcp_ipv4.c from 2.6.37 kernel */
static int tcp_v4_init_sock(struct sock *sk)
{
        struct inet_connection_sock *icsk = inet_csk(sk);
        struct tcp_sock *tp = tcp_sk(sk);

        ....
        ....
        ....

        /* So many TCP implementations out there (incorrectly) count the
         * initial SYN frame in their delayed-ACK and congestion control
         * algorithms that we must have the following bandaid to talk
         * efficiently to them.  -DaveM
         */
        tp->snd_cwnd = 2;

        ....
        ....
        ....
}

A similar init code exists for IPv6 as well inside tcp_v6_init_sock() function in net/ipv6/tcp_ipv6.c

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.