mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
net/mlx5: LAG, replace peer count check with direct peer lookup
Replace mlx5_eswitch_get_npeers() count-based check with a new mlx5_eswitch_is_peer() function that directly verifies the peer relationship between two eswitches. This change prepares for SD LAG support, which is a virtual LAG that does not have num_lag_ports capability and cannot use the count-based peer validation. Signed-off-by: Shay Drory <shayd@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20260531113954.395443-5-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
2b1ba02c37
commit
2ca494dad9
|
|
@ -955,6 +955,8 @@ int mlx5_eswitch_offloads_single_fdb_add_one(struct mlx5_eswitch *master_esw,
|
|||
void mlx5_eswitch_offloads_single_fdb_del_one(struct mlx5_eswitch *master_esw,
|
||||
struct mlx5_eswitch *slave_esw);
|
||||
int mlx5_eswitch_reload_ib_reps(struct mlx5_eswitch *esw);
|
||||
bool mlx5_eswitch_is_peer(struct mlx5_eswitch *esw,
|
||||
struct mlx5_eswitch *peer_esw);
|
||||
|
||||
bool mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb);
|
||||
void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev);
|
||||
|
|
@ -970,13 +972,6 @@ static inline int mlx5_eswitch_num_vfs(struct mlx5_eswitch *esw)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int mlx5_eswitch_get_npeers(struct mlx5_eswitch *esw)
|
||||
{
|
||||
if (mlx5_esw_allowed(esw))
|
||||
return esw->num_peers;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline struct mlx5_flow_table *
|
||||
mlx5_eswitch_get_slow_fdb(struct mlx5_eswitch *esw)
|
||||
{
|
||||
|
|
@ -1058,8 +1053,6 @@ static inline void
|
|||
mlx5_eswitch_offloads_single_fdb_del_one(struct mlx5_eswitch *master_esw,
|
||||
struct mlx5_eswitch *slave_esw) {}
|
||||
|
||||
static inline int mlx5_eswitch_get_npeers(struct mlx5_eswitch *esw) { return 0; }
|
||||
|
||||
static inline int
|
||||
mlx5_eswitch_reload_ib_reps(struct mlx5_eswitch *esw)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3296,6 +3296,18 @@ static int mlx5_esw_offloads_set_ns_peer(struct mlx5_eswitch *esw,
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool mlx5_eswitch_is_peer(struct mlx5_eswitch *esw,
|
||||
struct mlx5_eswitch *peer_esw)
|
||||
{
|
||||
u16 peer_esw_i;
|
||||
|
||||
if (!mlx5_esw_allowed(esw) || !mlx5_esw_allowed(peer_esw))
|
||||
return false;
|
||||
|
||||
peer_esw_i = MLX5_CAP_GEN(peer_esw->dev, vhca_id);
|
||||
return !!xa_load(&esw->paired, peer_esw_i);
|
||||
}
|
||||
|
||||
static int mlx5_esw_offloads_devcom_event(int event,
|
||||
void *my_data,
|
||||
void *event_data)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
bool mlx5_lag_shared_fdb_supported(struct mlx5_lag *ldev)
|
||||
{
|
||||
struct mlx5_core_dev *dev;
|
||||
struct mlx5_core_dev *dev0, *dev;
|
||||
bool ret = false;
|
||||
int idx;
|
||||
int i;
|
||||
|
|
@ -19,6 +19,7 @@ bool mlx5_lag_shared_fdb_supported(struct mlx5_lag *ldev)
|
|||
if (idx < 0)
|
||||
return false;
|
||||
|
||||
dev0 = mlx5_lag_pf(ldev, idx)->dev;
|
||||
mlx5_ldev_for_each(i, 0, ldev) {
|
||||
if (i == idx)
|
||||
continue;
|
||||
|
|
@ -27,19 +28,15 @@ bool mlx5_lag_shared_fdb_supported(struct mlx5_lag *ldev)
|
|||
mlx5_eswitch_vport_match_metadata_enabled(dev->priv.eswitch) &&
|
||||
MLX5_CAP_GEN(dev, lag_native_fdb_selection) &&
|
||||
MLX5_CAP_ESW(dev, root_ft_on_other_esw) &&
|
||||
mlx5_eswitch_get_npeers(dev->priv.eswitch) ==
|
||||
MLX5_CAP_GEN(dev, num_lag_ports) - 1)
|
||||
mlx5_eswitch_is_peer(dev0->priv.eswitch, dev->priv.eswitch))
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
dev = mlx5_lag_pf(ldev, idx)->dev;
|
||||
if (is_mdev_switchdev_mode(dev) &&
|
||||
mlx5_eswitch_vport_match_metadata_enabled(dev->priv.eswitch) &&
|
||||
mlx5_esw_offloads_devcom_is_ready(dev->priv.eswitch) &&
|
||||
MLX5_CAP_ESW(dev, esw_shared_ingress_acl) &&
|
||||
mlx5_eswitch_get_npeers(dev->priv.eswitch) ==
|
||||
MLX5_CAP_GEN(dev, num_lag_ports) - 1)
|
||||
if (is_mdev_switchdev_mode(dev0) &&
|
||||
mlx5_eswitch_vport_match_metadata_enabled(dev0->priv.eswitch) &&
|
||||
mlx5_esw_offloads_devcom_is_ready(dev0->priv.eswitch) &&
|
||||
MLX5_CAP_ESW(dev0, esw_shared_ingress_acl))
|
||||
ret = true;
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user