[OpenWrt-Devel] ramips: Failsafe switch config broken on (some?) mt7620/mt7621 devices

Joseph C. Lehner joseph.c.lehner at gmail.com
Fri Feb 12 03:40:23 EST 2016


As indicated in the bug tracker[1], failsafe mode is broken on at least some
devices using the mt7620 switch (and possibly mt7621). The thread explicitly
mentions the Xiaomi MiWifi, and the Nexx WT3020, and an unspecified device
using the mt7621 switch; I can confirm the issue on a Netgear EX2700 (mt7620).
This applies to both Chaos Calmer and trunk!

The problem is that failsafe mode uses eth0, but VLANs are enabled by the switch
driver:

# swconfig dev mt7620 show
Global attributes:
        enable_vlan: 1
Port 0:
        pvid: 0
        link: port:0 link:down
Port 1:
        pvid: 0
        link: port:1 link:down
Port 2:
        pvid: 0
        link: port:2 link:down
Port 3:
        pvid: 0
        link: port:3 link:down
Port 4:
        pvid: 0
        link: port:4 link:up speed:100baseT full-duplex
Port 5:
        pvid: 0
        link: port:5 link:down
Port 6:
        pvid: 0
        link: port:6 link:up speed:1000baseT full-duplex
Port 7:
        pvid: 0
        link: port:7 link:down

In the patch adding support for the Netgear EX2700 (which has only one LAN port -
switch port 4), I've omitted the "mediatek,portmap" property in the device tree,
but the same happens if specifying either "llllw" or "wllll", obviously.

I'd submit a patch, but I'd like to some input on this matter first. I'm proposing
the following changes:

1. Patch /lib/preinit/07_set_preinit_iface_ramips, to disable VLANs on the switch
   (the bug tracker contains an example).

2. Patch the mt7530 switch driver to disable VLANs if no mediatek,portmap property
   was specified, similar to the attached patch (I'll submit a proper patch if this
   is accepted).

The second approach works perfectly on my EX2700, plus it allows for a simpler entry
in /etc/board.d/02_network (`ucidef_set_interface_lan "eth0"`). The first approach
also fixes failsafe on devices that DO have more than one ethernet port (i.e. those
that make use of the "mediatek,portmap" property).


Any thoughts on this? Regards,
Joseph


[1] https://dev.openwrt.org/ticket/18768

---

--- a/drivers/net/ethernet/mediatek/mt7530.c    2016-02-11 23:26:38.407412647 +0100
+++ a/drivers/net/ethernet/mediatek/mt7530.c    2016-02-11 23:21:59.911481188 +0100
@@ -760,7 +760,6 @@
 
    mt7530->base = base;
    mt7530->bus = bus;
-   mt7530->global_vlan_enable = vlan;
 
    swdev = &mt7530->swdev;
    if (bus) {
@@ -789,8 +788,13 @@
 
 
    map = mt7530_find_mapping(dev->of_node);
-   if (map)
+   if (map) {
+       mt7530->global_vlan_enable = vlan;
        mt7530_apply_mapping(mt7530, map);
+   } else {
+       mt7530->global_vlan_enable = 0;
+       dev_info(dev, "mediatek,portmap not specified - disabling VLAN\n")
+   }
    mt7530_apply_config(swdev);
 
    /* magic vodoo */
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list