We are maintaining MAC address twice which is unnecessary.
This patch removes the copy which helps reduce size of bnxt structure.
Fixes:
b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
#define BNXT_FLAG_FC_THREAD BIT(23)
#define BNXT_FLAG_RX_VECTOR_PKT_MODE BIT(24)
#define BNXT_FLAG_FLOW_XSTATS_EN BIT(25)
+#define BNXT_FLAG_DFLT_MAC_SET BIT(26)
#define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF))
#define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF)
#define BNXT_NPAR(bp) ((bp)->flags & BNXT_FLAG_NPAR_PF)
#define BNXT_HAS_NQ(bp) BNXT_CHIP_THOR(bp)
#define BNXT_HAS_RING_GRPS(bp) (!BNXT_CHIP_THOR(bp))
#define BNXT_FLOW_XSTATS_EN(bp) ((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
+#define BNXT_HAS_DFLT_MAC_SET(bp) ((bp)->flags & BNXT_FLAG_DFLT_MAC_SET)
uint32_t fw_cap;
#define BNXT_FW_CAP_HOT_RESET BIT(0)
uint8_t max_q;
uint16_t fw_fid;
- uint8_t dflt_mac_addr[RTE_ETHER_ADDR_LEN];
uint16_t max_rsscos_ctx;
uint16_t max_cp_rings;
uint16_t max_tx_rings;
return -ENOMEM;
}
- if (bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN)) {
+ if (!BNXT_HAS_DFLT_MAC_SET(bp)) {
if (BNXT_PF(bp))
return -EINVAL;
bp->mac_addr[3], bp->mac_addr[4], bp->mac_addr[5]);
rc = bnxt_hwrm_set_mac(bp);
- if (!rc)
- memcpy(&bp->eth_dev->data->mac_addrs[0], bp->mac_addr,
- RTE_ETHER_ADDR_LEN);
- return rc;
+ if (rc)
+ return rc;
}
/* Copy the permanent MAC from the FUNC_QCAPS response */
- memcpy(bp->mac_addr, bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN);
memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, RTE_ETHER_ADDR_LEN);
return rc;
int rc = 0;
/* MAC is already configured in FW */
- if (!bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN))
+ if (BNXT_HAS_DFLT_MAC_SET(bp))
return 0;
/* Restore the old MAC configured */
}
bp->fw_fid = rte_le_to_cpu_32(resp->fid);
- memcpy(bp->dflt_mac_addr, &resp->mac_address, RTE_ETHER_ADDR_LEN);
+ if (!bnxt_check_zero_bytes(resp->mac_address, RTE_ETHER_ADDR_LEN)) {
+ bp->flags |= BNXT_FLAG_DFLT_MAC_SET;
+ memcpy(bp->mac_addr, &resp->mac_address, RTE_ETHER_ADDR_LEN);
+ } else {
+ bp->flags &= ~BNXT_FLAG_DFLT_MAC_SET;
+ }
bp->max_rsscos_ctx = rte_le_to_cpu_16(resp->max_rsscos_ctx);
bp->max_cp_rings = rte_le_to_cpu_16(resp->max_cmpl_rings);
bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
HWRM_CHECK_RESULT();
- memcpy(bp->dflt_mac_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN);
HWRM_UNLOCK();
return rc;