X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_hwrm.c;h=4f0142cdbcb4c9cd0be7784edd7676c1c7b98b8e;hb=35b2d13fd6fdcbd191f2a30d74648faeb1186c65;hp=b605659edbbe6e724c29f2652055cbc39241b157;hpb=50d3c51baecc5906cd72de549cc99b5c283aee96;p=dpdk.git diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index b605659edb..4f0142cdbc 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -26,7 +26,7 @@ #include -#define HWRM_CMD_TIMEOUT 10000 +#define HWRM_CMD_TIMEOUT 6000000 #define HWRM_SPEC_CODE_1_8_3 0x10803 #define HWRM_VERSION_1_9_1 0x10901 @@ -135,7 +135,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, if (*valid == HWRM_RESP_VALID_KEY) break; } - rte_delay_us(600); + rte_delay_us(1); } if (i >= HWRM_CMD_TIMEOUT) { @@ -393,11 +393,11 @@ int bnxt_hwrm_set_l2_filter(struct bnxt *bp, if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR) memcpy(req.l2_addr, filter->l2_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK) memcpy(req.l2_addr_mask, filter->l2_addr_mask, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN) req.l2_ovlan = filter->l2_ovlan; @@ -571,7 +571,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) } bp->fw_fid = rte_le_to_cpu_32(resp->fid); - memcpy(bp->dflt_mac_addr, &resp->mac_address, ETHER_ADDR_LEN); + memcpy(bp->dflt_mac_addr, &resp->mac_address, RTE_ETHER_ADDR_LEN); 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); @@ -591,7 +591,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->pf.total_vnics = rte_le_to_cpu_16(resp->max_vnics); if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED) { bp->flags |= BNXT_FLAG_PTP_SUPPORTED; - PMD_DRV_LOG(INFO, "PTP SUPPORTED\n"); + PMD_DRV_LOG(DEBUG, "PTP SUPPORTED\n"); HWRM_UNLOCK(); bnxt_hwrm_ptp_qcfg(bp); } @@ -789,7 +789,6 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) int rc = 0; struct hwrm_ver_get_input req = {.req_type = 0 }; struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr; - uint32_t my_version; uint32_t fw_version; uint16_t max_resp_len; char type[RTE_MEMZONE_NAMESIZE]; @@ -817,10 +816,6 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) PMD_DRV_LOG(INFO, "Driver HWRM version: %d.%d.%d\n", HWRM_VERSION_MAJOR, HWRM_VERSION_MINOR, HWRM_VERSION_UPDATE); - my_version = HWRM_VERSION_MAJOR << 16; - my_version |= HWRM_VERSION_MINOR << 8; - my_version |= HWRM_VERSION_UPDATE; - fw_version = resp->hwrm_intf_maj_8b << 16; fw_version |= resp->hwrm_intf_min_8b << 8; fw_version |= resp->hwrm_intf_upd_8b; @@ -832,21 +827,6 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) goto error; } - if (my_version != fw_version) { - PMD_DRV_LOG(INFO, "BNXT Driver/HWRM API mismatch.\n"); - if (my_version < fw_version) { - PMD_DRV_LOG(INFO, - "Firmware API version is newer than driver.\n"); - PMD_DRV_LOG(INFO, - "The driver may be missing features.\n"); - } else { - PMD_DRV_LOG(INFO, - "Firmware API version is older than driver.\n"); - PMD_DRV_LOG(INFO, - "Not all driver features may be functional.\n"); - } - } - if (bp->max_req_len > resp->max_req_win_len) { PMD_DRV_LOG(ERR, "Unsupported request length\n"); rc = -EINVAL; @@ -1349,8 +1329,8 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic) vnic->rss_rule = (uint16_t)HWRM_NA_SIGNATURE; vnic->cos_rule = (uint16_t)HWRM_NA_SIGNATURE; vnic->lb_rule = (uint16_t)HWRM_NA_SIGNATURE; - vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE; + vnic->mru = bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; HWRM_PREP(req, VNIC_ALLOC, BNXT_USE_CHIMP_MB); if (vnic->func_default) @@ -1460,9 +1440,12 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic) req.cos_rule = rte_cpu_to_le_16(vnic->cos_rule); req.lb_rule = rte_cpu_to_le_16(vnic->lb_rule); req.mru = rte_cpu_to_le_16(vnic->mru); - if (vnic->func_default) + /* Configure default VNIC only once. */ + if (vnic->func_default && !(bp->flags & BNXT_FLAG_DFLT_VNIC_SET)) { req.flags |= rte_cpu_to_le_32(HWRM_VNIC_CFG_INPUT_FLAGS_DEFAULT); + bp->flags |= BNXT_FLAG_DFLT_VNIC_SET; + } if (vnic->vlan_strip) req.flags |= rte_cpu_to_le_32(HWRM_VNIC_CFG_INPUT_FLAGS_VLAN_STRIP_MODE); @@ -1600,6 +1583,10 @@ int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic) HWRM_UNLOCK(); vnic->fw_vnic_id = INVALID_HW_RING_ID; + /* Configure default VNIC again if necessary. */ + if (vnic->func_default && (bp->flags & BNXT_FLAG_DFLT_VNIC_SET)) + bp->flags &= ~BNXT_FLAG_DFLT_VNIC_SET; + return rc; } @@ -2529,8 +2516,8 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings) HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS); req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags); req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU); - req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx); req.num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx); @@ -2567,11 +2554,11 @@ static void populate_vf_func_cfg_req(struct bnxt *bp, HWRM_FUNC_CFG_INPUT_ENABLES_NUM_VNICS | HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS); - req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); - req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); req->num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx / (num_vfs + 1)); @@ -2591,7 +2578,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, struct hwrm_func_cfg_input *cfg_req, int vf) { - struct ether_addr mac; + struct rte_ether_addr mac; if (bnxt_hwrm_func_qcfg_vf_default_mac(bp, vf, &mac)) return; @@ -2599,10 +2586,11 @@ static void add_random_mac_if_needed(struct bnxt *bp, if (memcmp(mac.addr_bytes, "\x00\x00\x00\x00\x00", 6) == 0) { cfg_req->enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_MAC_ADDR); - eth_random_addr(cfg_req->dflt_mac_addr); + rte_eth_random_addr(cfg_req->dflt_mac_addr); bp->pf.vf_info[vf].random_mac = true; } else { - memcpy(cfg_req->dflt_mac_addr, mac.addr_bytes, ETHER_ADDR_LEN); + memcpy(cfg_req->dflt_mac_addr, mac.addr_bytes, + RTE_ETHER_ADDR_LEN); } } @@ -3125,7 +3113,7 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id, } int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac) + struct rte_ether_addr *mac) { struct hwrm_func_qcfg_input req = {0}; struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; @@ -3138,7 +3126,7 @@ int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, HWRM_CHECK_RESULT(); - memcpy(mac->addr_bytes, resp->mac_address, ETHER_ADDR_LEN); + memcpy(mac->addr_bytes, resp->mac_address, RTE_ETHER_ADDR_LEN); HWRM_UNLOCK(); @@ -3709,11 +3697,11 @@ int bnxt_hwrm_set_em_filter(struct bnxt *bp, if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_MACADDR) memcpy(req.src_macaddr, filter->src_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_MACADDR) memcpy(req.dst_macaddr, filter->dst_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_OVLAN_VID) req.ovlan_vid = filter->l2_ovlan; @@ -3812,11 +3800,11 @@ int bnxt_hwrm_set_ntuple_filter(struct bnxt *bp, if (enables & HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR) memcpy(req.src_macaddr, filter->src_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); //if (enables & //HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_MACADDR) //memcpy(req.dst_macaddr, filter->dst_macaddr, - //ETHER_ADDR_LEN); + //RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_ETHERTYPE) req.ethertype = rte_cpu_to_be_16(filter->ethertype);