diff --git a/vslib/SwitchStateBase.cpp b/vslib/SwitchStateBase.cpp index d07910734..32f5999f4 100644 --- a/vslib/SwitchStateBase.cpp +++ b/vslib/SwitchStateBase.cpp @@ -2273,6 +2273,43 @@ sai_status_t SwitchStateBase::refresh_port_oper_speed( return SAI_STATUS_SUCCESS; } +sai_status_t SwitchStateBase::refresh_acl_table_entries( + _In_ sai_object_id_t acl_table_id) +{ + std::vector acl_entries; + + sai_attribute_t attr; + attr.id = SAI_ACL_ENTRY_ATTR_TABLE_ID; + attr.value.oid = acl_table_id; + findObjects(SAI_OBJECT_TYPE_ACL_ENTRY, attr, acl_entries); + + attr.id = SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_ENTRY; + attr.value.u32 = m_maxAclTableEntries - (uint32_t) acl_entries.size(); + + CHECK_STATUS(set(SAI_OBJECT_TYPE_ACL_TABLE, acl_table_id, &attr)); + + return SAI_STATUS_SUCCESS; +} + +sai_status_t SwitchStateBase::refresh_acl_table_counters( + _In_ sai_object_id_t acl_table_id) +{ + std::vector acl_counters; + + sai_attribute_t attr; + attr.id = SAI_ACL_COUNTER_ATTR_TABLE_ID; + attr.value.oid = acl_table_id; + findObjects(SAI_OBJECT_TYPE_ACL_COUNTER, attr, acl_counters); + + attr.id = SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_COUNTER; + attr.value.u32 = m_maxAclTableCounters - (uint32_t) acl_counters.size(); + + CHECK_STATUS(set(SAI_OBJECT_TYPE_ACL_TABLE, acl_table_id, &attr)); + + return SAI_STATUS_SUCCESS; +} + + // XXX extra work may be needed on GET api if N on list will be > then actual /* @@ -2450,6 +2487,16 @@ sai_status_t SwitchStateBase::refresh_read_only( return refresh_macsec_sa_stat(object_id); } + if (meta->objecttype == SAI_OBJECT_TYPE_ACL_TABLE && meta->attrid == SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_ENTRY) + { + return refresh_acl_table_entries(object_id); + } + + if (meta->objecttype == SAI_OBJECT_TYPE_ACL_TABLE && meta->attrid == SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_COUNTER) + { + return refresh_acl_table_counters(object_id); + } + auto mmeta = m_meta.lock(); if (mmeta) diff --git a/vslib/SwitchStateBase.h b/vslib/SwitchStateBase.h index 7051acc06..22e111a34 100644 --- a/vslib/SwitchStateBase.h +++ b/vslib/SwitchStateBase.h @@ -173,6 +173,11 @@ namespace saivs virtual sai_status_t refresh_port_oper_speed( _In_ sai_object_id_t port_id); + virtual sai_status_t refresh_acl_table_entries( + _In_ sai_object_id_t acl_table_id); + + virtual sai_status_t refresh_acl_table_counters( + _In_ sai_object_id_t acl_table_id); public: virtual sai_status_t warm_boot_initialize_objects(); @@ -680,6 +685,8 @@ namespace saivs constexpr static const int m_maxAclTables = 3; constexpr static const int m_maxAclTableGroups = 200; + constexpr static const int m_maxAclTableEntries = 1000; + constexpr static const int m_maxAclTableCounters = 1000; protected: