-
Notifications
You must be signed in to change notification settings - Fork 539
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
Orchagent: Host interface tag processing #328
Conversation
The PR has dependency on #327 |
orchagent/portsorch.cpp
Outdated
@@ -1462,6 +1531,17 @@ bool PortsOrch::addLagMember(Port lag, Port port) | |||
|
|||
m_portList[lag.m_alias] = lag; | |||
|
|||
if (lag.m_vlan_members.size() > 0) |
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.
if (lag.m_vlan_members.size() > 0) [](start = 4, length = 34)
this criteria is a little bit indirect, it is better to check if lag is a bridge port or not (do we have an attribute to indicate if the lag is a bridge port or not), if it is then set to keep.
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.
to check if a lag is a bridge port or not, could we check the m_bridge_port_id variable? we're ensuring that once a port is added to a bridge port, we assign this id, once the bridge port is removed, we reset this 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.
as comments.
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.
See comments.
if (status != SAI_STATUS_SUCCESS) | ||
{ | ||
SWSS_LOG_ERROR("Failed to set %s to host interface %s", | ||
hostif_vlan_tag[strip], p.m_alias.c_str()); |
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.
align the spaces, or just use 8 spaces. same below.
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
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
orchagent/portsorch.cpp
Outdated
@@ -1179,6 +1233,13 @@ bool PortsOrch::addBridgePort(Port &port) | |||
return false; | |||
} | |||
|
|||
bool rv = setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_KEEP); |
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.
just use if (!setHostIntfsStripTag)
is fine. same below.
cd53052
to
30c5722
Compare
@JipanYanga , can you rebase your code and resolve the conflict? |
30c5722
to
6385898
Compare
I did a rebase against master branch. Before the possible merge for this PR is done, the libsai from ASIC vendors should support SAI_HOSTIF_VLAN_TAG_STRIP and SAI_HOSTIF_VLAN_TAG_KEEP The broadcom libsai I tested has support for them from 3.0.3.3. Current version of broadcom libsai in sonic-buildimage repo is 3.0.3.2-6 . https://github.com/Azure/sonic-buildimage/blob/master/platform/broadcom/sai.mk |
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.
please see my comment
orchagent/portsorch.cpp
Outdated
} | ||
else | ||
{ | ||
SWSS_LOG_ERROR("PortsOrch::setPortPvid port type %d not supported", port.m_type); |
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.
the log is not correct
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.
fixed.
6385898
to
24e3f6d
Compare
@JipanYanga , 3.0.3.2-6 does not support STRIP/KEEP attribute value, it will cause the T0 to break. For normal VLAN scenario, can we still use STRIP option and setup the pvid in the kernel to make it work? That seems to be the only way I can merge this PR right now. |
So the official libsai from some ASIC vendors don't have support for attributes "SAI_HOSTIF_VLAN_TAG_STRIP and SAI_HOSTIF_VLAN_TAG_KEE" in sai_hostif_vlan_tag_t. We may put "return true;" at the beginning of bool PortsOrch::setHostIntfsStripTag(Port &port, sai_hostif_vlan_tag_t strip), some the existing access vlan function won't be affected by the libsai issue. |
orchagent/portsorch.cpp
Outdated
* Port has been removed from 1q bridge at PortsOrch constructor, | ||
* also start stripping off VLAN tag. | ||
*/ | ||
setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_STRIP); |
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.
by default, it is stripped, so you do not call this.
SWSS_LOG_ERROR("Failed to set %s for hostif of port %s", | ||
hostif_vlan_tag[SAI_HOSTIF_VLAN_TAG_KEEP], port.m_alias.c_str()); | ||
return false; | ||
} |
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.
let's move this to addVlanMember(), in the untagged mode, we do not need to call KEEP.
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; | ||
} |
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.
move this to removeVlanMember()
@@ -1772,6 +1839,15 @@ bool PortsOrch::addLagMember(Port &lag, Port &port) | |||
|
|||
m_portList[lag.m_alias] = lag; | |||
|
|||
if (lag.m_bridge_port_id > 0) |
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.
also check if the port belongs to multiple vlans or not, if yes then add keep, otherwise do not need to do anything.
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.
avoid set vlan_tag attribute when the port is in untagged vlan mode.
Before SAI_HOSTIF_VLAN_TAG_ORIGINAL is supported by libsai from all asic vendors, the VLAN tag on hostif is explicitly controlled with SAI_HOSTIF_VLAN_TAG_STRIP & SAI_HOSTIF_VLAN_TAG_KEEP attributes. When a port/LAG is in 1Q bridge, SAI_HOSTIF_VLAN_TAG_KEEP is set for SAI_HOSTIF_ATTR_VLAN_TAG, for all other cases SAI_HOSTIF_VLAN_TAG_STRIP will be used. Signed-off-by: Jipan Yang <jipan.yang@alibaba-inc.com>
…TRIP explicitly at init. Signed-off-by: Jipan Yang <jipan.yang@alibaba-inc.com>
24e3f6d
to
1a473c3
Compare
retest this please |
config portchannel add <portchannel_name> config portchannel del <portchannel_name> config portchannel member add <portchannel_name> <port_name> config portchannel member del <portchannel_name> <port_name> Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
* initial barefoot checkin october 2017 * Revert "Merge branch 'master' of https://github.com/Azure/sonic-sairedis into rel_6_0" This reverts commit c48a7a20de2fb9e615535481f8727029440413bc, reversing changes made to aa5bf640db7b7fca245c1669eeb02198a50cb5c1. * missed integration diffs * Added new attr type support to sairedis. Also, some fixes for compilation issues * Changes to add new DTel api support in sairedis * Add new file to generate Dtel specific SAI stub API * Missed adding a file in the last commit * Fix ref point for SAI * Updated SAI repo to point to dtel_exp * Changes to handle new additions to DTel experimental SAI. Not compiled yet * handle platform specific lins in different directory (@runtime) * force order of library path to look for platform dir before lib dir * Change SAI branch refpoint * Update SAI submodule refpoint * enable fast-boot for barefoot platforms * Update ref point for SAI * SONiC changes due to DTel experimental SAI changes * allow Makefile to build for other platforms - restore it original for non-bfn platforms * allow clean build * Revert "allow clean build" This reverts commit adfdb8642fe0b5dbb4e19d13871172a03a8c883b. * Revert "allow Makefile to build for other platforms - restore it original for non-bfn platforms" This reverts commit d6b0ca34fcf63d0b79c801cd95d7ee2fe58d21ac. * makefile cleanup towards upstream * Support for platforms based on Barefoot Networks' device (sonic-net#304) * search for exact string - newer onie versions match multiple lines * Will need to revert this Should work without this change. Untested for now * SONiC sairedis changes needed to work with SAIv1.3 * Fix SAI path in gitmodules and add a comment * Remove sai thrift build hack * enable fast-boot for barefoot platforms * enable fast-boot for barefoot platforms * Add missing sai rpc hdr file path for bfn * Update SAI ref points * Multi p4 profile support for bfn sde (#5) * Remove code duplicated in merge * Keep fn in same order as azure master (sonic-net#8) * Address review comment * Link just bfn sai lib and shorten linking command by removing other libraries linked at compile time (#6) * Link only bfn sai lib * all unresolved symbols resolved at runtime * Preload some bfn libraries on syncd startup * Build fix * also remove commented code * Convert tabs to spaces * Fix alignment * Address upstream comment * BFN: link with just sai library for saisdkdump * Address review comments
Before SAI_HOSTIF_VLAN_TAG_ORIGINAL is supported by libsai from all asic vendors, the VLAN tag on hostif is explicitly controlled with SAI_HOSTIF_VLAN_TAG_STRIP & SAI_HOSTIF_VLAN_TAG_KEEP attributes.
When a port/LAG is in 1Q bridge, SAI_HOSTIF_VLAN_TAG_KEEP is set for SAI_HOSTIF_ATTR_VLAN_TAG, for all other cases SAI_HOSTIF_VLAN_TAG_STRIP will be used.
Signed-off-by: Jipan Yang jipan.yang@alibaba-inc.com
What I did
Add support for hostif VLAN tag processing support.
Why I did it
With VLAN trunk feature, it is necessary to have packet trapped to host with right VLAN tag.
How I verified it
Tested with whole VLAN trunk feature, please refer to VLAN trunk test cases.
Details if related