get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/810840/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 810840,
    "url": "http://patchwork.ozlabs.org/api/patches/810840/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1504753808-13266-1-git-send-email-yanhaishuang@cmss.chinamobile.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "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": "<1504753808-13266-1-git-send-email-yanhaishuang@cmss.chinamobile.com>",
    "list_archive_url": null,
    "date": "2017-09-07T03:10:08",
    "name": "ipv4: Namespaceify tcp_max_orphans knob",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": true,
    "hash": "493b78494b63b2bdc0b644f49bd75b7f4a25cd1a",
    "submitter": {
        "id": 68606,
        "url": "http://patchwork.ozlabs.org/api/people/68606/?format=api",
        "name": "Haishuang Yan",
        "email": "yanhaishuang@cmss.chinamobile.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1504753808-13266-1-git-send-email-yanhaishuang@cmss.chinamobile.com/mbox/",
    "series": [
        {
            "id": 1905,
            "url": "http://patchwork.ozlabs.org/api/series/1905/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1905",
            "date": "2017-09-07T03:10:08",
            "name": "ipv4: Namespaceify tcp_max_orphans knob",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1905/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/810840/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/810840/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>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xnlpB5q0Rz9s7C\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu,  7 Sep 2017 13:10:58 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753062AbdIGDKo (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 6 Sep 2017 23:10:44 -0400",
            "from cmccmta1.chinamobile.com ([221.176.66.79]:32157 \"EHLO\n\tcmccmta1.chinamobile.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751985AbdIGDKn (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 6 Sep 2017 23:10:43 -0400",
            "from spf.mail.chinamobile.com (unknown[172.16.121.17]) by\n\trmmx-syy-dmz-app04-12004 (RichMail) with SMTP id\n\t2ee459b0b8b00dc-991b9; Thu, 07 Sep 2017 11:10:40 +0800 (CST)",
            "from localhost (unknown[223.105.0.240])\n\tby rmsmtp-syy-appsvr09-12009 (RichMail) with SMTP id\n\t2ee959b0b8afb6c-c0717; Thu, 07 Sep 2017 11:10:39 +0800 (CST)"
        ],
        "X-RM-TRANSID": [
            "2ee459b0b8b00dc-991b9",
            "2ee959b0b8afb6c-c0717"
        ],
        "X-RM-SPAM-FLAG": "00000000",
        "From": "Haishuang Yan <yanhaishuang@cmss.chinamobile.com>",
        "To": "\"David S. Miller\" <davem@davemloft.net>,\n\tAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>,\n\tHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,\n\tEric Dumazet <edumazet@google.com>",
        "Cc": "netdev@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tHaishuang Yan <yanhaishuang@cmss.chinamobile.com>",
        "Subject": "[PATCH] ipv4: Namespaceify tcp_max_orphans knob",
        "Date": "Thu,  7 Sep 2017 11:10:08 +0800",
        "Message-Id": "<1504753808-13266-1-git-send-email-yanhaishuang@cmss.chinamobile.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "Different namespace application might require different maximal number\nof TCP sockets independently of the host.\n\nSigned-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>\n---\n include/net/netns/ipv4.h   |  1 +\n include/net/tcp.h          |  5 +++--\n net/ipv4/sysctl_net_ipv4.c | 14 +++++++-------\n net/ipv4/tcp.c             |  3 ---\n net/ipv4/tcp_input.c       |  1 -\n net/ipv4/tcp_ipv4.c        |  1 +\n 6 files changed, 12 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h\nindex 20d061c..305e031 100644\n--- a/include/net/netns/ipv4.h\n+++ b/include/net/netns/ipv4.h\n@@ -127,6 +127,7 @@ struct netns_ipv4 {\n \tint sysctl_tcp_timestamps;\n \tstruct inet_timewait_death_row tcp_death_row;\n \tint sysctl_max_syn_backlog;\n+\tint sysctl_tcp_max_orphans;\n \n #ifdef CONFIG_NET_L3_MASTER_DEV\n \tint sysctl_udp_l3mdev_accept;\ndiff --git a/include/net/tcp.h b/include/net/tcp.h\nindex b510f28..ac2d998 100644\n--- a/include/net/tcp.h\n+++ b/include/net/tcp.h\n@@ -320,10 +320,11 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)\n {\n \tstruct percpu_counter *ocp = sk->sk_prot->orphan_count;\n \tint orphans = percpu_counter_read_positive(ocp);\n+\tint tcp_max_orphans = sock_net(sk)->ipv4.sysctl_tcp_max_orphans;\n \n-\tif (orphans << shift > sysctl_tcp_max_orphans) {\n+\tif (orphans << shift > tcp_max_orphans) {\n \t\torphans = percpu_counter_sum_positive(ocp);\n-\t\tif (orphans << shift > sysctl_tcp_max_orphans)\n+\t\tif (orphans << shift > tcp_max_orphans)\n \t\t\treturn true;\n \t}\n \treturn false;\ndiff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c\nindex 0d3c038..4f26c8d3 100644\n--- a/net/ipv4/sysctl_net_ipv4.c\n+++ b/net/ipv4/sysctl_net_ipv4.c\n@@ -394,13 +394,6 @@ static int proc_tcp_available_ulp(struct ctl_table *ctl,\n \t\t.proc_handler\t= proc_dointvec\n \t},\n \t{\n-\t\t.procname\t= \"tcp_max_orphans\",\n-\t\t.data\t\t= &sysctl_tcp_max_orphans,\n-\t\t.maxlen\t\t= sizeof(int),\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_fastopen\",\n \t\t.data\t\t= &sysctl_tcp_fastopen,\n \t\t.maxlen\t\t= sizeof(int),\n@@ -1085,6 +1078,13 @@ static int proc_tcp_available_ulp(struct ctl_table *ctl,\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_max_orphans\",\n+\t\t.data\t\t= &init_net.ipv4.sysctl_tcp_max_orphans,\n+\t\t.maxlen\t\t= sizeof(int),\n+\t\t.mode\t\t= 0644,\n+\t\t.proc_handler\t= proc_dointvec\n+\t},\n #ifdef CONFIG_IP_ROUTE_MULTIPATH\n \t{\n \t\t.procname\t= \"fib_multipath_use_neigh\",\ndiff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c\nindex 5091402..39187ac 100644\n--- a/net/ipv4/tcp.c\n+++ b/net/ipv4/tcp.c\n@@ -3522,9 +3522,6 @@ void __init tcp_init(void)\n \t}\n \n \n-\tcnt = tcp_hashinfo.ehash_mask + 1;\n-\tsysctl_tcp_max_orphans = cnt / 2;\n-\n \ttcp_init_mem();\n \t/* Set per-socket limits to no more than 1/128 the pressure threshold */\n \tlimit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);\ndiff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c\nindex c5d7656..0230509 100644\n--- a/net/ipv4/tcp_input.c\n+++ b/net/ipv4/tcp_input.c\n@@ -88,7 +88,6 @@\n \n int sysctl_tcp_stdurg __read_mostly;\n int sysctl_tcp_rfc1337 __read_mostly;\n-int sysctl_tcp_max_orphans __read_mostly = NR_FILE;\n int sysctl_tcp_frto __read_mostly = 2;\n int sysctl_tcp_min_rtt_wlen __read_mostly = 300;\n int sysctl_tcp_moderate_rcvbuf __read_mostly = 1;\ndiff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c\nindex a63486a..4b17a91 100644\n--- a/net/ipv4/tcp_ipv4.c\n+++ b/net/ipv4/tcp_ipv4.c\n@@ -2468,6 +2468,7 @@ static int __net_init tcp_sk_init(struct net *net)\n \tnet->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo;\n \n \tnet->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256);\n+\tnet->ipv4.sysctl_tcp_max_orphans = cnt / 2;\n \tnet->ipv4.sysctl_tcp_sack = 1;\n \tnet->ipv4.sysctl_tcp_window_scaling = 1;\n \tnet->ipv4.sysctl_tcp_timestamps = 1;\n",
    "prefixes": []
}