Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1115666imm; Wed, 1 Aug 2018 10:26:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeF8tw1f3zTobm4GCg0LR5i7b24MQxF1/YutOhiif0NaNEfIS4kyGMtW4MF5X7Xh0ej5yax X-Received: by 2002:a62:45d2:: with SMTP id n79-v6mr27600476pfi.137.1533144375075; Wed, 01 Aug 2018 10:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144375; cv=none; d=google.com; s=arc-20160816; b=zfKtg/8sEXbuYhM4kkI25E/3m7fkEg3JuqmQWOtFJrdVXsfLnkUerhhl6YS0rP0Oby sjsSEtFJcu7Tcqmtwi8IswaQFyJL/eaMFb2uOOggz0hP/6vNEoW9kfOymxQeaqk4Cs+S iMA292IS+B+xwfzBB0wOR20ueylGur338q6zAvcqJnaQakC1s9vyEsqjQ9bfYRKyhckt bY1XYx6iLeDWXAuZmCdOetTcDchOdDUefcSL1KKyN04eWJA02TDpwM0cIEVr5etibmIU F/jkPtEz24aA6KUzbyw6JeRclYA7+cfoEmgsDQRzS2Y0Ca93kCITw5idPq/aAtikW1+Z ANNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OUnJYXunYpKe+jfNx2FGdywl8QgVbgOr1bxjYgaQuDk=; b=gxicTfBwU+41i2YUInIU/mXwIG8Gc30dOEzO/evnXkC50NL7Q6SimNJdqbNzlX6q7/ O7uX7MPq3xHaZBMqOzryfch2HEA7+UJGAXcMWbeXAJXCFv2EtUopAwKql4+S+s5j/5Tm vZFTprH1x9slZocryyUaTqoGUG5nJ4NOmQhalO62V7TaQor4eajDfzJTdYj0anu4v/YX TwAOtMoS9+9PaqcxW9N7LlD8FYeJ0C9sIhUUpofKZyMLcbDwljXVWpuFsaeyDHo8itZY Kia5Q17eXfVZxUEe5F3LWUQhDjkulz+VWsh9W+4zp1MrF7qreYSzylRX0TA/UXTuSD0o Lisw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16-v6si14465634pgu.487.2018.08.01.10.26.00; Wed, 01 Aug 2018 10:26:15 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406496AbeHATKv (ORCPT + 99 others); Wed, 1 Aug 2018 15:10:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51080 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405484AbeHATKu (ORCPT ); Wed, 1 Aug 2018 15:10:50 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0C5E6CC3; Wed, 1 Aug 2018 17:24:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yousuk Seung , Neal Cardwell , Yuchung Cheng , Eric Dumazet , Soheil Hassas Yeganeh , "David S. Miller" Subject: [PATCH 4.14 245/246] tcp: refactor tcp_ecn_check_ce to remove sk type cast Date: Wed, 1 Aug 2018 18:52:35 +0200 Message-Id: <20180801165023.458898740@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yousuk Seung [ Upstream commit f4c9f85f3b2cb7669830cd04d0be61192a4d2436 ] Refactor tcp_ecn_check_ce and __tcp_ecn_check_ce to accept struct sock* instead of tcp_sock* to clean up type casts. This is a pure refactor patch. Signed-off-by: Yousuk Seung Signed-off-by: Neal Cardwell Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -250,8 +250,10 @@ static void tcp_ecn_withdraw_cwr(struct tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; } -static void __tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb) +static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) { + struct tcp_sock *tp = tcp_sk(sk); + switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) { case INET_ECN_NOT_ECT: /* Funny extension: if ECT is not set on a segment, @@ -259,31 +261,31 @@ static void __tcp_ecn_check_ce(struct tc * it is probably a retransmit. */ if (tp->ecn_flags & TCP_ECN_SEEN) - tcp_enter_quickack_mode((struct sock *)tp, 1); + tcp_enter_quickack_mode(sk, 1); break; case INET_ECN_CE: - if (tcp_ca_needs_ecn((struct sock *)tp)) - tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_IS_CE); + if (tcp_ca_needs_ecn(sk)) + tcp_ca_event(sk, CA_EVENT_ECN_IS_CE); if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) { /* Better not delay acks, sender can have a very low cwnd */ - tcp_enter_quickack_mode((struct sock *)tp, 1); + tcp_enter_quickack_mode(sk, 1); tp->ecn_flags |= TCP_ECN_DEMAND_CWR; } tp->ecn_flags |= TCP_ECN_SEEN; break; default: - if (tcp_ca_needs_ecn((struct sock *)tp)) - tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_NO_CE); + if (tcp_ca_needs_ecn(sk)) + tcp_ca_event(sk, CA_EVENT_ECN_NO_CE); tp->ecn_flags |= TCP_ECN_SEEN; break; } } -static void tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb) +static void tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) { - if (tp->ecn_flags & TCP_ECN_OK) - __tcp_ecn_check_ce(tp, skb); + if (tcp_sk(sk)->ecn_flags & TCP_ECN_OK) + __tcp_ecn_check_ce(sk, skb); } static void tcp_ecn_rcv_synack(struct tcp_sock *tp, const struct tcphdr *th) @@ -710,7 +712,7 @@ static void tcp_event_data_recv(struct s } icsk->icsk_ack.lrcvtime = now; - tcp_ecn_check_ce(tp, skb); + tcp_ecn_check_ce(sk, skb); if (skb->len >= 128) tcp_grow_window(sk, skb); @@ -4443,7 +4445,7 @@ static void tcp_data_queue_ofo(struct so u32 seq, end_seq; bool fragstolen; - tcp_ecn_check_ce(tp, skb); + tcp_ecn_check_ce(sk, skb); if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) { NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);