Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 5 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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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