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)) {