Skip to content

Commit 4899f3b

Browse files
Michael Chanjfvogel
authored andcommitted
bnxt_en: Fix VF mac address regression.
Orabug: 28609280 The recent commit to always forward the VF MAC address to the PF for approval may not work if the PF driver or the firmware is older. This will cause the VF driver to fail during probe: bnxt_en 0000:00:03.0 (unnamed net_device) (uninitialized): hwrm req_type 0xf seq id 0x5 error 0xffff bnxt_en 0000:00:03.0 (unnamed net_device) (uninitialized): VF MAC address 00:00:17:02:05:d0 not approved by the PF bnxt_en 0000:00:03.0: Unable to initialize mac address. bnxt_en: probe of 0000:00:03.0 failed with error -99 We fix it by treating the error as fatal only if the VF MAC address is locally generated by the VF. Fixes: 707e7e9 ("bnxt_en: Always forward VF MAC address to the PF.") Reported-by: Seth Forshee <[email protected]> Reported-by: Siwei Liu <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]> (cherry picked from commit 28ea334) Signed-off-by: Brian Maly <[email protected]> Reviewed-by: Jack Vogel <[email protected]>
1 parent d3f793a commit 4899f3b

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7912,7 +7912,7 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p)
79127912
if (ether_addr_equal(addr->sa_data, dev->dev_addr))
79137913
return 0;
79147914

7915-
rc = bnxt_approve_mac(bp, addr->sa_data);
7915+
rc = bnxt_approve_mac(bp, addr->sa_data, true);
79167916
if (rc)
79177917
return rc;
79187918

@@ -8734,14 +8734,19 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
87348734
} else {
87358735
#ifdef CONFIG_BNXT_SRIOV
87368736
struct bnxt_vf_info *vf = &bp->vf;
8737+
bool strict_approval = true;
87378738

87388739
if (is_valid_ether_addr(vf->mac_addr)) {
87398740
/* overwrite netdev dev_addr with admin VF MAC */
87408741
memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
8742+
/* Older PF driver or firmware may not approve this
8743+
* correctly.
8744+
*/
8745+
strict_approval = false;
87418746
} else {
87428747
eth_hw_addr_random(bp->dev);
87438748
}
8744-
rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
8749+
rc = bnxt_approve_mac(bp, bp->dev->dev_addr, strict_approval);
87458750
#endif
87468751
}
87478752
return rc;

drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ void bnxt_update_vf_mac(struct bnxt *bp)
10981098
mutex_unlock(&bp->hwrm_cmd_lock);
10991099
}
11001100

1101-
int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
1101+
int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
11021102
{
11031103
struct hwrm_func_vf_cfg_input req = {0};
11041104
int rc = 0;
@@ -1116,12 +1116,13 @@ int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
11161116
memcpy(req.dflt_mac_addr, mac, ETH_ALEN);
11171117
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
11181118
mac_done:
1119-
if (rc) {
1119+
if (rc && strict) {
11201120
rc = -EADDRNOTAVAIL;
11211121
netdev_warn(bp->dev, "VF MAC address %pM not approved by the PF\n",
11221122
mac);
1123+
return rc;
11231124
}
1124-
return rc;
1125+
return 0;
11251126
}
11261127
#else
11271128

@@ -1138,7 +1139,7 @@ void bnxt_update_vf_mac(struct bnxt *bp)
11381139
{
11391140
}
11401141

1141-
int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
1142+
int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
11421143
{
11431144
return 0;
11441145
}

drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs);
3939
void bnxt_sriov_disable(struct bnxt *);
4040
void bnxt_hwrm_exec_fwd_req(struct bnxt *);
4141
void bnxt_update_vf_mac(struct bnxt *);
42-
int bnxt_approve_mac(struct bnxt *, u8 *);
42+
int bnxt_approve_mac(struct bnxt *, u8 *, bool);
4343
#endif

0 commit comments

Comments
 (0)