From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796040457; b=eGWA0GdMbtwLg2W+EU0ouZF02bBJIZnhQNbbI6Co+/E/OSzf+qSHbmosR/AMc8YBzXUN 4g19YLooetGL7aLLVwJqBEeOeqWBO6vDBUMOSpVIEIMGiswnLry/FKT+h2E+8i2hjdE49 YBMlOCXWHyi5SWuao7oFQes3RjXgj2HHxFIwJ3TR50VZoiG/f1J/nGQsW+5f7VBXjOgwL JY31pTQem6xeAeg7Q6qdpdtSOyspKoKyMdZORYNqKQAP2xZow2paxgwNnEHgd5Arpf+wy qQ2TzS4ozrcZsufciwX6saqxlKeYRnCxczll29a578MqoQKC/O3xpM366xUHp/cZwfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040457; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=DHNlKNBgdQdF3ez3r8dN/5VS9r3LzuEzh5TuAGagUu0=; b=Q290mXw2P2XnahX7Tm2/R1ToHnMor4KWd2ua5UCkKyu/dhOVNdiZjXxz/5gvsJEaobEX Mxlcm9XXUiK2pCgoYFtW+spBi0gzXETfGNszIH+/aRDDNWlPRW0JOhQwM4zWqHDANqpky aAZzpyVEh1hPV2J/5j7wukdhE4LL+H9Njm4xWoJPQJS/EejnSLn9ZaHOghmsfjgL7bjG3 TJBuXeLmOAs7Twc+vxKt6zxVUVBVT43J6foI7SA3CUEeAquz5VnHoIS+Mmzu7+6UR8BbE 16yyWYDduX2gnvoe57i+30baaok1m3tXJKrnvGAcIJMOEu2dqgQG1BtScj6GV7uNXlg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Tge+MOAC; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D359606A325; Mon, 30 Nov 2026 12:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Tge+MOAC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F5E51F000C1; Mon, 30 Nov 2026 12:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796040456; bh=DHNlKNBgdQdF3ez3r8dN/5VS9r3LzuEzh5TuAGagUu0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Tge+MOACptBT3WAOP+YZhXpIZpMQUxy4kXjTmS3XoEnSPNC4SfDl0ogwPMs0E0yKy 9cG6faGeaXB/IoOpxcOSu+YxGXPCtW5EmranWDOy4FonR6XObblIiEoc22PzqD8xMZ pt9J7MAhFzmg8eVhUsWmXZurkawzFReeB6KrtnXzwD8wX7KJ7gzBhCV39GYnbhcWcc +rroyCAollJGZirH9ATcRGdBCtoVOLm8LlJxqgQfk81L/URwY+TOCtzQ8/5Jkwj+we LhY6C9WFpmkGHh/0feVz9FQgECBAh5Bm+eLa0Min+sjh5cfo0IXNWcN2A/O22iJ0oa EzKuTgIdldgUw== Subject: Re: [PATCH net-next V5 4/7] net/mlx5e: macsec: Block TC offload when MACsec is enabled From: netdev-bot+sashiko@kernel.org To: tariqt@nvidia.com Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, sd@queasysnail.net, willemb@google.com, aleksandr.loktionov@intel.com, parri.andrea@gmail.com, borisp@nvidia.com, cjubran@nvidia.com, lcy8047@gmail.com, cratiu@nvidia.com, daniel.zahka@gmail.com, davem@davem-thinkpadp1gen8.ibmlond.csb, doruk@0sec.ai, dtatulea@nvidia.com, gal@nvidia.com, jianbol@nvidia.com, joasantonio108@gmail.com, leon@kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, mbloch@nvidia.com, phaddad@nvidia.com, ralf@mandelbit.com, saeedm@nvidia.com, horms@kernel.org Date: Mon, 30 Nov 2026 12:07:34 +0000 Message-ID: <179604045496.3146.10459707437454849888@kernel.org> In-Reply-To: <20261129120331.1910180-5-tariqt@nvidia.com> References: <20261129120331.1910180-5-tariqt@nvidia.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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] This patch makes every installed MACsec RX decrypt rule take a device-wide TC block. -- net/mlx5e: macsec: Block TC offload when MACsec is enabled This patch makes each installed MACsec RX decrypt rule hold a device-wide TC offload block. The block is taken in mlx5e_macsec_init_sa_fs() and released in mlx5e_macsec_cleanup_sa_fs(). macsec_upd_secy_hw_address() also keeps TC blocked while it rebuilds the RX rules. > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c > index 13896e9c1d331..146f1036dba42 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c [ ... ] > @@ -325,6 +326,8 @@ static void mlx5e_macsec_cleanup_sa_fs(struct mlx5e_macsec *macsec, > mlx5_macsec_fs_del_rule(macsec->mdev->macsec_fs, sa->macsec_rule, action, netdev, > fs_id); > sa->macsec_rule = NULL; > + if (!is_tx) > + mlx5e_accel_unblock_tc_offload(macsec->mdev); > } [ ... ] > @@ -354,13 +358,26 @@ static int mlx5e_macsec_init_sa_fs(struct macsec_context *ctx, > rule_attrs.action = (is_tx) ? MLX5_ACCEL_MACSEC_ACTION_ENCRYPT : > MLX5_ACCEL_MACSEC_ACTION_DECRYPT; > > + if (!is_tx) { > + err = mlx5e_accel_block_tc_offload(priv->mdev); > + if (err) > + return err; > + } > + [Severity: Medium] Can mdev->offload_block.num_block_tc leak here when the NIC profile is torn down while RX SAs are still installed? The only place this block is released is mlx5e_macsec_cleanup_sa_fs(). When the eswitch moves from legacy to switchdev, the path is: mlx5e_vport_uplink_rep_load() mlx5e_netdev_change_profile() priv->profile->cleanup(priv) == mlx5e_nic_cleanup() mlx5e_macsec_cleanup() mlx5e_macsec_cleanup() tears everything down without walking the RX SAs: mlx5_notifier_unregister(mdev, &macsec->nb); mlx5_macsec_fs_cleanup(mdev->macsec_fs); destroy_workqueue(macsec->wq); mlx5e_macsec_aso_cleanup(&macsec->aso, mdev); mutex_destroy(&macsec->lock); kfree(macsec); The netdev stays registered during a profile change. The MACsec core (macsec_notify() in drivers/net/macsec.c) only deletes secys on NETDEV_UNREGISTER, so mdo_del_secy is never called either. Unlike IPsec, MACsec does not call mlx5_eswitch_block_mode(), so nothing prevents this mode change. After the switch, num_block_tc stays above zero in struct mlx5_core_dev. It is only initialized at mdev init and is never reset. The uplink representor reuses the same netdev, and is_tc_accel_check_needed() returns true for it. Every mlx5e_configure_flower() on the uplink would then fail in mlx5e_tc_block_accel_offload(): if (mdev->offload_block.num_block_tc) ret = -EBUSY; Going back to legacy mode doesn't seem to recover either. mlx5e_macsec_init() allocates a fresh, empty context, so a later mdo_del_secy can't find the device and never unblocks. TC offload on the uplink/NIC netdev would stay disabled until the mlx5_core_dev is re-probed. Dropping SA rules during profile teardown is an older problem. The persistent device-level TC block is what turns it into a lasting TC offload outage. Later patches in the series don't seem to touch mlx5e_macsec_cleanup() or the profile-change path. Should mlx5e_macsec_cleanup() release the TC blocks held by installed RX rules? Alternatively, should MACsec RX offload block the eswitch mode change? > macsec_rule = mlx5_macsec_fs_add_rule(macsec_fs, ctx, &rule_attrs, fs_id); > - if (!macsec_rule) > - return -ENOMEM; > + if (!macsec_rule) { > + err = -ENOMEM; > + goto out_unblock_tc; > + } [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129120331.1910180-1-tariqt%40nvidia.com