On Fri, Nov 20, 2026 at 09:59:58AM +0200, Tariq Toukan wrote:
> From: Shay Drory <sha…@nvidia.com>
>
> LAG membership assumes every member represents a physical port.
> A nested LAG of VFs/SFs does not fit that assumption; its member
> functions sit behind a multi_uplink_eswitch and each reports
> num_lag_ports < 2, so they do not represent a physical port.
>
> Detect this with mlx5_virt_lag_is_supported(): let such a function join
> the LAG in mlx5_lag_add_mdev(), and skip the MLX5_LAG_XA_MARK_PORT mark
> and the PORT_CHANGE event notifier in mlx5_ldev_add_mdev(), since it is
> not a physical port.
>
> These function only support MPESW, and netdevs addition to LAG is only
> needed for linux bond. Hence, don't allow such a lag to add netdevs to
> itself. For the same reason, don't register the LAG netdev notifier for
> it. Multipath LAG is not supported either, so skip mlx5_lag_mp_init()
> and do not register the FIB notifier for it.
>
> Such a function may report num_lag_ports == 0, which ldev->ports keeps
> as is. Report at least one port from mlx5_lag_get_num_ports(), so user
> would avoid divide by 0.
>
> Such a function selects the uplink through port_select_eswitch, not
> through a TX port affinity. Yet once its LAG is active, RDMA sets
> lag_active, and mlx5_ib_lag_should_assign_affinity() then assigns a TX
> port affinity to every QP, bypassing the num_lag_ports > 1 and
> lag_tx_port_affinity capability checks. Make
> mlx5_ib_lag_should_assign_affinity() return false for such a function.
>
> Signed-off-by: Shay Drory <sha…@nvidia.com>
> Reviewed-by: Moshe Shemesh <mos…@nvidia.com>
> Reviewed-by: Mark Bloch <mblo…@nvidia.com>
> Signed-off-by: Tariq Toukan <tari…@nvidia.com>
Reviewed-by: Simon Horman <hor…@kernel.org>