]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnx2x: Free NVRAM lock at end of each page
authorYuval Mintz <Yuval.Mintz@qlogic.com>
Mon, 10 Aug 2015 09:49:36 +0000 (12:49 +0300)
committerDan Duval <dan.duval@oracle.com>
Mon, 19 Oct 2015 22:11:55 +0000 (18:11 -0400)
Orabug: 22066196

Writing each 4Kb page into flash might take up-to ~100 miliseconds,
during which time management firmware cannot acces the nvram for its
own uses.

Firmware upgrade utility use the ethtool API to burn new flash images
for the device via the ethtool API, doing so by writing several page-worth
of data on each command. Such action might create problems for the
management firmware, as the nvram might not be accessible for a long time.

This patch changes the write implementation, releasing the nvram lock on
the completion of each page, allowing the management firmware time to
claim it and perform its own required actions.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0ea853dfa93371e651d8b7b27fd2344e973a86ed)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

index 6f909077b919281bfb51661f7aecea41b7b3ed2f..aeb7ce64452e14cd3cbe49325f63bae2d99e3ef2 100644 (file)
@@ -1723,6 +1723,22 @@ static int bnx2x_nvram_write(struct bnx2x *bp, u32 offset, u8 *data_buf,
                offset += sizeof(u32);
                data_buf += sizeof(u32);
                written_so_far += sizeof(u32);
+
+               /* At end of each 4Kb page, release nvram lock to allow MFW
+                * chance to take it for its own use.
+                */
+               if ((cmd_flags & MCPR_NVM_COMMAND_LAST) &&
+                   (written_so_far < buf_size)) {
+                       DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
+                          "Releasing NVM lock after offset 0x%x\n",
+                          (u32)(offset - sizeof(u32)));
+                       bnx2x_release_nvram_lock(bp);
+                       usleep_range(1000, 2000);
+                       rc = bnx2x_acquire_nvram_lock(bp);
+                       if (rc)
+                               return rc;
+               }
+
                cmd_flags = 0;
        }