[OpenWrt-Devel] ramips: mt7620: fix failsafe switch config
diff mbox

Message ID 56C4A6A6.5090909@gmail.com
State Accepted
Headers show

Commit Message

Joseph C. Lehner Feb. 17, 2016, 4:58 p.m. UTC
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; the issue also applies to the Netgear EX2700.

The problem is that failsafe mode uses eth0, but enable_vlan is always set to 1
by the switch driver. Connecting to and/or pinging the device fails. This patch 
fixes the failsafe preinit config, by making sure that vlan support is disabled. 
It currently only fixes the switch config on mt7620, but might apply to the 
mt7621 as well, so the patch has been designed with this in mind.

A similar (line wrapped) patch was submitted in December by Simon Peter, but never
accepted and/or discussed.

This patch applies to both Chaos Calmer and trunk.

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

Signed-off-by: Joseph C. Lehner <joseph.c.lehner@gmail.com>

---

Comments

Joseph C. Lehner March 1, 2016, 4:15 p.m. UTC | #1
I see that the patch has been merged in trunk, however the same
issue exists in Chaos Calmer (and this patch applies to the CC
branch as well).

Regards,
Joseph


On 2016-02-17 17:58, Joseph C. Lehner wrote:
> 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; the issue also applies to the Netgear EX2700.
> 
> The problem is that failsafe mode uses eth0, but enable_vlan is always set to 1
> by the switch driver. Connecting to and/or pinging the device fails. This patch 
> fixes the failsafe preinit config, by making sure that vlan support is disabled. 
> It currently only fixes the switch config on mt7620, but might apply to the 
> mt7621 as well, so the patch has been designed with this in mind.
> 
> A similar (line wrapped) patch was submitted in December by Simon Peter, but never
> accepted and/or discussed.
> 
> This patch applies to both Chaos Calmer and trunk.
> 
> [1] https://dev.openwrt.org/ticket/18768
> 
> Signed-off-by: Joseph C. Lehner <joseph.c.lehner@gmail.com>
> 
> ---
> 
> diff --git a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
> index 3dce1b6..6948851 100644
> --- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
> +++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
> @@ -7,8 +7,22 @@
>  
>  ramips_set_preinit_iface() {
>  	RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350|MT7628|MT7688)"`
> +	MT762X=`cat /proc/cpuinfo | egrep "MT7620"`
> +
>  	if [ -n "${RT3X5X}" ]; then
>  		swconfig dev rt305x set reset 1
> +	elif [ -n "${MT762X}" ]; then
> +		# The mt7530 switch driver enables VLAN by default, but
> +		# failsafe uses eth0, making the device unreachable:
> +		# https://dev.openwrt.org/ticket/18768
> +		case "${MT762X}" in
> +		*MT7620*)
> +			mt762x_switchdev=mt7620
> +			;;
> +		esac
> +		swconfig dev $mt762x_switchdev set reset 1
> +		swconfig dev $mt762x_switchdev set enable_vlan 0
> +		swconfig dev $mt762x_switchdev set apply 1
>  	fi
>  
>  	if echo $RT3X5X | egrep -q "(RT5350|MT7628|MT7688)"; then
>
John Crispin March 1, 2016, 5:07 p.m. UTC | #2
On 01/03/2016 17:15, Joseph C. Lehner wrote:
> This patch applies to both Chaos Calmer and trunk.


missed that one ...

Patch
diff mbox

diff --git a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
index 3dce1b6..6948851 100644
--- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
+++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
@@ -7,8 +7,22 @@ 
 
 ramips_set_preinit_iface() {
 	RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350|MT7628|MT7688)"`
+	MT762X=`cat /proc/cpuinfo | egrep "MT7620"`
+
 	if [ -n "${RT3X5X}" ]; then
 		swconfig dev rt305x set reset 1
+	elif [ -n "${MT762X}" ]; then
+		# The mt7530 switch driver enables VLAN by default, but
+		# failsafe uses eth0, making the device unreachable:
+		# https://dev.openwrt.org/ticket/18768
+		case "${MT762X}" in
+		*MT7620*)
+			mt762x_switchdev=mt7620
+			;;
+		esac
+		swconfig dev $mt762x_switchdev set reset 1
+		swconfig dev $mt762x_switchdev set enable_vlan 0
+		swconfig dev $mt762x_switchdev set apply 1
 	fi
 
 	if echo $RT3X5X | egrep -q "(RT5350|MT7628|MT7688)"; then