OSDN Git Service

bnxt_en: Enable batch mode when using HWRM_NVM_MODIFY to flash packages.
authorMichael Chan <michael.chan@broadcom.com>
Sun, 13 Dec 2020 11:51:46 +0000 (06:51 -0500)
committerJakub Kicinski <kuba@kernel.org>
Tue, 15 Dec 2020 02:52:44 +0000 (18:52 -0800)
commita86b313e18178b39fcca4850d4dfeb5af1e3dc7e
tree80aa07110e872daac1a41d57d09d5b925c9c858a
parent1432c3f6a6ca091db10b60c7b9078f34f4c5268d
bnxt_en: Enable batch mode when using HWRM_NVM_MODIFY to flash packages.

The current scheme allocates a DMA buffer as big as the requested
firmware package file and DMAs the contents to firmware in one
operation.  The buffer size can be several hundred kilo bytes and
the driver may not be able to allocate the memory.  This will cause
firmware upgrade to fail.

Improve the scheme by using smaller DMA blocks and calling firmware to
DMA each block in a batch mode.  Older firmware can cause excessive
NVRAM erases if the block size is too small so we try to allocate a
256K buffer to begin with and size it down successively if we cannot
allocate the memory.

Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c