]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/mlx5: Add balance ID support for LAG multiplane groups
authorMark Bloch <mbloch@nvidia.com>
Thu, 23 Oct 2025 09:17:00 +0000 (12:17 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 28 Oct 2025 10:11:27 +0000 (11:11 +0100)
Implement balance ID support for multiplane LAG configurations. This
feature enables per-multiplane group load balancing by extending the
software system image GUID with a balance ID component.

Key implementations:
- Enable lag_per_mp_group capability when supported by hardware.
- Append load_balance_id to software system image GUID when conditions
  are met.
- Increase MLX5_SW_IMAGE_GUID_MAX_BYTES from 8 to 9 to accommodate the
  extra byte.

The balance ID is appended to the system image GUID only when both
load_balance_id and lag_per_mp_group capabilities are available, ensuring
backward compatibility while enabling enhanced LAG functionality.

This enhancement allows for more granular load balancing control in complex
multi-plane LAG deployments, improving network performance and flexibility.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1761211020-925651-6-git-send-email-tariqt@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/net/ethernet/mellanox/mlx5/core/vport.c
include/linux/mlx5/driver.h

index 563267acf386fcb4982fb9768eaabbb3d0726ef0..c904696cbc3a157651a6e1c6dc579b0c08b03661 100644 (file)
@@ -575,6 +575,11 @@ static int handle_hca_cap_2(struct mlx5_core_dev *dev, void *set_ctx)
                do_set = true;
        }
 
+       if (MLX5_CAP_GEN_2_MAX(dev, lag_per_mp_group)) {
+               MLX5_SET(cmd_hca_cap_2, set_hca_cap, lag_per_mp_group, 1);
+               do_set = true;
+       }
+
        /* some FW versions that support querying MLX5_CAP_GENERAL_2
         * capabilities but don't support setting them.
         * Skip unnecessary update to hca_cap_2 when no changes were introduced
index 4224e275086549de9f8a867dd20dce4876b66ffe..992873536c1b136d3612275fa0c69b21db3fbd21 100644 (file)
@@ -1203,6 +1203,10 @@ void mlx5_query_nic_sw_system_image_guid(struct mlx5_core_dev *mdev, u8 *buf,
 
        memcpy(buf, &fw_system_image_guid, sizeof(fw_system_image_guid));
        *len += sizeof(fw_system_image_guid);
+
+       if (MLX5_CAP_GEN_2(mdev, load_balance_id) &&
+           MLX5_CAP_GEN_2(mdev, lag_per_mp_group))
+               buf[(*len)++] = MLX5_CAP_GEN_2(mdev, load_balance_id);
 }
 
 static bool mlx5_vport_use_vhca_id_as_func_id(struct mlx5_core_dev *dev,
index dcf262aa9ea6b6ee4e40eb1c41421b8c3ca788c2..046396269ccf6993c3eef044947517beea28ccbf 100644 (file)
@@ -1380,6 +1380,6 @@ static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
        return devlink_net(priv_to_devlink(dev));
 }
 
-#define MLX5_SW_IMAGE_GUID_MAX_BYTES 8
+#define MLX5_SW_IMAGE_GUID_MAX_BYTES 9
 
 #endif /* MLX5_DRIVER_H */