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,
agoldberger@nvidia.com, gal@nvidia.com, jgg@ziepe.ca,
leon@kernel.org, linux-rdma@vger.kernel.org, mbloch@nvidia.com,
moshe@nvidia.com, ohartoov@nvidia.com, saeedm@nvidia.com,
shayd@nvidia.com
Subject: Re: [PATCH net-next V2 4/5] net/mlx5e: Register eswitch-manager VF/SF self-port with switch-id
Date: Tue, 24 Nov 2026 08:32:51 +0000 [thread overview]
Message-ID: <179550917191.3135.3268324102399128656@kernel.org> (raw)
In-Reply-To: <20261120075959.2533702-5-tariqt@nvidia.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In mlx5e_devlink_port_register()
(drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c, new lines…
- [Low] The commit message says the self-port 'was always registered with
DEVLINK_PORT_FLAVOUR_VIRTUAL, which doesn't carries switch_id' (also a…
--
net/mlx5e: Register eswitch-manager VF/SF self-port with switch-id
This patch makes a non-PF function (VF or SF) that is an eswitch manager
register its self-port with a switch_id. The switch_id comes from the SW
system image GUID. As a result, the uplink netdev reports a
phys_switch_id and can be grouped with the representors it manages.
> A non-PF function's self-port (its own uplink netdev) was always
> registered with DEVLINK_PORT_FLAVOUR_VIRTUAL, which doesn't carries
> switch_id.
[Severity: Low]
Is this description accurate? In net/devlink/port.c, switch_port depends
only on whether a switch_id was supplied. The port flavour plays no part:
net/devlink/port.c:__devlink_port_attrs_set() {
...
if (attrs->switch_id.id_len) {
devlink_port->switch_port = true;
...
} else {
devlink_port->switch_port = false;
}
}
devlink_compat_switch_id_get() checks only switch_port. A VIRTUAL port
can carry a switch_id, and this patch relies on that: it keeps
DEVLINK_PORT_FLAVOUR_VIRTUAL and only fills attrs.switch_id.
The phys_switch_id was missing because mlx5e_devlink_port_register()
never filled attrs.switch_id for non-PF functions. The flavour was not
the cause.
The message also mentions only grouping with representors. Could it say
that the uplink netdev now passes netdev_port_same_parent_id() checks it
used to fail? Examples are tc_act_can_offload_mirred(),
tc_act_parse_mirred() and the check in en/tc_tun.c.
There is also a grammar slip: "doesn't carries" should be
"doesn't carry".
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c
> index 8818f65d1fbc4..79adb1ecc4506 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c
> @@ -63,6 +63,11 @@ int mlx5e_devlink_port_register(struct mlx5e_dev *mlx5e_dev,
> dl_port_index = mlx5_esw_vport_to_devlink_port_index(mdev,
> MLX5_VPORT_UPLINK);
> } else {
> + if (MLX5_ESWITCH_MANAGER(mdev)) {
> + mlx5e_devlink_get_port_parent_id(mdev, &ppid);
> + memcpy(attrs.switch_id.id, ppid.id, ppid.id_len);
> + attrs.switch_id.id_len = ppid.id_len;
> + }
[Severity: Low]
Is this switch_id unique to the nested eswitch? The value comes from
mlx5_query_nic_sw_system_image_guid(). That is the device-wide FW GUID
followed by capability-only bytes, with trailing zero bytes trimmed:
drivers/net/ethernet/mellanox/mlx5/core/vport.c:
static u8 mlx5_sw_guid_sf(const struct mlx5_core_dev *mdev)
{
return mlx5_core_is_sf(mdev) && mlx5_virt_lag_is_supported(mdev);
}
static u8 mlx5_sw_guid_vf(const struct mlx5_core_dev *mdev)
{
return mlx5_core_is_vf(mdev) && mlx5_virt_lag_is_supported(mdev);
}
mlx5_query_nic_sw_system_image_guid() {
...
for (i = 0; i < ARRAY_SIZE(mlx5_sw_guid_fields); i++) {
u8 val = mlx5_sw_guid_fields[i](mdev);
buf[(*len)++] = val;
if (val)
trim_len = *len;
}
*len = trim_len;
}
Commit c25049685e16 ("Distinguish VFs/SFs in the SW system image
GUID...") says a PF and its VFs/SFs share the same FW system image GUID.
It also says a VF/SF that cannot join a virt LAG "keeps its current key
and is still identified as the same HW as its PF". This leads to two
cases.
In the first case, a VF/SF eswitch manager lacks the virt-LAG caps
(multi_uplink_eswitch, lag_master, num_lag_ports < 2). It then gets
exactly the PF's switch_id. The PF uplink carries that same ID, and so
do the PF-eswitch PCI_VF/PCI_SF representors set up by
mlx5_esw_offloads_pf_vf_devlink_port_attrs_set(), including the
representor of this VF/SF itself.
In the second case, every virt-LAG-capable VF (or SF) eswitch manager on
one HCA gets the same ID, whether or not they share an FDB. That
includes a standalone late joiner that mlx5_esw_offloads_devcom_init()
refuses to pair.
After this patch, devlink_compat_switch_id_get() reports this ID as the
phys_switch_id of the VF/SF uplink netdev.
Documentation/networking/switchdev.rst says the switch ID must be unique
between switches on the same system.
The nested-eswitch representors already used this ID before the patch,
and the PF uplinks of one HCA already share a switch_id. The in-kernel
mlx5 TC forwarding path re-checks the real eswitch/LAG relationship in
mlx5e_is_valid_eswitch_fwd_dev(). What changes is that the uplink netdev
itself now reports the colliding ID.
Should this check also require mlx5_virt_lag_is_supported(), or the
nested-eswitch condition used elsewhere in the series, rather than only
MLX5_ESWITCH_MANAGER(mdev)? If not, should the limitation be documented?
> attrs.flavour = DEVLINK_PORT_FLAVOUR_VIRTUAL;
> dl_port_index = mlx5_esw_vport_to_devlink_port_index(mdev, 0);
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120075959.2533702-1-tariqt%40nvidia.com
next prev parent reply other threads:[~2026-11-24 8:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 7:59 [PATCH net-next V2 0/5] net/mlx5: LAG over VFs/SFs (virtual LAG) Tariq Toukan
2026-11-20 7:59 ` [PATCH net-next V2 1/5] net/mlx5: E-switch, add match-metadata allocator for nested VF/SF eswitches Tariq Toukan
2026-11-24 8:32 ` netdev-bot+sashiko
2026-11-20 7:59 ` [PATCH net-next V2 2/5] net/mlx5: E-switch, match master egress rule by vport metadata Tariq Toukan
2026-11-20 7:59 ` [PATCH net-next V2 3/5] net/mlx5: E-switch, drop master egress rule under a SW vport LAG Tariq Toukan
2026-11-24 8:32 ` netdev-bot+sashiko
2026-11-20 7:59 ` [PATCH net-next V2 4/5] net/mlx5e: Register eswitch-manager VF/SF self-port with switch-id Tariq Toukan
2026-11-24 8:32 ` netdev-bot+sashiko [this message]
2026-11-20 7:59 ` [PATCH net-next V2 5/5] net/mlx5: LAG, enable LAG over functions that do not represent a physical port Tariq Toukan
2026-11-24 8:32 ` 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=179550917191.3135.3268324102399128656@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=agoldberger@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gal@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=ohartoov@nvidia.com \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=shayd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox