From patchwork Fri Sep 25 17:04:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuchung Cheng X-Patchwork-Id: 260201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEAE1C4727E for ; Fri, 25 Sep 2020 17:04:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AFC520936 for ; Fri, 25 Sep 2020 17:04:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="b8q+0D8d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729601AbgIYREm (ORCPT ); Fri, 25 Sep 2020 13:04:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729477AbgIYREl (ORCPT ); Fri, 25 Sep 2020 13:04:41 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1416C0613CE for ; Fri, 25 Sep 2020 10:04:41 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id a7so3174009ybq.22 for ; Fri, 25 Sep 2020 10:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=LkYOVOnkUnJHYHdTID+eAr4bWSUFNO12flF0Na+m7x0=; b=b8q+0D8d+g44dssqMdOkSSe3XqYzHSd1Uwl3Np2suBitB6gk69Q/x2jGCbyq58t5MU TkN88j6QIP3ePHIvu+1mOFm54+cIpUSNPFEmNW9z/IJgbkJ11vm+B1Lv+1ek53QTntHb SoqrwQIMtOcBPgco6TTxrS0auaNSb3kSzyL4r01PYyQb3tg8BAFOeQ4cH2jshDRIpBJQ 6fniEplUzeQIt9lZEdrwpS4Y8/v3YE7U2c1pqjyLuW5pdwzwJcDuJrlqzvw4FC2Gyv88 4DcpqKwjkfjqV5Xf1fyIO7xz5GjuBUzcgJ51rdI6muB5Uq74c23612DINUI+rRQDds5u AVGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=LkYOVOnkUnJHYHdTID+eAr4bWSUFNO12flF0Na+m7x0=; b=eIJUhnpHlWmtpSN0c/4rCMi+v55q+hpPvQyQCQT37rPFXT4UkW52vO1/hA/WHE5xrC H5Y6CqLeEISj+6H7SZh2OZzlIPFTQa1FvjRk6FroCKixsufiC+ccvKystngBJdhBQ/KC cjqyVzHponwRgQzFx2KGsYyVknHeErR91pMbOrwhcSkM7woSCVOabWvt+vuSKJSTC5AD p0Y2qpQd4RD2IAqkL326HkClsABEgRiaRe+2QZ04ZBNgRGggBAUqiZv0f/on21Q2P6cV JJ41rtoCl1ys/X/AncLmce8U0EkIf7fVKDshmd3PXFmVSTsR9JGZ0R6ngAXL+8uP1OLU xJlw== X-Gm-Message-State: AOAM530fsqyODwlA4jPXrCpyu1Fzq6b9XNbIh6Rw/nLA/nEjNnKBIHV2 aws3PGRkp7y3eyqssHsknD3yBr5+HgI= X-Google-Smtp-Source: ABdhPJwBmRW/gQgEZGW8y32Dcl+FcdlQILWKm/b4/560KBBfczyXsT3+3R5SjR2rHnLJQ+GLXfgB7H4zp1A= Sender: "ycheng via sendgmr" X-Received: from ycheng.svl.corp.google.com ([2620:15c:2c4:201:f693:9fff:fef4:fc76]) (user=ycheng job=sendgmr) by 2002:a25:3752:: with SMTP id e79mr242593yba.154.1601053480883; Fri, 25 Sep 2020 10:04:40 -0700 (PDT) Date: Fri, 25 Sep 2020 10:04:29 -0700 In-Reply-To: <20200925170431.1099943-1-ycheng@google.com> Message-Id: <20200925170431.1099943-3-ycheng@google.com> Mime-Version: 1.0 References: <20200925170431.1099943-1-ycheng@google.com> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH net-next 2/4] tcp: move tcp_mark_skb_lost From: Yuchung Cheng To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, ncardwell@google.com, Yuchung Cheng Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org A pure refactor to move tcp_mark_skb_lost to tcp_input.c to prepare for the later loss marking consolidation. Signed-off-by: Yuchung Cheng Signed-off-by: Neal Cardwell Signed-off-by: Eric Dumazet --- net/ipv4/tcp_input.c | 14 ++++++++++++++ net/ipv4/tcp_recovery.c | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index f84420dc7d37..0f8d33b95678 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1016,6 +1016,20 @@ static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb) tp->retransmit_skb_hint = skb; } +void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb) +{ + struct tcp_sock *tp = tcp_sk(sk); + + tcp_skb_mark_lost_uncond_verify(tp, skb); + if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS) { + /* Account for retransmits that are lost again */ + TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; + tp->retrans_out -= tcp_skb_pcount(skb); + NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPLOSTRETRANSMIT, + tcp_skb_pcount(skb)); + } +} + /* Sum the number of packets on the wire we have marked as lost. * There are two cases we care about here: * a) Packet hasn't been marked lost (nor retransmitted), diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c index 26a42289a870..f65a3ddd0d58 100644 --- a/net/ipv4/tcp_recovery.c +++ b/net/ipv4/tcp_recovery.c @@ -2,20 +2,6 @@ #include #include -void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb) -{ - struct tcp_sock *tp = tcp_sk(sk); - - tcp_skb_mark_lost_uncond_verify(tp, skb); - if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS) { - /* Account for retransmits that are lost again */ - TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; - tp->retrans_out -= tcp_skb_pcount(skb); - NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPLOSTRETRANSMIT, - tcp_skb_pcount(skb)); - } -} - static bool tcp_rack_sent_after(u64 t1, u64 t2, u32 seq1, u32 seq2) { return t1 > t2 || (t1 == t2 && after(seq1, seq2)); From patchwork Fri Sep 25 17:04:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuchung Cheng X-Patchwork-Id: 260200 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39D80C4727F for ; Fri, 25 Sep 2020 17:04:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE5C720936 for ; Fri, 25 Sep 2020 17:04:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XbNRFdY7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729619AbgIYREr (ORCPT ); Fri, 25 Sep 2020 13:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729477AbgIYREq (ORCPT ); Fri, 25 Sep 2020 13:04:46 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75F6C0613CE for ; Fri, 25 Sep 2020 10:04:45 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id 60so2449238qtf.21 for ; Fri, 25 Sep 2020 10:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=436BrWsA80ToWEcQPbIaaI07QH/vu1GtRZGSncsEHfo=; b=XbNRFdY7cUlooqt16QcAeXZNH0gRhxZa1flvmCPTD2uFKGyLClcNBEf7UR7f1ROcek A99nelMz17uc53pebhzB3Wdee+LA5OnAMo3bUUmGqi4evVIyrfUwe+IY3x4szegi7I3i dO8HaqbhlppIOc4QSkTPn/8GZYoXgHyQ3DAayna2GaK4HvZ5+VyN5NHkDpy0/zmemntL CNbvKUt8s19YceEdj958vFRfLxAZIB8mW8vTgL8qi9fOyAsiR5i1RskdBwEwmdAvQbie lYhasBWOaidan4+v8GW2BNb13etWBnvz6Ahrxo7lBnft3X84MTnNtekAtRxQQwIbyYaf sBoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=436BrWsA80ToWEcQPbIaaI07QH/vu1GtRZGSncsEHfo=; b=EVxK3NUpSJI69/xDpevaQVsW2WylGfCahk6fUQMYtxoGBHNnwjY0Aezw0Yn2W0/OmZ g2a3OrvJZXLqdbKSR/4fci484ij8BoFS+/cliFfgKFBVCxhzb/wn1+Z3Ml1WHOY2xj17 WdLBNl8xMaP6Mo1tSv8sOOvrN5Ebj7DNglZfnQYrfqx7crWLnfy3/CArQ4htm10mfOP7 88Q/gKeK+1UjS/GUNHmD1yr5a9yiyngKjNJ7x5WuMDGF1JTTI1I2HN7P0Jlwkul2uu+s BlqsIMC+NLok7iWQXMX0n8TdqFWlllyqFN8O/d0dFzvlx48d15C4aeq3kAGSoEdAEwbo YT7w== X-Gm-Message-State: AOAM531pCLOe4NQbNZNtE/4g5SXTXZBe3SKaSALF5ajdIkIOOYqD1k2/ znfa4fvZGX3LM+dXR1qek2YlMwRzdvM= X-Google-Smtp-Source: ABdhPJyuPPbpUMwqX3IPQEiYAEuICvKIbNVAwXhb6e7wvZqFKIjr5FMU0tPLFewJcXvt5dtcht3UwKM1Y2g= Sender: "ycheng via sendgmr" X-Received: from ycheng.svl.corp.google.com ([2620:15c:2c4:201:f693:9fff:fef4:fc76]) (user=ycheng job=sendgmr) by 2002:a0c:8001:: with SMTP id 1mr267593qva.21.1601053484679; Fri, 25 Sep 2020 10:04:44 -0700 (PDT) Date: Fri, 25 Sep 2020 10:04:31 -0700 In-Reply-To: <20200925170431.1099943-1-ycheng@google.com> Message-Id: <20200925170431.1099943-5-ycheng@google.com> Mime-Version: 1.0 References: <20200925170431.1099943-1-ycheng@google.com> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH net-next 4/4] tcp: consolidate tcp_mark_skb_lost and tcp_skb_mark_lost From: Yuchung Cheng To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, ncardwell@google.com, Yuchung Cheng Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org tcp_skb_mark_lost is used by RFC6675-SACK and can easily be replaced with the new tcp_mark_skb_lost handler. Signed-off-by: Yuchung Cheng Signed-off-by: Neal Cardwell Signed-off-by: Eric Dumazet --- net/ipv4/tcp_input.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 9be41b69a75b..2ebfe87210f7 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1043,17 +1043,6 @@ void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb) } } -static void tcp_skb_mark_lost(struct tcp_sock *tp, struct sk_buff *skb) -{ - if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_LOST|TCPCB_SACKED_ACKED))) { - tcp_verify_retransmit_hint(tp, skb); - - tp->lost_out += tcp_skb_pcount(skb); - tcp_sum_lost(tp, skb); - TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; - } -} - /* Updates the delivered and delivered_ce counts */ static void tcp_count_delivered(struct tcp_sock *tp, u32 delivered, bool ece_ack) @@ -2308,7 +2297,8 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int mark_head) if (cnt > packets) break; - tcp_skb_mark_lost(tp, skb); + if (!(TCP_SKB_CB(skb)->sacked & TCPCB_LOST)) + tcp_mark_skb_lost(sk, skb); if (mark_head) break;