Page MenuHomeFreeBSD

D12128.id32405.diff
No OneTemporary

D12128.id32405.diff

Index: sys/dev/bnxt/bnxt.h
===================================================================
--- sys/dev/bnxt/bnxt.h
+++ sys/dev/bnxt/bnxt.h
@@ -519,6 +519,28 @@
struct sysctl_oid *nvm_oid;
};
+struct bnxt_func_qcfg {
+ uint8_t current_mac_address[ETHER_ADDR_LEN];
+ uint16_t vlan_id;
+ uint32_t min_bw;
+ uint32_t max_bw;
+ uint32_t alloc_mcast_filters;
+ uint16_t pci_id;
+ uint16_t alloc_rss_cos_contexts;
+ uint16_t alloc_completion_rings;
+ uint16_t alloc_tx_rings;
+ uint16_t alloc_rx_rings;
+ uint16_t alloc_l2_contexts;
+ uint16_t alloc_vnics;
+ uint16_t alloc_hw_ring_grps;
+ uint16_t mtu;
+ uint16_t mru;
+ uint16_t stat_ctx_id;
+ uint16_t partition_type;
+ uint16_t dflt_vnic_id;
+ uint16_t evb_mode;
+};
+
struct bnxt_softc {
device_t dev;
if_ctx_t ctx;
@@ -535,6 +557,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: sys/dev/bnxt/bnxt_hwrm.h
===================================================================
--- sys/dev/bnxt/bnxt_hwrm.h
+++ 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: sys/dev/bnxt/bnxt_hwrm.c
===================================================================
--- sys/dev/bnxt/bnxt_hwrm.c
+++ sys/dev/bnxt/bnxt_hwrm.c
@@ -438,6 +438,58 @@
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->current_mac_address[0] =
+ resp->mac_address[0];
+ fn_qcfg->current_mac_address[1] =
+ resp->mac_address[1];
+ fn_qcfg->current_mac_address[2] =
+ resp->mac_address[2];
+ fn_qcfg->current_mac_address[3] =
+ resp->mac_address[3];
+ fn_qcfg->current_mac_address[4] =
+ resp->mac_address[4];
+ fn_qcfg->current_mac_address[5] =
+ resp->mac_address[5];
+ fn_qcfg->pci_id = resp->pci_id;
+ fn_qcfg->vlan_id = resp->vlan;
+ fn_qcfg->min_bw = resp->min_bw;
+ fn_qcfg->max_bw = resp->max_bw;
+ fn_qcfg->alloc_mcast_filters = resp->alloc_mcast_filters;
+ fn_qcfg->alloc_rss_cos_contexts= resp->alloc_rsscos_ctx;
+ fn_qcfg->alloc_completion_rings = resp->alloc_cmpl_rings;
+ fn_qcfg->alloc_tx_rings = resp->alloc_tx_rings;
+ fn_qcfg->alloc_rx_rings = resp->alloc_rx_rings;
+ fn_qcfg->alloc_vnics = resp->alloc_vnics;
+ fn_qcfg->alloc_l2_contexts = resp->alloc_l2_ctx;
+ fn_qcfg->alloc_hw_ring_grps = resp->alloc_hw_ring_grps;
+ fn_qcfg->mtu = resp->mtu;
+ fn_qcfg->mru = resp->mru;
+ fn_qcfg->stat_ctx_id = resp->stat_ctx_id;
+ fn_qcfg->partition_type = resp->port_partition_type;
+ fn_qcfg->dflt_vnic_id = resp->dflt_vnic_id;
+ fn_qcfg->evb_mode = resp->evb_mode;
+
+fail:
+ BNXT_HWRM_UNLOCK(softc);
+ return rc;
+}
+
int
bnxt_hwrm_func_reset(struct bnxt_softc *softc)
{
Index: sys/dev/bnxt/if_bnxt.c
===================================================================
--- sys/dev/bnxt/if_bnxt.c
+++ 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 = {
@@ -605,6 +605,7 @@
{
struct bnxt_softc *softc = iflib_get_softc(ctx);
if_softc_ctx_t scctx;
+ int max_num_queues = 0;
int rc = 0;
softc->ctx = ctx;
@@ -702,6 +703,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 +769,15 @@
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);
- 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);
+
+ max_num_queues = min(pci_msix_count(softc->dev) - 1,
+ (softc->fn_qcfg.alloc_completion_rings - 1) / 2);
+ max_num_queues = min(max_num_queues, softc->fn_qcfg.alloc_tx_rings);
+ max_num_queues = min(max_num_queues, softc->fn_qcfg.alloc_rx_rings);
+ max_num_queues = min(max_num_queues, softc->fn_qcfg.alloc_vnics);
+
+ scctx->isc_ntxqsets_max = scctx->isc_nrxqsets_max = max_num_queues;
+
scctx->isc_rss_table_size = HW_HASH_INDEX_SIZE;
scctx->isc_rss_table_mask = scctx->isc_rss_table_size - 1;

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 8, 10:36 AM (5 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29384367
Default Alt Text
D12128.id32405.diff (5 KB)

Event Timeline