From patchwork Tue Nov 5 10:06:35 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: 13862733 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2054.outbound.protection.outlook.com [40.107.249.54]) (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 597771D1E71; Tue, 5 Nov 2024 10:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801232; cv=fail; b=t36ulDSLKI03aiqGei6LXdoXfoFMs0yQ/HzCu6vs163MHlHe/hGxX9Mgkh8WBdMYsmtji8CuO35JqsF3RlWr8PziswmFHv1VfWyahyN1aDwR23gzlvdFBmmRXfLelADKWtP42YOzSnVsbaQ8AERFzRD2Z0eUDwEYWhjUI4HjmWo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801232; c=relaxed/simple; bh=undR/3AUMa7xPhBuHpEtaAz+WVt05ZZ72lfV2xzbLWs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=A3NlH791vr8FXebwJ4ZshcDtGPzbMVUgj65I19eP4kh8NebsT6s8mhpYtP1tjQxhusIlVt4BlnG88RNj53LOqqVWPneZVrYRKp0/v6k8LJRzBqSAu4BXVIxBi9HaSbgo8+dS7cX45iQqN1lJwEGAiGuisAvJbY9RdEQOAjw6Vcc= 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=rQud75Cj; arc=fail smtp.client-ip=40.107.249.54 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="rQud75Cj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qBE1+qNlLNMPcfmojgrgkCbd1lpv2oEGjSPrsnP0cO/Oc69t8QVuRjgTNBiGW5HP2n8jMNMY/LLM+uqAboBj/93tGO7ECMhzsydb2PHnWPFPZrVaA/vcroePurg5go5JeCYQPCpgWaHmG9DyCdsDxXw8c4rHmMGPH5c8LtB2QkxLGNSRxy1fJXi0SHJSr9aoZHTLwRmjinFbcr4VVPc4QsTKb9/RZH3oyf6rSA5L3zYT3FBZhYTDEjiwOYjZmZfz0uO7NDUUJb0JrV2A20/5Q14Y9CCJnQpXN0Lo6X/X2C0QxG+BwfzQ71n2GJkQNCEumbU3DkImpQXedWo1W21KFQ== 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=Tpn3nQqAQ82hXg4RIYB+P6Y5GVodjhYMsmufaB7g9ng=; b=lZh1yWJVjpRKrYv832mmuCvDgpyp/MVNDKaZ3AWbK50SZLCCF8alGXnAtqcrxhG7bdgYpLcz9TdlQKdvhwwMOetgv+2h/7ZWDnOi3riepkMKTO5Ecb/3/L0Itkv83MpXqUfsNDJAZXhOCgRPvlBPkK59Cee/8GBOnNmjroJZxoMEEn+SyfVXjx6i9rsmc/vEG9/aThdStqT9OGOoPh50qO0wj+406Nt9fA4a2ObiFsR+6EX5qxg95aH9JZYrHjmOv4KvnoBgpKYSxPDgZ/xcwBRUDfVemubzdcE91HYeYfscDeWnrRwiLZB2M0DqikTZ2keaNlI84MFsHC4VZp+huQ== 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=Tpn3nQqAQ82hXg4RIYB+P6Y5GVodjhYMsmufaB7g9ng=; b=rQud75CjjZ6YjnlOtzlpQs/HzmW4rdUNRckkAhBABrCniq75uoOgIkNsVt9ZDKd/86ifFQXsiUbcGg9hlI5O+PnQGdePHvhwCmj9xDWOC6fTByGcc/IvPAP69vTInazdjfy92cE2whocECfxV47uJSQQJXoAdjzQUp/hD2QT4L7lHA4tJ7F4OUfgzj8dzpNM/fdwxawvCEmTJZRPGPAtY/YWA9R2mcr+5Cyx//QDVBuyzHq4baPxKmRigSVhmHO+U2T4nBr5VGZvKWgMMB5YA1URkfduF4PD54RJZMpxwwzFWtu33QMjEOpi6FA8L6VcGNO7xk7sQR0lWuZ2AiU8Mw== Received: from AM6P192CA0040.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::17) by PA4PR07MB7615.eurprd07.prod.outlook.com (2603:10a6:102:cd::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Tue, 5 Nov 2024 10:07:05 +0000 Received: from AMS1EPF0000004D.eurprd04.prod.outlook.com (2603:10a6:209:82:cafe::24) by AM6P192CA0040.outlook.office365.com (2603:10a6:209:82::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:05 +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 AMS1EPF0000004D.mail.protection.outlook.com (10.167.16.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:05 +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 4A5A6o2b024723; Tue, 5 Nov 2024 10:07:03 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, 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 v5 net-next 01/13] tcp: reorganize tcp_in_ack_event() and tcp_count_delivered() Date: Tue, 5 Nov 2024 11:06:35 +0100 Message-Id: <20241105100647.117346-2-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AMS1EPF0000004D:EE_|PA4PR07MB7615:EE_ X-MS-Office365-Filtering-Correlation-Id: 37a619d2-9b80-4199-34db-08dcfd8199e8 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?/4E9VemKbVSsUdnoj/cptW/AhVGdS19?= =?utf-8?q?1VU27ZTa1EzgQ3+07xHtjr79s8aoZ2/GDO/y0yCB6do+5jl1ps+Urhwdbf6kXZec0?= =?utf-8?q?0nc0wenc+HNkrMSfK+GILycW9RycKu9KLNGB/o5Vh8IBvx95Woc+e5IBhwHPFe8s3?= =?utf-8?q?98hTtoZyT6CvE4pXiFemvguZgpjFieR/KbFa4sKYTwx9yH52+vpWet+wCtd87OXmK?= =?utf-8?q?KIVo+BlrYEVDG0312wdC3IoWdlyqMB2hkFpPDk0yB3GQq5qc1VxS/pVXzY5DWSGl0?= =?utf-8?q?Xg1TicYENpEgJHH6fE9yclAbOfLYHalkDmMWMvqgyFLEOGcZNIgWjHHZ0PUDiunm5?= =?utf-8?q?5Sl/P5V869oSBUSjkjGooBlD+nsxfuKo+EX0MZ9roEZy10kpTnTJ+F3QXv772O1SI?= =?utf-8?q?S9TlaFQ++u4Pq/0QXb8Umerrxwx625S+lu0gS+8nxYJ73QIyoXdbxULh7qFIuVrXI?= =?utf-8?q?MSkxrLCeAelMVh0mr5DzY67Pobsg+zBD8tEEdD8mLOwh/aQ36tNzqLrD4hhp5RTbs?= =?utf-8?q?Ore8tSjgTy5CY8NkOeMInSaC38lUDATbfQcTIVGw7HRGCfWCfSbAIaWNql8imBpZk?= =?utf-8?q?mgXuWB6cD8z9w2MQaHBkKJfWv/wq3SSRd6RD0zlUp7t0TTcKa8ftQRhlNz5+/nURg?= =?utf-8?q?D/b6JO8ttg8QaVMJviROWiQBrdH72mzX1vnaxn/N0huDkFA1AUlwUWYYYNlzSQiaY?= =?utf-8?q?43jUsqtmzH8/oA2axFKhd2ie4FfmApwxGHo9fUzsKbnBWGCu8e9qSOXUsstn6Gv2v?= =?utf-8?q?0OZ7Q71OnUEUyglHcWDhVbp3IBDDUYBCzgsKrMZoGlUuWzS2L2W3AlHnWFJuM2Q4v?= =?utf-8?q?3TKT7CS506oZqVL1o6ElPIMmBGFEG3OzuU720YNg5n8ZnDiSsL/KU/dsyBlcTW8Nw?= =?utf-8?q?Fa0tviaHBN3Fz3yqFea2jFO5f/q+h6Stmhf8G05XS9CF4MUGZRHYYg9WevrC0cxIU?= =?utf-8?q?+bGDRDPSPOz6xEosR2z/UniOKS21rb802teeyziMT3/KaS1aXVvsW+sDB3MrYR0kU?= =?utf-8?q?hPk+0JdMbqOUGLXob7hBjfJ+n355x4ulF8li7e7xJMQp6kxj5tFpOcXkrH8zUL/+v?= =?utf-8?q?QTJo1363RnEIE0mO8N2YBOK5KuyhIPj91U6sAtkkj1C+/Yj/vpNa0coHvTjfU32ls?= =?utf-8?q?8XnS1lAkikOj9KQxa4urKo3mfLchOC7+ie44CBAreTFU51xvXDdI5eqhWkmzcwG4x?= =?utf-8?q?S+YKjf6hxWpHAbdBI4LYIde5su9jnPjb4aMGcCgmWJ7uUiKY67WXAdX+9ElKKTDun?= =?utf-8?q?u8wOYe2AqqzM5tHWrsmX65PX2BNmsalHjVl46FMuuUDJoDrRBia/Qphd7HKIqWGE2?= =?utf-8?q?ksszu2JsTmCeRz39m4fpArPkhjEcN7WwAQdlhGBOu5wB9yD/hmV+UYg=3D?= 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)(376014)(7416014)(1800799024)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:05.3414 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37a619d2-9b80-4199-34db-08dcfd8199e8 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: AMS1EPF0000004D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR07MB7615 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..fc52eab4fcc9 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 Tue Nov 5 10:06:36 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: 13862734 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2085.outbound.protection.outlook.com [40.107.21.85]) (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 214E01D1F46; Tue, 5 Nov 2024 10:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801234; cv=fail; b=efRRA8q0FdqZTO9WGVrpNRJevuOO/yWwL8rH59hAAXlf1kODj78euU9hNzJHm/zogVmi2Ha73/ivb0tkWxS/TsZa8RiygX80B69pw+HdUXysnzrxI/uitEEYK1ugHJphPyFVQfk0p+dNxH9MK0wnvQ7Y4rY1CtlNd5NVa8F755s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801234; c=relaxed/simple; bh=1hUO7+wovHcGqJC0Yp7DTQ8T2gJSqSAExU9lZet4204=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=KEimMGVyTbmUThUFD3kR0TzXDNmLBu5OYK3qcuf4i//KtaXJlY04ax+VeFTHBgc+zkHNeQ0eF7yWz9Se9r5oJyiJnFvZm+EALvwO/BeYu7RFwuavhkOMcRF56/ZMguHwv0rNI27oERUpve3Mup+GeqfgoRQ7ascEChOhuAOgovs= 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=H8M8JgCn; arc=fail smtp.client-ip=40.107.21.85 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="H8M8JgCn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G3M2av2S4mer6h8z5oo3Qj/Aek+6enq1Rk7zkIInI0ybdkB2EEcP46I7cUea76W4yx5YxbcnLrev3Nmh5BO61bOJsR8rSaD7yXA6RxMAa6sJ+qUt7KX9uU4EymRGQ9KbpBobFEwrSXYJmax7sAvVOYydq5ELqlLolGgLldzY7twxeohGzeMWTv8i5l+dk9Y+mx3ZNxvLa7FEzaNHVwwQwKcNbJ8jv8OHliCi66ftzSnHCVhvVU7aSE3rI8vewKi4DoX4SLBmfF5neaY/0mjhEXUnA9QoRz8drEBXAIAktTxB5yadV5oeuuFkFBrYfSTsdhxjKMzyrxwJ2/9GLtzZCw== 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=CQPlh+hxNXZNwK0AAtvrUWy2uf9fT50P/b2uNXfazGA=; b=m1JCrzRB6wF6LgLaOL6IDCfsy2Rm0zCjgjrUfJnm6FDiskujk0OcOQ4uIa9YYYCVZ4RrQAF/AREnhKrC9G2HxnDM/pERkLr5iZ3vhXGNXJ+705dGtAdwJiIqMixnCNf6cUbIQhJUOhJ+1kPT/9F/CkaMmMN0rSte2k48qhdXAPQTtiy7H6XWcc0HUYbO0VMzRnki62Hw4V3W4hGhCGMTzDnTMi7R/Ito3CJZEPDwaAmzZUuAVREV1m4JA7DFNdPUu/pOfIE7NZ3FtrJnBfPsBOzAQJL94Tn3aAapVHLFeSJn1jyt4BKB+nyakCRT3k3aFcoa7SAjF1UEq6bgsuzVLQ== 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=CQPlh+hxNXZNwK0AAtvrUWy2uf9fT50P/b2uNXfazGA=; b=H8M8JgCnPNrV+Slu/E7FXKOGOhLDSzo0sxBmlPD9w1/4+FRo6lE5pvF7j8KWu4jyLypQ7Z/rImXrkS3VQLAgAJ3f1uplPNn2XHqmZfa+oTxqHeCs/hfefD1CZLk4pSJBKXYzJso72INeXg/zB6uz3GyYwaEDIZWFLyf5KULZYICj4d6S04NI1Bti9qtHgbYKgzD4YzRAFNx1Wu2Ze9s2GWiQnkkE+0Nhd3RrqMAAcjc0kTaDxWH8Gwl99n3VrDavXDLzvcmsA9AYGLcoMGnK+D4ghw7ff6jltxqLOMoxtck1Vhn1Z4+fBDQr1m5ggDOf7e/AqYiwr4d2V3NPdFEckg== Received: from AS9PR06CA0545.eurprd06.prod.outlook.com (2603:10a6:20b:485::15) by VI1PR07MB10090.eurprd07.prod.outlook.com (2603:10a6:800:1de::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Tue, 5 Nov 2024 10:07:06 +0000 Received: from AM2PEPF0001C710.eurprd05.prod.outlook.com (2603:10a6:20b:485:cafe::dd) by AS9PR06CA0545.outlook.office365.com (2603:10a6:20b:485::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:06 +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 AM2PEPF0001C710.mail.protection.outlook.com (10.167.16.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:06 +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 4A5A6o2c024723; Tue, 5 Nov 2024 10:07:05 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, 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 v5 net-next 02/13] tcp: create FLAG_TS_PROGRESS Date: Tue, 5 Nov 2024 11:06:36 +0100 Message-Id: <20241105100647.117346-3-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AM2PEPF0001C710:EE_|VI1PR07MB10090:EE_ X-MS-Office365-Filtering-Correlation-Id: d024df15-2efe-48d1-d908-08dcfd819a8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|36860700013|7416014|1800799024|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?HOTZqJiP5eeon0SdYGpBpO2/T0lkdpW?= =?utf-8?q?wzwEyhIeB6mvLgprYzjeBMrhnCGad4vbA5aL9SSSi0jS115aUw15NYX3m8xJ5jbFP?= =?utf-8?q?mJMyiIP3hFfveV0N1qu9V3mxEvLoRkIn+soeQvdqAPXfb0Vq4G4J4OiMyaZ4auWfb?= =?utf-8?q?aFkkVtYf40BCBeys78msUGasz5Q8+ZFy++bV2ma+hl3abvjNWnuP5IRUpO7BtIpd6?= =?utf-8?q?X5xMJft+HzSRJOJjRxIuqwEShwFfgLsw22OLaETvb6gFkJmAYEcGrNIatJGoS4D1K?= =?utf-8?q?cx3dLG5FPKh1FPdSMK8UUeLosdiBvVAnrVyzaYrVYU36Xs6KFBsxim1X4cI3CMP6y?= =?utf-8?q?aaATfMe0Cc+aVTLF1cs2upDCGGSp1SriW9gF6s1AhlnxPqtGsVj2LCkmGZVpGkYyD?= =?utf-8?q?fXimdX286qlE5MszSEgLfcECmBNmSpElQO/JqJ+cb+1yVr8vEClOkow9y9xqGCvU0?= =?utf-8?q?TxAviKvcJaiiKi0JrUXGPqumOaLqWcNRl2BwjaRCUHWyq9kRKlcWzXw7jrexOlAtb?= =?utf-8?q?eycXh4GxE7qU86J/52Pv2SoU9CerNl7VjOCWP9s1mK9sm7jrpN+DGRh0HUQxNr7NB?= =?utf-8?q?bdGdtsyqOb5dQ4Amq/4KsqaELuepqBbbeQIoUv61bouTrulkBNmpiwnegV74IqcYO?= =?utf-8?q?qgO+VDkbkSr30qOVNURBNwcNUMX2LWmktLs8yAqcUgUbMEPpAZQBGrvddpqULGDbw?= =?utf-8?q?FEh5AtrlOQPB0gisWUNYERHQI6W9pwH55ljfuWWNEAEmmQqLo5xezaO99IJ/y+lxU?= =?utf-8?q?IAgNCJ73T7NRLc3cWCZ2JL84ktzhhkVXL6hanAIFIBQOFmrap6XfbdWCaijOTHWhA?= =?utf-8?q?ch2j8FaJ+g7HXTTO0szBvx9Uy6oxOWkAZ8dI5OVR95mg4ZQxrHj+B5Y+d5wxn4XN1?= =?utf-8?q?tBK7URV9NpXhRSYNfxZLHDSxKEwldFat/Z0qfOhTfgeko48GLMURyaGfqwRHo50ql?= =?utf-8?q?CsUFR1/55L3NVK/hu4kdkZvSWqgmR4eUIkVEhMuLY1/QvFtn1oKCmSw/tMmEzNG+b?= =?utf-8?q?O0+ZnYfU+jPBi8V1mt/CwHBxtf+4cpcuNquV7zPbcqbK0qx1uGeOLGoZwrbx/FAYT?= =?utf-8?q?sHg/MXRJPdocV/j1uSWir8WW5qDZL9ide1dxLc9gaTriSRKGSDxGzzrizWN1jeXna?= =?utf-8?q?wxfa4Ms/PHD3l8/o1s24dv9qX4QMtgFdQAXmpUS4TD/ifdWOhU7img7kTG371Z2UM?= =?utf-8?q?4hlXesMwgcKWpblzICgM05yCvoohggEtTqJgtcbll2zMHxFObyBiysaG5FR9zy2Qq?= =?utf-8?q?DMNUnYJHphFNXsCsOISa2ych2oR+fgRjQMu8Bn0nUdfoK4eh7INCWlp/AT1VwL+gL?= =?utf-8?q?66P/ggYYKr3E65VQe5EAio+OU9oLFiZhsv+37Bs/0WsXyaWUT2LFGBA=3D?= 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)(376014)(82310400026)(36860700013)(7416014)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:06.3982 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d024df15-2efe-48d1-d908-08dcfd819a8b 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: AM2PEPF0001C710.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB10090 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 --- 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 fc52eab4fcc9..ecb3de69c6de 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 Tue Nov 5 10:06:37 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: 13862736 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2055.outbound.protection.outlook.com [40.107.105.55]) (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 A77AB1D2232; Tue, 5 Nov 2024 10:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801235; cv=fail; b=lhPJbHg1F9O+kJ6wc1yiv3GqzoM4pUjI3pyGee9TPZA0ORa2iveBeG00Rb5yK6dpUs2eSWrKlUDTiTRGOaRvuaek6YQCZfn7kp5HzHCDx3zvD54CDeWIbPZkMHQpd3uiIquAOzg02q7k+R7ZiCxfRH+7m8ML0KihJusIV2Iyd4A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801235; c=relaxed/simple; bh=VHilEMYxpKn5hhen868ZcLWPndwq2c439JHOD2fLgIA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=twHw+Iph940mggJ7UcdXtylEZY6YUEcvOOsZB6uhhUXiI7gEeB4C4RGTKlK7L8deyoijEYyUfqZo2ZZEPuVCvNIQel+xVLDMs/1JWChsDurC6kRtCe8oOm36PLxtJi0sDpmPhDbDiKkAQvJJTchmL/y/QZt+LqIHnbwDiSgd0jw= 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=ivyt2rSY; arc=fail smtp.client-ip=40.107.105.55 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="ivyt2rSY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ogeuAeruFfwnVRfOxGWXL8Z0/oixKj14CoV9fAVMeyNQVoJNqDgL4RYXdLOcpOF3JOMjE29hVoApQ8PHKVjZ9kOlDrxX0y/Ec4+h6caGsBktK2Qb7/9YhCvXbBpzPjJn2bfnMxCTswhh39CkKbRUC23u3napatTylVgSXMUrt0yF4cnwZFNSP1rP30wi+Vsq3hmc7lNzb/fqq3xXOiv8Rfezf1QhzD+dYbIl5dhWl4TW/DsS+4kSgbdtUCu64E+xMXNkF64/2TNPdedYQFo9B4kHKgaMmmH1jB5p7418jBLGQOJh6lzuh/lPhJ1Dz65vgqu04Lg9lKnmmXvt8b6ITg== 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=9iG33npHxgvNvqmIUpLFwRjxAsBrazRJD/A6KR/X9W4=; b=Vptjv6ZKRDlBIxfbxIFY9zO1hPnbQqIgcYBhUOLQ8crj+V6L5MzvIItKSOXWT8hHdVBtgtEh+ZKbtlwVe57YQO5lHGJCH5ID/1f0DTxG+7CdURukt6MAJnqbPnDGQ2QCLSl58zUfQGEJw+8Yz5gxN2RQ21wt1TfoLsV20VcbP1dXywTWsWCeW8TlEX7r+KBkcC33+hXIc5n1s/5YkCOMQIUID4o1EDrxMzSWAy/VI66/m7hMFrZrOs2aiJqbpuamEqWLYMYZCYw+1VoCl2EPbEz+K4lkXDszeC2xd/P8L3iI8ZKExk7NS7u/j5oWGjAVcgRTLCckn8Jv3TxV1+hzbw== 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=9iG33npHxgvNvqmIUpLFwRjxAsBrazRJD/A6KR/X9W4=; b=ivyt2rSY1c5TA697UJ/IBmka/iYRRDHnNUmSGOXKepnIhPFUAJxYnBUiAeh2NED/aJM8fWaCz7lJK04/6BSuMka2KDaM69YUpbUJXNTNwVzYYrrRiiQqkttkBVeiZzi1gErJEdpQrJ5PiCxCIEEqRHD4NFOKC0wEWSqXiVf8mh3s8z2WGBfQa/V69LdkFL2hpwZiJMx7vxsRARoC+i4hgAGCBwzACSsOxsCyC+R4rJMSHi0w0Huf4saGMEHII5OBil9q7Jx2XIjAtI3nw3XMiXYlLJw0308/vuv6govkqpjHg/EQ8H6znbtVb7+4dRN0zUlGiuhT0GCaG54z0KuIPQ== Received: from AS9P251CA0002.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:50f::10) by DBAPR07MB6790.eurprd07.prod.outlook.com (2603:10a6:10:191::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Tue, 5 Nov 2024 10:07:07 +0000 Received: from AMS1EPF00000049.eurprd04.prod.outlook.com (2603:10a6:20b:50f:cafe::2) by AS9P251CA0002.outlook.office365.com (2603:10a6:20b:50f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:07 +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 AMS1EPF00000049.mail.protection.outlook.com (10.167.16.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:07 +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 4A5A6o2d024723; Tue, 5 Nov 2024 10:07:06 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, 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 v5 net-next 03/13] tcp: use BIT() macro in include/net/tcp.h Date: Tue, 5 Nov 2024 11:06:37 +0100 Message-Id: <20241105100647.117346-4-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AMS1EPF00000049:EE_|DBAPR07MB6790:EE_ X-MS-Office365-Filtering-Correlation-Id: 0928bf4a-64c2-4350-9564-08dcfd819b2e 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?rwlwK+y/gRBGEp4FkQgaYPNJnMc07T1?= =?utf-8?q?GyFsaWMpe73YuXjQLg57qKd4tNtmKoSEYG8azvjDw2g46r5RI1rQL/DDor3yF2Yry?= =?utf-8?q?SsWGLIzkRtqasFleakXJoVDZN0jZC+lok0R0o/g6a7l051HRRF55AVuScahy6gaJv?= =?utf-8?q?sRxB5jnE4WEHbJcZsFwvOKi8XyzOdI9GOA1Og3uX+HA7wLNtqsqosNZ/GQhmGnwEv?= =?utf-8?q?tnnJbYUX95exkC48ecRuy46pfQ4mlKBqKic9aAAE87Vfj3iDIp/FMGNDkK8i30MG3?= =?utf-8?q?DdZJ/CRxfsHa9YgkcMij/+GIL2yQvWra46vuQa8TxtrDuY0gOex5WpWUS6TWxF38b?= =?utf-8?q?vmxflpO9QIuXYfVmI01x11JHCE2WnsRArs952zZLsPFNy+yS/Djm1eUMa0aFCbRJe?= =?utf-8?q?8BipL6TzPvccSB1/un44zF8MSf+5njENTzYDRUXXCDfd6tU0mmfDYgDoVNLCFA/tj?= =?utf-8?q?a6ToFWmMpw4hbmwU7LtgDVVwJaDXf7Ie8x332f3S2ViuJMCCCI15IUry3kdPPjW8L?= =?utf-8?q?8Ekc+HBwgpJVqGwL3Vgd7df0fUt+xwtjoa/9Gah6/UfgFNtbX5hlsLGCTz7ldRJs9?= =?utf-8?q?SQoiv4NnQwGNnCCs8gy9XLq9oiewy3efHc86zFqZsbjvCX0Qp5Jgg9tOpn3CF4ak6?= =?utf-8?q?A1QzlX/aHJXdWr1sHYSIzbGwjAXw7quLmwE2rkQ1desqN4BOWbCukpPFHMgWltUD8?= =?utf-8?q?vsZj0PzSHtiH4QZDRPoEIi6nNXEKiZa69VOdOTZjIp12M9hQB45UheHa9ZM/GORVX?= =?utf-8?q?6rtThNgzAI9u7tIwiagNZGynYMTkeTBVqgliJAEOChgW/bS1qFNX7q7j5FwQx3GuD?= =?utf-8?q?BHcTUNzj8Jx169EB/8HORe+axsBIN5iCij5YExMXpieowHeG40CHWeKqEn332S0BX?= =?utf-8?q?0TYNnur/ooW6mg+7V0LgkJwm+jWO7qz+0a7FiiYAU72mF8ygimITzLXaaRuzdz3ca?= =?utf-8?q?TJFZagJG/FTgWpKXMA8JUZVKZBFMYfS1XU7VsahpTKBp3MNEjxlxQm6Gqj6l0nnBx?= =?utf-8?q?X3CDNCk5+eucT+qXEk3NvQ6/ZD9Y9pmXD4M0bf9n99UUqfPt4OsyAaAOcHe86THhz?= =?utf-8?q?KjcSEdFfHDMAGxmsVqkvJcK3dfrfb2tdLd6Jr/4yRo8PuuyJDQotY5ZcsTzY8SF+g?= =?utf-8?q?f6roDVCNxsudZ5PavF0W9eGZyMEMnlP0GJW8HOEVLntihZjI6lurOJnnFO6gclyr6?= =?utf-8?q?tdMy0A/VFpSM0qjLliz3v0YEvi1PionGThKsRjMKrgNrxpyGwxhivxnk8aBOIh7KU?= =?utf-8?q?83q3TX9OZGanUUIqmxJvOCjs3SSXbdCTGNchdcU1HhnOWmVZev1zwPqv8vUpStfok?= =?utf-8?q?dkTliO4P1Jq6ecC3BOAJDvmHoEiCRWj78BAnzdODkWlU9SkB/00/2fE=3D?= 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)(1800799024)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:07.4647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0928bf4a-64c2-4350-9564-08dcfd819b2e 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: AMS1EPF00000049.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR07MB6790 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 --- 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 e9b37b76e894..cccc6b739532 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 Tue Nov 5 10:06:38 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: 13862735 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2061.outbound.protection.outlook.com [40.107.21.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 89B9A1D1F70; Tue, 5 Nov 2024 10:07:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801234; cv=fail; b=MIg1neovMey6vvPrn1oQ7bfrQJlmJTScsxYi+eMT7RAC+U6KfcYUey2ys8fl+cgXX7TaD8aUOrxiFC7N/rs92GAYfQjPXAzIZyai1BLPZDyy4LF1D1i7B+cHnWk1Y0sse595461SEbfQLpghi/yRxzO7GXm2MUXeKJ0emtd3/ac= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801234; c=relaxed/simple; bh=ZUpqmapcQZlw3AG5m4SAohieBwkRCQPgcReyVEFDsqo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=RhuuN1mFNJAMWC+qfUBmjLdGSJppw++c/PyM8495szYDVsy1p6K7xD8D0hYZS7iPkdhrEdZlBajaQsszBeMhzQyMHXTx5c+NU5ZhUkMtn07Rr+I3D3Xpguql2oVQsTeDePIeJL6+VHYjCjGMFZiMPnARzTzXVnyKezVIavbZKgE= 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=lo7lfmoC; arc=fail smtp.client-ip=40.107.21.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="lo7lfmoC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XHJ9vEwF0UXgxdMK1rnwdqA+IK1PNg6cOr8saGFxQdgjaCxB629ITUqKaCuhP95eqZjz95glQpLr0IgO83H5aorjw7+Ra7Z1BFZ1vmYQgo3Uq3bdr4qWluwU6Njtv3XfQuxBt5u2mOqxf4gOSUdJpOiU/gFTLQ7R7XMOBzKHuDl6Kk7lcktKd12GT+9R6MNWkMRNOFtJ4GdJS8G8qhx8BK8Oy+yUOwMqsJxoy8r09YT5uoGbTnhV5ps0iTj01s0I0EABe84uUOavMUm3ixlk5yKGV7URXmpZKaSket1YVY3t7DLpzV3yurCYenlUuWUWG+cGNljqd6mY7kttruw3Tw== 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=4ULNgEXIdwwQGMYZLblb14lW21AVOQjqSqY7fPxsNyI=; b=jGH6fjrKLKond6atk9M6JsqYJlBtGMmoNXqrvYGPqjbjHcNNnuN0nW7K2oscamsMI4LWBhvU+iJje+GJqrIJ68KjYcjAVk0DQ5tGLR46TcXotPZqRdR8eDR6dJREXqLUtHWfSF5Ybjm+YXzpXICz5GTUoaDCJmrrGRA35nQE41xa6jzfidJQGaoL/hD4TXaXOLfPUaKSjcDjR4bPhlNmzhSQ7+hr1ljjb/k/X9VrTxyCtUMBil5kHqJHjmfbK3MtlTv+x5HFV44Huiicqpj82Yc6GJ/K432Zqw2Jbja1dk6YKRZwhf/+iTr2DeF9r7Es3CrwLs7Ph1E17qE4+YFT/w== 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=4ULNgEXIdwwQGMYZLblb14lW21AVOQjqSqY7fPxsNyI=; b=lo7lfmoC/qS/z4LHyHzrzGBNokTm1u1XZV5W+nStwcseFnMjaIgUAwGUOIvt6OZLcGb3tCuDSbZ+e1cnc+fsk2yMTPS03iKgn6PbwYyOz0vyOZn2nsPxgsS3RQ/scz8yU/EhTH3rLu6F2JQzZVlxEW6P10gLBCYq8TBJQQIeMga4ZzY8Dh9lxdIAAyY/5xxIPCrstTKqN6SgtJmEJhd1XLAEdkqI8FKMG66dZRwdtqOd5ujHh/AXHJZI+Qc1MlrMuMLZKqTObpqHlGG5uubRUQyQBCPb46re2knYOkOaER9h8e52CaV86zHNIo8lUaRb/Hs+kgAcrWvSNGa08Re/nw== Received: from AS8P251CA0014.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:2f2::13) by PR3PR07MB6586.eurprd07.prod.outlook.com (2603:10a6:102:69::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Tue, 5 Nov 2024 10:07:09 +0000 Received: from AM2PEPF0001C716.eurprd05.prod.outlook.com (2603:10a6:20b:2f2:cafe::e1) by AS8P251CA0014.outlook.office365.com (2603:10a6:20b:2f2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:09 +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 AM2PEPF0001C716.mail.protection.outlook.com (10.167.16.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:08 +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 4A5A6o2e024723; Tue, 5 Nov 2024 10:07:07 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, 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 v5 net-next 04/13] tcp: extend TCP flags to allow AE bit/ACE field Date: Tue, 5 Nov 2024 11:06:38 +0100 Message-Id: <20241105100647.117346-5-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AM2PEPF0001C716:EE_|PR3PR07MB6586:EE_ X-MS-Office365-Filtering-Correlation-Id: 29a18570-9580-4ff1-8603-08dcfd819c01 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?5oSsq/hU4z4mxOahAlxDUkLte1MFEoi?= =?utf-8?q?YdHyllFZNrtMEqSVoUtS2h1cDnSleiD67NYcN3X7mAWVpdSw7AYxn5XKyhPmO5L5d?= =?utf-8?q?QccPLiDAnEUVR58tXhastfsndWr0T6BnknnIkTwSZ+qtBgWbwEUorMb6S3aQc6XNG?= =?utf-8?q?TDJdpA1k8ax8sW/CEZakwLhrC7XdZAEeKV0OMKN6zhNQ5ZeGk6qzwK4OCxQ4r3DFW?= =?utf-8?q?nws/2vUQIQf2cmGDcPvvsGcfMn7fhig5t6J5PZvBmMM7alod+LuayJUldMc1djw1t?= =?utf-8?q?yYsPAQyO2NR7o5+UOSH3r6qSPQBtETJWy++UYNK0r3Hc1CSk9ju7v4p8bPeyoUDCM?= =?utf-8?q?HVpp05YBfzM8Bx5KDCWVq6q1SnFTL1hGmctTARHE0G6KSYQFTBo5msKhfwPMPA1nY?= =?utf-8?q?dYQERk9asD1Vn8TnOqdL0fXsmDOTh5obX1ygM5pdV6JYBZDP8/0o+xE2eJ8ykRqLa?= =?utf-8?q?VuVmmFytnAS/Qldv1mb5TnfUb9gAD4erEhr3osOyoJicQicX+TqiaY8seSYGpUDmM?= =?utf-8?q?O/7rfFDjZr3+AdJaasQk6lacZskU/N210NH7AoQWQIE1Ai6NTfVSTyNMuJJbTjKju?= =?utf-8?q?w/2Gzim8ulgH0ydRRf0IyTGlKpEBom8JNQE2fMEG51+2qgD9nbf1gWtqNCgzVYw7c?= =?utf-8?q?2h5ONhmleOicHAqmhvqUG8WS2cBwHBVBBda4ZB68iWIpBdsaC+XlIEocwnWQVmXtH?= =?utf-8?q?MgzPowwecalOaef47dmVLL9/PZ1voHyoh88K8ogmQEX3HlCQAM+ZdJuEO3+AVkrQv?= =?utf-8?q?0kQkVAtuL8DF4XOv/WlyiOWatapf0lm786XK9qX4XTKNRfb6Mvjw90+itYm6EDgsW?= =?utf-8?q?lIfbj46kHFCpaW+ybx93Qxxmqpw5fjkP21gbEeaF9VrjDUKPv5awzpc4z9uOPFU8D?= =?utf-8?q?21Fn5MoUKGbkZMHjLxLbIb9j6aeQ3evkcM9zby6rDClqz/DclODNmiN1W/zlHNUfY?= =?utf-8?q?qsjDKlC6m8RMZWwM3RkMt652LbrpkP8fU7vk1feRPP22EDD4AGlarQEkXDOft34Do?= =?utf-8?q?kTBgBOowpSb09TtqMQm7pci6IpZRBNVVFDJkzz3knBvhjYaVjb06JEBg8yQaANnfY?= =?utf-8?q?DtKhhiX8aSX9MsC2DHs4uMZzOsK199yT0TV3URJ9eSvZxvTJ/rfldMrimxcg8eW5R?= =?utf-8?q?pyFOXs/9E6B2VydNoJ6JJUTGwQrHx4bqHMkEGQwGI8hal/o7vWDyaNzXUZ8I/kn9X?= =?utf-8?q?xVYPBQNrRXizJshChq1uxVu6bMCYOy6kGrGqZvukGDS0U4KrR5VmelaU86X4qA/J9?= =?utf-8?q?uM4KScWW5a8XWnSU+/NYs/Jgysojv5ql+FdskYfDlvlawoMcU7dqA/ZlkmTG4VcmR?= =?utf-8?q?FWAg9pvQFtm/LhF2DEW7cHrYMchnEo57Vd7ghcHtpcwXnfhxePjHo14=3D?= 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)(1800799024)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:08.8315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29a18570-9580-4ff1-8603-08dcfd819c01 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: AM2PEPF0001C716.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR07MB6586 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 --- 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 cccc6b739532..a9948fe3537a 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 a38c8b1f44db..536767723584 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2163,7 +2163,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 5485a70b5fe5..1b2f4a2e7332 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; @@ -1382,7 +1382,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; @@ -1603,8 +1603,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; @@ -2159,7 +2159,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 c748eeae1453..fec9acffb167 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1737,7 +1737,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 Tue Nov 5 10:06:39 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: 13862737 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2086.outbound.protection.outlook.com [40.107.247.86]) (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 13DEA1D26E6; Tue, 5 Nov 2024 10:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801235; cv=fail; b=ucejwDEFfPAXIRC7lGGz6soXTXX9oRB9Kk6xI/uwCdwZlrMkh4ufq/R4JHiOO8um1CeBlVI0vTf26FFq4C0+IWpPM94mafd+E7looT47ZP+G5lIaPxZ+rWwB8TkOdir4biwBi65QMoohnKVulSpKorqr0QZ83dULEbnjRSqyQaU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801235; c=relaxed/simple; bh=+fN0wQlh7EjE+4+Ds/P2ZVcJsFXPLcFSJmVQ6ZFXzUo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=PQQq+a1kwHYpDJk6korFoaR9bvAGgKGJsmehBfaMBjbSWTFH6dUcJGAm1Z1Who7Rjog/Mo2XfHR5d7twYAYm/mLx3P5HFqoaWJWt66fRNdek5f9m2d6/ecEdouKQj0zwmR3mj6yCj8/Wfuirq00izLOpfbdfd3vAIomz4p4GXjU= 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=m7Nz1TgS; arc=fail smtp.client-ip=40.107.247.86 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="m7Nz1TgS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dVGKAua8oFA9STICXM2nSz2z2xUKgtdn5PQWfRpoPcpJAtVCzxoeJuercNrA/eCAuZiKfq3N1p60PUIb08BiCdY+Ux69Rv3OWXdC7VARUzgyS0Q4nq/3pkTZHIpS5vUDc1Z7shXywTBaesptpbG17yvgH8Ntbiv8t7JIucT23+y6g3hGsOQBoPNlnmDvtJxD8sYOglhYeyLq7a9EpC/UfkdSaq6e1CIzxj3NsqlTJu/y6hrYH86ERiip3J18OY6F13gtW60u8P6fJNTEn2Fx8lqQLvTxJStmvNedpwNK05CiVIV0NyHb/nGoHk1oAhBOFTFRDvkLdvs4Emr0h0Yf9A== 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=mxzfKuQL2ymqWZHjJRTMeflBQuu80RXXH9l9hWW5VEc=; b=v6e1MMJpNu3CCIbqrDGRzQt7BW8/Gm+ycbI0jNFy/F85xjzOzcFIlePRedVPR8ETkgEbGfvXqM09EgAwSp3vYeGk8fTjP24LZb7wtsQZMKzfNUCdqGJTFY9WNJgv+RSlzS6fTYjnWZKfYj2Z1Sfqr7Qfqyqo5YBwZUg6hihE0hlzzmO/Iil6eL2djKnHF/o1QiwuycdLPaO9KCyb/SINj4sJ1SW1+F8niYBMKyT6Qw3D9F/Q6TsEbVXEhzFB1y09gK8VVU/oqTKyCGlH0FKu9aaswVJ9Ion/g7HmJYb+qYmBFsQc6ldE8KbBoQv1GW8vXiUOKsOP3euMqIwsfl8jhg== 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=mxzfKuQL2ymqWZHjJRTMeflBQuu80RXXH9l9hWW5VEc=; b=m7Nz1TgS9G4Yj5l8m+K5YjKniosyhSwRm75yid0mWnpj0jJ5gm0RZK3AQ7hrzUHXAamhktWOiweyTJNlW0Fvgiaf7sWDbYevrMt+18+59QZ5aSa4gnVhhnNLTmcg6YZ8khZXJX8RlkgzsEoKZ+MCES7ggHMaVCxb44qBIlY/KEYLAi5al8EztKJrIdQaO6Qpw/GOgIfWjS68Qwl9ClrxhikWgvwQEgt6A56AxzyPxSAjZGGpO/98dtj1yk7LfDNSGQTG6fJXpe91iDsuPuWJ2dTidkcdo4HdzARCv+p5qjBh7ZDIKhjNgu5jjYWJ+oW0tDsaDpJH/EUr55B4navtWw== Received: from AS4PR09CA0025.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::15) by PAXPR07MB7888.eurprd07.prod.outlook.com (2603:10a6:102:13c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.29; Tue, 5 Nov 2024 10:07:10 +0000 Received: from AM2PEPF0001C712.eurprd05.prod.outlook.com (2603:10a6:20b:5d4:cafe::8b) by AS4PR09CA0025.outlook.office365.com (2603:10a6:20b:5d4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:10 +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 AM2PEPF0001C712.mail.protection.outlook.com (10.167.16.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:09 +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 4A5A6o2f024723; Tue, 5 Nov 2024 10:07:08 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, 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 v5 net-next 05/13] tcp: reorganize SYN ECN code Date: Tue, 5 Nov 2024 11:06:39 +0100 Message-Id: <20241105100647.117346-6-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AM2PEPF0001C712:EE_|PAXPR07MB7888:EE_ X-MS-Office365-Filtering-Correlation-Id: d69751fa-a3a9-4aee-8261-08dcfd819cac 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?hSaIRlRdMB0ugzQ5REtNcJA23o0Ywsv?= =?utf-8?q?s0xpS7HvfBn5MTjjRvxQebISKm4gkn7dWr1OZyTkjji6au2ygK264XT1z+bZmrgL4?= =?utf-8?q?eLJcfZz8C0thwsrVRTwnS6bmIAiWMNii0+y2vfS89LGLDL2jtmPS24ZzTePIawcY9?= =?utf-8?q?tOkTKa9aRLbf/m7pnngHDy3PFaMO+lRnFMAntj1tdeQ91dxE7L3x0+2tJ/QtsLnDa?= =?utf-8?q?i0FLsTB2HvNuKLMWTP3AeOXZDrSOcuY+4Af6dCA6QAjPfTiKHKihtpJsCTzsVhM96?= =?utf-8?q?YcC20IoGn6ZLnBi6e5JBvIYPOfypTs33Gz9uOW0AfJosnb7rpINl8Me3V0oHX3doZ?= =?utf-8?q?MtWDqZj7/Hov9KRprxCAVRNvlzn7iB5fMFPQvIZZ6h2w/DNr5JtLOJyVZQqfyaAYt?= =?utf-8?q?nPwFLH6H3GO0tCgmeBtEwQgDwFSeA0SLP76Yfqe2V9HnWxPbEGRwYEDQ/JjqHHXGe?= =?utf-8?q?g7pzQQ3cfw2Ta5KU0yyzzwFJet8zrcEorisQBaLWVZWlQraPs1AR2eZp/RGjAai30?= =?utf-8?q?YvMTsX2UHXXdvHhdp0pHipk6ZlV9tvYo85s8h7qMN5zEwkt7DST/8ubRhJ9aEPL10?= =?utf-8?q?0FGx4aWSyb8IB00KgUq0CiM2KcQcWwrKmu7U0PXu3EY8AcouU54MvIV1Rr+GmN8Aq?= =?utf-8?q?w5L9GxtmbOnmZ8Jt/nUPFOtPwUYshSus3g5MiO7TeRGsBKAEh9sEbVu38dpmhJ5ez?= =?utf-8?q?foDZktyjH/9/3TfcB5MxVzzL08VCZnI4atKwKszYrF0gw1TE17RCGdpXysdcu36+x?= =?utf-8?q?2Mi8HXNMIsq5FqYbyg2S3255XOm+aLWI0hax9T3sJTE/W1v8YrTlStayV+Wxadrf2?= =?utf-8?q?CEF0Rq/nbkf6+FumXU/GJn9+ZznmG7m4kquJHk8w8Pdkizj5LQYjrOQ1TrYWxYFZf?= =?utf-8?q?DAXPTeNAYhxY1lf/hTXZwRPdPssHKfTwL6eqsnWAmYwgVMwOvpCZKYmAgPYCcV8VO?= =?utf-8?q?xTcoQwjNw6CeuMnhwpxGOuuU2zhxnGttZTv9rVue7KgSrIptQy+HjKknun9fHwRGP?= =?utf-8?q?WRGg7y+YH8HrzGW1iRBN3Mc6r+DTF0zmDtEfTekanad3PG9/uCwW0B8gRTSHJFHFL?= =?utf-8?q?nXf4O7mdrbQr2UZjyyJH52CQDLbOQPTtj3rqrAlS9cbvX9QgovdQCSr9hkS6I6cbl?= =?utf-8?q?3Qb9r2Xlm7i993wUCUONH12IUW47lHL8n91La38U6jVJYhtlxQmXRJD/rVjbUmQIu?= =?utf-8?q?6QPAWz/JaFlCrRw+xNfpbmnWCU/AmQfokN5kpkI3OYsJ65HgbYQsq9YrwnsUtydwo?= =?utf-8?q?2fkE6Z/e5aKpPMrbQUzraYb4Nqvo55RKT9/GKl1ZmIuEuxcTDpjYK+k2oj1UOlOhF?= =?utf-8?q?Do1xx7PcBACA8pa1X3B3QJiqNKlLca3QIqdfNdn6eD6pyJ47D41xENo=3D?= 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)(82310400026)(36860700013)(1800799024)(7416014)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:09.7490 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d69751fa-a3a9-4aee-8261-08dcfd819cac 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: AM2PEPF0001C712.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR07MB7888 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 --- 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 1b2f4a2e7332..9c47b46aa14d 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 Tue Nov 5 10:06:40 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: 13862739 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2074.outbound.protection.outlook.com [40.107.249.74]) (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 287A31D2B39; Tue, 5 Nov 2024 10:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801237; cv=fail; b=BxocjfUjciqn7MSGjwEBmI12Nwc/eC0R0R/PMG6leF1tXI5Az5vE4wMnQNNS3FyOZ0+Cf3QuD5pEhJAXO3YH5VRNOpxambHdIdGJxLAqSDy+p9qDAqHQZvO6uVB010OqaAsqckg/peyjw5M4TRjDn8cLJe4r70d+cBLs70UL6hQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801237; c=relaxed/simple; bh=E6/oU7XTbYUxrlKFEG4RUbEO6W4yeZQKW32oUlApFc0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Ov/zT6EHq7LPP0vB0q9yrjIwmzJgEwBGOyF5KF6q+tctQeqtLp8PS9+SpQj4CzLjRwEHCtaAlQwRDgvzEI5Xuv9tr4gCwDCJv2NFfnTX1OavERoxVbyfoEnPAKsLvqm9FG6sLvkRBqvay+RP3VX5eOfiIQk4lTBoFLdBHVxOzwA= 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=uJ8uQjxQ; arc=fail smtp.client-ip=40.107.249.74 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="uJ8uQjxQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Om0K1dznY9plFQ96dr8Z/3XxRaaFJpeWzNFBDr1lU/cuG/k7k/DfirV57Ptq3rmUdYfwtLTNJqc1Dl/p8aj4T9vgLyVX8GisMVCsIxR/Il/4Gr66/h80q/HEqMJWqbJkrKKWzo97UdzQl4WGlK929CItTy8p5We4p4Bkr4F/ZhdVcJ4/i8MalPb5pZeAA26bXNZamyh2mutzVtvCsBCgA/XbksbvalWW2TSPGM5HVjYNwste+vcaCQPA0CgRqwYhuwQSn5ZdELunpRfb/rk5HAx6ZS8MMcRwYZu2gBx5cHgzGoSsOO6baw9K219yUmn8b5F7n5LJxOnH8LJqUy64Gg== 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=evfypev1jjY7AlGOflVED1L6E85KGTDkvWDuJDL/N7s=; b=VacJU4Y6Pvl027ZHpe74DyTgGRvoXDHY5YZ7/ejeJgmDw24R+dibiNc/gyDKtRUL/65e39CoOipPHuBbdZ+wm0YkNcqRuS3unSxo/7N3lEA3xsqOJEMfIxkM0Nxg7LQIub1dFo7SBYQH48m/WFrwEqTMX/sc+rPboWJiAc8HzRYlJrAYke4RNupJA/aV1bWbYLtOagkSa2wvQZaLxmgXrf6JrmNtKYJdnxEpPaSmP2ak2oqGJSUvxSHiBcyrd6ArZRUq64L7jObyze7c2P6L3lsZ9hEwYCZAqXlw//O5/wnIrEV7hgforX3IqeyA1gK7Wa5gAOR14AZ3oXqbjKGRfQ== 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=evfypev1jjY7AlGOflVED1L6E85KGTDkvWDuJDL/N7s=; b=uJ8uQjxQDRTotQPwHAubI+6C+3PIdo+bonGm4dBpjy4mAFsBImu80hc1za4vx5IqRKVtqlo/A8mxPpORkzPWg4/lii8hvZdKHfTf8ZIiisuq/fM+BBtYdBBidIsRa8Y8k3Nl6oBgz4fJ/GUlD1cAhlDU1dhKYO4JNOB+RU3Q0kz+unV8rjoFBbhl4rMkHrfrqXDthPzsfLHdhdRD8f+IqvfZ0Z8J/iEn/KSpB9co50tOxPebIIoJtPIJQBhSlULxBR2X9zBmi4YwmWZ3Nf8PMX4bmRNmlphhst7MCOjZpB1He0vfFtqcSM8bLyFCmoh19AaiVWtdoK81s9NtzE9RAw== Received: from AS4P191CA0048.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:657::17) by DU0PR07MB9194.eurprd07.prod.outlook.com (2603:10a6:10:42e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.28; Tue, 5 Nov 2024 10:07:12 +0000 Received: from AM2PEPF0001C714.eurprd05.prod.outlook.com (2603:10a6:20b:657:cafe::4d) by AS4P191CA0048.outlook.office365.com (2603:10a6:20b:657::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18 via Frontend Transport; Tue, 5 Nov 2024 10:07:12 +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 AM2PEPF0001C714.mail.protection.outlook.com (10.167.16.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:10 +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 4A5A6o2g024723; Tue, 5 Nov 2024 10:07:09 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, 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 v5 net-next 06/13] tcp: rework {__,}tcp_ecn_check_ce() -> tcp_data_ecn_check() Date: Tue, 5 Nov 2024 11:06:40 +0100 Message-Id: <20241105100647.117346-7-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AM2PEPF0001C714:EE_|DU0PR07MB9194:EE_ X-MS-Office365-Filtering-Correlation-Id: 21774a1f-110e-4794-99ef-08dcfd819d0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|82310400026|36860700013|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?eXPKBlbEk6636ruKmD9ZgLlA0x3PT33?= =?utf-8?q?7RYyf1t17KTUjDisfBkL+1h3eCXOD/yAPDqVoqidoleiiYa+t/CLozVEWlfYRc3MI?= =?utf-8?q?S2WQ7/3A8TpNpAXZV84qJoYG/C1erqqhS9L2j1aEH8yI/fFQ8r09OX8CObv1Yiccs?= =?utf-8?q?AnXgVd4Q2cuOw+jm81W7H6X4IRmeOCM9mbXd7NmiXNxI9ZdB+Ie8IWd1Uu6Moi2Xv?= =?utf-8?q?L3VaH9ovrBSH/cX6dPx7ZKkP3SpQUXX6qRaQSYTfKuXc9yVw4j3Vn8cK0G2ut/yTT?= =?utf-8?q?zh5nE00uAhuU+Kh8DLjFxgfDm7zXzdbvBdqsee2NW/RRC7qj94KcZchs48HXdQ1aO?= =?utf-8?q?x8kMzX66J29Jg3fokt/h/RSXN3i9eRDQdIGJWUC3LuPhoECx8R+2byVS7rbdokl8u?= =?utf-8?q?t8uUL59C5H03YYbKiEsihM4AQ6UGslzz6UBukHDFNouPrxdzMbY2a3om+oVEyE8RA?= =?utf-8?q?N4TnRCVFzgtjU+oeWKaLEfFRo03/DzbqypXjiVYhNS1XR7fjMfQiHisVjhE5MNdfe?= =?utf-8?q?a1FUJushWRn1MkzxYoNL228DTqG5z5zVlHcOEAgzQIximWbnLwlXX2AJlHkAFB6qn?= =?utf-8?q?6nEGSBixi+mq8tq/FH+rXfbnORJqnRHiwdC9e9g0hwLNI6hhHK8auFOf67iNUuQu+?= =?utf-8?q?hrr4cvFlo30/pEkp5KwhIcsrbkXhK6YR5f8f7cG+7eYXqQmYQioGnQc3RVh9zrWB5?= =?utf-8?q?32sJxqHy4muUrYRpVNTEISFhuIhWpND6IqDRURN5SPTqa6+WyfKXfoIBhgNT+aCXP?= =?utf-8?q?Cntm38ciW5ZXrmEK71DYsTuDGEkP9XqhaLnaPgjpeftNE9noIF/7WDJctMBd7v33e?= =?utf-8?q?MXnJD1QMsIdew0Q/uez86ys5x/NXTTwI9atq78g4Nx0ZZxr9vw2NNdE4F8sSkWut0?= =?utf-8?q?48W0FFJYrDdCfjCF29k3piq1X4Bw5AbZxkhmpzE7Wp6D7yn7/Tw+uZ2G4j/hLaoix?= =?utf-8?q?FwFHhyIJ/rOGJjYszoAkKe/75bWTCDrVMKwu6++mNt8HSTS+0UoREWfr8WL7LOS6z?= =?utf-8?q?5v01NIRlieScKudYzg9Ih81OUJQbuT9l8sMou+lfAqW+F9C/ZgKX6vUgvcHY5iPOf?= =?utf-8?q?/oPSxOrB+fhCEsPIN46vJwo8dbbclvJ46Y420F2jW+T1gonxwkvEBbpPqXQaoOwkO?= =?utf-8?q?pS+gIULC3a+Anc8tZQkVzwJxXpRspGHnYFs8IG3cU6/j1L5BRL7qUUQMeq0YDskiI?= =?utf-8?q?Gs6f0cgXnA8EKsPhCc6oF54p6tWtatwCu17Fs5Eagi7/HBpqD3BGyGbPvrWlUwlA1?= =?utf-8?q?nV6+GqnXKR/oOOCUPjOvXxqFFRrPM/VJqz5suWG2w+Ly+2L7Rwh5XZKFsGeloCK5k?= =?utf-8?q?AC+LZAfIuvUmuU9tasFoJ/YbMe600UA3z3PSgLC9SmWIg1Pkn1ST/RM=3D?= 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)(376014)(1800799024)(7416014)(82310400026)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:10.6262 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21774a1f-110e-4794-99ef-08dcfd819d0e 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: AM2PEPF0001C714.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR07MB9194 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen Rename tcp_ecn_check_ce to tcp_data_ecn_check as it is called only for data segments, not for ACKs (with AccECN, also ACKs may get ECN bits). The extra "layer" in tcp_ecn_check_ce() function just checks for ECN being enabled, that can be moved into tcp_ecn_field_check rather than having the __ variant. No functional changes. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang --- net/ipv4/tcp_input.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index ecb3de69c6de..b5654f94453e 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 Tue Nov 5 10:06:41 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: 13862738 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) (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 CAAC91D2B13; Tue, 5 Nov 2024 10:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801237; cv=fail; b=Z7JCx7Oioo4VIWPz2UnZEZZH/XCpUu1C/FP8ptrytC5RH4teu08BA2djaa4y9nIjWLPpvbs0F+oV67qKWDAke7IlJHVUdUtTMQrHHy5gx9SJS5UI7T0xfD7FEH89ASfwztArImG+BDQRjpMHWMDeXSdCJpV/SR635X6g55bNAcU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801237; c=relaxed/simple; bh=NJEYJJzMDWgLOVoaVgooljRv6P8APPeNFprYiTxY5p4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=i7vTtB9thf/2WSzmU1SWWPl/ygenwb2wMRN3UcnVVGZbdqWmyji9iqcp+dkjMa8ykxgbh0+Q9g0F6YU7sPR5+pBiY2SJo1QnQvtbXKgFxS2w+tWZiuGF+fsSfZEGPAqJ8SUtlUyXW4yMrgjMIAaeXECxhzjL/JjL2oF4A6Z19UA= 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=IjL67B/Z; arc=fail smtp.client-ip=40.107.22.84 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="IjL67B/Z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MhqtEMLkX75MWnuHLWgUJbfcTfaTpR9HsY9Dcm9mhSOqyaOWCFAAbJ+oj7ICCA/hhd11tBoSj6u4QphEka2laLPMGSRtd97EpCvae+sBdnh54+2BGgbRVzNMq21gpiFE97d9/y8vWDI4fxRrxGtPJSpN6G2YiKdifdVjk1xR23aSkMcIoe/IVnWKX6DldEYLx/rc4cS1LkhHKSTfh9Dk0dfVL/knroFrBM5nQruCibZW2LF4yejtK2kBYJN8TTEDaWQKbwsweILT9ilsb0iMijphoQSXlRq2b2JvyQ6th8mvqN09ACyjAt8SY+kctXmASURf7LdLSEpBixX9mASnFQ== 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=RtfKEv3eF/eyKLurF4fP6RLz28q+tGELwANdcngos3g=; b=MfC/EEKsgpSiJ3WZCp0RrKJHLGmGe8t+55dFqlahPDwTDNGouaFQtX/iSYd/3KUzxeOZAXG+aTeflEgLKGla4dh/MsETQJPXIWbzdFLOuvbaWyUYXR/CMOXpa7GRseOfGPwt35vl1iYhIUYoAUsbBvslwx665ekL1ovvnpngTNmgjEF40KtLjE+vtd5yT7GRWO6YtQG0NxCxmCrbFwI9cnzf0Ejo15ESeDJp1DJp3kn94P5Nyux/mz2r7QvihSFq3oD4pfon6KwVPJBxzA1r1r0vZb+S5cX6Og3zIgSEhlmOPp0Sqjh1XMuhR7fHqZJch9+ftgICC+L16C73Vg9KRQ== 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=RtfKEv3eF/eyKLurF4fP6RLz28q+tGELwANdcngos3g=; b=IjL67B/Z/iF0kq2IQ51ed0mnMEKQHEZIBjo/aXCMKlhWFGWWxgb0okIwhLbG0944XCuEOj4dBq2eNyjfnqBvv/FTArnZy4yrnU2T1yBh3VWu2u1GwceRIpOT2pXHw/5iRkxI1Ru/hjBfGASlgXjEF4VFbQk4B/Ll/pjJFOA0EN1kWa03CCii9lCGJr9UjD1K5cLLVpc62nsnTv0Mx12Gpq5yuN/jbGoDGqFScj0iykVp1uBnQ+MQcO/ThkH8UGUva33N9DuvFrfWaBIIOywZyq22PYsTFvnFl0YzU+6DtCgZRYewPXUj4ES+EFt8mhqHEbY29zkNMei0kLlqbDo62g== Received: from DU2P250CA0017.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:231::22) by DB9PR07MB7692.eurprd07.prod.outlook.com (2603:10a6:10:21f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Tue, 5 Nov 2024 10:07:12 +0000 Received: from DU2PEPF00028D01.eurprd03.prod.outlook.com (2603:10a6:10:231:cafe::db) by DU2P250CA0017.outlook.office365.com (2603:10a6:10:231::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:11 +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 DU2PEPF00028D01.mail.protection.outlook.com (10.167.242.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:11 +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 4A5A6o2h024723; Tue, 5 Nov 2024 10:07:10 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, 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 v5 net-next 07/13] tcp: helpers for ECN mode handling Date: Tue, 5 Nov 2024 11:06:41 +0100 Message-Id: <20241105100647.117346-8-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: DU2PEPF00028D01:EE_|DB9PR07MB7692:EE_ X-MS-Office365-Filtering-Correlation-Id: 56a7a667-6a7c-4532-81de-08dcfd819dc6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|7416014|1800799024|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?UNM7YAYtqxsnrjAccNN6rX1Nav21Ixi?= =?utf-8?q?9/yrbmVNTzmXg6yU+BLy+ndEHzeqyEB9450sYS2qWVDDIcmgOmxclSn3Lv+W1S3cY?= =?utf-8?q?+wmFaJcwe77xSNI3K86qLX2fDQjmAzs7fELnYana2UCs7kzIULMeknNTbf6fNrwea?= =?utf-8?q?3Z3CIltUMSXVF9lh6y0+aTH1ny+Q1No+tAxPodx06BuuKo1k8qoC4po6jg+YR/NQJ?= =?utf-8?q?LBrUQ88AQAZj5zKeSElM7tqYPTwA6kBgjU1KbDIQ8Bz8FituK2QFp8wa7jHXGQ/Q+?= =?utf-8?q?YELoH2dfmJb99p4lrr+hYHjoQ+9MocrUbjQXoA2J6+hPKcyR6ZMGLnL6RT+6nHXK/?= =?utf-8?q?9jFqFNRvwk768b5jM0lxr/sU97vWZGznvNkY26Mr523KvPzHNlQxyM1CXjkis50SS?= =?utf-8?q?T4gYijs3Arxju/FFR7WDBfxvpM6wFdQvAxG4cEdELv6dr1zYtvonZbbcAyzGUuYZw?= =?utf-8?q?fsw73tk4jW3iBQoGw6wk8MROJIb0fsGSDOf3NrEKWiRBm1zIUSFbhvPMz4MSR1Z2B?= =?utf-8?q?1wwBBrMpiufo89GCnvGR8EeCDcWm0kzPMWD1pjouc+N1azt0EffG/lymLXt0N0gjd?= =?utf-8?q?3mJHwhnChd3nXBr55vyCS81P3zEOrSxVY3CD5TI5FsvP6QlW0J+N1hX4k2Gm3fE+9?= =?utf-8?q?KbFLF8Dx/fRXlPKbCvlz0qH0NuR9isnpTQXFs1v8nnSiQ7tvfk2DoxKfEKv+J/5Yc?= =?utf-8?q?fYJ+kL2p5xql71z12pCKZgHEPkwRpENuuvXDpi7AnvWiJIeODqICZV3c+EvbBTv30?= =?utf-8?q?EOsedls8yt7SdpArLfjlm1UP3MbIvebjiKns85fYZD1jpcpaNwYe8IANsreDndjQV?= =?utf-8?q?noxIX3WOz63gVrcV3ogyVoSJRWT9+1ImrCiRBKJC272Hnl9DAL+eEFxZKylFPQols?= =?utf-8?q?gGTS1Es7H4XaQzRhwWKnfUsiNtPGzRMiqLgwouKHyqBpny00oTWwFPkAZugFOST/e?= =?utf-8?q?MvK/zsuXhNuga+F+KpBLrOpyvRGD/gj96TX73v+Rr5uKVUpkGNl1z4bxZsl342JId?= =?utf-8?q?fTVDBK3/hIgHrMNtGVWrDpiB+eIpV092xjie8vlqExM/JH5dzIKRjQfSm1xx2VGQ5?= =?utf-8?q?IBdoc051d3yIzHlv6JwrLIA9eqOP+ZqJmhwiRpQcNbFIguNLS4A/V81451m7B9RvX?= =?utf-8?q?/7dRRCUN9Ypp321b9SomUyj5j9z0VUmJQfJSx8psjjS/3W+slGyZ6OcZHgVU01D/0?= =?utf-8?q?PzV6FlR8ks0XhuxbPxdJ1swODxDQ7nuQakRPjsvO58JSFgabX4Wd7VIbS/XubpPvS?= =?utf-8?q?P9lH1papSMLTTxttKZsVokqGJoy7QaH8UjvE28ogHhFSjZcnQIwOkFULeP7vTRc3n?= =?utf-8?q?Y5hSQcxsG75KhzfdeH9BMJ2UJxFZMEay8QYqq5eRrzJglvblR5JRMR0=3D?= 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)(36860700013)(82310400026)(376014)(7416014)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:11.7689 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56a7a667-6a7c-4532-81de-08dcfd819dc6 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: DU2PEPF00028D01.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB7692 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 --- 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 a9948fe3537a..215b7ba105be 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 b5654f94453e..bafd09ff9a70 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 bb1fe1ba867a..bd6515ab660f 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -453,7 +453,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 9c47b46aa14d..f4ee86e2b1b5 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 Tue Nov 5 10:06:42 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: 13862743 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2088.outbound.protection.outlook.com [40.107.22.88]) (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 862BF1D362B; Tue, 5 Nov 2024 10:07:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801244; cv=fail; b=cni7yjpFj+yZLEBOZMJpcxVtPEGhPI1Sv619WYfvPkB6kaT0LlDFUrLjGrtyHElKE3sx2t4fazjRmEUV2/E1jFWcGFXUfule4IDs/BbaXIyQQZlSZ0835IATWga8Vqub6Dll+3mWePjm3cP6eTxVVfNG9f95LxuorYnyoz/PzhU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801244; c=relaxed/simple; bh=1Q4qCl3ortfIb9oBRpDQvSipMXyiQaagf0Kz+XUOqDg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=GvlybVj+CWVWw4pqSip7X4V7i43rTWUslaMzhFtU3GElDKDnO9lPfau60sNMA2AKDkI+YqzdfFMu/ZWvggldLggDgw71Sv8yXnM4c5VmIDEWBKfiUBjNmeZmW+XWr2zEsgMyfH/W24wgJt1GYWgGuiAhF3kbrBALMWCHGpKyajI= 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=lGziBknQ; arc=fail smtp.client-ip=40.107.22.88 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="lGziBknQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sliXE7nsH69gy8Sesu3E8VkuTaaWD5h5RX6EB3G/IRsfMaC2tgSAl6PuzcWzG4A5TgNmgXSjuUVthmlcin6FkWOUFaLVrxzEg9FsM17Mti2reK5O4q8I+GuHSTQUD7x72lgHJ/e9/hPmTfkCErngVzIzx2YuZTdGBkgYVOdBQRzMrwcheImoBMjEplbQoELDP5s62Fxv99ykOrKD40NJuY8VkPnE00wX1Y7LUIO2+Vi7fiuQB9vtokVAJVFeOlwnYkgm2WipftMtKsQEtOWNBBZzxce5dEz4vIkHAAYuljUinH8YYHZy2+RVRDOF9qayp//AnlKwXfYMU95LlKqgtA== 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=EpfOO9LdFqlvGOZ0J7Ru6IQpZU0EvDw/bG1up8j5CX4=; b=sM3jIWxI7XiCYg6fzrdUB7RVW2ZtTugxRFNADVFu1C0soLc8lE5QicUsDCNkU5zMCPBdb2kr7LBf2uqfyV+YoNWm8exl4WwdVeORNFUxk1YFtDlOO5cxIf9Ot2CQMFVSAhn8Gy7rpl4E6pJbB39vP9lg94sp2TBvqhYau1jloaMAjej9Qp4ZTKn2ZkOTdy4YVLFuyJ94Jf3TqARE9Oce5M1UUQ0UJgplf0NpaCv8Pvr3AIsbr152b+7FzP6Ye9qMEfB0OdQ4xnNJ2Tb6BJEsS4DWhw6tYzE9SCZpPxwl3OXtlTOYrO8hT3/U0ZBT7yAest64bk/sd8yGi75wksiG3Q== 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=EpfOO9LdFqlvGOZ0J7Ru6IQpZU0EvDw/bG1up8j5CX4=; b=lGziBknQbPKG/XGtYp96YR5kHJE2tm2CUeKD07KRzFxi6ywYhyE+WmbiRHWn18//cZ0lv+e6gRQthzLCLJxtxPO1FPXuvvVL8jqly1iZjSZ+CQFtrXlJPJGg1Y2tbkF4GCexkgTMCBPFDi0UDiDskPY3cZiRkMMStvMqPDZfFMCzMDd1HYZjGgdAXwA0123VFcxx7pI4Nz6ku6hcWO3J+a39+e1604MZiSKn/jrn7n8kKlZ5yRPpYEYZR10NtECWnrrEvnCPrX6G2/oshqt9UINVnYzGsFEbqBW/vTI1JuYjM12ndvIMdFgIjuw16s5avUVFWtLZDFjuWiXRc97+9w== Received: from AS9PR06CA0554.eurprd06.prod.outlook.com (2603:10a6:20b:485::8) by PAXPR07MB8495.eurprd07.prod.outlook.com (2603:10a6:102:2b6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.29; Tue, 5 Nov 2024 10:07:15 +0000 Received: from AM2PEPF0001C710.eurprd05.prod.outlook.com (2603:10a6:20b:485:cafe::a) by AS9PR06CA0554.outlook.office365.com (2603:10a6:20b:485::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18 via Frontend Transport; Tue, 5 Nov 2024 10:07:13 +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 AM2PEPF0001C710.mail.protection.outlook.com (10.167.16.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:13 +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 4A5A6o2i024723; Tue, 5 Nov 2024 10:07:11 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, 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 v5 net-next 08/13] gso: AccECN support Date: Tue, 5 Nov 2024 11:06:42 +0100 Message-Id: <20241105100647.117346-9-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AM2PEPF0001C710:EE_|PAXPR07MB8495:EE_ X-MS-Office365-Filtering-Correlation-Id: e5a24a84-21c3-4875-be45-08dcfd819e9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?exIB94xxZJp3cRwSTPqcqvYX2XSWLLZ?= =?utf-8?q?lnOA7l1ACNNsQDE9skwjt3PpyXrbxr5lO9PtyJOt4EA2P31wErRQezRBaeY8p//5a?= =?utf-8?q?PjSithAfzs8uqzjNWLcfhUyvZOFlKShleTZQUnIIxKoJAS65zGJdWTDrleY61V5p2?= =?utf-8?q?QoviqZxV/LpiDcOsj8vsjdst/KIbfiJZQU7vlLTRD4jIbxbz0qWuVrYtxgGPulV0V?= =?utf-8?q?/UwDDur1OE/xXtH89NQImcelX/RgzFUpZks59JbUCXkF6mGDnNoBBXO1bAPPoClj+?= =?utf-8?q?qQ2fEX1XPVJZNnU6anaEygCyqUw6BCBPnJA/OgOaC4eBYdkt4Zuv4IgUiqNQlMQFj?= =?utf-8?q?cJQCRr2Htjcuqeh4z4MT1229eZKdQHVSOKQlwveII58e1hWj0PyWHcszy0n5Aj5bO?= =?utf-8?q?vHNyesU0wADyl/uXsiE4uoI9S0sj/EPqTLVMz7F39EGyQXC4auxSZk/VXucoJqk19?= =?utf-8?q?JXt98naj+9MTalJZC9wF++2+65PMGlIui2IC+xzVnfSWB2keI77LcXsoJsF1KYGgp?= =?utf-8?q?z9LzVzdWFs0ledBtMEYzdlkHZAMSd5Q+HvlRYaCsGx03yNGeMrFbuulrteJ1c0Cvm?= =?utf-8?q?Vox7Ac6pnbVMy2hJCoOkIHZ9nEA91WSUfXbNEj+EJrc0EfbOrA+gZ/TTmCplgkbyo?= =?utf-8?q?8fyQrHXkT6UosbjxOPDWR/6cHWD4/ErxNaOPfVhHsQf9r6ZoS+tZ36E3p6gyWZd3A?= =?utf-8?q?2fairBAgdFvY70GF6ycgazt5Yu+FnNsJLWi64HXRPK4xktcn8J3sA5SoWCZD9xRuN?= =?utf-8?q?TcgtWGAFji6VARb1VF6CRil71FtqVDZrLWQvQRRNsGiq0QarpNo/Bz7jmJlJGvTDv?= =?utf-8?q?vYIODWVxIu01s9GVA1e0vqm+/d1OINZ3OhuUZZ9e7ctNBTkkuUGRa7NPHrktK5cU/?= =?utf-8?q?4ojcZwEwtqqPBhsPBgP90r5/gEF24yAnon6ETaR/nhdXUE47Y7re8iT/HZm/Bei+m?= =?utf-8?q?a0f2MVs3xRgoGGpXusfSozrDTDcflF7rfXZN0dndENq4eSUTw+2k84MqkFzRxa9DY?= =?utf-8?q?orMFm9tujYVzIzi+Jk0JsyE6/r7WaE1Ez8J5nwOosl/hgPzaEKT90W3+qagFy3jIO?= =?utf-8?q?OiSZFYbNw3PL7bwoFZdmbA1CVpbKekrREu+gY4k3Osy4ktwH92t8ODdjUNUAiq2Dj?= =?utf-8?q?CrRAW5KrNqJkwtitcEsYoSWnvyYV7BpZsebMN6DNWn/s3aBLpewErekjmm3/3+apA?= =?utf-8?q?mHWoodoP6H93D8D2lL3p1ekhR6jWYkQV9zRFlrNBSlafZtUNYFAo8qsNa3JkM/32F?= =?utf-8?q?6cTioZSlcvsHbPPKCYzUsEmqh8k3J2juobKDJtvpSv3SOFIqMWxWlIYdCbiw4YVHH?= =?utf-8?q?IB4DvxiHN78nQuYvVMQ4fFywankIN9T7zoIa8K178FB5slQ4D8Tlc1c=3D?= 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)(36860700013)(376014)(7416014)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:13.2264 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5a24a84-21c3-4875-be45-08dcfd819e9d 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: AM2PEPF0001C710.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR07MB8495 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 --- 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 66e7d26b70a4..c59db449bcf0 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 6e0f8e4aeb14..480d915b3bdb 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5076,6 +5076,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 48f1e0fa2a13..530cb325fb86 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -694,6 +694,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 0d62363dbd9d..5c3ba2dfaa74 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -32,6 +32,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 Tue Nov 5 10:06:43 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: 13862740 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) (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 C840A1D31B5; Tue, 5 Nov 2024 10:07:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801240; cv=fail; b=YFOOX8L4u8KHm10loNI+Aeh1YiLYPhhyef7helPE+QYLSjiWdKXawPkNAW2O6VscGULoi6VKm8S2DmbRRrKN1vzcQU7JKrLy5FTRUf3dBdErJEZuE2vr4TQV1ySNXz0DMKAZ3XZZhCqv46xOBehZyLAX7aQKrn+Qw/9zYMNG8Ig= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801240; 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=Li4jhTgdp8ywTQeqzehaT4SyX9+PTyp2/f7Ig987EtZnqaLe4YeMKi8Jx/EWDwQVJxp9V4+gDuuozNffbJrTD425qEhGcwXiJH2xJr87OTorNPNxyx7WVlCoZmSet5/mHakdm99pEBv9NQmu2ezPFQFriAcxU2jHWQwNiuMi3OE= 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=JwXIL6BO; arc=fail smtp.client-ip=40.107.22.73 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="JwXIL6BO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uXUGxUTObqkMjoNGF0bB5nD+5nBPHRnP+8+XumJtZu6PB492UlirAvKCA0KMSzidwZx05iHtnIlLFfVFqGmksqTIAMo7818L5j6ha0VC964EDi87kbvC2LEvn8PPBFCmDM2IvwY+yWWDS0Jc3fLsftQzsB2MHueNw+CQdkluz5LDl3Dg3S2b8qPtz7FeDpF3lr2F3w/8JuHWXcjzHfB4iZ+KwFETKXz8bF6N54gltnadwyG9v3DVwvz1CPAzjvxjjaEalKoev7NTbjOMz4JeY1cszU4DhcHnyP8Rt7VfVp7UtJOu67pLqsLxZyANOHXs3HH2/UnsR5OxzoOhMC1dHA== 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=hkHponZDvGPQMrdGO+eCjLPwPyjTL+AcOwZWpfkTwRHgtib3dG5061DV0yBqI07+FeEv2BZM4bgqJVMfv9c8lErr3RwSJHUoVJXuCQeuQ765a2P8oAsILyEflDGDCpdfkTxjvVsikkSE/T0IMxIhAuHNyKSQJBMobm84OA85WIbKqYzi5BSfBU75jiJHsQ4P0VrPte2q5IVnJYuJ1pxtHcaniGctQ7BwVQO18qztm7MFMr9dEJ2re2ZgdJ0ibjpqV9J3hDTRlmiNV4f6XEcYBetW5UUsh/CNcQajVbkGNc7fl0x/70YwhKtZ6OpCdV508DtoLtkXmnZF+zbgnUoLmg== 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=VSA7eqx5WtqjVvMOGIZmeD65xQRrVJgg0ZR6KM5OeDg=; b=JwXIL6BODM0ePeXy/I8WbwzfVd1wbApIy5EyRzzCr8iENZzeyFUaCyf5D6mSgmI+SV+755Yu0lcSPY49BJ6x0j344tbOFZjlHOaNknmNMzWyxbD8hlukUB3dnJcehzI6UbD4fwwFExphoCqYQrdRXDN6poWNeJULGi5X3OkRFskba4c+uO4Cjf6cPLc1FoIETlqa78T5U+wJ9LRfJ38tKakJ9F7vlbqmsAeZ8axwffE0JWPKvPSD8R9aNuT3asmSC3s52SQDCRTXO6CzdjB5xqgUqF+h8aE4wwXrjFyXXQLL4AbuvcSik+Lk/SbV/Oo++ygEzrwNLMlM3dJ/NZYa5g== Received: from DB8PR03CA0014.eurprd03.prod.outlook.com (2603:10a6:10:be::27) by AS8PR07MB7830.eurprd07.prod.outlook.com (2603:10a6:20b:38f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31; Tue, 5 Nov 2024 10:07:14 +0000 Received: from DU2PEPF00028D03.eurprd03.prod.outlook.com (2603:10a6:10:be:cafe::c2) by DB8PR03CA0014.outlook.office365.com (2603:10a6:10:be::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:14 +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 DU2PEPF00028D03.mail.protection.outlook.com (10.167.242.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:14 +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 4A5A6o2j024723; Tue, 5 Nov 2024 10:07:12 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, 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 v5 net-next 09/13] gro: prevent ACE field corruption & better AccECN handling Date: Tue, 5 Nov 2024 11:06:43 +0100 Message-Id: <20241105100647.117346-10-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: DU2PEPF00028D03:EE_|AS8PR07MB7830:EE_ X-MS-Office365-Filtering-Correlation-Id: b3823e4e-3e52-47c0-36b1-08dcfd819f52 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|7416014|36860700013|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4pekJ8OAy9kmmubN+FaNz2DDhVNuG7B?= =?utf-8?q?ptmiZ2Y+J4lXuUMcr8l7LnlTpmo+Ps6PrVlkLbx0Oz+34oK40kW63rkVgCfAPpYyU?= =?utf-8?q?7UVPFtlFRJCfryuyHFSvu7+HNxzvCPZNFKLa7mEe/a+5m+VjzHIICMfYO930tpaHX?= =?utf-8?q?+EUxIIG1O9+eJQpEJRRWNvh3W+7WnP2OY2sXd2Rv3CHb4vLvPnlgzBPlg2zEwP6gF?= =?utf-8?q?5bLGdGltqKkdb+fO1QV/2O2yU7SzTtPPFT4bEUdN5hhZvhUxSpkgwHkvu4kIHBPwu?= =?utf-8?q?FAzN7PW59TEVo88PE+6i9zMvMcbPVlShe9YLOSUeLe82u4T5kvAa+YN6DvynEDHBU?= =?utf-8?q?V4PTVxLDrqponq22WBVysk4Kda0S/PWQC2jq6EaYctN+qJE1+I+j+g1+xcvJnjZAo?= =?utf-8?q?lTqirWh/4SKe8nREZmbki5OSU2xlqIwHDHXVttLxMrbC5UOk0a5fGfTeifIsnuQMW?= =?utf-8?q?qwV+K1xgw1PnW1/ITOrOeqPgHL+/rvDqEVbMrMjmxQmGQPjjSSxlYyd5aCocSPwEs?= =?utf-8?q?M4AhV6IzFBpwY3Nd2zsqzPVBVJNIM8Q7IaMgML59QIMJsd1sgVjwQp20fGcYJWXW3?= =?utf-8?q?OAcg92JKpVGSiy9jXmdhWjpmSk3Idb5TATNfVbB5d2TLJENVwOrLXR9vcnfv+Ssvh?= =?utf-8?q?rTmg/tSgQUo6J5LJClAJ46fKrC7yM7U4/9nJmQa0clTsfrD7xlqm2SJrBEnBtRlAl?= =?utf-8?q?oVkN79m/srNZa8V2fJpxO74mcME9OXVzelJAzl+4sX4za6+6LHomOXuTJKMbz0oeo?= =?utf-8?q?XJn8mT1TXkDkkgHR8NYt2SWDC/3cKjeCcn7LzRQwD///53WBUZNbwwxtPy1PnCdZz?= =?utf-8?q?irI3KiW1Gj9aFMOYqCc7u0OHwmrn5Cx3YbLzffsUVyNquRyRRCkz7Wj2JmJkdXy+B?= =?utf-8?q?Vi1CDDixhJkFHvRXsboS7Qi2eVsv98vHsnWp8rbQSw6U9Fvy7ncdlAGIz9o00aNIt?= =?utf-8?q?//oqi8jwNd6lVDAQB2cHzAeb+9hmJQ606XC/727Vbf7WyR7f5x7v1T0DWFWDIW5V9?= =?utf-8?q?gEqHuv/kvDx3ah62SSBHDwSzpXhI0tEb84uWjGaPv07h4tpoNL06V/tLhMcXM8ibH?= =?utf-8?q?/u35LZ/l4j081CUKKUHK0aKBUVW5x2DqhM5a5PurR+LVPALIyGpudI8zUu2XyrNrP?= =?utf-8?q?PiFs2HSaGkeAi8F9E4LU/nMp+mcmmDKByZXVU1AzmKbeD136LqZVnlvYgM9sP/G/R?= =?utf-8?q?EQGK8sO7KS5q8CA8L9eyYJ/MRqalSlBjhjReWpfFwsucNJREw1mU3M3v7Q4m1JIM7?= =?utf-8?q?NF9MW7Y2e1V0YzunrGsO3/xLxhgd+Jwk6lV2o2JAcuPFpXsCUMWIz/8076ZOy2YBI?= =?utf-8?q?jN8xidVMzFwRazd+v68hCEp8YCXq93enojBvZz79D1EYIw5hNN9l0yI=3D?= 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)(82310400026)(1800799024)(376014)(7416014)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:14.3622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3823e4e-3e52-47c0-36b1-08dcfd819f52 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: DU2PEPF00028D03.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7830 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 Tue Nov 5 10:06:44 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: 13862741 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2060.outbound.protection.outlook.com [40.107.20.60]) (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 5D8041D220E; Tue, 5 Nov 2024 10:07:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801242; cv=fail; b=BRij6BGvaeN5r6Ns05jLcvLbSgh6im7Z7OW83l0c333Omr3FICklxLIPHrVozqB4fpD4yki/s/6jpEgigxoqGbWoT71GYbwayGMfw5JpFdCxnS5JtUviTPIzaO/NWHfYFhXyoUT7Bqocyb+qAWhjxUbk3dE9ZrNPBM9lzC8SvDA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801242; c=relaxed/simple; bh=eOHWPwMJuz/mcwi6S8cnhycMYE+XI1TmSzdOUd8turs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=AjUvUFBOEeVPEQ3w80O66b5BfbIclo5coFvotGvdOvUEgATmht0tdACnBxqxmufKDvmVin6H7segfrRRTS+UjdSU7UvbhKi1OShz2Fyw4dgmNdNXTwkS19Knd30WMDqtwl66pJg8p4B68mo+w9yzJJtyfIojncTH69IrvFYudoU= 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=sMOi+AeR; arc=fail smtp.client-ip=40.107.20.60 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="sMOi+AeR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uAEzHhVSb9uk+J0FPWQ38R+4J/DyN3VrvpcmnufJzYr26hPgFezvmkcnOZ5TP+tl+U8CEzycmMke1m9vltsivpy8Lt9Hlq4TALgDX5rWN4Kj2RbBn+oQPngxmCaSDdBLUPrGTm9xtyCARRyawwpW33r+vArGhB+k6mmOTzaVE4IE9ce3yUOs0Jt7GyQRvoT2TomXmgTTksblReui02wdVQkELs+aDs9K74QhXXCQyTMtaWLw/zvKf6qpCV1i8ZIaKazStKbktdQDHGhjkKtqCEqfC9iGTMteehFUL4bK38pA0B3qu63KNCLKqj1zsh0i83a6pKgbDzcBxpO1l8D/2Q== 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=KlFDTlzD+PlG4iZfYJwLSQYGNnGbWGzidStYupmxf7U=; b=zWJ4wVvHTGyNd/q0c1Z/WrkGi35Ag3DA7cuG1UaCOJ6ZKBWxly7sLt38PfojBJ7aJEt3jTDWSAOzJeWLqzNULlTb16oUZ3BvmOl+qmpchIW4hBUBtnQlw5l1Wb3Qu8QUrvpyeLHvN+NXbX+zvQ1UGnX9ZNeIFvx/yYxOO6+fQz78GgRrWDML0A+V89ZjTMbX0JBeabFa2E4TCJd9HDoq1NZPTLkgPVw/3I/64FGD0xWifnRnNNzena7xgkLHteKEmMspIh5nzBFudq/3o002zec7XXAUOdwPub1AYVhVN34Rk9S+NiPMN5lf9/+pnfRF4j42+pguQr2ngsDmegoIPQ== 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=KlFDTlzD+PlG4iZfYJwLSQYGNnGbWGzidStYupmxf7U=; b=sMOi+AeRVz/NsK/pe91yJH3WIUtnBaHVrDfZA5P3phoopPbh6D5Il2VuHwhgsuvaJxwYR/qoTaj51HGdF/iW8JxnwbHiCYZkHE+uGQvtN2rx1K/vFcbpMHBkAQ7aFyJLZPXo5cspBrhi+iay7p07kHpCKbm+V3B1HygSLPpeRW2z3Rs2Y9To3ZP+RIweMh6c6f1vUjtq2f+6bqJcTONhzyhqUfiIF2oNhpVse6U1Tx+XoWr12Jigii2Ryh3y5V3yr96al04/8O4uJN9Ss8MMDvl/UqTcpb57cj7TpFK5dhaiEgdfIlJuFS3sblHdrI9z1wwoRxVbidlhACePq6IlyA== Received: from AM6P192CA0060.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::37) by VI1PR07MB9458.eurprd07.prod.outlook.com (2603:10a6:800:1cd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31; Tue, 5 Nov 2024 10:07:16 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:209:82:cafe::d5) by AM6P192CA0060.outlook.office365.com (2603:10a6:209:82::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:16 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:15 +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 4A5A6o2k024723; Tue, 5 Nov 2024 10:07:14 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, 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 v5 net-next 10/13] tcp: AccECN support to tcp_add_backlog Date: Tue, 5 Nov 2024 11:06:44 +0100 Message-Id: <20241105100647.117346-11-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AM2PEPF0001C715:EE_|VI1PR07MB9458:EE_ X-MS-Office365-Filtering-Correlation-Id: 435a4c7d-3283-476e-e69c-08dcfd81a028 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|82310400026|1800799024|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?VbZHIHtpwO4MB55/YqJllyUvIAc5XYk?= =?utf-8?q?wyH3rKb4aDpdtkjR61ApZINXFMVltZA2up0GKHYIizqNgZu+pIz9l0N84B8wOw1e1?= =?utf-8?q?4No/IgpDROy3qlK+NJjbjSQXdfTXWESmJweQ4uOig9XWD6NZm4YTSAzXC7BZb0gI3?= =?utf-8?q?MBG5C5rFL5uOICCtirNhO5B02ucE+C8h05jftsrYXCX4cUT6m5VwjHLo2GY5X32qu?= =?utf-8?q?Sk1aqcs8G+IvtgmxHVOrdhwBdiDEvmPFieueqb3iDtumaLwDNj6J9FlrKfF0cM6qU?= =?utf-8?q?QESwwolqPO7gpLORT5vir7MkCkTNQmesK2EcUh+ZhJGh4+cl7eDt7db4qm9DBqtcD?= =?utf-8?q?GhW5gWEDd/2tXNoyXcYn72YU2+0+aUDUkWFrIGs7argrJieoPuMjY8AP+DTrFzRXv?= =?utf-8?q?+8ACM3Rcf1RhyhZcR9RxiBMzNwcQOITjim6i785vE+DzjXBqALsAjulu9Xm8N7glr?= =?utf-8?q?zsz9FFbpRlayzrsLnaIfTnavDmJeYNA1L6b/IQxXLVeArC09Nn3W0UU1oCvXCqCe7?= =?utf-8?q?qZmPI43gjK4VDpvl/Ka+KozS+iAVAJjGwgqWpFyfNIdPye96VnlslanInqiExYwfo?= =?utf-8?q?TZxOKzLp+YfauNfjUUvS3uanoUHOBqQHpbT5kDMIYlbxUTfQsdV8FtUyvgv6XEwdY?= =?utf-8?q?ZHOBuOQhC4y4dDEgriEVdNoj6j4aleuPjEnPK19GV++SBb0vM7416BnNlfiI0Fxbw?= =?utf-8?q?uy/U+WV5kwyYikiQXY9nG/zSu7fNahyT7CDskWSYERrsAAnpX8DYtIQO+Mn88wpNW?= =?utf-8?q?3ESPa7QY1+nVwCmXHPyDfB9JYxV3FI2kofBOVmtUR8C/HxqtyBZ4GC8O1n4xjBW8y?= =?utf-8?q?chLJPauTMDKXI0LW1naG9o4cd7EBJvm/V6RP/qUv1hD3YlS941HvcRaIwK56QoUrq?= =?utf-8?q?xVmwrnx+dv1cizJ385GB0mSljTlE41W1Fgp56jjpPrSGKiYqDxMs1ifnQmYPog5XJ?= =?utf-8?q?3TrMTcs4jODhit4ygY+TPfEqnDIM0sSpQeaxQ/kjHzLKlc+RhbWcpibeEKBeKQv+5?= =?utf-8?q?yH4beNB8RC5wpLhDFSpcEKaMyZKECNLV1ktVa/tNeOy2eLIzBc2TUT2ldN2wtlIeS?= =?utf-8?q?UvOVPykW5pgAti+wYZw6M6oj2/CCSB4ni3f7mig7Cg6k1LmEuw+PWivPzkdAbudBk?= =?utf-8?q?eYrC9L0+lVJHtKLAmbiw3MHgHCmry/ZOGU1GynFSgEe29cXUwryAj+fLacfb2Hxnh?= =?utf-8?q?BVmIt0k1wgl89Si/8i/ZJIKPmikSgDBm7WjTdaPV4t+DUDA14L8/SWm9OeDIN/0T4?= =?utf-8?q?1nJMEqF2AVw1btKR6XK+8AivzGIEj/mWuXinb2Mtm+RzW5O/L6mP0qqwaM0qRPHa0?= =?utf-8?q?kZ0dMqYFkLpfaa9Jn+f40rep5ccgi4A38JBVUQQ6LJHmzGBwZ7tRs4c=3D?= 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)(376014)(7416014)(36860700013)(82310400026)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:15.8005 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 435a4c7d-3283-476e-e69c-08dcfd81a028 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB9458 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 --- 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 536767723584..a13d6745d92b 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2055,7 +2055,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 Tue Nov 5 10:06:45 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: 13862745 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2047.outbound.protection.outlook.com [40.107.249.47]) (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 188FC1D364C; Tue, 5 Nov 2024 10:07:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801245; cv=fail; b=c2HzUD0Imi0PkAOBrWl9NtJnmgNN3D5o1kXkmMXwlY6Y9h2iDJQwngl/XtCkiT1YmnVDs/zpMubdgXwdchAV1Y4hP8bsOvt//MJBkkVe7DOOCn8cyZW+4kEfUnKu2BAU5cefSfOTmvjExX8ExuJ/tSDs9qWQ/13uT+qJRzUK7AI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801245; c=relaxed/simple; bh=A0alP3i7BChIrDcYCJQzCBSK6YQw6QqGYkRVrg1e4vU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=bW0vmV5lFixlOwS/VcD/+DUJD94I4Y3QRji34NUd1QM8UOBf9zBANlI5crcv0LwdiYnM8N5nL/R5DqVbvJFR04tPcKCbPZVx5h+oLwEoW7znbRsvTc/0I30pWeZsKCN7znlMljr3kqIM19IT/9tT4b/amD1H6seKe1kza+F6Ebg= 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=Hd1Ue/0f; arc=fail smtp.client-ip=40.107.249.47 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="Hd1Ue/0f" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pk0NPsf+7FcUFOoHOoFtv/0nB+JeDD0m7ZnLuvSoAT259GWWbR77Uq1TNyrn6tgL49J7oV201gxCHn9BitUr4xJBw9KM+yygUaY6RAWPdeHC2vy8gxNMvRLKhvOdwRhQ26VCzvYJxA7WZGGjqdU9EljLYMHYwHM5XZ4HaP0wrF+/YbGcC8/LAQ9sBX3CILP96ZEBW4/gOwe+1yirsErJRiH6DHfMC+AReipzL+iIfXV39BsIAIYXkw5fot7aEolMGk/z96g2PeElQ5xMpcmpdTLxucRXTm+bjuFeGbl5E1ZuV3wriLu+youNinLjdrl9CW1haUZflmGPOEtlIqLwwg== 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=QNStub9z4iTqc3XDC4qBDpx4QNkLlRs6W6piM1aLW4w=; b=xAbw0EeTDh8tjXVwn1ObNqmLvtHR4zpTlVfIvlZUgrqsxQAJvaQVjqdwFBPeq59rttTsIlCqzGEXLViHBzfykaOZy+zRYGxl1haE+KhIihj6Em0ODjXvmkYs2rlkATQNiEBFtIOD0zwjsOCmEit9k3tAFaRlfh59Wb5no53plb44Sgqv2l6HiqZSU++Lu4HlUEJIL8Sxg12c3oM0VdNPxM2ZpfI3LP1YxH9g/GJcd4uWSmILCpf2+5q6f92AdqNV5GveMogClZV/j4NhEl6uPKiJ3aF/3auYbnEGz2zZ123lQUawz/Sm1a1nce091pfnWIAFsE+fXyDm1LzwtHn7ug== 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=QNStub9z4iTqc3XDC4qBDpx4QNkLlRs6W6piM1aLW4w=; b=Hd1Ue/0fFR6qSPM7JjnlYWsId6mKzLEgC44UdCYh/Bi6VJjvofmbQS/KF1+z22tQkoOXfao6l05CaoQKXrM2Wr8MoIjKyoPddt0c+v4DVrQtBlYjwJz/8LhMyaxXDCY49O5Ef1cxCFDo0Ksej/D5T089ueDddLNVOJ47NUDeWJBa7AquQ8LkOzUabRAN4Z77kBia6V6luheTAvwTp825wI9P/W8FWXFfGH8Qwj/Abyiaatn/ybSVdaFoMCxSmK1X/ss6GJUZqwIvCT5VJpK+fCAXkvavM+4gazdQ1T7ruSXgUegSfegE5hwE1XDS37es/3ZRuR7hx2h5ZLOq0VeoYw== Received: from DU7P250CA0023.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:54f::11) by AS2PR07MB9169.eurprd07.prod.outlook.com (2603:10a6:20b:559::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Tue, 5 Nov 2024 10:07:17 +0000 Received: from DU2PEPF00028D02.eurprd03.prod.outlook.com (2603:10a6:10:54f:cafe::32) by DU7P250CA0023.outlook.office365.com (2603:10a6:10:54f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Tue, 5 Nov 2024 10:07:17 +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 DU2PEPF00028D02.mail.protection.outlook.com (10.167.242.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:17 +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 4A5A6o2l024723; Tue, 5 Nov 2024 10:07:15 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, 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 v5 net-next 11/13] tcp: allow ECN bits in TOS/traffic class Date: Tue, 5 Nov 2024 11:06:45 +0100 Message-Id: <20241105100647.117346-12-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: DU2PEPF00028D02:EE_|AS2PR07MB9169:EE_ X-MS-Office365-Filtering-Correlation-Id: 68f4f258-120e-4b67-f133-08dcfd81a122 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?kVyESe2EQHnnMcftKZc2xOEIMT8ROoz?= =?utf-8?q?QXE9jnm320zOBU/yg/SCWjjp56TlGcGOx1fHMts5lW33S3tm3r37mIEwf228nzQMM?= =?utf-8?q?HYEza5BK9T92Ul7Ptzhi2TapjenHrtLVtzetmwIphTvyPlXvnJhjX6VratZEjHiZz?= =?utf-8?q?0Wln8C/dyi98ZiS21SmODBtFJEER2INohQbNsgvhswAJWYngM4BEtKxGj5K9Bt4ie?= =?utf-8?q?LbUKWdLOjyFh3DPBpQph+NEDx75EkFFYV9asREc/govNSGQcl9FeImpQ4TDLdEh0T?= =?utf-8?q?YU5BPM+ZP/tmvJDkhmU8qvWKR3+ifF+SWoI+Qdwto2mblBpIgLyAgjYYlX3PYr+hc?= =?utf-8?q?dpFgjntb663YXMWKdjyDvN1Un5CkJKZVzMbtd4Cue2HF9vTjPmeLXeSjwwfedV4uS?= =?utf-8?q?nZitutoc3e1UsrS7FGNuFjrN+FHBSwB5LveQQlj9dDmwYSSiIlecTvVgaHKi2dXwU?= =?utf-8?q?xzKAeADoqFkjqU9vTFo/qi3C3oVr6y+EPuiQ92XBqYXBn1DA6VtRJfs3OQ06ub0x9?= =?utf-8?q?8EFUYUcnUG+N+aczBJ5gE8brCriA6NL0/AXzr+pKrRoSyNwedpVChVMuJvBUwRmt4?= =?utf-8?q?v/BReUC52Kw/jy7LVT7vcaZicQ5E6yTTw9BU7k562DK9ApaTWiRmiN2gm0pDpkEgd?= =?utf-8?q?ZYVoifiWt8vNAlV9/6yhR0Cneff8cWh8jJ906i4sfOvQ8n/Eejpykrf44DW1+k4KR?= =?utf-8?q?hWLt8rbCUgeYzTz7emkfIEteRLOCrBZ48/MiF+I6VsSLhUdXxfLDy7mTq2dMPlIvw?= =?utf-8?q?Uh24ytw1Htu35k2cRYpzclPd7MNYVfVPw3aMM/+gwnHvpF88jrpOl8xxvHP4Chmg2?= =?utf-8?q?OaI4qS1sLfE3lP5N0qgR1wse84NrEokFFABi0CaRmIwxjGZt5uevIsFm620RMTV0O?= =?utf-8?q?cAhsNKh/BgUpSzuUnm3X5KAjA86VkTKxQGvsCY9C/N5btV8VrGi264fQlTiGeFVi1?= =?utf-8?q?5cVFvL14movlOhzSvpf9xgeEqnWhDf3v4elYD3G/9zjkGWnR7IbCUTsToo5e9QCgr?= =?utf-8?q?gA8hxzC6H5r6Z2IOJKs2EcB4iIcNXz59HgQw8bW4bLajSz57wzpScUlkF8ke2XtGn?= =?utf-8?q?OIEuQepMRb/DYh4iI2vFXSf47F8xgAZf4Ayif4RK3T1yOX/dhJ2qTOV5ByqO8ioV+?= =?utf-8?q?ClHyvqSr+WZParVQh2jIXaM2thnJiVbkCluSw36UeFErhbqIGXZ57q677XgR6y3XN?= =?utf-8?q?vYv7q2oZzO4F9ERkMaaLu5QyX02lJfRdbAg/YzrYL/Q8QB/6N3rOylvPK70H7nAbt?= =?utf-8?q?ia2YWq9Ddq6oOCewCvvf/qFY8L63XUGLGXfDeMEsgbAh9GnQPgxDH4bQeidZlW0vH?= =?utf-8?q?iNldY+uLJ64xgt9z3SRPnpg3lDEA4Yr4YQahZsC+Z1868dTTInZqAbs=3D?= 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)(376014)(7416014)(36860700013)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:17.4079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68f4f258-120e-4b67-f133-08dcfd81a122 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: DU2PEPF00028D02.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR07MB9169 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen AccECN connection's last ACK cannot retain ECT(1) as the bits are always cleared causing the packet to switch into another service queue. This effectively adds a finer-grained filtering for ECN bits so that acceptable TW ACKs can retain the bits. 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 | 23 +++++++++++++++++------ net/ipv4/tcp_minisocks.c | 2 +- net/ipv6/tcp_ipv6.c | 24 +++++++++++++++++------- 5 files changed, 38 insertions(+), 17 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 215b7ba105be..3a8782874333 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 0065b1996c94..2fe7b1df3b90 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -75,7 +75,6 @@ #include #include #include -#include #include #include #include @@ -1643,7 +1642,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 a13d6745d92b..1950d4cd5da8 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -887,7 +888,7 @@ 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; + 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); @@ -1033,11 +1034,17 @@ 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; + + if (tw_status == TCP_TW_ACK_OOW) + tos &= ~INET_ECN_MASK; + #ifdef CONFIG_TCP_AO struct tcp_ao_info *ao_info; @@ -1081,7 +1088,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); @@ -1158,7 +1165,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); @@ -2179,6 +2186,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; @@ -2405,7 +2413,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, @@ -2426,7 +2436,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 bd6515ab660f..8fb9f550fdeb 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 fec9acffb167..ea85c117bf96 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)) @@ -1747,6 +1754,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; @@ -1967,7 +1975,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; @@ -1992,7 +2001,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 Tue Nov 5 10:06:46 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: 13862742 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2088.outbound.protection.outlook.com [40.107.22.88]) (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 AA8241D3627; Tue, 5 Nov 2024 10:07:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801243; cv=fail; b=hv1PruNkGGvRM2RxqasLv+v40pcGoLxENTUKe+835jiRi2FzvyBYb9sRSV/M8/Md7OsBzyuT2IIBeaBFKxJjAykeLWqpxxCaqgErPgmThCQP2iIHgIfLrdQaMS4h493gW5DntBR56worvHghHzopK22Rls2aPQowZpiErOf1qSs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801243; c=relaxed/simple; bh=ssjxVEMcvpaVcfyj3lHG+KGc+gIGqQWYDIRxqflhA54=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=dpv0dkAWPjcEYOKZ+qwjRSlyX6ttWTZhbKnOx0S/2uBHJWmzkZvpdhWB7WdxW+sShyGsHAjrJStTLQgtynzuqRy0fy0U9BF+aPhjLEgf1n6b2DQv0v2eocnlxGuVwYxJCiMUKsjpARVJDKbsFdr7PFLYZ1gPksq7E+EQ5W8qmO4= 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=BOZ1OpKP; arc=fail smtp.client-ip=40.107.22.88 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="BOZ1OpKP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bCq+LTvXZxaM1cZG+6DkAcAgQDDYiCbdYAkfMbiKL8hDEFFeSzqDtQv6T4GaBfaDuNpWTRwHfEV9xmaun6tN90v5Z5DPOXd1d4SsWS+9l/ZmamNAM7e6X7uQQq2izItMmfMK1oUpgUiulNWekf1DUCI9g26cCczrV7lFUV42trO4kgkZq9orwdYjlH8+dTuzPRprETGwyZoUeiKxUiQ65gn2bDJ/zXdAyu3LlE5OD7IxeSjv7WAhVuLwbLJed4wrExyqa3erlQe9u3zzORmaYB1PdBpEobMx5OVID1eEoIrPQ+QNdQED3KcCPFxAjWnLmcuDpYq8pWfFt/8eB9bBYg== 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=N1pZXl5+kCUsPEVD9JDjJjXdEzcn3u/itThiBuxhFZI=; b=x5M2PbNB/Ol7ODn4SAqt41U7cqEbSin12KlYPq+enkTdAaQ5CkDLttscQfdUabuYoQ7FLtqEAT/MUsl5iC2ztegh+cfqG0lIcLj+QMOTaYbrS1kgfUZclkVHVAD8BVx2TWYNkQBNuB3LqgKCobbA8yVz+uhuOWA10RVg9DV+2JleFjOYTj/ekmCoIWqBVTdGwnjwio9AarnxkqDIh14acssXh76ZUf3LDcCbML1ghJWK29n5gIRHM5P4ZSZ4A4o5DSjsYMdpCgTHl9RERGehdaYku4PFnNF0cxTNbT7fb0JWvvoM7fwo+m1mDHutU5LfB0LQXY3uOn7QKJg4TkfvZA== 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=N1pZXl5+kCUsPEVD9JDjJjXdEzcn3u/itThiBuxhFZI=; b=BOZ1OpKP0ThZLtBspZuCMaTaNQur+kP1rMr3Uudp5ZFj4yAiqcIDznLCV82LSBoUBo1VXglSYRLSxysLxXo0KEzYMi3QAEHjIsVlKAxslubzX7Jb7OgaarKBa5g693h9pTO35AScLso+7qaEemW9rfbtJ7kwdgkqG09mfqzNz98peIftJK4vnvNvfH2lG57BBpboV+4ABRvf6uwBdeLR2XFgpgvsBM+pITqRMkW1xNZu3G5XAL1CDJel3+6WbotQSp9WIgkBnd/ZK+lgQ9pgNPpjvGZYh88hl7leiuGwWmgQgshJ8mHuXzd/c2YhI6QkZDSgHjmMHaBOSUnrGEev5A== Received: from AS4P191CA0054.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:657::12) by DBAPR07MB6999.eurprd07.prod.outlook.com (2603:10a6:10:19b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31; Tue, 5 Nov 2024 10:07:18 +0000 Received: from AM2PEPF0001C714.eurprd05.prod.outlook.com (2603:10a6:20b:657:cafe::41) by AS4P191CA0054.outlook.office365.com (2603:10a6:20b:657::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:18 +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 AM2PEPF0001C714.mail.protection.outlook.com (10.167.16.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:18 +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 4A5A6o2m024723; Tue, 5 Nov 2024 10:07:17 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, 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 v5 net-next 12/13] tcp: Pass flags to __tcp_send_ack Date: Tue, 5 Nov 2024 11:06:46 +0100 Message-Id: <20241105100647.117346-13-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: AM2PEPF0001C714:EE_|DBAPR07MB6999:EE_ X-MS-Office365-Filtering-Correlation-Id: a52d718c-889c-44f8-c4ea-08dcfd81a1aa 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?RqVohzJdCSt7vyGmln6iIF/Zl1ErQY3?= =?utf-8?q?Y0aXCu+D4lA4aWr6IUkT3eqwwS8VFG1iO8ZAa60Ns+lmu0zOzoWqHEacZ7buyh69v?= =?utf-8?q?/03o3EVIHZOByvtjc3djtA1NI5vt1nPfO4TJhrmIIfGLykIXWHqKIlDdhOf9NZGEb?= =?utf-8?q?yOOl0oqIptLHfIKAhREbOnhvm6fZQwhfx85UQELr1YkD3r+g8mQ0SKRzo4SNZny2x?= =?utf-8?q?ZyCZTN2tEB6RyWp1KJsQWxlPVFjbdg6jto7sNox8V1Ve/SInYHbf3oMtFb3QpZDEO?= =?utf-8?q?DV1rcGU1H4bHpRiynQpZWDeEuEZK11R8h0s3FOamudEyOUiJ5kpVMCegtDEfcCQVg?= =?utf-8?q?WKmNpDg3lfmj1w6s9cPM1hpi1F0IzuqTf/vmJ1NYs7U7b8czzSaaKBzmUzVw3hnzE?= =?utf-8?q?3w4KkVD1jffICBMTRUqRIfCTORwTxPkYX3kQp351JJJg0L/7hbWfC0SI/EUtgBZgn?= =?utf-8?q?G806eSoqIx9KHUsmbS91vuL/vwiRgeUp8ZxRCDhqolieXh+n5rKXq3xJCiBCcmQxo?= =?utf-8?q?zWlpFfWbep16ciZCwfSDo8Esu2YfAPDesmCF5eDApF2PyQga2dpGORO0BXcbHKDJN?= =?utf-8?q?JN+fnYsoAcvHXQMEqPxQM0WQmMu0WHZFv6S5w8o1H3dOW9vG9zPgy8JTOTJL/qfeK?= =?utf-8?q?YIJOOgSb8sd97gtDBntEPL/jjCGHTFd0mu9LaSXfEJdqoZR/QtAIjDCB7Sgr8WpwJ?= =?utf-8?q?ez3qFTilyUM8lG6DwMeVy6daob/4TDPBmUuMkZmggZJdJM0Wlqkcn4fKc5fcLVkIU?= =?utf-8?q?IPjYct/NCw9N5D2H9TncR1iUhyYp7hlBueDQ9S1A8mw/Z2rMdt3ZkiBE4r0Km0SiF?= =?utf-8?q?+tcL9fD08xspBfQy6mZV2b++h8n3ikFberozEnTCa9VAJ/S0QHNPRXlQMK5JLjqyk?= =?utf-8?q?hglpAKxEHcv5CPJZHN+Co8ZJ/scF1Asotxjb/Hrkpd+yNPvT7OF8kK/W597ifAUt/?= =?utf-8?q?WDmrHq4wCO2rov4SHEQOBZeYcvwZkM/BLYTpjiO2nh7P32RAnn2xYTDULcGN5q+Ak?= =?utf-8?q?nZzXEIHzjksAS86FmANTquWwTnJpdlp7Y0XqMA8PUeylGaOetBe7DZ9UpUx7ziKFD?= =?utf-8?q?bpIbAY8q/Sv+wtd359/5bG875Wr7Nf8b7pdO7XwhPDvDh3SroLSY1+7xiBiej9law?= =?utf-8?q?GG/jFI07JHuDeaBnKjkEXQB2sG+Tp4RX2W5QhJn5zi0ilSf4TNYEPhb9QeB57HiAz?= =?utf-8?q?fcdqCTRJVHeK0uZCVlrfSNGLwvVGnETSmrj0XP3Gqgnh9h8F5XhNBnrYUC0cu809U?= =?utf-8?q?RjGpEqoxZcXkqn/2UnghJGhFClwvXu4yPgdvNAIUQdKAxvLaS2idCf4qW9cIcLees?= =?utf-8?q?Q/U0oozcq5F8KkJ+MRHoo6IlM5zmsePZLL9oQz4hIunAESw5WPpn4mA=3D?= 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)(82310400026)(1800799024)(7416014)(376014)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:18.3449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a52d718c-889c-44f8-c4ea-08dcfd81a1aa 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: AM2PEPF0001C714.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR07MB6999 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 --- 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 3a8782874333..fc9d181e9362 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 f4ee86e2b1b5..fdb4af44c47e 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -4230,7 +4230,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; @@ -4259,7 +4259,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. @@ -4274,7 +4274,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 From patchwork Tue Nov 5 10:06:47 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: 13862744 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2043.outbound.protection.outlook.com [40.107.104.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 D39561D319C; Tue, 5 Nov 2024 10:07:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801244; cv=fail; b=r9fyMnLI98QtJakJm6D5ZA01C181P+uJxaCXND4dAXq/6uV+8TouPdT7/9rKhBLMLaG6i6pTr8T2mYyI3+vu+kZqGShJZ6O4fEpkPIfqfXwe8nLPiPYDDBO4LmHgHblA/nvOdaK1BLvpdhXWSz1r2DaDC1Cd1AUc7FyyEuYYHcc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730801244; c=relaxed/simple; bh=gU5bTWaRSJRRY+OABQjWb/EQSIBvto2A818+Uk91GYY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=VOvz1funZ3YntEOi1S31IJUPkwg8W4TWuT0UiGFiJ4MI1/bFMLxm0XI1apa8t1qQSarMckZAmObC3aZi8nNbOXRuaMp2RmPl5YrZn2yNMU0G5YKo0JTEuYlo99KFjIEsgWypG02zjjjL4MAKFP8FTCxmxVcC+hcbHGQUOKFjeYo= 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=RAx6cZs8; arc=fail smtp.client-ip=40.107.104.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="RAx6cZs8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JZXpddY8NBVql4BMuvidAPFD7u/URVvFnLp4EH//YZ1iw0tGBmSlawqQ2oEEAg5YIjqUWgeyHhC0r9uNt3kfTRlVsK5fGkbZMCG5rBkuScO0OiYLOWbQd3AdGh470+3BA4LXIIA+dYWVi42GexZZ30fGtgB8juKT6+oVn/R4FAQHT/Iji9Nn50bKOrqBEB8CWHypeW3BlYTJ1qCY5zfApmLUrf4I7zV1uHXNaQpvA4ErOaNq6FjuFRq86FLnkTVrNKmTIpGRXUJeNpk8XQ4qgoykeh8bYpwNUrhu/NKEg6TE5yCl/Stw/g9VE7KSte+PRavir9mIhseDHzVVJsMerg== 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=OrsVlUfq0qAe/cNgDzcbvtTrQ21P8Ir9GQPhTTcHhh0=; b=e4VlZHMTt+KHTYopIwY3WJnCql1Vlo8rfrOZYVmijHtfPZkGVaBB9MJ7N2Sgqj3kR1WZzCcjyipbLWA1IjmEzV5jEGIvOIZPagOerSPfA757nItPxRii9wZId+RkORYlNkVghpP70bm4tV/e7HQzkPrbE8DcAhQckVHYiTALYTLMgrRfXSrMPh9ymj6YvCiXVkElz/Zr7jDITLjnzLWfxTrHWNADJEHgLS2Bs1MRXExShPSYVAmL7R/G0Z+4Pts80eL2YfQbvsRUElmk+y3l5M4YDgZxvWHf4EiVtRJofvl0VWWVb2Y0lF/bMo0ogYu0ehijkmwdnKZRqWH0+jCCkg== 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=OrsVlUfq0qAe/cNgDzcbvtTrQ21P8Ir9GQPhTTcHhh0=; b=RAx6cZs8FgMkDJVavYILKc1+cQJLh8UPp/5VzZpY9/R9DzE4dfo7YJ16x8CEB+pXCnUi8rA6ahd/ivTo6s64LTGwJSZ02EVJUqfUseIpHjI+JpRxnqMLcLfA6PJ9jtrRrij1yqjM8JWCrolU6HLZlVDdbCDKzPCXoRy3bBnOpB+SYHM8c+JjdYQTYEMfiWn4beoO4xAJ+74YddRjDEXRyTsDebj0A11qG6R4cC1Wo9zSJJgqc600+dv6i4s1GAO/L+C/31wSVouwKgApw9ziqWq6SztwDZ6WZmKhtjT8jdqbZ4qvoJ3Q7ivwDkpfMAr0ZzMpLFOas7pORI8RWmObzg== Received: from DU7P250CA0017.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:54f::20) by AM7PR07MB6422.eurprd07.prod.outlook.com (2603:10a6:20b:13c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31; Tue, 5 Nov 2024 10:07:19 +0000 Received: from DU2PEPF00028D02.eurprd03.prod.outlook.com (2603:10a6:10:54f:cafe::fc) by DU7P250CA0017.outlook.office365.com (2603:10a6:10:54f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31 via Frontend Transport; Tue, 5 Nov 2024 10:07:19 +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 DU2PEPF00028D02.mail.protection.outlook.com (10.167.242.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Tue, 5 Nov 2024 10:07:19 +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 4A5A6o2n024723; Tue, 5 Nov 2024 10:07:18 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, 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: Chai-Yu Chang Subject: [PATCH v5 net-next 13/13] tcp: fast path functions later Date: Tue, 5 Nov 2024 11:06:47 +0100 Message-Id: <20241105100647.117346-14-chia-yu.chang@nokia-bell-labs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105100647.117346-1-chia-yu.chang@nokia-bell-labs.com> References: <20241105100647.117346-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: DU2PEPF00028D02:EE_|AM7PR07MB6422:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fdb73c5-651e-4ea1-0a04-08dcfd81a260 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|7416014|36860700013|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?p6o6UBwzUo/iHVxGQVLoB8eDGUiO2GA?= =?utf-8?q?8Xko9RXm8yhKjc/7jlF/8LRXaQVLWDpBxHymKf5mXN3Y+Ddcjdd5W8xvJmSxoMY4m?= =?utf-8?q?WcJp4sFAgbEDqkSDHVaLJCNVc1sxenD4I9wplccGNwGSi09COpvOVwnvc65t9Wx7I?= =?utf-8?q?E3It0cnoykfX+ZzYEYqgR2bO2x3DVQhwuQwKex+L01pcvuy9xX8d1qhkcVHyutetA?= =?utf-8?q?df7hzaUUUXZvfKrLIs8OP49JwRcmxpjMq34rS8iZ3BpMb6VKXNAJhzsjxTcqQ9EI8?= =?utf-8?q?rULOkCFIcUuchUNPIEsp9hTmSQ9pASUVVRPgD87Q9ReIATwM9hSTWFPRBThSaN69/?= =?utf-8?q?w3HdzLioYukKqjFFC4o1MMFmgBa1sG9aTcrZIHlY2RpxXfuFj8o2JDQC7uMK+NbZA?= =?utf-8?q?zyJelvq/cYGPud1B5D3DI9Fa0nux/78i7Z6fqnv19rK/Ohzlh8pzEIVFa/ZU5mDkO?= =?utf-8?q?1+m3E9vaC+G+HTQwXEz3DCouRMx0aPIQe642SuxhTdWi7VPH8khDztCsS8u30pcNc?= =?utf-8?q?zXhk1X9NgpmdGuuWyc+D0c4O2VXWVEdNl8ulCEXZoxvShxMAiVWvZyGEkysxJ8dgB?= =?utf-8?q?VHSdcAT/22/S9jviAp/Ly13xxSQba41+DGQNi7wKuP1EZytP0dpc5+uxoJyTO/D0E?= =?utf-8?q?xsgssNmOu1i42I1hRIMfj/x8xt8KuUzkkvM90ze4oKkxGkBKc+1J1Xe3Zq9YR409x?= =?utf-8?q?cYzL509eRuYMm/MGL0DzMSq5SZ6+znm9rdF1M+qxSyitvEpScsS7Rl1tnHYTQ2srd?= =?utf-8?q?CS/154XJDj1hNxXYnuuW26/xOGwlc+JgxiR/V9QKRSVGVZ2sEOSDz1eHf1E3yC62g?= =?utf-8?q?0zlDXPLL/1PYOkDDK4EdfZe1fXEaLt9mFQqhfWFXYQK7CXY6ZfCOaE7etWO2KpNUy?= =?utf-8?q?8oDgVypUlVSs24xLxiAEXtOKVSEJdXoM90LRHe91SY2tXfk+NOjPHVQZ7CXWCMVqw?= =?utf-8?q?FsLmVsYokawp6jWfy2n0BhPQo5FBtPtoaa1njfzG4r3RR6wH/nPQH8E2X1bHmTTFw?= =?utf-8?q?qwh4eQ9ZrUtZITDjHGTKzY6QGizFNx2jMRxUEpIfoW223HeFxpedsO/EGT2M0roaa?= =?utf-8?q?POFUmXqgZ++wGjrxasQoR2E0RFAbpuCE7SuPkMJ16FFBYp/qKLSomCgMIbDh44dWv?= =?utf-8?q?aDuekB5AlJSfqhV0lrV48EbhZP9ADEgKiiMqtbDE0SKI3u4s9RVsxGLZbQowccWXD?= =?utf-8?q?iDmdJA6P/eWSS4ZoqhvF+eUaD2ybfD/Ac0RtwR12bB+OhQejZD21JmnbkfjGJZggM?= =?utf-8?q?YFQAlvBfX8+XY7tvMyx1z7AVfyx0mL+gmmxiQ4Tm3ghdCzDlif9ifxCEHBTNP+Vt5?= =?utf-8?q?XDyC9iyefh7FojzKqst2EoBSZTY6bmOnRxUsAPFJdGyW/8PrJqEU3xc=3D?= 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)(82310400026)(1800799024)(376014)(7416014)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: nokia-bell-labs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 10:07:19.5016 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fdb73c5-651e-4ea1-0a04-08dcfd81a260 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: DU2PEPF00028D02.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR07MB6422 X-Patchwork-Delegate: kuba@kernel.org From: Ilpo Järvinen The following patch will use tcp_ecn_mode_accecn(), TCP_ACCECN_CEP_INIT_OFFSET, TCP_ACCECN_CEP_ACE_MASK in __tcp_fast_path_on() to make new flag for AccECN. No functional changes. Signed-off-by: Ilpo Järvinen Signed-off-by: Chai-Yu Chang --- include/net/tcp.h | 54 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index fc9d181e9362..6255977bd7f9 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -788,33 +788,6 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp) return usecs_to_jiffies((tp->srtt_us >> 3) + tp->rttvar_us); } -static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) -{ - /* mptcp hooks are only on the slow path */ - if (sk_is_mptcp((struct sock *)tp)) - return; - - tp->pred_flags = htonl((tp->tcp_header_len << 26) | - ntohl(TCP_FLAG_ACK) | - snd_wnd); -} - -static inline void tcp_fast_path_on(struct tcp_sock *tp) -{ - __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); -} - -static inline void tcp_fast_path_check(struct sock *sk) -{ - struct tcp_sock *tp = tcp_sk(sk); - - if (RB_EMPTY_ROOT(&tp->out_of_order_queue) && - tp->rcv_wnd && - atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && - !tp->urg_data) - tcp_fast_path_on(tp); -} - u32 tcp_delack_max(const struct sock *sk); /* Compute the actual rto_min value */ @@ -1770,6 +1743,33 @@ static inline bool tcp_paws_reject(const struct tcp_options_received *rx_opt, return true; } +static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) +{ + /* mptcp hooks are only on the slow path */ + if (sk_is_mptcp((struct sock *)tp)) + return; + + tp->pred_flags = htonl((tp->tcp_header_len << 26) | + ntohl(TCP_FLAG_ACK) | + snd_wnd); +} + +static inline void tcp_fast_path_on(struct tcp_sock *tp) +{ + __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); +} + +static inline void tcp_fast_path_check(struct sock *sk) +{ + struct tcp_sock *tp = tcp_sk(sk); + + if (RB_EMPTY_ROOT(&tp->out_of_order_queue) && + tp->rcv_wnd && + atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && + !tp->urg_data) + tcp_fast_path_on(tp); +} + bool tcp_oow_rate_limited(struct net *net, const struct sk_buff *skb, int mib_idx, u32 *last_oow_ack_time);