From: Simon Horman <horms@kernel.org>
To: Tariq Toukan <tariqt@nvidia.com>
Cc: Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>, Mark Bloch <mbloch@nvidia.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, Gal Pressman <gal@nvidia.com>,
Dragos Tatulea <dtatulea@nvidia.com>,
Cosmin Ratiu <cratiu@nvidia.com>
Subject: Re: [PATCH net] net/mlx5: Don't zero user_count when destroying FDB tables
Date: Tue, 28 Oct 2025 16:57:35 +0000 [thread overview]
Message-ID: <aQD1_13OxXT16XPR@horms.kernel.org> (raw)
In-Reply-To: <1761510019-938772-1-git-send-email-tariqt@nvidia.com>
On Sun, Oct 26, 2025 at 10:20:19PM +0200, Tariq Toukan wrote:
> From: Cosmin Ratiu <cratiu@nvidia.com>
>
> esw->user_count tracks how many TC rules are added on an esw via
> mlx5e_configure_flower -> mlx5_esw_get -> atomic64_inc(&esw->user_count)
>
> esw.user_count was unconditionally set to 0 in
> esw_destroy_legacy_fdb_table and esw_destroy_offloads_fdb_tables.
>
> These two together can lead to the following sequence of events:
> 1. echo 1 > /sys/class/net/eth2/device/sriov_numvfs
> - mlx5_core_sriov_configure -...-> esw_create_legacy_table ->
> atomic64_set(&esw->user_count, 0)
> 2. tc qdisc add dev eth2 ingress && \
> tc filter replace dev eth2 pref 1 protocol ip chain 0 ingress \
> handle 1 flower action ct nat zone 64000 pipe
> - mlx5e_configure_flower -> mlx5_esw_get ->
> atomic64_inc(&esw->user_count)
> 3. echo 0 > /sys/class/net/eth2/device/sriov_numvfs
> - mlx5_core_sriov_configure -..-> esw_destroy_legacy_fdb_table
> -> atomic64_set(&esw->user_count, 0)
> 4. devlink dev eswitch set pci/0000:08:00.0 mode switchdev
> - mlx5_devlink_eswitch_mode_set -> mlx5_esw_try_lock ->
> atomic64_read(&esw->user_count) == 0
> - then proceed to a WARN_ON in:
> esw_offloads_start -> mlx5_eswitch_enable_locke -> esw_offloads_enable
> -> mlx5_esw_offloads_rep_load -> mlx5e_vport_rep_load ->
> mlx5e_netdev_change_profile -> mlx5e_detach_netdev ->
> mlx5e_cleanup_nic_rx -> mlx5e_tc_nic_cleanup ->
> mlx5e_mod_hdr_tbl_destroy
>
> Fix this by not clearing out the user_count when destroying FDB tables,
> so that the check in mlx5_esw_try_lock can prevent the mode change when
> there are TC rules configured, as originally intended.
>
> Fixes: 2318b8bb94a3 ("net/mlx5: E-switch, Destroy legacy fdb table when needed")
> Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2025-10-28 16:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 20:20 [PATCH net] net/mlx5: Don't zero user_count when destroying FDB tables Tariq Toukan
2025-10-28 16:57 ` Simon Horman [this message]
2025-10-30 1:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aQD1_13OxXT16XPR@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.