From 1970ee58fadf6eeac5cfd96c104cbf0ebd0df45c Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 1 Jan 2023 14:58:49 +0100 Subject: [PATCH] ipq807x: set network interface names Set network interface names according to physical port markings. Since this would break networking configs, compat version is set for affected boards along with a message when trying to sysupgrade that it can only be done if not preserving config. Compat version will be dropped once a PR to OpenWrt is made. Signed-off-by: Robert Marko --- .../ipq807x/base-files/etc/board.d/01_leds | 16 ++++++++-------- .../ipq807x/base-files/etc/board.d/02_network | 12 ++++++------ .../base-files/etc/board.d/05_compat-version | 18 ++++++++++++++++++ .../arm64/boot/dts/qcom/ipq8070-cax1800.dts | 1 + .../arm64/boot/dts/qcom/ipq8071-ax3600.dtsi | 4 ++++ .../arm64/boot/dts/qcom/ipq8071-eap102.dts | 2 ++ .../arch/arm64/boot/dts/qcom/ipq8072-301w.dts | 6 ++++++ .../arm64/boot/dts/qcom/ipq8072-ax9000.dts | 5 +++++ .../arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts | 5 +++++ target/linux/ipq807x/image/generic.mk | 12 ++++++++++++ 10 files changed, 67 insertions(+), 14 deletions(-) create mode 100644 target/linux/ipq807x/base-files/etc/board.d/05_compat-version diff --git a/target/linux/ipq807x/base-files/etc/board.d/01_leds b/target/linux/ipq807x/base-files/etc/board.d/01_leds index d48dcfa385fd1..0424958416546 100644 --- a/target/linux/ipq807x/base-files/etc/board.d/01_leds +++ b/target/linux/ipq807x/base-files/etc/board.d/01_leds @@ -7,19 +7,19 @@ board=$(board_name) case "$board" in edgecore,eap102) - ucidef_set_led_netdev "wan" "WAN" "green:wanpoe" "eth0" + ucidef_set_led_netdev "wan" "WAN" "green:wanpoe" "wan" ;; redmi,ax6|\ xiaomi,ax3600) - ucidef_set_led_netdev "wan" "WAN" "blue:network" "eth0" + ucidef_set_led_netdev "wan" "WAN" "blue:network" "wan" ;; qnap,301w) - ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth0" - ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth1" - ucidef_set_led_netdev "lan3" "LAN3" "green:lan3" "eth2" - ucidef_set_led_netdev "lan4" "LAN4" "green:lan4" "eth3" - ucidef_set_led_netdev "10G_1" "10G_1" "green:10g_1" "eth4" - ucidef_set_led_netdev "10G_2" "10G_2" "green:10g_2" "eth5" + ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "lan1" + ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "lan2" + ucidef_set_led_netdev "lan3" "LAN3" "green:lan3" "lan3" + ucidef_set_led_netdev "lan4" "LAN4" "green:lan4" "lan4" + ucidef_set_led_netdev "10G_1" "10G_1" "green:10g_1" "10g-1" + ucidef_set_led_netdev "10G_2" "10G_2" "green:10g_2" "10g-2" ;; esac diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network index ff0f98e464c07..e2bd46f095968 100644 --- a/target/linux/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/ipq807x/base-files/etc/board.d/02_network @@ -12,23 +12,23 @@ ipq807x_setup_interfaces() case "$board" in dynalink,dl-wrx36) - ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4" "eth0" + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; edgecore,eap102) - ucidef_set_interfaces_lan_wan "eth1" "eth0" + ucidef_set_interfaces_lan_wan "lan" "wan" ;; edimax,cax1800) - ucidef_set_interfaces_lan_wan "eth0" + ucidef_set_interfaces_lan_wan "lan" ;; qnap,301w) - ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3 eth4" "eth5" + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g-2" "10g-1" ;; redmi,ax6|\ xiaomi,ax3600) - ucidef_set_interfaces_lan_wan "eth1 eth2 eth3" "eth0" + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; xiaomi,ax9000) - ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3" "eth4" + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; *) echo "Unsupported hardware. Network interfaces not initialized" diff --git a/target/linux/ipq807x/base-files/etc/board.d/05_compat-version b/target/linux/ipq807x/base-files/etc/board.d/05_compat-version new file mode 100644 index 0000000000000..70272f99ed5d8 --- /dev/null +++ b/target/linux/ipq807x/base-files/etc/board.d/05_compat-version @@ -0,0 +1,18 @@ +# +# Copyright (C) 2022 OpenWrt.org +# + +. /lib/functions.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + *) + ucidef_set_compat_version "1.1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts index d260bad58ab4d..dc14cd5a1d81d 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts @@ -591,6 +591,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075>; phy-mode = "sgmii"; + label = "lan"; }; }; diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi index 6b46fab309e1f..537d979f0e3a4 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi @@ -438,6 +438,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_1>; phy-mode = "sgmii"; + label = "wan"; }; dp3: dp3 { @@ -449,6 +450,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_2>; phy-mode = "sgmii"; + label = "lan1"; }; dp4: dp4 { @@ -460,6 +462,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_3>; phy-mode = "sgmii"; + label = "lan2"; }; dp5: dp5 { @@ -471,6 +474,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_4>; phy-mode = "sgmii"; + label = "lan3"; }; }; diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts index 0c5950fa9a51d..0a0c4239cdcff 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts @@ -653,6 +653,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8081_28>; phy-mode = "sgmii"; + label = "wan"; }; dp5: dp5 { @@ -664,6 +665,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8081_24>; phy-mode = "sgmii"; + label = "lan"; }; }; diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts index 81de57bb77c55..6f25cf4fe89a6 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts @@ -731,6 +731,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_16>; phy-mode = "sgmii"; + label = "lan4"; }; dp2: dp2 { @@ -742,6 +743,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_17>; phy-mode = "sgmii"; + label = "lan3"; }; dp3: dp3 { @@ -753,6 +755,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_18>; phy-mode = "sgmii"; + label = "lan2"; }; dp4: dp4 { @@ -764,6 +767,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_19>; phy-mode = "sgmii"; + label = "lan1"; }; dp5: dp5 { @@ -775,6 +779,7 @@ local-mac-address = [000000000000]; phy-handle = <&aqr113c_8>; phy-mode = "sgmii"; + label = "10g-1"; }; dp6: dp6 { @@ -786,6 +791,7 @@ local-mac-address = [000000000000]; phy-handle = <&aqr113c_0>; phy-mode = "sgmii"; + label = "10g-2"; }; }; diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts index cf18eecbd9d1f..79e7612d28af6 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts @@ -700,6 +700,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_0>; phy-mode = "sgmii"; + label = "lan4"; }; dp2: dp2 { @@ -711,6 +712,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_1>; phy-mode = "sgmii"; + label = "lan3"; }; dp3: dp3 { @@ -722,6 +724,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_2>; phy-mode = "sgmii"; + label = "lan2"; }; dp4: dp4 { @@ -733,6 +736,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_3>; phy-mode = "sgmii"; + label = "lan1"; }; dp5: dp5 { @@ -744,6 +748,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8081>; phy-mode = "sgmii"; + label = "wan"; }; }; diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts index ce044859cbe16..5fa93904e891d 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts @@ -490,6 +490,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8081>; phy-mode = "sgmii"; + label = "wan"; }; dp2: dp2 { @@ -501,6 +502,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_3>; phy-mode = "sgmii"; + label = "lan1"; }; dp3: dp3 { @@ -512,6 +514,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_2>; phy-mode = "sgmii"; + label = "lan2"; }; dp4: dp4 { @@ -523,6 +526,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_1>; phy-mode = "sgmii"; + label = "lan3"; }; dp5: dp5 { @@ -534,6 +538,7 @@ local-mac-address = [000000000000]; phy-handle = <&qca8075_0>; phy-mode = "sgmii"; + label = "lan4"; }; }; diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index 2c8996cac0221..896fa2e89c51a 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -17,9 +17,15 @@ define Device/UbiFit IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef +define Device/IfnameMigration + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Network interface names have changed +endef + define Device/dynalink_dl-wrx36 $(call Device/FitImage) $(call Device/UbiFit) + $(call Device/IfnameMigration) DEVICE_VENDOR := Dynalink DEVICE_MODEL := DL-WRX36 BLOCKSIZE := 128k @@ -33,6 +39,7 @@ TARGET_DEVICES += dynalink_dl-wrx36 define Device/edgecore_eap102 $(call Device/FitImage) $(call Device/UbiFit) + $(call Device/IfnameMigration) DEVICE_VENDOR := Edgecore DEVICE_MODEL := EAP102 BLOCKSIZE := 128k @@ -47,6 +54,7 @@ TARGET_DEVICES += edgecore_eap102 define Device/edimax_cax1800 $(call Device/FitImage) $(call Device/UbiFit) + $(call Device/IfnameMigration) DEVICE_VENDOR := Edimax DEVICE_MODEL := CAX1800 BLOCKSIZE := 128k @@ -59,6 +67,7 @@ TARGET_DEVICES += edimax_cax1800 define Device/qnap_301w $(call Device/FitImage) + $(call Device/IfnameMigration) DEVICE_VENDOR := QNAP DEVICE_MODEL := 301w DEVICE_DTS_CONFIG := config@hk01 @@ -74,6 +83,7 @@ TARGET_DEVICES += qnap_301w define Device/redmi_ax6 $(call Device/xiaomi_ax3600) + $(call Device/IfnameMigration) DEVICE_VENDOR := Redmi DEVICE_MODEL := AX6 DEVICE_PACKAGES := ipq-wifi-redmi_ax6 @@ -83,6 +93,7 @@ TARGET_DEVICES += redmi_ax6 define Device/xiaomi_ax3600 $(call Device/FitImage) $(call Device/UbiFit) + $(call Device/IfnameMigration) DEVICE_VENDOR := Xiaomi DEVICE_MODEL := AX3600 BLOCKSIZE := 128k @@ -96,6 +107,7 @@ TARGET_DEVICES += xiaomi_ax3600 define Device/xiaomi_ax9000 $(call Device/FitImage) $(call Device/UbiFit) + $(call Device/IfnameMigration) DEVICE_VENDOR := Xiaomi DEVICE_MODEL := AX9000 BLOCKSIZE := 128k