Page MenuHomeFreeBSD

axe: fix spurious link flaps from MII
Needs ReviewPublic

Authored by rkitover_gmail.com on Wed, Mar 18, 7:04 PM.
Referenced Files
F149679240: D55925.diff
Thu, Mar 26, 5:22 AM
F149674154: D55925.id173865.diff
Thu, Mar 26, 4:25 AM
F149647432: D55925.id173866.diff
Wed, Mar 25, 11:25 PM
F149600556: D55925.diff
Wed, Mar 25, 1:12 PM
Unknown Object (File)
Tue, Mar 24, 8:35 PM
Unknown Object (File)
Tue, Mar 24, 6:23 PM
Unknown Object (File)
Tue, Mar 24, 6:13 PM
Unknown Object (File)
Tue, Mar 24, 12:38 AM
Subscribers

Details

Reviewers
adrian
pouria
zlei
Summary

A race condition in the MII layer causes spurious link down events, see:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252165

. In statchg, on link down, check if the PHY reports the link as
actually down using the BMSR register, if not, force the status of the
link to back up. Do the same in a MII linkchg handler.

I have tested this patch with an ASIX AX88772B USB 2.0 interface, and it
fixes the link flaps.

Differential Review:

Signed-off-by: Rafael Kitover <rkitover@gmail.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71492
Build 68375: arc lint + arc unit

Event Timeline

Environment:

Hardware: ASIX Electronics Corp. AX88772 (BUFFALO LUA3-U2-ATX, 100Base Ethernet)
Tested on: Raspberry Pi 4(16-current), Raspberry Pi Zero 2W(15.0-RELEASE), Pine64(15.0-RELEASE)

Description:
I am experiencing a "link flapping" issue where the connection repeatedly toggles between UP and DOWN. Unfortunately, this issue persists even after applying the latest patch.

The logs show frequent "spurious link down" messages[OK] and link state changes[NG], as seen below:

Log Output:

Mar 23 16:01:29 generic syslogd: last message repeated 9 times
Mar 23 16:01:29 generic kernel: ue0: link state changed to DOWN
Mar 23 16:01:29 generic kernel: ue0: link state changed to UP
Mar 23 16:01:30 generic kernel: axe0: spurious link down (PHY link up), overriding
Mar 23 16:01:31 generic syslogd: last message repeated 1 times
Mar 23 16:01:31 generic kernel: ue0: link state changed to DOWN
Mar 23 16:01:31 generic kernel: axe0: spurious link down (PHY link up), overriding
Mar 23 16:01:31 generic syslogd: last message repeated 2 times
Mar 23 16:01:31 generic kernel: ue0: link state changed to UP
Mar 23 16:01:31 generic kernel: ue0: link state changed to DOWN
Mar 23 16:01:31 generic kernel: axe0: spurious link down (PHY link up), overriding
Mar 23 16:01:31 generic kernel: ue0: link state changed to UP
Mar 23 16:01:32 generic kernel: axe0: spurious link down (PHY link up), overriding
Mar 23 16:01:40 generic syslogd: last message repeated 10 times
Mar 23 16:01:40 generic kernel: ue0: link state changed to DOWN
Mar 23 16:01:40 generic kernel: ue0: 3 link states coalesced
Mar 23 16:01:40 generic kernel: ue0: link state changed to UP
Mar 23 16:01:42 generic kernel: axe0: spurious link down (PHY link up), overriding

Notes:
I also use a ure driver dongle (Lenovo USB-C to LAN). In that case, the similar issue was successfully resolved by the ure patch, but the axe driver (AX88772) still exhibits this behavior.

Please let me know if you need any further debug information.

FYI: My testing methodology

Setup:

  • Machine A (Remote): Run ping [Unassigned Local IP].
  • Machine B (Target): Run the route -n monitor command in four separate instances.

Note: In my environment, the link issue only occurs while route -n monitor is running. If the command is not active, the connection remains stable.

Thank you for testing,

I'll run some tests and try to find the issue.