提交 fe07d723 编写于 作者: P Petr Machata 提交者: David S. Miller

mlxsw: spectrum_buffers: Keep shared buffer size in mlxsw_sp_sb

Entities of infinite size will be reported as if they had the maximum
size allowed by the chip. To that end, keep track of maximum shared
buffer size in mlxsw_sp->sb.
Signed-off-by: NPetr Machata <petrm@mellanox.com>
Reviewed-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5f95d20b
...@@ -68,6 +68,7 @@ struct mlxsw_sp_sb { ...@@ -68,6 +68,7 @@ struct mlxsw_sp_sb {
struct mlxsw_sp_sb_pr prs[MLXSW_SP_SB_POOL_DESS_LEN]; struct mlxsw_sp_sb_pr prs[MLXSW_SP_SB_POOL_DESS_LEN];
struct mlxsw_sp_sb_port *ports; struct mlxsw_sp_sb_port *ports;
u32 cell_size; u32 cell_size;
u64 sb_size;
}; };
u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells) u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells)
...@@ -585,7 +586,6 @@ int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp) ...@@ -585,7 +586,6 @@ int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp)
{ {
u16 ing_pool_count; u16 ing_pool_count;
u16 eg_pool_count; u16 eg_pool_count;
u64 sb_size;
int err; int err;
if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, CELL_SIZE)) if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, CELL_SIZE))
...@@ -593,12 +593,13 @@ int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp) ...@@ -593,12 +593,13 @@ int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp)
if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, MAX_BUFFER_SIZE)) if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, MAX_BUFFER_SIZE))
return -EIO; return -EIO;
sb_size = MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_BUFFER_SIZE);
mlxsw_sp->sb = kzalloc(sizeof(*mlxsw_sp->sb), GFP_KERNEL); mlxsw_sp->sb = kzalloc(sizeof(*mlxsw_sp->sb), GFP_KERNEL);
if (!mlxsw_sp->sb) if (!mlxsw_sp->sb)
return -ENOMEM; return -ENOMEM;
mlxsw_sp->sb->cell_size = MLXSW_CORE_RES_GET(mlxsw_sp->core, CELL_SIZE); mlxsw_sp->sb->cell_size = MLXSW_CORE_RES_GET(mlxsw_sp->core, CELL_SIZE);
mlxsw_sp->sb->sb_size = MLXSW_CORE_RES_GET(mlxsw_sp->core,
MAX_BUFFER_SIZE);
err = mlxsw_sp_sb_ports_init(mlxsw_sp); err = mlxsw_sp_sb_ports_init(mlxsw_sp);
if (err) if (err)
...@@ -614,7 +615,8 @@ int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp) ...@@ -614,7 +615,8 @@ int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp)
if (err) if (err)
goto err_sb_mms_init; goto err_sb_mms_init;
mlxsw_sp_pool_count(&ing_pool_count, &eg_pool_count); mlxsw_sp_pool_count(&ing_pool_count, &eg_pool_count);
err = devlink_sb_register(priv_to_devlink(mlxsw_sp->core), 0, sb_size, err = devlink_sb_register(priv_to_devlink(mlxsw_sp->core), 0,
mlxsw_sp->sb->sb_size,
ing_pool_count, ing_pool_count,
eg_pool_count, eg_pool_count,
MLXSW_SP_SB_ING_TC_COUNT, MLXSW_SP_SB_ING_TC_COUNT,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册