Skip to content

Commit 424e783

Browse files
manishc88kuba-moo
authored andcommitted
bnx2x: fix built-in kernel driver load failure
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>
1 parent f1858c2 commit 424e783

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
@@ -2533,6 +2533,4 @@ void bnx2x_register_phc(struct bnx2x *bp);
25332533
* Meant for implicit re-load flows.
25342534
*/
25352535
int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp);
2536-
int bnx2x_init_firmware(struct bnx2x *bp);
2537-
void bnx2x_release_firmware(struct bnx2x *bp);
25382536
#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
@@ -2364,24 +2364,30 @@ int bnx2x_compare_fw_ver(struct bnx2x *bp, u32 load_code, bool print_err)
23642364
/* is another pf loaded on this engine? */
23652365
if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP &&
23662366
load_code != FW_MSG_CODE_DRV_LOAD_COMMON) {
2367-
/* build my FW version dword */
2368-
u32 my_fw = (bp->fw_major) + (bp->fw_minor << 8) +
2369-
(bp->fw_rev << 16) + (bp->fw_eng << 24);
2367+
u8 loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw_eng;
2368+
u32 loaded_fw;
23702369

23712370
/* read loaded FW from chip */
2372-
u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
2371+
loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
23732372

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

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

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

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

1232012320
bnx2x_read_fwinfo(bp);
1232112321

12322-
if (IS_PF(bp)) {
12323-
rc = bnx2x_init_firmware(bp);
12324-
12325-
if (rc) {
12326-
bnx2x_free_mem_bp(bp);
12327-
return rc;
12328-
}
12329-
}
12330-
1233112322
func = BP_FUNC(bp);
1233212323

1233312324
/* need to reset chip if undi was active */
@@ -12340,7 +12331,6 @@ static int bnx2x_init_bp(struct bnx2x *bp)
1234012331

1234112332
rc = bnx2x_prev_unload(bp);
1234212333
if (rc) {
12343-
bnx2x_release_firmware(bp);
1234412334
bnx2x_free_mem_bp(bp);
1234512335
return rc;
1234612336
}
@@ -13409,7 +13399,7 @@ do { \
1340913399
(u8 *)bp->arr, len); \
1341013400
} while (0)
1341113401

13412-
int bnx2x_init_firmware(struct bnx2x *bp)
13402+
static int bnx2x_init_firmware(struct bnx2x *bp)
1341313403
{
1341413404
const char *fw_file_name, *fw_file_name_v15;
1341513405
struct bnx2x_fw_file_hdr *fw_hdr;
@@ -13509,7 +13499,7 @@ int bnx2x_init_firmware(struct bnx2x *bp)
1350913499
return rc;
1351013500
}
1351113501

13512-
void bnx2x_release_firmware(struct bnx2x *bp)
13502+
static void bnx2x_release_firmware(struct bnx2x *bp)
1351313503
{
1351413504
kfree(bp->init_ops_offsets);
1351513505
kfree(bp->init_ops);
@@ -14026,7 +14016,6 @@ static int bnx2x_init_one(struct pci_dev *pdev,
1402614016
return 0;
1402714017

1402814018
init_one_freemem:
14029-
bnx2x_release_firmware(bp);
1403014019
bnx2x_free_mem_bp(bp);
1403114020

1403214021
init_one_exit:

0 commit comments

Comments
 (0)