Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 7 down vote accepted
+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
share|improve this answer
    
Yes, grepping the code is always a good idea! – cYrus Mar 3 '13 at 11:59

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.

share|improve this answer

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

share|improve this answer
    
+1, that web site is pretty useful. – cYrus Mar 3 '13 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .