]> xenbits.xensource.com Git - arm/linux.git/commitdiff
bnxt_en: Always forward VF MAC address to the PF.
authorMichael Chan <michael.chan@broadcom.com>
Tue, 8 May 2018 07:18:41 +0000 (03:18 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 May 2018 14:14:22 +0000 (10:14 -0400)
The current code already forwards the VF MAC address to the PF, except
in one case.  If the VF driver gets a valid MAC address from the firmware
during probe time, it will not forward the MAC address to the PF,
incorrectly assuming that the PF already knows the MAC address.  This
causes "ip link show" to show zero VF MAC addresses for this case.

This assumption is not correct.  Newer firmware remembers the VF MAC
address last used by the VF and provides it to the VF driver during
probe.  So we need to always forward the VF MAC address to the PF.

The forwarded MAC address may now be the PF assigned MAC address and so we
need to make sure we approve it for this case.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c

index cd3ab788936f40d4147765870ef2f300908cfd4a..dfa0839f665613bc9ec0cf20e94df826708677bd 100644 (file)
@@ -8678,8 +8678,8 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
                        memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
                } else {
                        eth_hw_addr_random(bp->dev);
-                       rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
                }
+               rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
 #endif
        }
        return rc;
index cc21d874eb6e23e412b140616cd389d2527d2dd2..a64910892c25e9526c313fa86a7dec0e1b05bf6f 100644 (file)
@@ -923,7 +923,8 @@ static int bnxt_vf_configure_mac(struct bnxt *bp, struct bnxt_vf_info *vf)
        if (req->enables & cpu_to_le32(FUNC_VF_CFG_REQ_ENABLES_DFLT_MAC_ADDR)) {
                if (is_valid_ether_addr(req->dflt_mac_addr) &&
                    ((vf->flags & BNXT_VF_TRUST) ||
-                    (!is_valid_ether_addr(vf->mac_addr)))) {
+                    !is_valid_ether_addr(vf->mac_addr) ||
+                    ether_addr_equal(req->dflt_mac_addr, vf->mac_addr))) {
                        ether_addr_copy(vf->vf_mac_addr, req->dflt_mac_addr);
                        return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size);
                }