From e5c9308bdf0b7cdcbe943ccf4661b2dfba9b3a24 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 5 Sep 2017 13:01:58 -0700 Subject: [PATCH] [aclorch]: Add match TC support for ACL rule (#302) Sample ACL JSON input: { "ACL_RULE_TABLE:ACL_Testbed_Test_Table:Tc_test": { "priority" : "50", "tc" : "3", "packet_action" : "drop" }, "OP": "SET" } --- orchagent/aclorch.cpp | 11 +++++++++++ orchagent/aclorch.h | 1 + 2 files changed, 12 insertions(+) diff --git a/orchagent/aclorch.cpp b/orchagent/aclorch.cpp index cbe66cf0f5..87b408cadb 100644 --- a/orchagent/aclorch.cpp +++ b/orchagent/aclorch.cpp @@ -36,6 +36,7 @@ acl_rule_attr_lookup_t aclMatchLookup = { MATCH_TCP_FLAGS, SAI_ACL_ENTRY_ATTR_FIELD_TCP_FLAGS }, { MATCH_IP_TYPE, SAI_ACL_ENTRY_ATTR_FIELD_ACL_IP_TYPE }, { MATCH_DSCP, SAI_ACL_ENTRY_ATTR_FIELD_DSCP }, + { MATCH_TC, SAI_ACL_ENTRY_ATTR_FIELD_TC }, { MATCH_L4_SRC_PORT_RANGE, (sai_acl_entry_attr_t)SAI_ACL_RANGE_TYPE_L4_SRC_PORT_RANGE }, { MATCH_L4_DST_PORT_RANGE, (sai_acl_entry_attr_t)SAI_ACL_RANGE_TYPE_L4_DST_PORT_RANGE }, }; @@ -226,6 +227,12 @@ bool AclRule::validateAddMatch(string attr_name, string attr_value) return false; } } + else if(attr_name == MATCH_TC) + { + value.aclfield.data.u8 = to_uint(attr_value); + value.aclfield.mask.u8 = 0xFF; + } + } catch (exception &e) { @@ -1441,6 +1448,10 @@ sai_status_t AclOrch::createBindAclTable(AclTable &aclTable, sai_object_id_t &ta attr.value.booldata = true; table_attrs.push_back(attr); + attr.id = SAI_ACL_TABLE_ATTR_FIELD_TC; + attr.value.booldata = true; + table_attrs.push_back(attr); + if (aclTable.type == ACL_TABLE_MIRROR) { attr.id = SAI_ACL_TABLE_ATTR_FIELD_DSCP; diff --git a/orchagent/aclorch.h b/orchagent/aclorch.h index ab176a08d1..e4180114a0 100644 --- a/orchagent/aclorch.h +++ b/orchagent/aclorch.h @@ -37,6 +37,7 @@ #define MATCH_DSCP "DSCP" #define MATCH_L4_SRC_PORT_RANGE "L4_SRC_PORT_RANGE" #define MATCH_L4_DST_PORT_RANGE "L4_DST_PORT_RANGE" +#define MATCH_TC "TC" #define ACTION_PACKET_ACTION "PACKET_ACTION" #define ACTION_MIRROR_ACTION "MIRROR_ACTION"