aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2020-09-16 09:35:27 +0300
committerDavid S. Miller <davem@davemloft.net>2020-09-16 15:19:30 -0700
commita41b96267c1d5b3a84492a01b0924541639a3372 (patch)
tree7d395477db397bbbf5485783f5d1016ef303cecf /drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
parentmlxsw: spectrum_buffers: Convert mlxsw_sp_port_headroom_init() (diff)
downloadwireguard-linux-a41b96267c1d5b3a84492a01b0924541639a3372.tar.xz
wireguard-linux-a41b96267c1d5b3a84492a01b0924541639a3372.zip
mlxsw: spectrum_buffers: Introduce shared buffer ops
The size of the internal buffer is currently calculated in the SPAN module. Logically it belongs to the spectrum_buffers module, where it should be moved. However, that being a chip-specific operation, it needs dynamic dispatch. There currently is a chip-specific structure for description of shared buffer values, struct mlxsw_sp_sb_vals. However placing ops into this structure would be confusing. Therefore introduce a new per-chip structure, currently empty, and initialize the ops pointer as appropriate. Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
index 2f1d09a40058..cdd0f3dac68b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
@@ -121,6 +121,9 @@ struct mlxsw_sp_sb_vals {
unsigned int cms_cpu_count;
};
+struct mlxsw_sp_sb_ops {
+};
+
u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells)
{
return mlxsw_sp->sb->cell_size * cells;
@@ -1101,6 +1104,15 @@ const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals = {
.cms_cpu_count = ARRAY_SIZE(mlxsw_sp_cpu_port_sb_cms),
};
+const struct mlxsw_sp_sb_ops mlxsw_sp1_sb_ops = {
+};
+
+const struct mlxsw_sp_sb_ops mlxsw_sp2_sb_ops = {
+};
+
+const struct mlxsw_sp_sb_ops mlxsw_sp3_sb_ops = {
+};
+
int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp)
{
u32 max_headroom_size;