Skip to content

Commit ed32e33

Browse files
vsenchyshyndaall
authored andcommitted
[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 <[email protected]>
1 parent b5209c4 commit ed32e33

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
@@ -715,6 +715,17 @@ bool PortsOrch::addSubPort(Port &port, const string &alias, const bool &adminUp,
715715
}
716716
p.m_vlan_info.vlan_id = vlan_id;
717717

718+
// Change hostif vlan tag for the parent port only when a first subport is created
719+
if (parentPort.m_child_ports.empty())
720+
{
721+
if (!setHostIntfsStripTag(parentPort, SAI_HOSTIF_VLAN_TAG_KEEP))
722+
{
723+
SWSS_LOG_ERROR("Failed to set %s for hostif of port %s",
724+
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_KEEP], parentPort.m_alias.c_str());
725+
return false;
726+
}
727+
}
728+
718729
parentPort.m_child_ports.insert(p.m_alias);
719730

720731
m_portList[alias] = p;
@@ -751,6 +762,21 @@ bool PortsOrch::removeSubPort(const string &alias)
751762
m_portList[parentPort.m_alias] = parentPort;
752763

753764
m_portList.erase(it);
765+
766+
// Restore hostif vlan tag for the parent port when the last subport is removed
767+
if (parentPort.m_child_ports.empty())
768+
{
769+
if (parentPort.m_bridge_port_id == SAI_NULL_OBJECT_ID)
770+
{
771+
if (!setHostIntfsStripTag(parentPort, SAI_HOSTIF_VLAN_TAG_STRIP))
772+
{
773+
SWSS_LOG_ERROR("Failed to set %s for hostif of port %s",
774+
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_STRIP], parentPort.m_alias.c_str());
775+
return false;
776+
}
777+
}
778+
}
779+
754780
return true;
755781
}
756782

0 commit comments

Comments
 (0)