]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
mlxsw: spectrum: Add struct mlxsw_sp_sb_vals
authorPetr Machata <petrm@mellanox.com>
Wed, 20 Feb 2019 19:32:12 +0000 (19:32 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Feb 2019 23:57:45 +0000 (15:57 -0800)
Spectrum-2 will be configured with a different shared buffer
configuration than Spectrum-1. Therefore introduce a structure for
keeping the chip-specific default and immutable configuration.

Configuration mutable in runtime will still be kept in struct
mlxsw_sp_sb.

Signed-off-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_buffers.c

index 7ee6d747e97b087ab029a1f6ff9090cfad06a566..c1ec4f89973b83b981c2acd199db4a2deee92292 100644 (file)
@@ -4092,6 +4092,7 @@ static int mlxsw_sp1_init(struct mlxsw_core *mlxsw_core,
        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;
+       mlxsw_sp->sb_vals = &mlxsw_sp1_sb_vals;
 
        return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info);
 }
@@ -4109,6 +4110,7 @@ static int mlxsw_sp2_init(struct mlxsw_core *mlxsw_core,
        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;
 
        return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info);
 }
index ceebc91f4f1ded7ff078882c38e6d008f9ef90e8..976843917c95d091dc47b8d6ec1f0ca88d114298 100644 (file)
@@ -133,6 +133,7 @@ struct mlxsw_sp_kvdl_ops;
 struct mlxsw_sp_mr_tcam_ops;
 struct mlxsw_sp_acl_tcam_ops;
 struct mlxsw_sp_nve_ops;
+struct mlxsw_sp_sb_vals;
 
 struct mlxsw_sp {
        struct mlxsw_sp_port **ports;
@@ -167,6 +168,7 @@ struct mlxsw_sp {
        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;
+       const struct mlxsw_sp_sb_vals *sb_vals;
 };
 
 static inline struct mlxsw_sp_upper *
@@ -372,6 +374,9 @@ int mlxsw_sp_sb_occ_tc_port_bind_get(struct mlxsw_core_port *mlxsw_core_port,
 u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells);
 u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes);
 
+extern const struct mlxsw_sp_sb_vals mlxsw_sp1_sb_vals;
+extern const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals;
+
 /* spectrum_switchdev.c */
 int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp);
 void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp);
index 80066f437a65e8a91c63ea7000189c62a7a4565e..cd23ec9268bc50023c3e79eee0e4b67e0c6b9fd8 100644 (file)
@@ -73,6 +73,9 @@ struct mlxsw_sp_sb {
        u64 sb_size;
 };
 
+struct mlxsw_sp_sb_vals {
+};
+
 u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells)
 {
        return mlxsw_sp->sb->cell_size * cells;
@@ -625,6 +628,12 @@ out:
        *p_egress_len = MLXSW_SP_SB_POOL_DESS_LEN - i;
 }
 
+const struct mlxsw_sp_sb_vals mlxsw_sp1_sb_vals = {
+};
+
+const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals = {
+};
+
 int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp)
 {
        u16 ing_pool_count;