[Bug 267514] AXGE(4) ASIX AX88179A ue0: link state changed to DOWN

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 10 Mar 2024 18:19:30 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267514

Andrey Kosachenko <Andrey.Kosachenko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Andrey.Kosachenko@gmail.com

--- Comment #8 from Andrey Kosachenko <Andrey.Kosachenko@gmail.com> ---
(In reply to karl from comment #5)

The same issue observed over here too.

» uname -v
FreeBSD 14.0-RELEASE #0 releng/14.0-n265380-f9716eee8ab4: Fri Nov 10 05:57:23
UTC 2023    
root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC


I've got a usb-dock with 1GB ethernet port:
===
~ » usbconfig -d1.7 dump_device_desc
ugen1.7: <ASIX AX88179A> at usbus1, cfg=1 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE
(46mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0320 
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0009 
  idVendor = 0x0b95 
  idProduct = 0x1790 
  bcdDevice = 0x0200 
  iManufacturer = 0x0001  <ASIX>
  iProduct = 0x0002  <AX88179A>
  iSerialNumber = 0x0003  <00324FA6>
  bNumConfigurations = 0x0003 
===

the links used to go up/down constantly (every 30-40 secs):

===
 » ssed -nRe '/Mar  9.+ue0: link state/p;' /var/log/messages | tail            
                                                                               
                                                                            
silent@beastie
Mar  9 23:53:20 beastie kernel: ue0: link state changed to DOWN
Mar  9 23:53:21 beastie kernel: ue0: link state changed to UP
Mar  9 23:56:10 beastie kernel: ue0: link state changed to DOWN
Mar  9 23:56:10 beastie kernel: ue0: link state changed to UP
Mar  9 23:56:20 beastie kernel: ue0: link state changed to DOWN
Mar  9 23:56:21 beastie kernel: ue0: link state changed to UP
Mar  9 23:59:10 beastie kernel: ue0: link state changed to DOWN
Mar  9 23:59:10 beastie kernel: ue0: link state changed to UP
Mar  9 23:59:11 beastie kernel: ue0: link state changed to DOWN
Mar  9 23:59:11 beastie kernel: ue0: link state changed to UP

 » ssed -nRe 's/(Mar  9 [0-9]+):[0-9]+:[0-9]+(.+ue0: link state
changed)/\1H:MM:SS\2/p;' /var/log/messages | sort | uniq -c
 121 Mar  9 21H:MM:SS beastie kernel: ue0: link state changed to DOWN
 121 Mar  9 21H:MM:SS beastie kernel: ue0: link state changed to UP
  97 Mar  9 22H:MM:SS beastie kernel: ue0: link state changed to DOWN
  97 Mar  9 22H:MM:SS beastie kernel: ue0: link state changed to UP
 102 Mar  9 23H:MM:SS beastie kernel: ue0: link state changed to DOWN
 102 Mar  9 23H:MM:SS beastie kernel: ue0: link state changed to UP
===


There is a workaround though found in this thread (suggested by PHK):
https://lists.freebsd.org/archives/freebsd-current/2024-March/005680.html.
NB: that workaround comes at cost though (speed decreases, nevertheless in my
case I was able to get more than 200Mbps which is fine for my use case)
Seems PHK added quirk into the src. Whereas the same can be achieved via
usbconfig.

In particular did the following:

By default device is attache axge driver:
===
» usbconfig -d1.7 show_ifdrv
ugen1.7: <ASIX AX88179A> at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE
(46mA)
ugen1.7.0: axge0: <NetworkInterface>
===


so decided to find out whether the suggested trick to replace it with cdce will
work. 
First of all found out that device supports several configurations (default is
0):
===
» usbconfig -d1.7 dump_all_desc | egrep '(bNumConfigurations|Configuration
index)'
  bNumConfigurations = 0x0003 
 Configuration index 0
 Configuration index 1
 Configuration index 2
===


so tried it to change to 1 and it worked out:
===
~ » sudo usbconfig -d 1.7 set_config 1

~ » usbconfig -d1.7 show_ifdrv
ugen1.7: <ASIX AX88179A> at usbus1, cfg=1 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE
(46mA)
ugen1.7.0: cdce0: <ASIX AX88179A, class 0/0, rev 3.20/2.00, addr 33>
===


after that was done no link up/down flapping observed anymore.
Extended devd configuration (to avoid manual handling) and it works quite well
(configuration below includes lagg (failover to WiFi), so it looks a bit
excessive but I believe the idea is clear)
===
notify 100 {
    match "system"      "USB";
    match "subsystem"   "DEVICE";
    match "type"        "ATTACH";
    match "vendor"      "0x0b95";
    match "product"     "0x1790";
    # action "logger -tUE0 /usr/sbin/usbconfig -d $cdev set_config 1";
    action "/usr/sbin/usbconfig -d $cdev set_config 1 && /usr/sbin/usbconfig -d
$cdev power_save";
};


notify 100 {
    match "system"      "IFNET";
    match "subsystem"   "ue0";
    match "type"        "ATTACH";
    action "/sbin/ifconfig $subsystem up promisc";
};


notify 100 {
    match "system"      "IFNET";
    match "subsystem"   "ue0";
    match "type"        "DETACH";
    action "/sbin/ifconfig lagg0 laggport wlan0 && /sbin/ifconfig wlan0 up";
};


notify 100 {
    match "system"      "IFNET";
    match "subsystem"   "ue0";
    match "type"        "LINK_UP";
    action "/sbin/ifconfig lagg0 laggport $subsystem -laggport wlan0 &&
/sbin/ifconfig wlan0 down";
};


notify 100 {
    match "system"      "IFNET";
    match "subsystem"   "ue0";
    match "type"        "LINK_DOWN";
    action "/sbin/ifconfig lagg0 laggport wlan0 && /sbin/ifconfig wlan0 up";
};

===


The workaroud (switchover from axge to cdce) is done very quickly:
===
Mar 10 19:26:28 beastie kernel: ugen1.7: <ASIX AX88179A> at usbus1
Mar 10 19:26:28 beastie kernel: axge0 on uhub5
Mar 10 19:26:28 beastie kernel: axge0: <NetworkInterface> on usbus1
Mar 10 19:26:28 beastie kernel: axge0: at uhub5, port 4, addr 33 (disconnected)
Mar 10 19:26:29 beastie kernel: axge0: attaching PHYs failed
Mar 10 19:26:29 beastie kernel: axge0: detached
Mar 10 19:26:29 beastie kernel: cdce0 on uhub5
Mar 10 19:26:29 beastie kernel: cdce0: <ASIX AX88179A, class 0/0, rev
3.20/2.00, addr 33> on usbus1
Mar 10 19:26:29 beastie kernel: ue0: <USB Ethernet> on cdce0
Mar 10 19:26:29 beastie kernel: ue0: Ethernet address: 20:7b:d2:32:4f:a6
===

and works with decent (for my use case) performance:
===
~ » speedtest

   Speedtest by Ookla

      Server: xxxx - xxxx (id: 6088)
         ISP: xxxxxxx Net
Idle Latency:     1.27 ms   (jitter: 0.04ms, low: 1.24ms, high: 1.34ms)
    Download:   195.24 Mbps (data used: 295.3 MB)                               
                  1.61 ms   (jitter: 4.53ms, low: 1.14ms, high: 245.98ms)
      Upload:   194.79 Mbps (data used: 277.4 MB)                               
                  2.26 ms   (jitter: 9.39ms, low: 1.26ms, high: 260.40ms)
 Packet Loss:     0.0%
===

Hope that helps to workaround the issue until the up/down flapping is fixed
normally

-- 
You are receiving this mail because:
You are the assignee for the bug.