Index: head/sys/dev/bnxt/bnxt.h =================================================================== --- head/sys/dev/bnxt/bnxt.h +++ head/sys/dev/bnxt/bnxt.h @@ -519,6 +519,13 @@ struct sysctl_oid *nvm_oid; }; +struct bnxt_func_qcfg { + uint16_t alloc_completion_rings; + uint16_t alloc_tx_rings; + uint16_t alloc_rx_rings; + uint16_t alloc_vnics; +}; + struct bnxt_softc { device_t dev; if_ctx_t ctx; @@ -535,6 +542,7 @@ uint32_t total_msix; struct bnxt_func_info func; + struct bnxt_func_qcfg fn_qcfg; struct bnxt_pf_info pf; struct bnxt_vf_info vf; Index: head/sys/dev/bnxt/bnxt_hwrm.h =================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.h +++ head/sys/dev/bnxt/bnxt_hwrm.h @@ -43,6 +43,7 @@ int bnxt_hwrm_func_drv_rgtr(struct bnxt_softc *softc); int bnxt_hwrm_func_drv_unrgtr(struct bnxt_softc *softc, bool shutdown); int bnxt_hwrm_func_qcaps(struct bnxt_softc *softc); +int bnxt_hwrm_func_qcfg(struct bnxt_softc *softc); int bnxt_hwrm_func_reset(struct bnxt_softc *softc); int bnxt_hwrm_set_link_setting(struct bnxt_softc *, bool set_pause, bool set_eee); Index: head/sys/dev/bnxt/bnxt_hwrm.c =================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.c +++ head/sys/dev/bnxt/bnxt_hwrm.c @@ -438,6 +438,31 @@ return rc; } +int +bnxt_hwrm_func_qcfg(struct bnxt_softc *softc) +{ + struct hwrm_func_qcfg_input req = {0}; + struct hwrm_func_qcfg_output *resp = + (void *)softc->hwrm_cmd_resp.idi_vaddr; + struct bnxt_func_qcfg *fn_qcfg = &softc->fn_qcfg; + int rc; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_QCFG); + req.fid = htole16(0xffff); + BNXT_HWRM_LOCK(softc); + rc = _hwrm_send_message(softc, &req, sizeof(req)); + if (rc) + goto fail; + + fn_qcfg->alloc_completion_rings = le16toh(resp->alloc_cmpl_rings); + fn_qcfg->alloc_tx_rings = le16toh(resp->alloc_tx_rings); + fn_qcfg->alloc_rx_rings = le16toh(resp->alloc_rx_rings); + fn_qcfg->alloc_vnics = le16toh(resp->alloc_vnics); +fail: + BNXT_HWRM_UNLOCK(softc); + return rc; +} + int bnxt_hwrm_func_reset(struct bnxt_softc *softc) { Index: head/sys/dev/bnxt/if_bnxt.c =================================================================== --- head/sys/dev/bnxt/if_bnxt.c +++ head/sys/dev/bnxt/if_bnxt.c @@ -287,7 +287,7 @@ * iflib shared context */ -#define BNXT_DRIVER_VERSION "1.0.0.1" +#define BNXT_DRIVER_VERSION "1.0.0.2" char bnxt_driver_version[] = BNXT_DRIVER_VERSION; extern struct if_txrx bnxt_txrx; static struct if_shared_ctx bnxt_sctx_init = { @@ -702,6 +702,13 @@ if (rc) goto failed; + /* Get the current configuration of this function */ + rc = bnxt_hwrm_func_qcfg(softc); + if (rc) { + device_printf(softc->dev, "attach: hwrm func qcfg failed\n"); + goto failed; + } + iflib_set_mac(ctx, softc->func.mac_addr); scctx->isc_txrx = &bnxt_txrx; @@ -761,12 +768,16 @@ scctx->isc_nrxd[1]; scctx->isc_rxqsizes[2] = sizeof(struct rx_prod_pkt_bd) * scctx->isc_nrxd[2]; + scctx->isc_nrxqsets_max = min(pci_msix_count(softc->dev)-1, - softc->func.max_cp_rings - 1); + softc->fn_qcfg.alloc_completion_rings - 1); scctx->isc_nrxqsets_max = min(scctx->isc_nrxqsets_max, - softc->func.max_rx_rings); - scctx->isc_ntxqsets_max = min(softc->func.max_rx_rings, - softc->func.max_cp_rings - scctx->isc_nrxqsets_max - 1); + softc->fn_qcfg.alloc_rx_rings); + scctx->isc_nrxqsets_max = min(scctx->isc_nrxqsets_max, + softc->fn_qcfg.alloc_vnics); + scctx->isc_ntxqsets_max = min(softc->fn_qcfg.alloc_tx_rings, + softc->fn_qcfg.alloc_completion_rings - scctx->isc_nrxqsets_max - 1); + scctx->isc_rss_table_size = HW_HASH_INDEX_SIZE; scctx->isc_rss_table_mask = scctx->isc_rss_table_size - 1;