From 28d8df0a09ea7a597d6d30b53de47fb7ffad5581 Mon Sep 17 00:00:00 2001 From: Anandhi Dhanabalan Date: Fri, 24 Jul 2026 17:43:34 +0530 Subject: [PATCH 1/3] Add policer operational attributes and MEF policing modes Signed-off-by: Anandhi Dhanabalan --- inc/saipolicer.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++- meta/acronyms.txt | 1 + 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/inc/saipolicer.h b/inc/saipolicer.h index 66696bbd9..b20a57a72 100644 --- a/inc/saipolicer.h +++ b/inc/saipolicer.h @@ -63,6 +63,12 @@ typedef enum _sai_policer_mode_t /** Storm control mode. Single Rate Two color CIR, CBS, G and R */ SAI_POLICER_MODE_STORM_CONTROL = 0x00000002, + /** MEF 10.2 with Coupling Flag = 0 (RFC 4115 compliant) */ + SAI_POLICER_MODE_MEF0 = 0x00000003, + + /** MEF 10.2 with Coupling Flag = 1 */ + SAI_POLICER_MODE_MEF1 = 0x00000004, + /** Custom range base value */ SAI_POLICER_MODE_CUSTOM_RANGE_BASE = 0x10000000 @@ -156,7 +162,7 @@ typedef enum _sai_policer_attr_t * @type sai_uint64_t * @flags CREATE_AND_SET * @default 0 - * @validonly SAI_POLICER_ATTR_MODE == SAI_POLICER_MODE_TR_TCM + * @validonly SAI_POLICER_ATTR_MODE == SAI_POLICER_MODE_TR_TCM or SAI_POLICER_ATTR_MODE == SAI_POLICER_MODE_MEF0 or SAI_POLICER_ATTR_MODE == SAI_POLICER_MODE_MEF1 */ SAI_POLICER_ATTR_PIR = 0x00000006, @@ -240,6 +246,68 @@ typedef enum _sai_policer_attr_t */ SAI_POLICER_ATTR_LABEL, + /** + * @brief Operational committed burst size + * + * Returns the committed burst size programmed by the implementation in + * bytes or packets, based on #SAI_POLICER_ATTR_METER_TYPE. + * + * The operational value may differ from the configured value due to hardware + * granularity or implementation limitations. + * + * @type sai_uint64_t + * @flags READ_ONLY + */ + SAI_POLICER_ATTR_OPER_CBS, + + /** + * @brief Operational committed information rate + * + * Returns the committed information rate programmed by the implementation in + * bytes per second or packets per second, based on + * #SAI_POLICER_ATTR_METER_TYPE. + * + * The operational value may differ from the configured value due to hardware + * granularity or implementation limitations. + * + * @type sai_uint64_t + * @flags READ_ONLY + */ + SAI_POLICER_ATTR_OPER_CIR, + + /** + * @brief Operational peak burst size + * + * Returns the peak burst size programmed by the implementation in bytes or + * packets, based on #SAI_POLICER_ATTR_METER_TYPE. + * + * The operational value may differ from the configured value due to hardware + * granularity or implementation limitations. + * + * Applicable only for SR_TCM, TR_TCM, MEF policing modes. + * + * @type sai_uint64_t + * @flags READ_ONLY + */ + SAI_POLICER_ATTR_OPER_PBS, + + /** + * @brief Operational peak information rate + * + * Returns the peak information rate programmed by the implementation in + * bytes per second or packets per second, based on + * #SAI_POLICER_ATTR_METER_TYPE. + * + * The operational value may differ from the configured value due to hardware + * granularity. + * + * Applicable only for TR_TCM, MEF policing modes. + * + * @type sai_uint64_t + * @flags READ_ONLY + */ + SAI_POLICER_ATTR_OPER_PIR, + /** * @brief End of attributes */ diff --git a/meta/acronyms.txt b/meta/acronyms.txt index 180a7a6b6..df23727f0 100644 --- a/meta/acronyms.txt +++ b/meta/acronyms.txt @@ -103,6 +103,7 @@ LSP - Label Switched Path MAC - Medium Access Control MDIO - Management Data Input/Output MDIX - Medium Dependent Interface Crossover +MEF - Metro Ethernet Forum MILLI - milli (1/1000) MMU - Memory Management Unit MPLS - Multi Protocol Label Switching From 0a83d3dce80e59303719d619502660f0c5bd70f7 Mon Sep 17 00:00:00 2001 From: Anandhi Dhanabalan Date: Tue, 4 Aug 2026 11:50:45 +0530 Subject: [PATCH 2/3] Added separate enum alias for TRTCM (rfc-4115) Signed-off-by: Anandhi Dhanabalan --- inc/saipolicer.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/saipolicer.h b/inc/saipolicer.h index b20a57a72..8136bb168 100644 --- a/inc/saipolicer.h +++ b/inc/saipolicer.h @@ -63,8 +63,11 @@ typedef enum _sai_policer_mode_t /** Storm control mode. Single Rate Two color CIR, CBS, G and R */ SAI_POLICER_MODE_STORM_CONTROL = 0x00000002, + /** RFC 4115 */ + SAI_POLICER_MODE_TR_TCM_V2 = 0x00000003, + /** MEF 10.2 with Coupling Flag = 0 (RFC 4115 compliant) */ - SAI_POLICER_MODE_MEF0 = 0x00000003, + SAI_POLICER_MODE_MEF0 = SAI_POLICER_MODE_TR_TCM_V2, /** MEF 10.2 with Coupling Flag = 1 */ SAI_POLICER_MODE_MEF1 = 0x00000004, From b9fa87eac9d39a9423101e39acb685adcc13beee Mon Sep 17 00:00:00 2001 From: Anandhi Dhanabalan Date: Thu, 6 Aug 2026 21:03:17 +0530 Subject: [PATCH 3/3] Fix review comment to remove SAI_POLICER_MODE_TR_TCM_V2 Signed-off-by: Anandhi Dhanabalan --- inc/saipolicer.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/inc/saipolicer.h b/inc/saipolicer.h index 8136bb168..b20a57a72 100644 --- a/inc/saipolicer.h +++ b/inc/saipolicer.h @@ -63,11 +63,8 @@ typedef enum _sai_policer_mode_t /** Storm control mode. Single Rate Two color CIR, CBS, G and R */ SAI_POLICER_MODE_STORM_CONTROL = 0x00000002, - /** RFC 4115 */ - SAI_POLICER_MODE_TR_TCM_V2 = 0x00000003, - /** MEF 10.2 with Coupling Flag = 0 (RFC 4115 compliant) */ - SAI_POLICER_MODE_MEF0 = SAI_POLICER_MODE_TR_TCM_V2, + SAI_POLICER_MODE_MEF0 = 0x00000003, /** MEF 10.2 with Coupling Flag = 1 */ SAI_POLICER_MODE_MEF1 = 0x00000004,