Skip to content

Commit

Permalink
[aclorch]: Add match TC support for ACL rule (#302)
Browse files Browse the repository at this point in the history
Sample ACL JSON input:
{
  "ACL_RULE_TABLE:ACL_Testbed_Test_Table:Tc_test": {
    "priority" : "50",
    "tc" : "3",
    "packet_action" : "drop"
  },
  "OP": "SET"
}
  • Loading branch information
sihuihan88 authored and Shuotian Cheng committed Sep 5, 2017
1 parent 0909192 commit e5c9308
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
};
Expand Down Expand Up @@ -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<uint8_t>(attr_value);
value.aclfield.mask.u8 = 0xFF;
}

}
catch (exception &e)
{
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions orchagent/aclorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e5c9308

Please sign in to comment.