7
7
#include " ipprefix.h"
8
8
#include " converter.h"
9
9
#include " timer.h"
10
+ #include " crmorch.h"
10
11
11
12
using namespace std ;
12
13
using namespace swss ;
@@ -26,6 +27,7 @@ extern sai_port_api_t* sai_port_api;
26
27
extern sai_switch_api_t * sai_switch_api;
27
28
extern sai_object_id_t gSwitchId ;
28
29
extern PortsOrch* gPortsOrch ;
30
+ extern CrmOrch *gCrmOrch ;
29
31
30
32
acl_rule_attr_lookup_t aclMatchLookup =
31
33
{
@@ -368,6 +370,8 @@ bool AclRule::create()
368
370
decreaseNextHopRefCount ();
369
371
}
370
372
373
+ gCrmOrch ->incCrmAclTableUsedCounter (CrmResourceType::CRM_ACL_ENTRY, m_tableOid);
374
+
371
375
return (status == SAI_STATUS_SUCCESS);
372
376
}
373
377
@@ -412,6 +416,8 @@ bool AclRule::remove()
412
416
return false ;
413
417
}
414
418
419
+ gCrmOrch ->decCrmAclTableUsedCounter (CrmResourceType::CRM_ACL_ENTRY, m_tableOid);
420
+
415
421
m_ruleOid = SAI_NULL_OBJECT_ID;
416
422
417
423
decreaseNextHopRefCount ();
@@ -505,6 +511,8 @@ bool AclRule::createCounter()
505
511
return false ;
506
512
}
507
513
514
+ gCrmOrch ->incCrmAclTableUsedCounter (CrmResourceType::CRM_ACL_COUNTER, m_tableOid);
515
+
508
516
return true ;
509
517
}
510
518
@@ -537,6 +545,8 @@ bool AclRule::removeCounter()
537
545
return false ;
538
546
}
539
547
548
+ gCrmOrch ->decCrmAclTableUsedCounter (CrmResourceType::CRM_ACL_COUNTER, m_tableOid);
549
+
540
550
SWSS_LOG_INFO (" Removing record about the counter %lX from the DB" , m_counterOid);
541
551
AclOrch::getCountersTable ().del (getTableId () + " :" + getId ());
542
552
@@ -973,6 +983,12 @@ bool AclTable::create()
973
983
}
974
984
975
985
sai_status_t status = sai_acl_api->create_acl_table (&m_oid, gSwitchId , (uint32_t )table_attrs.size (), table_attrs.data ());
986
+
987
+ if (status == SAI_STATUS_SUCCESS)
988
+ {
989
+ gCrmOrch ->incCrmAclUsedCounter (CrmResourceType::CRM_ACL_TABLE, (sai_acl_stage_t ) attr.value .s32 , SAI_ACL_BIND_POINT_TYPE_PORT);
990
+ }
991
+
976
992
return status == SAI_STATUS_SUCCESS;
977
993
}
978
994
@@ -1388,6 +1404,10 @@ bool AclOrch::removeAclTable(string table_id)
1388
1404
{
1389
1405
SWSS_LOG_NOTICE (" Successfully deleted ACL table %s" , table_id.c_str ());
1390
1406
m_AclTables.erase (table_oid);
1407
+
1408
+ sai_acl_stage_t stage = (m_AclTables[table_oid].stage == ACL_STAGE_INGRESS) ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS;
1409
+ gCrmOrch ->decCrmAclUsedCounter (CrmResourceType::CRM_ACL_TABLE, stage, SAI_ACL_BIND_POINT_TYPE_PORT, table_oid);
1410
+
1391
1411
return true ;
1392
1412
}
1393
1413
else
0 commit comments