Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/bnxt/if_bnxt.c
Show First 20 Lines • Show All 500 Lines • ▼ Show 20 Lines | for (i = 0; i < nrxqsets; i++) { | ||||
softc->rx_rings[i].phys_id = (uint16_t)HWRM_NA_SIGNATURE; | softc->rx_rings[i].phys_id = (uint16_t)HWRM_NA_SIGNATURE; | ||||
softc->rx_rings[i].softc = softc; | softc->rx_rings[i].softc = softc; | ||||
softc->rx_rings[i].id = i + 1; | softc->rx_rings[i].id = i + 1; | ||||
softc->rx_rings[i].doorbell = softc->rx_rings[i].id * 0x80; | softc->rx_rings[i].doorbell = softc->rx_rings[i].id * 0x80; | ||||
softc->rx_rings[i].ring_size = softc->scctx->isc_nrxd[1]; | softc->rx_rings[i].ring_size = softc->scctx->isc_nrxd[1]; | ||||
softc->rx_rings[i].vaddr = vaddrs[i * nrxqs + 1]; | softc->rx_rings[i].vaddr = vaddrs[i * nrxqs + 1]; | ||||
softc->rx_rings[i].paddr = paddrs[i * nrxqs + 1]; | softc->rx_rings[i].paddr = paddrs[i * nrxqs + 1]; | ||||
/* Allocate the TPA start buffer */ | |||||
softc->rx_rings[i].tpa_start = malloc(sizeof(struct bnxt_full_tpa_start) * | |||||
(RX_TPA_START_CMPL_AGG_ID_MASK >> RX_TPA_START_CMPL_AGG_ID_SFT), | |||||
M_DEVBUF, M_NOWAIT | M_ZERO); | |||||
if (softc->rx_rings[i].tpa_start == NULL) { | |||||
rc = -ENOMEM; | |||||
device_printf(softc->dev, | |||||
"Unable to allocate space for TPA\n"); | |||||
goto tpa_alloc_fail; | |||||
} | |||||
/* Allocate the AG ring */ | /* Allocate the AG ring */ | ||||
softc->ag_rings[i].phys_id = (uint16_t)HWRM_NA_SIGNATURE; | softc->ag_rings[i].phys_id = (uint16_t)HWRM_NA_SIGNATURE; | ||||
softc->ag_rings[i].softc = softc; | softc->ag_rings[i].softc = softc; | ||||
softc->ag_rings[i].id = nrxqsets + i + 1; | softc->ag_rings[i].id = nrxqsets + i + 1; | ||||
softc->ag_rings[i].doorbell = softc->ag_rings[i].id * 0x80; | softc->ag_rings[i].doorbell = softc->ag_rings[i].id * 0x80; | ||||
softc->ag_rings[i].ring_size = softc->scctx->isc_nrxd[2]; | softc->ag_rings[i].ring_size = softc->scctx->isc_nrxd[2]; | ||||
softc->ag_rings[i].vaddr = vaddrs[i * nrxqs + 2]; | softc->ag_rings[i].vaddr = vaddrs[i * nrxqs + 2]; | ||||
softc->ag_rings[i].paddr = paddrs[i * nrxqs + 2]; | softc->ag_rings[i].paddr = paddrs[i * nrxqs + 2]; | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, | ||||
softc->nrxqsets = nrxqsets; | softc->nrxqsets = nrxqsets; | ||||
return rc; | return rc; | ||||
rss_grp_alloc_fail: | rss_grp_alloc_fail: | ||||
iflib_dma_free(&softc->vnic_info.rss_hash_key_tbl); | iflib_dma_free(&softc->vnic_info.rss_hash_key_tbl); | ||||
rss_hash_alloc_fail: | rss_hash_alloc_fail: | ||||
iflib_dma_free(&softc->vnic_info.mc_list); | iflib_dma_free(&softc->vnic_info.mc_list); | ||||
tpa_alloc_fail: | |||||
mc_list_alloc_fail: | mc_list_alloc_fail: | ||||
for (i = i - 1; i >= 0; i--) | |||||
free(softc->rx_rings[i].tpa_start, M_DEVBUF); | |||||
iflib_dma_free(&softc->rx_stats); | iflib_dma_free(&softc->rx_stats); | ||||
hw_stats_alloc_fail: | hw_stats_alloc_fail: | ||||
free(softc->grp_info, M_DEVBUF); | free(softc->grp_info, M_DEVBUF); | ||||
grp_alloc_fail: | grp_alloc_fail: | ||||
free(softc->ag_rings, M_DEVBUF); | free(softc->ag_rings, M_DEVBUF); | ||||
ag_alloc_fail: | ag_alloc_fail: | ||||
free(softc->rx_rings, M_DEVBUF); | free(softc->rx_rings, M_DEVBUF); | ||||
ring_alloc_fail: | ring_alloc_fail: | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | if (bnxt_pci_mapping(softc)) | ||||
return (ENXIO); | return (ENXIO); | ||||
/* HWRM setup/init */ | /* HWRM setup/init */ | ||||
BNXT_HWRM_LOCK_INIT(softc, device_get_nameunit(softc->dev)); | BNXT_HWRM_LOCK_INIT(softc, device_get_nameunit(softc->dev)); | ||||
rc = bnxt_alloc_hwrm_dma_mem(softc); | rc = bnxt_alloc_hwrm_dma_mem(softc); | ||||
if (rc) | if (rc) | ||||
goto dma_fail; | goto dma_fail; | ||||
/* Allocate the TPA start buffer */ | |||||
softc->tpa_start = malloc(sizeof(struct bnxt_full_tpa_start) * | |||||
(RX_TPA_START_CMPL_AGG_ID_MASK >> RX_TPA_START_CMPL_AGG_ID_SFT), | |||||
M_DEVBUF, M_NOWAIT | M_ZERO); | |||||
if (softc->tpa_start == NULL) { | |||||
rc = ENOMEM; | |||||
device_printf(softc->dev, | |||||
"Unable to allocate space for TPA\n"); | |||||
goto tpa_failed; | |||||
} | |||||
/* Get firmware version and compare with driver */ | /* Get firmware version and compare with driver */ | ||||
softc->ver_info = malloc(sizeof(struct bnxt_ver_info), | softc->ver_info = malloc(sizeof(struct bnxt_ver_info), | ||||
M_DEVBUF, M_NOWAIT | M_ZERO); | M_DEVBUF, M_NOWAIT | M_ZERO); | ||||
if (softc->ver_info == NULL) { | if (softc->ver_info == NULL) { | ||||
rc = ENOMEM; | rc = ENOMEM; | ||||
device_printf(softc->dev, | device_printf(softc->dev, | ||||
"Unable to allocate space for version info\n"); | "Unable to allocate space for version info\n"); | ||||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
init_sysctl_failed: | init_sysctl_failed: | ||||
bnxt_hwrm_func_drv_unrgtr(softc, false); | bnxt_hwrm_func_drv_unrgtr(softc, false); | ||||
drv_rgtr_fail: | drv_rgtr_fail: | ||||
free(softc->nvm_info, M_DEVBUF); | free(softc->nvm_info, M_DEVBUF); | ||||
nvm_alloc_fail: | nvm_alloc_fail: | ||||
ver_fail: | ver_fail: | ||||
free(softc->ver_info, M_DEVBUF); | free(softc->ver_info, M_DEVBUF); | ||||
ver_alloc_fail: | ver_alloc_fail: | ||||
free(softc->tpa_start, M_DEVBUF); | |||||
tpa_failed: | |||||
bnxt_free_hwrm_dma_mem(softc); | bnxt_free_hwrm_dma_mem(softc); | ||||
dma_fail: | dma_fail: | ||||
BNXT_HWRM_LOCK_DESTROY(softc); | BNXT_HWRM_LOCK_DESTROY(softc); | ||||
bnxt_pci_mapping_free(softc); | bnxt_pci_mapping_free(softc); | ||||
pci_disable_busmaster(softc->dev); | pci_disable_busmaster(softc->dev); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | bnxt_detach(if_ctx_t ctx) | ||||
iflib_dma_free(&softc->vnic_info.mc_list); | iflib_dma_free(&softc->vnic_info.mc_list); | ||||
iflib_dma_free(&softc->vnic_info.rss_hash_key_tbl); | iflib_dma_free(&softc->vnic_info.rss_hash_key_tbl); | ||||
iflib_dma_free(&softc->vnic_info.rss_grp_tbl); | iflib_dma_free(&softc->vnic_info.rss_grp_tbl); | ||||
if (softc->vnic_info.vlan_tag_list.idi_vaddr) | if (softc->vnic_info.vlan_tag_list.idi_vaddr) | ||||
iflib_dma_free(&softc->vnic_info.vlan_tag_list); | iflib_dma_free(&softc->vnic_info.vlan_tag_list); | ||||
SLIST_FOREACH_SAFE(tag, &softc->vnic_info.vlan_tags, next, tmp) | SLIST_FOREACH_SAFE(tag, &softc->vnic_info.vlan_tags, next, tmp) | ||||
free(tag, M_DEVBUF); | free(tag, M_DEVBUF); | ||||
iflib_dma_free(&softc->def_cp_ring_mem); | iflib_dma_free(&softc->def_cp_ring_mem); | ||||
free(softc->tpa_start, M_DEVBUF); | for (i = 0; i < softc->nrxqsets; i++) | ||||
free(softc->rx_rings[i].tpa_start, M_DEVBUF); | |||||
free(softc->ver_info, M_DEVBUF); | free(softc->ver_info, M_DEVBUF); | ||||
free(softc->nvm_info, M_DEVBUF); | free(softc->nvm_info, M_DEVBUF); | ||||
bnxt_hwrm_func_drv_unrgtr(softc, false); | bnxt_hwrm_func_drv_unrgtr(softc, false); | ||||
bnxt_free_hwrm_dma_mem(softc); | bnxt_free_hwrm_dma_mem(softc); | ||||
BNXT_HWRM_LOCK_DESTROY(softc); | BNXT_HWRM_LOCK_DESTROY(softc); | ||||
pci_disable_busmaster(softc->dev); | pci_disable_busmaster(softc->dev); | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | if (++j == softc->nrxqsets) | ||||
j = 0; | j = 0; | ||||
} | } | ||||
rc = bnxt_hwrm_rss_cfg(softc, &softc->vnic_info, | rc = bnxt_hwrm_rss_cfg(softc, &softc->vnic_info, | ||||
softc->vnic_info.rss_hash_type); | softc->vnic_info.rss_hash_type); | ||||
if (rc) | if (rc) | ||||
goto fail; | goto fail; | ||||
#ifdef notyet | /* | ||||
/* Enable LRO/TPA/GRO */ | * Enable LRO/TPA/GRO | ||||
* TBD: | |||||
* Enable / Disable HW_LRO based on | |||||
* ifconfig lro / ifconfig -lro setting | |||||
*/ | |||||
rc = bnxt_hwrm_vnic_tpa_cfg(softc, &softc->vnic_info, | rc = bnxt_hwrm_vnic_tpa_cfg(softc, &softc->vnic_info, | ||||
(if_getcapenable(iflib_get_ifp(ctx)) & IFCAP_LRO) ? | (if_getcapenable(iflib_get_ifp(ctx)) & IFCAP_LRO) ? | ||||
HWRM_VNIC_TPA_CFG_INPUT_FLAGS_TPA : 0); | HWRM_VNIC_TPA_CFG_INPUT_FLAGS_TPA : 0); | ||||
if (rc) | if (rc) | ||||
goto fail; | goto fail; | ||||
#endif | |||||
for (i = 0; i < softc->ntxqsets; i++) { | for (i = 0; i < softc->ntxqsets; i++) { | ||||
/* Allocate the statistics context */ | /* Allocate the statistics context */ | ||||
rc = bnxt_hwrm_stat_ctx_alloc(softc, &softc->tx_cp_rings[i], | rc = bnxt_hwrm_stat_ctx_alloc(softc, &softc->tx_cp_rings[i], | ||||
softc->tx_stats.idi_paddr + | softc->tx_stats.idi_paddr + | ||||
(sizeof(struct ctx_hw_stats) * i)); | (sizeof(struct ctx_hw_stats) * i)); | ||||
if (rc) | if (rc) | ||||
goto fail; | goto fail; | ||||
▲ Show 20 Lines • Show All 1,532 Lines • Show Last 20 Lines |