bnx2x: Free NVRAM lock at end of each page

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>
This commit is contained in:
Yuval Mintz 2015-08-10 12:49:36 +03:00 committed by David S. Miller
parent e1615903eb
commit 0ea853dfa9

View File

@ -1718,6 +1718,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;
}