2Gbps Routing (WAN/LAN) on Asus RT-AX59U (MT7986 with MT7531 switch)?

I hope going off on a tangent will be forgiven but I'm curious whether a similar construction might apply to the Asus RT-AX59U (MT7986 with MT7531 switch) based on the decompiled DTB I extracted from a recent OEM firmware - the ethernet section looks like this:

	ethernet@15100000 {
		compatible = "mediatek,mt7986-eth";
		reg = <0x00 0x15100000 0x00 0x80000>;
		interrupts = <0x00 0xc4 0x04 0x00 0xc5 0x04 0x00 0xc6 0x04 0x00 0xc7 0x04>;
		clocks = <0x18 0x00 0x18 0x01 0x18 0x02 0x18 0x03 0x18 0x04 0x19 0x00 0x19 0x01 0x19 0x02 0x19 0x03 0x1a 0x00 0x1a 0x01 0x1a 0x02 0x1a 0x03>;
		clock-names = "fe\0gp2\0gp1\0wocpu1\0wocpu0\0sgmii_tx250m\0sgmii_rx250m\0sgmii_cdr_ref\0sgmii_cdr_fb\0sgmii2_tx250m\0sgmii2_rx250m\0sgmii2_cdr_ref\0sgmii2_cdr_fb";
		assigned-clocks = <0x05 0x4b 0x05 0x4c>;
		assigned-clock-parents = <0x05 0x15 0x05 0x1b>;
		mediatek,ethsys = <0x18>;
		mediatek,sgmiisys = <0x19 0x1a>;
		#reset-cells = <0x01>;
		#address-cells = <0x01>;
		#size-cells = <0x00>;
		status = "okay";

		mac@0 {
			compatible = "mediatek,eth-mac";
			reg = <0x00>;
			phy-mode = "2500base-x";
			local-mac-address = [00 00 00 00 00 00];
			phandle = <0x1b>;

			fixed-link {
				speed = <0x9c4>;
				full-duplex;
				pause;
			};
		};

		mac@1 {
			compatible = "mediatek,eth-mac";
			reg = <0x01>;
			phy-mode = "2500base-x";
			local-mac-address = [00 00 00 00 00 00];

			fixed-link {
				speed = <0x9c4>;
				full-duplex;
				pause;
			};
		};

		mdio-bus {
			#address-cells = <0x01>;
			#size-cells = <0x00>;

			switch@0 {
				compatible = "mediatek,mt7531";
				reg = <0x1f>;
				reset-gpios = <0x17 0x05 0x00>;

				ports {
					#address-cells = <0x01>;
					#size-cells = <0x00>;

					port@2 {
						reg = <0x02>;
						label = "lan1";
					};

					port@3 {
						reg = <0x03>;
						label = "lan2";
					};

					port@4 {
						reg = <0x04>;
						label = "lan3";
					};

					port@6 {
						reg = <0x06>;
						label = "cpu";
						ethernet = <0x1b>;
						phy-mode = "2500base-x";

						fixed-link {
							speed = <0x9c4>;
							full-duplex;
							pause;
						};
					};
				};
			};
		};
	};

The OEM firmware has a 5.4.225 kernel based on the modules I found.

For comparison, the ethernet section of the decompiled DTB from a recent 23.05 branch build (which is what the device is currently running) looks like this:

		ethernet@15100000 {
			compatible = "mediatek,mt7986-eth";
			reg = <0x00 0x15100000 0x00 0x80000>;
			interrupts = <0x00 0xc4 0x04 0x00 0xc5 0x04 0x00 0xc6 0x04 0x00 0xc7 0x04>;
			clocks = <0x19 0x00 0x19 0x01 0x19 0x02 0x19 0x03 0x19 0x04 0x1a 0x00 0x1a 0x01 0x1a 0x02 0x1a 0x03 0x1b 0x00 0x1b 0x01 0x1b 0x02 0x1b 0x03 0x04 0x2b 0x04 0x2c>;
			clock-names = "fe\0gp2\0gp1\0wocpu1\0wocpu0\0sgmii_tx250m\0sgmii_rx250m\0sgmii_cdr_ref\0sgmii_cdr_fb\0sgmii2_tx250m\0sgmii2_rx250m\0sgmii2_cdr_ref\0sgmii2_cdr_fb\0netsys0\0netsys1";
			assigned-clocks = <0x04 0x2e 0x04 0x2f>;
			assigned-clock-parents = <0x05 0x01 0x05 0x03>;
			mediatek,ethsys = <0x19>;
			mediatek,sgmiisys = <0x1a 0x1b>;
			mediatek,wed-pcie = <0x1c>;
			mediatek,wed = <0x1d 0x1e>;
			#reset-cells = <0x01>;
			#address-cells = <0x01>;
			#size-cells = <0x00>;
			status = "okay";
			phandle = <0x3b>;

			mac@0 {
				compatible = "mediatek,eth-mac";
				reg = <0x00>;
				phy-mode = "2500base-x";
				phandle = <0x1f>;

				fixed-link {
					speed = <0x9c4>;
					full-duplex;
					pause;
				};
			};

			mdio-bus {
				#address-cells = <0x01>;
				#size-cells = <0x00>;
				phandle = <0x3c>;

				switch@1f {
					compatible = "mediatek,mt7531";
					reg = <0x1f>;
					reset-gpios = <0x02 0x05 0x00>;

					ports {
						#address-cells = <0x01>;
						#size-cells = <0x00>;

						port@1 {
							reg = <0x01>;
							label = "wan";
						};

						port@2 {
							reg = <0x02>;
							label = "lan1";
						};

						port@3 {
							reg = <0x03>;
							label = "lan2";
						};

						port@4 {
							reg = <0x04>;
							label = "lan3";
						};

						port@6 {
							reg = <0x06>;
							label = "cpu";
							ethernet = <0x1f>;
							phy-mode = "2500base-x";

							fixed-link {
								speed = <0x9c4>;
								full-duplex;
								pause;
							};
						};
					};
				};
			};
		};

I'm might be seeing a mirage but the difference between the two looks to me like the OEM firmware has the WAN port attached to gmac1 instead of connecting via the switch cpu port attached to gmac0. @arinc9 if you have the time I'd appreciate your advice as to whether what appears to be done in the OEM DTB could be translated to OpenWrt's RT-AX59U DTS.

MAC to phy is like apples to potatoes comparison, btw you can find OpenWRT DTS files in source tree without decompilation pains.
In principle on most mediatek since 23.05.0 you should find ip link saying

wan ->gmac0
lan1@dsa
lan2@dsa
....
lan5@dsa
dsa -> gmac1

i.e same as you detected in vendor firmware, not flat one-MAC structure like OpenWRT v22

2 Likes

I don't understand how you mean... Have you ever read IEEE Std 802.3-2022 or just 802-2014?

I don't care how the OEM firmware works. The current state of affairs in the mainline Linux is that the MT7530 DSA subdriver does not support changing the affinity of user ports to CPU ports, which would provide 2 Gbps routing. The device tree source file of a board shall describe both CPU ports regardless of the state of the Linux driver.

Once the MT7530 DSA subdriver supports the said function, the affinity of user ports can be changed using ip-link(8). I'm looking over implementing this function to the subdriver. It shall be done this year. After that I may work on describing the second CPU ports on the device tree source files hosted on the OpenWrt repository.

That said, 2 Gbps routing for the MT7530 switch is provided by a hardware feature. You can't achieve the same goal on the MT7531 switch.

2 Likes

@pythonic read above

Many thanks for the clarification.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.