From b49742c6601be9aae54ada8dd6861a13462208e4 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 | 6 ++++++ inc/saiqueue.h | 6 ++++++ inc/saiswitch.h | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/inc/saibuffer.h b/inc/saibuffer.h index 2bd1292f6..77560d56c 100644 --- a/inc/saibuffer.h +++ b/inc/saibuffer.h @@ -150,6 +150,12 @@ 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, + /** Custom range base value */ SAI_INGRESS_PRIORITY_GROUP_STAT_CUSTOM_RANGE_BASE = 0x10000000 diff --git a/inc/saiqueue.h b/inc/saiqueue.h index be93f0eab..c1c5c7051 100644 --- a/inc/saiqueue.h +++ b/inc/saiqueue.h @@ -418,6 +418,12 @@ typedef enum _sai_queue_stat_t /** Queue delay watermark in nanoseconds [uint64_t] */ SAI_QUEUE_STAT_DELAY_WATERMARK_NS = 0x00000027, + /** Get current queue occupancy in cells [uint64_t] */ + SAI_QUEUE_STAT_CURR_OCCUPANCY_CELLS = 0x00000028, + + /** Get watermark queue occupancy in cells [uint64_t] */ + SAI_QUEUE_STAT_WATERMARK_CELLS = 0x00000029, + /** Custom range base value */ SAI_QUEUE_STAT_CUSTOM_RANGE_BASE = 0x10000000 diff --git a/inc/saiswitch.h b/inc/saiswitch.h index 1c13bc24c..d58e0b4e6 100644 --- a/inc/saiswitch.h +++ b/inc/saiswitch.h @@ -3070,6 +3070,18 @@ typedef enum _sai_switch_attr_t */ SAI_SWITCH_ATTR_SELECTIVE_COUNTER_LIST, + /** + * @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 */