@@ -3722,6 +3722,104 @@ static inline void mlxsw_reg_sbmm_pack(char *payload, u8 prio, u32 min_buff,
3722
3722
mlxsw_reg_sbmm_pool_set (payload , pool );
3723
3723
}
3724
3724
3725
+ /* SBSR - Shared Buffer Status Register
3726
+ * ------------------------------------
3727
+ * The SBSR register retrieves the shared buffer occupancy according to
3728
+ * Port-Pool. Note that this register enables reading a large amount of data.
3729
+ * It is the user's responsibility to limit the amount of data to ensure the
3730
+ * response can match the maximum transfer unit. In case the response exceeds
3731
+ * the maximum transport unit, it will be truncated with no special notice.
3732
+ */
3733
+ #define MLXSW_REG_SBSR_ID 0xB005
3734
+ #define MLXSW_REG_SBSR_BASE_LEN 0x5C /* base length, without records */
3735
+ #define MLXSW_REG_SBSR_REC_LEN 0x8 /* record length */
3736
+ #define MLXSW_REG_SBSR_REC_MAX_COUNT 120
3737
+ #define MLXSW_REG_SBSR_LEN (MLXSW_REG_SBSR_BASE_LEN + \
3738
+ MLXSW_REG_SBSR_REC_LEN * \
3739
+ MLXSW_REG_SBSR_REC_MAX_COUNT)
3740
+
3741
+ static const struct mlxsw_reg_info mlxsw_reg_sbsr = {
3742
+ .id = MLXSW_REG_SBSR_ID ,
3743
+ .len = MLXSW_REG_SBSR_LEN ,
3744
+ };
3745
+
3746
+ /* reg_sbsr_clr
3747
+ * Clear Max Buffer Occupancy. When this bit is set, the max_buff_occupancy
3748
+ * field is cleared (and a new max value is tracked from the time the clear
3749
+ * was performed).
3750
+ * Access: OP
3751
+ */
3752
+ MLXSW_ITEM32 (reg , sbsr , clr , 0x00 , 31 , 1 );
3753
+
3754
+ /* reg_sbsr_ingress_port_mask
3755
+ * Bit vector for all ingress network ports.
3756
+ * Indicates which of the ports (for which the relevant bit is set)
3757
+ * are affected by the set operation. Configuration of any other port
3758
+ * does not change.
3759
+ * Access: Index
3760
+ */
3761
+ MLXSW_ITEM_BIT_ARRAY (reg , sbsr , ingress_port_mask , 0x10 , 0x20 , 1 );
3762
+
3763
+ /* reg_sbsr_pg_buff_mask
3764
+ * Bit vector for all switch priority groups.
3765
+ * Indicates which of the priorities (for which the relevant bit is set)
3766
+ * are affected by the set operation. Configuration of any other priority
3767
+ * does not change.
3768
+ * Range is 0..cap_max_pg_buffers - 1
3769
+ * Access: Index
3770
+ */
3771
+ MLXSW_ITEM_BIT_ARRAY (reg , sbsr , pg_buff_mask , 0x30 , 0x4 , 1 );
3772
+
3773
+ /* reg_sbsr_egress_port_mask
3774
+ * Bit vector for all egress network ports.
3775
+ * Indicates which of the ports (for which the relevant bit is set)
3776
+ * are affected by the set operation. Configuration of any other port
3777
+ * does not change.
3778
+ * Access: Index
3779
+ */
3780
+ MLXSW_ITEM_BIT_ARRAY (reg , sbsr , egress_port_mask , 0x34 , 0x20 , 1 );
3781
+
3782
+ /* reg_sbsr_tclass_mask
3783
+ * Bit vector for all traffic classes.
3784
+ * Indicates which of the traffic classes (for which the relevant bit is
3785
+ * set) are affected by the set operation. Configuration of any other
3786
+ * traffic class does not change.
3787
+ * Range is 0..cap_max_tclass - 1
3788
+ * Access: Index
3789
+ */
3790
+ MLXSW_ITEM_BIT_ARRAY (reg , sbsr , tclass_mask , 0x54 , 0x8 , 1 );
3791
+
3792
+ static inline void mlxsw_reg_sbsr_pack (char * payload , bool clr )
3793
+ {
3794
+ MLXSW_REG_ZERO (sbsr , payload );
3795
+ mlxsw_reg_sbsr_clr_set (payload , clr );
3796
+ }
3797
+
3798
+ /* reg_sbsr_rec_buff_occupancy
3799
+ * Current buffer occupancy in cells.
3800
+ * Access: RO
3801
+ */
3802
+ MLXSW_ITEM32_INDEXED (reg , sbsr , rec_buff_occupancy , MLXSW_REG_SBSR_BASE_LEN ,
3803
+ 0 , 24 , MLXSW_REG_SBSR_REC_LEN , 0x00 , false);
3804
+
3805
+ /* reg_sbsr_rec_max_buff_occupancy
3806
+ * Maximum value of buffer occupancy in cells monitored. Cleared by
3807
+ * writing to the clr field.
3808
+ * Access: RO
3809
+ */
3810
+ MLXSW_ITEM32_INDEXED (reg , sbsr , rec_max_buff_occupancy , MLXSW_REG_SBSR_BASE_LEN ,
3811
+ 0 , 24 , MLXSW_REG_SBSR_REC_LEN , 0x04 , false);
3812
+
3813
+ static inline void mlxsw_reg_sbsr_rec_unpack (char * payload , int rec_index ,
3814
+ u32 * p_buff_occupancy ,
3815
+ u32 * p_max_buff_occupancy )
3816
+ {
3817
+ * p_buff_occupancy =
3818
+ mlxsw_reg_sbsr_rec_buff_occupancy_get (payload , rec_index );
3819
+ * p_max_buff_occupancy =
3820
+ mlxsw_reg_sbsr_rec_max_buff_occupancy_get (payload , rec_index );
3821
+ }
3822
+
3725
3823
static inline const char * mlxsw_reg_id_str (u16 reg_id )
3726
3824
{
3727
3825
switch (reg_id ) {
@@ -3817,6 +3915,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
3817
3915
return "SBPM" ;
3818
3916
case MLXSW_REG_SBMM_ID :
3819
3917
return "SBMM" ;
3918
+ case MLXSW_REG_SBSR_ID :
3919
+ return "SBSR" ;
3820
3920
default :
3821
3921
return "*UNKNOWN*" ;
3822
3922
}
0 commit comments