cxgb4: FW upgrade fixes
authorArjun Vynipadath <[email protected]>
Tue, 30 May 2017 12:36:06 +0000 (18:06 +0530)
committerDavid S. Miller <[email protected]>
Tue, 30 May 2017 18:12:29 +0000 (14:12 -0400)
Disable FW_OK flag while flashing Firmware. This will help to fix any
potential mailbox timeouts during Firmware flash.

Grab new devlog parameters after Firmware restart. When we FLASH new
Firmware onto an adapter, the new Firmware may have the Firmware Device Log
located at a different memory address or have a different size for it.

Signed-off-by: Arjun Vynipadath <[email protected]>
Signed-off-by: Casey Leedom <[email protected]>
Signed-off-by: Ganesh Goudar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c

index b97ce4a15ae033f4411e5594c26f622481499687..9160c882fbfcf2d205efda4fd6f725bf72b5fdb6 100644 (file)
@@ -6288,13 +6288,18 @@ int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
        if (!t4_fw_matches_chip(adap, fw_hdr))
                return -EINVAL;
 
+       /* Disable FW_OK flag so that mbox commands with FW_OK flag set
+        * wont be sent when we are flashing FW.
+        */
+       adap->flags &= ~FW_OK;
+
        ret = t4_fw_halt(adap, mbox, force);
        if (ret < 0 && !force)
-               return ret;
+               goto out;
 
        ret = t4_load_fw(adap, fw_data, size);
        if (ret < 0)
-               return ret;
+               goto out;
 
        /*
         * Older versions of the firmware don't understand the new
@@ -6305,7 +6310,17 @@ int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
         * its header flags to see if it advertises the capability.
         */
        reset = ((be32_to_cpu(fw_hdr->flags) & FW_HDR_FLAGS_RESET_HALT) == 0);
-       return t4_fw_restart(adap, mbox, reset);
+       ret = t4_fw_restart(adap, mbox, reset);
+
+       /* Grab potentially new Firmware Device Log parameters so we can see
+        * how healthy the new Firmware is.  It's okay to contact the new
+        * Firmware for these parameters even though, as far as it's
+        * concerned, we've never said "HELLO" to it ...
+        */
+       (void)t4_init_devlog_params(adap);
+out:
+       adap->flags |= FW_OK;
+       return ret;
 }
 
 /**