Re: [PATCH] bcm53xx: switch to the upstream DSA-based b53 driver

2021-10-18 Thread Christian Lamparter
Hello,

On Mon, Oct 18, 2021 at 3:06 PM Rafał Miłecki  wrote:
> 1. Drop swconfig
> 2. Simplify network setup
> 3. Verify network config
> 4. Disable Buffalo WZR-900DHP for now - it misses ports definition
>

Nice! MR32's portion of a similar patch (the only change that has
remained... as the DTS is upstream)
in my staging-tree looks very similar.

> +   meraki,mr32)
> +   ucidef_set_interface_lan "poe"
> +   ;;

I opted not to set the dhcp mode as you did since zeroconf wasn't
supported by the udhcp (maybe that has changed?).
But yes, this should be good.

Reviewed-By: Christian Lamparter 

> Signed-off-by: Rafał Miłecki 
> ---
> diff --git a/target/linux/bcm53xx/Makefile b/target/linux/bcm53xx/Makefile
> index 083f905096..921058d140 100644
> --- a/target/linux/bcm53xx/Makefile
> +++ b/target/linux/bcm53xx/Makefile
> @@ -22,7 +22,7 @@ include $(INCLUDE_DIR)/target.mk
>
>  KERNELNAME:=zImage dtbs
>
> -DEFAULT_PACKAGES += swconfig nvram \
> +DEFAULT_PACKAGES += nvram \
^^^ See below in the config-5.10 / CONFIG_SWCONFIG=y

> diff --git a/target/linux/bcm53xx/config-5.10 
> b/target/linux/bcm53xx/config-5.10
> index 9d98e812bd..73cccf1d3a 100644
> --- a/target/linux/bcm53xx/config-5.10
> +++ b/target/linux/bcm53xx/config-5.10
> @@ -267,10 +282,6 @@ CONFIG_SPI_MASTER=y
>  CONFIG_SPI_MEM=y
>  CONFIG_SRCU=y
>  CONFIG_SWCONFIG=y

-CONFIG_SWCONFIG=y (it should be possible to remove this line too)

(Or does this symbol creep on back during kernel_*config? if so

# CONFIG_SWCONFIG is not set
)

Cheers,
Christian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] bcm53xx: switch to the upstream DSA-based b53 driver

2021-10-18 Thread Rafał Miłecki
From: Rafał Miłecki 

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 
---
 target/linux/bcm53xx/Makefile |  2 +-
 .../bcm53xx/base-files/etc/board.d/02_network | 80 +++
 .../etc/uci-defaults/03_dsa_migrate   | 23 ++
 target/linux/bcm53xx/config-5.10  | 19 -
 target/linux/bcm53xx/image/Makefile   |  1 +
 5 files changed, 49 insertions(+), 76 deletions(-)
 create mode 100644 
target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate

diff --git a/target/linux/bcm53xx/Makefile b/target/linux/bcm53xx/Makefile
index 083f905096..921058d140 100644
--- a/target/linux/bcm53xx/Makefile
+++ b/target/linux/bcm53xx/Makefile
@@ -22,7 +22,7 @@ include $(INCLUDE_DIR)/target.mk
 
 KERNELNAME:=zImage dtbs
 
-DEFAULT_PACKAGES += swconfig nvram \
+DEFAULT_PACKAGES += nvram \
osafeloader oseama otrx \
kmod-gpio-button-hotplug \
kmod-leds-gpio
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" \
-