Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/iflib.c
Show First 20 Lines • Show All 1,568 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
iflib_txsd_alloc(iflib_txq_t txq) | iflib_txsd_alloc(iflib_txq_t txq) | ||||
{ | { | ||||
if_ctx_t ctx = txq->ift_ctx; | if_ctx_t ctx = txq->ift_ctx; | ||||
if_shared_ctx_t sctx = ctx->ifc_sctx; | if_shared_ctx_t sctx = ctx->ifc_sctx; | ||||
if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; | if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; | ||||
device_t dev = ctx->ifc_dev; | device_t dev = ctx->ifc_dev; | ||||
bus_size_t tsomaxsize; | |||||
int err, nsegments, ntsosegments; | int err, nsegments, ntsosegments; | ||||
nsegments = scctx->isc_tx_nsegments; | nsegments = scctx->isc_tx_nsegments; | ||||
ntsosegments = scctx->isc_tx_tso_segments_max; | ntsosegments = scctx->isc_tx_tso_segments_max; | ||||
tsomaxsize = scctx->isc_tx_tso_size_max; | |||||
if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_VLAN_MTU) | |||||
tsomaxsize += sizeof(struct ether_vlan_header); | |||||
MPASS(scctx->isc_ntxd[0] > 0); | MPASS(scctx->isc_ntxd[0] > 0); | ||||
MPASS(scctx->isc_ntxd[txq->ift_br_offset] > 0); | MPASS(scctx->isc_ntxd[txq->ift_br_offset] > 0); | ||||
MPASS(nsegments > 0); | MPASS(nsegments > 0); | ||||
if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_TSO) { | |||||
MPASS(ntsosegments > 0); | MPASS(ntsosegments > 0); | ||||
MPASS(sctx->isc_tso_maxsize >= tsomaxsize); | |||||
} | |||||
/* | /* | ||||
* Setup DMA descriptor areas. | * Setup DMA descriptor areas. | ||||
*/ | */ | ||||
if ((err = bus_dma_tag_create(bus_get_dma_tag(dev), | if ((err = bus_dma_tag_create(bus_get_dma_tag(dev), | ||||
1, 0, /* alignment, bounds */ | 1, 0, /* alignment, bounds */ | ||||
BUS_SPACE_MAXADDR, /* lowaddr */ | BUS_SPACE_MAXADDR, /* lowaddr */ | ||||
BUS_SPACE_MAXADDR, /* highaddr */ | BUS_SPACE_MAXADDR, /* highaddr */ | ||||
NULL, NULL, /* filter, filterarg */ | NULL, NULL, /* filter, filterarg */ | ||||
sctx->isc_tx_maxsize, /* maxsize */ | sctx->isc_tx_maxsize, /* maxsize */ | ||||
nsegments, /* nsegments */ | nsegments, /* nsegments */ | ||||
sctx->isc_tx_maxsegsize, /* maxsegsize */ | sctx->isc_tx_maxsegsize, /* maxsegsize */ | ||||
0, /* flags */ | 0, /* flags */ | ||||
NULL, /* lockfunc */ | NULL, /* lockfunc */ | ||||
NULL, /* lockfuncarg */ | NULL, /* lockfuncarg */ | ||||
&txq->ift_desc_tag))) { | &txq->ift_desc_tag))) { | ||||
device_printf(dev,"Unable to allocate TX DMA tag: %d\n", err); | device_printf(dev,"Unable to allocate TX DMA tag: %d\n", err); | ||||
device_printf(dev,"maxsize: %ju nsegments: %d maxsegsize: %ju\n", | device_printf(dev,"maxsize: %ju nsegments: %d maxsegsize: %ju\n", | ||||
(uintmax_t)sctx->isc_tx_maxsize, nsegments, (uintmax_t)sctx->isc_tx_maxsegsize); | (uintmax_t)sctx->isc_tx_maxsize, nsegments, (uintmax_t)sctx->isc_tx_maxsegsize); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
if ((err = bus_dma_tag_create(bus_get_dma_tag(dev), | if ((if_getcapabilities(ctx->ifc_ifp) & IFCAP_TSO) & | ||||
(err = bus_dma_tag_create(bus_get_dma_tag(dev), | |||||
1, 0, /* alignment, bounds */ | 1, 0, /* alignment, bounds */ | ||||
BUS_SPACE_MAXADDR, /* lowaddr */ | BUS_SPACE_MAXADDR, /* lowaddr */ | ||||
BUS_SPACE_MAXADDR, /* highaddr */ | BUS_SPACE_MAXADDR, /* highaddr */ | ||||
NULL, NULL, /* filter, filterarg */ | NULL, NULL, /* filter, filterarg */ | ||||
scctx->isc_tx_tso_size_max, /* maxsize */ | tsomaxsize, /* maxsize */ | ||||
ntsosegments, /* nsegments */ | ntsosegments, /* nsegments */ | ||||
scctx->isc_tx_tso_segsize_max, /* maxsegsize */ | sctx->isc_tso_maxsegsize,/* maxsegsize */ | ||||
0, /* flags */ | 0, /* flags */ | ||||
NULL, /* lockfunc */ | NULL, /* lockfunc */ | ||||
NULL, /* lockfuncarg */ | NULL, /* lockfuncarg */ | ||||
&txq->ift_tso_desc_tag))) { | &txq->ift_tso_desc_tag))) { | ||||
device_printf(dev,"Unable to allocate TX TSO DMA tag: %d\n", err); | device_printf(dev,"Unable to allocate TX TSO DMA tag: %d\n", err); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,653 Lines • ▼ Show 20 Lines | if (txq->ift_sds.ifsd_map != NULL) { | ||||
prefetch(&txq->ift_sds.ifsd_flags[next]); | prefetch(&txq->ift_sds.ifsd_flags[next]); | ||||
} | } | ||||
} else if (txq->ift_sds.ifsd_map != NULL) | } else if (txq->ift_sds.ifsd_map != NULL) | ||||
map = txq->ift_sds.ifsd_map[pidx]; | map = txq->ift_sds.ifsd_map[pidx]; | ||||
if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { | if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { | ||||
desc_tag = txq->ift_tso_desc_tag; | desc_tag = txq->ift_tso_desc_tag; | ||||
max_segs = scctx->isc_tx_tso_segments_max; | max_segs = scctx->isc_tx_tso_segments_max; | ||||
MPASS(desc_tag != NULL); | |||||
MPASS(max_segs > 0); | |||||
} else { | } else { | ||||
desc_tag = txq->ift_desc_tag; | desc_tag = txq->ift_desc_tag; | ||||
max_segs = scctx->isc_tx_nsegments; | max_segs = scctx->isc_tx_nsegments; | ||||
} | } | ||||
if ((sctx->isc_flags & IFLIB_NEED_ETHER_PAD) && | if ((sctx->isc_flags & IFLIB_NEED_ETHER_PAD) && | ||||
__predict_false(m_head->m_pkthdr.len < scctx->isc_min_frame_size)) { | __predict_false(m_head->m_pkthdr.len < scctx->isc_min_frame_size)) { | ||||
err = iflib_ether_pad(ctx->ifc_dev, m_headp, scctx->isc_min_frame_size); | err = iflib_ether_pad(ctx->ifc_dev, m_headp, scctx->isc_min_frame_size); | ||||
if (err) | if (err) | ||||
▲ Show 20 Lines • Show All 1,084 Lines • ▼ Show 20 Lines | if ((err = IFDI_ATTACH_PRE(ctx)) != 0) { | ||||
CTX_UNLOCK(ctx); | CTX_UNLOCK(ctx); | ||||
device_printf(dev, "IFDI_ATTACH_PRE failed %d\n", err); | device_printf(dev, "IFDI_ATTACH_PRE failed %d\n", err); | ||||
return (err); | return (err); | ||||
} | } | ||||
_iflib_pre_assert(scctx); | _iflib_pre_assert(scctx); | ||||
ctx->ifc_txrx = *scctx->isc_txrx; | ctx->ifc_txrx = *scctx->isc_txrx; | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
MPASS(scctx->isc_capenable); | MPASS(scctx->isc_capabilities); | ||||
if (scctx->isc_capenable & IFCAP_TXCSUM) | if (scctx->isc_capabilities & IFCAP_TXCSUM) | ||||
MPASS(scctx->isc_tx_csum_flags); | MPASS(scctx->isc_tx_csum_flags); | ||||
#endif | #endif | ||||
if_setcapabilities(ifp, scctx->isc_capenable | IFCAP_HWSTATS); | if_setcapabilities(ifp, scctx->isc_capabilities | IFCAP_HWSTATS); | ||||
if_setcapenable(ifp, scctx->isc_capenable | IFCAP_HWSTATS); | if_setcapenable(ifp, scctx->isc_capenable | IFCAP_HWSTATS); | ||||
if (scctx->isc_ntxqsets == 0 || (scctx->isc_ntxqsets_max && scctx->isc_ntxqsets_max < scctx->isc_ntxqsets)) | if (scctx->isc_ntxqsets == 0 || (scctx->isc_ntxqsets_max && scctx->isc_ntxqsets_max < scctx->isc_ntxqsets)) | ||||
scctx->isc_ntxqsets = scctx->isc_ntxqsets_max; | scctx->isc_ntxqsets = scctx->isc_ntxqsets_max; | ||||
if (scctx->isc_nrxqsets == 0 || (scctx->isc_nrxqsets_max && scctx->isc_nrxqsets_max < scctx->isc_nrxqsets)) | if (scctx->isc_nrxqsets == 0 || (scctx->isc_nrxqsets_max && scctx->isc_nrxqsets_max < scctx->isc_nrxqsets)) | ||||
scctx->isc_nrxqsets = scctx->isc_nrxqsets_max; | scctx->isc_nrxqsets = scctx->isc_nrxqsets_max; | ||||
#ifdef ACPI_DMAR | #ifdef ACPI_DMAR | ||||
Show All 31 Lines | if (scctx->isc_tx_nsegments > scctx->isc_ntxd[main_txq] / | ||||
MAX_SINGLE_PACKET_FRACTION) | MAX_SINGLE_PACKET_FRACTION) | ||||
scctx->isc_tx_nsegments = max(1, scctx->isc_ntxd[main_txq] / | scctx->isc_tx_nsegments = max(1, scctx->isc_ntxd[main_txq] / | ||||
MAX_SINGLE_PACKET_FRACTION); | MAX_SINGLE_PACKET_FRACTION); | ||||
if (scctx->isc_tx_tso_segments_max > scctx->isc_ntxd[main_txq] / | if (scctx->isc_tx_tso_segments_max > scctx->isc_ntxd[main_txq] / | ||||
MAX_SINGLE_PACKET_FRACTION) | MAX_SINGLE_PACKET_FRACTION) | ||||
scctx->isc_tx_tso_segments_max = max(1, | scctx->isc_tx_tso_segments_max = max(1, | ||||
scctx->isc_ntxd[main_txq] / MAX_SINGLE_PACKET_FRACTION); | scctx->isc_ntxd[main_txq] / MAX_SINGLE_PACKET_FRACTION); | ||||
/* TSO parameters - dig these out of the data sheet - simply correspond to tag setup */ | |||||
if (if_getcapabilities(ifp) & IFCAP_TSO) { | |||||
/* | /* | ||||
* Protect the stack against modern hardware | * The stack can't handle a TSO size larger than IP_MAXPACKET, | ||||
* but some MACs do. | |||||
*/ | */ | ||||
if (scctx->isc_tx_tso_size_max > FREEBSD_TSO_SIZE_MAX) | if_sethwtsomax(ifp, min(scctx->isc_tx_tso_size_max, | ||||
scctx->isc_tx_tso_size_max = FREEBSD_TSO_SIZE_MAX; | IP_MAXPACKET)); | ||||
/* | |||||
/* TSO parameters - dig these out of the data sheet - simply correspond to tag setup */ | * Take maximum number of m_pullup(9)'s in iflib_parse_header() | ||||
ifp->if_hw_tsomaxsegcount = scctx->isc_tx_tso_segments_max; | * into account. In the worst case, each of these calls will | ||||
ifp->if_hw_tsomax = scctx->isc_tx_tso_size_max; | * add another mbuf and, thus, the requirement for another DMA | ||||
ifp->if_hw_tsomaxsegsize = scctx->isc_tx_tso_segsize_max; | * segment. So for best performance, it doesn't make sense to | ||||
* advertize a maximum of TSO segments that typically will | |||||
* require defragmentation in iflib_encap(). | |||||
*/ | |||||
if_sethwtsomaxsegcount(ifp, scctx->isc_tx_tso_segments_max - 3); | |||||
if_sethwtsomaxsegsize(ifp, scctx->isc_tx_tso_segsize_max); | |||||
} | |||||
if (scctx->isc_rss_table_size == 0) | if (scctx->isc_rss_table_size == 0) | ||||
scctx->isc_rss_table_size = 64; | scctx->isc_rss_table_size = 64; | ||||
scctx->isc_rss_table_mask = scctx->isc_rss_table_size-1; | scctx->isc_rss_table_mask = scctx->isc_rss_table_size-1; | ||||
GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); | GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); | ||||
/* XXX format name */ | /* XXX format name */ | ||||
taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin"); | taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin"); | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | if (scctx->isc_intr == IFLIB_INTR_MSI) { | ||||
MPASS(msix == 1); | MPASS(msix == 1); | ||||
rid = 1; | rid = 1; | ||||
} | } | ||||
if ((err = iflib_legacy_setup(ctx, ctx->isc_legacy_intr, ctx->ifc_softc, &rid, "irq0")) != 0) { | if ((err = iflib_legacy_setup(ctx, ctx->isc_legacy_intr, ctx->ifc_softc, &rid, "irq0")) != 0) { | ||||
device_printf(dev, "iflib_legacy_setup failed %d\n", err); | device_printf(dev, "iflib_legacy_setup failed %d\n", err); | ||||
goto fail_intr_free; | goto fail_intr_free; | ||||
} | } | ||||
} | } | ||||
ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac); | ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac); | ||||
if ((err = IFDI_ATTACH_POST(ctx)) != 0) { | if ((err = IFDI_ATTACH_POST(ctx)) != 0) { | ||||
device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err); | device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err); | ||||
goto fail_detach; | goto fail_detach; | ||||
} | } | ||||
/* | |||||
* Tell the upper layer(s) if IFCAP_VLAN_MTU is supported. | |||||
* This must appear after the call to ether_ifattach() because | |||||
* ether_ifattach() sets if_hdrlen to the default value. | |||||
*/ | |||||
if (if_getcapabilities(ifp) & IFCAP_VLAN_MTU) | |||||
if_setifheaderlen(ifp, sizeof(struct ether_vlan_header)); | |||||
if ((err = iflib_netmap_attach(ctx))) { | if ((err = iflib_netmap_attach(ctx))) { | ||||
device_printf(ctx->ifc_dev, "netmap attach failed: %d\n", err); | device_printf(ctx->ifc_dev, "netmap attach failed: %d\n", err); | ||||
goto fail_detach; | goto fail_detach; | ||||
} | } | ||||
*ctxp = ctx; | *ctxp = ctx; | ||||
NETDUMP_SET(ctx->ifc_ifp, iflib); | NETDUMP_SET(ctx->ifc_ifp, iflib); | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | if ((err = IFDI_CLONEATTACH(ctx, clctx->cc_ifc, clctx->cc_name, | ||||
device_printf(dev, "IFDI_CLONEATTACH failed %d\n", err); | device_printf(dev, "IFDI_CLONEATTACH failed %d\n", err); | ||||
return (err); | return (err); | ||||
} | } | ||||
ifmedia_add(&ctx->ifc_media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); | ifmedia_add(&ctx->ifc_media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); | ||||
ifmedia_add(&ctx->ifc_media, IFM_ETHER | IFM_AUTO, 0, NULL); | ifmedia_add(&ctx->ifc_media, IFM_ETHER | IFM_AUTO, 0, NULL); | ||||
ifmedia_set(&ctx->ifc_media, IFM_ETHER | IFM_AUTO); | ifmedia_set(&ctx->ifc_media, IFM_ETHER | IFM_AUTO); | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
MPASS(scctx->isc_capenable); | MPASS(scctx->isc_capabilities); | ||||
if (scctx->isc_capenable & IFCAP_TXCSUM) | if (scctx->isc_capabilities & IFCAP_TXCSUM) | ||||
MPASS(scctx->isc_tx_csum_flags); | MPASS(scctx->isc_tx_csum_flags); | ||||
#endif | #endif | ||||
if_setcapabilities(ifp, scctx->isc_capenable | IFCAP_HWSTATS | IFCAP_LINKSTATE); | if_setcapabilities(ifp, scctx->isc_capabilities | IFCAP_HWSTATS | IFCAP_LINKSTATE); | ||||
if_setcapenable(ifp, scctx->isc_capenable | IFCAP_HWSTATS | IFCAP_LINKSTATE); | if_setcapenable(ifp, scctx->isc_capenable | IFCAP_HWSTATS | IFCAP_LINKSTATE); | ||||
ifp->if_flags |= IFF_NOGROUP; | ifp->if_flags |= IFF_NOGROUP; | ||||
if (sctx->isc_flags & IFLIB_PSEUDO) { | if (sctx->isc_flags & IFLIB_PSEUDO) { | ||||
ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac); | ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac); | ||||
if ((err = IFDI_ATTACH_POST(ctx)) != 0) { | if ((err = IFDI_ATTACH_POST(ctx)) != 0) { | ||||
device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err); | device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err); | ||||
goto fail_detach; | goto fail_detach; | ||||
} | } | ||||
*ctxp = ctx; | *ctxp = ctx; | ||||
/* | |||||
* Tell the upper layer(s) if IFCAP_VLAN_MTU is supported. | |||||
* This must appear after the call to ether_ifattach() because | |||||
* ether_ifattach() sets if_hdrlen to the default value. | |||||
*/ | |||||
if (if_getcapabilities(ifp) & IFCAP_VLAN_MTU) | |||||
if_setifheaderlen(ifp, | |||||
sizeof(struct ether_vlan_header)); | |||||
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; | ||||
return (0); | return (0); | ||||
} | } | ||||
_iflib_pre_assert(scctx); | _iflib_pre_assert(scctx); | ||||
ctx->ifc_txrx = *scctx->isc_txrx; | ctx->ifc_txrx = *scctx->isc_txrx; | ||||
Show All 29 Lines | if (scctx->isc_tx_nsegments > scctx->isc_ntxd[main_txq] / | ||||
MAX_SINGLE_PACKET_FRACTION) | MAX_SINGLE_PACKET_FRACTION) | ||||
scctx->isc_tx_nsegments = max(1, scctx->isc_ntxd[main_txq] / | scctx->isc_tx_nsegments = max(1, scctx->isc_ntxd[main_txq] / | ||||
MAX_SINGLE_PACKET_FRACTION); | MAX_SINGLE_PACKET_FRACTION); | ||||
if (scctx->isc_tx_tso_segments_max > scctx->isc_ntxd[main_txq] / | if (scctx->isc_tx_tso_segments_max > scctx->isc_ntxd[main_txq] / | ||||
MAX_SINGLE_PACKET_FRACTION) | MAX_SINGLE_PACKET_FRACTION) | ||||
scctx->isc_tx_tso_segments_max = max(1, | scctx->isc_tx_tso_segments_max = max(1, | ||||
scctx->isc_ntxd[main_txq] / MAX_SINGLE_PACKET_FRACTION); | scctx->isc_ntxd[main_txq] / MAX_SINGLE_PACKET_FRACTION); | ||||
/* TSO parameters - dig these out of the data sheet - simply correspond to tag setup */ | |||||
if (if_getcapabilities(ifp) & IFCAP_TSO) { | |||||
/* | /* | ||||
* Protect the stack against modern hardware | * The stack can't handle a TSO size larger than IP_MAXPACKET, | ||||
* but some MACs do. | |||||
*/ | */ | ||||
if (scctx->isc_tx_tso_size_max > FREEBSD_TSO_SIZE_MAX) | if_sethwtsomax(ifp, min(scctx->isc_tx_tso_size_max, | ||||
scctx->isc_tx_tso_size_max = FREEBSD_TSO_SIZE_MAX; | IP_MAXPACKET)); | ||||
/* | |||||
/* TSO parameters - dig these out of the data sheet - simply correspond to tag setup */ | * Take maximum number of m_pullup(9)'s in iflib_parse_header() | ||||
ifp->if_hw_tsomaxsegcount = scctx->isc_tx_tso_segments_max; | * into account. In the worst case, each of these calls will | ||||
ifp->if_hw_tsomax = scctx->isc_tx_tso_size_max; | * add another mbuf and, thus, the requirement for another DMA | ||||
ifp->if_hw_tsomaxsegsize = scctx->isc_tx_tso_segsize_max; | * segment. So for best performance, it doesn't make sense to | ||||
* advertize a maximum of TSO segments that typically will | |||||
* require defragmentation in iflib_encap(). | |||||
*/ | |||||
if_sethwtsomaxsegcount(ifp, scctx->isc_tx_tso_segments_max - 3); | |||||
if_sethwtsomaxsegsize(ifp, scctx->isc_tx_tso_segsize_max); | |||||
} | |||||
if (scctx->isc_rss_table_size == 0) | if (scctx->isc_rss_table_size == 0) | ||||
scctx->isc_rss_table_size = 64; | scctx->isc_rss_table_size = 64; | ||||
scctx->isc_rss_table_mask = scctx->isc_rss_table_size-1; | scctx->isc_rss_table_mask = scctx->isc_rss_table_size-1; | ||||
GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); | GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); | ||||
/* XXX format name */ | /* XXX format name */ | ||||
taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin"); | taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin"); | ||||
/* XXX --- can support > 1 -- but keep it simple for now */ | /* XXX --- can support > 1 -- but keep it simple for now */ | ||||
scctx->isc_intr = IFLIB_INTR_LEGACY; | scctx->isc_intr = IFLIB_INTR_LEGACY; | ||||
/* Get memory for the station queues */ | /* Get memory for the station queues */ | ||||
if ((err = iflib_queues_alloc(ctx))) { | if ((err = iflib_queues_alloc(ctx))) { | ||||
device_printf(dev, "Unable to allocate queue memory\n"); | device_printf(dev, "Unable to allocate queue memory\n"); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
if ((err = iflib_qset_structures_setup(ctx))) { | if ((err = iflib_qset_structures_setup(ctx))) { | ||||
device_printf(dev, "qset structure setup failed %d\n", err); | device_printf(dev, "qset structure setup failed %d\n", err); | ||||
goto fail_queues; | goto fail_queues; | ||||
} | } | ||||
/* | /* | ||||
* XXX What if anything do we want to do about interrupts? | * XXX What if anything do we want to do about interrupts? | ||||
*/ | */ | ||||
ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac); | ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac); | ||||
if ((err = IFDI_ATTACH_POST(ctx)) != 0) { | if ((err = IFDI_ATTACH_POST(ctx)) != 0) { | ||||
device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err); | device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err); | ||||
goto fail_detach; | goto fail_detach; | ||||
} | } | ||||
/* | |||||
* Tell the upper layer(s) if IFCAP_VLAN_MTU is supported. | |||||
* This must appear after the call to ether_ifattach() because | |||||
* ether_ifattach() sets if_hdrlen to the default value. | |||||
*/ | |||||
if (if_getcapabilities(ifp) & IFCAP_VLAN_MTU) | |||||
if_setifheaderlen(ifp, sizeof(struct ether_vlan_header)); | |||||
/* XXX handle more than one queue */ | /* XXX handle more than one queue */ | ||||
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); | ||||
▲ Show 20 Lines • Show All 1,678 Lines • Show Last 20 Lines |