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

[PortsOrch] Init Port paramter with port speed & an & FEC from APP DB, #960

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,7 @@ string PortsOrch::getPriorityGroupWatermarkFlexCounterTableKey(string key)
return string(PG_WATERMARK_STAT_COUNTER_FLEX_COUNTER_GROUP) + ":" + key;
}

bool PortsOrch::initPort(const string &alias, const set<int> &lane_set)
bool PortsOrch::initPort(const string &alias, const set<int> &lane_set, uint32_t speed, int an, string fec_mode)
{
SWSS_LOG_ENTER();

Expand All @@ -1359,6 +1359,12 @@ bool PortsOrch::initPort(const string &alias, const set<int> &lane_set)

p.m_index = static_cast<int32_t>(m_portList.size()); // TODO: Assume no deletion of physical port
p.m_port_id = id;
if (!fec_mode.empty())
if (fec_mode_map.find(fec_mode) != fec_mode_map.end())
p.m_fec_mode = fec_mode_map[fec_mode];
p.m_speed = speed;
if (an != -1)
p.m_autoneg = an;

/* Initialize the port and create corresponding host interface */
if (initializePort(p))
Expand Down Expand Up @@ -1672,7 +1678,7 @@ void PortsOrch::doPortTask(Consumer &consumer)

if (port_created)
{
if (!initPort(get<0>(it->second), it->first))
if (!initPort(get<0>(it->second), it->first, get<1>(it->second), get<2>(it->second), get<3>(it->second)))
{
throw runtime_error("PortsOrch initialization failure.");
}
Expand Down
2 changes: 1 addition & 1 deletion orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class PortsOrch : public Orch, public Subject

bool addPort(const set<int> &lane_set, uint32_t speed, int an=0, string fec="");
bool removePort(sai_object_id_t port_id);
bool initPort(const string &alias, const set<int> &lane_set);
bool initPort(const string &alias, const set<int> &lane_set, uint32_t speed, int an, string fec_mode);

bool setPortAdminStatus(sai_object_id_t id, bool up);
bool getPortAdminStatus(sai_object_id_t id, bool& up);
Expand Down