]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[axge] Reapply USB device configuration when opening network device
authorMichael Brown <mcb30@ipxe.org>
Fri, 3 Jul 2020 19:17:25 +0000 (20:17 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 3 Jul 2020 19:23:39 +0000 (20:23 +0100)
When connected to a USB3 port, the AX88179 seems to have an
approximately 50% chance of producing a USB transaction error on each
of its three endpoints after being closed and reopened.  The root
cause is unclear, but rewriting the USB device configuration value
seems to clear whatever internal error state has accumulated.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/axge.c
src/drivers/net/axge.h

index 1106c1e6f0600b9aa2f84a1629590fe6273d17f2..fb274d24f999a8b209f38c7064352867888f0c67 100644 (file)
@@ -531,6 +531,13 @@ static int axge_open ( struct net_device *netdev ) {
        uint16_t rcr;
        int rc;
 
+       /* Reapply device configuration to avoid transaction errors */
+       if ( ( rc = usb_set_configuration ( axge->usb, axge->config ) ) != 0 ) {
+               DBGC ( axge, "AXGE %p could not set configuration: %s\n",
+                      axge, strerror ( rc ) );
+               goto err_set_configuration;
+       }
+
        /* Open USB network device */
        if ( ( rc = usbnet_open ( &axge->usbnet ) ) != 0 ) {
                DBGC ( axge, "AXGE %p could not open: %s\n",
@@ -567,6 +574,7 @@ static int axge_open ( struct net_device *netdev ) {
  err_write_mac:
        usbnet_close ( &axge->usbnet );
  err_open:
+ err_set_configuration:
        return rc;
 }
 
@@ -674,6 +682,7 @@ static int axge_probe ( struct usb_function *func,
        axge->usb = usb;
        axge->bus = usb->port->hub->bus;
        axge->netdev = netdev;
+       axge->config = config->config;
        usbnet_init ( &axge->usbnet, func, &axge_intr_operations,
                      &axge_in_operations, &axge_out_operations );
        usb_refill_init ( &axge->usbnet.intr, 0, 0, AXGE_INTR_MAX_FILL );
index 6183b4e703bffbc8eab17ae92eb203652b95dd01..e22e0ec47d8875a571c1bd34f83100e90bd2ce08 100644 (file)
@@ -145,6 +145,8 @@ struct axge_device {
        struct net_device *netdev;
        /** USB network device */
        struct usbnet_device usbnet;
+       /** Device configuration */
+       unsigned int config;
        /** Link state has changed */
        int check_link;
 };