From 63ba27203a43fc374101676cea4de92e1a6d2bfc 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/02_network | 10 ++++---- .../base-files/etc/board.d/05_compat-version | 23 +++++++++++++++++++ .../arm64/boot/dts/qcom/ipq8070-cax1800.dts | 1 + .../arm64/boot/dts/qcom/ipq8071-ax3600.dtsi | 4 ++++ .../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 | 11 +++++++++ 8 files changed, 60 insertions(+), 5 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/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network index ff0f98e464c073..9666276419ee46 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" ;; 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 00000000000000..94686182856ab5 --- /dev/null +++ b/target/linux/ipq807x/base-files/etc/board.d/05_compat-version @@ -0,0 +1,23 @@ +# +# Copyright (C) 2022 OpenWrt.org +# + +. /lib/functions.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + dynalink,dl-wrx36|\ + edimax,cax1800|\ + qnap,301w|\ + redmi,ax6|\ + xiaomi,ax3600|\ + xiaomi,ax9000) + 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 d260bad58ab4d0..dc14cd5a1d81dc 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 6b46fab309e1f2..537d979f0e3a41 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/ipq8072-301w.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts index 81de57bb77c550..6f25cf4fe89a6b 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 cf18eecbd9d1fb..79e7612d28af6f 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 ce044859cbe163..5fa93904e891db 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 2c8996cac0221b..070d3a566df326 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 @@ -47,6 +53,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 +66,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 +82,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 +92,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 +106,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