@@ -784,7 +784,7 @@ bool PortsOrch::bindAclTable(sai_object_id_t id, sai_object_id_t table_oid, sai_
784
784
785
785
setPort (port.m_alias , port);
786
786
787
- gCrmOrch ->incCrmAclUsedCounter (CrmResourceType::CRM_ACL_GROUP, ingress ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS, SAI_ACL_BIND_POINT_TYPE_PORT );
787
+ gCrmOrch ->incCrmAclUsedCounter (CrmResourceType::CRM_ACL_GROUP, ingress ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS, bind_type );
788
788
789
789
switch (port.m_type )
790
790
{
@@ -1264,7 +1264,7 @@ bool PortsOrch::removePort(sai_object_id_t port_id)
1264
1264
SWSS_LOG_ERROR (" Failed to remove port %lx, rv:%d" , port_id, status);
1265
1265
return false ;
1266
1266
}
1267
-
1267
+ removeAclTableGroup (p);
1268
1268
SWSS_LOG_NOTICE (" Remove port %lx" , port_id);
1269
1269
1270
1270
return true ;
@@ -2602,6 +2602,8 @@ bool PortsOrch::removeVlan(Port vlan)
2602
2602
return false ;
2603
2603
}
2604
2604
2605
+ removeAclTableGroup (vlan);
2606
+
2605
2607
SWSS_LOG_NOTICE (" Remove VLAN %s vid:%hu" , vlan.m_alias .c_str (),
2606
2608
vlan.m_vlan_info .vlan_id );
2607
2609
@@ -2778,6 +2780,8 @@ bool PortsOrch::removeLag(Port lag)
2778
2780
return false ;
2779
2781
}
2780
2782
2783
+ removeAclTableGroup (lag);
2784
+
2781
2785
SWSS_LOG_NOTICE (" Remove LAG %s lid:%lx" , lag.m_alias .c_str (), lag.m_lag_id );
2782
2786
2783
2787
m_portList.erase (lag.m_alias );
@@ -3178,3 +3182,46 @@ bool PortsOrch::getPortOperStatus(const Port& port, sai_port_oper_status_t& stat
3178
3182
return true ;
3179
3183
}
3180
3184
3185
+ bool PortsOrch::removeAclTableGroup (const Port &p)
3186
+ {
3187
+ sai_acl_bind_point_type_t bind_type;
3188
+ switch (p.m_type )
3189
+ {
3190
+ case Port::PHY:
3191
+ bind_type = SAI_ACL_BIND_POINT_TYPE_PORT;
3192
+ break ;
3193
+ case Port::LAG:
3194
+ bind_type = SAI_ACL_BIND_POINT_TYPE_LAG;
3195
+ break ;
3196
+ case Port::VLAN:
3197
+ bind_type = SAI_ACL_BIND_POINT_TYPE_VLAN;
3198
+ break ;
3199
+ default :
3200
+ // Dealing with port, lag and vlan for now.
3201
+ return true ;
3202
+ }
3203
+ sai_status_t ret;
3204
+ if (p.m_ingress_acl_table_group_id != 0 )
3205
+ {
3206
+ ret = sai_acl_api->remove_acl_table_group (p.m_ingress_acl_table_group_id );
3207
+ if (ret != SAI_STATUS_SUCCESS)
3208
+ {
3209
+ SWSS_LOG_ERROR (" Failed to remove ingress acl table group for %s" , p.m_alias .c_str ());
3210
+ return false ;
3211
+ }
3212
+ gCrmOrch ->decCrmAclUsedCounter (CrmResourceType::CRM_ACL_GROUP, SAI_ACL_STAGE_INGRESS, bind_type, p.m_ingress_acl_table_group_id );
3213
+ }
3214
+
3215
+ if (p.m_egress_acl_table_group_id != 0 )
3216
+ {
3217
+ ret = sai_acl_api->remove_acl_table_group (p.m_egress_acl_table_group_id );
3218
+ if (ret != SAI_STATUS_SUCCESS)
3219
+ {
3220
+ SWSS_LOG_ERROR (" Failed to remove egress acl table group for %s" , p.m_alias .c_str ());
3221
+ return false ;
3222
+ }
3223
+ gCrmOrch ->decCrmAclUsedCounter (CrmResourceType::CRM_ACL_GROUP, SAI_ACL_STAGE_EGRESS, bind_type, p.m_egress_acl_table_group_id );
3224
+ }
3225
+ return true ;
3226
+ }
3227
+
0 commit comments