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

[orchagent]: Support LAG/VLAN with SAI 1.0 #250

Merged
merged 2 commits into from
Jul 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions orchagent/fdborch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

extern sai_fdb_api_t *sai_fdb_api;

void FdbOrch::update(sai_fdb_event_t type, const sai_fdb_entry_t* entry, sai_object_id_t portOid)
void FdbOrch::update(sai_fdb_event_t type, const sai_fdb_entry_t* entry, sai_object_id_t bridge_port_id)
{
SWSS_LOG_ENTER();

Expand All @@ -19,9 +19,9 @@ void FdbOrch::update(sai_fdb_event_t type, const sai_fdb_entry_t* entry, sai_obj
switch (type)
{
case SAI_FDB_EVENT_LEARNED:
if (!m_portsOrch->getBridgePort(portOid, update.port))
if (!m_portsOrch->getPortByBridgePortId(bridge_port_id, update.port))
{
SWSS_LOG_ERROR("Failed to get port for %lu OID", portOid);
SWSS_LOG_ERROR("Failed to get port by bridge port ID %lu", bridge_port_id);
return;
}

Expand Down Expand Up @@ -60,13 +60,14 @@ bool FdbOrch::getPort(const MacAddress& mac, uint16_t vlan, Port& port)
sai_status_t status = sai_fdb_api->get_fdb_entry_attribute(&entry, 1, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to get port for FDB entry OID");
SWSS_LOG_ERROR("Failed to get bridge port ID for FDB entry %s, rv:%d",
mac.to_string().c_str(), status);
return false;
}

if (!m_portsOrch->getBridgePort(attr.value.oid, port))
if (!m_portsOrch->getPortByBridgePortId(attr.value.oid, port))
{
SWSS_LOG_ERROR("Failed to get port for %lu OID", attr.value.oid);
SWSS_LOG_ERROR("Failed to get port by bridge port ID %lu", attr.value.oid);
return false;
}

Expand Down
10 changes: 4 additions & 6 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@ bool IntfsOrch::addRouterIntfs(Port &port)
return true;
}

if (port.m_type == Port::PHY)
{
gPortsOrch->removeBridgePort(port);
}

/* Create router interface if the router interface doesn't exist */
sai_attribute_t attr;
vector<sai_attribute_t> attrs;
Expand Down Expand Up @@ -365,8 +360,11 @@ void IntfsOrch::addIp2MeRoute(const IpPrefix &ip_prefix)
attr.value.s32 = SAI_PACKET_ACTION_FORWARD;
attrs.push_back(attr);

Port cpu_port;
gPortsOrch->getCpuPort(cpu_port);
Copy link
Contributor

@qiluo-msft qiluo-msft Jul 11, 2017

Choose a reason for hiding this comment

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

getCpuPort [](start = 16, length = 10)

check return value #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the function is void. if CPU port is not get successfully, portsOrch class is not initialized and orchagent will throw exception.


In reply to: 126777033 [](ancestors = 126777033)


attr.id = SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID;
attr.value.oid = gPortsOrch->getCpuPort();
attr.value.oid = cpu_port.m_port_id;
attrs.push_back(attr);

sai_status_t status = sai_route_api->create_route_entry(&unicast_route_entry, attrs.size(), attrs.data());
Expand Down
1 change: 1 addition & 0 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Port
int m_ifindex = 0;
sai_object_id_t m_port_id = 0;
sai_object_id_t m_vlan_oid = 0;
sai_object_id_t m_bridge_port_id = 0; // TODO: port could have multiple bridge port IDs
sai_vlan_id_t m_vlan_id = 0;
sai_vlan_id_t m_port_vlan_id = DEFAULT_PORT_VLAN_ID; // Port VLAN ID
sai_object_id_t m_vlan_member_id = 0;
Expand Down
Loading