Move the code that shuts down the IB link earlier in the unload
process, to be sure no new packets can arrive while we are unloading.
Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
 {
        int port;
 
-       ipath_shutdown_device(dd);
-
        if (*dd->ipath_statusp & IPATH_STATUS_CHIP_PRESENT) {
                /* can't do anything more with chip; needs re-init */
                *dd->ipath_statusp &= ~IPATH_STATUS_CHIP_PRESENT;
 
        ipath_cdbg(VERBOSE, "removing, pdev=%p, dd=%p\n", pdev, dd);
 
+       /*
+        * disable the IB link early, to be sure no new packets arrive, which
+        * complicates the shutdown process
+        */
+       ipath_shutdown_device(dd);
+
        if (dd->verbs_dev)
                ipath_unregister_ib_device(dd->verbs_dev);