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

Fix VLAN error introduced with new 4.9 kernel behavior #1001

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

jipanyang
Copy link
Contributor

Signed-off-by: Jipan Yang [email protected]

What I did
The change includes two parts:

<1> Bring member out of default VLAN 1 upon putting port/lag in a VLAN

<2> Second part was done by @tieguoevan ( https://github.com/tieguoevan) and incorporated here to avoid test error that would follow change <1>.

Summary:
The Bridge interface needs to be up all the time. Otherwise, the command bridge vlan will fail.
Not sure it is a kernel bug, but it cause error when clear all vlan members and reconfigure it.

create a dummy interface in the Bridge to keep it up all the time

Without change <2>

root@bc133f3f180f:/var/log# /sbin/bridge vlan add vid 2 dev Bridge self
RTNETLINK answers: Invalid argument
root@bc133f3f180f:/var/log# echo $?
255
root@bc133f3f180f:/var/log# bridge vlan 
port	vlan ids
Bridge	None
root@bc133f3f180f:/var/log# bridge vlan  add vid 2 dev Bridge self
RTNETLINK answers: Invalid argument
root@bc133f3f180f:/var/log# bridge vlan
port	vlan ids
Bridge	None
root@bc133f3f180f:/var/log# bridge vlan  add vid 2 dev Bridge self
RTNETLINK answers: Invalid argument
root@bc133f3f180f:/var/log# bridge vlan  add vid 2 dev Bridge      
RTNETLINK answers: Operation not supported
root@bc133f3f180f:/var/log# bridge vlan  add vid 2 dev Bridge self
RTNETLINK answers: Invalid argument
root@bc133f3f180f:/var/log# bridge vlan  add vid 2 dev Bridge self
RTNETLINK answers: Invalid argument
root@bc133f3f180f:/var/log# 
root@bc133f3f180f:/var/log# 
root@bc133f3f180f:/var/log# bridge vlan  add vid 2 dev Bridge self
RTNETLINK answers: Invalid argument
root@bc133f3f180f:/var/log# bridge vlan
port	vlan ids
Bridge	None
root@bc133f3f180f:/var/log# bridge vlan del vid 2 dev Bridge self
root@bc133f3f180f:/var/log# echo $?
0
root@bc133f3f180f:/var/log# bridge vlan  add vid 2 dev Bridge self
RTNETLINK answers: Invalid argument
jipan@jipan_sonic_vm_150:~/upstream/sonic-buildimage/src/sonic-swss/tests$ sudo pytest -v --dvsname=vs  test_vlan.py  -x
===================================================================== test session starts =====================================================================
platform linux2 -- Python 2.7.15rc1, pytest-3.3.0, py-1.5.3, pluggy-0.6.0 -- /usr/bin/python
cachedir: .cache
rootdir: /home/jipan/upstream/sonic-buildimage/src/sonic-swss/tests, inifile:
collected 15 items                                                                                                                                            

test_vlan.py::TestVlan::test_VlanAddRemove PASSED                                                                                                       [  6%]
test_vlan.py::TestVlan::test_MultipleVlan PASSED                                                                                                        [ 13%]
test_vlan.py::TestVlan::test_VlanIncrementalConfig FAILED                                                                                               [ 20%]

========================================================================== FAILURES ===========================================================================
_____________________________________________________________ TestVlan.test_VlanIncrementalConfig _____________________________________________________________

self = <test_vlan.TestVlan object at 0x7f11214c2e50>, dvs = <conftest.DockerVirtualSwitch object at 0x7f11214e05d0>
testlog = <function testlog at 0x7f1122e3f7d0>

    def test_VlanIncrementalConfig(self, dvs, testlog):
        dvs.setup_db()
    
        # create vlan
        dvs.create_vlan("2")
    
        # check asic database
        tbl = swsscommon.Table(dvs.adb, "ASIC_STATE:SAI_OBJECT_TYPE_VLAN")
        vlan_entries = [k for k in tbl.getKeys() if k != dvs.asicdb.default_vlan_id]
>       assert len(vlan_entries) == 1
E       assert 0 == 1
E        +  where 0 = len([])

test_vlan.py:184: AssertionError

Why I did it

Fix
#998
sonic-net/sonic-buildimage#2658

and
How I verified it

Details if related

@lguohan
Copy link
Contributor

lguohan commented Jul 30, 2019

retest this please

@lguohan
Copy link
Contributor

lguohan commented Jul 31, 2019

admin@str-s6100-acs-2:~$ show vlan brief
+-----------+----------------+------------+----------------+-----------------------+
|   VLAN ID | IP Address     | Ports      | Port Tagging   | DHCP Helper Address   |
+===========+================+============+================+=======================+
|      1000 | 192.168.0.1/21 | Ethernet6  | untagged       | 192.0.0.1             |
|           |                | Ethernet7  | untagged       | 192.0.0.2             |
|           |                | Ethernet8  | untagged       | 192.0.0.3             |
|           |                | Ethernet9  | untagged       | 192.0.0.4             |
|           |                | Ethernet10 | untagged       | 192.0.0.5             |
|           |                | Ethernet11 | untagged       | 192.0.0.6             |
|           |                | Ethernet12 | untagged       | 192.0.0.7             |
|           |                | Ethernet13 | untagged       | 192.0.0.8             |
|           |                | Ethernet14 | untagged       | 192.0.0.9             |
|           |                | Ethernet15 | untagged       | 192.0.0.10            |
|           |                | Ethernet22 | untagged       | 192.0.0.11            |
|           |                | Ethernet23 | untagged       | 192.0.0.12            |
|           |                | Ethernet24 | untagged       | 192.0.0.13            |
|           |                | Ethernet25 | untagged       | 192.0.0.14            |
|           |                | Ethernet26 | untagged       | 192.0.0.15            |
|           |                | Ethernet27 | untagged       | 192.0.0.16            |
|           |                | Ethernet28 | untagged       | 192.0.0.17            |
|           |                | Ethernet29 | untagged       | 192.0.0.18            |
|           |                | Ethernet30 | untagged       | 192.0.0.19            |
|           |                | Ethernet31 | untagged       | 192.0.0.20            |
|           |                | Ethernet32 | untagged       | 192.0.0.21            |
|           |                | Ethernet36 | untagged       | 192.0.0.22            |
|           |                | Ethernet37 | untagged       | 192.0.0.23            |
|           |                | Ethernet38 | untagged       | 192.0.0.24            |
|           |                | Ethernet39 | untagged       | 192.0.0.25            |
|           |                | Ethernet40 | untagged       | 192.0.0.26            |
|           |                | Ethernet41 | untagged       | 192.0.0.27            |
|           |                | Ethernet42 | untagged       | 192.0.0.28            |
|           |                | Ethernet48 | untagged       | 192.0.0.29            |
|           |                | Ethernet52 | untagged       | 192.0.0.30            |
|           |                | Ethernet53 | untagged       | 192.0.0.31            |
|           |                | Ethernet54 | untagged       | 192.0.0.32            |
|           |                | Ethernet55 | untagged       | 192.0.0.33            |
|           |                | Ethernet56 | untagged       | 192.0.0.34            |
|           |                | Ethernet57 | untagged       | 192.0.0.35            |
|           |                | Ethernet58 | untagged       | 192.0.0.36            |
|           |                |            |                | 192.0.0.37            |
|           |                |            |                | 192.0.0.38            |
|           |                |            |                | 192.0.0.39            |
|           |                |            |                | 192.0.0.40            |
|           |                |            |                | 192.0.0.41            |
|           |                |            |                | 192.0.0.42            |
|           |                |            |                | 192.0.0.43            |
|           |                |            |                | 192.0.0.44            |
|           |                |            |                | 192.0.0.45            |
|           |                |            |                | 192.0.0.46            |
|           |                |            |                | 192.0.0.47            |
|           |                |            |                | 192.0.0.48            |
+-----------+----------------+------------+----------------+-----------------------+

@lguohan
Copy link
Contributor

lguohan commented Jul 31, 2019

without the fix.

admin@str-s6100-acs-2:~$  sudo bridge vlan
port    vlan ids
docker0  1 PVID Egress Untagged

Bridge   1000

Ethernet52       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet53       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet54       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet55       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet32       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet14       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet15       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet12       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet13       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet56       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet57       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet58       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet10       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet11       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet8        1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet9        1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet22       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet23       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet6        1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet7        1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet24       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet25       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet26       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet27       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet42       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet40       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet41       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet28       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet29       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet30       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet31       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet48       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet38       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet39       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet36       1 Egress Untagged
         1000 PVID Egress Untagged

Ethernet37       1 Egress Untagged
         1000 PVID Egress Untagged

admin@str-s6100-acs-2:~$ 

@lguohan lguohan merged commit 5166212 into sonic-net:master Jul 31, 2019
tonytitus pushed a commit to tonytitus/sonic-swss that referenced this pull request Jul 31, 2019
The change includes two parts:

<1> Bring member out of default VLAN 1 upon putting port/lag in a VLAN

<2> Second part was done by @tieguoevan ( https://github.com/tieguoevan) and incorporated here to avoid test error that would follow change <1>.

Summary:
The Bridge interface needs to be up all the time. Otherwise, the command bridge vlan will fail.
Not sure it is a kernel bug, but it cause error when clear all vlan members and reconfigure it.

create a dummy interface in the Bridge to keep it up all the time

Signed-off-by: Jipan Yang <[email protected]>
yxieca pushed a commit that referenced this pull request Sep 9, 2019
The change includes two parts:

<1> Bring member out of default VLAN 1 upon putting port/lag in a VLAN

<2> Second part was done by @tieguoevan ( https://github.com/tieguoevan) and incorporated here to avoid test error that would follow change <1>.

Summary:
The Bridge interface needs to be up all the time. Otherwise, the command bridge vlan will fail.
Not sure it is a kernel bug, but it cause error when clear all vlan members and reconfigure it.

create a dummy interface in the Bridge to keep it up all the time

Signed-off-by: Jipan Yang <[email protected]>
@dawnbeauty
Copy link

@jipanyang How about a port need to attach vlan 1 and other vlans (trunk port)?
Wouldn't the port be detached from vlan1 when attach to other vlans. I think port should be move out of default vlan only when the first time to join bridge but not each time of attaching to vlans.

EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-swss that referenced this pull request Mar 1, 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.

5 participants