From patchwork Tue Oct 15 10:29:22 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: 13836081 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2070.outbound.protection.outlook.com [40.107.21.70]) (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 212611EF087 for ; Tue, 15 Oct 2024 10:30:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728988232; cv=fail; b=mHhE+DM6XT64XW170o4QWZMPYB/0xtxgA2V5ZC2hKjPas4DxiHbmTMRXfH555lxGID1SAGZt434R44JBrQA9V8Ps0KQ/Q947p3izKAfXA8du9wmM6yRrluNrJ9L/ULShIk375xeL04KKVps5ASsMeBNYP3k+de6xKuio3uIbxoc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728988232; c=relaxed/simple; bh=Gn1/UHy4PJ7gn76PcQtxLIFaOwAKdGOwbNQmuf3ct8k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=LBUQOpV2RxFIr9o14GOFGBong82d4HJRAlavYx48DOhYI2TIuCZm+0rKft+bbL0Vsgdb0b0oDR2nQu5TRHbBXw0GBUDnYq+/wDodLP2+y2LF2fERcIVu3bD0BGlxAqdouZUcEKl5ySaY52U3svGOHnVpO+6V6+Juefkemthcx/w= 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=X37mKPSq; arc=fail smtp.client-ip=40.107.21.70 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="X37mKPSq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w2f7DYVW5JxChNdSl7zpSdzaKoAk+Lckd124KF1bt8lxNjUO4n0qcvT7zV9+GZfdsBa5IO4MTcy8OayiU949ZmDmh4f2EHML0TZzjbu/+RosgqTglcygimPGIvyxwxX9GIoxn9d2ocaXQi4sk0KUe8xKuaUQVgQVStYlNF6Jj8xy6kH9cGQXlYXANimi/5Y4g37AlyuzSrXaUJKmagq7FFa0wuHHzl1O1Cm1Y3oRGzr9M4WMj5WgdJqv2JPp5ROoEbopQpX1O8b3RfPwsGKxBMQUx86bD5sxs5dHyvlcSLP0mBrB0nGoxyyNq/b+Qq+lh2rb+P/ahY3j4m/ybN4Eyw== 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=j9WwR2Xv4FIHJwuPLcvHdHKdLc6GIQYEULQNRRvPIyo=; b=Z6KT5WqeULtzjtiq+RYTK2hYF5BWvw6vEHSZdkGnUnXtJx3oLV8vfw3qLOeOZ6saM6x2WlWWTzDMS60TqNIhyQdhpK7y0KmwY1fNBrC5TFsO3JRqcfHuyj5tYxSSiKJPnc8o8UkpYyua1hF62qNJPyIBmxYNhNKMxlOp4Zoly1SbL9HqMZ9mSUwibwbG/JyyJCY9td4lrrFtKk8OokLS5oUF0zHraqxwSba9kMsu0cekw728YrOclZiN+CSCDNocQS+QH/9d/7q4JQAB0BE7oxab9tIJcdf/eMH+FdgYerlRiIMBQZfyoMqcJTpkE+BSuDqDX3I9xLyI7t+1KY7Ygw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.101) 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=j9WwR2Xv4FIHJwuPLcvHdHKdLc6GIQYEULQNRRvPIyo=; b=X37mKPSq4d5phqIkZXwiE4RTFP06BrLEYfrClqRlKxecupQdt9FYVmbbfuDrEJVPHvra1+F/jjyGuZlkGJqHpJ3McRqRQzfYalgqLrvmmDX6yEWbZOjjw1u+QwbTyIje8YgjuQg8DTDlfPcNLBXzwxtweuOToPME/wtk4651qsxgaHskpw2IZxv0wobyVx0YZJJfDOGrghEW+RnKjODTAf/MZ+qGicpJ0TvuEMDH1Bob4N6vu9vr8As4GrZCsZvb82WOrWmA276CXMICUfeP6mEqV8aY/AmXqVdLfX0aIkQr4NZXSNfnoW5Krl+GIFHWLhEEfhuqVprJCKYS6lDj8w== Received: from DUZPR01CA0066.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c2::14) by AM0PR07MB6273.eurprd07.prod.outlook.com (2603:10a6:20b:144::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Tue, 15 Oct 2024 10:30:28 +0000 Received: from DB1PEPF000509FD.eurprd03.prod.outlook.com (2603:10a6:10:3c2:cafe::f) by DUZPR01CA0066.outlook.office365.com (2603:10a6:10:3c2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 10:30:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.101) 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.101 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.101; helo=fr712usmtp1.zeu.alcatel-lucent.com; pr=C Received: from fr712usmtp1.zeu.alcatel-lucent.com (131.228.6.101) 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.8069.17 via Frontend Transport; Tue, 15 Oct 2024 10:30:27 +0000 Received: from sarah.nbl.nsn-rdnet.net (sarah.nbl.nsn-rdnet.net [10.0.73.150]) by fr712usmtp1.zeu.alcatel-lucent.com (GMO) with ESMTP id 49FATtnU029578; Tue, 15 Oct 2024 10:30:26 GMT From: chia-yu.chang@nokia-bell-labs.com To: netdev@vger.kernel.org, ij@kernel.org, ncardwell@google.com, koen.de_schepper@nokia-bell-labs.com, g.white@CableLabs.com, ingemar.s.johansson@ericsson.com, mirja.kuehlewind@ericsson.com, cheshire@apple.com, rs.ietf@gmx.at, Jason_Livingood@comcast.com, vidhi_goel@apple.com Cc: Chia-Yu Chang Subject: [PATCH net-next 26/44] tcp: accecn: AccECN ACE field multi-wrap heuristic Date: Tue, 15 Oct 2024 12:29:22 +0200 Message-Id: <20241015102940.26157-27-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015102940.26157-1-chia-yu.chang@nokia-bell-labs.com> References: <20241015102940.26157-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_|AM0PR07MB6273:EE_ X-MS-Office365-Filtering-Correlation-Id: 9313b7b3-7caf-438b-5a44-08dced04631e 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?f8911/mmppqQ3it9uFgRrMCWQKfGWVD?= =?utf-8?q?zhu3HSz+SW891Y1x9APvjSKukKV8RgI1OONJCViq0jq1sVeC3qq2gy9PQRq+rV8Xs?= =?utf-8?q?UruCudS/Y85PC3xiv6sps0pyHCUZY20B+zrIAjKHQ0kgynWJAF45w8pvtOi0K/WoM?= =?utf-8?q?CSbZlwswEtaTbjc/5Kl3rz8aQSSWWLuM5s/7y1hi6xxaPxDrqIMkcLXYj/buHeWHG?= =?utf-8?q?WyhE2SS9KYJA0MksYINS3ghQWXQePaCedSdiH3CiBTpb7GkAQNmiPDhuRpkZbQnQG?= =?utf-8?q?VfD4cGFCf17E+HyuK0DiGIZnkw1y/Qjdaiod+glxgfZyKC/3zqAaq1Xee/RyjC5tU?= =?utf-8?q?W6xmTeXus9UW1U+nuzITRMM9dXBvaWTm/sP/IW1deMVNAMQUS/Zu2fc8iNQ9sgSGi?= =?utf-8?q?NmOacbqdqtJH4efCHcD6kYReaBjOTgeo8g71vf/avajnAJUt5LM6xk5CMxmFN8t0J?= =?utf-8?q?WZv7bdkGShiZmuV6ijDQi5Pwme700ZjOC7VxV2EA9pJPSsfEnuaIE+/tM0Tflqg3j?= =?utf-8?q?J2Q2tXcv+RwMMQUeg8y/nHAWjXUDqf1nFsQWMmX9EImmzNYiK7yRy9ZnDrrKFmB54?= =?utf-8?q?+r4HD65Ruue9g/sHRhQuxTOCyADoKyVxJS19PnUN+iNzIyb6XImfRPXTIrItFLJPo?= =?utf-8?q?SUE44pSDW1z6qDb6puV38y1cCAqXKApOKmmL7mY7TI/8wFk3Ih9jUH8qFTNYxu5e8?= =?utf-8?q?RTIAlivmRzv/N9rRZXHP5kmJPGtJva1DPgj4WsIQACCc+kTIcJZ9aqAn07EzrYgP2?= =?utf-8?q?13lAAEq2cZb2LdWXJ1BcrwWtfOmJiPrHlFf/JsyWJhIDUVgkDqXUpdaZ4sq6DHAQI?= =?utf-8?q?HpK5FJ/n/E/kn0iXlcgpKhYO5HQiSfxOQbCOKs+fR7azI+Lwf5NgPq+wAL5b1+5HB?= =?utf-8?q?/PSzFKdcFpEAbGbLP/OOi8cQuyruh5EE76xWFddO3nArQNuvUFVbQIrmWsGJFgh7f?= =?utf-8?q?1ztapeGmU8xFRTdpcXGzT8xQVZf0wqDM9G/91nbHkmK0K047+edh/82Jmw0aZCSBr?= =?utf-8?q?da0Z56dW7JOotf+M2hug/KfUQaFR78JeDzgM3PFYjqk1Oc1VrACd/ZvznjzTkJOCo?= =?utf-8?q?rAuNxbqGLPO43zjm4bxMxWjkJYGGFN5pIrjlFDwCnWzf7ErzGjeX6r9rR8a1S0HKI?= =?utf-8?q?ojv/j8M5l99NyqsJSPN1Vw0jAaUX3pbgWCq7W3T7QdV3JzOW2ADma4YH2uoGj9DH7?= =?utf-8?q?BNFqb7b+QOY4AehwAv+G2uQ9ZBoXfeComDXqoUWJYWLFY2TMe5kzRADBxrSwgPAmP?= =?utf-8?q?iceyWWH+F9VNQJtHYMCbce1Z7+KOquSh7Lad1/bbxkPSYYoaRWnjMZrihvkbYSmr4?= =?utf-8?q?AQ6gheiMxTLY?= X-Forefront-Antispam-Report: CIP:131.228.6.101;CTRY:FI;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:fr712usmtp1.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: 15 Oct 2024 10:30:27.6790 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9313b7b3-7caf-438b-5a44-08dced04631e 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.101];Helo=[fr712usmtp1.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: AM0PR07MB6273 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen Armed with ceb delta from option, delivered bytes, and delivered packets it is possible to estimate how many times ACE field wrapped. This calculation is necessary only if more than one wrap is possible. Without SACK, delivered bytes and packets are not always trustworthy in which case TCP falls back to the simpler no-or-all wraps ceb algorithm. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang --- net/ipv4/tcp_input.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 79e901eb5fcf..ac928359a443 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -705,6 +705,19 @@ static u32 __tcp_accecn_process(struct sock *sk, const struct sk_buff *skb, d_ceb = tp->delivered_ecn_bytes[INET_ECN_CE - 1] - old_ceb; if (!d_ceb) return delta; + + if ((delivered_pkts >= (TCP_ACCECN_CEP_ACE_MASK + 1) * 2) && + (tcp_is_sack(tp) || + ((1 << inet_csk(sk)->icsk_ca_state) & (TCPF_CA_Open | TCPF_CA_CWR)))) { + u32 est_d_cep; + + if (delivered_bytes <= d_ceb) + return safe_delta; + + est_d_cep = DIV_ROUND_UP_ULL((u64)d_ceb * delivered_pkts, delivered_bytes); + return min(safe_delta, delta + (est_d_cep & ~TCP_ACCECN_CEP_ACE_MASK)); + } + if (d_ceb > delta * tp->mss_cache) return safe_delta; if (d_ceb < safe_delta * tp->mss_cache >> TCP_ACCECN_SAFETY_SHIFT)