Skip to content

Commit 91e231c

Browse files
authored
[portsorch] Configure hostif tagging for subports (#1573)
Configure SAI_HOSTIF_VLAN_TAG_KEEP for the parent port hostif when a first subport is added and restore it to SAI_HOSTIF_VLAN_TAG_STRIP when the last subport is removed. Signed-off-by: Vitaliy Senchyshyn <vsenchyshyn@barefootnetworks.com>
1 parent 008325c commit 91e231c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

orchagent/portsorch.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,17 @@ bool PortsOrch::addSubPort(Port &port, const string &alias, const bool &adminUp,
706706
}
707707
p.m_vlan_info.vlan_id = vlan_id;
708708

709+
// Change hostif vlan tag for the parent port only when a first subport is created
710+
if (parentPort.m_child_ports.empty())
711+
{
712+
if (!setHostIntfsStripTag(parentPort, SAI_HOSTIF_VLAN_TAG_KEEP))
713+
{
714+
SWSS_LOG_ERROR("Failed to set %s for hostif of port %s",
715+
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_KEEP], parentPort.m_alias.c_str());
716+
return false;
717+
}
718+
}
719+
709720
parentPort.m_child_ports.insert(p.m_alias);
710721

711722
m_portList[alias] = p;
@@ -742,6 +753,21 @@ bool PortsOrch::removeSubPort(const string &alias)
742753
m_portList[parentPort.m_alias] = parentPort;
743754

744755
m_portList.erase(it);
756+
757+
// Restore hostif vlan tag for the parent port when the last subport is removed
758+
if (parentPort.m_child_ports.empty())
759+
{
760+
if (parentPort.m_bridge_port_id == SAI_NULL_OBJECT_ID)
761+
{
762+
if (!setHostIntfsStripTag(parentPort, SAI_HOSTIF_VLAN_TAG_STRIP))
763+
{
764+
SWSS_LOG_ERROR("Failed to set %s for hostif of port %s",
765+
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_STRIP], parentPort.m_alias.c_str());
766+
return false;
767+
}
768+
}
769+
}
770+
745771
return true;
746772
}
747773

0 commit comments

Comments
 (0)