From patchwork Fri Oct 18 23:20:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Chia-Yu Chang (Nokia)" X-Patchwork-Id: 13842500 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2048.outbound.protection.outlook.com [40.107.104.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0F671922E2 for ; Fri, 18 Oct 2024 23:20:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729293635; cv=fail; b=rfGsBXt67mEGvR7QhVxxYOKwY8/bIKLLGKugh4qX4aXxiV7xuySVOqKNkBJo42ZEs+TSLpU04CR+aTgVbCZ1LvOJqju0iVhzdeTgIa86n3D7I+k1hpWAOqbYPsozgNs5a/IqUJ1A9dSADKxxY8GPXroR+67KEXgOzpkYFB50YJA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729293635; c=relaxed/simple; bh=/jUnhM67qhllbqUJmPtYVGiT6TZs/a8KJ6py5OD7NWE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=m8jnsZI4snjtJPXIdqp21tIEa6j/q2ACpFv3NfA5v6j27bxtMYQAGnajkQIwKxU3y44yjCNqfd3vjRN+mBEwszsjsu6mCOHdJCK05m7ff/cNL93t7J0NcLe62XoDBqXK+l+tqswNSyr8JLenzAMkQBx6NdtGwOBgldib2WxSNiQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nokia-bell-labs.com; spf=fail smtp.mailfrom=nokia-bell-labs.com; dkim=pass (2048-bit key) header.d=nokia-bell-labs.com header.i=@nokia-bell-labs.com header.b=K5DCBuaj; arc=fail smtp.client-ip=40.107.104.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nokia-bell-labs.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nokia-bell-labs.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nokia-bell-labs.com header.i=@nokia-bell-labs.com header.b="K5DCBuaj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ESGxa0zpH3jfTtUYvdFkOn2wUz6IlUOzOSoQbo5FMoQ/jJRx1kwuyCCEylVGhXxWqN5iA3VS+v5wi7RRhoIRbm7cPLaXUDMqbqISoSYdiUFkF9bdMy8CW/9M0yjXZdjjhbyXASitgj8C2rFKhjS5tWE6f9fQEIdw6WbyrsRnFXyByFy9teYxqr6wK7+zXz0EjIZogLo9Vgg4FsyXhrrn8FW8JeaG6NzFkg57D873Idco16NmN2WgWR8KKsWkSbECJz0jvptsHDcD9thBuLkfAL9pErWqaGOuko2amq29Ar6P5haesTltgyMrhZmxtX1lodDOLaqWS3TkEpoNtZ4Vrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=06rvrvJvhApG7LYRr6bC4vZiKxPmT7OwntdkaM2HTEk=; b=jKRrfpcHST38ggUyq0EZNTI9KGy25ykcmz0Y4IOEW6/trDbVDksGtc2KZv7KZR3ty7MrfnQzRl/vGZvgxwBrnHKC2yj7L351KBZaH/YU628dPROhtyELc+Z5wVC5vxItHy8C5+P66pi1Cu66PtmA1+1vmPvQHsd9KhJ867oZUFvJE4PhYeSPJ+xqHli39RweLK+uLhYZEOcjXm7M22KgSGsmm+xe0+2g24Lt8ogW/7sEf3xnnarEcWS3VZp/u5XBxKAsIvKO9utlWySgKqvWSyMIEAFlvBXtLlnt/EK45E+3DPz2iKMiPIsDmv0ff9ZM7DMCPoxvpIfPINBU9X+cMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=temperror action=none header.from=nokia-bell-labs.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia-bell-labs.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=06rvrvJvhApG7LYRr6bC4vZiKxPmT7OwntdkaM2HTEk=; b=K5DCBuaj12av9WVV6dHiwalmYn2e2ev488x7Qe70gLS6w63IE5V61nPT9vF/sZLzuoMxaJUHYo7ZnlziELwIgP8XYgCDKSsFYr7fla6o4jfWy+ZxEAKtpw4R9POCEsgKV2jU20XL3fKiaXAo1AnC8q9OZGteLkiJwVZ2Q58GX21JIiLGMc1qJbRvVthD8AlZyQAHnIU0nKAchrVemK+XZRrIs2Y1QGO7Zw3hbuKzn23fmsdOV6kamFKWnwmkw0YlOBqnVlDs6sACVYDBUBWFq4tWXXkvF/fhlMZuLnMrdsqxPNugnhYJ/vTbpzqI1cKuo4peI3R6ctVd4fuTqKEotQ== Received: from AM8P190CA0010.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:219::15) by DB9PR07MB8728.eurprd07.prod.outlook.com (2603:10a6:10:30f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.20; Fri, 18 Oct 2024 23:20:30 +0000 Received: from AM3PEPF0000A79A.eurprd04.prod.outlook.com (2603:10a6:20b:219:cafe::53) by AM8P190CA0010.outlook.office365.com (2603:10a6:20b:219::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.23 via Frontend Transport; Fri, 18 Oct 2024 23:20:30 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=temperror action=none header.from=nokia-bell-labs.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of nokia-bell-labs.com: DNS Timeout) Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by AM3PEPF0000A79A.mail.protection.outlook.com (10.167.16.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Fri, 18 Oct 2024 23:20:28 +0000 Received: from sarah.nbl.nsn-rdnet.net (sarah.nbl.nsn-rdnet.net [10.0.73.150]) by fr711usmtp2.zeu.alcatel-lucent.com (GMO) with ESMTP id 49INKJJV010239; Fri, 18 Oct 2024 23:20:27 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, dsahern@kernel.org, ij@kernel.org, ncardwell@google.com, koen.de_schepper@nokia-bell-labs.com, g.white@CableLabs.com, ingemar.s.johansson@ericsson.com, mirja.kuehlewind@ericsson.com, cheshire@apple.com, rs.ietf@gmx.at, Jason_Livingood@comcast.com, vidhi_goel@apple.com Cc: Chia-Yu Chang Subject: [PATCH v3 net-next 06/14] tcp: rework {__,}tcp_ecn_check_ce() -> tcp_data_ecn_check() Date: Sat, 19 Oct 2024 01:20:09 +0200 Message-Id: <20241018232017.46833-7-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241018232017.46833-1-chia-yu.chang@nokia-bell-labs.com> References: <20241018232017.46833-1-chia-yu.chang@nokia-bell-labs.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM3PEPF0000A79A:EE_|DB9PR07MB8728:EE_ X-MS-Office365-Filtering-Correlation-Id: 95ffa877-193e-401c-c578-08dcefcb7470 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700013|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0cdyfl3tPkXksc4reVN5N1ZM9r7PNnI?= =?utf-8?q?xL8y28hLontZcJcCi2TdF4lOf2Fsvym6rQhFSRAHkXyiwYwS1HsiMdf0pJTD4Elny?= =?utf-8?q?IOiq2OqA8bGl+Hb7HLi/ogX8wKo0cxTorpsdI8iThlUnLrNudxQ0v53IQDbBW1D16?= =?utf-8?q?3+3vX0pZfTObyVCVjwbwo4d+AR/+wjytMO06/VySA9oPVCR6LFXFq8bltHsbbDdwq?= =?utf-8?q?/jDf+vA+vGWLrlyB3QjLmt/Q2r4XDGztM1ulGNsp5DPkY6lVH1P0ftIH7cQi9Ya9L?= =?utf-8?q?ljdBWhINvZGot+V9KeXLqt/41eVWggdsggzzrIxNsRGFV3WCcUHN9RkLF/cywZ+Rt?= =?utf-8?q?dogyzji2/llhE+LgRGxs6/Gq/7v/coUHv2P8MFhwRGsGa0e804mWTf+78RD7SKiK1?= =?utf-8?q?d8pTOUpo94s2xm+9BLLM5sk8RmK85FTL6XqaFUaktdyytO3o+hk/u6RDvMss9S63T?= =?utf-8?q?9OvxNvGBOv+QU8F0xdbXSkd2fZr/SUyCmWeXcr6BK52S/EWzjshYsGCp/LAFy7uuM?= =?utf-8?q?kstPgw6kFf/MSyAOpSfDO4F7btHJdzBuLWdC0Ix9ZzBfOlZt4Us3jXVDaWrl7BnvD?= =?utf-8?q?bnNhdwlu1sMUM/fC7TDJJ4RKJSg/jlQddlWiyvQ3CsWtxoWxOz3I8TZdHteAas/CM?= =?utf-8?q?oDsdJZNQ2oSfN1VR2LF4mLhxUAro4z+rGzPDpryAnmnGn4Bj/Dyjt2sXhAF3RZuWW?= =?utf-8?q?PF069pof2o39PTBdyerfsmVzjx0HquXpBhAV2Hl09Pc2X1EAMJmbyAmiFTKBZh9+X?= =?utf-8?q?w8WYTV8D+cEfRT6o3I5iJ0/doDzkDRjvyn5kREHDL1/E1q9w9joMFpr3NM95tdB8t?= =?utf-8?q?FoRVHUp90Nzap9CARw6bA/QJTIKu+p5n+Zn6GksxHbQ5nF8JLDpA72L4fPXBF37T6?= =?utf-8?q?uyiR888aovuevlkaKU7/novBAAhGXcZISkLgwo6KngTUs9wwj/a4qmRKNef5VrDol?= =?utf-8?q?7C0AqKdCQ0LtyfSrU57dJMqSjs4+3FhUgiM1NXAW5GJsGMkl38xUuEtTiLNnhLk4d?= =?utf-8?q?o0cUxuojQiex0z87VctKQbC5rDkzRVQ6u8Fcov1ogzwwEBe4U9TYjxnJ284gSRKWR?= =?utf-8?q?bHcSjhk66P89hBpkgMMB9J5USZZ88Ay39EydxZ0Xa186WB+wSfY0BPga2EeY37E9n?= =?utf-8?q?e0aRKGGKil3eDitbxSeeL4OEU/uWVs1+OMSv4RYQLPD5E4hUC4cuY6pr1MilL2yEU?= =?utf-8?q?s5gEbXWVOysr+yg/2CkYs+dOM7yLo7y5ohQHnfR7P9DcYbRHnuAB3ff/TFN9tTrha?= =?utf-8?q?OIW67yLQ/3F/pveupdUjJMzbjtawiOyFbhnURXfvUz9aHdekWK/r0+ttUYMl2j2X8?= =?utf-8?q?2Aos3mLXneY1AMCh87ejMgzAUNldHpsthHaq9iLdtKR05dEeb5JV5cs=3D?= X-Forefront-Antispam-Report: CIP:131.228.6.100;CTRY:FI;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:fr711usmtp2.zeu.alcatel-lucent.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(36860700013)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 23:20:28.9465 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95ffa877-193e-401c-c578-08dcefcb7470 X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0;Ip=[131.228.6.100];Helo=[fr711usmtp2.zeu.alcatel-lucent.com] X-MS-Exchange-CrossTenant-AuthSource: AM3PEPF0000A79A.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB8728 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen Rename tcp_ecn_check_ce to tcp_data_ecn_check as it is called only for data segments, not for ACKs (with AccECN, also ACKs may get ECN bits). The extra "layer" in tcp_ecn_check_ce() function just checks for ECN being enabled, that can be moved into tcp_ecn_field_check rather than having the __ variant. No functional changes. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang --- net/ipv4/tcp_input.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 7b8e69ccbbb0..7b4e7ed8cc52 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -357,10 +357,13 @@ static void tcp_ecn_withdraw_cwr(struct tcp_sock *tp) tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; } -static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) +static void tcp_data_ecn_check(struct sock *sk, const struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); + if (!(tcp_sk(sk)->ecn_flags & TCP_ECN_OK)) + return; + 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, @@ -389,12 +392,6 @@ static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) } } -static void tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *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) { if ((tp->ecn_flags & TCP_ECN_OK) && (!th->ece || th->cwr)) @@ -866,7 +863,7 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb) icsk->icsk_ack.lrcvtime = now; tcp_save_lrcv_flowlabel(sk, skb); - tcp_ecn_check_ce(sk, skb); + tcp_data_ecn_check(sk, skb); if (skb->len >= 128) tcp_grow_window(sk, skb, true); @@ -5028,7 +5025,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) bool fragstolen; tcp_save_lrcv_flowlabel(sk, skb); - tcp_ecn_check_ce(sk, skb); + tcp_data_ecn_check(sk, skb); if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) { NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);