Skip to content

Commit

Permalink
[Subport] Fix issues on portsorch.cpp
Browse files Browse the repository at this point in the history
1. [Subport] Keep vlan tag when add member port into portchannel of subport

When add member port into portchannel, if the portchannel has subport interface,
the port should keep the vlan tag.

2. Handle HostIntfsStripTag properly

removeBridgePort should check port.m_child_ports.empty() before HostIntfsStripTag(,SAI_HOSTIF_VLAN_TAG_STRIP).

3. fix ERR syslog while test_subport setup/teardown

fix 2:

config portchannel add PortChannel1
config interface ip add PortChannel1.40 100.40.40.40/24

config interface ip remove PortChannel1.40 100.40.40.40/24
config portchannel del PortChannel1

syslog:
Dec 27 15:01:38.336049 as5812-54x NOTICE swss#orchagent: :- removeRouterIntfs: Router interface is still referenced
Dec 27 15:01:38.337833 as5812-54x ERR swss#orchagent: :- meta_generic_validation_remove: object 0x2000000000a81 reference count is 1, can't remove
Dec 27 15:01:38.338038 as5812-54x ERR swss#orchagent: :- removeLag: Failed to remove LAG PortChannel1 lid:2000000000a81

root cause:
portchannel is still reference by subport

solution: PortsOrch::doLagTask, op == DEL_COMMAND

=====
fix 3:

syslog:
Dec 24 17:28:01.030970 as5812-54x ERR swss#orchagent: :- meta_sai_validate_oid: oid is set to null object id on SAI_OBJECT_TYPE_LAG_MEMBER
Dec 24 17:28:01.031218 as5812-54x ERR swss#orchagent: :- setCollectionOnLagMember: Failed to enable collection on LAG member Ethernet28

root cause:
PortsOrch::setCollectionOnLagMember/ setDistributionOnLagMember, check lag member id
  • Loading branch information
peter-yu committed Aug 14, 2024
1 parent 3dec9b5 commit f9c0afd
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4835,6 +4835,13 @@ void PortsOrch::doLagTask(Consumer &consumer)
continue;
}

if (!lag.m_child_ports.empty())
{
SWSS_LOG_NOTICE("LAG %s still has subport child, can't be removed", lag.m_alias.c_str());
it++;
continue;
}

if (removeLag(lag))
it = consumer.m_toSync.erase(it);
else
Expand Down Expand Up @@ -5633,12 +5640,14 @@ bool PortsOrch::removeBridgePort(Port &port)
return parseHandleSaiStatusFailure(handle_status);
}
}

if (!setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_STRIP))
if (port.m_child_ports.empty())
{
SWSS_LOG_ERROR("Failed to set %s for hostif of port %s",
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_STRIP], port.m_alias.c_str());
return false;
if (!setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_STRIP))
{
SWSS_LOG_ERROR("Failed to set %s for hostif of port %s",
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_STRIP], port.m_alias.c_str());
return false;
}
}

//Flush the FDB entires corresponding to the port
Expand Down Expand Up @@ -6496,7 +6505,7 @@ bool PortsOrch::addLagMember(Port &lag, Port &port, string member_status)

m_portList[lag.m_alias] = lag;

if (lag.m_bridge_port_id > 0)
if ((lag.m_bridge_port_id > 0) || !lag.m_child_ports.empty())
{
if (!setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_KEEP))
{
Expand Down Expand Up @@ -6544,7 +6553,7 @@ bool PortsOrch::removeLagMember(Port &lag, Port &port)
lag.m_members.erase(port.m_alias);
m_portList[lag.m_alias] = lag;

if (lag.m_bridge_port_id > 0)
if ((lag.m_bridge_port_id > 0) || !lag.m_child_ports.empty())
{
if (!setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_STRIP))
{
Expand Down Expand Up @@ -6601,6 +6610,10 @@ bool PortsOrch::setCollectionOnLagMember(Port &lagMember, bool enableCollection)
{
/* Port must be LAG member */
assert(lagMember.m_lag_member_id);
if (!lagMember.m_lag_member_id)
{
return false;
}

sai_status_t status = SAI_STATUS_FAILURE;
sai_attribute_t attr {};
Expand Down Expand Up @@ -6632,6 +6645,10 @@ bool PortsOrch::setDistributionOnLagMember(Port &lagMember, bool enableDistribut
{
/* Port must be LAG member */
assert(lagMember.m_lag_member_id);
if (!lagMember.m_lag_member_id)
{
return false;
}

sai_status_t status = SAI_STATUS_FAILURE;
sai_attribute_t attr {};
Expand Down

0 comments on commit f9c0afd

Please sign in to comment.