获取Linux上TCP initcwnd的当前/默认值


9

我可以通过以下方式操纵这种价值:

ip route change ... initcwnd 10

然后通过以下方式获得反馈:

ip route show

但是修改之前的默认值呢?有没有办法从系统查询该值?

或者,您可以提供一个有效的参考来显示每个内核版本的默认硬编码值吗?

Answers:



6

好吧,我不能说我100%肯定这应该是答案,因为buuut通常是ss显示一些信息的好选择,例如:

 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通常摆脱烦人的DNS解析,-l是我们仅坚持侦听套接字,-i(关键)是“显示内部TCP信息”。可以看出,同时显示了拥塞算法和默认的cwnd。


2

如果我对您的理解正确,那么您正在寻找snd_cwnd初始化TCP套接字时参数集的初始值。

看起来从linux内核开始,在linux / include / net / tcp.h中引入了2.6.39一个宏,该宏在初始化TCP套接字时填充的值。TCP_INIT_CWNDsnd_cwnd

我知道此代码在的内核中的位置IPv4,但是不幸的是,它似乎没有使用任何宏来填充早于的内核的值。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;

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

IPv6在内部tcp_v6_init_sock()函数中也存在类似的初始化代码net/ipv6/tcp_ipv6.c

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.