diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2021-10-18 15:04:17 +0200 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2021-10-21 17:38:17 +0200 |
commit | e9672b1a8fa4714cbc35d5964caf704b2e571f35 (patch) | |
tree | e766798860094936a46c529c40c0ad81fe33d0d5 /target/linux/bcm53xx/base-files | |
parent | d88f3b8a427acd1aef7ec3fc4c8e47c7a665d7d0 (diff) | |
download | upstream-e9672b1a8fa4714cbc35d5964caf704b2e571f35.tar.gz upstream-e9672b1a8fa4714cbc35d5964caf704b2e571f35.tar.bz2 upstream-e9672b1a8fa4714cbc35d5964caf704b2e571f35.zip |
bcm53xx: switch to the upstream DSA-based b53 driver
1. Drop swconfig
2. Simplify network setup
3. Verify network config
4. Disable Buffalo WZR-900DHP for now - it misses ports definition
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-By: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/bcm53xx/base-files')
-rw-r--r-- | target/linux/bcm53xx/base-files/etc/board.d/02_network | 80 | ||||
-rw-r--r-- | target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate | 23 |
2 files changed, 32 insertions, 71 deletions
diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network index e02286027f..9308801b85 100644 --- a/target/linux/bcm53xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network @@ -9,74 +9,24 @@ bcm53xx_setup_interfaces() { local board="$1" - # On BCM4708 / BCM4709(4) there are 3 Ethernet interfaces connected to 3 switch - # ports. It's up to vendor which to use. case "$board" in - tenda,ac9) - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "4:lan" "8@eth0" "0:wan" "5@eth1" - ;; - buffalo,wxr-1900dhp| \ - buffalo,wzr-1750dhp) - ucidef_add_switch "switch0" \ - "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:wan:5" "5@eth0" - ;; - dlink,dir-885l | \ - netgear,r7900 | \ - netgear,r8000 | \ - netgear,r8500) - # NVRAM specifies port 8 (eth2) - unsupported by OpenWrt b53 - # Use port 5 (eth0) as workaround - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@eth0" + asus,rt-ac87u) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; linksys,panamera) - ucidef_add_switch "switch1" \ - "0:lan" "1:lan:7" "2:lan:4" "3:lan:8" "4:wan" "5t@eth0" - ;; - luxul,abr-4500-v1|\ - luxul,xbr-4500-v1) - ucidef_add_switch "switch0" \ - "0:wan" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5@eth0" + ucidef_set_interfaces_lan_wan "lan4 lan7 lan8 extsw" "wan" ;; luxul,xap-1610-v1) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "5@eth0" - ucidef_set_interface_lan "eth0.1" "dhcp" + ucidef_set_interface_lan "poe lan" "dhcp" ;; - luxul,xwr-3150-v1) - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "5@eth0" + meraki,mr32) + ucidef_set_interface_lan "poe" "dhcp" ;; phicomm,k3) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:wan" "5@eth0" + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; *) - # NVRAM entries may contain unsorted ports, e.g. Netgear R6250 uses - # vlan1ports=3 2 1 0 5* - # vlan2ports=4 5u - # and early Netgear R8000 was using - # vlan1ports=3 2 1 0 5 7 8* - # (the enclosing echo is needed to convert newline back to space) - vlan1ports="$(echo $(nvram get vlan1ports | tr " " "\n" | sort))" - vlan2ports="$(echo $(nvram get vlan2ports | tr " " "\n" | sort))" - if echo "$vlan1ports" | egrep -q "^1 2 3 4 5" && \ - echo "$vlan2ports" | egrep -q "^0 5"; then - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5t@eth0" - elif echo "$vlan1ports" | egrep -q "^1 2 3 5 7" && \ - echo "$vlan2ports" | egrep -q "^0 7"; then - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "5:lan" "0:wan" "7t@eth1" - elif echo "$vlan1ports" | egrep -q "^0 1 2 3 5 7 8" && \ - echo "$vlan2ports" | egrep -q "^4 8"; then - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "5:lan" "7:lan" "4:wan" "8t@eth2" - else - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@eth0" - fi + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; esac } @@ -85,20 +35,8 @@ bcm53xx_setup_macs() { local board="$1" - case "$board" in - dlink,dir-885l | \ - linksys,panamera | \ - netgear,r7900 | \ - netgear,r8000 | \ - netgear,r8500) - # As vendor doesn't use eth0 its MAC may be missing. Use one from eth2. - et2macaddr="$(nvram get et2macaddr)" - ;; - esac - - [ -n "$et2macaddr" ] && ucidef_set_interface_macaddr "lan" "$et2macaddr" - wan_macaddr="$(nvram get wan_hwaddr)" + case "$board" in asus,rt-ac87u) etXmacaddr=$(nvram get et1macaddr) diff --git a/target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate b/target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate new file mode 100644 index 0000000000..7350f57e5d --- /dev/null +++ b/target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-only + +# Exit if network doesn't contain any swconfig section +uci -q get network.@switch[0] > /dev/null || exit 0 + +lan_proto="$(uci -q get network.lan.proto)" +lan_ipaddr="$(uci -q get network.lan.ipaddr)" +lan_netmask="$(uci -q get network.lan.netmask)" +wan_proto="$(uci -q get network.wan.proto)" +wan_ipaddr="$(uci -q get network.wan.ipaddr)" +wan_netmask="$(uci -q get network.wan.netmask)" + +rm /etc/config/network +config_generate + +uci -q batch <<-EOF + set network.lan.proto="$lan_proto" + set network.lan.ipaddr="$lan_ipaddr" + set network.lan.netmask="$lan_netmask" + set network.wan.proto="$wan_proto" + set network.wan.ipaddr="$wan_ipaddr" + set network.wan.netmask="$wan_netmask" +EOF |