Skip to content

Commit

Permalink
Merge branch 'master' into fec_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsudharsan authored Aug 11, 2023
2 parents f785df9 + 7251623 commit 3ba56d5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 74 deletions.
5 changes: 0 additions & 5 deletions orchagent/p4orch/tests/fake_portorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,6 @@ bool PortsOrch::setDistributionOnLagMember(Port &lagMember, bool enableDistribut
return true;
}

bool PortsOrch::addPort(const PortConfig &port)
{
return true;
}

sai_status_t PortsOrch::removePort(sai_object_id_t port_id)
{
return SAI_STATUS_SUCCESS;
Expand Down
68 changes: 0 additions & 68 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2959,74 +2959,6 @@ void PortsOrch::updateDbPortOperStatus(const Port& port, sai_port_oper_status_t
m_portTable->set(port.m_alias, tuples);
}

bool PortsOrch::addPort(const PortConfig &port)
{
SWSS_LOG_ENTER();

if (!port.speed.is_set || !port.lanes.is_set)
{
/*
speed and lane list are mandatory attributes for the initial create_port call
This check is required because the incoming notifs may not be atomic
*/
return true;
}

vector<uint32_t> lanes(port.lanes.value.begin(), port.lanes.value.end());

sai_attribute_t attr;
vector<sai_attribute_t> attrs;

attr.id = SAI_PORT_ATTR_SPEED;
attr.value.u32 = port.speed.value;
attrs.push_back(attr);

attr.id = SAI_PORT_ATTR_HW_LANE_LIST;
attr.value.u32list.list = lanes.data();
attr.value.u32list.count = static_cast<uint32_t>(lanes.size());
attrs.push_back(attr);

if (port.autoneg.is_set)
{
attr.id = SAI_PORT_ATTR_AUTO_NEG_MODE;
attr.value.booldata = port.autoneg.value;
attrs.push_back(attr);
}

if (port.fec.is_set)
{
attr.id = SAI_PORT_ATTR_FEC_MODE;
attr.value.s32 = port.fec.value;
attrs.push_back(attr);
}

sai_object_id_t port_id;
sai_status_t status = sai_port_api->create_port(&port_id, gSwitchId, static_cast<uint32_t>(attrs.size()), attrs.data());
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create port with the speed %u, rv:%d", port.speed.value, status);
task_process_status handle_status = handleSaiCreateStatus(SAI_API_PORT, status);
if (handle_status != task_success)
{
return parseHandleSaiStatusFailure(handle_status);
}
}

m_portListLaneMap[port.lanes.value] = port_id;
m_portCount++;

// newly created ports might be put in the default vlan so remove all ports from
// the default vlan.
if (gMySwitchType == "voq") {
removeDefaultVlanMembers();
removeDefaultBridgePorts();
}

SWSS_LOG_NOTICE("Create port %" PRIx64 " with the speed %u", port_id, port.speed.value);

return true;
}

sai_status_t PortsOrch::removePort(sai_object_id_t port_id)
{
SWSS_LOG_ENTER();
Expand Down
1 change: 0 additions & 1 deletion orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ class PortsOrch : public Orch, public Subject
bool setCollectionOnLagMember(Port &lagMember, bool enableCollection);
bool setDistributionOnLagMember(Port &lagMember, bool enableDistribution);

bool addPort(const PortConfig &port);
sai_status_t removePort(sai_object_id_t port_id);
bool initPort(const PortConfig &port);
void deInitPort(string alias, sai_object_id_t port_id);
Expand Down

0 comments on commit 3ba56d5

Please sign in to comment.