-
Notifications
You must be signed in to change notification settings - Fork 580
[portsorch] Configure hostif tagging for subports #1573
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -702,6 +702,17 @@ bool PortsOrch::addSubPort(Port &port, const string &alias, const bool &adminUp, | |
} | ||
p.m_vlan_info.vlan_id = vlan_id; | ||
|
||
// Change hostif vlan tag for the parent port only when a first subport is created | ||
if (parentPort.m_child_ports.empty()) | ||
{ | ||
if (!setHostIntfsStripTag(parentPort, SAI_HOSTIF_VLAN_TAG_KEEP)) | ||
{ | ||
SWSS_LOG_ERROR("Failed to set %s for hostif of port %s", | ||
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_KEEP], parentPort.m_alias.c_str()); | ||
return false; | ||
} | ||
} | ||
|
||
parentPort.m_child_ports.insert(p.m_alias); | ||
|
||
m_portList[alias] = p; | ||
|
@@ -738,6 +749,21 @@ bool PortsOrch::removeSubPort(const string &alias) | |
m_portList[parentPort.m_alias] = parentPort; | ||
|
||
m_portList.erase(it); | ||
|
||
// Restore hostif vlan tag for the parent port when the last subport is removed | ||
if (parentPort.m_child_ports.empty()) | ||
{ | ||
if (!parentPort.m_bridge_port_id) | ||
{ | ||
if (!setHostIntfsStripTag(parentPort, SAI_HOSTIF_VLAN_TAG_STRIP)) | ||
{ | ||
SWSS_LOG_WARN("Failed to set %s for hostif of port %s", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the thought for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copy & paste from the log right above in the function. Didn't notice that there is no return false. |
||
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_STRIP], parentPort.m_alias.c_str()); | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== SAI_NULL_OBJECT_ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done