I’m currently working with an Edgerouter X SFP, in the hopes of getting full duplex near gigabit out of it. With hardware offloading, 900Mbps half-duplex works now (with NAT and PPPoE), so now I am running into the limitation of having a single Gbit link between the switch and the CPU. Since the CPU has a second ethernet interface, I investigated whether that could be used, as is already done on the ER-X.
After digging through datasheets, DTS files and driver sources, I think it should be possible to make use of this second port (GMAC1).
The MT7621 switch programming manual suggests that PORT 5 on the switch can be configured in a few ways, but the docs and terms are super vague, so I’m not sure I’m understanding this correctly.
- Connecting port 5 to GMAC5 (switch side), which I think then connects to GMAC1 (CPU side). I think this connects GMAC1 to the switch, and could be maybe be used a second conduit / uplink (something that DSA now supports, but I read a bit of code in the switch driver that suggests it enables only one port, so maybe this will not fly).
- Connecting the GMAC1 to the external PHY, essentially bypassing the switch completely. This would end up with the SFP module GMAC1, which would allow high throughput if the SFP is used as the WAN port.
- Connecting GMAC1 to either the eth0 or eth4 PHY (disconnecting that PHY from the switch). This is what ER-X does with eth0, introduced with https://github.com/openwrt/openwrt/pull/10238 I presume this was not done for ER-X, since this probably disables the user of port5 (though I’m not sure if this is necessarily true, maybe GMAC1 can be connected to PHY0 while GMAC5 / switch port 5 is still connected to the external PHY/SFP?)
- Connecting GMAC5 / switch port 5 to the external PHY/SFP. This is what is currently the case, meaning the SFP shares bandwith with the other switched ports.
The most obvious one here would seem option 2, where the SFP gets its own CPU port. Is there something that prevents this from working? I think I might figure out how to change the DTS to configure this, but I don’t have an SFP at hand yet to test with ![]()
Option 3 is also interesting. This will likely disable the SFP, but if you do not need that, you get a fast WAN port at eth0. I tried this by uploading the ER-X image to my board (since the changes between them seem to be limited to the setup of the network ports and some PoE GPIOs), but that did not work (it boots ok, I get an eth0 instead of eth0@dsa, and I can receive traffic on that port, but somehow not transmit anything…).
Just in case I missed some difference, I also compiled an ER-X-SFP image from scratch with just the network reconfigured, but that also did not work (not sure if the result is identical and can receive but not TX, since I built a minimal image without opkg so cannot install tcpdump. Will retest with a bigger image later). Edit: seems the self-built ER-X-SFP image (from openwrt master) is slightly different from the official ER-X image (24.10.5), since on my self-built image I do not receive anything on eth0. I rechecked with the ER-X image to see that I did not misinterpret, but I really see data from my network there, and with my own image only outgoing DHCP requests from the ER. So there must be some (relevant) detail I’m missing, or maybe a version difference…*
Built with this diff:
diff --git a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts
index 9f1e0a8d20..4aaed91a46 100644
--- a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts
+++ b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts
@@ -4,12 +4,6 @@ / {
model = "Ubiquiti EdgeRouter X SFP";
compatible = "ubnt,edgerouter-x-sfp", "mediatek,mt7621-soc";
- sfp_eth5: sfp_eth5 {
- compatible = "sff,sfp";
- i2c-bus = <&i2c>;
- mod-def0-gpio = <&expander0 5 GPIO_ACTIVE_LOW>;
- maximum-power-milliwatt = <1000>;
- };
};
&i2c {
@@ -52,12 +46,6 @@ sfp_i2c_clk_gate {
};
};
-&mdio {
- ephy7: ethernet-phy@7 {
- reg = <7>;
- sfp = <&sfp_eth5>;
- };
-};
&rgmii2_pins {
rgmii2 {
@@ -65,16 +53,24 @@ rgmii2 {
};
};
+
+&gmac1 {
+ status = "okay";
+ openwrt,netdev-name = "eth0";
+ phy-handle = <ðphy0>;
+
+ nvmem-cells = <&macaddr_factory_22 0>;
+ nvmem-cell-names = "mac-address";
+};
+
+ðphy0 {
+ /delete-property/ interrupts;
+};
+
&switch0 {
ports {
- port@5 {
- reg = <5>;
- openwrt,netdev-name = "eth5";
- phy-handle = <&ephy7>;
- phy-mode = "rgmii-rxid";
- nvmem-cells = <&macaddr_factory_22 5>;
- nvmem-cell-names = "mac-address";
- /delete-property/ label;
+ port@0 {
+ status = "disabled";
};
};
};




