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

[portsorch] Configure hostif tagging for subports #1573

Merged
merged 3 commits into from
Jan 28, 2021

Conversation

vsenchyshyn
Copy link
Contributor

Signed-off-by: Vitaliy Senchyshyn vsenchyshyn@barefootnetworks.com

What I did
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.

Why I did it
As the parent port hostif tagging is not modified during subports creation the packets destined to the subport interfaces are forwarded as untagged by the packet driver and therefore never reaching the subport netdevs.

How I verified it

Created two subports using the config below and pinged their IPs with vlan 10 and 20 tagged packets respectively. The ping was successful.

{
    "VLAN_SUB_INTERFACE": {
        "Ethernet1.10": {
            "admin_status" : "up"
        },
        "Ethernet1.10|11.0.10.1/24": {},

        "Ethernet1.20": {
            "admin_status" : "up"
        },
        "Ethernet1.20|11.0.20.1/24": {}
    }
}

Details if related

Signed-off-by: Vitaliy Senchyshyn <vsenchyshyn@barefootnetworks.com>
@vsenchyshyn
Copy link
Contributor Author

retest vs please

@vsenchyshyn
Copy link
Contributor Author

@lguohan could you please review?

@vsenchyshyn
Copy link
Contributor Author

@prsunny @stcheng @lguohan Could you please review

@vsenchyshyn
Copy link
Contributor Author

retest vs please

{
if (!parentPort.m_bridge_port_id)
{
if (!setHostIntfsStripTag(port, SAI_HOSTIF_VLAN_TAG_STRIP))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it port or parentPort?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Fixed.

@prsunny
Copy link
Collaborator

prsunny commented Jan 21, 2021

request @wendani to review

{
if (!setHostIntfsStripTag(parentPort, SAI_HOSTIF_VLAN_TAG_STRIP))
{
SWSS_LOG_WARN("Failed to set %s for hostif of port %s",
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the thought for WARN instead of ERROR as above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

== SAI_NULL_OBJECT_ID

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

@wendani
Copy link
Contributor

wendani commented Jan 22, 2021

Can you also validate on the lag parent port case?

@wendani
Copy link
Contributor

wendani commented Jan 22, 2021

Looks relevant to sonic-net/sonic-buildimage#3943

@vsenchyshyn
Copy link
Contributor Author

vsenchyshyn commented Jan 22, 2021

Can you also validate on the lag parent port case?

I'm not sure I can do this. I've applied the following config on a switch running t0 topo config:

{
    "VLAN_SUB_INTERFACE": {
        "PortChannel0001.10": {
            "admin_status" : "up"
        },
        "PortChannel0001.10|11.0.10.1/24": {},

        "PortChannel0001.20": {
            "admin_status" : "up"
        },
        "PortChannel0001.20|11.0.20.1/24": {}
    }
}

But this didn't have any effect - no subinterface PortChannel0001.10 created in linux. The config present in config db only.

@wendani
Copy link
Contributor

wendani commented Jan 23, 2021

Can you also validate on the lag parent port case?

I'm not sure I can do this. I've applied the following config on a switch running t0 topo config:

{
    "VLAN_SUB_INTERFACE": {
        "PortChannel0001.10": {
            "admin_status" : "up"
        },
        "PortChannel0001.10|11.0.10.1/24": {},

        "PortChannel0001.20": {
            "admin_status" : "up"
        },
        "PortChannel0001.20|11.0.20.1/24": {}
    }
}

But this didn't have any effect - no subinterface PortChannel0001.10 created in linux. The config present in config db only.

Keep port channel name within 15 characters. Rename to PortChannel1.10

@OleksandrKozodoi
Copy link

Can you also validate on the lag parent port case?

@wendani I've validated this case.
Steps for validation:

  1. Deploy t0 topology.
  2. Deploy minigrapgh on DUT
  3. Remove member port from Vlan1000 on the DUT
config vlan member del 1000 Ethernet8
  1. Create portchannel on the DUT
config portchannel add PortChannel5 --fallback=true
  1. Add member port to portchannel on the DUT
config portchannel member add PortChannel5 Ethernet8
  1. Setup bond interface on the PTF
ip link add bond2 type bond
ip link set bond2 type bond miimon 100 mode balance-xor
ip link set eth2 down
ip link set eth2 master bond2
ip link set dev bond2 up
ifconfig bond2 hw ether 22:22:22:22:22:21
ifconfig bond2 mtu 9216 up
  1. Setup configuration of sub-ports on the DUT
    sub_port_config.j2:
{
	"VLAN_SUB_INTERFACE": {

		"PortChannel5.10": {
			"admin_status" : "up"
		},
		"PortChannel5.10|172.16.0.5/30": {}
	}
}
sonic-cfggen -j sub_port_config.j2 --write-to-db
  1. Setup configuration of sub-ports on the PTF
ip link add link bond2 name bond2.10 type vlan id 10
ip address add 172.16.0.6/30 dev bond2.10
ip link set bond2.10 up
  1. Ping DUT from PTF
ping -I bond2.10 172.16.0.5

Validation results

/# ping -I bond2.10 172.16.0.5
PING 172.16.0.5 (172.16.0.5) from 172.16.0.6 bond2.10: 56(84) bytes of data.
64 bytes from 172.16.0.5: icmp_seq=1 ttl=64 time=0.405 ms
64 bytes from 172.16.0.5: icmp_seq=2 ttl=64 time=0.445 ms
64 bytes from 172.16.0.5: icmp_seq=3 ttl=64 time=0.771 ms
64 bytes from 172.16.0.5: icmp_seq=4 ttl=64 time=0.746 ms
~$ tcpdump -nei PortChannel5.10
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on PortChannel5.10, link-type EN10MB (Ethernet), capture size 262144 bytes
14:55:19.045230 22:22:22:22:22:21 > 74:83:ef:c9:b4:38, ethertype IPv4 (0x0800), length 98: 172.16.0.6 > 172.16.0.5: ICMP echo request, id 911, seq 1862, length 64
14:55:19.045305 74:83:ef:c9:b4:38 > 22:22:22:22:22:21, ethertype IPv4 (0x0800), length 98: 172.16.0.5 > 172.16.0.6: ICMP echo reply, id 911, seq 1862, length 64
14:55:20.069271 22:22:22:22:22:21 > 74:83:ef:c9:b4:38, ethertype IPv4 (0x0800), length 98: 172.16.0.6 > 172.16.0.5: ICMP echo request, id 911, seq 1863, length 64
14:55:20.069359 74:83:ef:c9:b4:38 > 22:22:22:22:22:21, ethertype IPv4 (0x0800), length 98: 172.16.0.5 > 172.16.0.6: ICMP echo reply, id 911, seq 1863, length 64
14:55:21.093466 22:22:22:22:22:21 > 74:83:ef:c9:b4:38, ethertype IPv4 (0x0800), length 98: 172.16.0.6 > 172.16.0.5: ICMP echo request, id 911, seq 1864, length 64
14:55:21.093536 74:83:ef:c9:b4:38 > 22:22:22:22:22:21, ethertype IPv4 (0x0800), length 98: 172.16.0.5 > 172.16.0.6: ICMP echo reply, id 911, seq 1864, length 64

@prsunny prsunny merged commit 91e231c into sonic-net:master Jan 28, 2021
@vsenchyshyn vsenchyshyn deleted the subport-hostif-tagging-fix branch January 29, 2021 10:00
DavidZagury pushed a commit to DavidZagury/sonic-swss that referenced this pull request Mar 4, 2021
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 <vsenchyshyn@barefootnetworks.com>
daall pushed a commit that referenced this pull request Apr 22, 2021
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 <vsenchyshyn@barefootnetworks.com>
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
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 <vsenchyshyn@barefootnetworks.com>
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.

5 participants