Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/bnxt/if_bnxt.c
Show First 20 Lines • Show All 637 Lines • ▼ Show 20 Lines | |||||
ag_alloc_fail: | ag_alloc_fail: | ||||
free(softc->rx_rings, M_DEVBUF); | free(softc->rx_rings, M_DEVBUF); | ||||
ring_alloc_fail: | ring_alloc_fail: | ||||
free(softc->rx_cp_rings, M_DEVBUF); | free(softc->rx_cp_rings, M_DEVBUF); | ||||
cp_alloc_fail: | cp_alloc_fail: | ||||
return rc; | return rc; | ||||
} | } | ||||
static void bnxt_free_hwrm_short_cmd_req(struct bnxt_softc *softc) | |||||
{ | |||||
if (softc->hwrm_short_cmd_req_addr.idi_vaddr) | |||||
iflib_dma_free(&softc->hwrm_short_cmd_req_addr); | |||||
softc->hwrm_short_cmd_req_addr.idi_vaddr = NULL; | |||||
} | |||||
static int bnxt_alloc_hwrm_short_cmd_req(struct bnxt_softc *softc) | |||||
{ | |||||
int rc; | |||||
rc = iflib_dma_alloc(softc->ctx, softc->hwrm_max_req_len, | |||||
&softc->hwrm_short_cmd_req_addr, BUS_DMA_NOWAIT); | |||||
return rc; | |||||
} | |||||
/* Device setup and teardown */ | /* Device setup and teardown */ | ||||
static int | static int | ||||
bnxt_attach_pre(if_ctx_t ctx) | bnxt_attach_pre(if_ctx_t ctx) | ||||
{ | { | ||||
struct bnxt_softc *softc = iflib_get_softc(ctx); | struct bnxt_softc *softc = iflib_get_softc(ctx); | ||||
if_softc_ctx_t scctx; | if_softc_ctx_t scctx; | ||||
int rc = 0; | int rc = 0; | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | bnxt_attach_pre(if_ctx_t ctx) | ||||
softc->ver_info->hwrm_min_update = 2; | softc->ver_info->hwrm_min_update = 2; | ||||
rc = bnxt_hwrm_ver_get(softc); | rc = bnxt_hwrm_ver_get(softc); | ||||
if (rc) { | if (rc) { | ||||
device_printf(softc->dev, "attach: hwrm ver get failed\n"); | device_printf(softc->dev, "attach: hwrm ver get failed\n"); | ||||
goto ver_fail; | goto ver_fail; | ||||
} | } | ||||
if (softc->flags & BNXT_FLAG_SHORT_CMD) { | |||||
rc = bnxt_alloc_hwrm_short_cmd_req(softc); | |||||
if (rc) | |||||
goto hwrm_short_cmd_alloc_fail; | |||||
} | |||||
/* Get NVRAM info */ | /* Get NVRAM info */ | ||||
if (BNXT_PF(softc)) { | if (BNXT_PF(softc)) { | ||||
softc->nvm_info = malloc(sizeof(struct bnxt_nvram_info), | softc->nvm_info = malloc(sizeof(struct bnxt_nvram_info), | ||||
M_DEVBUF, M_NOWAIT | M_ZERO); | M_DEVBUF, M_NOWAIT | M_ZERO); | ||||
if (softc->nvm_info == NULL) { | if (softc->nvm_info == NULL) { | ||||
rc = ENOMEM; | rc = ENOMEM; | ||||
device_printf(softc->dev, | device_printf(softc->dev, | ||||
"Unable to allocate space for NVRAM info\n"); | "Unable to allocate space for NVRAM info\n"); | ||||
▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | |||||
failed: | failed: | ||||
bnxt_free_sysctl_ctx(softc); | bnxt_free_sysctl_ctx(softc); | ||||
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: | ||||
if (BNXT_PF(softc)) | if (BNXT_PF(softc)) | ||||
free(softc->nvm_info, M_DEVBUF); | free(softc->nvm_info, M_DEVBUF); | ||||
nvm_alloc_fail: | nvm_alloc_fail: | ||||
bnxt_free_hwrm_short_cmd_req(softc); | |||||
hwrm_short_cmd_alloc_fail: | |||||
ver_fail: | ver_fail: | ||||
free(softc->ver_info, M_DEVBUF); | free(softc->ver_info, M_DEVBUF); | ||||
ver_alloc_fail: | ver_alloc_fail: | ||||
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); | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | bnxt_detach(if_ctx_t ctx) | ||||
for (i = 0; i < softc->nrxqsets; i++) | for (i = 0; i < softc->nrxqsets; i++) | ||||
free(softc->rx_rings[i].tpa_start, M_DEVBUF); | free(softc->rx_rings[i].tpa_start, M_DEVBUF); | ||||
free(softc->ver_info, M_DEVBUF); | free(softc->ver_info, M_DEVBUF); | ||||
if (BNXT_PF(softc)) | if (BNXT_PF(softc)) | ||||
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_free_hwrm_short_cmd_req(softc); | |||||
BNXT_HWRM_LOCK_DESTROY(softc); | BNXT_HWRM_LOCK_DESTROY(softc); | ||||
pci_disable_busmaster(softc->dev); | pci_disable_busmaster(softc->dev); | ||||
bnxt_pci_mapping_free(softc); | bnxt_pci_mapping_free(softc); | ||||
return 0; | return 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,479 Lines • Show Last 20 Lines |