From patchwork Fri Sep 8 07:00:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 811337 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3xpSrn6ZB3z9s83; Fri, 8 Sep 2017 17:00:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1dqDHL-0000op-5s; Fri, 08 Sep 2017 07:00:39 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1dqDHK-0000nm-Bf for kernel-team@lists.canonical.com; Fri, 08 Sep 2017 07:00:38 +0000 Received: from mail-pg0-f71.google.com ([74.125.83.71]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dqDHJ-00039c-Uo for kernel-team@lists.canonical.com; Fri, 08 Sep 2017 07:00:38 +0000 Received: by mail-pg0-f71.google.com with SMTP id 11so3643407pge.4 for ; Fri, 08 Sep 2017 00:00:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=/QxdCQOt06IjsyPFIvjZf4WQRlzazDBZe/0+5Kcw9yA=; b=hb+Y4P1AUGom7GA1mmN+kWztLaW7eGiPIUsMQAMTbPD7wSmHUIVKDy/ixDpwR/Ge1q 7RZGuYkpzXBh7Uq2e5p1i76WJYJJmPOZ6x7NVmLJlqfvxyBCpnmikm4N8SkM0WAAiJFM VT8+vScYg82sm9Cd5qRgAfYHd42xUJ0K3achGTdxMu5zXfRmfKznrDhF8FxkuZFoJOVv RlSmOFQctJzVb7+oia8AawPHzSozFPmq7Bd20OVJh3NgtM4RgzxaNvfjqeN56nfn0bbh z9HSquDf3Bk5gf/1qdFyqdnWDGpgsjBJkm4i4lHqrFiwCdbkxAZn5tj+ieUaMknHthx9 m2Qg== X-Gm-Message-State: AHPjjUiV/nZ5Gjk+/VxHfFGiqwsN+omEpX+F2V6z5x6wqDKtkmKrpyPP fNBnLJV+ep6KDnr7UhKc9YK96ALd2AXxevdLxCBRXWXn/iAJ+M8azoyeTnKF2376lzijaCQQ4Lg kWacqRTBwvtLqNRMdVrbiRxmlB3JwrGTIK3id+QU= X-Received: by 10.84.129.193 with SMTP id b59mr2289810plb.121.1504854036506; Fri, 08 Sep 2017 00:00:36 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5wn7I8iAvIrMxUI4ez49YeXC8GX5qOGXpEhCXhQ9HBsBsDUkPaBddE4gSbJ/+JdE82OTsbeg== X-Received: by 10.84.129.193 with SMTP id b59mr2289790plb.121.1504854036265; Fri, 08 Sep 2017 00:00:36 -0700 (PDT) Received: from localhost.localdomain (124-171-202-56.dyn.iinet.net.au. [124.171.202.56]) by smtp.gmail.com with ESMTPSA id 125sm2138129pff.5.2017.09.08.00.00.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 00:00:35 -0700 (PDT) From: Daniel Axtens To: kernel-team@lists.canonical.com Subject: [SRU][Zesty][PATCH 4/7] tcp: replace dst_confirm with sk_dst_confirm Date: Fri, 8 Sep 2017 17:00:15 +1000 Message-Id: <20170908070018.4141-5-daniel.axtens@canonical.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170908070018.4141-1-daniel.axtens@canonical.com> References: <20170908070018.4141-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Julian Anastasov BugLink: https://bugs.launchpad.net/bugs/1715812 When same struct dst_entry can be used for many different neighbours we can not use it for pending confirmations. Use the new sk_dst_confirm() helper to propagate the indication from received packets to sock_confirm_neigh(). Reported-by: YueHaibing Fixes: 5110effee8fd ("net: Do delayed neigh confirmation.") Fixes: f2bb4bedf35d ("ipv4: Cache output routes in fib_info nexthops.") Tested-by: YueHaibing Signed-off-by: Julian Anastasov Acked-by: Eric Dumazet Signed-off-by: David S. Miller (cherry picked from commit c3a2e8370534f810cac6050169db0ed3e0f94f0b) Signed-off-by: Daniel Axtens --- net/ipv4/tcp_input.c | 12 +++--------- net/ipv4/tcp_metrics.c | 7 ++----- net/ipv4/tcp_output.c | 2 ++ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e7516efa99dc..f3ed7c2f9429 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3698,11 +3698,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) if (tp->tlp_high_seq) tcp_process_tlp_ack(sk, ack, flag); - if ((flag & FLAG_FORWARD_PROGRESS) || !(flag & FLAG_NOT_DUP)) { - struct dst_entry *dst = __sk_dst_get(sk); - if (dst) - dst_confirm(dst); - } + if ((flag & FLAG_FORWARD_PROGRESS) || !(flag & FLAG_NOT_DUP)) + sk_dst_confirm(sk); if (icsk->icsk_pending == ICSK_TIME_RETRANS) tcp_schedule_loss_probe(sk); @@ -6028,7 +6025,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) break; case TCP_FIN_WAIT1: { - struct dst_entry *dst; int tmo; /* If we enter the TCP_FIN_WAIT1 state and we are a @@ -6055,9 +6051,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) tcp_set_state(sk, TCP_FIN_WAIT2); sk->sk_shutdown |= SEND_SHUTDOWN; - dst = __sk_dst_get(sk); - if (dst) - dst_confirm(dst); + sk_dst_confirm(sk); if (!sock_flag(sk, SOCK_DEAD)) { /* Wake up lingering close() */ diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index ba8f02d0f283..077d7b7ba403 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c @@ -375,12 +375,10 @@ void tcp_update_metrics(struct sock *sk) u32 val; int m; + sk_dst_confirm(sk); if (sysctl_tcp_nometrics_save || !dst) return; - if (dst->flags & DST_HOST) - dst_confirm(dst); - rcu_read_lock(); if (icsk->icsk_backoff || !tp->srtt_us) { /* This session failed to estimate rtt. Why? @@ -493,11 +491,10 @@ void tcp_init_metrics(struct sock *sk) struct tcp_metrics_block *tm; u32 val, crtt = 0; /* cached RTT scaled by 8 */ + sk_dst_confirm(sk); if (!dst) goto reset; - dst_confirm(dst); - rcu_read_lock(); tm = tcp_get_metrics(sk, dst, true); if (!tm) { diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index b7236ad4d832..4c49283900b6 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -975,6 +975,8 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, skb_set_hash_from_sk(skb, sk); atomic_add(skb->truesize, &sk->sk_wmem_alloc); + skb_set_dst_pending_confirm(skb, sk->sk_dst_pending_confirm); + /* Build TCP header and checksum it. */ th = (struct tcphdr *)skb->data; th->source = inet->inet_sport;