Skip to content

Commit 28ea334

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix VF mac address regression.
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]>
1 parent bbd6528 commit 28ea334

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
@@ -8027,7 +8027,7 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p)
80278027
if (ether_addr_equal(addr->sa_data, dev->dev_addr))
80288028
return 0;
80298029

8030-
rc = bnxt_approve_mac(bp, addr->sa_data);
8030+
rc = bnxt_approve_mac(bp, addr->sa_data, true);
80318031
if (rc)
80328032
return rc;
80338033

@@ -8827,14 +8827,19 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
88278827
} else {
88288828
#ifdef CONFIG_BNXT_SRIOV
88298829
struct bnxt_vf_info *vf = &bp->vf;
8830+
bool strict_approval = true;
88308831

88318832
if (is_valid_ether_addr(vf->mac_addr)) {
88328833
/* overwrite netdev dev_addr with admin VF MAC */
88338834
memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
8835+
/* Older PF driver or firmware may not approve this
8836+
* correctly.
8837+
*/
8838+
strict_approval = false;
88348839
} else {
88358840
eth_hw_addr_random(bp->dev);
88368841
}
8837-
rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
8842+
rc = bnxt_approve_mac(bp, bp->dev->dev_addr, strict_approval);
88388843
#endif
88398844
}
88408845
return rc;

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ void bnxt_update_vf_mac(struct bnxt *bp)
11041104
mutex_unlock(&bp->hwrm_cmd_lock);
11051105
}
11061106

1107-
int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
1107+
int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
11081108
{
11091109
struct hwrm_func_vf_cfg_input req = {0};
11101110
int rc = 0;
@@ -1122,12 +1122,13 @@ int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
11221122
memcpy(req.dflt_mac_addr, mac, ETH_ALEN);
11231123
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
11241124
mac_done:
1125-
if (rc) {
1125+
if (rc && strict) {
11261126
rc = -EADDRNOTAVAIL;
11271127
netdev_warn(bp->dev, "VF MAC address %pM not approved by the PF\n",
11281128
mac);
1129+
return rc;
11291130
}
1130-
return rc;
1131+
return 0;
11311132
}
11321133
#else
11331134

@@ -1144,7 +1145,7 @@ void bnxt_update_vf_mac(struct bnxt *bp)
11441145
{
11451146
}
11461147

1147-
int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
1148+
int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
11481149
{
11491150
return 0;
11501151
}

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)