aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bnxt
diff options
context:
space:
mode:
authorStephen Hurd <shurd@FreeBSD.org>2017-09-06 20:14:34 +0000
committerStephen Hurd <shurd@FreeBSD.org>2017-09-06 20:14:34 +0000
commit96b2e63f10093faddbdd539f159d8ae61b0d681f (patch)
tree9364a3b54355b92471cc920808b609deee848c2d /sys/dev/bnxt
parentb99b705d9ce3e07b49a5fc222fe500ac15944ad1 (diff)
Notes
Diffstat (limited to 'sys/dev/bnxt')
-rw-r--r--sys/dev/bnxt/bnxt.h8
-rw-r--r--sys/dev/bnxt/bnxt_hwrm.c25
-rw-r--r--sys/dev/bnxt/bnxt_hwrm.h1
-rw-r--r--sys/dev/bnxt/if_bnxt.c21
4 files changed, 50 insertions, 5 deletions
diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h
index f893bd25ee56..20a727a74b5a 100644
--- a/sys/dev/bnxt/bnxt.h
+++ b/sys/dev/bnxt/bnxt.h
@@ -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;
diff --git a/sys/dev/bnxt/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_hwrm.c
index fe18da885bcb..6427341846e3 100644
--- a/sys/dev/bnxt/bnxt_hwrm.c
+++ b/sys/dev/bnxt/bnxt_hwrm.c
@@ -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)
{
diff --git a/sys/dev/bnxt/bnxt_hwrm.h b/sys/dev/bnxt/bnxt_hwrm.h
index 9125f7694525..2c221ede5c2a 100644
--- a/sys/dev/bnxt/bnxt_hwrm.h
+++ b/sys/dev/bnxt/bnxt_hwrm.h
@@ -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);
diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c
index edfbafa882fe..5195e64bfb3a 100644
--- a/sys/dev/bnxt/if_bnxt.c
+++ b/sys/dev/bnxt/if_bnxt.c
@@ -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->fn_qcfg.alloc_rx_rings);
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_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;