]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mlxsw: spectrum: Do not enforce same firmware version for multiple ASICs
authorIdo Schimmel <idosch@mellanox.com>
Wed, 15 Jan 2020 11:53:44 +0000 (13:53 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Jan 2020 12:16:30 +0000 (04:16 -0800)
In commit 576149f20d9a ("mlxsw: Enforce firmware version for
Spectrum-2") I added a required firmware version for Spectrum-2, but
missed the fact that mlxsw_sp2_init() is used by both Spectrum-2 and
Spectrum-3. This means that the same firmware version will be used for
both, which is wrong.

Fix this by creating a new init() callback for Spectrum-3.

Fixes: 576149f20d9a ("mlxsw: Enforce firmware version for Spectrum-2")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Tested-by: Shalom Toledo <shalomt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c

index f7fd5e8fbf96f640ca22913ae9ad94be5a7a3322..5408a964bd105354156e1e8a054932a940a95d33 100644 (file)
@@ -5132,6 +5132,27 @@ static int mlxsw_sp2_init(struct mlxsw_core *mlxsw_core,
        return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info, extack);
 }
 
+static int mlxsw_sp3_init(struct mlxsw_core *mlxsw_core,
+                         const struct mlxsw_bus_info *mlxsw_bus_info,
+                         struct netlink_ext_ack *extack)
+{
+       struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core);
+
+       mlxsw_sp->kvdl_ops = &mlxsw_sp2_kvdl_ops;
+       mlxsw_sp->afa_ops = &mlxsw_sp2_act_afa_ops;
+       mlxsw_sp->afk_ops = &mlxsw_sp2_afk_ops;
+       mlxsw_sp->mr_tcam_ops = &mlxsw_sp2_mr_tcam_ops;
+       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;
+       mlxsw_sp->sb_vals = &mlxsw_sp2_sb_vals;
+       mlxsw_sp->port_type_speed_ops = &mlxsw_sp2_port_type_speed_ops;
+       mlxsw_sp->ptp_ops = &mlxsw_sp2_ptp_ops;
+
+       return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info, extack);
+}
+
 static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core)
 {
        struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core);
@@ -5634,7 +5655,7 @@ static struct mlxsw_driver mlxsw_sp2_driver = {
 static struct mlxsw_driver mlxsw_sp3_driver = {
        .kind                           = mlxsw_sp3_driver_name,
        .priv_size                      = sizeof(struct mlxsw_sp),
-       .init                           = mlxsw_sp2_init,
+       .init                           = mlxsw_sp3_init,
        .fini                           = mlxsw_sp_fini,
        .basic_trap_groups_set          = mlxsw_sp_basic_trap_groups_set,
        .port_split                     = mlxsw_sp_port_split,