mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
mlxsw: reg: Extend SBPM register for occupancy control
Since it is not possible to get and clear Port-Pool occupancy data using SBSR register, there's a need to implement that using SBPM. Extend pack helper and add unpack helper to get occupancy values. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
26176def3c
commit
42a7f1d774
@ -3636,6 +3636,27 @@ MLXSW_ITEM32(reg, sbpm, pool, 0x00, 8, 4);
|
||||
*/
|
||||
MLXSW_ITEM32(reg, sbpm, dir, 0x00, 0, 2);
|
||||
|
||||
/* reg_sbpm_buff_occupancy
|
||||
* Current buffer occupancy in cells.
|
||||
* Access: RO
|
||||
*/
|
||||
MLXSW_ITEM32(reg, sbpm, buff_occupancy, 0x10, 0, 24);
|
||||
|
||||
/* reg_sbpm_clr
|
||||
* Clear Max Buffer Occupancy
|
||||
* When this bit is set, max_buff_occupancy field is cleared (and a
|
||||
* new max value is tracked from the time the clear was performed).
|
||||
* Access: OP
|
||||
*/
|
||||
MLXSW_ITEM32(reg, sbpm, clr, 0x14, 31, 1);
|
||||
|
||||
/* reg_sbpm_max_buff_occupancy
|
||||
* Maximum value of buffer occupancy in cells monitored. Cleared by
|
||||
* writing to the clr field.
|
||||
* Access: RO
|
||||
*/
|
||||
MLXSW_ITEM32(reg, sbpm, max_buff_occupancy, 0x14, 0, 24);
|
||||
|
||||
/* reg_sbpm_min_buff
|
||||
* Minimum buffer size for the limiter, in cells.
|
||||
* Access: RW
|
||||
@ -3656,17 +3677,25 @@ MLXSW_ITEM32(reg, sbpm, min_buff, 0x18, 0, 24);
|
||||
MLXSW_ITEM32(reg, sbpm, max_buff, 0x1C, 0, 24);
|
||||
|
||||
static inline void mlxsw_reg_sbpm_pack(char *payload, u8 local_port, u8 pool,
|
||||
enum mlxsw_reg_sbxx_dir dir,
|
||||
enum mlxsw_reg_sbxx_dir dir, bool clr,
|
||||
u32 min_buff, u32 max_buff)
|
||||
{
|
||||
MLXSW_REG_ZERO(sbpm, payload);
|
||||
mlxsw_reg_sbpm_local_port_set(payload, local_port);
|
||||
mlxsw_reg_sbpm_pool_set(payload, pool);
|
||||
mlxsw_reg_sbpm_dir_set(payload, dir);
|
||||
mlxsw_reg_sbpm_clr_set(payload, clr);
|
||||
mlxsw_reg_sbpm_min_buff_set(payload, min_buff);
|
||||
mlxsw_reg_sbpm_max_buff_set(payload, max_buff);
|
||||
}
|
||||
|
||||
static inline void mlxsw_reg_sbpm_unpack(char *payload, u32 *p_buff_occupancy,
|
||||
u32 *p_max_buff_occupancy)
|
||||
{
|
||||
*p_buff_occupancy = mlxsw_reg_sbpm_buff_occupancy_get(payload);
|
||||
*p_max_buff_occupancy = mlxsw_reg_sbpm_max_buff_occupancy_get(payload);
|
||||
}
|
||||
|
||||
/* SBMM - Shared Buffer Multicast Management Register
|
||||
* --------------------------------------------------
|
||||
* The SBMM register configures and retrieves the shared buffer allocation
|
||||
|
@ -113,7 +113,8 @@ static int mlxsw_sp_sb_pm_write(struct mlxsw_sp *mlxsw_sp, u8 local_port,
|
||||
struct mlxsw_sp_sb_pm *pm;
|
||||
int err;
|
||||
|
||||
mlxsw_reg_sbpm_pack(sbpm_pl, local_port, pool, dir, min_buff, max_buff);
|
||||
mlxsw_reg_sbpm_pack(sbpm_pl, local_port, pool, dir, false,
|
||||
min_buff, max_buff);
|
||||
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbpm), sbpm_pl);
|
||||
if (err)
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user