{"id":830992,"url":"http://patchwork.ozlabs.org/api/1.2/patches/830992/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20171026233526.6155-15-edumazet@google.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171026233526.6155-15-edumazet@google.com>","list_archive_url":null,"date":"2017-10-26T23:35:25","name":"[net-next,14/15] tcp: Namespace-ify sysctl_tcp_adv_win_scale","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"213be457fe48a1c7b16538f045aaa5af6a2a11e4","submitter":{"id":13357,"url":"http://patchwork.ozlabs.org/api/1.2/people/13357/?format=json","name":"Eric Dumazet","email":"edumazet@google.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20171026233526.6155-15-edumazet@google.com/mbox/","series":[{"id":10461,"url":"http://patchwork.ozlabs.org/api/1.2/series/10461/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=10461","date":"2017-10-26T23:35:11","name":"tcp: move 14 sysctls to namespaces","version":1,"mbox":"http://patchwork.ozlabs.org/series/10461/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/830992/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/830992/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"mE3ZYQta\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yNNgK3CH5z9t2d\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 27 Oct 2017 10:36:13 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932493AbdJZXgL (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 26 Oct 2017 19:36:11 -0400","from mail-pf0-f195.google.com ([209.85.192.195]:47979 \"EHLO\n\tmail-pf0-f195.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S932470AbdJZXgF (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 26 Oct 2017 19:36:05 -0400","by mail-pf0-f195.google.com with SMTP id z11so3614568pfk.4\n\tfor <netdev@vger.kernel.org>; Thu, 26 Oct 2017 16:36:05 -0700 (PDT)","from localhost ([2620:15c:2c4:201:c5be:583d:61a8:d070])\n\tby smtp.gmail.com with ESMTPSA id\n\th77sm12371535pfj.38.2017.10.26.16.36.03\n\t(version=TLS1_2 cipher=AES128-SHA bits=128/128);\n\tThu, 26 Oct 2017 16:36:04 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=google.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=mMTECD0u5OMLEFDv8O0R0NaOn58pIjU2mJj81le6BEA=;\n\tb=mE3ZYQta+eloABUH4Jf8WIK/vg6KFH4d2tbzTw8nlxUnkM6f3JvZdph9kiAt7b0Dhe\n\tR6Lqr1eUjzWcRZBv+48PR4ps5ggZa91Y/25CvdpkqQwZDw8VMasktjkCdQBNvSm5hko8\n\tO64X4JNuBWBmyvlW+rM1LrzxajQHSIfW+nYNb8uIxN/zzVBP34oaok7/MOg5SRcYGIe5\n\tUzrVDtsgN14asybnZbxFPX9qUDgQRRu+SPXoyH2ld29rbNClgjkH055MCc6dkvN4gqQ3\n\teJqgfW7kYX6af+CN4Udbj/RF5RkNJb4BVPJN/4sKKrILTP4CmkKdg8glCknX0715/bR3\n\tfAYw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=mMTECD0u5OMLEFDv8O0R0NaOn58pIjU2mJj81le6BEA=;\n\tb=EpCSoexKn3AS+ryiEdRT7WPWAfvxa7pG7fuQnw2B+wES08r2Raun22A1P3dc4c2Y0Y\n\tEoZPJ6JHkbIbF8PtonS5GzU4or9z805V2QRGx712R5qOQvwxXElaercZu9yC+XofcHRo\n\tJpGXoJ/eF7Bkn8J/lrmyif6A9CR6Xczxh2n0wdedRqR+cdfUmFD2Z5jaW2fMeo0K5mKV\n\tLDWoG3bodmPn42FoB54D7X/O3TWV/jQV+hnVKh+kQbOzULo4Vk4SUzSjhvd15muvTD3f\n\tNSEQpE5plArv24STPAcenK8d9yIkPnWav0Rs03ijO2Qdcn1GbZe8db13GJhICrAxv4s9\n\tOQ7g==","X-Gm-Message-State":"AMCzsaUwKHn3cILmL13iUWgBg6WWhEiQ6+BGd8xnb33Ihv7GVKvXv718\n\tekhBY3hpZ7Viv2d6yPrSYH+FMA==","X-Google-Smtp-Source":"ABhQp+RVdo0lXk6Gh9uy7IF+5fc7Zx7Ig6wxxQXolL5HT9yYO+KFZrzuKnmfDOkK8tGnNDNzXBsMHw==","X-Received":"by 10.159.218.67 with SMTP id x3mr5752856plv.1.1509060964480;\n\tThu, 26 Oct 2017 16:36:04 -0700 (PDT)","From":"Eric Dumazet <edumazet@google.com>","To":"\"David S . Miller\" <davem@davemloft.net>","Cc":"netdev <netdev@vger.kernel.org>, Eric Dumazet <edumazet@google.com>,\n\tEric Dumazet <eric.dumazet@gmail.com>","Subject":"[PATCH net-next 14/15] tcp: Namespace-ify sysctl_tcp_adv_win_scale","Date":"Thu, 26 Oct 2017 16:35:25 -0700","Message-Id":"<20171026233526.6155-15-edumazet@google.com>","X-Mailer":"git-send-email 2.15.0.rc2.357.g7e34df9404-goog","In-Reply-To":"<20171026233526.6155-1-edumazet@google.com>","References":"<20171026233526.6155-1-edumazet@google.com>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Signed-off-by: Eric Dumazet <edumazet@google.com>\n---\n include/net/netns/ipv4.h   |  1 +\n include/net/tcp.h          |  9 ++++-----\n net/ipv4/sysctl_net_ipv4.c | 18 +++++++++---------\n net/ipv4/tcp_input.c       | 13 +++++--------\n net/ipv4/tcp_ipv4.c        |  1 +\n 5 files changed, 20 insertions(+), 22 deletions(-)","diff":"diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h\nindex 63f91d52cbc0ad35d8e04a8da0d9f57aa960bcb0..9dbb07d4eff465428817831e55c6a4922b7208fb 100644\n--- a/include/net/netns/ipv4.h\n+++ b/include/net/netns/ipv4.h\n@@ -140,6 +140,7 @@ struct netns_ipv4 {\n \tint sysctl_tcp_max_reordering;\n \tint sysctl_tcp_dsack;\n \tint sysctl_tcp_app_win;\n+\tint sysctl_tcp_adv_win_scale;\n \tstruct inet_timewait_death_row tcp_death_row;\n \tint sysctl_max_syn_backlog;\n \tint sysctl_tcp_fastopen;\ndiff --git a/include/net/tcp.h b/include/net/tcp.h\nindex c6bee85a3dec0dea6d4402d89184ade02a637a2e..2572b57682987dd5f3700ed47d63e7238946b9a8 100644\n--- a/include/net/tcp.h\n+++ b/include/net/tcp.h\n@@ -244,7 +244,6 @@ extern int sysctl_tcp_max_orphans;\n extern long sysctl_tcp_mem[3];\n extern int sysctl_tcp_wmem[3];\n extern int sysctl_tcp_rmem[3];\n-extern int sysctl_tcp_adv_win_scale;\n extern int sysctl_tcp_frto;\n extern int sysctl_tcp_nometrics_save;\n extern int sysctl_tcp_moderate_rcvbuf;\n@@ -1308,9 +1307,9 @@ void tcp_select_initial_window(int __space, __u32 mss, __u32 *rcv_wnd,\n \t\t\t       __u32 *window_clamp, int wscale_ok,\n \t\t\t       __u8 *rcv_wscale, __u32 init_rcv_wnd);\n \n-static inline int tcp_win_from_space(int space)\n+static inline int tcp_win_from_space(const struct sock *sk, int space)\n {\n-\tint tcp_adv_win_scale = sysctl_tcp_adv_win_scale;\n+\tint tcp_adv_win_scale = sock_net(sk)->ipv4.sysctl_tcp_adv_win_scale;\n \n \treturn tcp_adv_win_scale <= 0 ?\n \t\t(space>>(-tcp_adv_win_scale)) :\n@@ -1320,13 +1319,13 @@ static inline int tcp_win_from_space(int space)\n /* Note: caller must be prepared to deal with negative returns */\n static inline int tcp_space(const struct sock *sk)\n {\n-\treturn tcp_win_from_space(sk->sk_rcvbuf -\n+\treturn tcp_win_from_space(sk, sk->sk_rcvbuf -\n \t\t\t\t  atomic_read(&sk->sk_rmem_alloc));\n }\n \n static inline int tcp_full_space(const struct sock *sk)\n {\n-\treturn tcp_win_from_space(sk->sk_rcvbuf);\n+\treturn tcp_win_from_space(sk, sk->sk_rcvbuf);\n }\n \n extern void tcp_openreq_init_rwin(struct request_sock *req,\ndiff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c\nindex e057788834a99cf99e141a602ddbe19b8e6fce3c..a95123e1e7da706c88bf5553b7d8ef6c2653ab50 100644\n--- a/net/ipv4/sysctl_net_ipv4.c\n+++ b/net/ipv4/sysctl_net_ipv4.c\n@@ -437,15 +437,6 @@ static struct ctl_table ipv4_table[] = {\n \t\t.proc_handler\t= proc_dointvec_minmax,\n \t\t.extra1\t\t= &one,\n \t},\n-\t{\n-\t\t.procname\t= \"tcp_adv_win_scale\",\n-\t\t.data\t\t= &sysctl_tcp_adv_win_scale,\n-\t\t.maxlen\t\t= sizeof(int),\n-\t\t.mode\t\t= 0644,\n-\t\t.proc_handler\t= proc_dointvec_minmax,\n-\t\t.extra1\t\t= &tcp_adv_win_scale_min,\n-\t\t.extra2\t\t= &tcp_adv_win_scale_max,\n-\t},\n \t{\n \t\t.procname\t= \"tcp_frto\",\n \t\t.data\t\t= &sysctl_tcp_frto,\n@@ -1145,6 +1136,15 @@ static struct ctl_table ipv4_net_table[] = {\n \t\t.mode\t\t= 0644,\n \t\t.proc_handler\t= proc_dointvec\n \t},\n+\t{\n+\t\t.procname\t= \"tcp_adv_win_scale\",\n+\t\t.data\t\t= &init_net.ipv4.sysctl_tcp_adv_win_scale,\n+\t\t.maxlen\t\t= sizeof(int),\n+\t\t.mode\t\t= 0644,\n+\t\t.proc_handler\t= proc_dointvec_minmax,\n+\t\t.extra1\t\t= &tcp_adv_win_scale_min,\n+\t\t.extra2\t\t= &tcp_adv_win_scale_max,\n+\t},\n \t{ }\n };\n \ndiff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c\nindex 06a8c27e1a690e3b26cb6773320bafa31b06d3b3..d01f390da23dcd4100271b150bd8bc143f7328cf 100644\n--- a/net/ipv4/tcp_input.c\n+++ b/net/ipv4/tcp_input.c\n@@ -77,9 +77,6 @@\n #include <linux/errqueue.h>\n #include <trace/events/tcp.h>\n \n-int sysctl_tcp_adv_win_scale __read_mostly = 1;\n-EXPORT_SYMBOL(sysctl_tcp_adv_win_scale);\n-\n /* rfc5961 challenge ack rate limiting */\n int sysctl_tcp_challenge_ack_limit = 1000;\n \n@@ -361,8 +358,8 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb)\n {\n \tstruct tcp_sock *tp = tcp_sk(sk);\n \t/* Optimize this! */\n-\tint truesize = tcp_win_from_space(skb->truesize) >> 1;\n-\tint window = tcp_win_from_space(sysctl_tcp_rmem[2]) >> 1;\n+\tint truesize = tcp_win_from_space(sk, skb->truesize) >> 1;\n+\tint window = tcp_win_from_space(sk, sysctl_tcp_rmem[2]) >> 1;\n \n \twhile (tp->rcv_ssthresh <= window) {\n \t\tif (truesize <= skb->len)\n@@ -387,7 +384,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)\n \t\t/* Check #2. Increase window, if skb with such overhead\n \t\t * will fit to rcvbuf in future.\n \t\t */\n-\t\tif (tcp_win_from_space(skb->truesize) <= skb->len)\n+\t\tif (tcp_win_from_space(sk, skb->truesize) <= skb->len)\n \t\t\tincr = 2 * tp->advmss;\n \t\telse\n \t\t\tincr = __tcp_grow_window(sk, skb);\n@@ -628,7 +625,7 @@ void tcp_rcv_space_adjust(struct sock *sk)\n \t\t}\n \n \t\trcvmem = SKB_TRUESIZE(tp->advmss + MAX_TCP_HEADER);\n-\t\twhile (tcp_win_from_space(rcvmem) < tp->advmss)\n+\t\twhile (tcp_win_from_space(sk, rcvmem) < tp->advmss)\n \t\t\trcvmem += 128;\n \n \t\trcvbuf = min(rcvwin / tp->advmss * rcvmem, sysctl_tcp_rmem[2]);\n@@ -4789,7 +4786,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, struct rb_root *root,\n \t\t *   overlaps to the next one.\n \t\t */\n \t\tif (!(TCP_SKB_CB(skb)->tcp_flags & (TCPHDR_SYN | TCPHDR_FIN)) &&\n-\t\t    (tcp_win_from_space(skb->truesize) > skb->len ||\n+\t\t    (tcp_win_from_space(sk, skb->truesize) > skb->len ||\n \t\t     before(TCP_SKB_CB(skb)->seq, start))) {\n \t\t\tend_of_skbs = false;\n \t\t\tbreak;\ndiff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c\nindex 189664ebd28e4cda7ef40a47591c3bd8cac3574b..1fe30fb99308b3e3fd07509b509b0e3727cc5d44 100644\n--- a/net/ipv4/tcp_ipv4.c\n+++ b/net/ipv4/tcp_ipv4.c\n@@ -2491,6 +2491,7 @@ static int __net_init tcp_sk_init(struct net *net)\n \tnet->ipv4.sysctl_tcp_max_reordering = 300;\n \tnet->ipv4.sysctl_tcp_dsack = 1;\n \tnet->ipv4.sysctl_tcp_app_win = 31;\n+\tnet->ipv4.sysctl_tcp_adv_win_scale = 1;\n \n \tnet->ipv4.sysctl_tcp_fastopen = TFO_CLIENT_ENABLE;\n \tspin_lock_init(&net->ipv4.tcp_fastopen_ctx_lock);\n","prefixes":["net-next","14/15"]}