Skip to content

Commit e5c9308

Browse files
sihuihan88Shuotian Cheng
authored and
Shuotian Cheng
committed
[aclorch]: Add match TC support for ACL rule (sonic-net#302)
Sample ACL JSON input: { "ACL_RULE_TABLE:ACL_Testbed_Test_Table:Tc_test": { "priority" : "50", "tc" : "3", "packet_action" : "drop" }, "OP": "SET" }
1 parent 0909192 commit e5c9308

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

orchagent/aclorch.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ acl_rule_attr_lookup_t aclMatchLookup =
3636
{ MATCH_TCP_FLAGS, SAI_ACL_ENTRY_ATTR_FIELD_TCP_FLAGS },
3737
{ MATCH_IP_TYPE, SAI_ACL_ENTRY_ATTR_FIELD_ACL_IP_TYPE },
3838
{ MATCH_DSCP, SAI_ACL_ENTRY_ATTR_FIELD_DSCP },
39+
{ MATCH_TC, SAI_ACL_ENTRY_ATTR_FIELD_TC },
3940
{ MATCH_L4_SRC_PORT_RANGE, (sai_acl_entry_attr_t)SAI_ACL_RANGE_TYPE_L4_SRC_PORT_RANGE },
4041
{ MATCH_L4_DST_PORT_RANGE, (sai_acl_entry_attr_t)SAI_ACL_RANGE_TYPE_L4_DST_PORT_RANGE },
4142
};
@@ -226,6 +227,12 @@ bool AclRule::validateAddMatch(string attr_name, string attr_value)
226227
return false;
227228
}
228229
}
230+
else if(attr_name == MATCH_TC)
231+
{
232+
value.aclfield.data.u8 = to_uint<uint8_t>(attr_value);
233+
value.aclfield.mask.u8 = 0xFF;
234+
}
235+
229236
}
230237
catch (exception &e)
231238
{
@@ -1441,6 +1448,10 @@ sai_status_t AclOrch::createBindAclTable(AclTable &aclTable, sai_object_id_t &ta
14411448
attr.value.booldata = true;
14421449
table_attrs.push_back(attr);
14431450

1451+
attr.id = SAI_ACL_TABLE_ATTR_FIELD_TC;
1452+
attr.value.booldata = true;
1453+
table_attrs.push_back(attr);
1454+
14441455
if (aclTable.type == ACL_TABLE_MIRROR)
14451456
{
14461457
attr.id = SAI_ACL_TABLE_ATTR_FIELD_DSCP;

orchagent/aclorch.h

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#define MATCH_DSCP "DSCP"
3838
#define MATCH_L4_SRC_PORT_RANGE "L4_SRC_PORT_RANGE"
3939
#define MATCH_L4_DST_PORT_RANGE "L4_DST_PORT_RANGE"
40+
#define MATCH_TC "TC"
4041

4142
#define ACTION_PACKET_ACTION "PACKET_ACTION"
4243
#define ACTION_MIRROR_ACTION "MIRROR_ACTION"

0 commit comments

Comments
 (0)