{"id":811342,"url":"http://patchwork.ozlabs.org/api/patches/811342/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20170908070142.4440-2-daniel.axtens@canonical.com/","project":{"id":15,"url":"http://patchwork.ozlabs.org/api/projects/15/?format=json","name":"Ubuntu Kernel","link_name":"ubuntu-kernel","list_id":"kernel-team.lists.ubuntu.com","list_email":"kernel-team@lists.ubuntu.com","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170908070142.4440-2-daniel.axtens@canonical.com>","list_archive_url":null,"date":"2017-09-08T07:01:36","name":"[SRU,Xenial,1/7] sock: add sk_dst_pending_confirm flag","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"dc3a55bb302903d9a925c41c1c581db3714513db","submitter":{"id":71548,"url":"http://patchwork.ozlabs.org/api/people/71548/?format=json","name":"Daniel Axtens","email":"daniel.axtens@canonical.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20170908070142.4440-2-daniel.axtens@canonical.com/mbox/","series":[{"id":2112,"url":"http://patchwork.ozlabs.org/api/series/2112/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/list/?series=2112","date":"2017-09-08T07:01:35","name":"Fixes for LP#1715812","version":1,"mbox":"http://patchwork.ozlabs.org/series/2112/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811342/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811342/checks/","tags":{},"related":[],"headers":{"Return-Path":"<kernel-team-bounces@lists.ubuntu.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com\n\t(client-ip=91.189.94.19; helo=huckleberry.canonical.com;\n\tenvelope-from=kernel-team-bounces@lists.ubuntu.com;\n\treceiver=<UNKNOWN>)","Received":["from huckleberry.canonical.com (huckleberry.canonical.com\n\t[91.189.94.19])\n\tby ozlabs.org (Postfix) with ESMTP id 3xpStG2Qccz9sDB;\n\tFri,  8 Sep 2017 17:01:58 +1000 (AEST)","from localhost ([127.0.0.1] helo=huckleberry.canonical.com)\n\tby huckleberry.canonical.com with esmtp (Exim 4.86_2)\n\t(envelope-from <kernel-team-bounces@lists.ubuntu.com>)\n\tid 1dqDIZ-0001C8-IX; Fri, 08 Sep 2017 07:01:55 +0000","from youngberry.canonical.com ([91.189.89.112])\n\tby huckleberry.canonical.com with esmtps\n\t(TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.86_2) (envelope-from <daniel.axtens@canonical.com>)\n\tid 1dqDIX-0001BB-J0\n\tfor kernel-team@lists.canonical.com; Fri, 08 Sep 2017 07:01:53 +0000","from mail-pf0-f197.google.com ([209.85.192.197])\n\tby youngberry.canonical.com with esmtps\n\t(TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.76) (envelope-from <daniel.axtens@canonical.com>)\n\tid 1dqDIX-0003DM-7K\n\tfor kernel-team@lists.canonical.com; Fri, 08 Sep 2017 07:01:53 +0000","by mail-pf0-f197.google.com with SMTP id g13so3517978pfm.0\n\tfor <kernel-team@lists.canonical.com>;\n\tFri, 08 Sep 2017 00:01:53 -0700 (PDT)","from localhost.localdomain (124-171-202-56.dyn.iinet.net.au.\n\t[124.171.202.56]) by smtp.gmail.com with ESMTPSA id\n\th1sm2255518pfg.153.2017.09.08.00.01.49\n\tfor <kernel-team@lists.canonical.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 08 Sep 2017 00:01:50 -0700 (PDT)"],"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:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=3h5Nslc+TJ2Gs9qsKFsqnONND8ZQDkg5jmFuRrVH2w8=;\n\tb=kiDelvb1cpOpF5oIpUJ+JMl0pIX5ArDqaEOE0j2Svq3XqPIxLNLFFL+uSOYTOtxwG9\n\t1HihjwKZtdYXLttebG1UR8f0HFwV1LkJFnWjdTNCs4Z40fSHfg487kYrmsDHN7kMol3s\n\tImZte08Wrvpmy2177ntcXa4A6iaJF8iBVsEM/WceV1SUj+GF8ftLUcBIcnapMa1Eu3+0\n\tZ9GSXWo0LHglguEVP4mxlTkOPnEeuaUeeYkQqHP/dNSBSK8ihR34c6o0fApLNqQwgjV+\n\toriyZyVS3BIDdFi3TK/SUdV1x1le2hllYG7G8XvLcTJ7aqs1J2DA1+XYsvBQH45/cnGW\n\t95Bg==","X-Gm-Message-State":"AHPjjUhY37xE273Wm9KAn0mPDSe7BdCsy1Ww59k89I4z6ltDByNHmboh\n\t+EZ/xRnnIiEvrg05gQNxDF9xpwBLGZMFbrk1cnL0VeRFpZIkVNEROREWUzFcvMsEzgnX8ec60by\n\trqLYMbGo37Bu3A+1v/cFXiX4mEa61GH0FIHMmHRo=","X-Received":["by 10.98.77.70 with SMTP id a67mr2092261pfb.347.1504854111760;\n\tFri, 08 Sep 2017 00:01:51 -0700 (PDT)","by 10.98.77.70 with SMTP id a67mr2092247pfb.347.1504854111350;\n\tFri, 08 Sep 2017 00:01:51 -0700 (PDT)"],"X-Google-Smtp-Source":"ADKCNb4LnPLoqy4GGgbtBhcFK2/ugrCKxlmbtLCHyBQnfQb8MO3zh+9qQMw3NH/kkCZ8qx0JZQpN8w==","From":"Daniel Axtens <daniel.axtens@canonical.com>","To":"kernel-team@lists.canonical.com","Subject":"[SRU][Xenial][PATCH 1/7] sock: add sk_dst_pending_confirm flag","Date":"Fri,  8 Sep 2017 17:01:36 +1000","Message-Id":"<20170908070142.4440-2-daniel.axtens@canonical.com>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170908070142.4440-1-daniel.axtens@canonical.com>","References":"<20170908070142.4440-1-daniel.axtens@canonical.com>","X-BeenThere":"kernel-team@lists.ubuntu.com","X-Mailman-Version":"2.1.20","Precedence":"list","List-Id":"Kernel team discussions <kernel-team.lists.ubuntu.com>","List-Unsubscribe":"<https://lists.ubuntu.com/mailman/options/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=unsubscribe>","List-Archive":"<https://lists.ubuntu.com/archives/kernel-team>","List-Post":"<mailto:kernel-team@lists.ubuntu.com>","List-Help":"<mailto:kernel-team-request@lists.ubuntu.com?subject=help>","List-Subscribe":"<https://lists.ubuntu.com/mailman/listinfo/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"kernel-team-bounces@lists.ubuntu.com","Sender":"\"kernel-team\" <kernel-team-bounces@lists.ubuntu.com>"},"content":"From: Julian Anastasov <ja@ssi.bg>\n\nBugLink: https://bugs.launchpad.net/bugs/1715812\n\nAdd new sock flag to allow sockets to confirm neighbour.\nWhen same struct dst_entry can be used for many different\nneighbours we can not use it for pending confirmations.\nAs not all call paths lock the socket use full word for\nthe flag.\n\nAdd sk_dst_confirm as replacement for dst_confirm when\ncalled for received packets.\n\nSigned-off-by: Julian Anastasov <ja@ssi.bg>\nAcked-by: Eric Dumazet <edumazet@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>\n(backported from commit 9b8805a325591cf5b6b9df71200de25a2bd721fd)\nSigned-off-by: Daniel Axtens <daniel.axtens@canonical.com>\n---\n include/net/sock.h | 11 +++++++++++\n net/core/sock.c    |  2 ++\n 2 files changed, 13 insertions(+)","diff":"diff --git a/include/net/sock.h b/include/net/sock.h\nindex 3d5ff7436f41..08d2bb9e66ee 100644\n--- a/include/net/sock.h\n+++ b/include/net/sock.h\n@@ -254,6 +254,7 @@ struct cg_proto;\n   *\t@sk_wq: sock wait queue and async head\n   *\t@sk_rx_dst: receive input route used by early demux\n   *\t@sk_dst_cache: destination cache\n+  *\t@sk_dst_pending_confirm: need to confirm neighbour\n   *\t@sk_policy: flow policy\n   *\t@sk_receive_queue: incoming packets\n   *\t@sk_wmem_alloc: transmit queue bytes committed\n@@ -397,6 +398,7 @@ struct sock {\n \tatomic_t\t\tsk_omem_alloc;\n \tint\t\t\tsk_sndbuf;\n \tstruct sk_buff_head\tsk_write_queue;\n+\t__u32\t\t\tsk_dst_pending_confirm;\n \tkmemcheck_bitfield_begin(flags);\n \tunsigned int\t\tsk_shutdown  : 2,\n \t\t\t\tsk_no_check_tx : 1,\n@@ -1748,6 +1750,7 @@ static inline void dst_negative_advice(struct sock *sk)\n \t\tif (ndst != dst) {\n \t\t\trcu_assign_pointer(sk->sk_dst_cache, ndst);\n \t\t\tsk_tx_queue_clear(sk);\n+\t\t\tsk->sk_dst_pending_confirm = 0;\n \t\t}\n \t}\n }\n@@ -1758,6 +1761,7 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)\n \tstruct dst_entry *old_dst;\n \n \tsk_tx_queue_clear(sk);\n+\tsk->sk_dst_pending_confirm = 0;\n \t/*\n \t * This can be called while sk is owned by the caller only,\n \t * with no state that can be checked in a rcu_dereference_check() cond\n@@ -1773,6 +1777,7 @@ sk_dst_set(struct sock *sk, struct dst_entry *dst)\n \tstruct dst_entry *old_dst;\n \n \tsk_tx_queue_clear(sk);\n+\tsk->sk_dst_pending_confirm = 0;\n \told_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);\n \tdst_release(old_dst);\n }\n@@ -1793,6 +1798,12 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);\n \n struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);\n \n+static inline void sk_dst_confirm(struct sock *sk)\n+{\n+\tif (!sk->sk_dst_pending_confirm)\n+\t\tsk->sk_dst_pending_confirm = 1;\n+}\n+\n bool sk_mc_loop(struct sock *sk);\n \n static inline bool sk_can_gso(const struct sock *sk)\ndiff --git a/net/core/sock.c b/net/core/sock.c\nindex bd2fad27891e..6c890806868d 100644\n--- a/net/core/sock.c\n+++ b/net/core/sock.c\n@@ -532,6 +532,7 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie)\n \n \tif (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {\n \t\tsk_tx_queue_clear(sk);\n+\t\tsk->sk_dst_pending_confirm = 0;\n \t\tRCU_INIT_POINTER(sk->sk_dst_cache, NULL);\n \t\tdst_release(dst);\n \t\treturn NULL;\n@@ -1540,6 +1541,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)\n \t\t\t\taf_family_clock_key_strings[newsk->sk_family]);\n \n \t\tnewsk->sk_dst_cache\t= NULL;\n+\t\tnewsk->sk_dst_pending_confirm = 0;\n \t\tnewsk->sk_wmem_queued\t= 0;\n \t\tnewsk->sk_forward_alloc = 0;\n \t\tnewsk->sk_send_head\t= NULL;\n","prefixes":["SRU","Xenial","1/7"]}