Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Aclorch] fix Acl bind point type issue #516

Merged
merged 7 commits into from
Jul 11, 2018
39 changes: 2 additions & 37 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,43 +952,7 @@ bool AclTable::create()

sai_attribute_t attr;
vector<sai_attribute_t> table_attrs;

int32_t range_types_list[] =
{ SAI_ACL_RANGE_TYPE_L4_DST_PORT_RANGE,
SAI_ACL_RANGE_TYPE_L4_SRC_PORT_RANGE
};

set<sai_acl_bind_point_type_t> binds;
for (const auto& portid_pair : ports)
{
Port port;
if (!gPortsOrch->getPort(portid_pair.first, port))
{
continue;
}

switch (port.m_type)
{
case Port::PHY:
binds.insert(SAI_ACL_BIND_POINT_TYPE_PORT);
break;
case Port::VLAN:
binds.insert(SAI_ACL_BIND_POINT_TYPE_VLAN);
break;
case Port::LAG:
binds.insert(SAI_ACL_BIND_POINT_TYPE_LAG);
break;
default:
return SAI_STATUS_FAILURE;
}
}

vector<int32_t> bpoint_list;
for (auto bind : binds)
{
bpoint_list.push_back(bind);
}

vector<int32_t> bpoint_list = { SAI_ACL_BIND_POINT_TYPE_PORT, SAI_ACL_BIND_POINT_TYPE_LAG };
Copy link
Contributor

@qiluo-msft qiluo-msft Jun 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add SAI_ACL_BIND_POINT_TYPE_VLAN? #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, can add this, then we don't need to change the code in the future when deciding to support VLAN.

attr.id = SAI_ACL_TABLE_ATTR_ACL_BIND_POINT_TYPE_LIST;
attr.value.s32list.count = static_cast<uint32_t>(bpoint_list.size());
attr.value.s32list.list = bpoint_list.data();
Expand Down Expand Up @@ -1060,6 +1024,7 @@ bool AclTable::create()

if(stage == ACL_STAGE_INGRESS)
{
int32_t range_types_list[] = { SAI_ACL_RANGE_TYPE_L4_DST_PORT_RANGE, SAI_ACL_RANGE_TYPE_L4_SRC_PORT_RANGE };
attr.id = SAI_ACL_TABLE_ATTR_FIELD_ACL_RANGE_TYPE;
attr.value.s32list.count = (uint32_t)(sizeof(range_types_list) / sizeof(range_types_list[0]));
attr.value.s32list.list = range_types_list;
Expand Down