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);
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)
{
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)
{
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)
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;
if (idx < 0)
return false;
+ dev0 = mlx5_lag_pf(ldev, idx)->dev;
mlx5_ldev_for_each(i, 0, ldev) {
if (i == idx)
continue;
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;