Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1154481imm; Wed, 18 Jul 2018 18:17:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfQlrVTyYwBeO6rb6itSJKWBVMQIonU/BzELwyUbzDTEP/+B6yHWrfLuoGTucSODpG6RhnS X-Received: by 2002:a62:2646:: with SMTP id m67-v6mr7518765pfm.254.1531963031560; Wed, 18 Jul 2018 18:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531963031; cv=none; d=google.com; s=arc-20160816; b=oZKNsp5HrDYqsoUatJLSnWfjNyla5nMUakoaaQkApBKZGs1jtiTxS8J9EeLRonUtj6 vtS49ggWeNHsxykNricoFi3rwFGHrzxANOkWzq68iNLajGEdS8GbZaAxtMpsArL2Hesd y+tXPKHKBO1DXApoK3V3TdhqFgowfbYeI3MPqAWvFdOvwq1ty4RfdTsnqkQalU7h80ut wyhRsBRmOwSe2F2iPqxdCt7gO+pGcggJvOMLWPkBnD9UkYNxMMKpzKJOHU2aFWY3VwkV e1MZtcxErDOqvwf3QW8KFU/wJr00R+V3xJnGDKcNVDquiA4fbOnPma0DChY4TlgdJWd4 XpLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=MYTRioSUhjVk7i1bOukYD6jQ9ixb9FQH+G1HinngLWg=; b=gOkzosqDTIjrSMsd9UmWeKtoAVtBctAICDrzckR6yqt55u7YTezXL0kzUzOKLNufy0 R/RltGCCcRNw+WRN1WdyqyxUeytc8TtC/+hRCC1aResnM1hhdYjiNJxxPqGtk4mL0W8z zW2V+pq7JLVd5M/TNZvWadFvwfEQ5IDpf5388tRlMg1nLh0YdkCCDTDOqbgxmbjD7Wof NIh+61ukAxbYullCtMf/fBQ3YCmk66seRm3fhbxm7jLsBFQV9ExnhvOGGIo62Tk177Oc F8Zo90Dy7AwlLS6TUwKYdRN7Ejmz9dxpdodr4f3durX3UuHmXuIvz6rSMgoDjbdAy2Gl bbhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o184-v6si4822506pga.520.2018.07.18.18.16.56; Wed, 18 Jul 2018 18:17:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731113AbeGSB4M (ORCPT + 99 others); Wed, 18 Jul 2018 21:56:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47426 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730094AbeGSB4L (ORCPT ); Wed, 18 Jul 2018 21:56:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 73E817262F; Thu, 19 Jul 2018 01:15:38 +0000 (UTC) Received: from 192-168-1-101.tpgi.com.com (vpn2-54-62.bne.redhat.com [10.64.54.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A811C2026D69; Thu, 19 Jul 2018 01:15:35 +0000 (UTC) From: Jon Maxwell To: davem@davemloft.net Cc: edumazet@google.com, ncardwell@google.com, David.Laight@aculab.com, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jmaxwell@redhat.com Subject: [PATCH V4 net-next 2/3] tcp: Add tcp_retransmit_stamp() helper routine Date: Thu, 19 Jul 2018 11:14:43 +1000 Message-Id: <20180719011444.4694-3-jmaxwell37@gmail.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 19 Jul 2018 01:15:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 19 Jul 2018 01:15:38 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jmaxwell37@gmail.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Create a seperate helper routine as per Neal Cardwells suggestion. To be used by the final commit in this series and retransmits_timed_out(). Signed-off-by: Jon Maxwell --- net/ipv4/tcp_timer.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index fa34984d0b12..d212f183dd2d 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -22,6 +22,20 @@ #include #include +u32 tcp_retransmit_stamp(const struct sock *sk) +{ + u32 start_ts = tcp_sk(sk)->retrans_stamp; + + if (unlikely(!start_ts)) { + struct sk_buff *head = tcp_rtx_queue_head(sk); + + if (!head) + return 0; + start_ts = tcp_skb_timestamp(head); + } + return start_ts; +} + /** * tcp_write_err() - close socket and save error info * @sk: The socket the error has appeared on. @@ -166,14 +180,9 @@ static bool retransmits_timed_out(struct sock *sk, if (!inet_csk(sk)->icsk_retransmits) return false; - start_ts = tcp_sk(sk)->retrans_stamp; - if (unlikely(!start_ts)) { - struct sk_buff *head = tcp_rtx_queue_head(sk); - - if (!head) - return false; - start_ts = tcp_skb_timestamp(head); - } + start_ts = tcp_retransmit_stamp(sk); + if (!start_ts) + return false; if (likely(timeout == 0)) { linear_backoff_thresh = ilog2(TCP_RTO_MAX/rto_base); -- 2.13.6