From 7c7c4513112177d780cf43697754ed3db51d7e1c Mon Sep 17 00:00:00 2001 From: Song Yuan <64041228+ysmanman@users.noreply.github.com> Date: Tue, 6 Jul 2021 08:14:25 -0700 Subject: [PATCH] Revert recirc port change (#1813) Recirc port support has been added to recent versions of DNX SAI. The earlier special handling for recirc port is not required anymore and thus reverted. --- orchagent/portsorch.cpp | 94 +++-------------------------------------- orchagent/portsorch.h | 1 - 2 files changed, 5 insertions(+), 90 deletions(-) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index a699ddded126..9b22a551b543 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -2235,11 +2235,6 @@ bool PortsOrch::initPort(const string &alias, const string &role, const int inde { SWSS_LOG_ENTER(); - if (role == "Rec" || role == "Inb") - { - return doProcessRecircPort(alias, role, lane_set, SET_COMMAND); - } - /* Determine if the lane combination exists in switch */ if (m_portListLaneMap.find(lane_set) != m_portListLaneMap.end()) { @@ -2294,6 +2289,11 @@ bool PortsOrch::initPort(const string &alias, const string &role, const int inde m_portList[alias].m_init = true; + if (role == "Rec" || role == "Inb") + { + m_recircPortRole[alias] = role; + } + SWSS_LOG_NOTICE("Initialized port %s", alias.c_str()); } else @@ -2756,16 +2756,6 @@ void PortsOrch::doPortTask(Consumer &consumer) } else { - /* Skip configuring recirc port for now because the current SAI implementation of some vendors - * have limiited support for recirc port. This check can be removed once SAI implementation - * is enhanced/changed in the future. - */ - if (m_recircPortRole.find(alias) != m_recircPortRole.end()) - { - it = consumer.m_toSync.erase(it); - continue; - } - if (!an_str.empty()) { if (autoneg_mode_map.find(an_str) == autoneg_mode_map.end()) @@ -5955,80 +5945,6 @@ bool PortsOrch::getRecircPort(Port &port, string role) return false; } -bool PortsOrch::doProcessRecircPort(string alias, string role, set lane_set, string op) -{ - SWSS_LOG_ENTER(); - - if (op == SET_COMMAND) - { - if (m_recircPortRole.find(alias) != m_recircPortRole.end()) - { - SWSS_LOG_DEBUG("Recirc port %s already added", alias.c_str()); - return true; - } - - /* Find pid of recirc port */ - sai_object_id_t port_id = SAI_NULL_OBJECT_ID; - if (m_portListLaneMap.find(lane_set) != m_portListLaneMap.end()) - { - port_id = m_portListLaneMap[lane_set]; - } - - if (port_id == SAI_NULL_OBJECT_ID) - { - SWSS_LOG_ERROR("Failed to find port id for recirc port %s", alias.c_str()); - return false; - } - - Port p(alias, Port::PHY); - p.m_port_id = port_id; - p.m_init = true; - m_recircPortRole[alias] = role; - setPort(alias, p); - - string lane_str = ""; - for (auto lane : lane_set) - { - lane_str += to_string(lane) + " "; - } - SWSS_LOG_NOTICE("Added recirc port %s, pid:%" PRIx64 " lanes:%s", - alias.c_str(), port_id, lane_str.c_str()); - - /* Create host intf for recirc port */ - if(addHostIntfs(p, p.m_alias, p.m_hif_id)) - { - SWSS_LOG_NOTICE("Created host intf for recycle port %s", p.m_alias.c_str()); - } - else - { - SWSS_LOG_ERROR("Failed to Create host intf for recirc port %s", p.m_alias.c_str()); - } - - if(setHostIntfsOperStatus(p, true)) - { - SWSS_LOG_NOTICE("Set host intf oper status UP for recirc port %s", p.m_alias.c_str()); - } - else - { - SWSS_LOG_ERROR("Failed to set host intf oper status for recirc port %s", p.m_alias.c_str()); - } - - PortUpdate update = { p, true }; - notify(SUBJECT_TYPE_PORT_CHANGE, static_cast(&update)); - return true; - } - else if (op == DEL_COMMAND) - { - SWSS_LOG_ERROR("Delete recirc port is not supported."); - return false; - } - else - { - SWSS_LOG_ERROR("Unknown operation type %s", op.c_str()); - return false; - } -} - bool PortsOrch::addSystemPorts() { vector keys; diff --git a/orchagent/portsorch.h b/orchagent/portsorch.h index c29b59837f1b..22efce3561dd 100755 --- a/orchagent/portsorch.h +++ b/orchagent/portsorch.h @@ -324,7 +324,6 @@ class PortsOrch : public Orch, public Subject bool initGearboxPort(Port &port); map m_recircPortRole; - bool doProcessRecircPort(string alias, string role, set laneSet, string op); //map key is tuple of map, sai_object_id_t> m_systemPortOidMap;