Skip to content

Commit c1530d8

Browse files
author
Shuotian Cheng
authored
orchagent: Setting SAI_SWITCH_ATTR_DEFAULT_INGRESS_ACL_LIST for system ACL table (sonic-net#167)
Signed-off-by: Shuotian Cheng <[email protected]>
1 parent a29003c commit c1530d8

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

orchagent/qosorch.cpp

+19-13
Original file line numberDiff line numberDiff line change
@@ -626,15 +626,24 @@ sai_object_id_t QosOrch::initSystemAclTable()
626626
attrs.push_back(attr);
627627

628628
status = sai_acl_api->create_acl_table(&acl_table_id, attrs.size(), &attrs[0]);
629-
if (status == SAI_STATUS_SUCCESS)
629+
if (status != SAI_STATUS_SUCCESS)
630630
{
631-
SWSS_LOG_NOTICE("Create system ACL table for ECN coloring");
631+
SWSS_LOG_ERROR("Failed to create a system ACL table for ECN coloring, rv:%d", status);
632+
throw runtime_error("Failed to create a system ACL table for ECN coloring");
632633
}
633-
else
634+
SWSS_LOG_NOTICE("Create a system ACL table for ECN coloring");
635+
636+
attr.id = SAI_SWITCH_ATTR_DEFAULT_INGRESS_ACL_LIST;
637+
attr.value.objlist.count = 1;
638+
attr.value.objlist.list = &acl_table_id;
639+
640+
status = sai_switch_api->set_switch_attribute(&attr);
641+
if (status != SAI_STATUS_SUCCESS)
634642
{
635-
SWSS_LOG_ERROR("Failed to create system ACL table. sai_acl_api->create_acl_table failed: %d", status);
636-
throw runtime_error("Failed to create system ACL table");
643+
SWSS_LOG_ERROR("Failed to bind the system ACL table globally, rv:%d", status);
644+
throw runtime_error("Failed to bind the system ACL table globally");
637645
}
646+
SWSS_LOG_NOTICE("Bind the system ACL table globally");
638647

639648
return acl_table_id;
640649
}
@@ -673,16 +682,13 @@ void QosOrch::initAclEntryForEcn(sai_object_id_t acl_table_id, sai_uint32_t prio
673682
attr.value.aclaction.parameter.s32 = color;
674683
attrs.push_back(attr);
675684

676-
status = sai_acl_api->create_acl_entry(&acl_entry_id, attrs.size(), &attrs[0]);
677-
if (status == SAI_STATUS_SUCCESS)
678-
{
679-
SWSS_LOG_NOTICE("Successfully created ACL entry for ECN coloring. dscp=%d, ecn=%d", ecn_field, dscp_field);
680-
}
681-
else
685+
status = sai_acl_api->create_acl_entry(&acl_entry_id, attrs.size(), attrs.data());
686+
if (status != SAI_STATUS_SUCCESS)
682687
{
683-
SWSS_LOG_ERROR("dscp=%d, ecn=%d. sai_acl_api->create_acl_entry() failed: %d", ecn_field, dscp_field, status);
684-
throw runtime_error("Failed to create color acl entry");
688+
SWSS_LOG_ERROR("Failed to create a system ACL entry for ECN coloring, rv=%d", status);
689+
throw runtime_error("Failed to create a system ACL entry for ECN coloring");
685690
}
691+
SWSS_LOG_INFO("Create a system ACL entry for ECN coloring");
686692
}
687693

688694
void QosOrch::initTableHandlers()

0 commit comments

Comments
 (0)