瑞芯微Rockchip开发者社区
直播中

陈秀英

7年用户 1222经验值
私信 关注
[问答]

怎样去解决swp口与eno0之间切换出的问题呢

你好,我在使用OK1028A板子时发现一个问题:
配置了一个bridge,把所有口(eno0,swp0-3)都加入这个网桥。
将PC先接到swp0上,bridge fdb show里面查到了两条mac表(一条在bridge上,一条在swp0上切类型为self):
root@forlinx:~# bridge fdb | grep 0a:35
00:e0:99:00:0a:35 dev swp0 vlan 100 master Bridge
00:e0:99:00:0a:35 dev swp0 vlan 100 self
root@forlinx:~#

然后拔掉PC的网线,还剩下一条mac表(self类型的那条),并且永远不老化:
root@forlinx:~# bridge fdb | grep 0a:35
00:e0:99:00:0a:35 dev swp0 vlan 100 self
root@forlinx:~#

然后PC接到eno0上,又生成了一条新的mac表,但是上面那条仍然存在,并没有刷新,这样就会导致流量转发出问题。
root@forlinx:~# bridge fdb | grep 0a:35
00:e0:99:00:0a:35 dev eno0 vlan 100 master Bridge
00:e0:99:00:0a:35 dev swp0 vlan 100 self

root@forlinx:~#

另外:如果PC只是在swp0~3之间切换,mac表可以正常刷新的。感觉就是swp口与eno0之间切换会出问题。请帮忙看看啥原因?








回帖(5)

李裕伦

2021-12-31 11:18:33

  • 您能发一下您详细的操作指令吗?我这边复现一下。
举报

韩冬

2021-12-31 11:18:49
操作很简单,就是把eno0和swp0~3全部加入bridge中,然后按照上面的步骤操作一下,就能复现:
ip link set eno0 up
ip link set eno2 up
ip link set swp0 up
ip link set swp1 up
ip link set swp2 up
ip link set swp3 up
ip link add Bridge up type bridge vlan_filtering 1
ip link set eno0 master Bridge
ip link set swp0 master Bridge
ip link set swp1 master Bridge
ip link set swp2 master Bridge
ip link set swp3 master Bridge
bridge vlan add vid 100 dev Bridge self
bridge vlan add vid 100 dev eno0 master pvid untagged
bridge vlan add vid 100 dev swp0 master pvid untagged
bridge vlan add vid 100 dev swp1 master pvid untagged
bridge vlan add vid 100 dev swp2 master pvid untagged
bridge vlan add vid 100 dev swp3 master pvid untagged



root@forlinx:~# brctl show
bridge name     bridge id               STP enabled     inte**ces
Bridge          8000.1636ad6de5ed       no              eno0
                                                        swp0
                                                        swp1
                                                        swp2
                                                        swp3
docker0         8000.0242e37c4144       no
root@forlinx:~# bridge vlan
port    vlan ids
eno0     1 Egress Untagged
         100 PVID Egress Untagged

swp0     1 Egress Untagged
         100 PVID Egress Untagged

swp1     1 Egress Untagged
         100 PVID Egress Untagged

swp2     1 Egress Untagged
         100 PVID Egress Untagged

swp3     1 Egress Untagged
         100 PVID Egress Untagged

docker0  1 PVID Egress Untagged

Bridge   1 PVID Egress Untagged
         100
举报

潘飘稚

2021-12-31 11:19:04
我在执行下列命令的过程中,出现了报错:
root@forlinx:~# bridge vlan add vid 100 dev swp0 master pvid untagged
[  209.302944] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  209.309611] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 0: -16
[  209.317637] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  209.324708] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 4: -16
root@forlinx:~# bridge vlan add vid 100 dev swp1 master pvid untagged
[  265.085154] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  265.091739] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 1: -16
[  265.098665] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  265.105224] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 4: -16
root@forlinx:~# bridge vlan add vid 100 dev swp2 master pvid untagged
[  273.630731] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  273.637311] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 2: -16
[  273.644244] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  273.650823] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 4: -16
root@forlinx:~# bridge vlan add vid 100 dev swp3 master pvid untagged
[  278.387161] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  278.393733] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 3: -16
[  278.401709] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  278.408752] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 4: -16
举报

李悠冉

2021-12-31 11:19:26
每次配PVID时候都会报错
[  209.302944] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  209.309611] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 0: -16
[  209.317637] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1
[  209.324708] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 4: -16

能请你们开发看看吗?
举报

李飞凤

2021-12-31 11:19:47
修改一下驱动:
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -238,12 +238,12 @@ static int ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,

        if (ocelot_port->vid != vid) {
                /* Always permit deleting the native VLAN (vid = 0) */
-               if (ocelot_port->vid && vid) {
+               /*if (ocelot_port->vid && vid) {
                        dev_err(ocelot->dev,
                                "Port already has a native VLAN: %dn",
                                ocelot_port->vid);
                        return -EBUSY;
-               }
+               }*/
                ocelot_port->vid = vid;
        }
举报

更多回帖

发帖
×
20
完善资料,
赚取积分