mlxsw: spectrum: Set RIF ops per ASIC type
authorNir Dotan <nird@mellanox.com>
Sun, 20 Jan 2019 06:50:41 +0000 (06:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 20 Jan 2019 19:12:57 +0000 (11:12 -0800)
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>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 32519c9..a881697 100644 (file)
@@ -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->nve_ops_arr = mlxsw_sp1_nve_ops_arr;
        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);
 }
@@ -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->nve_ops_arr = mlxsw_sp2_nve_ops_arr;
        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);
 }
index a1c32a8..1fa5c81 100644 (file)
@@ -75,6 +75,11 @@ enum mlxsw_sp_rif_type {
        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 {
        MLXSW_SP_FID_TYPE_8021Q,
        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_acl_tcam_ops *acl_tcam_ops;
        const struct mlxsw_sp_nve_ops **nve_ops_arr;
+       const struct mlxsw_sp_rif_ops **rif_ops_arr;
 };
 
 static inline struct mlxsw_sp_upper *
index 0940375..1397677 100644 (file)
@@ -6284,7 +6284,7 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp,
        int i, err;
 
        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);
        if (IS_ERR(vr))
@@ -7512,8 +7512,6 @@ static int mlxsw_sp_rifs_init(struct mlxsw_sp *mlxsw_sp)
        if (!mlxsw_sp->router->rifs)
                return -ENOMEM;
 
-       mlxsw_sp->router->rif_ops_arr = mlxsw_sp1_rif_ops_arr;
-
        return 0;
 }