]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnxt_en: Re-arrange bnxt_hwrm_func_qcaps().
authorMichael Chan <michael.chan@broadcom.com>
Mon, 19 Sep 2016 07:58:05 +0000 (03:58 -0400)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 18:07:40 +0000 (13:07 -0500)
Orabug: 24567991

Re-arrange the code so that the generation of the random MAC address for
the VF is at the end of the function.  The next patch will add one more step
to call bnxt_approve_mac() to get the firmware to approve the random MAC
address.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7cc5a20e38fcaf395ac59e7ed6c3decb575a0dc7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 36e402db25a7d4207a0d29d526b5df98ea44c7cc..a9cd4e0339d29f46e3975a626504f1b41e34c264 100644 (file)
@@ -4179,6 +4179,11 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)
        if (rc)
                goto hwrm_func_qcaps_exit;
 
+       bp->tx_push_thresh = 0;
+       if (resp->flags &
+           cpu_to_le32(FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED))
+               bp->tx_push_thresh = BNXT_TX_PUSH_THRESH;
+
        if (BNXT_PF(bp)) {
                struct bnxt_pf_info *pf = &bp->pf;
 
@@ -4210,12 +4215,6 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)
                struct bnxt_vf_info *vf = &bp->vf;
 
                vf->fw_fid = le16_to_cpu(resp->fid);
-               memcpy(vf->mac_addr, resp->mac_address, ETH_ALEN);
-               if (is_valid_ether_addr(vf->mac_addr))
-                       /* overwrite netdev dev_adr with admin VF MAC */
-                       memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
-               else
-                       random_ether_addr(bp->dev->dev_addr);
 
                vf->max_rsscos_ctxs = le16_to_cpu(resp->max_rsscos_ctx);
                vf->max_cp_rings = le16_to_cpu(resp->max_cmpl_rings);
@@ -4227,14 +4226,16 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)
                vf->max_l2_ctxs = le16_to_cpu(resp->max_l2_ctxs);
                vf->max_vnics = le16_to_cpu(resp->max_vnics);
                vf->max_stat_ctxs = le16_to_cpu(resp->max_stat_ctx);
+
+               memcpy(vf->mac_addr, resp->mac_address, ETH_ALEN);
+               if (is_valid_ether_addr(vf->mac_addr))
+                       /* overwrite netdev dev_adr with admin VF MAC */
+                       memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
+               else
+                       random_ether_addr(bp->dev->dev_addr);
 #endif
        }
 
-       bp->tx_push_thresh = 0;
-       if (resp->flags &
-           cpu_to_le32(FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED))
-               bp->tx_push_thresh = BNXT_TX_PUSH_THRESH;
-
 hwrm_func_qcaps_exit:
        mutex_unlock(&bp->hwrm_cmd_lock);
        return rc;