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=1796040454; b=ap9ARZB97dflAuyuWVuaH1hNGT+Ws7HA+yPxvKnYbUjM5K95H2avfjuxj0lK1WUp0wZE V2Kf4WPJ3PYqSiCnq507v47k3fypJhRRdfBRQ4OLFHvtx/Ntdua8RsuaO4QuRfHstbUOl iYrR84my7H3FKkDEMuoLkyDULm9/cz7dEeyhQ+v+nH8xFbFWvOoYtvLR8gIZK+T2keJlf hYTfL3kjIy0hQHt5lqUviA/YHPWSbA0SKVs5t4dGorqpY4P/qG5B3iiZKTvhSk693F0Ao xfekpyWqCI+feadbiC8GhN4GRnwOZQEALAMhKeuC4Ot8k2uet9lRXYzITTJqhjgvlHw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040454; 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=vIvmBum3nzOJEscENG3kF3HxAfKoZPxPl+lvO1fN9b4=; b=KhMXF9DHIPMKjxg+l/dvAaEhX2DilPmThx+EFwcqt4uN+R0VgTGjClYOqQCKhjWX17yE nLS1cQ4XsB8wfq+KTjgYMPlm3PKKpHZcnwARB3tiX9OlMGRFIftnwDOz+TGeQBS7A0rZW +sA8Kna5F56bmGE9Fvm0ZtIl9bTczt7dVfg0u1QsDvI32ptmCnay07Bs+P+wRM3g+i1kV yS/wkdMjRIdpMRi5lEzb7JKdkGwfZNGqGI9hcHIcNUSrNTHtYXq9ZUgCOt8POysUMquCi H16MGOW7JImspRQMKbtURYK65Oz+Vt4SvtI3XE7qVVHa/8aRRbcU2k/taHF1Q2Q5kww== 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=g2yLQEto; 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 C6DE4606A31C; Mon, 30 Nov 2026 12:07:34 +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=g2yLQEto Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFF371F0089A; Mon, 30 Nov 2026 12:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796040454; bh=vIvmBum3nzOJEscENG3kF3HxAfKoZPxPl+lvO1fN9b4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=g2yLQEtobONA7AGJEuKr+b2xPzvP31TGUdJ9xyecNXkDEJgE1mnrIaCkIlbKBgjv2 4lj5y5GT2cMzE3JnqyGbjsIMllADZMY6/hALNy5f64yJFPM3p5KKmPoah7eVna+514 zJLXrfd1hE4Of2GVWHT1Ycz7XSr/UpR5g4jG+52aMFHUq6ME3MX++C9viLkfVYP2rP kyUlEs4RzVCFr4jh7WX+4hVTNX2Zrl3Ql6mrpeF3MCRuQinp8Cev760mHMScS+TfFa zQYfsQaxlmLIlBhmEOSXo3pEzz0tYXa3XUUkXHJ0TJ9VcTIe2Zq/HCsK+jcMPO+z/U RwKcA31GbwXGQ== Subject: Re: [PATCH net-next V5 1/7] net/mlx5e: Generalize TC <-> IPsec mutual exclusion 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:32 +0000 Message-ID: <179604045242.3146.11465224103483791527@kernel.org> In-Reply-To: <20261129120331.1910180-2-tariqt@nvidia.com> References: <20261129120331.1910180-2-tariqt@nvidia.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 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] The num_block_accel count leaks on PM suspend/resume while TC flower rules are installed on the PF netdev in NIC (legacy) mode. -- net/mlx5e: Generalize TC <-> IPsec mutual exclusion This commit moves the TC/IPsec mutual exclusion helpers to en_accel.h as mlx5e_accel_{,un}block_tc_offload() and renames num_block_ipsec to num_block_accel. It also drops the CONFIG_MLX5_EN_IPSEC check from is_tc_accel_check_needed(), so that follow-up patches can use the same gate for PSP and MACsec. > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > index 615af3acdb9eb..03bade86c38c2 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > @@ -4821,14 +4821,15 @@ static bool is_flow_rule_duplicate_allowed(struct net_device *dev, [ ... ] > -static bool is_tc_ipsec_order_check_needed(struct net_device *filter, struct mlx5e_priv *priv) > +static bool is_tc_accel_check_needed(struct net_device *filter, > + struct mlx5e_priv *priv) > { > - if (!IS_ENABLED(CONFIG_MLX5_EN_IPSEC)) > - return false; > - > if (filter != priv->netdev) > return false; [Severity: Medium] Without the IS_ENABLED(CONFIG_MLX5_EN_IPSEC) check, every successful mlx5e_configure_flower() on the PF netdev now increments num_block_accel in every build. That count is becoming the gate for IPsec, PSP and MACsec. Can it leak across PM suspend/resume in NIC (legacy) mode? The only decrement is in mlx5e_delete_flower(). It only runs when the flow's cookie is still in the driver's tc hashtable. On system suspend the netdev stays registered, so the TC core keeps its filters. The driver still frees its flows, though: mlx5_suspend() mlx5_unload_one(dev, true) mlx5_detach_device(dev, true) mlx5e_suspend() _mlx5e_suspend() mlx5e_detach_netdev() profile->cleanup_rx() == mlx5e_cleanup_nic_rx() mlx5e_tc_nic_cleanup() rhashtable_free_and_destroy(&tc->ht, _mlx5e_tc_del_flow, NULL); The destroy callback does not drop the count: drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:_mlx5e_tc_del_flow() { ... mlx5e_tc_del_flow(priv, flow); kfree(flow); } On resume, mlx5e_attach_netdev() creates a new, empty hashtable. When the user later deletes the filters, mlx5e_delete_flower() misses the lookup. It returns before it reaches mlx5e_tc_unblock_accel_offload(): flow = rhashtable_lookup(tc_ht, &f->cookie, tc_ht_params); if (!flow || !same_flow_direction(flow, flags)) { err = -EINVAL; goto errout; } offload_block is set up only once, in mlx5_mdev_init(), and is never reset. esw->user_count, by contrast, is reset on the legacy and offloads init paths. So num_block_accel would stay non-zero for the life of the mdev. Wouldn't every later mlx5e_accel_block_tc_offload() call on this mdev then return -EBUSY until the driver is reloaded? if (mdev->offload_block.num_block_accel) ret = -EBUSY; The leaking teardown path dates from commit c8e350e62fc5, where it only affected IPsec packet offload in CONFIG_MLX5_EN_IPSEC builds. With this patch and the follow-ups, one leaked TC count would block IPsec SA and policy add, PSP RX enable and MACsec RX SA add. That includes builds without IPsec. At the end of the series, the _mlx5e_tc_del_flow() and mlx5e_tc_nic_cleanup() path still has no unblock. The other teardown paths look fine: - Health recovery, fw reset, devlink reload and driver unload use suspend=false. - _mlx5e_remove() calls unregister_netdev() before _mlx5e_suspend(), so the TC core flushes the filters through mlx5e_delete_flower() first. - In switchdev mode, mlx5e_vport_uplink_rep_unload() unregisters the netdev before the profile change. So this appears specific to PM suspend in NIC mode. Should mlx5e_tc_nic_cleanup() also drop the num_block_accel count for each flow it frees? [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129120331.1910180-1-tariqt%40nvidia.com