From: Mark Bloch <mbloch@nvidia.com>
To: Bernardo Soares <bsoares.it@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
netdev@vger.kernel.org, saeedm@nvidia.com,
Vlad Buslov <vladbu@nvidia.com>,
Bernardo Soares <bersoare@isovalent.com>
Subject: Re: [PATCH net v2 3/3] net/mlx5: Bridge, don't fail unlink of untracked/unsupported peer ports
Date: Tue, 15 Sep 2026 22:51:34 +0300 [thread overview]
Message-ID: <d611e425-70c7-4006-a72e-101834b955cc@nvidia.com> (raw)
In-Reply-To: <20260914085430.18694-4-bersoare@isovalent.com>
On 14/09/2026 11:54, Bernardo Soares wrote:
> mlx5_esw_bridge_vport_unlink() returns -EINVAL when the port isn't
> tracked by this instance's br_offloads, which is reachable in two
> legitimate cases: a replayed/duplicate NETDEV_CHANGEUPPER unlink for a
> port already cleaned up, or a peer-port unlink for a vport whose link
> was never created because peer_link() skipped it. Return 0 instead in
> both cases, and give mlx5_esw_bridge_vport_peer_unlink() the same
> merged_eswitch capability guard peer_link() already has.
>
> This also matters beyond the -EINVAL itself:
> mlx5_esw_bridge_switchdev_port_event() runs on the per-netns
> netdev_chain, and notifier_from_errno(-EINVAL) sets NOTIFY_STOP_MASK,
> which call_netdevice_notifiers_info() checks to skip the global chain
> entirely - so the old -EINVAL silently dropped the event for every
> other listener on the system, including a sibling PF's own
> bridge-offload instance, even though none of it was visible to user
> space since __netdev_upper_dev_unlink() discards the return value.
>
> Fixes: c358ea1741bc ("net/mlx5: Bridge, allow merged eswitch connectivity")
> Signed-off-by: Bernardo Soares <bersoare@isovalent.com>
Commit message nit: NETDEV_CHANGEUPPER is not replayed, and
only listeners later in the chain are skipped. The code looks
good.
checkpatch warns the From address is gmail while the signed-off-by
uses the Isovalent address. Please make them match.
v2 was sent as a reply to v1. Please send v3 as a new thread.
Mark
> ---
> v2: new patch, addresses review comment on v1 asking whether the peer
> unlink path also needed changes. mlx5_esw_bridge_vport_peer_unlink()
> now mirrors mlx5_esw_bridge_vport_peer_link()'s merged_eswitch
> capability guard, and mlx5_esw_bridge_vport_unlink() treats an
> already-absent/untracked port as a no-op (return 0) instead of
> -EINVAL, which is reachable on a replayed or duplicate
> NETDEV_CHANGEUPPER unlink and was found while auditing the same
> code for the ownership-check gap raised on v1.
> ---
>
> drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
> index ac90ccda1272..b4cf3c5ac0dd 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
> @@ -1649,10 +1649,8 @@ int mlx5_esw_bridge_vport_unlink(struct net_device *br_netdev, u16 vport_num,
> int err;
>
> port = mlx5_esw_bridge_port_lookup(vport_num, esw_owner_vhca_id, br_offloads);
> - if (!port) {
> - NL_SET_ERR_MSG_MOD(extack, "Port is not attached to any bridge");
> - return -EINVAL;
> - }
> + if (!port)
> + return 0;
> if (port->bridge->ifindex != br_netdev->ifindex) {
> NL_SET_ERR_MSG_MOD(extack, "Port is attached to another bridge");
> return -EINVAL;
> @@ -1682,6 +1680,9 @@ int mlx5_esw_bridge_vport_peer_unlink(struct net_device *br_netdev, u16 vport_nu
> struct mlx5_esw_bridge_offloads *br_offloads,
> struct netlink_ext_ack *extack)
> {
> + if (!MLX5_CAP_ESW(br_offloads->esw->dev, merged_eswitch))
> + return 0;
> +
> return mlx5_esw_bridge_vport_unlink(br_netdev, vport_num, esw_owner_vhca_id, br_offloads,
> extack);
> }
next prev parent reply other threads:[~2026-09-15 19:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 16:19 [PATCH net] net/mlx5: Bridge, don't fail switchdev events of sibling eswitch ports Daniel Borkmann
2026-09-10 12:47 ` Mark Bloch
2026-09-14 8:54 ` [PATCH net v2 0/3] net/mlx5: Bridge, fix remaining switchdev ownership gaps on merged eswitch Bernardo Soares
2026-09-14 8:54 ` [PATCH net v2 1/3] net/mlx5: Bridge, don't fail switchdev events of sibling eswitch ports Bernardo Soares
2026-09-17 2:56 ` netdev-bot+sashiko
2026-09-14 8:54 ` [PATCH net v2 2/3] net/mlx5: LAG, check if vport exists on br_offloads Bernardo Soares
2026-09-15 19:52 ` Mark Bloch
2026-09-17 2:56 ` netdev-bot+sashiko
2026-09-14 8:54 ` [PATCH net v2 3/3] net/mlx5: Bridge, don't fail unlink of untracked/unsupported peer ports Bernardo Soares
2026-09-15 19:51 ` Mark Bloch [this message]
2026-09-17 2:56 ` netdev-bot+sashiko
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=d611e425-70c7-4006-a72e-101834b955cc@nvidia.com \
--to=mbloch@nvidia.com \
--cc=bersoare@isovalent.com \
--cc=bsoares.it@gmail.com \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=vladbu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox