Re: [PATCH net-next V2 01/10] net/mlx5: Distinguish VFs/SFs in the SW system image GUID for LAG grouping
From: netdev-bot+sashiko
Date: Wed Nov 18 2026 - 05:32:22 EST
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 patch changes the SW system image GUID of a VF/SF that
passes mlx5_virt_lag_is_supported(): mlx5_sw_guid_vf() or…
--
net/mlx5: Distinguish VFs/SFs in the SW system image GUID for LAG grouping
This patch changes mlx5_query_nic_sw_system_image_guid() so that each
discriminator byte after the FW system image GUID has a fixed position,
and trailing zero fields are trimmed. It adds VF and SF marker bytes that
are only set when mlx5_virt_lag_is_supported() is true, and it raises
MLX5_SW_IMAGE_GUID_MAX_BYTES from 9 to 11.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> index 78f3d15b599d0..bab43df6a7d72 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> @@ -1308,10 +1308,37 @@ u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev)
> }
> EXPORT_SYMBOL_GPL(mlx5_query_nic_system_image_guid);
>
> +static u8 mlx5_sw_guid_load_balance(const struct mlx5_core_dev *mdev)
> +{
> + if (MLX5_CAP_GEN_2(mdev, load_balance_id) &&
> + MLX5_CAP_GEN_2(mdev, lag_per_mp_group))
> + return MLX5_CAP_GEN_2(mdev, load_balance_id);
> + return 0;
> +}
> +
> +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);
> +}
[Severity: Medium]
Does this break the same-HW check between a PF and a VF/SF that passes
mlx5_virt_lag_is_supported()?
Suppose the VF/SF's own caps report multi_uplink_eswitch=1, lag_master=1
and num_lag_ports < 2. The VF key then becomes guid + [lb|0] + 0x01, which
is 10 bytes. The SF key becomes guid + [lb|0] + 0x00 + 0x01, which is 11
bytes. A PF never sets either marker, so its key is still 8 or 9 bytes.
mlx5_same_hw_devs() requires the lengths to match:
drivers/net/ethernet/mellanox/mlx5/core/dev.c:mlx5_same_hw_devs() {
...
return plen && flen && flen == plen &&
!memcmp(fsystem_guid, psystem_guid, flen);
}
That means it now returns false for any PF paired with such a VF/SF.
mlx5e_tc_is_vf_tunnel() only reaches that comparison when out_mdev is a
PF and route_mdev is a VF/SF:
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:mlx5e_tc_is_vf_tunnel() {
...
if (route_mdev->coredev_type != MLX5_COREDEV_VF &&
route_mdev->coredev_type != MLX5_COREDEV_SF)
return false;
return mlx5e_same_hw_devs(out_priv, route_priv);
}
For a virt-LAG-capable VF/SF route device, will it now always return
false? These are the paths that would be affected:
mlx5e_set_vf_tunnel()
mlx5e_tc_is_vf_tunnel()
mlx5e_same_hw_devs()
mlx5_same_hw_devs()
- In mlx5e_set_vf_tunnel() the check fails and the code jumps to out with
err = 0. The encap flow is still offloaded, but without the VF vport
source port rewrite (MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE plus the
VPORT_TO_REG metadata). The encapsulated packet then goes straight to
the uplink and skips FDB processing of the VF vport.
- mlx5e_update_vf_tunnel() returns -ENODEV on route updates.
- On decap, mlx5e_tc_tun_route_lookup() no longer sets
rx_tun_attr->decap_vport to the VF vport.
- In mirred_nic.c, the NIC-mode redirect check
if (priv->netdev->netdev_ops != out_dev->netdev_ops ||
!mlx5e_same_hw_devs(priv, netdev_priv(out_dev))) {
now rejects redirects between a PF netdev and such a VF/SF netdev with
"devices are not on same switch HW".
The commit message says:
"so a VF/SF that cannot join a virt LAG keeps its current key and is
still identified as the same HW as its PF."
That covers VFs/SFs that cannot join a virt LAG. It doesn't cover the
ones that can, and none of the consumers above are updated.
Should mlx5_same_hw_devs() compare without the VF/SF markers? Or should
the LAG grouping key be kept separate from the key used for same-HW
detection?
> +
> +static u8 (* const mlx5_sw_guid_fields[])(const struct mlx5_core_dev *mdev) = {
> + mlx5_sw_guid_load_balance,
> + mlx5_sw_guid_vf,
> + mlx5_sw_guid_sf,
> + /* New fields should be added at the end */
> +};
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116103010.1129666-1-tariqt%40nvidia.com