After moving my HP Color LaserJet Pro MFP M477fdw from my Huawei S6720-32C-PWH-SI to a Ubiquiti Unifi Switch Flex running OpenWrt master, I noticed the printer randomly coming out of standby. Looking at the OpenWrt log, I noticed the DSA interface connected to the printer to be flapping.

root@sw4:~# logread -e lan3: | tail -n 10
Tue Dec  3 15:06:59 2024 kern.info kernel: [268169.045070] mt7530-mdio mdio-bus:1f lan3: Link is Down
Tue Dec  3 15:07:04 2024 kern.info kernel: [268173.349006] mt7530-mdio mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control off
Tue Dec  3 15:29:45 2024 kern.info kernel: [269534.550197] mt7530-mdio mdio-bus:1f lan3: Link is Down
Tue Dec  3 15:29:49 2024 kern.info kernel: [269538.824008] mt7530-mdio mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control off
Tue Dec  3 15:52:29 2024 kern.info kernel: [270898.821547] mt7530-mdio mdio-bus:1f lan3: Link is Down
Tue Dec  3 15:52:33 2024 kern.info kernel: [270903.091741] mt7530-mdio mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control off
Tue Dec  3 17:14:44 2024 kern.info kernel: [275834.043343] mt7530-mdio mdio-bus:1f lan3: Link is Down
Tue Dec  3 17:14:49 2024 kern.info kernel: [275838.247726] mt7530-mdio mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control off
Tue Dec  3 17:45:41 2024 kern.info kernel: [277690.946838] mt7530-mdio mdio-bus:1f lan3: Link is Down
Tue Dec  3 17:45:45 2024 kern.info kernel: [277695.018574] mt7530-mdio mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control off

After checking the cable was properly plugged in on both ends, I checked if Energy-Efficient Ethernet (EEE) was enabled.

root@sw4:~# ethtool --show-eee lan3
EEE Settings for lan3:
        EEE status: enabled - active
        Tx LPI: 30 (us)
        Supported EEE link modes:  100baseT/Full
                                   1000baseT/Full
        Advertised EEE link modes:  100baseT/Full
                                    1000baseT/Full
        Link partner advertised EEE link modes:  100baseT/Full
                                                 1000baseT/Full

Disabling it manually with ethtool seems to solve the problem.

ethtool --set-eee lan3 eee off

Unfortunately that does not survive a reboot. After a bit of STFW, I could not find a working way to do it in /etc/config/network, so that it would survive a reboot. Fortunately the netifd source gave a hint. Adding the following section to /etc/config/network, and triggering a netifd reload, seems to disable EEE persistently.

config device 'lan3'
        option name 'lan3'
        option eee '0'
root@sw4:~# ifup foo
Interface foo not found
root@sw4:~# ethtool --show-eee lan3
EEE Settings for lan3:
        EEE status: disabled
        Tx LPI: disabled
        Supported EEE link modes:  100baseT/Full
                                   1000baseT/Full
        Advertised EEE link modes:  Not reported
        Link partner advertised EEE link modes:  100baseT/Full
                                                 1000baseT/Full

I use a non-existent interface there, as using an existing interface would result in temporary loss of network connectivity.

This probably also works on a normal Ethernet interface, but I couldn't immediately find a device with a normal Ethernet interface that supports EEE and is running OpenWrt.