From patchwork Fri Dec 27 19:11:58 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: 13922094 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2046.outbound.protection.outlook.com [40.107.241.46]) (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 DBFE11F8ADF; Fri, 27 Dec 2024 19:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326768; cv=fail; b=uvaGK+vcCUEMcnqCeP6FfFhvqOmUqrXkFTDBDKLZEcP/KmN1Nv9attRBo/qDHAeoVPpIAxfleVkQczM/7LFoRTrYeipGqe1xZfFj9w0/KrzhVZlDYCT/clpZlMKWFoi3otJvI6Nhfhk/ZhiG4eIxSJEEa4qbpZCbjAdVfBaolhQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326768; c=relaxed/simple; bh=Oojgx23HQNPxXraR47CSiOn/RxhutAcAv3i6TmQT2Bg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=PIpcvND8EBaV+COgvmtWl502abpe2ccI9q4BW2U8WsPTJg3hNjdTfgjhg4INyqsJ1cYY4dwB06HCLy7+1be/sAHIVzyny3RLx7OVCAjfEkcylWeXsfEch2EehhadHtyr/qMq63VqhM8lUma+koSvG4olkWify8RQ3qDb6JzSe8c= 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=p/Ok/5ef; arc=fail smtp.client-ip=40.107.241.46 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="p/Ok/5ef" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FaeQMR7/GwM32RH5NkxLArmt+PrE0PR6sRPGyQJXN2qMZ0rac40gwxHobkkvwO+vlnmbO+fxJaOBKdxXqPWs5Wrv80DwuTrIihwtzPTED7RuI4l9a67m6PVddnq/aR8rh8nDKYUjXHNW8lJhqXyDzKMbE/3ddLdzVKwYdPJ1mO/R+XZKAfdPEbKehRFe7ZjSap2FQkdn9mdOoiUdYcb4NTcrKHjjqlyMXxlzgozVd2OdhFyXH93nUYTrmu4ZHW2g3EjvtyZWo05eLz4RCDhItX17ZrCsRcUaR36n2Ug0Bc4oUF/9aqAcHWq7bh4D4q1mhoXeHkVGhZCm7pGgtKvUGQ== 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=nFCMQxwhqe4TweAabOVnMZ5cVYjk/vxMKmQJdV7ochQ=; b=FUUU1b5FqAxYpErg6lhVH7GtSLs4uCPXA8xI2vEh14bxtHN+x9dbddcwJLbn6om4IJzpjwptGRstwhbVPPxnY26UopQUW2+tY1whiun/1Wl9VIWLWb9AHiMDNllK/LPzwVOxzUDKnfdtLB/KoGfUgT4hVduIbWlxXE7t2nElqXHXAIuF8xnMtoyzx1XwWZbA3Tplhu1EToxq9Kb3Zive3nJBycr+knoqlb4YmNOKhl5npPJOtroYRVqBiRdnTCeFsghbMvH7XNKkUBrU0dfHK2pU6Gb2MAsO1ukPJRsgqC1khw4eS1oyDJuYglabP1agWM07pRAd16hdcWc/uVfswQ== 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=nFCMQxwhqe4TweAabOVnMZ5cVYjk/vxMKmQJdV7ochQ=; b=p/Ok/5efTPtp10R2sHcVTZMZaTbJrxviwshUIuiBpbm4Clhax7HUq/P6igLmSPHNLfsHqdPrLLcjkFUVGB93nltRcHyDkgaEHC8DZvq9N+DZ0bcwlXbpCotjBlqQGbicSgyah6FRPiRctvDUbVlH55hCh1XahQ7HRmu8xN1l3DTBpPCkZTuVBz3veKYsL49y1xLg3wQQhzUDYDFHnYiibxuMmJmmbld1ShKtxsVV5oZM0JA3jrbcQXa7ADKnvelaB0yg4qRhnl5hgg1Y8XuzoPVU9uSsPGmYGYDv7X6ueelXg7B0jKw3EAi5MmYmr83DLn7yyYt9OkgereWae6BYog== Received: from AM0PR06CA0103.eurprd06.prod.outlook.com (2603:10a6:208:fa::44) by AM7PR07MB6231.eurprd07.prod.outlook.com (2603:10a6:20b:133::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.16; Fri, 27 Dec 2024 19:12:38 +0000 Received: from AM2PEPF0001C709.eurprd05.prod.outlook.com (2603:10a6:208:fa:cafe::60) by AM0PR06CA0103.outlook.office365.com (2603:10a6:208:fa::44) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 27 Dec 2024 19:12:38 +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 AM2PEPF0001C709.mail.protection.outlook.com (10.167.16.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:37 +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 4BRJCH2R011940; Fri, 27 Dec 2024 19:12:37 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 01/14] tcp: reorganize tcp_in_ack_event() and tcp_count_delivered() Date: Fri, 27 Dec 2024 20:11:58 +0100 Message-Id: <20241227191211.12485-2-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: AM2PEPF0001C709:EE_|AM7PR07MB6231:EE_ X-MS-Office365-Filtering-Correlation-Id: b1b54cf9-51fb-4a04-fbed-08dd26aa6d12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700013|82310400026|1800799024|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0V590ixWtmIj/ZoSSeXZ6hE0E1j4NTT?= =?utf-8?q?oIyklo5v2YOewmAW/FnjdaYqO1ZIJZclwKV+jUaFugerSVvuHuu0q24HiS1lr/46+?= =?utf-8?q?Y2f12+S/jhRb79hase3NdnmsYo1BSYdoGVGi4hQO842t21e6/JgDprcPs24+4aDtt?= =?utf-8?q?UGgmrWpm7jiQoPVcvQCofY06VuEpT+KMgIk4WwSkF48LoYqeqyz8RhztumFyfHhY2?= =?utf-8?q?IyHUV86eifLjI88u7ZR7pzDgnPtK4Lz7yGRC3NUqbWPjigGuw7+8N7Erhq0pKm1AF?= =?utf-8?q?P7M1LTmNMearrZgvE6SMws3/yQbsSHGRg0hrt6dKFfBSOHudR9WV1SfokMWWL25NZ?= =?utf-8?q?kTJug3ncQAiZ8AOH3Rdj6jEStCAtn+r2Dp9reXRxV5rzp8U0RLyYR07DRlTlKypBG?= =?utf-8?q?zwkX2xlIr8lSt89zEc832Ie6cnoL6JPh9F93ciJ9JIYRoPf00Qgm402qS18PHbHG8?= =?utf-8?q?bwc87hDRjZ1qfd9vQGbBmDW/ot0BswEl0hQh2+qCFUipzq0mDaV4eQ+1Jd0WVbZt7?= =?utf-8?q?rvbVCePz0Cu4r6pfnWxFMo5USGG9PMOeOWjzI8HWBwhn8MTMYMAtBIz5a9cEJ9puC?= =?utf-8?q?aSM0bxLtlVvAqyo/0MNQM2R5pgESgRH4ELmwVWvn1liG4k4u2qNRe1FbkG0MKYgGh?= =?utf-8?q?OVBQsGlmfsGRzQPnS37V8rKWVyiIIUIovDtT75LJNx4HgMWNg0ue5Fj+QJkVMZnrw?= =?utf-8?q?ez3CZR0vMZMUbZgO8YrIWtGUPm7YLXMw/vBJ1iB80SfjGNX6LmZKfuoI7ZalXjpCV?= =?utf-8?q?UsUj/d4NZic+R5hSmrmgSlD6x9rwr6u5jYaaawavQjVRwhIJNM+lCzlBv0x1uANx0?= =?utf-8?q?7nkZDD5vw4r2TcQhixvLt6pP9RGHA5E71LkTKx68ZMy+vrpZu1DasYYa69LinxMWF?= =?utf-8?q?hItyG33mi9l1fxxD4WEUzcJT1T2A8GUl5sGCzzpp1mgjEonyt1TwoRp+mHorf08dq?= =?utf-8?q?xajEZ8i1UvVsuyBiYizx8xK6J83zpbgWL0dUa30xJzzXMyUCSgZmDoD8JBKzTou+a?= =?utf-8?q?Uj4xSo2ur5Zz5HpyKxhCy26wl0g4z8mZwvVtMNbm4oozJhunM4POLonvo9T6A+2dq?= =?utf-8?q?WyrRlXI2I8o27K7+fPJfWU3XrZU29DtHu55w+5TaAC5rDtJ3mv1b3IUZlJeKsN2jo?= =?utf-8?q?SU0Wu8k9ejp7O1spfxJ6T0ntqh3UvBpPPa0x3ldP/YrycFnTPtAWV/ZId2xFxwElX?= =?utf-8?q?bAro7qWKjHOvMOQZIFCVcewT1zGlkDg8CnEFi7ttaf8hEO1pYCfvyoORelIXTrpoc?= =?utf-8?q?Z+V3muCygAsBKarWcgo6QdXq+GbydzGRetwC7YzlhOWg0FizAD6OEE+obVcZPHTA9?= =?utf-8?q?vVmZPwBKeNZypvXGjvLQ4jpcWVbPxuQnJa4fRtQgWBb7ex5iD7zrIhNzmhuJgWpcZ?= =?utf-8?q?EQfkW65zrfyEDm4yfFcEuDJaxC9E3usYrWCk8M88JH8htTzy+Fx6K446omFTsPmuQ?= =?utf-8?q?x3PmSv7IxR?= 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)(82310400026)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:37.1641 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1b54cf9-51fb-4a04-fbed-08dd26aa6d12 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: AM2PEPF0001C709.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR07MB6231 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen - Move tcp_count_delivered() earlier and split tcp_count_delivered_ce() out of it - Move tcp_in_ack_event() later - While at it, remove the inline from tcp_in_ack_event() and let the compiler to decide Accurate ECN's heuristics does not know if there is going to be ACE field based CE counter increase or not until after rtx queue has been processed. Only then the number of ACKed bytes/pkts is available. As CE or not affects presence of FLAG_ECE, that information for tcp_in_ack_event is not yet available in the old location of the call to tcp_in_ack_event(). Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang --- net/ipv4/tcp_input.c | 56 +++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 5bdf13ac26ef..f3691c1cdc83 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -413,6 +413,20 @@ static bool tcp_ecn_rcv_ecn_echo(const struct tcp_sock *tp, const struct tcphdr return false; } +static void tcp_count_delivered_ce(struct tcp_sock *tp, u32 ecn_count) +{ + tp->delivered_ce += ecn_count; +} + +/* Updates the delivered and delivered_ce counts */ +static void tcp_count_delivered(struct tcp_sock *tp, u32 delivered, + bool ece_ack) +{ + tp->delivered += delivered; + if (ece_ack) + tcp_count_delivered_ce(tp, delivered); +} + /* Buffer size and advertised window tuning. * * 1. Tuning sk->sk_sndbuf, when connection enters established state. @@ -1148,15 +1162,6 @@ void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb) } } -/* Updates the delivered and delivered_ce counts */ -static void tcp_count_delivered(struct tcp_sock *tp, u32 delivered, - bool ece_ack) -{ - tp->delivered += delivered; - if (ece_ack) - tp->delivered_ce += delivered; -} - /* This procedure tags the retransmission queue when SACKs arrive. * * We have three tag bits: SACKED(S), RETRANS(R) and LOST(L). @@ -3856,12 +3861,23 @@ static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag) } } -static inline void tcp_in_ack_event(struct sock *sk, u32 flags) +static void tcp_in_ack_event(struct sock *sk, int flag) { const struct inet_connection_sock *icsk = inet_csk(sk); - if (icsk->icsk_ca_ops->in_ack_event) - icsk->icsk_ca_ops->in_ack_event(sk, flags); + if (icsk->icsk_ca_ops->in_ack_event) { + u32 ack_ev_flags = 0; + + if (flag & FLAG_WIN_UPDATE) + ack_ev_flags |= CA_ACK_WIN_UPDATE; + if (flag & FLAG_SLOWPATH) { + ack_ev_flags |= CA_ACK_SLOWPATH; + if (flag & FLAG_ECE) + ack_ev_flags |= CA_ACK_ECE; + } + + icsk->icsk_ca_ops->in_ack_event(sk, ack_ev_flags); + } } /* Congestion control has updated the cwnd already. So if we're in @@ -3978,12 +3994,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) tcp_snd_una_update(tp, ack); flag |= FLAG_WIN_UPDATE; - tcp_in_ack_event(sk, CA_ACK_WIN_UPDATE); - NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPACKS); } else { - u32 ack_ev_flags = CA_ACK_SLOWPATH; - if (ack_seq != TCP_SKB_CB(skb)->end_seq) flag |= FLAG_DATA; else @@ -3995,19 +4007,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) flag |= tcp_sacktag_write_queue(sk, skb, prior_snd_una, &sack_state); - if (tcp_ecn_rcv_ecn_echo(tp, tcp_hdr(skb))) { + if (tcp_ecn_rcv_ecn_echo(tp, tcp_hdr(skb))) flag |= FLAG_ECE; - ack_ev_flags |= CA_ACK_ECE; - } if (sack_state.sack_delivered) tcp_count_delivered(tp, sack_state.sack_delivered, flag & FLAG_ECE); - - if (flag & FLAG_WIN_UPDATE) - ack_ev_flags |= CA_ACK_WIN_UPDATE; - - tcp_in_ack_event(sk, ack_ev_flags); } /* This is a deviation from RFC3168 since it states that: @@ -4034,6 +4039,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) tcp_rack_update_reo_wnd(sk, &rs); + tcp_in_ack_event(sk, flag); + if (tp->tlp_high_seq) tcp_process_tlp_ack(sk, ack, flag); @@ -4065,6 +4072,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) return 1; no_queue: + tcp_in_ack_event(sk, flag); /* If data was DSACKed, see if we can undo a cwnd reduction. */ if (flag & FLAG_DSACKING_ACK) { tcp_fastretrans_alert(sk, prior_snd_una, num_dupack, &flag, From patchwork Fri Dec 27 19:11:59 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: 13922095 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2061.outbound.protection.outlook.com [40.107.241.61]) (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 6B9251F892C; Fri, 27 Dec 2024 19:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326769; cv=fail; b=B13lmAHzG9Es3ZKfRUg+3TyIkpSEBP2EgT1jBLupZ7q3Op+YGCrkKskD8zP3h6mdRDGP0eBHl6J092W0yD8Os/BbuZW7D8uJy5JWMiRkUpSnH/Y0S4CmE9iDk1vVNC1akmEIxrBBoYHYf/twh5HYTFmNy1NXVWXyQh9Tvge5IXE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326769; c=relaxed/simple; bh=501Gi53SHarDIBvdO2AAchf7vQePAyB6TeoMAHZDqQY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=aYSH5cZcNrcGCAQDAPIMTWR+1i0KacGACJO4tQp7KGXlFzZfdYxso49l7OMdIZol7XWk4nnJoKUQiqIz5cPeOh+Dta/mlbo9Rk8mUXaKTAERzUkxHT9bFN4LyMkzsuc+DF2a3KeTLFgvwq/wBgnVRLe150D+PGZU26RgVUA5PS0= 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=RFZ26ji3; arc=fail smtp.client-ip=40.107.241.61 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="RFZ26ji3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yu3ueIIchj08I4PNGcykNuPppdPR+X4IXIs+i5w/qV/lVu+bFHiXYjhsQt6Ltflx3IbYD+J4MzORlgy7rnd/7MgR8hVYbtaj/l/ZN6+syCs5lWZk5c/llpxWpS72vH0Qnwu55/FRp2A2VLuLs66eOQDfVEtahlcXuCfs5TPuXYCqWakcvq3D2y2cUuJj424cKMLl8Qs6SYW3rS+VwqcL5/297oLCEbFyGH5vXVEpULHOpa1l++wmdaSpFwTWDaOEcA1pd+LpaAJmwmj3Ej+9XqDJgUuFM8uky5yL5R/ckFgnolQtNw33rgj5VP8rWSpur1aKIgDZHxPDXZHHv+D1Yg== 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=x4DQWYI/EIGBsQm2JGiVDXpW56OUTHA0ARk3VMbRgvM=; b=UGqzzaaZAH6knmCFwnaT+gEIoHHldwZgg9Wj46KMEBQtAMpnQPgvJAzat3QQ3I+g8fh0UeMxx7DL6lr4HAJia3ASb1Z1CV9XDX/yNey2MPl4hfk4RNxc6jf0jdMmcOMwEmllBYQkqUwR8hHPQEuTZvMxX/dqaLQt7hw1iL1TQ/K7f1/0SfTbr2dsUfgiNd5u6DEpVxGZiX1SCvzSvULBaAWNh1cr51Vqd+Bt/ImgZnpQNwqjUyfsN/NTAd73+IaU7vD+Nr5t2LiQF02oO5vcXfnA/RQmJJYDNqt9EswkO16evmeM5WXNXSrcC5JdD9HSBlJ2EmTwqgljc0jwu4cZrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=x4DQWYI/EIGBsQm2JGiVDXpW56OUTHA0ARk3VMbRgvM=; b=RFZ26ji3VMa7ddtlPbW9LeBOCRL3LaPtmsT1XaxtBBLNvNxbus7bwTB+d5n/iN4hKwe/+5rNE0CVLYeVKG0vZCccDCW2dqmDB1TreBe1UYWtZ0zgg6aTPrZxK7u+Bkv3dWyjzr/Aee+XukIEAivl7Tr6Ee2rN82TQYdqXtrtE2DwvPtnkvt1JomDuYzLWcW/mF81eL3MKVHNLh9FuzZISnQWwLfyk+/EV7u2cFXCZhVXkIK5bMAH2NNcwWd5IBKFQ313hzBuFxEmKoj+5t3Bq033ar/0apeSOcHw0pq5LK2+uDTHkSZyB4CWzGpBvytPs0EiJiT59/pATAYH0HBQRA== Received: from DB8P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:130::16) by PA4PR07MB7183.eurprd07.prod.outlook.com (2603:10a6:102:fd::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.15; Fri, 27 Dec 2024 19:12:39 +0000 Received: from DU2PEPF00028CFD.eurprd03.prod.outlook.com (2603:10a6:10:130:cafe::60) by DB8P191CA0006.outlook.office365.com (2603:10a6:10:130::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 27 Dec 2024 19:12:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by DU2PEPF00028CFD.mail.protection.outlook.com (10.167.242.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:39 +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 4BRJCH2S011940; Fri, 27 Dec 2024 19:12:39 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 02/14] tcp: create FLAG_TS_PROGRESS Date: Fri, 27 Dec 2024 20:11:59 +0100 Message-Id: <20241227191211.12485-3-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: DU2PEPF00028CFD:EE_|PA4PR07MB7183:EE_ X-MS-Office365-Filtering-Correlation-Id: 3901b252-d92e-4ac3-c956-08dd26aa6e32 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?6aWdOmDSMswYVO+e1eiYGqdbWGAQuhW?= =?utf-8?q?7QrGXJhgoT3jdUxeBhr2K312LcHzhvwIT0bs/NSdVGTHWkVTnL9WW6uFdezg4P9ZD?= =?utf-8?q?MgCNQrLWNv6mT13LzaSQXtPH2sKIXOfoigtrn1aCiA8H/6DFiqx1fdOFuxd7E4iGe?= =?utf-8?q?Y+LmOywB8pTqqHtLSDXJ0JVmr4tWpaG116UVDKt6DQw0Nm4G1tFIq2yfznBn38S77?= =?utf-8?q?r5jYBKN8qCqRsnwhPFRxOC2clXtX9fk2rbQfMpzTFoqskKvNdLIs1gQ83OAnJYlJV?= =?utf-8?q?PXYrkKz7+iF3H9QDlQp7hnlbi15REkAY3Y84Bj7ri6OnAOzCuEb6x7/PI0w+xnbrB?= =?utf-8?q?65bRq3V7PAQ7icpYZjlY2qecFJ/ZEGMt2UydGGjSLQFscXKVWOq8uowNuohgyE4dO?= =?utf-8?q?7MVuMqqchxCHiDInnKwpodewpLrtgeEuotaZTycPv9YO1GP+pQB+llrpxGcXjJT2h?= =?utf-8?q?wp3eDN1OrZ7J2MBz6IjU3oBpab5yrtb648bUME90ljdD3Qx//UYr+zNC7hpxEhsfp?= =?utf-8?q?5Z/9+s8zJObooIszI+zBpZe4VzmwJab3w2o9phzLc9+VZLiTmLt+I5YB6ICoP13oU?= =?utf-8?q?WKG0RTpWIhERIdMxwNwY2yGfVh3wY/k7Qdq3eGlDn75iYr2lDnpOG401feJ7LoIOt?= =?utf-8?q?u1z/vdYM2du1Gy8Tr2BzYxU3APnSscp9qgT/PDQngHWvQ7Bywcnj4eflbsXBoCukZ?= =?utf-8?q?Uy+TGCaGwIZutn3jJkU5OlqXwdjMh8l9G7l6309yJk6xNgXxmgkGzVFxaV4+HmifL?= =?utf-8?q?I+5WE6tUnvjj24061YCLVQny3JvNbaJ4UzckNsgyfzEs3t3zhyt8K51OaIxBKaQFd?= =?utf-8?q?XZlnf+Y5DPWGh+IcRx2REc/XUBU6OmppababcgqZjAez4r7SnbnqILUklI5JeEx0r?= =?utf-8?q?UN8ayVpolUefNgvQjCPs1PYmRhSHSO1NPkm5qXlv2payhzDDOUj7h9DZSUNvTZoOj?= =?utf-8?q?1OmMNjLkZAefCgPzRVsXXMyVEQVdsAPwiBrI/0o1DpAxQ9OvudcTEFAkxUlU5uLVL?= =?utf-8?q?P8GvwVTRJ5ygoUUvTfPt7wsgfgR3dD8KShj6AkXtMbAi+OYsPJw5J8FWMi8lp8Gfb?= =?utf-8?q?2Z8jnJgF/QXwDyU+SpQVJGNgZbIQKUa492MUJVMrL1ADl4fCJOuctgp+zoCfm1qA0?= =?utf-8?q?XniV49AG6S0CVJi4kKuFAKWpD0k2ccb6qGMRCK/aGx8pJJrI2MLVSeAloBBuBJNkL?= =?utf-8?q?/oKmg6BYRlEcZVNOSO57Ukkp/EpQrRdN6oBK7+PndaJPpjGtK077t46PslTad3f/x?= =?utf-8?q?+lwkNzcvE4Wc9uzeQfBtXeDfyYGPAD/d498I4/nOPJzZpEj+W+ou9NQpjHk6rOdzT?= =?utf-8?q?UEoBLA9St0WyqLkVVrsPZfVslhtI6gP+qWcCqUvjK4XS2EsMhDnAu6BdZLnc4cFBP?= =?utf-8?q?APQJTo60aqBJHL2M+5NdR53MkXRz9sPCLcIAZT3geoOPB5iuYIoKIAZMZXX5j9Fi6?= =?utf-8?q?SU52BZshZz?= 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)(1800799024)(36860700013)(376014)(7416014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:39.0346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3901b252-d92e-4ac3-c956-08dd26aa6e32 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: DU2PEPF00028CFD.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR07MB7183 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen Whenever timestamp advances, it declares progress which can be used by the other parts of the stack to decide that the ACK is the most recent one seen so far. AccECN will use this flag when deciding whether to use the ACK to update AccECN state or not. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- net/ipv4/tcp_input.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index f3691c1cdc83..eebe3a99aa90 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -102,6 +102,7 @@ int sysctl_tcp_max_orphans __read_mostly = NR_FILE; #define FLAG_NO_CHALLENGE_ACK 0x8000 /* do not call tcp_send_challenge_ack() */ #define FLAG_ACK_MAYBE_DELAYED 0x10000 /* Likely a delayed ACK */ #define FLAG_DSACK_TLP 0x20000 /* DSACK for tail loss probe */ +#define FLAG_TS_PROGRESS 0x40000 /* Positive timestamp delta */ #define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) #define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) @@ -3813,8 +3814,16 @@ static void tcp_store_ts_recent(struct tcp_sock *tp) tp->rx_opt.ts_recent_stamp = ktime_get_seconds(); } -static void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) +static int __tcp_replace_ts_recent(struct tcp_sock *tp, s32 tstamp_delta) { + tcp_store_ts_recent(tp); + return tstamp_delta > 0 ? FLAG_TS_PROGRESS : 0; +} + +static int tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) +{ + s32 delta; + if (tp->rx_opt.saw_tstamp && !after(seq, tp->rcv_wup)) { /* PAWS bug workaround wrt. ACK frames, the PAWS discard * extra check below makes sure this can only happen @@ -3823,9 +3832,13 @@ static void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) * Not only, also it occurs for expired timestamps. */ - if (tcp_paws_check(&tp->rx_opt, 0)) - tcp_store_ts_recent(tp); + if (tcp_paws_check(&tp->rx_opt, 0)) { + delta = tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent; + return __tcp_replace_ts_recent(tp, delta); + } } + + return 0; } /* This routine deals with acks during a TLP episode and ends an episode by @@ -3982,7 +3995,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) * is in window. */ if (flag & FLAG_UPDATE_TS_RECENT) - tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); + flag |= tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); if ((flag & (FLAG_SLOWPATH | FLAG_SND_UNA_ADVANCED)) == FLAG_SND_UNA_ADVANCED) { @@ -6140,6 +6153,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) TCP_SKB_CB(skb)->seq == tp->rcv_nxt && !after(TCP_SKB_CB(skb)->ack_seq, tp->snd_nxt)) { int tcp_header_len = tp->tcp_header_len; + s32 delta = 0; + int flag = 0; /* Timestamp header prediction: tcp_header_len * is automatically equal to th->doff*4 due to pred_flags @@ -6152,8 +6167,10 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) if (!tcp_parse_aligned_timestamp(tp, th)) goto slow_path; + delta = tp->rx_opt.rcv_tsval - + tp->rx_opt.ts_recent; /* If PAWS failed, check it more carefully in slow path */ - if ((s32)(tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent) < 0) + if (delta < 0) goto slow_path; /* DO NOT update ts_recent here, if checksum fails @@ -6173,12 +6190,13 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) if (tcp_header_len == (sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) && tp->rcv_nxt == tp->rcv_wup) - tcp_store_ts_recent(tp); + flag |= __tcp_replace_ts_recent(tp, + delta); /* We know that such packets are checksummed * on entry. */ - tcp_ack(sk, skb, 0); + tcp_ack(sk, skb, flag); __kfree_skb(skb); tcp_data_snd_check(sk); /* When receiving pure ack in fast path, update @@ -6209,7 +6227,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) if (tcp_header_len == (sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) && tp->rcv_nxt == tp->rcv_wup) - tcp_store_ts_recent(tp); + flag |= __tcp_replace_ts_recent(tp, + delta); tcp_rcv_rtt_measure_ts(sk, skb); @@ -6224,7 +6243,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) if (TCP_SKB_CB(skb)->ack_seq != tp->snd_una) { /* Well, only one small jumplet in fast path... */ - tcp_ack(sk, skb, FLAG_DATA); + tcp_ack(sk, skb, flag | FLAG_DATA); tcp_data_snd_check(sk); if (!inet_csk_ack_scheduled(sk)) goto no_ack; From patchwork Fri Dec 27 19:12:00 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: 13922096 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2043.outbound.protection.outlook.com [40.107.105.43]) (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 275211F8EE2; Fri, 27 Dec 2024 19:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326770; cv=fail; b=uFX4xH6URE0W1Ch0ucyGWwH6g9PBxb8dZUBqgrUusOKdSLsXUC8J5EmWqdjMWe9d/F4WvV6kgxwsPZtjL71GO6k+QkT8t+akdQ4VA7e+6YrIcjV2AX5uAjk67JY64HVwxzkCcvHioNHlz0J3y/K6lu43UXssnfcnmAjzwSGmyS4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326770; c=relaxed/simple; bh=MsdAqWnPWRxZPSL/UrZmoKcVK8CirxJipjJtss53gr4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=nMzP5e8sUQRiGBgJunSZAkbYfrdAABibr3UMtIbLYg/h3gHC83Ho3SQzd/1w3HVS7pNe/Mr+UW5RDPoGYPwx0DxKMqekzfNtwUtCBEiHv5LoXrwIHUKBq5qNaOvJ5wQbLYXmTbWzMBkDpCDaazQhl47ewytQUYhdto7CyrRQN4Q= 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=VhiFlpBn; arc=fail smtp.client-ip=40.107.105.43 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="VhiFlpBn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=haUkDeU6SxbjlU6VcnJyMmjQJhJfaEJw6LRTDmivZub5Bem2XBCD1K53h3iOrDhHUWQbwxn8APQUKnd2I/dVvCrmQQNS4KiwPp3H1hBpbrmD6TPI0OBQkOcwrY2RLnD8F3MUfiC0Yqf415Krltj44dhGTikjFk0R4jUZpmBGSp0nnTiyaJbP4wXtCforNmmt3wP/C/4p5ACDgbPiVcANXBm/QE9i9KvLq/UXmFJyJZwp/b1dGjs5Otld3N2qhBpxY0UDCl7XqE3UmsGAYFJmcR90NoBdeVkEf3ypdJyHrsVrxJvlfNeWk+7fodhgj3EURIVoraOw+HX2Vv11GcWvRw== 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=Kv5g0ulzAH5jx/foekk8GpabdDVTZhLYKyA16xv0700=; b=jMILg2oKQo5N7XE1N2Rcp2a62/y2bOfFGTqfIw+Ukq9ToPGotOxDtEVAJH23nFeDTBLkEVTGQV39VjhPe/G2/OUzbqFV15XbyHcqxZ0F7H2jYFbqHm8kKTP9s0hiw5bNtZtB66R6zNEktHzAXEBlCYW7dJCzRSPKJIbwJM3UJ51myzHz+6OX1/nKjjIvkKEcgxHkmnj0nSlyfx+3ECPrm4Fud8KpRWvwY/VVflYOqJ4dmIYoTZxKwxXLETB7Oi3E8k1NNMwqsdDnLJcdoWH96cYdO+U1wSv4Jgh6UONbEgskTgpAac47W2YKMfLRShlUrx7JJXvKzcCkmytv/vv6tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=Kv5g0ulzAH5jx/foekk8GpabdDVTZhLYKyA16xv0700=; b=VhiFlpBnGpK5hVC/gA+l5xlHYUJtjAsEvl+Y1Kd+CzEDHWPygXw4Yd4oX+IVJn3jbnMB8mzfdHIz0+TkUrRXNf3JY06rW80KZksn+/z6X6SJ/exUNDVjLjeel5UscHQqY3A9b8ZWvfn/spCzNl37Wx69wMLH/j53PBKVvrHy5NlvPl9LKk7hv99gOB2vzTo7kTgxJYIdDeyqZUwC7uA3ceas6WMx42rG7WZv0HZbDso6aLuGGLnJJEwDpvTmb6xqm94knpew0K0hyVj/zUmp4lFFpQNtU90v1MrxW+amrp3S0pxvPqfcWhWr2tCfvjQeO23FGbeH4uxZwWoS5t1J7A== Received: from AM5PR0301CA0021.eurprd03.prod.outlook.com (2603:10a6:206:14::34) by DB9PR07MB7930.eurprd07.prod.outlook.com (2603:10a6:10:2a2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.14; Fri, 27 Dec 2024 19:12:41 +0000 Received: from AMS0EPF000001A9.eurprd05.prod.outlook.com (2603:10a6:206:14:cafe::c3) by AM5PR0301CA0021.outlook.office365.com (2603:10a6:206:14::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.15 via Frontend Transport; Fri, 27 Dec 2024 19:12:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by AMS0EPF000001A9.mail.protection.outlook.com (10.167.16.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:40 +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 4BRJCH2T011940; Fri, 27 Dec 2024 19:12:40 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 03/14] tcp: use BIT() macro in include/net/tcp.h Date: Fri, 27 Dec 2024 20:12:00 +0100 Message-Id: <20241227191211.12485-4-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: AMS0EPF000001A9:EE_|DB9PR07MB7930:EE_ X-MS-Office365-Filtering-Correlation-Id: 24e659a4-e3c4-4ce7-4f10-08dd26aa6f1c 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?nl6L0SVNzHJrD8rbiPl96u0x6B6U2mC?= =?utf-8?q?lIbcZKFDzHSILFM/7l29UvN2Qd6At4GBei7zzZAZ7nkP07aAfx2JrG3MJG5a/ObqI?= =?utf-8?q?JuZUW0R+fvbjqcyX8v18dZ1iHmdgxtymMx0rUe57Gci8v946UEbZiN2dwAzvgEKZm?= =?utf-8?q?2H2Z8qw845KRA6c8BVLRLuUqjXSVdkIiMB9bygx5zaEmK4vnPzovMrbuML3WdYzNc?= =?utf-8?q?IK/gdlo+urQYhKUBKdoyfTE7u6zMO1AMva4YCXBy8DwCGxGsB9GZFkFtvEnLKjX/J?= =?utf-8?q?1JU6ZFpvqdYPl66EB7OWF7AlUWovkTiCz/rVduVEZrcjsBT5MciRQliendNAkgG+z?= =?utf-8?q?E1jCp9Uc/EOqsV/UHRBKMyZdIV9orzvxIhFe3Y1FwmXkqsm5wxyUixrylpFltTOSo?= =?utf-8?q?S6y6s88v01uhIJT9Lkh3fgD3V3ETH9OrsO6I2ifNL+lnHjXSXMGQh0Zb7eN1aeV7X?= =?utf-8?q?1X9beRBbmrN/wGdLgUvwvwi4KuVaU2UDXI/0YFgUOryTuEOjWUfOqo+KYHiqOfCNb?= =?utf-8?q?QFmQpMNXTF+eY2J2YYC4+n8Uu6nUEZuSpuxXpJ0x2f0NZ5x4OMHLufC5Z1apBqAKG?= =?utf-8?q?x4OtAZhZHVCff1mhwvJQklS7hgd6LAY4h2Z8KI5438LYC9SyppvbqCWHlWYKyXHUV?= =?utf-8?q?d8oqogReCJwKQ+JhZNrXc1Fk947nEVYviJo/ONaEv7Bg+laP0menhkUQyiUPdaSjR?= =?utf-8?q?t/oTAjurk7bwRSwW1u2aaMCqnKfQozBTJdFhPgwWjSRkp77Lr1PWLfd1bdZj6k5JH?= =?utf-8?q?sZUbmOWktwWhjvCuDn2nSNL3wm+oHdJtUA9S4Lrg4rWn2QRfuSmr1BroVYyfckow7?= =?utf-8?q?wSxAWeCU3QbDj1qfimznZnarG/HEZvd8HrCiJ++x8lZ4FtMtT3JEeC3xcNvBYc1aX?= =?utf-8?q?jh0v6Ra+YSfqyRnOPWRFspgc9IIfs+e9LII8DSXiJUYeWusXltUD9CTzXfSBFekWz?= =?utf-8?q?hDmxJCk9EKWgaANShAaHHbBE5SyG4SbKlezYrA+MU+Ngj5aS35VNAEE9ZyoEEPAvo?= =?utf-8?q?j6qf7C6AvkkuFItK6D1DiFp3WEY0a0qS/G+QY7LdMuhkqfrMqrjr+SBmzo9NWVxoa?= =?utf-8?q?tb0XoM+V/dS0Klm6WDB1bnpmbRiuKyhtInSgBAGPNHxjhbnA8SM5ljPnRcTlCySvj?= =?utf-8?q?Yeg79ihNlPJyiz6Dg6lkUF91ZeISS1k739/HbBL9qJ0To+T3PiqQaaHUNT05IJ5BW?= =?utf-8?q?HClqBccnbd75gQ9Zt1lYavyAryfDgOhvFltwBHJRq7w2T/iTJ0pd6yPkOJ14zCHuI?= =?utf-8?q?uy/VxwcY75iBR0tAhYzPTSVEmDqLByMkqCR/g7qBnsAEo7J/EFyYiM1/IQX8pBb7b?= =?utf-8?q?5spArQJxYKnxwRxo6tjCr97XcFwB7tVGBex82h6eoq/EqLEBWAK6IN8xNB/BwkxAc?= =?utf-8?q?JBtQW/AEoR6Xvf9I6Th4uwt+NpNn43QeK/x0p00KDKh/rjBBj+vswgq4P/hrDCGZt?= =?utf-8?q?sAjN4WAowC?= 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: 27 Dec 2024 19:12:40.5338 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24e659a4-e3c4-4ce7-4f10-08dd26aa6f1c 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: AMS0EPF000001A9.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB7930 X-Patchwork-Delegate: kuba@kernel.org From: Chia-Yu Chang Use BIT() macro for TCP flags field and TCP congestion control flags that will be used by the congestion control algorithm. No functional changes. Signed-off-by: Chia-Yu Chang Reviewed-by: Ilpo Järvinen Reviewed-by: Eric Dumazet --- include/net/tcp.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 5b2b04835688..99dcbb47eac0 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -911,14 +912,14 @@ static inline u32 tcp_rsk_tsval(const struct tcp_request_sock *treq) #define tcp_flag_byte(th) (((u_int8_t *)th)[13]) -#define TCPHDR_FIN 0x01 -#define TCPHDR_SYN 0x02 -#define TCPHDR_RST 0x04 -#define TCPHDR_PSH 0x08 -#define TCPHDR_ACK 0x10 -#define TCPHDR_URG 0x20 -#define TCPHDR_ECE 0x40 -#define TCPHDR_CWR 0x80 +#define TCPHDR_FIN BIT(0) +#define TCPHDR_SYN BIT(1) +#define TCPHDR_RST BIT(2) +#define TCPHDR_PSH BIT(3) +#define TCPHDR_ACK BIT(4) +#define TCPHDR_URG BIT(5) +#define TCPHDR_ECE BIT(6) +#define TCPHDR_CWR BIT(7) #define TCPHDR_SYN_ECN (TCPHDR_SYN | TCPHDR_ECE | TCPHDR_CWR) @@ -1107,9 +1108,9 @@ enum tcp_ca_ack_event_flags { #define TCP_CA_UNSPEC 0 /* Algorithm can be set on socket without CAP_NET_ADMIN privileges */ -#define TCP_CONG_NON_RESTRICTED 0x1 +#define TCP_CONG_NON_RESTRICTED BIT(0) /* Requires ECN/ECT set on all packets */ -#define TCP_CONG_NEEDS_ECN 0x2 +#define TCP_CONG_NEEDS_ECN BIT(1) #define TCP_CONG_MASK (TCP_CONG_NON_RESTRICTED | TCP_CONG_NEEDS_ECN) union tcp_cc_info; From patchwork Fri Dec 27 19:12:01 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: 13922098 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2067.outbound.protection.outlook.com [40.107.22.67]) (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 10E831F8AE0; Fri, 27 Dec 2024 19:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326774; cv=fail; b=WVTKfzz78gTQBtJRPhVMtFmKkUQzxXqWX0v+qyJ5wLiugB7aH6dVL1/fBTqjtorK3MBo+9kSuZ/2Zkw71rUQfa59ieYNOsYtWAY2y7fniw6HEKP6DQphWFWPxmrlg4AzvJFY0xm5XorU8eDQrFT7CBW2h5Zr0T7Lo28zVlovVLY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326774; c=relaxed/simple; bh=tJmiv5zcexXprjb0rePvbqOHx8USh4ij7lk+RuZ/giY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Xw4P8DDvIYe4lG8QeBfPZZng5ZfshMXoDeOpT7ic4HYR6+G2zdz11UaUjS4Keb2M/m7uDs0+eCQj9sulpP4DwTzfbdACVT12qUFuvbifROrWyHYmhykoRWLaf2zy/4Adf2ok6NSGexfv/QX+gTlSMh1umhogYO/guo0uw5Fdl3E= 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=qOx3DKs4; arc=fail smtp.client-ip=40.107.22.67 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="qOx3DKs4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Nf9iq8VKw7hSvXcpc4zgoKWb/QDZF3HCiEM03GekyKh1+bK/1yB7J5j0LCCewou2aG4bbc2fxGg1/n9tH9/nvHG+oB6gDey98lB6qurBqn9NELzJRIHxJxPxMTPRmNs8Vx8LHirYJ4SqVCCFy26wgUvvWhWq6Yr+Qre0UZwrgcHZPn4fKyjreigHyhlW9IfM1vh543m1FOfqTj5nZxY9F06j7mzFMm5hfa28v8gqdGoLQ6rhb/pQugPXMh6octqmwnret9S6tkXgTSuSA6oEZ5B86TGBRbjwW05HiD/IOjhhjr8cg3as9rdv/zC/Bf/HMenANoAhCBhu39aC54AYBA== 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=1vvcT2AP4UOe+vI+7Cd7/BC5PwEvYpzbuAeuZWi7zrU=; b=G3VKM9iTpBoeD8dxQ8J9vh1ycf/wwFPxIm2LcmLjKm7xP4MWE/fF54UDItqQv1Mj2I6o+YJ1nC3JbZUSNQXcF3TaUyuuFRxwLsvi49c+UOVVJqRfz6003wIZdDfUsDptOMzrSu60EFMGvNyouZul8HixZpSLdjkUfnz65Izyc2W5kUfVOAMNECyY6UyjY9eUK28KFrYeBIOop7vfP7FDk3WWoAh2lMmWjiQ4AX0uTk3rt7DTOFlc75L5p/bvPa/trC2n1BFU+LDFzu+M1NoCnRUsmkq48X8R+5eYkZjIi0qmTBR6sr+at9YJHp0ZUoI4QG20HXYft37YIRjBUDfOFA== 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=1vvcT2AP4UOe+vI+7Cd7/BC5PwEvYpzbuAeuZWi7zrU=; b=qOx3DKs4K8ASLXonHC21DLx0SWyXWqyGyXgDW6bJ8/K8fPgoZP8cMWkO7NvvhTrrktPb7seh/qDYRxgorg/1rDj3lEBt6h+RhVfGjzDuD82YGLNOq/TAJMIRrUX3JEuV4dPXV2h31ihzV7WbZLOX8gRJLN6Df7MQCD0hz7kRnbZpkEJyhCUaJgqDRRBM4NM33N8liZkGbwdrxfwlWCUjTAoTli28kv4NX9X2XpP6A3ljirgrAQn49CozPZZunxreHtrMTaTG9CD/jzB6UIXEG9GSI6M1kfx9AJMelwTRqkzEYb3L6CLOK5awvuEa/s1gux0WOPBeUvKPSJMLNqRoCw== Received: from DUZPR01CA0138.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bc::14) by AS4PR07MB8875.eurprd07.prod.outlook.com (2603:10a6:20b:4f6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.15; Fri, 27 Dec 2024 19:12:43 +0000 Received: from DU2PEPF00028D00.eurprd03.prod.outlook.com (2603:10a6:10:4bc:cafe::6a) by DUZPR01CA0138.outlook.office365.com (2603:10a6:10:4bc::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 27 Dec 2024 19:12:43 +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 DU2PEPF00028D00.mail.protection.outlook.com (10.167.242.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:42 +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 4BRJCH2U011940; Fri, 27 Dec 2024 19:12:42 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 04/14] tcp: extend TCP flags to allow AE bit/ACE field Date: Fri, 27 Dec 2024 20:12:01 +0100 Message-Id: <20241227191211.12485-5-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: DU2PEPF00028D00:EE_|AS4PR07MB8875:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e4a6b2e-336b-46eb-1f7c-08dd26aa7035 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0xkTPZNlQQ+zu1Q4CLxrCmXNsVEb0+f?= =?utf-8?q?Tllp/JDkjv8On3cFBxGA653wrKowwWC6pfEtlF5LuwKRFdGiQXp7th3t/rqz0aQkP?= =?utf-8?q?e3ApPeygWP29406zB1rB33eleyFHarX/DPlNFEgQ3oA6pBKl9BUEA7pQ78G4ZRHri?= =?utf-8?q?WJs5ZjbU/93lg4X3gHyociGk+DGuXJ0OD0jK2Og0KWC+xo39PvKdeSmuVIIDj6Ph0?= =?utf-8?q?iIUNcLh7ZW59G9qQx2QEn5EdVOErXQVXY2awSBEPRNf9B8SWUyDJTA25zMKdCu+AX?= =?utf-8?q?7ON/94ZxPZKjB4Zi0xeN/bCERhRlqj58rbe+hZPC+5MKWhOE0S4co9KRru79CN8jm?= =?utf-8?q?l41+2Of9QXqxioDKiu1IxhFJTwdTuV6nTXZFOCebe+whoPSYWYPLUMMIvW9XIu8Wr?= =?utf-8?q?rXv0nDOp2lvv7cDU0KOdRTUhjD/6kvOGF+u5ejZy5s4YuEpJyEKRXCC1E49XgqY8W?= =?utf-8?q?ZoEgSsaSS2N7D8ntNpqmwbYIXVgFMM1Vy2l3+k5De08XpKlsW4T6HiaZ2c3ZpVBut?= =?utf-8?q?0ine08cmuWQ6TIxvx7Ag16m1LapXMTaXXYFCwJXJ+JvYVevFZpM+R4VB67q4hy/oM?= =?utf-8?q?t3c68hXyBVBAgtf1QcJtj75ooTOwTtcikhOPuxovYafXwun1FgqT+GF2/ZGlkL67A?= =?utf-8?q?FEbCFWg1sYKgalurRUvia9vQ0FluHGH6+31Gf2T5+k896uONyh3pacFE3gQ1WVJ/5?= =?utf-8?q?Ni1MCC4zUzTsDjEKh4O7yV2TQwzAh434pL85slyazJPwC4AVwCTYYzGvrT3PtHfZO?= =?utf-8?q?wRv7KxTiT1adnDBjQczxED5TU/kaB/KJj70XC3Wm2Hc+1mU5uqH17HUeiKYoEL8B3?= =?utf-8?q?27OvVGoDhxRTFae7GltJAQsyoZwbBSkCoVVEcuoQQifv6AT27u3EwRsXeI52xPr8o?= =?utf-8?q?M8FIWdTXn5TQBOoN9tlTb5TgtEV/hpTsu2RzhFBMbzOXC/TwUsGES16kZ8UpXkTOP?= =?utf-8?q?BCOnm3cydxYzZDsQGfvURHa++/y1upJr6qrykdoI+ivv9yXeYnX2L/ZLsFqIiZVZD?= =?utf-8?q?gQ5aqavLL1LVbFn2vu+YYYTgu9Am4R+Xw6ezAvxDRPUpJR7Kir8IQYqYCxLvXYH5t?= =?utf-8?q?ZLChQm2tMENNo8/jxGbw9NLwn5FOnDyhmoe36OiVMFP9usUMOCDJOPKzGdG/ryG50?= =?utf-8?q?nXFMQktgsLPWIdVfsJtNciTr1OstrYyE+44Tsp359ZunEOPbXUmpMFR1l2v7oduvy?= =?utf-8?q?oebey+rOOpoj4iVKPGvsddacRKthyrWElmotM7kmulpwnIRcKHdswJG80htaooFWl?= =?utf-8?q?yawuS0X9EqELZCsd6qxP7buz2+GXed+GxflwbXqeqNFGAVhdOLgD8NtOHYqaJAq8u?= =?utf-8?q?lmBKkXv8vVvEUJgW/OpeI0+kNZMts7YQErKr97Fvw/fV6noS51wW981IS8Yq3Pjm3?= =?utf-8?q?gbG07Zo7HZpSxUweZMbCLX7UHZsIMDzdLPKwi2CjWjrc7QdC40b/7z9LtYHdammdp?= =?utf-8?q?08DSX1hyLU?= 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)(376014)(7416014)(1800799024)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:42.4053 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e4a6b2e-336b-46eb-1f7c-08dd26aa7035 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: DU2PEPF00028D00.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR07MB8875 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen With AccECN, there's one additional TCP flag to be used (AE) and ACE field that overloads the definition of AE, CWR, and ECE flags. As tcp_flags was previously only 1 byte, the byte-order stuff needs to be added to it's handling. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- include/net/tcp.h | 11 +++++++++-- include/uapi/linux/tcp.h | 9 ++++++--- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/tcp_output.c | 8 ++++---- net/ipv6/tcp_ipv6.c | 2 +- net/netfilter/nf_log_syslog.c | 8 +++++--- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 99dcbb47eac0..c9bab41685cf 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -920,7 +920,14 @@ static inline u32 tcp_rsk_tsval(const struct tcp_request_sock *treq) #define TCPHDR_URG BIT(5) #define TCPHDR_ECE BIT(6) #define TCPHDR_CWR BIT(7) - +#define TCPHDR_AE BIT(8) +#define TCPHDR_FLAGS_MASK (TCPHDR_FIN | TCPHDR_SYN | TCPHDR_RST | \ + TCPHDR_PSH | TCPHDR_ACK | TCPHDR_URG | \ + TCPHDR_ECE | TCPHDR_CWR | TCPHDR_AE) +#define tcp_flags_ntohs(th) (ntohs(*(__be16 *)&tcp_flag_word(th)) & \ + TCPHDR_FLAGS_MASK) + +#define TCPHDR_ACE (TCPHDR_ECE | TCPHDR_CWR | TCPHDR_AE) #define TCPHDR_SYN_ECN (TCPHDR_SYN | TCPHDR_ECE | TCPHDR_CWR) /* State flags for sacked in struct tcp_skb_cb */ @@ -955,7 +962,7 @@ struct tcp_skb_cb { u16 tcp_gso_size; }; }; - __u8 tcp_flags; /* TCP header flags. (tcp[13]) */ + __u16 tcp_flags; /* TCP header flags (tcp[12-13])*/ __u8 sacked; /* State flags for SACK. */ __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */ diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h index dbf896f3146c..3fe08d7dddaf 100644 --- a/include/uapi/linux/tcp.h +++ b/include/uapi/linux/tcp.h @@ -28,7 +28,8 @@ struct tcphdr { __be32 seq; __be32 ack_seq; #if defined(__LITTLE_ENDIAN_BITFIELD) - __u16 res1:4, + __u16 ae:1, + res1:3, doff:4, fin:1, syn:1, @@ -40,7 +41,8 @@ struct tcphdr { cwr:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u16 doff:4, - res1:4, + res1:3, + ae:1, cwr:1, ece:1, urg:1, @@ -70,6 +72,7 @@ union tcp_word_hdr { #define tcp_flag_word(tp) (((union tcp_word_hdr *)(tp))->words[3]) enum { + TCP_FLAG_AE = __constant_cpu_to_be32(0x01000000), TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000), TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000), TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000), @@ -78,7 +81,7 @@ enum { TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000), TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000), TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000), - TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000), + TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0E000000), TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000) }; diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index e45222d5fc2e..b0b8bbfa9386 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2165,7 +2165,7 @@ static void tcp_v4_fill_cb(struct sk_buff *skb, const struct iphdr *iph, TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + skb->len - th->doff * 4); TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); - TCP_SKB_CB(skb)->tcp_flags = tcp_flag_byte(th); + TCP_SKB_CB(skb)->tcp_flags = tcp_flags_ntohs(th); TCP_SKB_CB(skb)->ip_dsfield = ipv4_get_dsfield(iph); TCP_SKB_CB(skb)->sacked = 0; TCP_SKB_CB(skb)->has_rxtstamp = diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 0e5b9a654254..33e73cefcdbc 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -400,7 +400,7 @@ static void tcp_ecn_send(struct sock *sk, struct sk_buff *skb, /* Constructs common control bits of non-data skb. If SYN/FIN is present, * auto increment end seqno. */ -static void tcp_init_nondata_skb(struct sk_buff *skb, u32 seq, u8 flags) +static void tcp_init_nondata_skb(struct sk_buff *skb, u32 seq, u16 flags) { skb->ip_summed = CHECKSUM_PARTIAL; @@ -1384,7 +1384,7 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, th->seq = htonl(tcb->seq); th->ack_seq = htonl(rcv_nxt); *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | - tcb->tcp_flags); + (tcb->tcp_flags & TCPHDR_FLAGS_MASK)); th->check = 0; th->urg_ptr = 0; @@ -1605,8 +1605,8 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue, struct sk_buff *buff; int old_factor; long limit; + u16 flags; int nlen; - u8 flags; if (WARN_ON(len > skb->len)) return -EINVAL; @@ -2161,7 +2161,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, { int nlen = skb->len - len; struct sk_buff *buff; - u8 flags; + u16 flags; /* All of a TSO frame must be composed of paged data. */ DEBUG_NET_WARN_ON_ONCE(skb->len != skb->data_len); diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 2debdf085a3b..e373ca997ee0 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1735,7 +1735,7 @@ static void tcp_v6_fill_cb(struct sk_buff *skb, const struct ipv6hdr *hdr, TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + skb->len - th->doff*4); TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); - TCP_SKB_CB(skb)->tcp_flags = tcp_flag_byte(th); + TCP_SKB_CB(skb)->tcp_flags = tcp_flags_ntohs(th); TCP_SKB_CB(skb)->ip_dsfield = ipv6_get_dsfield(hdr); TCP_SKB_CB(skb)->sacked = 0; TCP_SKB_CB(skb)->has_rxtstamp = diff --git a/net/netfilter/nf_log_syslog.c b/net/netfilter/nf_log_syslog.c index 58402226045e..86d5fc5d28e3 100644 --- a/net/netfilter/nf_log_syslog.c +++ b/net/netfilter/nf_log_syslog.c @@ -216,7 +216,9 @@ nf_log_dump_tcp_header(struct nf_log_buf *m, /* Max length: 9 "RES=0x3C " */ nf_log_buf_add(m, "RES=0x%02x ", (u_int8_t)(ntohl(tcp_flag_word(th) & TCP_RESERVED_BITS) >> 22)); - /* Max length: 32 "CWR ECE URG ACK PSH RST SYN FIN " */ + /* Max length: 35 "AE CWR ECE URG ACK PSH RST SYN FIN " */ + if (th->ae) + nf_log_buf_add(m, "AE "); if (th->cwr) nf_log_buf_add(m, "CWR "); if (th->ece) @@ -516,7 +518,7 @@ dump_ipv4_packet(struct net *net, struct nf_log_buf *m, /* Proto Max log string length */ /* IP: 40+46+6+11+127 = 230 */ - /* TCP: 10+max(25,20+30+13+9+32+11+127) = 252 */ + /* TCP: 10+max(25,20+30+13+9+35+11+127) = 255 */ /* UDP: 10+max(25,20) = 35 */ /* UDPLITE: 14+max(25,20) = 39 */ /* ICMP: 11+max(25, 18+25+max(19,14,24+3+n+10,3+n+10)) = 91+n */ @@ -526,7 +528,7 @@ dump_ipv4_packet(struct net *net, struct nf_log_buf *m, /* (ICMP allows recursion one level deep) */ /* maxlen = IP + ICMP + IP + max(TCP,UDP,ICMP,unknown) */ - /* maxlen = 230+ 91 + 230 + 252 = 803 */ + /* maxlen = 230+ 91 + 230 + 255 = 806 */ } static noinline_for_stack void From patchwork Fri Dec 27 19:12:02 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: 13922097 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) (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 9074F1F9405; Fri, 27 Dec 2024 19:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326773; cv=fail; b=EMrd20S9xwKWJJvrxVUe4wvNFOFQ2E4vbka0kUrnKdb1aBu5nt7l8ZzEfxdIcL8PoD2NQengt7grepMYhVphiWkUbjvo2wX6NVEm6mv+Tb2/TUT7zfaVna4iOoDAeZ8E95pD/blTcq8Ue4Xb7rHyAfFIZpRpD1r96yhxNbTb5ec= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326773; c=relaxed/simple; bh=mtpprwWOrrtuVp6ibY5rP/eipJJmjic/wQVn+ofJYi0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=iaBkthgNiCiJ8k8uA5fSlOAN965I1mBM5J32fA5O2F3QhAbq/syO3IPkYafnXY+CNI/vsdI7y4NPNbHW98oIYirhHy/kwPzxRIAhHpbMCkMcCEmg25ZwbYlBVvi2xa6VIqgBo/mowR6rOuxVY63JdItQzM9cpdTQz7YS3AwBGjk= 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=EDTNYCDu; arc=fail smtp.client-ip=40.107.22.66 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="EDTNYCDu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Vx40OS1o5qTgdkwLBRVYPLL/X2kM3wLr8fDnOFCel37R022gbW0PpAiapJhJAGkA+52zwA7X45r0YwxKYc7SdEMd8xDZLmsYiM/VbGRklB498x6ojgwnAXm9nb/NzfNKXeHdsDmz/VfRQ68LAXdGtvLri9lj2zaHuPBI44FvIXZZDpcsVn3FgiW9CpowyNXzdlvlVLqqTU3lGxupekjR0hPJOqc8JDuaT+hgCzv2o720O1fJqQapxcnozCxhBsTH5AXXEU5X9jZ8fGh7CSyNmNlHli6fs361Icx7tt/awCKXvaBm8eWWlZAL/EtpZ0kZf+1486ZoNHShuLBQT4ViBg== 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=r+GA9ZAEJCNCHB7hW5C+kom/iLrrAaNs/Q/YYKoaKyY=; b=KWUSGkSx8+ygoeKnGyeH1xb/KzBR9luQ3eGk9KBTlWzKe1GgJIpXF7Cp/oHyso0vS0swmssgVlzQ4F95uvWz/LoRn07X4NyH2m9I+0xHotSMffsBymy3fxJ4CavKpzWwiWQvEiYSrjMshP9xf37SJ788JOnHprARIGIOUQhFELvDOUOy0RcueEBuFUOBTPXR6tDPNHyhIGaK6OoYd0QQ/gSdRpvLgy4G6hwTkNHLfj+w2hj/tvWUlGRNN/uPv5oJ41eTwP+sm5/aXpoUieG1DXXZcwsS1QmsJhhWs74UT3VGKhUXvirKCRpvBJDxLOBhGPjYiRjdCgicA/57e7ftUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=r+GA9ZAEJCNCHB7hW5C+kom/iLrrAaNs/Q/YYKoaKyY=; b=EDTNYCDujKn/h89uwRhQFvWlZhvKYKlU3tBSFYzv8T/Msr4ZogYaiWlHJUnMIMO7VAMlBYoUUVmnkiJ8g0v758IerHLTJPU3rp5G+tUXlJkVbypHFr+iVX7Ymd5biVLwmN99VMzR2xdrU2pyzJdFgB12d4NZt4IF8NRINh5KrNnjUeQlAYTNFDK4M+gq0FGuaG8F3EKkLgPE5ezdla5UH6+sxIQJEM3OFB+cDpIbgHoBLDwkqGAf60IKSGrkU7rIqUDRS+nOhnNlfYvwU0eQOHdS9aWzKCgARE+3lIt4qDeVbOOjK15tisDMNvjrV+BbS7Q8warRHoxl4Nbio16a5Q== Received: from PR3P250CA0004.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:57::9) by AM7PR07MB6391.eurprd07.prod.outlook.com (2603:10a6:20b:13e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.16; Fri, 27 Dec 2024 19:12:44 +0000 Received: from AM4PEPF00027A5D.eurprd04.prod.outlook.com (2603:10a6:102:57:cafe::94) by PR3P250CA0004.outlook.office365.com (2603:10a6:102:57::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.15 via Frontend Transport; Fri, 27 Dec 2024 19:12:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by AM4PEPF00027A5D.mail.protection.outlook.com (10.167.16.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:43 +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 4BRJCH2V011940; Fri, 27 Dec 2024 19:12:44 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 05/14] tcp: reorganize SYN ECN code Date: Fri, 27 Dec 2024 20:12:02 +0100 Message-Id: <20241227191211.12485-6-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: AM4PEPF00027A5D:EE_|AM7PR07MB6391:EE_ X-MS-Office365-Filtering-Correlation-Id: 96e0d846-dfc7-436b-80c8-08dd26aa7113 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|1800799024|36860700013|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?68BLCE+tUQArbKCy6MSKUaTwZhJqjgq?= =?utf-8?q?0MyiOGmnPrCl5S4TuPAcmI8zzbo3neapSNpWobtC+gS4jQx86IjHLn2VB9jn6CVVE?= =?utf-8?q?TzL2ho/3kvHCibFBQ4Ee8kVZKF7O1VkU4EX0c/GrZVpi/UIBmwWWMN/KpGQ1hsfET?= =?utf-8?q?PwNirJWRExmUbRmC4/Hbrkp8v7NHrgKh4K/LwA0EpbynZYKt4uQcj+d9Z0enmEyim?= =?utf-8?q?YfcKkom+g4DX/o9Rfci4N4NV8fRlodHGxCl6uldjiuzxIxZK66WHghAnWG4BbFtkj?= =?utf-8?q?rW6WrzmmR+hFuykWB60EsTBlcT5Cz6Tad/5klimZ3cId7DWmHpcnUPK4JXb8PPX0C?= =?utf-8?q?FrAnMnAOLHR0qK4InSW4oLVTXPKslYFZcjJrmsceZ9dMaoh9MmXUdrKO/pGz+CIVm?= =?utf-8?q?U0CeXxmGpo/t9NIQQLRMW4bET1j2Pun61Cf/qwv9NZpovKzqJFN6uWjjwX+n4hkNh?= =?utf-8?q?r67A8GiLxXGUogN330Z/lKmxYxdKySJSk85+1cPNckl6lTvKP5sVe8Mf6wGH2w46v?= =?utf-8?q?rv/djuPrrLIm+syFIGd4AbLZ9tM3jjUpDXIEt+GUuUDbLAj6l/ncr1SVo7WMy3uEu?= =?utf-8?q?Adic3qIKmVJsQErLF7MPTITofDs8L+6k1cSd0bwL8skGdtNCVPBcisB9NlvxsYZKR?= =?utf-8?q?A6zzZUOXf8Cp5AY7FD9iur7FfZA/YV6Pbaba3JjKlaOUQvXzvye0r2eKZqG1j9K06?= =?utf-8?q?WSILBZYQExqTTFGNxddXQcjvTlVd1Z1tA4aqZ0/SyDa1HEhhw0caoDYny40jWFmXW?= =?utf-8?q?Bxer0PZXLqhtV5KKULmgeU6oeoBsyOPsRGo7zPLk7hbsifbWqcGa+LPT46jKsOXjB?= =?utf-8?q?MjeInS7siSKgngidKkn3FvRRIFr+IfqeXI9RDAaPaJTt+RLE7X6UJlnAEkyKINx65?= =?utf-8?q?HtI1lKZ9L33a/sEjq6ajdZfBfUocHIbmKqSt7qgrGWY8mJIKN4LG3z3XM7T1BueKs?= =?utf-8?q?dSRG0QT+ra0GMc98+jbWWAHRLBNn47uTPm/ythIfKES5OvD2tHUdQ+j/Yy0dsePQT?= =?utf-8?q?xX0QwFy+RasNj+m0oCpF2oab90gJsdpUb/n0u2tkaLzA0xAw/klrY7OwJs+yQD52l?= =?utf-8?q?KdN43BLKsViU48DEaSNhhOQZqAKKiCs4NVzfMTwCr+qZmSHxG51iTAr8t5AlyqevV?= =?utf-8?q?m+YlI4JWBpe9B/xEqP5Hg1BRXl6RXM5lPk1a+Hd7jO7gwR30IH24LO49jniUMxf+A?= =?utf-8?q?jIqphDS0f/sSWGEkAPNJ9Pd2LNzcJns58Khz1uwd6OdbuI7Yy5g7siWarXfcMpWfw?= =?utf-8?q?7YRwfLjUdp2otHsyuZOreBKT6mxssHkdfmXyliVEH7zftQ9CSPNMA2K+iZ8shg1nY?= =?utf-8?q?VM98Tqd6fchoY4bQLxzXaQB67ENXwMWpbFOqRInHiD6lAK/sX9jKFqFiFNCtD3jSj?= =?utf-8?q?kaxjiMrx7XJSRtNSKdRXO2vtg812mEC5z0egyxFP/2hDVMpQjLXKIBOaIMBQwkppz?= =?utf-8?q?+nwz4zhB8P?= 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)(376014)(7416014)(82310400026)(1800799024)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:43.8627 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96e0d846-dfc7-436b-80c8-08dd26aa7113 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: AM4PEPF00027A5D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR07MB6391 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen Prepare for AccECN that needs to have access here on IP ECN field value which is only available after INET_ECN_xmit(). No functional changes. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- net/ipv4/tcp_output.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 33e73cefcdbc..fde40ffc32ff 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -347,10 +347,11 @@ static void tcp_ecn_send_syn(struct sock *sk, struct sk_buff *skb) tp->ecn_flags = 0; if (use_ecn) { - TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_ECE | TCPHDR_CWR; - tp->ecn_flags = TCP_ECN_OK; if (tcp_ca_needs_ecn(sk) || bpf_needs_ecn) INET_ECN_xmit(sk); + + TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_ECE | TCPHDR_CWR; + tp->ecn_flags = TCP_ECN_OK; } } From patchwork Fri Dec 27 19:12:03 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: 13922099 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2061.outbound.protection.outlook.com [40.107.247.61]) (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 EA6911F8AF0; Fri, 27 Dec 2024 19:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326776; cv=fail; b=QV16X8gf0w5uFDpgL/DucXK94TjHJDZOOYfxaQY6Msm5bU72ISunUEhpBw/EMurtXYBpbC7zld3ZQpRPwdOAnAzrga2O0t2u697rCuqxQ8UU7lbD1h3JG2DtCa4dEfdErs5pMPRJ6sRR2FabFm00VMWx+QaeMpKiHHLE0QsUDjA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326776; c=relaxed/simple; bh=UEW0ed4J2/qSG3G1YZN9et+ZmquoEkvZs57N8NehlbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=klmDSxENFv9ZGZkCgRjITe6+/pvWv04mfV5eLkMfIh3BFXpMyuqaZT7y6Gh0xf01W2C/SVT9f4ah9RTnLhjyjs+jkoR+N7HnoDd3TOciHjzTt16Am3U5hsgEgF1B82GkfxsX99KZPD7QJI9S52lMuL06kzC1QOv5cuNSBm0rhcA= 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=SuQ0LyzL; arc=fail smtp.client-ip=40.107.247.61 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="SuQ0LyzL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ybccg2EaQkqF2As+me96WoUUXzSBZqwmQ8AZinItzDQ8qza8vv3/dgQJjhUd6/q0CHgzVb+oiWiG2LXfauwBNjVZP0xrZqGiMXD7QrSr4z8Gn9SE1Ww9jJSMtfkSUhb8cJiuDTrRuKQfMwTCg24d4nx2Ng7Gv46aMIr7bB1A9luHj2A65YWxDSv+bwyPTiiV/eUKwieKcVjB9CA+x6Sz20O1dKpYsuu0YAnIgRTyTYJEig6WLIgTI5KsQwkdx2PrJ995NRBy+GrMJ6XTc4vdTTCjwj41HB28TT//eSP946bbEDLg9fUloEK73ADFRtrklL7jai/9nBQ0cGwgGoPz9Q== 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=w1PFN8qO9zvJ0vyV4Mr9uN8oxSmktBTjV8wyvOKiPVw=; b=pevuB/c15eMl/hr6yHeg9IaIYBLRwvSLd83um5EJHtZW+adbW7l9iRrAFnZMbWdTRNqGT6K36nkAVqN562KbPH50sqs6PocIYtfj7VyusZxm2DLisDMgs+V523O00W3H+tphWKBaZrI6NrDwGdGbf4fKIYKqVbJHSe3oU+VGVvdJQDVeLmGKG2EE8ucyRxdb0dhlF+/cw7nWmx9M9JkpT2OJsACAnxc1UnufgHdtKzXBs6VgIImuKLL0j39ckuEUcNlGywgH0eWSmhG3Q7LYPoUJWpxmIg+DfphBPC+YW8Hf9qI2bHBfO8onAnSb4/AbHsbqcabPPyqZdubxkOjUGQ== 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=w1PFN8qO9zvJ0vyV4Mr9uN8oxSmktBTjV8wyvOKiPVw=; b=SuQ0LyzLlqHpBr6Hvbp+nNngYCoZqCIX/4KiBWBWbfayBlCT0V7BTkNjouqpCN31dHW5S7UwVhgAo34bTNY9OnxZOb42WPoArUfY+PCVjjK+m2cOBbDqOqgQBcFLzq3SkYLlZDH8q1Xe6BzybRGlB6Jv9RaYLZptH3vMIb/lloWUmshUAAjzm2aY9u+FMID+HB655vNVlmo0pAoW160PrOmf+Fg7S7nvfdV6mNgBBv+D4jLP/BJDWhAlHvh2IPaCobRwzH7S/BX5fEbAcMmdnKn8at9bx4rEpQGeRjiTR/nJJn7crFbSs/4a2A42k3uPEG3Z5cd9I7DKCqQZqzsRYg== Received: from AM9P193CA0013.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:21e::18) by VI1PR07MB6720.eurprd07.prod.outlook.com (2603:10a6:800:179::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.16; Fri, 27 Dec 2024 19:12:47 +0000 Received: from AM4PEPF00027A5F.eurprd04.prod.outlook.com (2603:10a6:20b:21e:cafe::f2) by AM9P193CA0013.outlook.office365.com (2603:10a6:20b:21e::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.15 via Frontend Transport; Fri, 27 Dec 2024 19:12:47 +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 AM4PEPF00027A5F.mail.protection.outlook.com (10.167.16.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:45 +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 4BRJCH2W011940; Fri, 27 Dec 2024 19:12:45 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 06/14] tcp: rework {__,}tcp_ecn_check_ce() -> tcp_data_ecn_check() Date: Fri, 27 Dec 2024 20:12:03 +0100 Message-Id: <20241227191211.12485-7-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: AM4PEPF00027A5F:EE_|VI1PR07MB6720:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e4863fa-7477-44c7-fa25-08dd26aa720f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|7416014|376014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ws4D5lqKJeXFxV9RGceMzL9+tLjcC7r?= =?utf-8?q?KEOi3CpWEZ9p3qSX8wxMHuvjJwz2RvwAMyM4pVUU2zF4uX+Q1UsDCs8FFW5tH5Hak?= =?utf-8?q?jvdDeXrD/p7HT7df9KDFxuF5mXLu6Px0NTdQ2IMChmxW6/B0gCb7nJCW9kjDF/y+M?= =?utf-8?q?wGlkdSKde9nXW/rFKydb2JzmtpYtkruFc229P1FofK2iItBajVfV7vYQWusgSPSBz?= =?utf-8?q?KzjLKSMiK2Bzga+fAaJylvtHPPLlDwagTkSHqBEOUjFLocd7U4hvCo2FGSt97tJPL?= =?utf-8?q?85gKMBBFETPvWQc2sAOQ/qcl1aA3+j/7sBtO7MaHMhAHBmi8QF6ZxG0riJePVS1h2?= =?utf-8?q?ZTVTohaPQBirdi/j62e2shE6MyTXr/5WdF7yhz7v4EgwCkqKW9H2gf8vLY/zJCSIt?= =?utf-8?q?OLuEbb8wCweW7HBredZ38w3kPvEQn1svzFVKLr4kBHg10kbVrFP/J1NqmZ4ZlU/jx?= =?utf-8?q?dkuKT1OlXxDygD2YEV5kO5sFVaUaHCRWeRrCw9sSqPI6+B9ZVo90V2SgU5q6Xt+/g?= =?utf-8?q?HuAE70PubIZg3Ni6KIsseuQDis2kmbH6PqzkMiPlo4Btlivkq5mQJzEhPRGs+9/3N?= =?utf-8?q?StUKFDErJQFq9UntUQ3vmoxDyfWclA2u5mQt6flV6drMn4DW13VHLKj74+PqpYGj3?= =?utf-8?q?pYCFoei0jjPrK0KnkWpwQN8uJJw/65mYzOXZ0n/cVU4/SxpNS6lLi/b47WvjQ5Xb/?= =?utf-8?q?d8WRMqemUyL97DnRwDQ0B/VCx2rhHXFGTs5MI7xV/pg/qqPgfCQC9CVaXeVh4qkXC?= =?utf-8?q?GOpW6Xhd+YdcHGhPpJWkwSikIfpec89IkT984Vr3D+EOheuOxfdOiTt/eYnHe2s4t?= =?utf-8?q?8jtORtslXmZex3W0JOVlUmdb4ZCHS+5oOhXraw/TajTq6jt+P7oDT89C2Jg04ltLh?= =?utf-8?q?Ek+CHgECrYlHr+N25OPnXvpVlMmfcbD4LSnMxjhhaRqScB/2HDRg2n4fIRjWm86KV?= =?utf-8?q?Mjx+NbNjPpZgxZ+Ll7Dy924TIOKR5UtSdcwGhhvuxify/Ye2z2dc5pxbvrlID3cz2?= =?utf-8?q?Xj3pSLexpnA3aTSJMX7Rf/AkNO9X1L3lbtavQP6DncdazEnltaRzTyVjdxxvRp8vw?= =?utf-8?q?g5PeSlP/Mh3dPPtHbEN8XGOTL3GEP6xFvKg1R2t1DQQWZpRa0wsMuw7OsBZ6B3O/4?= =?utf-8?q?InzD6He1i0Tav5RqwM+JlWJKayjBTznf8I3Rr4VWZcplBFiHOTKs9cCMz3AbHIQES?= =?utf-8?q?09vb7ML9JTHAdDH3W1RHuiyDNLhNfdKavoCyiVAy6J2GuuCnn6SCJWjm/ZpkSmExI?= =?utf-8?q?Fx6bMfKuU7sIuPoLQMbzHjFqwmvAdThwBz8eE9O12zUD5PvcYdd/QLDdFXRvNEoHz?= =?utf-8?q?a985UgFrM+rOpjRdVnoc4R3g3Q2HcZpCbfR9O6nF7gc2lwMvb/aSWmY/gad8OGBvA?= =?utf-8?q?7gvkPHBIL7TSU61I3aTyaZuJQOsRIlpfgvm8inKjRMEAiipf33KiqFodeIUWHjK1q?= =?utf-8?q?Z/oKqhw3Iu?= 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)(82310400026)(36860700013)(1800799024)(7416014)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:45.5330 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e4863fa-7477-44c7-fa25-08dd26aa720f 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: AM4PEPF00027A5F.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6720 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 Reviewed-by: Eric Dumazet --- 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 eebe3a99aa90..4751f55a79ad 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); From patchwork Fri Dec 27 19:12:04 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: 13922100 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2044.outbound.protection.outlook.com [40.107.103.44]) (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 B51A71F9435; Fri, 27 Dec 2024 19:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326778; cv=fail; b=dZxSHbiNLPn90wq/dqrzkc2aV2Zorz97+tLLMZOhEJHA97//E1mAgy0USAIp033CrxTfsRaqofn1XtJDWUn3AQ+RIbps9XfW8KQirnZIFjq0urNdGbiJ4WexMkFZfchUlFOUHcnfiYdx+0hApVovv3x9eyT+yoqGWPXNi3DqNKk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326778; c=relaxed/simple; bh=vvKl+hRd4P2c+aZzDb6E/7ggWjkmkGN8GiwvcfahwnE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=HJntuppDOzNqfXHAJwDWXvSG7VvIbhKPzVAOuVGpvCwt2wp6y60kfigpzKI/grZMH5tedgDODnUYy06+gkVkd8YE7f97kFTROWiC3LBz8icRQVL0+nbyVl3PBCVYdkLSWEfIZgv0TRRmgnTqNpP9/IzmgqcoowSpyO2QKMu768s= 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=jRTEDt+1; arc=fail smtp.client-ip=40.107.103.44 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="jRTEDt+1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LK1GTpovFIBlR1XvyXruSIZT1X4krwDsXeujeJZbUBGwBISyXfcRV+vp6lr/sMIwTVD7LX2wK+yy0V5Ug47DS5WPBtt6bKluVVIXWcDcq6jGD8RFXM4rXGYNw6J1EiJGPXN1H85KZOSTNVsWYirO96XJ0y2CRkGIC1GvQFiKD4266/PPALSi4J71cdt/eKoEYQDhTfEkTrsW0tZFeIZJZ/iSkxjBHy8X4kYBWhyw7mTTqtVkOecW7F6B+MQeWWbAPemYp0HunXhbV+Lj+ZjfdW9RsGvzYpBwc6VWgfZqwNO/AQ2LhsUIksYl76U34ShOIPYwN4ZHPTtXJYkDxxKvsA== 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=9F9YbHQ4+dUQbRnzdxmTs7ibFUXoiEd2WYHYKLzw36Y=; b=xPKeMMKL67CV7aYdGFMxnapf6TxwxKzah1Zmsh1D9TE+eP4tTvkg+1qr5G4cPQbyhI3CNNzTkMCJC/LydUoNvNiUJHOK8LLqBZXR35WklGOy38rZa8EjTz78H9Nlz0M8fGNPWhOxcJ/R9qm9G7NuZUauNQrBXRHgPUnzZafWOP7hVzDBLzGKJ7I3/ZqUvoZ8X37h1IZGHpAmVgSfgxqa2brynJjPtdXRCsexBgilWnGm9Jy3QHFQAnKBIY8vJNEo2ZsCYn+GNBH4hrzZgA06YwtUIOeDT+gZWq3sWdHtSghJ5t0yIjs6/jfJEwIA1oqj7pqwB+4RVXngiTk870NR8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=9F9YbHQ4+dUQbRnzdxmTs7ibFUXoiEd2WYHYKLzw36Y=; b=jRTEDt+1pROuF9L248df65fi6MJAh2CMWcm//YJn4R8kNJju7+nB1H4mi29luUgHmYgX2Z2UBplhCnDoyo0IkLfhI8a3X3epDfZKJBMcdRXWsDplpkwXkHlEO+PtyqrJgm63TUnnf++NQgHvUqU9YGL1L6Oi5vOFShu1K4fPsr7AEfdl7yTtiIPOB+AkZvHRf70nJyjlG6dseq6cr8XdiysNGNnW4y5npjV4/Fv5PJuaoqrr8p+3JAR5fS3GmPCBIW2qTjrLpG6L8XJzmfQ8+d/LakPEK/ZY7qSUnrfDwX0FbHW4IpatGpi1fOgGziXp7sqjR5+6a55EcyujzwDCCg== Received: from AM5PR0601CA0057.eurprd06.prod.outlook.com (2603:10a6:206::22) by AS2PR07MB9183.eurprd07.prod.outlook.com (2603:10a6:20b:5e9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.15; Fri, 27 Dec 2024 19:12:47 +0000 Received: from AM3PEPF00009B9D.eurprd04.prod.outlook.com (2603:10a6:206:0:cafe::10) by AM5PR0601CA0057.outlook.office365.com (2603:10a6:206::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 27 Dec 2024 19:12:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by AM3PEPF00009B9D.mail.protection.outlook.com (10.167.16.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:47 +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 4BRJCH2X011940; Fri, 27 Dec 2024 19:12:47 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 07/14] tcp: helpers for ECN mode handling Date: Fri, 27 Dec 2024 20:12:04 +0100 Message-Id: <20241227191211.12485-8-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: AM3PEPF00009B9D:EE_|AS2PR07MB9183:EE_ X-MS-Office365-Filtering-Correlation-Id: 28af2c69-09ca-403a-474a-08dd26aa7311 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024|7416014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?TKyOSumrXxweHJRQVO7rkSExmv2A+P/?= =?utf-8?q?IoAuqlgAJbjzed1Skxc3b44mE6e/W5aR9+fPnBEebA73YSGiqgqQsljhTqaS6zfrk?= =?utf-8?q?pX7iZVFtGhcmPoJEfTHRPyZaIc+lZ4RtueWoLKKMj0U3n87Gp3/tvpRf1o7M6G1o/?= =?utf-8?q?dceKb+iXnl9Ne7elrh1N01U7hMuJRR3p1jxdgt+Z4rvSEhdoCeFZ/Qz8WNRhrxlbt?= =?utf-8?q?pD0iPNP/15JNQzZGQbv7SCyn/irOInU5LB8aGYIffHlUETF1f1JCbabeY2uFko22q?= =?utf-8?q?2n6QCjrXYCwtU8wtqJz0JhUw1qmnJ7TXPBWYLR5I2hZuE+r4HqLgYFgzE0Bx0ojF5?= =?utf-8?q?lwTms/2Zkyzb/N+7jYfbUgaqeR6ZbODzeBkplckUTLJSeaBm6Yui2t32nCwoTKqE8?= =?utf-8?q?F2HW8sfBVhgxhnexCK6jMxfLjD6yMpKnvPsoTgq5ABx62izciDbPm9zwx83pa9gMW?= =?utf-8?q?xENVU2tfFXBtddx5GkEDZfQkCQCKQEI08rJrJt+fX6AtC8lALUjc37xKe9Q8RkNhL?= =?utf-8?q?pRjBaoc04vWS/oTVL3LN3IEcOYm/rbrGLfx8Le4t4lpLvrHfgHBAjmGS7M93fU70p?= =?utf-8?q?xz7CK6MOK239P5TX3NEOTtOg8LXYoy6v78N7V5B0EAGFUzeQmBeKo06zwLTsVqBLK?= =?utf-8?q?mPe0Dhk0KSvWRje9MuHNrzUITh8KjicprYq6zC1aX11FPAMBzpYE+ZT/1xHg2H82R?= =?utf-8?q?Mo3MTvfMqjAwaalaxtOOgzJ5jYmjUvektPC7uPCgvi6R8nABtyYm8coEjtFfSM/ac?= =?utf-8?q?cnoirmKAPcCJQYIsgQ+EMHfSCE/rsdTntsRbISCiLTwFqufSFkzZzNcZspWentfN3?= =?utf-8?q?fpTmQq9BUsAmWDob+Hmvow5SYt0Kd48oI1gwRm82u6Bi6DejjBbnBLTxUiZiPhW5I?= =?utf-8?q?i0oTOmZj6SCwi3w1TJEz5LRW4xCRMIYz7VuwClcQtfjuXTzarJLkdS5/n/eJm/ewf?= =?utf-8?q?4qBLXEahKp2fD3rzutcnrsAOpjRN8JQRcGqUo1DrrmLobfOMTu48SP5nC4Adoq2Bn?= =?utf-8?q?H2j8+EqeedG7Ii5vXtQ9Ucii+Fo4rVKY0q3gXOgLmQF+UcjeoX61+60EGQGfgcHd3?= =?utf-8?q?d0d0fUoZxaRq4dKbdjKD/C4f/5rGehUdR/0KcUCaZ92jgsqiNIEbuEZf/OqYk5+qZ?= =?utf-8?q?4uSPvM/WGoSZ5SeouEaF2gstKi8GiWfgkMtfvO2SWfVNXNi7pp0Fj2Xz+TDqo/I20?= =?utf-8?q?+7WsxbIz0gNSdoRAn4APYHYoe6xwClMA7BjtwoKy8B9M485Dljd/K+WGFBUEGldqK?= =?utf-8?q?+Pjf4ZnV3uzzJMA6GT5SH7hRpEs4KafHv0PKwRNwR9/59D2ZQt4QaMNY5h1+OzO0o?= =?utf-8?q?gx7Xn7ahuWDAkcibIGX+NAiV/yxqUXNQMz6gZXmRBIgCwbOf/hUoh8El2N/uO8EhL?= =?utf-8?q?BuBJ9Hrp2UIUtTQIg/dhHuVflouS2Y1yQBmg85ICQgdcZP9qOPyeA85V423wqZhwW?= =?utf-8?q?WRfQ+UG35I?= 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)(82310400026)(36860700013)(376014)(1800799024)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:47.2348 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28af2c69-09ca-403a-474a-08dd26aa7311 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: AM3PEPF00009B9D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR07MB9183 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen Create helpers for TCP ECN modes. No functional changes. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- include/net/tcp.h | 44 ++++++++++++++++++++++++++++++++++++---- net/ipv4/tcp.c | 2 +- net/ipv4/tcp_dctcp.c | 2 +- net/ipv4/tcp_input.c | 14 ++++++------- net/ipv4/tcp_minisocks.c | 4 +++- net/ipv4/tcp_output.c | 6 +++--- 6 files changed, 55 insertions(+), 17 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index c9bab41685cf..4987cb0c59c4 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -372,10 +372,46 @@ static inline void tcp_dec_quickack_mode(struct sock *sk) } } -#define TCP_ECN_OK 1 -#define TCP_ECN_QUEUE_CWR 2 -#define TCP_ECN_DEMAND_CWR 4 -#define TCP_ECN_SEEN 8 +#define TCP_ECN_MODE_RFC3168 BIT(0) +#define TCP_ECN_QUEUE_CWR BIT(1) +#define TCP_ECN_DEMAND_CWR BIT(2) +#define TCP_ECN_SEEN BIT(3) +#define TCP_ECN_MODE_ACCECN BIT(4) + +#define TCP_ECN_DISABLED 0 +#define TCP_ECN_MODE_PENDING (TCP_ECN_MODE_RFC3168 | TCP_ECN_MODE_ACCECN) +#define TCP_ECN_MODE_ANY (TCP_ECN_MODE_RFC3168 | TCP_ECN_MODE_ACCECN) + +static inline bool tcp_ecn_mode_any(const struct tcp_sock *tp) +{ + return tp->ecn_flags & TCP_ECN_MODE_ANY; +} + +static inline bool tcp_ecn_mode_rfc3168(const struct tcp_sock *tp) +{ + return (tp->ecn_flags & TCP_ECN_MODE_ANY) == TCP_ECN_MODE_RFC3168; +} + +static inline bool tcp_ecn_mode_accecn(const struct tcp_sock *tp) +{ + return (tp->ecn_flags & TCP_ECN_MODE_ANY) == TCP_ECN_MODE_ACCECN; +} + +static inline bool tcp_ecn_disabled(const struct tcp_sock *tp) +{ + return !tcp_ecn_mode_any(tp); +} + +static inline bool tcp_ecn_mode_pending(const struct tcp_sock *tp) +{ + return (tp->ecn_flags & TCP_ECN_MODE_PENDING) == TCP_ECN_MODE_PENDING; +} + +static inline void tcp_ecn_mode_set(struct tcp_sock *tp, u8 mode) +{ + tp->ecn_flags &= ~TCP_ECN_MODE_ANY; + tp->ecn_flags |= mode; +} enum tcp_tw_status { TCP_TW_SUCCESS = 0, diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 0d704bda6c41..e30204394175 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -4107,7 +4107,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) info->tcpi_rcv_wscale = tp->rx_opt.rcv_wscale; } - if (tp->ecn_flags & TCP_ECN_OK) + if (tcp_ecn_mode_any(tp)) info->tcpi_options |= TCPI_OPT_ECN; if (tp->ecn_flags & TCP_ECN_SEEN) info->tcpi_options |= TCPI_OPT_ECN_SEEN; diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c index 8a45a4aea933..03abe0848420 100644 --- a/net/ipv4/tcp_dctcp.c +++ b/net/ipv4/tcp_dctcp.c @@ -90,7 +90,7 @@ __bpf_kfunc static void dctcp_init(struct sock *sk) { const struct tcp_sock *tp = tcp_sk(sk); - if ((tp->ecn_flags & TCP_ECN_OK) || + if (tcp_ecn_mode_any(tp) || (sk->sk_state == TCP_LISTEN || sk->sk_state == TCP_CLOSE)) { struct dctcp *ca = inet_csk_ca(sk); diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 4751f55a79ad..0804f146d6dc 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -334,7 +334,7 @@ static bool tcp_in_quickack_mode(struct sock *sk) static void tcp_ecn_queue_cwr(struct tcp_sock *tp) { - if (tp->ecn_flags & TCP_ECN_OK) + if (tcp_ecn_mode_rfc3168(tp)) tp->ecn_flags |= TCP_ECN_QUEUE_CWR; } @@ -361,7 +361,7 @@ 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)) + if (tcp_ecn_disabled(tp)) return; switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) { @@ -394,19 +394,19 @@ static void tcp_data_ecn_check(struct sock *sk, const struct sk_buff *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)) - tp->ecn_flags &= ~TCP_ECN_OK; + if (tcp_ecn_mode_rfc3168(tp) && (!th->ece || th->cwr)) + tcp_ecn_mode_set(tp, TCP_ECN_DISABLED); } static void tcp_ecn_rcv_syn(struct tcp_sock *tp, const struct tcphdr *th) { - if ((tp->ecn_flags & TCP_ECN_OK) && (!th->ece || !th->cwr)) - tp->ecn_flags &= ~TCP_ECN_OK; + if (tcp_ecn_mode_rfc3168(tp) && (!th->ece || !th->cwr)) + tcp_ecn_mode_set(tp, TCP_ECN_DISABLED); } static bool tcp_ecn_rcv_ecn_echo(const struct tcp_sock *tp, const struct tcphdr *th) { - if (th->ece && !th->syn && (tp->ecn_flags & TCP_ECN_OK)) + if (th->ece && !th->syn && tcp_ecn_mode_rfc3168(tp)) return true; return false; } diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index b089b08e9617..64d242571449 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -462,7 +462,9 @@ EXPORT_SYMBOL(tcp_openreq_init_rwin); static void tcp_ecn_openreq_child(struct tcp_sock *tp, const struct request_sock *req) { - tp->ecn_flags = inet_rsk(req)->ecn_ok ? TCP_ECN_OK : 0; + tcp_ecn_mode_set(tp, inet_rsk(req)->ecn_ok ? + TCP_ECN_MODE_RFC3168 : + TCP_ECN_DISABLED); } void tcp_ca_openreq_child(struct sock *sk, const struct dst_entry *dst) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index fde40ffc32ff..c2763c3361ad 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -322,7 +322,7 @@ static void tcp_ecn_send_synack(struct sock *sk, struct sk_buff *skb) const struct tcp_sock *tp = tcp_sk(sk); TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_CWR; - if (!(tp->ecn_flags & TCP_ECN_OK)) + if (tcp_ecn_disabled(tp)) TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_ECE; else if (tcp_ca_needs_ecn(sk) || tcp_bpf_ca_needs_ecn(sk)) @@ -351,7 +351,7 @@ static void tcp_ecn_send_syn(struct sock *sk, struct sk_buff *skb) INET_ECN_xmit(sk); TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_ECE | TCPHDR_CWR; - tp->ecn_flags = TCP_ECN_OK; + tcp_ecn_mode_set(tp, TCP_ECN_MODE_RFC3168); } } @@ -379,7 +379,7 @@ static void tcp_ecn_send(struct sock *sk, struct sk_buff *skb, { struct tcp_sock *tp = tcp_sk(sk); - if (tp->ecn_flags & TCP_ECN_OK) { + if (tcp_ecn_mode_rfc3168(tp)) { /* Not-retransmitted data segment: set ECT and inject CWR. */ if (skb->len != tcp_header_len && !before(TCP_SKB_CB(skb)->seq, tp->snd_nxt)) { From patchwork Fri Dec 27 19:12:05 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: 13922103 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2063.outbound.protection.outlook.com [40.107.22.63]) (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 0AC611F9AAB; Fri, 27 Dec 2024 19:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326783; cv=fail; b=kjagSiUh1FNuMvr9HDJ6hYh9GLj+I1YeVIjX85HdgGgkTU4XTIsKtNqrnZPLkKV+Yoa3hOKIzYzeka7RAulubyJ33qCxmlXPQG7xHfjFkIT8Dia6f/Z3Bpo/crqfqQhAMy4aLVEQiSR9J8ZzRHphWkdKSt+e55dgGxtAh/YhlUY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326783; c=relaxed/simple; bh=umHpARJWnkKOJ0bJpCO+IC2lpIieyXxdWWWOs007rtw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=cM6xVXFQSSnzNlXH9rJ5qBTCCFNPqO8tdK54wuGe8Cbojo4qZq/h3L+F5AnSXzinfjSyQet0X4IrwIhr3+Pm3BY5l6nTZOxwzK832L+zj6wVsHZ2U3ag98JHcZxcAxMtDaQmvaygeHME6wioAOeEPL8RaxuTufuNQNutaBxJtXQ= 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=kycMgfOw; arc=fail smtp.client-ip=40.107.22.63 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="kycMgfOw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EfjjscPKJMiaOzFtnKnEJh5uVz3GKQANGmjcMdKxh6je2W6yj+c9RHDD3HCUwj2pbbyOY+Jq/udR4c0D4kT6oHb4hcNRrRZW29cMyWBMyXgWbXLk7SiTRu8s2qUUZgIGBe0R7gCiBulZxsf/Hpu1xQyRbLH7bUW+87vCkjb7YYz7RmLaiSHN6iIcgkDBK4bg9BxfL/xTGu5BZh7RyzfszSQMfqxhJkjQ+1C+z32EXa6cFxgvNcUKskofOUHBNA34zSmIAcoFi93CBlppk7VSVptock12Fn7d2/syMxouNOmHXssNA+h8vDqhNlpTLmwjkBVt2cuqBBktG0quWDka/Q== 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=/Y96pwwXluKBiDGedF/m9r1dWu57GoaAE8NL0KEOm3k=; b=AJ16DYJbCYZQC92Zbs9Ialzql+91tERwKRhr8dvtniiXBBGH3Wa1EqfRWs7phV46CNl6qKT4AVfBLmxHfqarRMVp1ii5i5HpYHsEkw3Y4FsUOEx7/yBnusVg8pIYe8LbWKY/Ko1219Dsnj/XWcJqLdulaA4d/YaetncHudW1AiUqWhdNfHYR4QmbTcBgYsyr8Ye8KaFheFiV0Y27FMaHIbMoWZfDjnR9owtcIsDBTqX+mkNvAMrgzlOnS+y7zymgnh6ehm4U/7iLM/qLsRQJ1/Y77QWk96uwLNzzCv/1UgT4nE1kSre+FF9XJc3JfcIvwloqBYLoBr7RxAEFsGfoMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=/Y96pwwXluKBiDGedF/m9r1dWu57GoaAE8NL0KEOm3k=; b=kycMgfOwaulAaD4mSTZay9aWTuKAsPVXg5Eau37b0ILPFp2fPlooMDt7vWPDElENMYEUT+q13t9zAMhXuhtTXTYEHGgG6+Up5VwoqmT4aX1ziOXwq8qqrDcv2T3qN9LE3R4wuTpMpEVV2vIF/nEl9IL5YKp1gv0nRfcvlUQlXr4cw6d4X/whQ/Q1jXbwj8F3Zusl9RdixHX5lwtAVf9W51sDjZhaLizc52Kw2VvSkLcFUoOBeq+l2bNtw8acl4OlxDTCTpCSgZ+FJKzFOMFsNneD58IZ3RSU38eM9rCuBHcCGRd7caxCm2ON8LdWpPm54aat7ZGTjssSbMEgNQxk2g== Received: from AM5PR0601CA0078.eurprd06.prod.outlook.com (2603:10a6:206::43) by VI1PR0701MB7007.eurprd07.prod.outlook.com (2603:10a6:800:197::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.14; Fri, 27 Dec 2024 19:12:49 +0000 Received: from AM3PEPF00009B9D.eurprd04.prod.outlook.com (2603:10a6:206:0:cafe::2b) by AM5PR0601CA0078.outlook.office365.com (2603:10a6:206::43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.15 via Frontend Transport; Fri, 27 Dec 2024 19:12:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by AM3PEPF00009B9D.mail.protection.outlook.com (10.167.16.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:48 +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 4BRJCH2Y011940; Fri, 27 Dec 2024 19:12:49 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 08/14] gso: AccECN support Date: Fri, 27 Dec 2024 20:12:05 +0100 Message-Id: <20241227191211.12485-9-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: AM3PEPF00009B9D:EE_|VI1PR0701MB7007:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bc0f401-7eae-48d9-62cf-08dd26aa7410 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?iD5EK+z0fDkbAvrYTPA6Sx8HBiGN3Cv?= =?utf-8?q?mAelStpQp3htitY6lLR38u4v28ptgwAnIfdvfYlcYbT6nGhTT9slUT7f28XrQv//w?= =?utf-8?q?eL8RJHqesRg/v5xbIX8s3IJuxhLFi5VWDAXDDIPeTCyVYeHY9zzdAPiWCAdt8cGZ0?= =?utf-8?q?5RSx7K9frq68rHboxLiLdC+xSJ4pWiwDdHzIDxegAbpYorY4gc4CMbrqJEQSzUOw/?= =?utf-8?q?c6eF5MnYXb7eti2FL5P9mcGF+hAG9euK8DVkDsNm4sl3KpUKgBg+Q0IQslMaZX8Zu?= =?utf-8?q?A+qflPv0ehDKrJ5zkxWJLUz8h2jOfBEcz6KGSnqU3C2o6qkMFMdj4VDNClqhm9U2J?= =?utf-8?q?h7pVaNoL9cI250eF6sM5H00xeIK/3aZo/hddy0GN1OotEgr6sxIp80d+U8yRxad1z?= =?utf-8?q?PSalF2cAaVjsgBO1jV00+OeU/ehljR+IcLAn1iyiMW7N9Dlta8DiqPxISO0JdMbch?= =?utf-8?q?Ic8Wql+b8RXpkP/rtb3CB4UL83OQ1I7y5oIkzYq93De5GtjeEpESVUwKWsCcDyP14?= =?utf-8?q?DrnK4CepPIKiJJ9J9i4Bht72VEWSvHORP3t0K60TG67Xd5zBFmvtyvggtocMIsbaZ?= =?utf-8?q?V6fvBM4+48OcllkE3B5DsS108Pr2a6R9bLzZ/ifjXSJJD+9lbhoBf66t7qqPX9Y3m?= =?utf-8?q?LP8Hss5EQaCkTycZ+7I1cTpqhIXJ3PEiNPEPeDDxUZ+QePCtWtZZ8+wqS7UhDeCFp?= =?utf-8?q?qECoTXROkSb8GhUvURnvNrjwM6rRmO8QBj0KjA78iw2T+kiBzW1O4PyD1i2qz0Xcu?= =?utf-8?q?7b2Em1y2Gh6hM5MnK0guZZ4UMg/JRbEF3JV+lg5jnebgIa+Eqznuf+jYArNHBZsvR?= =?utf-8?q?/5iowvQyCa+g8Jqf5SGggNaOOidA829J0HXF2PVxewZeCZVkTK+sV2Efse2TuMTRK?= =?utf-8?q?mPiekG7XJYKbl0GiDkNNEc+ZWP55KL2KpMon6O9D2AP3TgxkRMeVhMADQCq6lAtgT?= =?utf-8?q?ozoJU7n/dpuD3/sHIzZopgtjuMUEPIjYi/nQw6lutBcY7QXwh9pSMTVqCMqfKIVN1?= =?utf-8?q?RUfA8Xm8fy2hOLj1fououe7KP0chec8Jl/OmY2M4rqTyusFSbMZFczymoFOqC5Eco?= =?utf-8?q?a85nOFhsOjWUWq8rYEnNzDS9/Z69UZu0MjPjHo9V/p4Y2SeTeU6z65XTTCvZaOfFa?= =?utf-8?q?d7wqq5TRhNE5weqYqsNQgnWGJ0G4MiT2nfEHMYKpN9Xa15VHxf9BUFhdwoeMnr6FH?= =?utf-8?q?6G/PpExF7FR+/+Fcl9PNo1FCGbeDu3bytc4MXCw9NhGkIddqwKipM3+d5SokqD/1U?= =?utf-8?q?U9KfbuiJB56sf4K/wtgXfHH6W9Pz73YkTdIzHULarUeh6+dGP8htFf14G3S6q75OR?= =?utf-8?q?cEUu0cYjLBk17GJ9+gCMVowgTI/mXhIc9c4AmNWq3zgcrAkErLf8t3gkWZo+2Jkbx?= =?utf-8?q?aL1XHscJRdqTxQwagWEDa+qYsgFWGGG2PefpIJDSHnNq71ZlLQJIbU=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)(376014)(1800799024)(7416014)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:48.9067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bc0f401-7eae-48d9-62cf-08dd26aa7410 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: AM3PEPF00009B9D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB7007 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen Handling the CWR flag differs between RFC 3168 ECN and AccECN. With RFC 3168 ECN aware TSO (NETIF_F_TSO_ECN) CWR flag is cleared starting from 2nd segment which is incompatible how AccECN handles the CWR flag. Such super-segments are indicated by SKB_GSO_TCP_ECN. With AccECN, CWR flag (or more accurately, the ACE field that also includes ECE & AE flags) changes only when new packet(s) with CE mark arrives so the flag should not be changed within a super-skb. The new skb/feature flags are necessary to prevent such TSO engines corrupting AccECN ACE counters by clearing the CWR flag (if the CWR handling feature cannot be turned off). If NIC is completely unaware of RFC3168 ECN (doesn't support NETIF_F_TSO_ECN) or its TSO engine can be set to not touch CWR flag despite supporting also NETIF_F_TSO_ECN, TSO could be safely used with AccECN on such NIC. This should be evaluated per NIC basis (not done in this patch series for any NICs). For the cases, where TSO cannot keep its hands off the CWR flag, a GSO fallback is provided by this patch. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- include/linux/netdev_features.h | 8 +++++--- include/linux/netdevice.h | 2 ++ include/linux/skbuff.h | 2 ++ net/ethtool/common.c | 1 + net/ipv4/tcp_offload.c | 6 +++++- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 11be70a7929f..7a01c518e573 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -53,12 +53,12 @@ enum { NETIF_F_GSO_UDP_BIT, /* ... UFO, deprecated except tuntap */ NETIF_F_GSO_UDP_L4_BIT, /* ... UDP payload GSO (not UFO) */ NETIF_F_GSO_FRAGLIST_BIT, /* ... Fraglist GSO */ + NETIF_F_GSO_ACCECN_BIT, /* TCP AccECN w/ TSO (no clear CWR) */ /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ - NETIF_F_GSO_FRAGLIST_BIT, + NETIF_F_GSO_ACCECN_BIT, NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ NETIF_F_SCTP_CRC_BIT, /* SCTP checksum offload */ - __UNUSED_NETIF_F_37, NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */ NETIF_F_RXHASH_BIT, /* Receive hashing offload */ NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */ @@ -128,6 +128,7 @@ enum { #define NETIF_F_SG __NETIF_F(SG) #define NETIF_F_TSO6 __NETIF_F(TSO6) #define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN) +#define NETIF_F_GSO_ACCECN __NETIF_F(GSO_ACCECN) #define NETIF_F_TSO __NETIF_F(TSO) #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) #define NETIF_F_RXFCS __NETIF_F(RXFCS) @@ -210,7 +211,8 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) NETIF_F_TSO_ECN | NETIF_F_TSO_MANGLEID) /* List of features with software fallbacks. */ -#define NETIF_F_GSO_SOFTWARE (NETIF_F_ALL_TSO | NETIF_F_GSO_SCTP | \ +#define NETIF_F_GSO_SOFTWARE (NETIF_F_ALL_TSO | \ + NETIF_F_GSO_ACCECN | NETIF_F_GSO_SCTP | \ NETIF_F_GSO_UDP_L4 | NETIF_F_GSO_FRAGLIST) /* diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index deffb9a0284f..e3742dfefad0 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5140,6 +5140,8 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type) BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_GSO_UDP >> NETIF_F_GSO_SHIFT)); BUILD_BUG_ON(SKB_GSO_UDP_L4 != (NETIF_F_GSO_UDP_L4 >> NETIF_F_GSO_SHIFT)); BUILD_BUG_ON(SKB_GSO_FRAGLIST != (NETIF_F_GSO_FRAGLIST >> NETIF_F_GSO_SHIFT)); + BUILD_BUG_ON(SKB_GSO_TCP_ACCECN != + (NETIF_F_GSO_ACCECN >> NETIF_F_GSO_SHIFT)); return (features & feature) == feature; } diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bb2b751d274a..1367c2883478 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -703,6 +703,8 @@ enum { SKB_GSO_UDP_L4 = 1 << 17, SKB_GSO_FRAGLIST = 1 << 18, + + SKB_GSO_TCP_ACCECN = 1 << 19, }; #if BITS_PER_LONG > 32 diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 2607aea1fbfb..d6569fa35f36 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -35,6 +35,7 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { [NETIF_F_TSO_BIT] = "tx-tcp-segmentation", [NETIF_F_GSO_ROBUST_BIT] = "tx-gso-robust", [NETIF_F_TSO_ECN_BIT] = "tx-tcp-ecn-segmentation", + [NETIF_F_GSO_ACCECN_BIT] = "tx-tcp-accecn-segmentation", [NETIF_F_TSO_MANGLEID_BIT] = "tx-tcp-mangleid-segmentation", [NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation", [NETIF_F_FSO_BIT] = "tx-fcoe-segmentation", diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index 2308665b51c5..0b05f30e9e5f 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -139,6 +139,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, struct sk_buff *gso_skb = skb; __sum16 newcheck; bool ooo_okay, copy_destructor; + bool ecn_cwr_mask; __wsum delta; th = tcp_hdr(skb); @@ -198,6 +199,8 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, newcheck = ~csum_fold(csum_add(csum_unfold(th->check), delta)); + ecn_cwr_mask = !!(skb_shinfo(gso_skb)->gso_type & SKB_GSO_TCP_ACCECN); + while (skb->next) { th->fin = th->psh = 0; th->check = newcheck; @@ -217,7 +220,8 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, th = tcp_hdr(skb); th->seq = htonl(seq); - th->cwr = 0; + + th->cwr &= ecn_cwr_mask; } /* Following permits TCP Small Queues to work well with GSO : From patchwork Fri Dec 27 19:12:06 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: 13922101 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2081.outbound.protection.outlook.com [40.107.105.81]) (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 331B71F9A8A; Fri, 27 Dec 2024 19:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326779; cv=fail; b=lw3ZlGifdU7L7XLzDe4vLwboEwD1iTYu0iMUsUq+N8zAKFN1PN0qNqiPP2wYu8hqzjiUhwAMhqmzv0EL3Z7TG+1TR1hEiSUCL1axgQZokob6wUQUZU9BFU3jMS3uXyesTnjzLTaGPXVOyJliIO9si+soSm53mMZ8e/LaLZdBqZw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326779; c=relaxed/simple; bh=4j5SJ5HYuPel2Dv+IBBWRsO/17dTAoza3QBOY2Scc+0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=C2fxChsbL9fIjELNUnWe+pbWkqzQ83DmAXekHvommQqoao4Vm8hCW7NmGhuboYAErlrMNIS1CEA6vgwfu8rouCQJGdIVYZie3uGACwikZhYSwwXlKkXpXCr1jpl3jdwcUH5hs178TR2TN5jc6740cvo9arEf4eLZiDs/14qXXKU= 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=tZx0VqIk; arc=fail smtp.client-ip=40.107.105.81 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="tZx0VqIk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QZdeHPC7UaTWg122T1Y98/6oqzYtsL3++oygdMWY95VJQWMdkQ9pnfYHxM9PcCIQ+oOjTJWWmjQfVagnykpuCITGFHHeF9Y9ofB7c3/GpoOgCCVJ5gUjDNHtqplZRx1vcJdoT3SF7FEwERxuvqAwyFDoFXhKpf8LnLiEM2utGWvrgyNcgFoqnEIsXPG35GEnvuFPv8xVBh1BLY3sXQ6Ro7JHgtwY7t1MziL4dwXXMOcM0bK5PwnYI6Qdi8A9diaTh0eFDhJVCZyt/J03s1J/C7fUDA7AVVdaDkOvSWk5IysdkB/rM+/yzHw3G2CP0haWIqwpoeEuzJgS7BeKVPKHiQ== 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=VSA7eqx5WtqjVvMOGIZmeD65xQRrVJgg0ZR6KM5OeDg=; b=InpEBXnVAhDcx84F9UknpgHC6TBGoRoCqNIeq0uUfW7cz/zk4XMBx4MMFrbLr6EgV3x7XhMLi5jn+WCXjRMEgqWfoOgsoMpnMzu8gSqZ8FPx3IqmvrzX4AU4YdrU5mNMFCDVLauD6ED28p7oKKiuinQt0TxaX9ccA8AL4byuVY/s1iMnPhEq/Ptcyk0C4Qx0uhK8EpnelDtGCyB5buFaPiJGmvUApRYOO1vQHfEZvtMOZosO+6SPMHhGKrVdZxk6QkEigPRLwPv0qD21LpyESm2PDIU808aQi7ICx/Dh0CkFERuY+00kZPArDjRa2kFethVtjX+XLR5PqD48rzH7Pg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=VSA7eqx5WtqjVvMOGIZmeD65xQRrVJgg0ZR6KM5OeDg=; b=tZx0VqIkqcI7lafapn9eDI7CjyeBR22AinzznHlzolzh+7u6MEGGa8RxGufyn6qinUGhJtJVbCltfAN+9wBq5kPf2sXxAGCrvj3afROFVeEQ9VHi4mpu8pSBrZstqD+Z11L7amChpOc6dWxtM4gJPrCaiPY55fpHnx41TMLvFynMafJng0HiCZIf1E4Sz5lIbA7hirvkZ9rslZXeLlCiJSyOkkL7jSed7GbzQbqCaAoxPkAEAMSWqH8bYDAkrbYwomWTlsCcJb6lXkPVtUEEyqz95GdpFrYd2DaFrBEXoIgW1yt9P50PyVCkb+DjHm0rag2iduS+ZVSFGAW+gXap2A== Received: from DU2PR04CA0278.eurprd04.prod.outlook.com (2603:10a6:10:28c::13) by PAWPR07MB9369.eurprd07.prod.outlook.com (2603:10a6:102:2e3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.15; Fri, 27 Dec 2024 19:12:50 +0000 Received: from DB5PEPF00014B90.eurprd02.prod.outlook.com (2603:10a6:10:28c:cafe::61) by DU2PR04CA0278.outlook.office365.com (2603:10a6:10:28c::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 27 Dec 2024 19:12:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by DB5PEPF00014B90.mail.protection.outlook.com (10.167.8.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:50 +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 4BRJCH2Z011940; Fri, 27 Dec 2024 19:12:50 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 09/14] gro: prevent ACE field corruption & better AccECN handling Date: Fri, 27 Dec 2024 20:12:06 +0100 Message-Id: <20241227191211.12485-10-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: DB5PEPF00014B90:EE_|PAWPR07MB9369:EE_ X-MS-Office365-Filtering-Correlation-Id: 20c83a26-03c2-45b8-3f69-08dd26aa7519 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?dv2/wJ2IEblVI/9zRslrptkqNg6VaM/?= =?utf-8?q?4PNKpDyqHcnscK9+pcNPr/66iJ1HMzZEdb/jRNbPrkESgcg8zFFv2r7pLn0uOCjdl?= =?utf-8?q?1WcM2FIo2yrC5aoR6qdU9JN6vt6sEO+WEG67pg0aTkT56gG2hRNloFX4IuXhr6o3Y?= =?utf-8?q?3UDQutKqOYo886ccq7N67rb22p1bejnz2TqwDpFuYkH/cqmM7hbJ0m2O/BHL3nBKw?= =?utf-8?q?03Pdexwo3uThViOsJnkGW7wy65ZjC7guiJEf5IoV8ovCYB19PbJoifwdNYxfhOsgz?= =?utf-8?q?77KWJ5SDKe1DXoj7NQA0nagFholUw9XSoJEn6bCLB3ERzh3aLHvyes3PFw6+P7pwc?= =?utf-8?q?qbzpogZ9lIYOhowYj7lROvsyQNWdqMf2DlrPmKi+5gElAOkluJkbmZPSw/lITcfIU?= =?utf-8?q?Q7HaSfmnye8rDn/VMuhTffspyxXcmufPfq6/iUg0SCinjL9tn3QB/UJZf4vYqhhOf?= =?utf-8?q?yTXgmdqzF7sKDiWJyzmchGHF1TQ8rV6ZeAXkrVGQn/fBT50O/mZlJn/nNe7Zc+QEw?= =?utf-8?q?tAlV8k+1983J1t2OKkG6Z9DbV1qat/pHFLBDs5Bol6TaH7rgSzzE/SAv+ABNlq7eF?= =?utf-8?q?UMczKxd+Y/0y/0yvF0aQcdodurdf5nZWWNlIO9ZyTDDahT5PBB7/JgSzK8eIDKjBv?= =?utf-8?q?g6NnZcVH8m+axQTz4aPVm3o05ogZhT4UdBQaANX84nXGmYURHN3h/B4OVApNXaIOu?= =?utf-8?q?EC3wP+R7dz09+vfbema9uIMKSXNfXWu70HwuaG1JZHqqxd899KtliINRj72lOpOXF?= =?utf-8?q?ZGB83NNsqMOqSb+Ea23Z21RNhdGzv+HtxVyq0l7OAJFpsZMcEwffFRXxtmeA4hBBr?= =?utf-8?q?8D3ok78IHusrdM0ugNfSq//ua8Y7PhAX47LTb8FNI0Swqcl4Ul9dK0mK9q71Kizkm?= =?utf-8?q?b6ZtHROe1cG3VcwoDvDF2Xi81+4/rqkjoLYN+ifSuSP9MXZe8U0ZDo7fXphnevOPv?= =?utf-8?q?j46SLCHVkt1H+ngQmkcwgUfRV8Wyt4kmAY4ylW/a4f+CsCqGqxyp5z/F2iUEqqVA6?= =?utf-8?q?WENc7dCWfVmU+LecJdwSOBLBUfv9W3L5RVaNmUxOiiGHX/is9LLXVRpBru7W0DiaU?= =?utf-8?q?M38n3LPmhuyskANwsdRW3p4QOGEl06sXV22UJhsdx2pYE33iAwu/sflllaS4MKdyy?= =?utf-8?q?M+bKyewa69FVluhemqMbIJtgOrTawoGhWDBCE5kSyksMKCpADqGdBpjxWulkpHH98?= =?utf-8?q?UX76/cDwfEZBZhBGXYlCkAirCxTfyblZnG5lVtv5vGMecWjrs2s2gJUJkYq4CnwRr?= =?utf-8?q?aIbMPAfFuuAxEt14n42XU66bzPO08VDpcpyvma4hodUt/Eg/d1UBxuyZS6eCVSy8B?= =?utf-8?q?ErI6eLpW6c+SIrPKqeCSLGLqwfPyB2FMARpPPaGKZxNRYOui/ccnwpF4pXZEm4vzb?= =?utf-8?q?xsTRW018L22Ry5o0nEQvyw0YPdoh+qGHNy6Q9DEAEqDGHPZGM8fQgGPXB3AzBmMGw?= =?utf-8?q?tly3I834RU?= 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)(1800799024)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:50.5956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20c83a26-03c2-45b8-3f69-08dd26aa7519 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: DB5PEPF00014B90.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR07MB9369 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen There are important differences in how the CWR field behaves in RFC3168 and AccECN. With AccECN, CWR flag is part of the ACE counter and its changes are important so adjust the flags changed mask accordingly. Also, if CWR is there, set the Accurate ECN GSO flag to avoid corrupting CWR flag somewhere. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang --- net/ipv4/tcp_offload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index 0b05f30e9e5f..f59762d88c38 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -329,7 +329,7 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb, th2 = tcp_hdr(p); flush = (__force int)(flags & TCP_FLAG_CWR); flush |= (__force int)((flags ^ tcp_flag_word(th2)) & - ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH)); + ~(TCP_FLAG_FIN | TCP_FLAG_PSH)); flush |= (__force int)(th->ack_seq ^ th2->ack_seq); for (i = sizeof(*th); i < thlen; i += 4) flush |= *(u32 *)((u8 *)th + i) ^ @@ -405,7 +405,7 @@ void tcp_gro_complete(struct sk_buff *skb) shinfo->gso_segs = NAPI_GRO_CB(skb)->count; if (th->cwr) - shinfo->gso_type |= SKB_GSO_TCP_ECN; + shinfo->gso_type |= SKB_GSO_TCP_ACCECN; } EXPORT_SYMBOL(tcp_gro_complete); From patchwork Fri Dec 27 19:12:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chia-Yu Chang (Nokia)" X-Patchwork-Id: 13922102 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2059.outbound.protection.outlook.com [40.107.249.59]) (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 0259C1F9AA4; Fri, 27 Dec 2024 19:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326781; cv=fail; b=NrKnFLMYtRgzepdZFKFavV9jf5R8kXcBCutwwnr+0maFUdu9eXeBthclxGtluE6ETb5BfmBlrGkcoMUPcjkPqsmTQbOpe9El4YmOYWglw8iPgu6H50RSz5e7jkMVFMx8HAAFC8i4yll4DEG2ueI3yz/2JndTsjhrJghYzsl3+p8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326781; c=relaxed/simple; bh=GP62ZfWUyy0KbnGWOga0bPjibK4UvOphB5r2d5YGoSc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=MJ6f2MILq1TNHdajxGekyRKrkUdJHDucvlAI5bCzZRDUM6Cz/zaOFGtI9CtzJ16Hh0Yc1s7M03eOY1g58szbr1jwK6NyoL7Ubby5VB10AToUbA05DpY3VDLhL/dRLzEhf1rhYEmvNaFInPjOGkVi7QhZwY0+F5qpV8yJL9thmXQ= 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=r3jX2mH8; arc=fail smtp.client-ip=40.107.249.59 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="r3jX2mH8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KMMupRA8Vt7fMCp7TVucXJqlyHHQehq9McxKkePBxgdTrc9layexo5VpbHhJ/weIHw9xYo0d89jm4Ave+gxPTv+8OzXKPvX1mQgaR1QMhABMwYrnKIZGhfdIY1bUyqVkO+DL6fuC1lqVaZ18EdpCZi7kOX+G39753CN1ApulfDsobS/FS8mNhoOPx+e6XjVCjYABXBqVZ8P8ZtUQfhO1h0FQaPvkEmj9MMcmZF02hvm1iXIFtWPDgcVzie0kHgaUsAJyigbjJI76qsMW+Z0BQSzj9G5Cx9SvHC/VuEl47L/i3iHBsliBtMWCFUbkG5Rrmn1mPpIDZUnTU1tiMqYE2g== 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=+VqEgAWYI3pftBss5XPYOgP4FcqnsRU8olVRBdFFM38=; b=kpnBGJRCIkpDxyHtjWAz99va07Ga+4FVAWOZldWZUvQpOpCfDR3BfrzmIuVdSPvvYHwWrOTuJXszgb+ETVj31EegDffuL60gnmdm+E3E01B2A7vEdj0dhrfLgwoa+aHYLe2GbxiVDMRvkjFkqFVYufqqnYOvqJO843ujZnb2lPE1HezubSR6BWD7waRg5CgVLbY0nLrPMM9TbRYQpt5gQsVPhthBQqFsCkIAkpb3cZ9/Xub1tGjULe3ECzEFtmOKsHsCFfmuwVaVQUlqXy53JZyn9LCQZtqYh6ftj7/v3orsZQNaTCMRZJRBHqbVdQKUxg0Q5w1aK22fHDEAlSCLqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=+VqEgAWYI3pftBss5XPYOgP4FcqnsRU8olVRBdFFM38=; b=r3jX2mH8MIwLsW3RPWr5VNbpA3xPl1kFCPQyeYEB3T47DMJfE0s7XTv2umT47OBzeQe2ZUclzRPwoJwSr1QefOiPsuXasKgHICZ5n/dqEUtzhEYt+SxpqWBicJ7afVyPoxvPEQKX11mgaTzCBY5hG8MUeRTT76jkQelwREwdiWRsWMXIYT2KLMx4AnqQyB9572j0Z2SawHQ+apdvREPrFjFrZkljO/egxWJOyFe8PgXzttHpqQi28MBKzAYDEXXdG8KjSiyubXvVYjWs/7PtsEooPjl38CuP3tth+ighQTnvy/R+2GN5KOZkaVhw0ANes0DAjkTWArwUvoDhpqQ25w== Received: from AM5PR0601CA0066.eurprd06.prod.outlook.com (2603:10a6:206::31) by AM7PR07MB6280.eurprd07.prod.outlook.com (2603:10a6:20b:142::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.16; Fri, 27 Dec 2024 19:12:52 +0000 Received: from AM3PEPF00009B9D.eurprd04.prod.outlook.com (2603:10a6:206:0:cafe::df) by AM5PR0601CA0066.outlook.office365.com (2603:10a6:206::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 27 Dec 2024 19:12:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by AM3PEPF00009B9D.mail.protection.outlook.com (10.167.16.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:52 +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 4BRJCH2a011940; Fri, 27 Dec 2024 19:12:52 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 10/14] net: hns3/mlx5e: avoid corrupting CWR flag when receiving GRO packet Date: Fri, 27 Dec 2024 20:12:07 +0100 Message-Id: <20241227191211.12485-11-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: AM3PEPF00009B9D:EE_|AM7PR07MB6280:EE_ X-MS-Office365-Filtering-Correlation-Id: bea8b68d-13e1-4a88-1119-08dd26aa7605 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|7416014|376014|921020; X-Microsoft-Antispam-Message-Info: +Hz3nyMsWcjLYzPz6RyIDke8dTROTQTnUU1r/RMWsLMi5RJ3UxBCg7Iin9WgNiOBxtfzSxrrg+f5FgEZWFxM5Uz047B0mqE2v/I7ESRJWCd5nepP69F2B3PFs2PprwvRfm9zbGCnZ7sQfD+ck/QCalHwB6zSXnSjKqRkSU/MHhpvPrLXykkLtigdjIiGil4fxvxIVUicM4gLR3U3zg+R8w8ftIasX8Dxw+tb5Pt4XQZ7lCYuTFy41MheiVcZj/Ul/ngs3jS7qKJHWygl+Ub/4yC0Ag7pLMOd3HsZHKp76XzSJsu8xbqEH01HzKT/aj9MdoiWqzPMM75WL+3SiHCOhYywym4ZhIooohJk+4TITH3G1M4MO0j6Sw84u4vclIFLeTTpfxq3F3kFE3iXFReeS7zeWMo5HFoJg5Vb+0wvlFeB5dxirNvxmlb83EY81roEECyIiYlIuiSfy/idNddbEf/kDujjIuV/C1hR3zeXVx1z4pkdiPE3pt8ESIrSWh+8n8XDK8ALFNtEswI7KHutFljSRlF6FIIwDQPb70V762ansZE+G8zZzX8MLkVDw4CTVa7W9cBSzbCFEOdCU+kRmul43BsuvhGmqMllW2xEkE2g5jJ7yI4cLkBuW4rvcRTFC5GTsAE2Q6B7RTjPOcXAKUqzf39gLxg3I4uNp7DAXnjgKaExy2TQykMIqJuGUONh8Z+sxlvpx4uWJIeQAJeiULwJ1pzHhlJv//dEhB0N6Un9q9sYB/ONvs4neNN37W9spYsaVYewEbCL/7bqP1WkXCBAxu9Yhgg5OF+CRxyzjv1vxpBqVN+3ClDtvB+8W2Nh0uRsVMuIty/X0fG0Yc4N7H+iaWcp9ZF3ZtFzIOGFqK/dH2WFXM3GnoCKM/6c6oxcRIGu29xZtmZwo/QjPsjB6P62lGP2fC/yeYeWnoFZRgp0DysSlKSKiRlir3fEqCVFWyTsRTP0Gg2q25df26WNm8JrIqJbzMFIGd1DgCwzOGH8OgV2jhU4Hx5BnSDAYw6m6Iy+u/e4FwlsrvvBOoY6oX2N1v8NvrlwA3ZdOj9iFZxEvY84rbTkYu77iN6QlV2CPSCdZWwr6gn+QZkA6sbXw08rm2wLgwN1bOrDGcUjqHeEuZItvTzqCm2RrZzZTt+hLOVPvdCGFU19MRRl7FMXFwPIL57FRzBfSYc/P0BN9L0a/t3b8UTe7fMQ+5zamrtxXSQ+NtnBS08r+zAToMDx5VfdQXywfdLUOIvEpV2QNX3jVqP14bHE1LO1wuqgCKbVx7RN0KzZzZXqSlS5x6Xv2OYOhTgGCbP4n6xY+Hn1D2exdz5DfklOjJGPv8DxBtKwHbJddnW/8FsrSL/foMiYfbcdWMULZAbBowbos00/MuyK7jf7++1NJvLxJ4AWlOwL3x46P4dGRaR2VhU70MrvlbQS+kQh0+SCZi87FoT1hHSWreXWXLikjJUCmNsAVVxg5GOxKbv8bjX2P1nPtOxX3n97e2cYUtcJlQe70klCTjA= 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)(82310400026)(36860700013)(1800799024)(7416014)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:52.1880 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bea8b68d-13e1-4a88-1119-08dd26aa7605 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: AM3PEPF00009B9D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR07MB6280 X-Patchwork-Delegate: kuba@kernel.org From: Chia-Yu Chang In Accurate ECN, ACE counter (AE, ECE, CWR flags) changes only when new CE packets arrive, while setting SKB_GSO_TCP_ECN in case of not knowing the ECN variant can result in header change that corrupts the ACE field. The new flag SKB_GSO_TCP_ACCECN is to prevent SKB_GSO_TCP_ECN or NETIF_F_TSO_ECN offloading to be used because they would corrupt CWR flag somewhere. Signed-off-by: Chia-Yu Chang --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 43377a7b2426..a6238a625d6f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3855,7 +3855,7 @@ static int hns3_gro_complete(struct sk_buff *skb, u32 l234info) skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; if (th->cwr) - skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN; if (l234info & BIT(HNS3_RXD_GRO_FIXID_B)) skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_FIXEDID; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index 1963bc5adb18..b9611cc223b3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -1286,7 +1286,7 @@ static void mlx5e_shampo_update_ipv4_tcp_hdr(struct mlx5e_rq *rq, struct iphdr * skb->csum_offset = offsetof(struct tcphdr, check); if (tcp->cwr) - skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN; } static void mlx5e_shampo_update_ipv6_tcp_hdr(struct mlx5e_rq *rq, struct ipv6hdr *ipv6, @@ -1307,7 +1307,7 @@ static void mlx5e_shampo_update_ipv6_tcp_hdr(struct mlx5e_rq *rq, struct ipv6hdr skb->csum_offset = offsetof(struct tcphdr, check); if (tcp->cwr) - skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN; } static void mlx5e_shampo_update_hdr(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, bool match) From patchwork Fri Dec 27 19:12:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chia-Yu Chang (Nokia)" X-Patchwork-Id: 13922104 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2087.outbound.protection.outlook.com [40.107.247.87]) (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 C84441F9EAF; Fri, 27 Dec 2024 19:13:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326784; cv=fail; b=CfEdyf7mAXMBN7jGpuIACMY3GOvq0qRzgeU7D7VFO4NLGbmDnU0nMuRXVspJXE03TACEhMqtvQKFHbZVwKkADo8Nw5HNdYxhvE+7wWRRKbjQJMwQSucYtCL1ga7Skdr3l0ngFx8BsmMXdkQGpTevhQGrgd32hcExqIXey/pjOfg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326784; c=relaxed/simple; bh=pbw2OQSAnpi5DuF5pan8o462KTTkkzZeZ5Ycd2Q2SlM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=h7g5Un1JwgLw3Xi7huFqCBmkPMAYg4hRH+XspjfN5+RN/kb+Xx2SK5T0bVDKbDu8L8YK4JBW+dh99ym0lz3F52sI07Vd3q8BETrOPL5dPm9DQpsYLB1/69uSORmelhyDMcQ4T2gVMFMnEALf/W7FmyZIv5dYnUMt3/iyz+4YCag= 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=UXZ+y6hx; arc=fail smtp.client-ip=40.107.247.87 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="UXZ+y6hx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=om0C+EIp8DF8v1Ky6wsfRSP4lE23pWCkJ93x9+7Il6DOzR1SgE1fgiif53rtBwaHdPsGVt95nmPKYnyKgIHsBOh+7mENlCDiA8Oinmr8AGpZFoD6EzUXOHnb8pG5zsNIbgk/6YGyEdBALQBUIY6QyRZ/lB3nEtE9DQ07xlZfsLEcCPTGaXiJl2i/EmZggot0OfYUfAHn8mk81pLuWfOe4Zbs0QiuMkm1gAvo/Efvy7Ya/ZSVuJ22+v35a0dwb3+Zhb/QolAHTjb6F9K5VU6iTTotCNWNZYfCjpvKP0NP+Cxdo+M2w9sLfp4NtGgHsZ9CBiI66OzJXMpChSDqww1osg== 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=YQriCZl2bTyHn9004OYreULPeiNFubb7hKAwAYFJBMQ=; b=DYctmiFh5Iy7DMTwZEbHyxzJVjmJqUIb5umdbjk2+oYxYPsHXttTHKH1Ak2xa0PpnFar6Rzl2Tn6V6HXFfAYMTF9pVfCgdT+dWE19gfLDln8dfzzUdQmLWt0uB5F8lAwXKPX4kFUZnickaljkR2dFZ3HzG7WZl55+r7tfliyPA+9YBfVLEfWZ7Ob7RFxGG2+LpUd3mZcXnZqgvOOuxPspbBTmAobU1ebdzcvpibcemmtA/+zvhld9LF/lL8P4SFfFcMsc2aOuF/ANL3SoHUTKnwmSZqQtik/fCdwB8k11Y/zDaOmqrCjJHmd9lO8Pp0DgmjDayYYr1xX7zmb0kqjDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=YQriCZl2bTyHn9004OYreULPeiNFubb7hKAwAYFJBMQ=; b=UXZ+y6hxzfuypgTZsRvjEAmDS0v3aGKhkv3t+30qYQTtVSCLNFxoLrx6tRSE0Kn42yLFj/5M5tK0mkhiKks17ia4k2vAZXlenYGx2KTHLvND0TrBnaKMiH+i9R2JUwgAvVS/1qATKGvDNt54RH8tO4U1kktbIz9g42JGYaM4g9wt75KgxZ7joyvw8mWlWpB0ST1xXpFI6dc+9iz/zBsOpT091IFBQy9ElX6Wa77JUxZEtdxhz/rl+CuRg0I42mXbg6Vihsrta2l7DN2KAQ35qhHYBrE9or34giHPKV6MVB6fCcPLPcEUGOPCBZ7PJS/VDVhpir28ep0ZxcvmeyMSbA== Received: from DUZPR01CA0297.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b7::8) by AM7PR07MB6214.eurprd07.prod.outlook.com (2603:10a6:20b:13a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.15; Fri, 27 Dec 2024 19:12:54 +0000 Received: from DB1PEPF000509FB.eurprd03.prod.outlook.com (2603:10a6:10:4b7:cafe::74) by DUZPR01CA0297.outlook.office365.com (2603:10a6:10:4b7::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.15 via Frontend Transport; Fri, 27 Dec 2024 19:12:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by DB1PEPF000509FB.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:53 +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 4BRJCH2b011940; Fri, 27 Dec 2024 19:12:54 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 11/14] virtio_net: Accurate ECN flag in virtio_net_hdr Date: Fri, 27 Dec 2024 20:12:08 +0100 Message-Id: <20241227191211.12485-12-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: DB1PEPF000509FB:EE_|AM7PR07MB6214:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d691234-adfd-41d5-9891-08dd26aa7700 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026|921020; X-Microsoft-Antispam-Message-Info: mwrE89yqZHO+xy3voJ0WpygHyjdF5ot7lBa/H1nSFqw8IMkmz98l1euaNLF8mqQdkPjpsIBOgIj3GnZjKsMAPNvldnNZqvwzTvhW0vll/L+y3hKyLUPAyY0RF9fLXyThs781zqp2vL/LVQwrFmW143I/edwaOn0vJ4eoLOGVNL3RJOdR0FgB1j0n1Pz8aNnTlY+2BS51Tw7G3UZsmccAOBRSOcxaWNEjicbxfEGy7/mqszAO/vYK6VBwbjGtk1ZRqXOJzbBg8v02HbjiuZNMRu8q5psr7JzxY0QqXavTyBq27cZQXsuTD98SXuDfTnIHrC7krpd1fK+we+4SXRZpKB8pCktemWTz0YlAkAydHFt+G4ZYBXRahbDQCi9XtdxmfYMiFmXmXznUjjzbS5raD3uIuEbKvV+mVAmVqmU53m0JFamlp2BtqPeaVmqsa1gosONNodBCUG7KCMH7SnHeZtCL3iEvhn/3aKIcfFrb1OtARq45hOo8AIwRwhOQrsX31carCvU3DlM+Yty+1IsQ/JjI5SVIc7AnKgHGM78BKe9aorPQP7Hlw9YrPhGiILZ3OIL+3kptHzEBen52cydku8HF6U8ksTR/73ShtLmE7WjgDUVSSBuQTTkzL/L0c0WIUgMi7NT4TrNp4nq3k5/htF8aqbjkUV/w0bAAxRw53Es5TlVylGFC1IFqc/kemfV+n83FLyMCPaBWNh/VLrIAiu/aDsYgGIR8Q1qEK3+Oqx6Spqi0mvwdBOU2Dnc9xYyVnA8iEAWOQxrtDmmT792pzAdPmsGFUQaTroRbgbtDpemmq/X1eZRAzxXN9j78lsrdfEjloN8oAzG+gvLVODYsZdUTxAFlm/5gfNmqYerXmcyOIvOa+PhVgBgqiYkLLGXweNA8GkYtSeSI85UwjLnWN9pi3GYRK9At0tjXWbWUfbcENx+xA7VVR4IbzWaemtMMerJ00qkchlJvApb6m9G+VWAohNfrcSCT43Rz7rabdrz/G2R1Um+vrdV8iF79TMELcuQyYv3laBQycdc557EjtiqsUS6ni3sWgRJLk7dYFcy+1v1V/JIl1ys+AsIXyObTPWHLG1XDKW9cSJ4+EGnmEbFz21yM+QaP5MKbbAQX+HiLjBAYDPlsKRnP45yUZjar8+FWDwhiSDzwHW/U32Mfej1w4nWQRaQOKu9hs+ymuMM/Vx5CrZvvsFWEscHN07qpRlV32s6Nht1/bhovTPRjI3B5CXkTk7dKmlfkXfSQTMHxO9Eg2170DUN9gwVQwn2RlCG7K6gErwmhQDgWMG88hCja3pSuZ7R6SPOXKGzu9xBq/yXj4WdCejJgwv0Ke4NFUDDLKE8Tzos1U92F6HKVcqYOC+O8xLi+rDGgYivdKbQMz11Wjbt817Ave5WYy5qSwSvW446/HT6UCGXjowIN6mvP0G2XZMWc2zuqUUd2olyk6PK1cvG1UbdGrEa6s23/gVIxeLYaPP6OpeuErwY7vxaBw7QwGQ1AfGgTarX/0Ms+hcylSxZXuE9uzvKufj0a 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)(1800799024)(36860700013)(376014)(7416014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:53.7895 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6d691234-adfd-41d5-9891-08dd26aa7700 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: DB1PEPF000509FB.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR07MB6214 X-Patchwork-Delegate: kuba@kernel.org From: Chia-Yu Chang Unlike RFC 3168 ECN, accurate ECN uses the CWR flag as part of the ACE field to count new packets with CE mark; however, it will be corrupted by the RFC 3168 ECN-aware TSO. Therefore, fallback shall be applied by seting NETIF_F_GSO_ACCECN to ensure that the CWR flag should not be changed within a super-skb. To apply the aforementieond new AccECN GSO for virtio, new featue bits for host and guest are added for feature negotiation between driver and device. And the translation of Accurate ECN GSO flag between virtio_net_hdr and skb header for NETIF_F_GSO_ACCECN is also added to avoid CWR flag corruption due to RFC3168 ECN TSO. Signed-off-by: Chia-Yu Chang --- drivers/net/virtio_net.c | 14 +++++++++++--- drivers/vdpa/pds/debugfs.c | 6 ++++++ include/linux/virtio_net.h | 16 ++++++++++------ include/uapi/linux/virtio_net.h | 5 +++++ 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7646ddd9bef7..470c70fa6868 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -58,6 +58,7 @@ static const unsigned long guest_offloads[] = { VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, VIRTIO_NET_F_GUEST_ECN, + VIRTIO_NET_F_GUEST_ACCECN, VIRTIO_NET_F_GUEST_UFO, VIRTIO_NET_F_GUEST_CSUM, VIRTIO_NET_F_GUEST_USO4, @@ -68,6 +69,7 @@ static const unsigned long guest_offloads[] = { #define GUEST_OFFLOAD_GRO_HW_MASK ((1ULL << VIRTIO_NET_F_GUEST_TSO4) | \ (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \ (1ULL << VIRTIO_NET_F_GUEST_ECN) | \ + (1ULL << VIRTIO_NET_F_GUEST_ACCECN) | \ (1ULL << VIRTIO_NET_F_GUEST_UFO) | \ (1ULL << VIRTIO_NET_F_GUEST_USO4) | \ (1ULL << VIRTIO_NET_F_GUEST_USO6)) @@ -5886,6 +5888,7 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, && (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ACCECN) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO4) || @@ -6549,6 +6552,7 @@ static bool virtnet_check_guest_gso(const struct virtnet_info *vi) return virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ACCECN) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) || (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO4) && virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO6)); @@ -6663,6 +6667,8 @@ static int virtnet_probe(struct virtio_device *vdev) dev->hw_features |= NETIF_F_TSO6; if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) dev->hw_features |= NETIF_F_TSO_ECN; + if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ACCECN)) + dev->hw_features |= NETIF_F_GSO_ACCECN; if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_USO)) dev->hw_features |= NETIF_F_GSO_UDP_L4; @@ -7061,9 +7067,11 @@ static struct virtio_device_id id_table[] = { VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \ VIRTIO_NET_F_MAC, \ VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \ - VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \ - VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, \ - VIRTIO_NET_F_HOST_USO, VIRTIO_NET_F_GUEST_USO4, VIRTIO_NET_F_GUEST_USO6, \ + VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_HOST_ACCECN, \ + VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \ + VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_ACCECN, \ + VIRTIO_NET_F_GUEST_UFO, VIRTIO_NET_F_HOST_USO, \ + VIRTIO_NET_F_GUEST_USO4, VIRTIO_NET_F_GUEST_USO6, \ VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, \ VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, \ VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \ diff --git a/drivers/vdpa/pds/debugfs.c b/drivers/vdpa/pds/debugfs.c index c328e694f6e7..90bd95db0245 100644 --- a/drivers/vdpa/pds/debugfs.c +++ b/drivers/vdpa/pds/debugfs.c @@ -78,6 +78,9 @@ static void print_feature_bits_all(struct seq_file *seq, u64 features) case BIT_ULL(VIRTIO_NET_F_GUEST_ECN): seq_puts(seq, " VIRTIO_NET_F_GUEST_ECN"); break; + case BIT_ULL(VIRTIO_NET_F_GUEST_ACCECN): + seq_puts(seq, " VIRTIO_NET_F_GUEST_ACCECN"); + break; case BIT_ULL(VIRTIO_NET_F_GUEST_UFO): seq_puts(seq, " VIRTIO_NET_F_GUEST_UFO"); break; @@ -90,6 +93,9 @@ static void print_feature_bits_all(struct seq_file *seq, u64 features) case BIT_ULL(VIRTIO_NET_F_HOST_ECN): seq_puts(seq, " VIRTIO_NET_F_HOST_ECN"); break; + case BIT_ULL(VIRTIO_NET_F_HOST_ACCECN): + seq_puts(seq, " VIRTIO_NET_F_HOST_ACCECN"); + break; case BIT_ULL(VIRTIO_NET_F_HOST_UFO): seq_puts(seq, " VIRTIO_NET_F_HOST_UFO"); break; diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 02a9f4dc594d..3b71465f0ddb 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -11,7 +11,7 @@ static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type) { - switch (gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + switch (gso_type & ~VIRTIO_NET_HDR_GSO_ECN_FLAGS) { case VIRTIO_NET_HDR_GSO_TCPV4: return protocol == cpu_to_be16(ETH_P_IP); case VIRTIO_NET_HDR_GSO_TCPV6: @@ -31,7 +31,7 @@ static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, if (skb->protocol) return 0; - switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN_FLAGS) { case VIRTIO_NET_HDR_GSO_TCPV4: case VIRTIO_NET_HDR_GSO_UDP: case VIRTIO_NET_HDR_GSO_UDP_L4: @@ -58,7 +58,7 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, unsigned int ip_proto; if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { - switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN_FLAGS) { case VIRTIO_NET_HDR_GSO_TCPV4: gso_type = SKB_GSO_TCPV4; ip_proto = IPPROTO_TCP; @@ -84,7 +84,9 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, return -EINVAL; } - if (hdr->gso_type & VIRTIO_NET_HDR_GSO_ECN) + if (hdr->gso_type & VIRTIO_NET_HDR_GSO_ACCECN) + gso_type |= SKB_GSO_TCP_ACCECN; + else if (hdr->gso_type & VIRTIO_NET_HDR_GSO_ECN) gso_type |= SKB_GSO_TCP_ECN; if (hdr->gso_size == 0) @@ -158,7 +160,7 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, unsigned int nh_off = p_off; struct skb_shared_info *shinfo = skb_shinfo(skb); - switch (gso_type & ~SKB_GSO_TCP_ECN) { + switch (gso_type & ~(SKB_GSO_TCP_ECN | SKB_GSO_TCP_ACCECN)) { case SKB_GSO_UDP: /* UFO may not include transport header in gso_size. */ nh_off -= thlen; @@ -223,7 +225,9 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP_L4; else return -EINVAL; - if (sinfo->gso_type & SKB_GSO_TCP_ECN) + if (sinfo->gso_type & SKB_GSO_TCP_ACCECN) + hdr->gso_type |= VIRTIO_NET_HDR_GSO_ACCECN; + else if (sinfo->gso_type & SKB_GSO_TCP_ECN) hdr->gso_type |= VIRTIO_NET_HDR_GSO_ECN; } else hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE; diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h index ac9174717ef1..65a13b7d4eed 100644 --- a/include/uapi/linux/virtio_net.h +++ b/include/uapi/linux/virtio_net.h @@ -56,6 +56,8 @@ #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ +#define VIRTIO_NET_F_HOST_ACCECN 25 /* Host can handle GSO of Accurate ECN */ +#define VIRTIO_NET_F_GUEST_ACCECN 26 /* Guest can handle GSO of Accurate ECN */ #define VIRTIO_NET_F_DEVICE_STATS 50 /* Device can provide device-level statistics. */ #define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notification coalescing */ #define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */ @@ -137,7 +139,10 @@ struct virtio_net_hdr_v1 { #define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */ #define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */ #define VIRTIO_NET_HDR_GSO_UDP_L4 5 /* GSO frame, IPv4& IPv6 UDP (USO) */ +#define VIRTIO_NET_HDR_GSO_ACCECN 0x40 /* TCP AccECN segmentation */ #define VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */ +#define VIRTIO_NET_HDR_GSO_ECN_FLAGS (VIRTIO_NET_HDR_GSO_ECN | \ + VIRTIO_NET_HDR_GSO_ACCECN) __u8 gso_type; __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ From patchwork Fri Dec 27 19:12: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: 13922105 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2049.outbound.protection.outlook.com [40.107.241.49]) (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 E4F2B1F5435; Fri, 27 Dec 2024 19:13:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326785; cv=fail; b=lJ9w7dSJKGwTQLu8+1z0aKNWtKlPysXZsJ+ytOUlgJT6GzJhv8gvpqm40wIUpAnhQkSPjkiN/Ts/hrf/rBbl7rPf5/U/0m8pCWPBnchMeQo7wcEebl3OQRFCZRfV+i3mgzGgIhvFQ+WX6LN5zHE9Z5OnDjpICG9iRnsPLY6p77k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326785; c=relaxed/simple; bh=CcYlKhlTGVwvxQzpYTCdMrVmnxAenvKmQP4UbtR/PLg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=YU7yLtNTyBppTH0rufn88VJtxZepvajLMpPDT/hmOrhryZV0+PzXycJCQe1ONl0CkFScp6LMsKpnQTFmKr/j4Im19s+XbsIFJhtklSj8yK7c67abaiQ4VKuL8jzefWK5jtc484xHupCgsmDMAk3F+58pejSwt+VsWyiE+jnp0FE= 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=LvkTDv12; arc=fail smtp.client-ip=40.107.241.49 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="LvkTDv12" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=h4pOpJsz9aT7k3tksT3ONipGXbnWFuixT1bNeeL8/5UXMJg/p4jmUSGrHM7UAn0lNzyCYoq1aLSIqaMJQv2PiZ9lcGZ3Oj+P0dgpoveA9/usJGhuJc+gwm+dWAqTs6V8h3HR78fp6UEZE01tt0HvswN3VrlrOmi9UcT/E3E7kWmdezI6CJ2ncTK02ajtK3G+F/HdhrjouwdtmGJ7y/clhFjyKyMiJ5hFZ60LeVHdgdJlePIKoFBRKHWc9lTDMJ0sI1OZf2QLD6YP425tOtsAJu1KL7X4jQkxBOTNU4mdy6gT4564AeZlNbj+e/gojty1Nlp1TjJVoZkZ8e9r6CKrsg== 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=/ZodM3kenxkLT6tdhtrcBCDtwxzMjkz39v4Wvx5Iq0w=; b=lIAgsP4ddonr7l8O+NZW4Du/K4zEchWWDoN5m3niosDopBn2R8n4R0dfkiyt+TzLig8skoFeMg6J7l8sw1TZEGQSXAsIu46ISY0rP2EVkprm0RqNICATAvztOOaRVda1BNTD4L5i+1o9Io2JWbXUueQdmiHUhDYaXM+dELx3/IFOP3Wo8brElj1xosXJ7J0gaQCtsfgO4WGiLq/+SBVj3tdRNdYS/pWG9heOG+TSU5mRzxVLuUyk22j3mrw0JG0xFX0BX1kDydomECfNYmPtEhYw6uG8b0iX+cpMCYkbGJ2e5Cachc5/Llk2dNxHHcBgUMHpRUQgnE1hI80RUE75gg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=/ZodM3kenxkLT6tdhtrcBCDtwxzMjkz39v4Wvx5Iq0w=; b=LvkTDv12iAlKETVJsNqigQ8s7rQNeKoFJePK2PPM0fgfz7F5fk9lBsKszk4Frahmgpv6mceUmyahLoZVy/qDqsJEsaFhyz9eydSaiEzBm6OIoTts4GjwbUjbejJFTGDJCGXAC2oHYDwJOPio7hXgBqT/wmtXfrqap+qI46g6Nm3xDkcIvI679hbHdcNs5TIv9hMXl56MiXLx4t5e2zc9fpScRXFGSePdOy1m3sKTn13g1u2TFp43UgxP/Wk0hETsAqdSl/nMiX/mXys0/vk4o9zFqlPHfg8Ieuv+1VxQArhqcPasiB5Dz6drysqatz8FM0ix6sVz4NR7GYLRtjv2Mw== Received: from DUZPR01CA0197.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::11) by PAXPR07MB7872.eurprd07.prod.outlook.com (2603:10a6:102:138::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.17; Fri, 27 Dec 2024 19:12:55 +0000 Received: from DB1PEPF000509FD.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::90) by DUZPR01CA0197.outlook.office365.com (2603:10a6:10:4b6::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.15 via Frontend Transport; Fri, 27 Dec 2024 19:12:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by DB1PEPF000509FD.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:55 +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 4BRJCH2c011940; Fri, 27 Dec 2024 19:12:55 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 12/14] tcp: AccECN support to tcp_add_backlog Date: Fri, 27 Dec 2024 20:12:09 +0100 Message-Id: <20241227191211.12485-13-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: DB1PEPF000509FD:EE_|PAXPR07MB7872:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e9f879e-ef9e-4dea-5819-08dd26aa7808 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|7416014|376014|36860700013|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ecqDmaVr0IbUxKEVKl97D57zIx4OvAp?= =?utf-8?q?Q+aKO0xqaiUb59Mi69vSwTzk3FZs/Tdjzhz5sEhsjSK4Mh/qRs1wYixLQ8R0nwgt/?= =?utf-8?q?Vmpf9puBjuLDLhIzrI0o3EeA6XHwWT4HwbHPhJbwxLFesGWpcaZ6q2CziiW40Wqhk?= =?utf-8?q?rXXeMyTVXWJ0u8xZ8mhT2JJfi3zk6C7h/3zkoRSZJ27J/KHD2cO/WewIXQdpPBEB2?= =?utf-8?q?6sta0TW4nU3crmPFLyP9ilDVRraS7/bftoC3ZEMiaK0cgLovW+9fmIKG7qeS5/xvb?= =?utf-8?q?B6Ic9n0InbtOhBe6SNOR2DFK+Rsqgg85ScHjVotnykZjcFH+RYW+ubw7z3zHmYe40?= =?utf-8?q?3222UzG2KbA9TOw5zPSzg5MtqdEYOPh6aSAzNig7cv2xY90CzYYX93piFXcMoy0cg?= =?utf-8?q?IcnKEykBWBen2rIIixMLU5uIV3GoOSeID34J1bNGYq1M5mHgirR9GQcr5tJNQ1eGE?= =?utf-8?q?2aliTkSo+rnppCpyUkFPGmS3bKrMg54FLliM/VldQx/dIDuxLyFDnKdR+FOjhHk5o?= =?utf-8?q?yrFF2oE764jsTeg/tHzPDQXyQyQVM5/FqPoRiVw99ubFKDh59RfkMvjrCOH0WuzAy?= =?utf-8?q?lJBLgfI8yMFnKobetmb8tpbvmaiiUqryazkfZbavCxnUnNUKX7DzM0ZMh2LBnnD7v?= =?utf-8?q?suyDmjWbpUNHBfH8q9cYq6epgoslwKR6TB3/doy2DBy6VWdholWDFWhhzGKM5LL+5?= =?utf-8?q?MConHOOHZK5KsGLZp9pKe4Cj0yoXUeLiMviCBYWVH2SsJcsSqF164l9bIpyI3C7zi?= =?utf-8?q?0Zj18763To5j7/JRReMcslPEZ9ZEtk42pNFgaPkMt1VolCAsnBDddB7mTEof6WHf8?= =?utf-8?q?4krKoo25I0xLeqIX2jPLXbiAV1Niuqz79R60v+tUoNupKgOtN9I8ILo/WDoWFkgpD?= =?utf-8?q?vh3INSz49/9i1qBr6RmBzEL1wanVPsi9lT2hMHY6pj75FwSZcX37uHbwVno9rWMDT?= =?utf-8?q?j80CauBlX+iilKlmQRqVR6w+YIFgOnLnWCQq2X9gmdTV2Z5lupzraxROATRXErpL4?= =?utf-8?q?8wC/b9YfNzG06eVsK7SiH2oczKNZTWgiPE0z0e/lH/WrMaJBGxOxQTlHPacqZ+Vuy?= =?utf-8?q?A2GgWKutGvEbMh5/vqEINnFMUnV573mo5UaqpQZP50eJuzqt6iRTHc8kCsMngL9GL?= =?utf-8?q?uDmRzqjwrcHTj42KX9TCE+z0JuvBotyaOmipUwRm0lhJcoRnFbtlIW55/hEXwBWK3?= =?utf-8?q?hlMv3828+VZYcvNUeJ/a2gdGuX36F58bFJ5uQOdpMkKfk79ayjimyUTI91WyxleV0?= =?utf-8?q?5tpZhBgjCkmnFQbLdHG03+Ky/v5JXZxZzpfKlc38vrfSnBwqMRVbUCLpopmGIGvJD?= =?utf-8?q?/t2rEle7ig+kR/T1bQBCGPrD9JLLTjn134NhMam4CCDSRzx5l2O7+3H+jNbs1B3jm?= =?utf-8?q?j8JHOH9WkOOjOsJRtDjoF+FaqFqMfdt+ndjPhpvjWNxQHUDNlC0LOsxMtJ3Tfo21e?= =?utf-8?q?znB3QfWMvf?= 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)(82310400026)(1800799024)(7416014)(376014)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:55.5024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e9f879e-ef9e-4dea-5819-08dd26aa7808 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: DB1PEPF000509FD.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR07MB7872 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen AE flag needs to be preserved for AccECN. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- net/ipv4/tcp_ipv4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index b0b8bbfa9386..24ec0ade8ae9 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2057,7 +2057,8 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb, !((TCP_SKB_CB(tail)->tcp_flags & TCP_SKB_CB(skb)->tcp_flags) & TCPHDR_ACK) || ((TCP_SKB_CB(tail)->tcp_flags ^ - TCP_SKB_CB(skb)->tcp_flags) & (TCPHDR_ECE | TCPHDR_CWR)) || + TCP_SKB_CB(skb)->tcp_flags) & + (TCPHDR_ECE | TCPHDR_CWR | TCPHDR_AE)) || !tcp_skb_can_collapse_rx(tail, skb) || thtail->doff != th->doff || memcmp(thtail + 1, th + 1, hdrlen - sizeof(*th))) From patchwork Fri Dec 27 19:12:10 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: 13922106 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2087.outbound.protection.outlook.com [40.107.249.87]) (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 7D69A1F9F59; Fri, 27 Dec 2024 19:13:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326788; cv=fail; b=h+a3iQXsiY93Krvapa6xUV7q86tt2AWIuZiXbk2Kc05TDPTkXSbQn+UZ2FQLxRDvlZ/6xQD4Qe50opEDnwm+jlfAWF2zltVKcFQ4bL6hTP0i3XV3P3kpFbtXIBe8h8YW0kd9ATJxFGqNktxrnGtH3KaPrvXiOjIxJVHBnlJVC4M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326788; c=relaxed/simple; bh=U2TGYxnhFCwvfX8sqP0/i02ZCL0Wrh2uoB+wx2UgPqQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=sDhnymxwGLPMx2UfvpMnbHKxbfxtuYJK2i7Cxk6yj08fUncmqGuMudrk+SX1QbGrqeRwp+tnzyxI3Vs5ri8AQIO3nmAy7FJt3hWS6FZ1WQhl2DoHgHJAs3uKl2iZOO3Lhk7sxExvsYPcd3vL/XZkoThsj5WgXts6sznjqej8hSk= 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=dYZuJq1j; arc=fail smtp.client-ip=40.107.249.87 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="dYZuJq1j" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gPPSjTlkD4k/3t5PoJM8KxV/qjmZisnd87NGMAHu2D9eCbD2+4RF5dLW1glzOquMUqnllUYsonIx87486q4rR8lG3NxC25ruTLsG+3VQcoCgPYNiRGBeNUfNcI2mOKZWwkPqFTsHPUqg8VZ6QiSv0RTz/XxLM3M5NtlzQTH8w3UcdN2mWC05l2Z2iz1XZBlMi2CUDrdqaW/bEBoBEmdYNIjn6YCyz19eiU3iW8PDd6DjroBymeaqOsdh8cyyNYxjkl6PI8l3oKHj74l4jTxCyV3qSYXViSDdv7ebSpOV9qJhiYwGgZ1VFFgEZ+YwkL7kYbZhR34rQuFh45CTNxyxAA== 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=CeCjce9jeD36fMnKu1YVL/NvCavnCJuGYN8QKTggfZI=; b=dYeeLkYaYRG89vg1d75ye5o5ZfVPwcZ3Dovrh91WNzCGdRVmMt0zqyL69pa/B+PYh4h/4eRKUPQx1iIY5np8XVnjPV/Ey0byqI0hztqCo9rv+UKPcgXjNBxL74oi8Yr3inBOLHDJeqN194G6Pe9p16Sk7loSHX/P1BwLwHkF/bu58Zt7FtRGtb4HUy0Tc6iXKjRNV1pRFCKECWjpflw7gUfhY07wUbNO8hLIWahZreXwjRbnQZaxkT7FGf8Gtx9s9lpjQgG6yZ/hA3ftw27gZubEEt/FG/q3j8/yljcJE+FPIPKh62FMc2BuCLEnm4UhuPAQf73GvysjFnBe+/p5cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=CeCjce9jeD36fMnKu1YVL/NvCavnCJuGYN8QKTggfZI=; b=dYZuJq1jFQy7s4FCX6VYt+SfmOHMZXUVG3gybY0vAjzbOriNn5mS5eAitKBzeu0h0Zlc8y32iXCz9q5IHddbBDZSYTndr0LR6jPXJ1sbHsJ+z6CrKBKVMNlw63gijk5U8YcjiggY9neW6MvoDkx0YmvX+gGXEu6W77h0rJTYMGvlRP4j/j/ObkwvuAg/lqxEHXByG3+UOotFcVIOXJHMHZVYO/D7g1obWfS8eyUPVZcJLeBuWGJBFbWq5KhwO+jHNtgIxnEQ0hto6uhtBEct4hqEXF57A7BPInJtvOavy+d24dYIETQ0REPcIEh93/0yXkZq+t7mbShEeYok7d7Z5Q== Received: from DUZPR01CA0193.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::14) by VI1PR07MB6606.eurprd07.prod.outlook.com (2603:10a6:800:185::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.14; Fri, 27 Dec 2024 19:12:57 +0000 Received: from DB1PEPF000509FD.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::cc) by DUZPR01CA0193.outlook.office365.com (2603:10a6:10:4b6::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 27 Dec 2024 19:12:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by DB1PEPF000509FD.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:57 +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 4BRJCH2d011940; Fri, 27 Dec 2024 19:12:57 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 13/14] tcp: add new TCP_TW_ACK_OOW state and allow ECN bits in TOS Date: Fri, 27 Dec 2024 20:12:10 +0100 Message-Id: <20241227191211.12485-14-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: DB1PEPF000509FD:EE_|VI1PR07MB6606:EE_ X-MS-Office365-Filtering-Correlation-Id: cab1a928-3e26-4550-11b9-08dd26aa7905 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?1iYrw3gjnicAc07/jLqTlcinLvbSLjZ?= =?utf-8?q?qmledsVtzo5VAvTGhmt5SDtK03RFyVPHM7uIdprXN/n4gya6Qv8CTJY/IDSm1BBTV?= =?utf-8?q?xnBZCZX0OSu8vYwWUaxF4DniMxQGKebIErFr3oW2RS9DIjOQqAm+PFZtJumlSC6iW?= =?utf-8?q?RvgsNTte9MmZtiZn/3kZ85dft4+8sLkgRyQPWgdQN9n02eAZD/mrYXMFK0fmmjaFy?= =?utf-8?q?qDLn/nRq3Jn/WWsuUeRvTvYoViGYDipqdDzVtwVgcOo4MB3XjJjivYeOVUINr5VeT?= =?utf-8?q?6lfrXJX9MM8n/WSMtf+zoS20n8IfwD4dO/BqoTi2FU7k5Y2MKOxnbpEukuOB6Onjk?= =?utf-8?q?NbO4LECW2fwSmJj3JomVDwUrx4hmURd52tbvw0D1V/OCjBSnaL1xXMp0atfveXOAU?= =?utf-8?q?N1dae686QE8wFpyP7kZy/P6vtdGt3A63pOnmpaFoF5U1E37z9N0vv6gd34HO8smo0?= =?utf-8?q?gyzU4FsUGGKSM7d1bvSJCixDDMBDNdEO+L0/EP05m6/C7RhgTcWB27SLQOcJb1M/P?= =?utf-8?q?C3saVk3T+Q9HWqBAi9J7ljwKyUAJzPN6n+2w/Dq9buRxs5FUKCbSRWG6Tm2eB7Cwo?= =?utf-8?q?Bno8EK32ukJaGhm9Ehfx821vPMGcx0XOXJLsN6J2bvYxsQJtbe1Nysm9NZe97lSAv?= =?utf-8?q?/eXW90k0RXXFXabC5WzWv6/dMBmgyfpLAdDGIje1RUWDbAIHvSJeRau6lWslIdH8X?= =?utf-8?q?MXmI5OQjLV1ZTNOCENQ8rq01nR0CIXaEzooDgaV8awck4e86AYSrN8yP/xmd1XIRt?= =?utf-8?q?FXjZczIwA4ETLZ2fOdYcqAvivGyjhKuOuxDS1z9Th0gfkdeIQCDWtT4x3cWYvVjLD?= =?utf-8?q?23vPWkwta1R5ZLCTo6fzy7aWodfqUuWK8uxuIDRIXVUPa013YUCAmJhn0EeRKslHw?= =?utf-8?q?LBrvE/eS/MWvFWyT4xIyEFOnSgWg/FOj3NlQJk69asdv5TiseOyCnVs4peHm4yqAv?= =?utf-8?q?hOLxc8clZc/zyWnggXlSzv7VBYxIjdM2qeKkIrNhXtVhych5pdjXpjHOCOiaYTnLy?= =?utf-8?q?l8oQ2hBgR6Ex0Ispkz4bvK4Ul196kDJBt7t2i+hs3BN9NCILCFVS9/h4CbYQZa2n4?= =?utf-8?q?JhGkkZ1/iftnIsBwOzdVJ2S64Hk4j2N/Vaqh+/ALJUb6mAuaaad06JnXKmcTmqh1Q?= =?utf-8?q?qLTUqA31Afrzff1GhYrtoJ05EyNBKDCz+VFjOxQwO1ABP8mSNyv4U5EhEwJ4YOTdz?= =?utf-8?q?MrScX0FHOUY4ZyZXBocMysdWgg/RTiK+ZSIZ2I9yhdJjMdl2iLO5XHUqK4eBqBnrr?= =?utf-8?q?d6Ot8nuSrLNmwAgrCK8WarhfNX2tRiW2Mh8yFe+ZGNvZWuMWob1Mgz1dBfl/UZcSC?= =?utf-8?q?o6AM+VcWRWZxF6Krj6BviZQnnsT79B+YTsa8+AncBf4tO2lyRew8ANEJv7xaUDWzD?= =?utf-8?q?kkftR08hHJXKoUCXA7b8NRSGA41ZfN+60wZMdw4pJz/lRuroFHhuzbAgneAgQK8MR?= =?utf-8?q?7OyK+GkGy5?= 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)(1800799024)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:57.1274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cab1a928-3e26-4550-11b9-08dd26aa7905 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: DB1PEPF000509FD.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6606 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen ECN bits in TOS are always cleared when sending in ACKs in TW. Clearing them is problematic for TCP flows that used Accurate ECN because ECN bits decide which service queue the packet is placed into (L4S vs Classic). Effectively, TW ACKs are always downgraded from L4S to Classic queue which might impact, e.g., delay the ACK will experience on the path compared with the other packets of the flow. Change the TW ACK sending code to differentiate: - In tcp_v4_send_reset(), commit ba9e04a7ddf4f ("ip: fix tos reflection in ack and reset packets") cleans ECN bits for TW reset and this is not affected. - In tcp_v4_timewait_ack(), ECN bits for all TW ACKs are cleaned. But now only ECN bits of ACKs for oow data or paws_reject are cleaned, and ECN bits of other ACKs will not be cleaned. - In tcp_v4_reqsk_send_ack(), commit 66b13d99d96a1 ("ipv4: tcp: fix TOS value in ACK messages sent from TIME_WAIT") did not clean ECN bits of ACKs for oow data or paws_reject. But now the ECN bits rae cleaned for these ACKs. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang --- include/net/tcp.h | 3 ++- net/ipv4/ip_output.c | 3 +-- net/ipv4/tcp_ipv4.c | 29 +++++++++++++++++++++++------ net/ipv4/tcp_minisocks.c | 2 +- net/ipv6/tcp_ipv6.c | 24 +++++++++++++++++------- 5 files changed, 44 insertions(+), 17 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 4987cb0c59c4..a68c414b9407 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -417,7 +417,8 @@ enum tcp_tw_status { TCP_TW_SUCCESS = 0, TCP_TW_RST = 1, TCP_TW_ACK = 2, - TCP_TW_SYN = 3 + TCP_TW_SYN = 3, + TCP_TW_ACK_OOW = 4 }; diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index ea7a260bec8a..6e18d7ec5062 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -75,7 +75,6 @@ #include #include #include -#include #include #include #include @@ -1640,7 +1639,7 @@ void ip_send_unicast_reply(struct sock *sk, const struct sock *orig_sk, if (IS_ERR(rt)) return; - inet_sk(sk)->tos = arg->tos & ~INET_ECN_MASK; + inet_sk(sk)->tos = arg->tos; sk->sk_protocol = ip_hdr(skb)->protocol; sk->sk_bound_dev_if = arg->bound_dev_if; diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 24ec0ade8ae9..f001f991a984 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -889,7 +890,8 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb, BUILD_BUG_ON(offsetof(struct sock, sk_bound_dev_if) != offsetof(struct inet_timewait_sock, tw_bound_dev_if)); - arg.tos = ip_hdr(skb)->tos; + /* ECN bits of TW reset are cleared */ + arg.tos = ip_hdr(skb)->tos & ~INET_ECN_MASK; arg.uid = sock_net_uid(net, sk && sk_fullsock(sk) ? sk : NULL); local_bh_disable(); local_lock_nested_bh(&ipv4_tcp_sk.bh_lock); @@ -1035,11 +1037,21 @@ static void tcp_v4_send_ack(const struct sock *sk, local_bh_enable(); } -static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb) +static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb, + enum tcp_tw_status tw_status) { struct inet_timewait_sock *tw = inet_twsk(sk); struct tcp_timewait_sock *tcptw = tcp_twsk(sk); struct tcp_key key = {}; + u8 tos = tw->tw_tos; + + /* Cleaning only ECN bits of TW ACKs of oow data or is paws_reject, + * while not cleaning ECN bits of other TW ACKs to avoid these ACKs + * being placed in a different service queues (Classic rather than L4S) + */ + if (tw_status == TCP_TW_ACK_OOW) + tos &= ~INET_ECN_MASK; + #ifdef CONFIG_TCP_AO struct tcp_ao_info *ao_info; @@ -1083,7 +1095,7 @@ static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb) READ_ONCE(tcptw->tw_ts_recent), tw->tw_bound_dev_if, &key, tw->tw_transparent ? IP_REPLY_ARG_NOSRCCHECK : 0, - tw->tw_tos, + tos, tw->tw_txhash); inet_twsk_put(tw); @@ -1153,6 +1165,7 @@ static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, key.type = TCP_KEY_MD5; } + /* Cleaning ECN bits of TW ACKs of oow data or is paws_reject */ tcp_v4_send_ack(sk, skb, seq, tcp_rsk(req)->rcv_nxt, tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale, @@ -1160,7 +1173,7 @@ static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, READ_ONCE(req->ts_recent), 0, &key, inet_rsk(req)->no_srccheck ? IP_REPLY_ARG_NOSRCCHECK : 0, - ip_hdr(skb)->tos, + ip_hdr(skb)->tos & ~INET_ECN_MASK, READ_ONCE(tcp_rsk(req)->txhash)); if (tcp_key_is_ao(&key)) kfree(key.traffic_key); @@ -2181,6 +2194,7 @@ int tcp_v4_rcv(struct sk_buff *skb) { struct net *net = dev_net(skb->dev); enum skb_drop_reason drop_reason; + enum tcp_tw_status tw_status; int sdif = inet_sdif(skb); int dif = inet_iif(skb); const struct iphdr *iph; @@ -2407,7 +2421,9 @@ int tcp_v4_rcv(struct sk_buff *skb) inet_twsk_put(inet_twsk(sk)); goto csum_error; } - switch (tcp_timewait_state_process(inet_twsk(sk), skb, th, &isn)) { + + tw_status = tcp_timewait_state_process(inet_twsk(sk), skb, th, &isn); + switch (tw_status) { case TCP_TW_SYN: { struct sock *sk2 = inet_lookup_listener(net, net->ipv4.tcp_death_row.hashinfo, @@ -2428,7 +2444,8 @@ int tcp_v4_rcv(struct sk_buff *skb) /* to ACK */ fallthrough; case TCP_TW_ACK: - tcp_v4_timewait_ack(sk, skb); + case TCP_TW_ACK_OOW: + tcp_v4_timewait_ack(sk, skb, tw_status); break; case TCP_TW_RST: tcp_v4_send_reset(sk, skb, SK_RST_REASON_TCP_TIMEWAIT_SOCKET); diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 64d242571449..54612c07c511 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -44,7 +44,7 @@ tcp_timewait_check_oow_rate_limit(struct inet_timewait_sock *tw, /* Send ACK. Note, we do not put the bucket, * it will be released by caller. */ - return TCP_TW_ACK; + return TCP_TW_ACK_OOW; } /* We are rate-limiting, so just release the tw sock and drop skb. */ diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index e373ca997ee0..6eaa20430fee 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -997,7 +997,7 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 if (!IS_ERR(dst)) { skb_dst_set(buff, dst); ip6_xmit(ctl_sk, buff, &fl6, fl6.flowi6_mark, NULL, - tclass & ~INET_ECN_MASK, priority); + tclass, priority); TCP_INC_STATS(net, TCP_MIB_OUTSEGS); if (rst) TCP_INC_STATS(net, TCP_MIB_OUTRSTS); @@ -1133,7 +1133,8 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb, trace_tcp_send_reset(sk, skb, reason); tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, 1, - ipv6_get_dsfield(ipv6h), label, priority, txhash, + ipv6_get_dsfield(ipv6h) & ~INET_ECN_MASK, + label, priority, txhash, &key); #if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO) @@ -1153,11 +1154,16 @@ static void tcp_v6_send_ack(const struct sock *sk, struct sk_buff *skb, u32 seq, tclass, label, priority, txhash, key); } -static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) +static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb, + enum tcp_tw_status tw_status) { struct inet_timewait_sock *tw = inet_twsk(sk); struct tcp_timewait_sock *tcptw = tcp_twsk(sk); + u8 tclass = tw->tw_tclass; struct tcp_key key = {}; + + if (tw_status == TCP_TW_ACK_OOW) + tclass &= ~INET_ECN_MASK; #ifdef CONFIG_TCP_AO struct tcp_ao_info *ao_info; @@ -1201,7 +1207,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, tcp_tw_tsval(tcptw), READ_ONCE(tcptw->tw_ts_recent), tw->tw_bound_dev_if, - &key, tw->tw_tclass, cpu_to_be32(tw->tw_flowlabel), + &key, tclass, cpu_to_be32(tw->tw_flowlabel), tw->tw_priority, tw->tw_txhash); #ifdef CONFIG_TCP_AO @@ -1278,7 +1284,8 @@ static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale, tcp_rsk_tsval(tcp_rsk(req)), READ_ONCE(req->ts_recent), sk->sk_bound_dev_if, - &key, ipv6_get_dsfield(ipv6_hdr(skb)), 0, + &key, ipv6_get_dsfield(ipv6_hdr(skb)) & ~INET_ECN_MASK, + 0, READ_ONCE(sk->sk_priority), READ_ONCE(tcp_rsk(req)->txhash)); if (tcp_key_is_ao(&key)) @@ -1745,6 +1752,7 @@ static void tcp_v6_fill_cb(struct sk_buff *skb, const struct ipv6hdr *hdr, INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) { enum skb_drop_reason drop_reason; + enum tcp_tw_status tw_status; int sdif = inet6_sdif(skb); int dif = inet6_iif(skb); const struct tcphdr *th; @@ -1965,7 +1973,8 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) goto csum_error; } - switch (tcp_timewait_state_process(inet_twsk(sk), skb, th, &isn)) { + tw_status = tcp_timewait_state_process(inet_twsk(sk), skb, th, &isn); + switch (tw_status) { case TCP_TW_SYN: { struct sock *sk2; @@ -1990,7 +1999,8 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) /* to ACK */ fallthrough; case TCP_TW_ACK: - tcp_v6_timewait_ack(sk, skb); + case TCP_TW_ACK_OOW: + tcp_v6_timewait_ack(sk, skb, tw_status); break; case TCP_TW_RST: tcp_v6_send_reset(sk, skb, SK_RST_REASON_TCP_TIMEWAIT_SOCKET); From patchwork Fri Dec 27 19:12:11 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: 13922107 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2082.outbound.protection.outlook.com [40.107.22.82]) (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 197A61F9F61; Fri, 27 Dec 2024 19:13:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326788; cv=fail; b=K8Ha1WxP+NPPetJpC5ABGzlQ/NRcytwvIT5mgOH7NfRiX6w68t0PkD9ADEKxc7pFH0zyWZf7W2eb9lK0xqCt+Ij/PMYZyehDtJr1KeogmjOq1lTPP/7e8N067npjcn9IhX/V2kDNRH51BdTB6zjnovZJlo3GtLtB59ZDxdO+e60= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735326788; c=relaxed/simple; bh=B63K06fPZIJMBBkJnXuewYLDXar3vfB7ly9mpRijW4I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=df0fW+PybttAuTaHvuW/hdk7bUVBEYOF4qZcL6s6bRHKXPGSpT/jb5tHYFRKubV/NLiBMqmf5aTzmFg7NVnJfu0ldQH0aoBV4dyJM+E1BMjHed0gFnUxrRo0itq62voLZQPQayGBNN9dPKfqGh0tpxHoEzYgvRjDHlEvlSLPQwE= 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=oX1UznHD; arc=fail smtp.client-ip=40.107.22.82 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="oX1UznHD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xfwcRpNj+tlsn/dtk+3Bazq3kBC4xRUCvF12sSdBFFpFX8yuBSzmcs2DVP+AORnqpq6j/UDhX0gVOTYn/WbrFrCtYtaqh192NVcWYqqRoJdR3iS/ABAS3BHvdBFi6ECK4HjdYzXDsUAlbN/FDPEAxFKPAAriEVBDkQQLJdrVltubXeCKERkpDle+wm5whrCr3/qbLjEgW7NNHqAvmSCEXNcyC2MviK/TLSuKF+YCkgkbGbskxwW9X+bVukr+D7fEJXPl61mE6FXmfuwkkHooLyos+sLcXU9ciLPOpAm2iyF4Gu+F3SONrw7VOOXlHFl5l7ZNEhPH+9nnOvuKN8j9lQ== 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=gAGbLNm+95eLXZ6Y52xMfP03JQ+w6fTE3HCUYf1s4rM=; b=uyNzZDBa2lDv3p0qpyjgUWnI6GEV5NpvBGTWp87ah9PyvoBAtQYPHfJ1A4WWQunZhbRA7fuTtI1Q+lWiQJZikuYkUrRhejfOCO6HXJJUuib0AJbbCi9pa/uMMfKHcr6D07FhQFfC9qLjBPVoPbQEnCs8YdoSN76Egnh8ggY0cIaJSZyKshx/dSxs2v0yOphGp0niXZltXZE0mXkodqXF3EHqJE9HpmFEU0tavNkt4iVZgV4S4UaX7INURK4RRX/aQJq3xlXSpB49t2LBUSAucojR7zeJL44TM+Tio9oXmRL6pN8X1M2ZZV7xRzHfUIj/b9iSMfe6+k5h+8pVpBOR1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=nokia-bell-labs.com smtp.mailfrom=nokia-bell-labs.com; dmarc=pass (p=reject sp=reject pct=100) 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=gAGbLNm+95eLXZ6Y52xMfP03JQ+w6fTE3HCUYf1s4rM=; b=oX1UznHDjkUISb8UyRugGliHbpesObfiNLtXCS49Y/iXtfc6fzxYeIWvnbMgZ7s1h3WQtOumT05PTuC1kDVOfYVI2wVxd+bq54J43R0lOo3zCNlVPhSKE6eFz8Os+fRuS3Y7l99NP/kOpteBsYAdNAh5U6PF7MMSP9m9+BrKUzOf1yddqxK3W0xPXgPnsr/9ObJ6iiWrs7HWjvWYryyEFbuJGY8SeVISA+wRWXstBBBBnZpG77WsyZc0w6LoAAfKrJyDkuOlVOsVvzKmi0kOpkIXb/VyQReed+95A9ZMcQBWxdYNXQewN/t5xr1V8Yc26Jq3pHqvkAitc76eMeeu/g== Received: from DUZPR01CA0334.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::25) by AS8PR07MB9019.eurprd07.prod.outlook.com (2603:10a6:20b:56e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.14; Fri, 27 Dec 2024 19:12:59 +0000 Received: from DB1PEPF000509EB.eurprd03.prod.outlook.com (2603:10a6:10:4b8:cafe::ff) by DUZPR01CA0334.outlook.office365.com (2603:10a6:10:4b8::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 27 Dec 2024 19:12:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia-bell-labs.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nokia-bell-labs.com; Received-SPF: Pass (protection.outlook.com: domain of nokia-bell-labs.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; pr=C Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by DB1PEPF000509EB.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12 via Frontend Transport; Fri, 27 Dec 2024 19:12:58 +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 4BRJCH2e011940; Fri, 27 Dec 2024 19:12:59 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net, edumazet@google.com, dsahern@kernel.org, pabeni@redhat.com, joel.granados@kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, horms@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, shenjian15@huawei.com, salil.mehta@huawei.com, shaojijie@huawei.com, saeedm@nvidia.com, tariqt@nvidia.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, 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 v6 net-next 14/14] tcp: Pass flags to __tcp_send_ack Date: Fri, 27 Dec 2024 20:12:11 +0100 Message-Id: <20241227191211.12485-15-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227191211.12485-1-chia-yu.chang@nokia-bell-labs.com> References: <20241227191211.12485-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: DB1PEPF000509EB:EE_|AS8PR07MB9019:EE_ X-MS-Office365-Filtering-Correlation-Id: 380a70c8-8d4a-43b9-9165-08dd26aa79ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700013|376014|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NQsYqopMmd+aYPxHTk45xGoa/DRpvMG?= =?utf-8?q?CcMFxmZemVzgzQGSiirOUNhFruTN4HM30vpS8aJGC+0Y350oS/ATdhqKlwuNv8Rnd?= =?utf-8?q?YfyD4Tn7UIuNYBgdGyiZqdf9Xqx3wLcQwXklmcdRxmRa3xgMiOdWDSa/9z1TXdG4i?= =?utf-8?q?/BqUwy475cAhfaoRqDBapvXG5hbjg0ZgW9Jid2azoIeWNcSY9v0iveCq4ibOEVleG?= =?utf-8?q?l4/zsFxIhj4kc0U227wdZi43c4Prse3FulhntEUfKfugxgkwoMm6wdWyoz3cUOEQ+?= =?utf-8?q?U10reRb35JcmDnv6N10VinBAF9Q2p7cy5PaXRAxaNY3rtgwiux5VrWs1vRxRu9g5z?= =?utf-8?q?+KMQm1nzMtuY5JSs7xAAWyvRGaNdZSfyUCBbT2Q+wCwrNhhaiI41HsOKWwRpEMSZM?= =?utf-8?q?XzH+Qr3DbEArptKZXRMV0FWk6nn1m80a/uLCOOJhmrHMtDrtDorLP7msmAzPDrfvS?= =?utf-8?q?hb6q+uymYfjVGSwm/kCZu/bTxVPjEGBdRim81p8GerLkw4pjnFfbMaJ2Xn+EjUmG2?= =?utf-8?q?qHgOK7hqcfCplO4yjfiFQqDjA07qSTUMJB/aU7+7Lgcd0NCO8UKM4pT6h6a6e2q9V?= =?utf-8?q?paVJ7vG81d1S44b8nUGJj0pOrZBh4HqEMWhwHJF8Y55lnJIdMXrsJEwloxlBYJfQD?= =?utf-8?q?Hh6430IXx8g5UfJEqTNJ9/mSoo2NK6HXDZE8uWRIMr6RAqEvy8gsBOJJl1C/3iAvq?= =?utf-8?q?J8Mdd8iAtDbKU+Fd5GxNKY/aECqw/GRSf9WhXg+38kgmw4v4mbomTzEFO4kEg+rmj?= =?utf-8?q?RJCjglCMGcnKWLvI/7DIxOJzfDjccyKHJ9mRElFVwk+ZmP2BfyeeCXOiUvdyHMuBP?= =?utf-8?q?XEAiftaD+fa3QXQqZsHqUg3ke/K4RSHVR+Yi55pNeejXWLZ5cDjgmNUGZ4wMBVcfr?= =?utf-8?q?VS1FdUbVaOphm7PyRdSDZmwH6H6yY9a2iyxV14iR+8pTdwnUp9tMlWYGXcpJdDHhL?= =?utf-8?q?ZvX9K9i0YKkCakTN8mtHU4GEzwkSjAq6VWkcRW5ihJEU0R1hFxDkJjoKkashAhXpg?= =?utf-8?q?gWc3LXgZ2/BoBrYUHUXDtHC/NeFcgU2eV3A39j/7I/v6akvD6aaCabcRZa/ujy95P?= =?utf-8?q?jlCnKbhXYQDkEkNVYvfYfs74N+yPMWN7Xac7QKjwY8gqAhV81R9ykAWOIiD3d2mo+?= =?utf-8?q?Xvz8sMOAp5Ai7VLsCGnAUa9cwsXutsvuCtI5Veu+oAds1OtCu2wDSgzMKC+gtNgNr?= =?utf-8?q?sOkyLIu/U23LtjD+5/kzBUsFvcsH4NiIAAapKoUrVObJTW0FSL80oGzG+gYLzKSCl?= =?utf-8?q?yhtaomCe/UQOJYNh9zh8beA/kGKqH7xYOul0VZl7cePLRLq++vvbouLj/kRaq3wFJ?= =?utf-8?q?F8RJygi3TX5241e3NQ+OM+pvmcBw+LaHAfpmi4ErrOOgKlvgW44rZGvFbB1ugf5U5?= =?utf-8?q?2FDQkVQHjUj0KUEEdU2ZncNqF1eCjZThub36mVa9PdT8HideRIhta4c3U31VZRO6G?= =?utf-8?q?fTqn/gxJHh?= 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)(36860700013)(376014)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2024 19:12:58.8159 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 380a70c8-8d4a-43b9-9165-08dd26aa79ff 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: DB1PEPF000509EB.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB9019 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen Accurate ECN needs to send custom flags to handle IP-ECN field reflection during handshake. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- include/net/tcp.h | 2 +- net/ipv4/bpf_tcp_ca.c | 2 +- net/ipv4/tcp_dctcp.h | 2 +- net/ipv4/tcp_output.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index a68c414b9407..5fde3e3583a1 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -704,7 +704,7 @@ void tcp_send_active_reset(struct sock *sk, gfp_t priority, enum sk_rst_reason reason); int tcp_send_synack(struct sock *); void tcp_push_one(struct sock *, unsigned int mss_now); -void __tcp_send_ack(struct sock *sk, u32 rcv_nxt); +void __tcp_send_ack(struct sock *sk, u32 rcv_nxt, u16 flags); void tcp_send_ack(struct sock *sk); void tcp_send_delayed_ack(struct sock *sk); void tcp_send_loss_probe(struct sock *sk); diff --git a/net/ipv4/bpf_tcp_ca.c b/net/ipv4/bpf_tcp_ca.c index 554804774628..e01492234b0b 100644 --- a/net/ipv4/bpf_tcp_ca.c +++ b/net/ipv4/bpf_tcp_ca.c @@ -121,7 +121,7 @@ static int bpf_tcp_ca_btf_struct_access(struct bpf_verifier_log *log, BPF_CALL_2(bpf_tcp_send_ack, struct tcp_sock *, tp, u32, rcv_nxt) { /* bpf_tcp_ca prog cannot have NULL tp */ - __tcp_send_ack((struct sock *)tp, rcv_nxt); + __tcp_send_ack((struct sock *)tp, rcv_nxt, 0); return 0; } diff --git a/net/ipv4/tcp_dctcp.h b/net/ipv4/tcp_dctcp.h index d69a77cbd0c7..4b0259111d81 100644 --- a/net/ipv4/tcp_dctcp.h +++ b/net/ipv4/tcp_dctcp.h @@ -28,7 +28,7 @@ static inline void dctcp_ece_ack_update(struct sock *sk, enum tcp_ca_event evt, */ if (inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER) { dctcp_ece_ack_cwr(sk, *ce_state); - __tcp_send_ack(sk, *prior_rcv_nxt); + __tcp_send_ack(sk, *prior_rcv_nxt, 0); } inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW; } diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index c2763c3361ad..9fa58ab46aa6 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -4232,7 +4232,7 @@ void tcp_send_delayed_ack(struct sock *sk) } /* This routine sends an ack and also updates the window. */ -void __tcp_send_ack(struct sock *sk, u32 rcv_nxt) +void __tcp_send_ack(struct sock *sk, u32 rcv_nxt, u16 flags) { struct sk_buff *buff; @@ -4261,7 +4261,7 @@ void __tcp_send_ack(struct sock *sk, u32 rcv_nxt) /* Reserve space for headers and prepare control bits. */ skb_reserve(buff, MAX_TCP_HEADER); - tcp_init_nondata_skb(buff, tcp_acceptable_seq(sk), TCPHDR_ACK); + tcp_init_nondata_skb(buff, tcp_acceptable_seq(sk), TCPHDR_ACK | flags); /* We do not want pure acks influencing TCP Small Queues or fq/pacing * too much. @@ -4276,7 +4276,7 @@ EXPORT_SYMBOL_GPL(__tcp_send_ack); void tcp_send_ack(struct sock *sk) { - __tcp_send_ack(sk, tcp_sk(sk)->rcv_nxt); + __tcp_send_ack(sk, tcp_sk(sk)->rcv_nxt, 0); } /* This routine sends a packet with an out of date sequence