{
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
}
{
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)
--- /dev/null
+# 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
CONFIG_ARM_VIRT_EXT=y
CONFIG_ATAGS=y
CONFIG_AUTO_ZRELADDR=y
+CONFIG_B53=y
+CONFIG_B53_MDIO_DRIVER=y
+# CONFIG_B53_MMAP_DRIVER is not set
+# CONFIG_B53_SERDES is not set
+# CONFIG_B53_SPI_DRIVER is not set
+CONFIG_B53_SRAB_DRIVER=y
CONFIG_BCM47XX_NVRAM=y
CONFIG_BCM47XX_SPROM=y
CONFIG_BCM47XX_WDT=y
CONFIG_GPIO_74X164=y
CONFIG_GPIO_BCM_XGS_IPROC=y
CONFIG_GPIO_GENERIC=y
+CONFIG_GRO_CELLS=y
CONFIG_HANDLE_DOMAIN_IRQ=y
CONFIG_HARDEN_BRANCH_PREDICTOR=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NET_DEVLINK=y
+CONFIG_NET_DSA=y
+CONFIG_NET_DSA_TAG_BRCM=y
+CONFIG_NET_DSA_TAG_BRCM_COMMON=y
+CONFIG_NET_DSA_TAG_BRCM_LEGACY=y
+CONFIG_NET_DSA_TAG_BRCM_PREPEND=y
CONFIG_NET_FLOW_LIMIT=y
+CONFIG_NET_SWITCHDEV=y
CONFIG_NR_CPUS=2
CONFIG_NVMEM=y
CONFIG_NVMEM_BRCM_NVRAM=y
CONFIG_PERF_USE_VMALLOC=y
CONFIG_PGTABLE_LEVELS=2
CONFIG_PHYLIB=y
+CONFIG_PHYLINK=y
# CONFIG_PHY_BCM_NS_USB2 is not set
# CONFIG_PHY_BCM_NS_USB3 is not set
# CONFIG_PHY_BCM_SR_PCIE is not set
CONFIG_SPI_MASTER=y
CONFIG_SPI_MEM=y
CONFIG_SRCU=y
-CONFIG_SWCONFIG=y
-CONFIG_SWCONFIG_B53=y
-CONFIG_SWCONFIG_B53_PHY_DRIVER=y
-CONFIG_SWCONFIG_B53_PHY_FIXUP=y
-CONFIG_SWCONFIG_B53_SRAB_DRIVER=y
CONFIG_SWPHY=y
CONFIG_SWP_EMULATE=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y