Skip to content
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

Merged
merged 3 commits into from
Dec 7, 2017

Conversation

jipanyang
Copy link
Contributor

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

@jipanyang
Copy link
Contributor Author

The PR has dependency on #327

@@ -1462,6 +1531,17 @@ bool PortsOrch::addLagMember(Port lag, Port port)

m_portList[lag.m_alias] = lag;

if (lag.m_vlan_members.size() > 0)
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

@lguohan lguohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as comments.

Copy link
Contributor

@stcheng stcheng left a 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());
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1179,6 +1233,13 @@ bool PortsOrch::addBridgePort(Port &port)
return false;
}

bool rv = setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_KEEP);
Copy link
Contributor

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.

@lguohan
Copy link
Contributor

lguohan commented Oct 17, 2017

@JipanYanga , can you rebase your code and resolve the conflict?

@jipanyang
Copy link
Contributor Author

jipanyang commented Oct 18, 2017

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
for attribute SAI_HOSTIF_ATTR_VLAN_TAG in both sai_create_hostif_fn() and sai_set_hostif_attribute_fn().

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

Copy link
Contributor

@stcheng stcheng left a 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

}
else
{
SWSS_LOG_ERROR("PortsOrch::setPortPvid port type %d not supported", port.m_type);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@lguohan
Copy link
Contributor

lguohan commented Oct 23, 2017

@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.

@jipanyang
Copy link
Contributor Author

jipanyang commented Oct 26, 2017

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.
While the two attributes or the better attribute SAI_HOSTIF_VLAN_TAG_ORIGINAL is mandatory for VLAN trunk support.

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.
We may just remove that line of code from the function once libsai support is ready which should happen really soon.

* Port has been removed from 1q bridge at PortsOrch constructor,
* also start stripping off VLAN tag.
*/
setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_STRIP);
Copy link
Contributor

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;
}
Copy link
Contributor

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;
}
Copy link
Contributor

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)
Copy link
Contributor

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.

Copy link
Contributor

@lguohan lguohan left a 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>
@lguohan
Copy link
Contributor

lguohan commented Dec 7, 2017

retest this please

@lguohan lguohan merged commit ff90429 into sonic-net:master Dec 7, 2017
@jipanyang jipanyang deleted the hostif_tag_processing branch June 5, 2018 00:30
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
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>
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-swss that referenced this pull request Mar 1, 2023
* 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
lukasstockner pushed a commit to genesiscloud/sonic-swss that referenced this pull request Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants