mlxsw: spectrum: Set RIF ops per ASIC type
Set RIF ops array as member of mlxsw_sp in order to control which RIF operations callbacks are called per ASIC type. This is needed to control per ASIC handling of loopback RIF configurations. Signed-off-by: Nir Dotan <nird@mellanox.com> Reviewed-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
99974468b9
commit
1f5b230339
|
@ -4094,6 +4094,7 @@ static int mlxsw_sp1_init(struct mlxsw_core *mlxsw_core,
|
||||||
mlxsw_sp->acl_tcam_ops = &mlxsw_sp1_acl_tcam_ops;
|
mlxsw_sp->acl_tcam_ops = &mlxsw_sp1_acl_tcam_ops;
|
||||||
mlxsw_sp->nve_ops_arr = mlxsw_sp1_nve_ops_arr;
|
mlxsw_sp->nve_ops_arr = mlxsw_sp1_nve_ops_arr;
|
||||||
mlxsw_sp->mac_mask = mlxsw_sp1_mac_mask;
|
mlxsw_sp->mac_mask = mlxsw_sp1_mac_mask;
|
||||||
|
mlxsw_sp->rif_ops_arr = mlxsw_sp1_rif_ops_arr;
|
||||||
|
|
||||||
return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info);
|
return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info);
|
||||||
}
|
}
|
||||||
|
@ -4110,6 +4111,7 @@ static int mlxsw_sp2_init(struct mlxsw_core *mlxsw_core,
|
||||||
mlxsw_sp->acl_tcam_ops = &mlxsw_sp2_acl_tcam_ops;
|
mlxsw_sp->acl_tcam_ops = &mlxsw_sp2_acl_tcam_ops;
|
||||||
mlxsw_sp->nve_ops_arr = mlxsw_sp2_nve_ops_arr;
|
mlxsw_sp->nve_ops_arr = mlxsw_sp2_nve_ops_arr;
|
||||||
mlxsw_sp->mac_mask = mlxsw_sp2_mac_mask;
|
mlxsw_sp->mac_mask = mlxsw_sp2_mac_mask;
|
||||||
|
mlxsw_sp->rif_ops_arr = mlxsw_sp2_rif_ops_arr;
|
||||||
|
|
||||||
return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info);
|
return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,11 @@ enum mlxsw_sp_rif_type {
|
||||||
MLXSW_SP_RIF_TYPE_MAX,
|
MLXSW_SP_RIF_TYPE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct mlxsw_sp_rif_ops;
|
||||||
|
|
||||||
|
extern const struct mlxsw_sp_rif_ops *mlxsw_sp1_rif_ops_arr[];
|
||||||
|
extern const struct mlxsw_sp_rif_ops *mlxsw_sp2_rif_ops_arr[];
|
||||||
|
|
||||||
enum mlxsw_sp_fid_type {
|
enum mlxsw_sp_fid_type {
|
||||||
MLXSW_SP_FID_TYPE_8021Q,
|
MLXSW_SP_FID_TYPE_8021Q,
|
||||||
MLXSW_SP_FID_TYPE_8021D,
|
MLXSW_SP_FID_TYPE_8021D,
|
||||||
|
@ -161,6 +166,7 @@ struct mlxsw_sp {
|
||||||
const struct mlxsw_sp_mr_tcam_ops *mr_tcam_ops;
|
const struct mlxsw_sp_mr_tcam_ops *mr_tcam_ops;
|
||||||
const struct mlxsw_sp_acl_tcam_ops *acl_tcam_ops;
|
const struct mlxsw_sp_acl_tcam_ops *acl_tcam_ops;
|
||||||
const struct mlxsw_sp_nve_ops **nve_ops_arr;
|
const struct mlxsw_sp_nve_ops **nve_ops_arr;
|
||||||
|
const struct mlxsw_sp_rif_ops **rif_ops_arr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct mlxsw_sp_upper *
|
static inline struct mlxsw_sp_upper *
|
||||||
|
|
|
@ -6284,7 +6284,7 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp,
|
||||||
int i, err;
|
int i, err;
|
||||||
|
|
||||||
type = mlxsw_sp_dev_rif_type(mlxsw_sp, params->dev);
|
type = mlxsw_sp_dev_rif_type(mlxsw_sp, params->dev);
|
||||||
ops = mlxsw_sp->router->rif_ops_arr[type];
|
ops = mlxsw_sp->rif_ops_arr[type];
|
||||||
|
|
||||||
vr = mlxsw_sp_vr_get(mlxsw_sp, tb_id ? : RT_TABLE_MAIN, extack);
|
vr = mlxsw_sp_vr_get(mlxsw_sp, tb_id ? : RT_TABLE_MAIN, extack);
|
||||||
if (IS_ERR(vr))
|
if (IS_ERR(vr))
|
||||||
|
@ -7512,8 +7512,6 @@ static int mlxsw_sp_rifs_init(struct mlxsw_sp *mlxsw_sp)
|
||||||
if (!mlxsw_sp->router->rifs)
|
if (!mlxsw_sp->router->rifs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
mlxsw_sp->router->rif_ops_arr = mlxsw_sp1_rif_ops_arr;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue