From owner-svn-src-head@freebsd.org Wed Sep 6 20:14:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2C55E14D2A; Wed, 6 Sep 2017 20:14:36 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66043748CB; Wed, 6 Sep 2017 20:14:36 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v86KEZcQ033496; Wed, 6 Sep 2017 20:14:35 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v86KEY5P033492; Wed, 6 Sep 2017 20:14:34 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201709062014.v86KEY5P033492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Wed, 6 Sep 2017 20:14:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323232 - head/sys/dev/bnxt X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/dev/bnxt X-SVN-Commit-Revision: 323232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Sep 2017 20:14:37 -0000 Author: shurd Date: Wed Sep 6 20:14:34 2017 New Revision: 323232 URL: https://svnweb.freebsd.org/changeset/base/323232 Log: bnxt: Use correct firmware call for number of queues supported 1) Based on the suggestion from firmware team, derive scctx->isc_ntxqsets_max & scctx->isc_nrxqsets_max based on FUNC_QCFG (instead of FUNC_QCAPS). 2) Bump-up driver version to "1.0.0.2". Submitted by: Bhargava Chenna Marreddy Reviewed by: shurd, sbruno Approved by: sbruno (mentor) Sponsored by: Broadcom Limited Differential Revision: https://reviews.freebsd.org/D12128 Modified: head/sys/dev/bnxt/bnxt.h head/sys/dev/bnxt/bnxt_hwrm.c head/sys/dev/bnxt/bnxt_hwrm.h head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/bnxt.h ============================================================================== --- head/sys/dev/bnxt/bnxt.h Wed Sep 6 20:01:19 2017 (r323231) +++ head/sys/dev/bnxt/bnxt.h Wed Sep 6 20:14:34 2017 (r323232) @@ -519,6 +519,13 @@ struct bnxt_nvram_info { 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 @@ struct bnxt_softc { 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; Modified: head/sys/dev/bnxt/bnxt_hwrm.c ============================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.c Wed Sep 6 20:01:19 2017 (r323231) +++ head/sys/dev/bnxt/bnxt_hwrm.c Wed Sep 6 20:14:34 2017 (r323232) @@ -438,6 +438,31 @@ fail: 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) { Modified: head/sys/dev/bnxt/bnxt_hwrm.h ============================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.h Wed Sep 6 20:01:19 2017 (r323231) +++ head/sys/dev/bnxt/bnxt_hwrm.h Wed Sep 6 20:14:34 2017 (r323232) @@ -43,6 +43,7 @@ int bnxt_hwrm_queue_qportcfg(struct bnxt_softc *softc) 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); Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Wed Sep 6 20:01:19 2017 (r323231) +++ head/sys/dev/bnxt/if_bnxt.c Wed Sep 6 20:14:34 2017 (r323232) @@ -287,7 +287,7 @@ static driver_t bnxt_iflib_driver = { * 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 @@ bnxt_attach_pre(if_ctx_t ctx) 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 @@ bnxt_attach_pre(if_ctx_t ctx) 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;