Skip to content

Commit

Permalink
ipq807x: set network interface names
Browse files Browse the repository at this point in the history
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 <robimarko@gmail.com>
  • Loading branch information
robimarko committed Jan 2, 2023
1 parent b352ba6 commit 1970ee5
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 14 deletions.
16 changes: 8 additions & 8 deletions target/linux/ipq807x/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions target/linux/ipq807x/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 18 additions & 0 deletions target/linux/ipq807x/base-files/etc/board.d/05_compat-version
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075>;
phy-mode = "sgmii";
label = "lan";
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_1>;
phy-mode = "sgmii";
label = "wan";
};

dp3: dp3 {
Expand All @@ -449,6 +450,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_2>;
phy-mode = "sgmii";
label = "lan1";
};

dp4: dp4 {
Expand All @@ -460,6 +462,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_3>;
phy-mode = "sgmii";
label = "lan2";
};

dp5: dp5 {
Expand All @@ -471,6 +474,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_4>;
phy-mode = "sgmii";
label = "lan3";
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8081_28>;
phy-mode = "sgmii";
label = "wan";
};

dp5: dp5 {
Expand All @@ -664,6 +665,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8081_24>;
phy-mode = "sgmii";
label = "lan";
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_16>;
phy-mode = "sgmii";
label = "lan4";
};

dp2: dp2 {
Expand All @@ -742,6 +743,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_17>;
phy-mode = "sgmii";
label = "lan3";
};

dp3: dp3 {
Expand All @@ -753,6 +755,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_18>;
phy-mode = "sgmii";
label = "lan2";
};

dp4: dp4 {
Expand All @@ -764,6 +767,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_19>;
phy-mode = "sgmii";
label = "lan1";
};

dp5: dp5 {
Expand All @@ -775,6 +779,7 @@
local-mac-address = [000000000000];
phy-handle = <&aqr113c_8>;
phy-mode = "sgmii";
label = "10g-1";
};

dp6: dp6 {
Expand All @@ -786,6 +791,7 @@
local-mac-address = [000000000000];
phy-handle = <&aqr113c_0>;
phy-mode = "sgmii";
label = "10g-2";
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_0>;
phy-mode = "sgmii";
label = "lan4";
};

dp2: dp2 {
Expand All @@ -711,6 +712,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_1>;
phy-mode = "sgmii";
label = "lan3";
};

dp3: dp3 {
Expand All @@ -722,6 +724,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_2>;
phy-mode = "sgmii";
label = "lan2";
};

dp4: dp4 {
Expand All @@ -733,6 +736,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_3>;
phy-mode = "sgmii";
label = "lan1";
};

dp5: dp5 {
Expand All @@ -744,6 +748,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8081>;
phy-mode = "sgmii";
label = "wan";
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8081>;
phy-mode = "sgmii";
label = "wan";
};

dp2: dp2 {
Expand All @@ -501,6 +502,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_3>;
phy-mode = "sgmii";
label = "lan1";
};

dp3: dp3 {
Expand All @@ -512,6 +514,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_2>;
phy-mode = "sgmii";
label = "lan2";
};

dp4: dp4 {
Expand All @@ -523,6 +526,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_1>;
phy-mode = "sgmii";
label = "lan3";
};

dp5: dp5 {
Expand All @@ -534,6 +538,7 @@
local-mac-address = [000000000000];
phy-handle = <&qca8075_0>;
phy-mode = "sgmii";
label = "lan4";
};
};

Expand Down
12 changes: 12 additions & 0 deletions target/linux/ipq807x/image/generic.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1970ee5

Please sign in to comment.