From e94b728b1b2b4e37fb343aad30c1ae63f72ebd92 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 8 Oct 2024 23:25:14 +0300 Subject: [PATCH] Add occupancy and watermark counters in cells Add occcupancy and watermark counters for priority group and queue objects in shared buffer cells to report them as they are in counted in the ASIC. Also add a companion read-only attribute to get the cell size of a shared buffer in a switch. Signed-off-by: Marian Pritsak --- inc/saibuffer.h | 30 ++++++++++++++++++++++++++++++ inc/saiqueue.h | 12 ++++++++++++ inc/saiswitch.h | 12 ++++++++++++ 3 files changed, 54 insertions(+) diff --git a/inc/saibuffer.h b/inc/saibuffer.h index c4672c1c0..1aca03a82 100644 --- a/inc/saibuffer.h +++ b/inc/saibuffer.h @@ -150,6 +150,24 @@ typedef enum _sai_ingress_priority_group_stat_t /** Get dropped packets count [uint64_t] */ SAI_INGRESS_PRIORITY_GROUP_STAT_DROPPED_PACKETS = 0x00000008, + /** Get current pg occupancy in cells [uint64_t] */ + SAI_INGRESS_PRIORITY_GROUP_STAT_CURR_OCCUPANCY_CELLS = 0x00000009, + + /** Get watermark pg occupancy in cells [uint64_t] */ + SAI_INGRESS_PRIORITY_GROUP_STAT_WATERMARK_CELLS = 0x0000000a, + + /** Get current pg shared occupancy in cells [uint64_t] */ + SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_CURR_OCCUPANCY_CELLS = 0x0000000b, + + /** Get watermark pg shared occupancy in cells [uint64_t] */ + SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_CELLS = 0x0000000c, + + /** Get current pg XOFF room occupancy in cells [uint64_t] */ + SAI_INGRESS_PRIORITY_GROUP_STAT_XOFF_ROOM_CURR_OCCUPANCY_CELLS = 0x0000000d, + + /** Get watermark pg XOFF room occupancy in cells [uint64_t] */ + SAI_INGRESS_PRIORITY_GROUP_STAT_XOFF_ROOM_WATERMARK_CELLS = 0x0000000e, + /** Custom range base value */ SAI_INGRESS_PRIORITY_GROUP_STAT_CUSTOM_RANGE_BASE = 0x10000000 @@ -472,6 +490,18 @@ typedef enum _sai_buffer_pool_stat_t /** Get headroom pool occupancy in bytes [uint64_t] */ SAI_BUFFER_POOL_STAT_XOFF_ROOM_WATERMARK_BYTES = 0x00000014, + /** Get current headroom pool occupancy in cells [uint64_t] */ + SAI_BUFFER_POOL_STAT_XOFF_ROOM_CURR_OCCUPANCY_CELLS = 0x00000015, + + /** Get headroom pool occupancy in cells [uint64_t] */ + SAI_BUFFER_POOL_STAT_XOFF_ROOM_WATERMARK_CELLS = 0x00000016, + + /** Get current pool occupancy in cells [uint64_t] */ + SAI_BUFFER_POOL_STAT_CURR_OCCUPANCY_CELLS = 0x00000017, + + /** Get watermark pool occupancy in cells [uint64_t] */ + SAI_BUFFER_POOL_STAT_WATERMARK_CELLS = 0x00000018, + /** Custom range base value */ SAI_BUFFER_POOL_STAT_CUSTOM_RANGE_BASE = 0x10000000 diff --git a/inc/saiqueue.h b/inc/saiqueue.h index 2d481854c..558ffc7ab 100644 --- a/inc/saiqueue.h +++ b/inc/saiqueue.h @@ -421,6 +421,18 @@ typedef enum _sai_queue_stat_t /** Packets trimmed due to failed admission [uint64_t] */ SAI_QUEUE_STAT_TRIM_PACKETS = 0x00000028, + /** Get current queue occupancy in cells [uint64_t] */ + SAI_QUEUE_STAT_CURR_OCCUPANCY_CELLS = 0x00000029, + + /** Get watermark queue occupancy in cells [uint64_t] */ + SAI_QUEUE_STAT_WATERMARK_CELLS = 0x0000002a, + + /** Get current queue shared occupancy in cells [uint64_t] */ + SAI_QUEUE_STAT_SHARED_CURR_OCCUPANCY_CELLS = 0x0000002b, + + /** Get watermark queue shared occupancy in cells [uint64_t] */ + SAI_QUEUE_STAT_SHARED_WATERMARK_CELLS = 0x0000002c, + /** Custom range base value */ SAI_QUEUE_STAT_CUSTOM_RANGE_BASE = 0x10000000 diff --git a/inc/saiswitch.h b/inc/saiswitch.h index 0761113f6..b225a8bf1 100644 --- a/inc/saiswitch.h +++ b/inc/saiswitch.h @@ -3185,6 +3185,18 @@ typedef enum _sai_switch_attr_t */ SAI_SWITCH_ATTR_PACKET_TRIM_QUEUE_INDEX, + /** + * @brief Size of a shared buffer cell + * + * Some counters related to shared buffer may be + * reported in cells instead of bytes for an + * improved performance. + * + * @type sai_uint32_t + * @flags READ_ONLY + */ + SAI_SWITCH_ATTR_SHARED_BUFFER_CELL_SIZE, + /** * @brief End of attributes */