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

[202211][ppi]: General code cleanup: remove unused methods (#2867) #2868

Merged
merged 1 commit into from
Sep 25, 2023
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
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
61 changes: 0 additions & 61 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2889,67 +2889,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++;

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 @@ -341,7 +341,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
Loading