Skip to content

Commit

Permalink
ipq807x: xiaomi: set network interface names
Browse files Browse the repository at this point in the history
Set network interface names according to physical port markings on Xiaomi
boards, others will follow.

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 <[email protected]>
  • Loading branch information
robimarko committed Jan 1, 2023
1 parent 08e7c2c commit f39a07a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
4 changes: 2 additions & 2 deletions target/linux/ipq807x/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ ipq807x_setup_interfaces()
;;
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
20 changes: 20 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,20 @@
#
# Copyright (C) 2022 OpenWrt.org
#

. /lib/functions.sh
. /lib/functions/uci-defaults.sh

board_config_update

case "$(board_name)" in
redmi,ax6|\
xiaomi,ax3600|\
xiaomi,ax9000)
ucidef_set_compat_version "1.1"
;;
esac

board_config_flush

exit 0
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 @@ -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
8 changes: 8 additions & 0 deletions target/linux/ipq807x/image/generic.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ 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)
Expand Down Expand Up @@ -74,6 +79,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 +89,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 +103,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 f39a07a

Please sign in to comment.