Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/iflib.c
Show First 20 Lines • Show All 4,656 Lines • ▼ Show 20 Lines | iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp, | ||||
scctx = &ctx->ifc_softc_ctx; | scctx = &ctx->ifc_softc_ctx; | ||||
ifp = ctx->ifc_ifp; | ifp = ctx->ifc_ifp; | ||||
/* | /* | ||||
* XXX sanity check that ntxd & nrxd are a power of 2 | * XXX sanity check that ntxd & nrxd are a power of 2 | ||||
*/ | */ | ||||
iflib_reset_qvalues(ctx); | iflib_reset_qvalues(ctx); | ||||
CTX_LOCK(ctx); | |||||
if ((err = IFDI_ATTACH_PRE(ctx)) != 0) { | if ((err = IFDI_ATTACH_PRE(ctx)) != 0) { | ||||
device_printf(dev, "IFDI_ATTACH_PRE failed %d\n", err); | device_printf(dev, "IFDI_ATTACH_PRE failed %d\n", err); | ||||
goto fail_ctx_free; | goto fail_unlock; | ||||
} | } | ||||
if (sctx->isc_flags & IFLIB_GEN_MAC) | if (sctx->isc_flags & IFLIB_GEN_MAC) | ||||
iflib_gen_mac(ctx); | iflib_gen_mac(ctx); | ||||
if ((err = IFDI_CLONEATTACH(ctx, clctx->cc_ifc, clctx->cc_name, | if ((err = IFDI_CLONEATTACH(ctx, clctx->cc_ifc, clctx->cc_name, | ||||
clctx->cc_params)) != 0) { | clctx->cc_params)) != 0) { | ||||
device_printf(dev, "IFDI_CLONEATTACH failed %d\n", err); | device_printf(dev, "IFDI_CLONEATTACH failed %d\n", err); | ||||
goto fail_ctx_free; | goto fail_ctx_free; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | #endif | ||||
for (i = 0; i < scctx->isc_nrxqsets; i++) | for (i = 0; i < scctx->isc_nrxqsets; i++) | ||||
IFDI_RX_CLSET(ctx, 0, i, ctx->ifc_rxqs[i].ifr_fl[0].ifl_sds.ifsd_cl); | IFDI_RX_CLSET(ctx, 0, i, ctx->ifc_rxqs[i].ifr_fl[0].ifl_sds.ifsd_cl); | ||||
*ctxp = ctx; | *ctxp = ctx; | ||||
if_setgetcounterfn(ctx->ifc_ifp, iflib_if_get_counter); | if_setgetcounterfn(ctx->ifc_ifp, iflib_if_get_counter); | ||||
iflib_add_device_sysctl_post(ctx); | iflib_add_device_sysctl_post(ctx); | ||||
ctx->ifc_flags |= IFC_INIT_DONE; | ctx->ifc_flags |= IFC_INIT_DONE; | ||||
CTX_UNLOCK(ctx); | |||||
return (0); | return (0); | ||||
fail_detach: | fail_detach: | ||||
ether_ifdetach(ctx->ifc_ifp); | ether_ifdetach(ctx->ifc_ifp); | ||||
fail_queues: | fail_queues: | ||||
iflib_tx_structures_free(ctx); | iflib_tx_structures_free(ctx); | ||||
iflib_rx_structures_free(ctx); | iflib_rx_structures_free(ctx); | ||||
fail_iflib_detach: | fail_iflib_detach: | ||||
IFDI_DETACH(ctx); | IFDI_DETACH(ctx); | ||||
fail_unlock: | |||||
CTX_UNLOCK(ctx); | |||||
fail_ctx_free: | fail_ctx_free: | ||||
free(ctx->ifc_softc, M_IFLIB); | free(ctx->ifc_softc, M_IFLIB); | ||||
free(ctx, M_IFLIB); | free(ctx, M_IFLIB); | ||||
return (err); | return (err); | ||||
} | } | ||||
int | int | ||||
iflib_pseudo_deregister(if_ctx_t ctx) | iflib_pseudo_deregister(if_ctx_t ctx) | ||||
▲ Show 20 Lines • Show All 1,732 Lines • Show Last 20 Lines |