From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.198.35 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796021881; b=tS7D/slqTosA/r+LJY1KLdlcXwNSbr3VwnfNygIZi/XA67zZmBxi8BglR/GFjIP5xDFb 657LkPzwPCPQ27opd/8oKKHizs0W5B5mcb1+gvNr79SUxIZg0usIbvZEtQ5dSEbNbvyze F5jGzea/SnHZIYVSgaxUX1sNsTdgJK7zZJ7ZbNagoDO6u6BZHG2Jy0tRPOip/prWMonUr hUGWh0ccawYiVXnUM5DbQ9kldIDm5hoHJFHlQo3LJbCavra44wRhBCS1q+zQailRKE4XM /YkE3R0ZVFTtgLFmTAVuQm4uIVHMVxs/unxOhdoYVZHWT2I+qOOIaChlKdCBUflbKGA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796021881; h=DMARC-Filter:DKIM-Signature:Received:Received:Message-ID:Date: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-ClientProxiedBy:MIME-Version: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=XVobz7EcWb9FxelYHczvSdTivF9tQCQkZJh6A1YwK4Q=; b=iNOzjpZIwLRivq0rBPw9O7NTBuchypykpaCOKYS461gE/Pmk2q6Z9p7xMo2aLa5ujQCI gdBMxyz5U2/DOjTrrma6dfWFDXJjlqnfGgTuHiYU4MgQK5RzPsEJcT2cz9FDZS/l4pPyR TLQGpi/SyKyTAzPQCck5VsGVspiw182RiTQVze7urnGx9g6fBb9w36du4eEWP8BT2cKCv GDO1HA4oyJPa780fNi9f9FeV5z22jzjCtYvWjYO0dOSX99hqFKW03dpWp7Udz2vncyyrj kKR7eIhrj+Cl12dGikpan7O9718y9lX0lL/UCe8vo3LERYk5HEjr0NH21tM8Gzko0VA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=PKK8vT94; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.198.35 Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010035.outbound.protection.outlook.com [40.93.198.35]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28CD8606A31C; Mon, 30 Nov 2026 06:58:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 28CD8606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=PKK8vT94 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WFHE5JmT/f9n4SJbEVkeJU2qf45I5ua7UWmxbpmzZqSpaACX9q8f9FUisPSmg1bSmC6JPCMQSYonYc9YOzUWUzUx+eCfbC19ighDOd6zytDY2wfK/NpURuJujjn1xZWjmXRKInLod+uT7djU68hs5Flsl7UEb2aNNbtgwrBNbiBlmmfscBQou4T9ZIwdckLRzTHROcbTrEg2YHGlBacKPNPG6txAG+DDOx2hfii0n5YATHVX2ZchDQHJfggNzdESXy1nUCuVsAewOdBHB4S4ZX4WwAADjQ4Uef0Av7kznQwEgp2N6DXcODOcov9c64/CozvIrHegF861L+lA0+523g== 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=XVobz7EcWb9FxelYHczvSdTivF9tQCQkZJh6A1YwK4Q=; b=bw44yqS6cWKiUUfDX1S49YkENwjkAT0oqIgJtFEdWJjoTyZ9yQBdOJfu+hKrVja4DWahg6OwVRcxDIYAjaM1be0Tvrgr482PiDF02RlJzcMfUbfAcg/15z1g4j2XbI4vxPnBnzMNFRefULWHIP0vaUn7D66U83XJnEwwMdVQfWAcjjGbdc9jwIlpf/mAOsoC0ZmuSpnbrvEvYPOlPJJuxuSKLmRqKQ50ScZHstX1bDZ3O/14rYGmel8xoynQG6Jf9Bl8knzdohHr5HUqmdhebfcqL3gBLANKAup5WNWUVWKpwK85MTGI5yYep9yZ0UYVJbfBI23XevV8hrpOQtA/jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XVobz7EcWb9FxelYHczvSdTivF9tQCQkZJh6A1YwK4Q=; b=PKK8vT94nhtwbHg+aUWkYlJ19Ds4lY8vNvOeIWcyV6V+1laLYpaIwXzyeI7oEq9N8Uw3IUa2/CgOpINkX821vmS2WVhTosrwq7YfEKi0vZJInpc8FE2AwLihz+Xa1HFu6bhWoPBEx/xKTVzDEKoW+tK/ojGa29LTkD5gkA2NFXZliD/zxWozfmBTox3+inBZMspK+Gk6BylLUcPgBWKQxQuYACkvyPgOOumzLE61unIr0qqu3amcfTqIPtknKYzPUZSUdY3weAliH6/rPWEBIKl79W7KXUJoS8r3ble/XZ3kYoLT11PNJwcedd2sIyi4KgqmiOx1B06aR8wO0yk3DA== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from SAVPR12MB999143.namprd12.prod.outlook.com (2603:10b6:806:4e5::21) by PH8PR12MB6938.namprd12.prod.outlook.com (2603:10b6:510:1bd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Mon, 30 Nov 2026 06:57:57 +0000 Received: from SAVPR12MB999143.namprd12.prod.outlook.com ([fe80::219e:6553:2ec0:3761]) by SAVPR12MB999143.namprd12.prod.outlook.com ([fe80::219e:6553:2ec0:3761%4]) with mapi id 15.21.0662.007; Mon, 30 Nov 2026 06:57:57 +0000 Message-ID: <494cee79-f1a2-4e3a-809e-8375f1cdd9da@nvidia.com> Date: Mon, 30 Nov 2026 14:57:44 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net 02/10] net/mlx5e: Stop counting packets dropped by IPsec RX SA rules To: netdev-bot+sashiko@kernel.org, tariqt@nvidia.com Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, willemb@google.com, parri.andrea@gmail.com, borisp@nvidia.com, cratiu@nvidia.com, eedmunds@nvidia.com, gal@nvidia.com, jmassar@nvidia.com, kuniyu@google.com, leon@kernel.org, linux-rdma@vger.kernel.org, mbloch@nvidia.com, phaddad@nvidia.com, raeds@nvidia.com, saeedm@nvidia.com, horms@kernel.org, sridhar.samudrala@intel.com, steffen.klassert@secunet.com References: <20261126215614.792598-3-tariqt@nvidia.com> <179581872594.3135.1501113897778355076@kernel.org> Content-Language: en-US From: Jianbo Liu In-Reply-To: <179581872594.3135.1501113897778355076@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::14) To SAVPR12MB999143.namprd12.prod.outlook.com (2603:10b6:806:4e5::21) X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SAVPR12MB999143:EE_|PH8PR12MB6938:EE_ X-MS-Office365-Filtering-Correlation-Id: ae5c8a60-9ea6-4f5e-7c55-08df4eaf438d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016|23010399003|4143699003|11063799006|261009223027099003|18002099003|22082099003|10067099003|56012099006|261028144727099003|261026135527099003|261026121527099003|261026130827099003|261026140227099003|261022113327099003|261022075727099003|261102123227099003|261022105027099003|261021121427099003|261022115727099003|261021135927099003|261021133027099003|261021130227099003|261021123027099003; X-Microsoft-Antispam-Message-Info: NOoCRwnaoWDaaYF8YTFkoP4q7oMWlOsnlQ5KyI3Pg1GJflxWRGG2naS5BQJ3KGa4yodIaQ4KbCs6NJCYxV8RF145jaTt00t0q+Q8MivOF65Di6g38pSQcn97Jym6vZrFwe7PiKPgwvSP6IzC+RB6NStp5e24qnmXeqKrF8PlrGz/3DUOlzFzLSg1c4/qSEjBO00m+OkBeRG+Pywgmy1zu4zawOxmg3FbjWUqbO68eHKSm+bUO7Rm0GM2e2rah++mtSEWv3T2Py4Sl5krtgMq5Hs/O41SR/7aEsLGoZ6yZZqEmFaj4B8o5ClPHpRK8oK4jPaoGmNBODpYgLOvTEu5a3GjcZcuiijwLCEs+GMnOS7uIpgJxMrPMpv+ICMiKCkQ7aAFUkpM8a6mqBKzcsyGzHZpbjCF/5fJbm6SvxDWPCUEv/NmU2jtFVD1kX6aGcZFE5lPvKlJ51iMJHlULkF5WeshN9YHogGjx47NoU1KETUWWbD8OAb5b87rzQuE4ZEI9U5tjtmW1llpjXZG2WnxDTSzjbQby9gfxaHetLQBmsghROkkqRqGgKwwrQ5PLjQ+4q5z1um255qjjZ8Wg1NuHUWTnGzDnQQeRv1W51ssQnn7KJN5V78Aiwk5yXSOqz0o4p4yWa8+g+LfyjRYmvfP40MVAu1kKbU8LM2ieJXud00= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SAVPR12MB999143.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016)(23010399003)(4143699003)(11063799006)(261009223027099003)(18002099003)(22082099003)(10067099003)(56012099006)(261028144727099003)(261026135527099003)(261026121527099003)(261026130827099003)(261026140227099003)(261022113327099003)(261022075727099003)(261102123227099003)(261022105027099003)(261021121427099003)(261022115727099003)(261021135927099003)(261021133027099003)(261021130227099003)(261021123027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dTFNbWs1RnNPaTVRd2NMNjdNMU04YlNYeVVGTTBVUjlHVzBNNFIvbWFoaUdT?= =?utf-8?B?RmFNOHJ5aCtMQkhQTGQzRXVTQnQzVHEycFB1UmNzcE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J1RlBON2swWmxDZE1FYUo3Sm9pRVlKMWp2STNqZS8wUGZpUGxlUXgwTzhw?= =?utf-8?B?cGs2VUlyRWNXcjhmWlZqcFgzbDBNU25SVThCVks4Ny9HUnlCNjVaTXR4ZUg1?= =?utf-8?B?TlFBZW5EL2xpMzZpS2ZlTm1oMzRYMUFIL3ZpeEtIOVhKRkRqbTJMMEhPVTZX?= =?utf-8?B?cE1UNWFiZXVGNnJQdmNFY2lTbWNzNTlRNnY5T3JwT3NwV0JsV3htdVBUd3VU?= =?utf-8?B?ZXRxMWFKWksxSy9INUtRK3c0OGhyZUlBTE5UeElYeklDUE5oa1JHRWVmNThw?= =?utf-8?B?emg3eUZUcHp5cnozek56Tmt6K1hTMVdINnFRT2c5RWVDYU1WVFFwUStHUStF?= =?utf-8?B?UFdUVG03anF2N0hQZmNpblowK0dvT0drSjlUU2lUWGpoZXFoK3FqeVA3MlM2?= =?utf-8?B?Y0xIemtnVWpnaUxUZkxtdXZJdHJFYW1IZnhrakZoM05rdmJTRTQ4dz09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae5c8a60-9ea6-4f5e-7c55-08df4eaf438d X-MS-Exchange-CrossTenant-AuthSource: SAVPR12MB999143.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 06:57:57.0786 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: E2kQXJ9pV5N4lwStYsOTwP2e7RVBeD84nmvZ/vRMLI8UTYSY2DW9QRZKe5KqCfAbqTT38PPYQuAbCWCyMZHaZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6938 On 11/28/2026 6:32 AM, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 1 potential > issue(s) to consider. > > Critical: 0 · High: 0 · Medium: 1 · Low: 0 > > If you believe none of the issues are legitimate, please reply to each > issue of Medium severity or higher and explain why the AI is wrong. > If any of them are legitimate and you plan to respin, please let patchwork > know by including "pw-bot: cr" as a separate line at the end of your reply > (one such reply per series is enough). > > - [Medium] In rx_add_rule() > (drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c), the… > > -- > > net/mlx5e: Stop counting packets dropped by IPsec RX SA rules > > This patch removes the COUNT action and the counter destination from the > RX SA rule used when attrs->drop is set. Packets dropped in hardware are > then no longer added to x->curlft.packets for packet offload. The goal is > to match crypto offload accounting, and the rule keeps CRYPTO_DECRYPT so > ESN state keeps updating. > >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c >> index 502d89a18f9ec..0facc54771558 100644 >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c > > [ ... ] > >> @@ -2103,17 +2102,24 @@ static int rx_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry) >> flow_act.crypto.type = MLX5_FLOW_CONTEXT_ENCRYPT_DECRYPT_TYPE_IPSEC; >> flow_act.crypto.obj_id = sa_entry->ipsec_obj_id; >> flow_act.flags |= FLOW_ACT_NO_APPEND; >> - flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_CRYPTO_DECRYPT | >> - MLX5_FLOW_CONTEXT_ACTION_COUNT; >> - if (attrs->drop) >> + /* Keep decrypting packets even when dropped, to allow ESN state >> + * updates. >> + */ >> + flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_CRYPTO_DECRYPT; >> + if (attrs->drop) { >> flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_DROP; >> - else >> - flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; >> - dest[0].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; >> - dest[0].ft = rx->ft.status; >> - dest[1].type = MLX5_FLOW_DESTINATION_TYPE_COUNTER; >> - dest[1].counter = counter; >> - rule = mlx5_add_flow_rules(rx->ft.sa, spec, &flow_act, dest, 2); >> + rule = mlx5_add_flow_rules(rx->ft.sa, spec, &flow_act, NULL, 0); > > [Severity: Medium] > Could this cause x->curlft.packets to drift away from the hardware ASO > packet-lifetime counter for packet offload RX SAs? > > The drop rule still decrypts against sa_entry->ipsec_obj_id, so the ASO > context for that object keeps being processed. For any finite packet limit, > mlx5e_ipsec_packet_setup() in ipsec_offload.c arms the lifetime counter in > the same ASO context without checking the direction: > > if (attrs->lft.hard_packet_limit != XFRM_INF) { > MLX5_SET(ipsec_aso, aso_ctx, remove_flow_pkt_cnt, > attrs->lft.hard_packet_limit); > MLX5_SET(ipsec_aso, aso_ctx, hard_lft_arm, 1); > MLX5_SET(ipsec_aso, aso_ctx, remove_flow_enable, 1); > } > > x->curlft.packets, however, is derived only from the SA rule flow counter > in mlx5e_xfrm_update_stats(): > > mlx5_fc_query_cached(ipsec_rule->fc, &bytes, &packets, &lastuse); > success_packets = packets - auth_packets - trailer_packets - replay_packets; > x->curlft.packets += success_packets; > > Before this patch, both counts included packets received in the drop > state. After it, only the hardware counter would, assuming the device > decrements remove_flow_pkt_cnt for packets that are decrypted and then > dropped by the same FTE. The code does not show whether the device does > this. Keeping DECRYPT so the ASO state keeps updating suggests that it > might. > > If so, when the hardware soft lifetime event fires, > mlx5e_ipsec_handle_limits() checks curlft once and marks the soft limit > as handled: > > sa_entry->limits.soft_limit_hit = true; > /* Notify about soft limit */ > xfrm_state_check_expire(sa_entry->x); > > At that point curlft can be short by the number of packets received while > attrs->drop was set. The soft expiry (rekey) would then be missed on this > path. > > In the final round, attrs->lft.soft_packet_limit is set to XFRM_INF, so > mlx5e_ipsec_handle_event() no longer calls mlx5e_ipsec_handle_limits(). Since > remove_flow_enable is set, can the hardware retire the SA while the xfrm > state is still valid, and drop traffic until curlft catches up? > The hardware can get to its hard limit that many packets early. On ConnectX-7, the SA rule counter still counts the packets that the hardware drops after that, so curlft gets to the soft and the hard limit as well, that many packets later. mlx5e_ipsec_handle_sw_limits() checks both against curlft every second, as long as it is still running. > The software poller mlx5e_ipsec_handle_sw_limits() returns early without > requeueing whenever attrs.drop is set. So the catch-up might also not happen. It seems an existing problem, which needs a fix of its own. > > The commit message says: > > Remove the count action and counter destination from the drop rule > so these dropped packets stay out of the lifetime, matching crypto > offload accounting. > > Crypto offload does not arm the ASO lifetime counter. Is it intended that > the hardware lifetime for packet offload RX SAs still counts these drops > while curlft no longer does? > Yes. A drop without decrypt would stop the ESN updates of the SA while it is in the drop state. >> + } else { >> + struct mlx5_flow_destination dest[2]; >> + >> + flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | >> + MLX5_FLOW_CONTEXT_ACTION_COUNT; >> + dest[0].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; >> + dest[0].ft = rx->ft.status; >> + dest[1].type = MLX5_FLOW_DESTINATION_TYPE_COUNTER; >> + dest[1].counter = counter; >> + rule = mlx5_add_flow_rules(rx->ft.sa, spec, &flow_act, dest, 2); >> + } > > [ ... ] >