Skip to content

Commit bf5b7aa

Browse files
manishc88gregkh
authored andcommitted
bnx2x: fix built-in kernel driver load failure
[ Upstream commit 424e783 ] Commit b7a49f7 ("bnx2x: Utilize firmware 7.13.21.0") added request_firmware() logic in probe() which caused load failure when firmware file is not present in initrd (below), as access to firmware file is not feasible during probe. Direct firmware load for bnx2x/bnx2x-e2-7.13.15.0.fw failed with error -2 Direct firmware load for bnx2x/bnx2x-e2-7.13.21.0.fw failed with error -2 This patch fixes this issue by - 1. Removing request_firmware() logic from the probe() such that .ndo_open() handle it as it used to handle it earlier 2. Given request_firmware() is removed from probe(), so driver has to relax FW version comparisons a bit against the already loaded FW version (by some other PFs of same adapter) to allow different compatible/close enough FWs with which multiple PFs may run with (in different environments), as the given PF who is in probe flow has no idea now with which firmware file version it is going to initialize the device in ndo_open() Link: https://lore.kernel.org/all/46f2d9d9-ae7f-b332-ddeb-b59802be2bab@molgen.mpg.de/ Reported-by: Paul Menzel <pmenzel@molgen.mpg.de> Tested-by: Paul Menzel <pmenzel@molgen.mpg.de> Fixes: b7a49f7 ("bnx2x: Utilize firmware 7.13.21.0") Signed-off-by: Manish Chopra <manishc@marvell.com> Signed-off-by: Ariel Elior <aelior@marvell.com> Link: https://lore.kernel.org/r/20220316214613.6884-1-manishc@marvell.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c07fdba commit bf5b7aa

3 files changed

Lines changed: 19 additions & 26 deletions

File tree

drivers/net/ethernet/broadcom/bnx2x/bnx2x.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,6 +2534,4 @@ void bnx2x_register_phc(struct bnx2x *bp);
25342534
* Meant for implicit re-load flows.
25352535
*/
25362536
int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp);
2537-
int bnx2x_init_firmware(struct bnx2x *bp);
2538-
void bnx2x_release_firmware(struct bnx2x *bp);
25392537
#endif /* bnx2x.h */

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,24 +2363,30 @@ int bnx2x_compare_fw_ver(struct bnx2x *bp, u32 load_code, bool print_err)
23632363
/* is another pf loaded on this engine? */
23642364
if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP &&
23652365
load_code != FW_MSG_CODE_DRV_LOAD_COMMON) {
2366-
/* build my FW version dword */
2367-
u32 my_fw = (bp->fw_major) + (bp->fw_minor << 8) +
2368-
(bp->fw_rev << 16) + (bp->fw_eng << 24);
2366+
u8 loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw_eng;
2367+
u32 loaded_fw;
23692368

23702369
/* read loaded FW from chip */
2371-
u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
2370+
loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
23722371

2373-
DP(BNX2X_MSG_SP, "loaded fw %x, my fw %x\n",
2374-
loaded_fw, my_fw);
2372+
loaded_fw_major = loaded_fw & 0xff;
2373+
loaded_fw_minor = (loaded_fw >> 8) & 0xff;
2374+
loaded_fw_rev = (loaded_fw >> 16) & 0xff;
2375+
loaded_fw_eng = (loaded_fw >> 24) & 0xff;
2376+
2377+
DP(BNX2X_MSG_SP, "loaded fw 0x%x major 0x%x minor 0x%x rev 0x%x eng 0x%x\n",
2378+
loaded_fw, loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw_eng);
23752379

23762380
/* abort nic load if version mismatch */
2377-
if (my_fw != loaded_fw) {
2381+
if (loaded_fw_major != BCM_5710_FW_MAJOR_VERSION ||
2382+
loaded_fw_minor != BCM_5710_FW_MINOR_VERSION ||
2383+
loaded_fw_eng != BCM_5710_FW_ENGINEERING_VERSION ||
2384+
loaded_fw_rev < BCM_5710_FW_REVISION_VERSION_V15) {
23782385
if (print_err)
2379-
BNX2X_ERR("bnx2x with FW %x was already loaded which mismatches my %x FW. Aborting\n",
2380-
loaded_fw, my_fw);
2386+
BNX2X_ERR("loaded FW incompatible. Aborting\n");
23812387
else
2382-
BNX2X_DEV_INFO("bnx2x with FW %x was already loaded which mismatches my %x FW, possibly due to MF UNDI\n",
2383-
loaded_fw, my_fw);
2388+
BNX2X_DEV_INFO("loaded FW incompatible, possibly due to MF UNDI\n");
2389+
23842390
return -EBUSY;
23852391
}
23862392
}

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12366,15 +12366,6 @@ static int bnx2x_init_bp(struct bnx2x *bp)
1236612366

1236712367
bnx2x_read_fwinfo(bp);
1236812368

12369-
if (IS_PF(bp)) {
12370-
rc = bnx2x_init_firmware(bp);
12371-
12372-
if (rc) {
12373-
bnx2x_free_mem_bp(bp);
12374-
return rc;
12375-
}
12376-
}
12377-
1237812369
func = BP_FUNC(bp);
1237912370

1238012371
/* need to reset chip if undi was active */
@@ -12387,7 +12378,6 @@ static int bnx2x_init_bp(struct bnx2x *bp)
1238712378

1238812379
rc = bnx2x_prev_unload(bp);
1238912380
if (rc) {
12390-
bnx2x_release_firmware(bp);
1239112381
bnx2x_free_mem_bp(bp);
1239212382
return rc;
1239312383
}
@@ -13469,7 +13459,7 @@ do { \
1346913459
(u8 *)bp->arr, len); \
1347013460
} while (0)
1347113461

13472-
int bnx2x_init_firmware(struct bnx2x *bp)
13462+
static int bnx2x_init_firmware(struct bnx2x *bp)
1347313463
{
1347413464
const char *fw_file_name, *fw_file_name_v15;
1347513465
struct bnx2x_fw_file_hdr *fw_hdr;
@@ -13569,7 +13559,7 @@ int bnx2x_init_firmware(struct bnx2x *bp)
1356913559
return rc;
1357013560
}
1357113561

13572-
void bnx2x_release_firmware(struct bnx2x *bp)
13562+
static void bnx2x_release_firmware(struct bnx2x *bp)
1357313563
{
1357413564
kfree(bp->init_ops_offsets);
1357513565
kfree(bp->init_ops);
@@ -14086,7 +14076,6 @@ static int bnx2x_init_one(struct pci_dev *pdev,
1408614076
return 0;
1408714077

1408814078
init_one_freemem:
14089-
bnx2x_release_firmware(bp);
1409014079
bnx2x_free_mem_bp(bp);
1409114080

1409214081
init_one_exit:

0 commit comments

Comments
 (0)