em/emx: On attach path, perform another reset if the first one fails
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 23 Sep 2013 01:41:34 +0000 (09:41 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 23 Sep 2013 01:41:34 +0000 (09:41 +0800)
The second reset fixes the 82573L attaching failure.

Reported-and-Tested-by: Johannes Hofmann <Johannes.Hofmann@gmx.de>
sys/dev/netif/em/if_em.c
sys/dev/netif/emx/if_emx.c

index 456fdf1..845aa58 100644 (file)
@@ -790,9 +790,16 @@ em_attach(device_t dev)
        /* Reset the hardware */
        error = em_reset(adapter);
        if (error) {
-               device_printf(dev, "Unable to reset the hardware\n");
-               ether_ifdetach(ifp);
-               goto fail;
+               /*
+                * Some 82573 parts fail the first reset, call it again,
+                * if it fails a second time its a real issue.
+                */
+               error = em_reset(adapter);
+               if (error) {
+                       device_printf(dev, "Unable to reset the hardware\n");
+                       ether_ifdetach(ifp);
+                       goto fail;
+               }
        }
 
        /* Initialize statistics */
index 8ee505b..733cbe6 100644 (file)
@@ -825,9 +825,16 @@ emx_attach(device_t dev)
        /* Reset the hardware */
        error = emx_reset(sc);
        if (error) {
-               device_printf(dev, "Unable to reset the hardware\n");
-               ether_ifdetach(&sc->arpcom.ac_if);
-               goto fail;
+               /*
+                * Some 82573 parts fail the first reset, call it again,
+                * if it fails a second time its a real issue.
+                */
+               error = emx_reset(sc);
+               if (error) {
+                       device_printf(dev, "Unable to reset the hardware\n");
+                       ether_ifdetach(&sc->arpcom.ac_if);
+                       goto fail;
+               }
        }
 
        /* Initialize statistics */