Changeset View
Changeset View
Standalone View
Standalone View
sys/net/iflib.c
Show First 20 Lines • Show All 795 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Register/unregister. We are already under netmap lock. | * Register/unregister. We are already under netmap lock. | ||||
* Only called on the first register or the last unregister. | * Only called on the first register or the last unregister. | ||||
*/ | */ | ||||
static int | static int | ||||
iflib_netmap_register(struct netmap_adapter *na, int onoff) | iflib_netmap_register(struct netmap_adapter *na, int onoff) | ||||
{ | { | ||||
if_t ifp = na->ifp; | if_t ifp = na->ifp; | ||||
if_ctx_t ctx = ifp->if_softc; | if_ctx_t ctx = if_getsoftc(ifp); | ||||
int status; | int status; | ||||
CTX_LOCK(ctx); | CTX_LOCK(ctx); | ||||
if (!CTX_IS_VF(ctx)) | if (!CTX_IS_VF(ctx)) | ||||
IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); | IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); | ||||
iflib_stop(ctx); | iflib_stop(ctx); | ||||
/* | /* | ||||
* Enable (or disable) netmap flags, and intercept (or restore) | * Enable (or disable) netmap flags, and intercept (or restore) | ||||
* ifp->if_transmit. This is done once the device has been stopped | * ifp->if_transmit. This is done once the device has been stopped | ||||
* to prevent race conditions. Also, this must be done after | * to prevent race conditions. Also, this must be done after | ||||
* calling netmap_disable_all_rings() and before calling | * calling netmap_disable_all_rings() and before calling | ||||
* netmap_enable_all_rings(), so that these two functions see the | * netmap_enable_all_rings(), so that these two functions see the | ||||
* updated state of the NAF_NETMAP_ON bit. | * updated state of the NAF_NETMAP_ON bit. | ||||
*/ | */ | ||||
if (onoff) { | if (onoff) { | ||||
nm_set_native_flags(na); | nm_set_native_flags(na); | ||||
} else { | } else { | ||||
nm_clear_native_flags(na); | nm_clear_native_flags(na); | ||||
} | } | ||||
iflib_init_locked(ctx); | iflib_init_locked(ctx); | ||||
IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); // XXX why twice ? | IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); // XXX why twice ? | ||||
status = ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1; | status = if_getdrvflags(ifp) & IFF_DRV_RUNNING ? 0 : 1; | ||||
if (status) | if (status) | ||||
nm_clear_native_flags(na); | nm_clear_native_flags(na); | ||||
CTX_UNLOCK(ctx); | CTX_UNLOCK(ctx); | ||||
return (status); | return (status); | ||||
} | } | ||||
static int | static int | ||||
iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) | iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) | ||||
{ | { | ||||
if_t ifp = na->ifp; | if_t ifp = na->ifp; | ||||
if_ctx_t ctx = ifp->if_softc; | if_ctx_t ctx = if_getsoftc(ifp); | ||||
iflib_rxq_t rxq = &ctx->ifc_rxqs[0]; | iflib_rxq_t rxq = &ctx->ifc_rxqs[0]; | ||||
iflib_fl_t fl = &rxq->ifr_fl[0]; | iflib_fl_t fl = &rxq->ifr_fl[0]; | ||||
info->num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; | info->num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; | ||||
info->num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; | info->num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; | ||||
info->num_tx_descs = iflib_num_tx_descs(ctx); | info->num_tx_descs = iflib_num_tx_descs(ctx); | ||||
info->num_rx_descs = iflib_num_rx_descs(ctx); | info->num_rx_descs = iflib_num_rx_descs(ctx); | ||||
info->rx_buf_maxsize = fl->ifl_buf_size; | info->rx_buf_maxsize = fl->ifl_buf_size; | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | iflib_netmap_txsync(struct netmap_kring *kring, int flags) | ||||
int tx_pkts = 0, tx_bytes = 0; | int tx_pkts = 0, tx_bytes = 0; | ||||
/* | /* | ||||
* interrupts on every tx packet are expensive so request | * interrupts on every tx packet are expensive so request | ||||
* them every half ring, or where NS_REPORT is set | * them every half ring, or where NS_REPORT is set | ||||
*/ | */ | ||||
u_int report_frequency = kring->nkr_num_slots >> 1; | u_int report_frequency = kring->nkr_num_slots >> 1; | ||||
/* device-specific */ | /* device-specific */ | ||||
if_ctx_t ctx = ifp->if_softc; | if_ctx_t ctx = if_getsoftc(ifp); | ||||
iflib_txq_t txq = &ctx->ifc_txqs[kring->ring_id]; | iflib_txq_t txq = &ctx->ifc_txqs[kring->ring_id]; | ||||
bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, | bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, | ||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | ||||
/* | /* | ||||
* First part: process new packets to send. | * First part: process new packets to send. | ||||
* nm_i is the current index in the netmap kring, | * nm_i is the current index in the netmap kring, | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | iflib_netmap_rxsync(struct netmap_kring *kring, int flags) | ||||
if_t ifp = na->ifp; | if_t ifp = na->ifp; | ||||
uint32_t nm_i; /* index into the netmap ring */ | uint32_t nm_i; /* index into the netmap ring */ | ||||
uint32_t nic_i; /* index into the NIC ring */ | uint32_t nic_i; /* index into the NIC ring */ | ||||
u_int n; | u_int n; | ||||
u_int const lim = kring->nkr_num_slots - 1; | u_int const lim = kring->nkr_num_slots - 1; | ||||
int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; | int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; | ||||
int i = 0, rx_bytes = 0, rx_pkts = 0; | int i = 0, rx_bytes = 0, rx_pkts = 0; | ||||
if_ctx_t ctx = ifp->if_softc; | if_ctx_t ctx = if_getsoftc(ifp); | ||||
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; | ||||
iflib_rxq_t rxq = &ctx->ifc_rxqs[kring->ring_id]; | iflib_rxq_t rxq = &ctx->ifc_rxqs[kring->ring_id]; | ||||
iflib_fl_t fl = &rxq->ifr_fl[0]; | iflib_fl_t fl = &rxq->ifr_fl[0]; | ||||
struct if_rxd_info ri; | struct if_rxd_info ri; | ||||
qidx_t *cidxp; | qidx_t *cidxp; | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | iflib_netmap_rxsync(struct netmap_kring *kring, int flags) | ||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, rx_pkts); | if_inc_counter(ifp, IFCOUNTER_IPACKETS, rx_pkts); | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
iflib_netmap_intr(struct netmap_adapter *na, int onoff) | iflib_netmap_intr(struct netmap_adapter *na, int onoff) | ||||
{ | { | ||||
if_ctx_t ctx = na->ifp->if_softc; | if_ctx_t ctx = if_getsoftc(na->ifp); | ||||
CTX_LOCK(ctx); | CTX_LOCK(ctx); | ||||
if (onoff) { | if (onoff) { | ||||
IFDI_INTR_ENABLE(ctx); | IFDI_INTR_ENABLE(ctx); | ||||
} else { | } else { | ||||
IFDI_INTR_DISABLE(ctx); | IFDI_INTR_DISABLE(ctx); | ||||
} | } | ||||
CTX_UNLOCK(ctx); | CTX_UNLOCK(ctx); | ||||
▲ Show 20 Lines • Show All 1,578 Lines • ▼ Show 20 Lines | #endif | ||||
m->m_pkthdr.csum_data = ri->iri_csum_data; | m->m_pkthdr.csum_data = ri->iri_csum_data; | ||||
return (m); | return (m); | ||||
} | } | ||||
#if defined(INET6) || defined(INET) | #if defined(INET6) || defined(INET) | ||||
static void | static void | ||||
iflib_get_ip_forwarding(struct lro_ctrl *lc, bool *v4, bool *v6) | iflib_get_ip_forwarding(struct lro_ctrl *lc, bool *v4, bool *v6) | ||||
{ | { | ||||
CURVNET_SET(lc->ifp->if_vnet); | CURVNET_SET(lc->ifp->if_vnet); /* XXX - DRVAPI */ | ||||
#if defined(INET6) | #if defined(INET6) | ||||
*v6 = V_ip6_forwarding; | *v6 = V_ip6_forwarding; | ||||
#endif | #endif | ||||
#if defined(INET) | #if defined(INET) | ||||
*v4 = V_ipforwarding; | *v4 = V_ipforwarding; | ||||
#endif | #endif | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) | ||||
if ((avail = iflib_rxd_avail(ctx, rxq, *cidxp, budget)) == 0) { | if ((avail = iflib_rxd_avail(ctx, rxq, *cidxp, budget)) == 0) { | ||||
for (i = 0, fl = &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) | for (i = 0, fl = &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) | ||||
retval |= iflib_fl_refill_all(ctx, fl); | retval |= iflib_fl_refill_all(ctx, fl); | ||||
DBG_COUNTER_INC(rx_unavail); | DBG_COUNTER_INC(rx_unavail); | ||||
return (retval); | return (retval); | ||||
} | } | ||||
/* pfil needs the vnet to be set */ | /* pfil needs the vnet to be set */ | ||||
CURVNET_SET_QUIET(ifp->if_vnet); | CURVNET_SET_QUIET(ifp->if_vnet); /* XXX - DRVAPI */ | ||||
for (budget_left = budget; budget_left > 0 && avail > 0;) { | for (budget_left = budget; budget_left > 0 && avail > 0;) { | ||||
if (__predict_false(!CTX_ACTIVE(ctx))) { | if (__predict_false(!CTX_ACTIVE(ctx))) { | ||||
DBG_COUNTER_INC(rx_ctx_inactive); | DBG_COUNTER_INC(rx_ctx_inactive); | ||||
break; | break; | ||||
} | } | ||||
/* | /* | ||||
* Reset client set fields to their default values | * Reset client set fields to their default values | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | #ifndef __NO_STRICT_ALIGNMENT | ||||
if (!IP_ALIGNED(m) && (m = iflib_fixup_rx(m)) == NULL) | if (!IP_ALIGNED(m) && (m = iflib_fixup_rx(m)) == NULL) | ||||
continue; | continue; | ||||
#endif | #endif | ||||
#if defined(INET6) || defined(INET) | #if defined(INET6) || defined(INET) | ||||
if (lro_enabled) { | if (lro_enabled) { | ||||
if (!lro_possible) { | if (!lro_possible) { | ||||
lro_possible = iflib_check_lro_possible(m, v4_forwarding, v6_forwarding); | lro_possible = iflib_check_lro_possible(m, v4_forwarding, v6_forwarding); | ||||
if (lro_possible && mf != NULL) { | if (lro_possible && mf != NULL) { | ||||
ifp->if_input(ifp, mf); | if_input(ifp, mf); | ||||
DBG_COUNTER_INC(rx_if_input); | DBG_COUNTER_INC(rx_if_input); | ||||
mt = mf = NULL; | mt = mf = NULL; | ||||
} | } | ||||
} | } | ||||
if ((m->m_pkthdr.csum_flags & (CSUM_L4_CALC|CSUM_L4_VALID)) == | if ((m->m_pkthdr.csum_flags & (CSUM_L4_CALC|CSUM_L4_VALID)) == | ||||
(CSUM_L4_CALC|CSUM_L4_VALID)) { | (CSUM_L4_CALC|CSUM_L4_VALID)) { | ||||
if (lro_possible && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0) | if (lro_possible && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0) | ||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
if (lro_possible) { | if (lro_possible) { | ||||
ifp->if_input(ifp, m); | if_input(ifp, m); | ||||
DBG_COUNTER_INC(rx_if_input); | DBG_COUNTER_INC(rx_if_input); | ||||
continue; | continue; | ||||
} | } | ||||
if (mf == NULL) | if (mf == NULL) | ||||
mf = m; | mf = m; | ||||
if (mt != NULL) | if (mt != NULL) | ||||
mt->m_nextpkt = m; | mt->m_nextpkt = m; | ||||
mt = m; | mt = m; | ||||
} | } | ||||
if (mf != NULL) { | if (mf != NULL) { | ||||
ifp->if_input(ifp, mf); | if_input(ifp, mf); | ||||
DBG_COUNTER_INC(rx_if_input); | DBG_COUNTER_INC(rx_if_input); | ||||
} | } | ||||
if_inc_counter(ifp, IFCOUNTER_IBYTES, rx_bytes); | if_inc_counter(ifp, IFCOUNTER_IBYTES, rx_bytes); | ||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, rx_pkts); | if_inc_counter(ifp, IFCOUNTER_IPACKETS, rx_pkts); | ||||
/* | /* | ||||
* Flush any outstanding LRO work | * Flush any outstanding LRO work | ||||
▲ Show 20 Lines • Show All 922 Lines • ▼ Show 20 Lines | if (__predict_false(err)) { | ||||
continue; | continue; | ||||
} | } | ||||
pkt_sent++; | pkt_sent++; | ||||
m = *mp; | m = *mp; | ||||
DBG_COUNTER_INC(tx_sent); | DBG_COUNTER_INC(tx_sent); | ||||
bytes_sent += m->m_pkthdr.len; | bytes_sent += m->m_pkthdr.len; | ||||
mcast_sent += !!(m->m_flags & M_MCAST); | mcast_sent += !!(m->m_flags & M_MCAST); | ||||
if (__predict_false(!(ifp->if_drv_flags & IFF_DRV_RUNNING))) | if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))) | ||||
break; | break; | ||||
ETHER_BPF_MTAP(ifp, m); | ETHER_BPF_MTAP(ifp, m); | ||||
rang = iflib_txd_db_check(txq, false); | rang = iflib_txd_db_check(txq, false); | ||||
} | } | ||||
/* deliberate use of bitwise or to avoid gratuitous short-circuit */ | /* deliberate use of bitwise or to avoid gratuitous short-circuit */ | ||||
ring = rang ? false : (iflib_min_tx_latency | err); | ring = rang ? false : (iflib_min_tx_latency | err); | ||||
iflib_txd_db_check(txq, ring); | iflib_txd_db_check(txq, ring); | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | #endif | ||||
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) | if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) | ||||
return; | return; | ||||
#ifdef DEV_NETMAP | #ifdef DEV_NETMAP | ||||
if ((if_getcapenable(ifp) & IFCAP_NETMAP) && | if ((if_getcapenable(ifp) & IFCAP_NETMAP) && | ||||
netmap_tx_irq(ifp, txq->ift_id)) | netmap_tx_irq(ifp, txq->ift_id)) | ||||
goto skip_ifmp; | goto skip_ifmp; | ||||
#endif | #endif | ||||
#ifdef ALTQ | #ifdef ALTQ | ||||
if (ALTQ_IS_ENABLED(&ifp->if_snd)) | if (ALTQ_IS_ENABLED(&ifp->if_snd)) /* XXX - DRVAPI */ | ||||
iflib_altq_if_start(ifp); | iflib_altq_if_start(ifp); | ||||
#endif | #endif | ||||
if (txq->ift_db_pending) | if (txq->ift_db_pending) | ||||
ifmp_ring_enqueue(txq->ift_br, (void **)&txq, 1, TX_BATCH_SIZE, abdicate); | ifmp_ring_enqueue(txq->ift_br, (void **)&txq, 1, TX_BATCH_SIZE, abdicate); | ||||
else if (!abdicate) | else if (!abdicate) | ||||
ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); | ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); | ||||
/* | /* | ||||
* When abdicating, we always need to check drainage, not just when we don't enqueue | * When abdicating, we always need to check drainage, not just when we don't enqueue | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
iflib_if_transmit(if_t ifp, struct mbuf *m) | iflib_if_transmit(if_t ifp, struct mbuf *m) | ||||
{ | { | ||||
if_ctx_t ctx = if_getsoftc(ifp); | if_ctx_t ctx = if_getsoftc(ifp); | ||||
iflib_txq_t txq; | iflib_txq_t txq; | ||||
int err, qidx; | int err, qidx; | ||||
int abdicate; | int abdicate; | ||||
if (__predict_false((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || !LINK_ACTIVE(ctx))) { | if (__predict_false((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 || !LINK_ACTIVE(ctx))) { | ||||
DBG_COUNTER_INC(tx_frees); | DBG_COUNTER_INC(tx_frees); | ||||
m_freem(m); | m_freem(m); | ||||
return (ENETDOWN); | return (ENETDOWN); | ||||
} | } | ||||
MPASS(m->m_nextpkt == NULL); | MPASS(m->m_nextpkt == NULL); | ||||
/* ALTQ-enabled interfaces always use queue 0. */ | /* ALTQ-enabled interfaces always use queue 0. */ | ||||
qidx = 0; | qidx = 0; | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
* the disused IFF_DRV_OACTIVE flag. Additionally, iflib_altq_if_start() | * the disused IFF_DRV_OACTIVE flag. Additionally, iflib_altq_if_start() | ||||
* will be installed as the start routine for use by ALTQ facilities that | * will be installed as the start routine for use by ALTQ facilities that | ||||
* need to trigger queue drains on a scheduled basis. | * need to trigger queue drains on a scheduled basis. | ||||
* | * | ||||
*/ | */ | ||||
static void | static void | ||||
iflib_altq_if_start(if_t ifp) | iflib_altq_if_start(if_t ifp) | ||||
{ | { | ||||
struct ifaltq *ifq = &ifp->if_snd; | struct ifaltq *ifq = &ifp->if_snd; /* XXX - DRVAPI */ | ||||
struct mbuf *m; | struct mbuf *m; | ||||
IFQ_LOCK(ifq); | IFQ_LOCK(ifq); | ||||
IFQ_DEQUEUE_NOLOCK(ifq, m); | IFQ_DEQUEUE_NOLOCK(ifq, m); | ||||
while (m != NULL) { | while (m != NULL) { | ||||
iflib_if_transmit(ifp, m); | iflib_if_transmit(ifp, m); | ||||
IFQ_DEQUEUE_NOLOCK(ifq, m); | IFQ_DEQUEUE_NOLOCK(ifq, m); | ||||
} | } | ||||
IFQ_UNLOCK(ifq); | IFQ_UNLOCK(ifq); | ||||
} | } | ||||
static int | static int | ||||
iflib_altq_if_transmit(if_t ifp, struct mbuf *m) | iflib_altq_if_transmit(if_t ifp, struct mbuf *m) | ||||
{ | { | ||||
int err; | int err; | ||||
if (ALTQ_IS_ENABLED(&ifp->if_snd)) { | if (ALTQ_IS_ENABLED(&ifp->if_snd)) { /* XXX - DRVAPI */ | ||||
IFQ_ENQUEUE(&ifp->if_snd, m, err); | IFQ_ENQUEUE(&ifp->if_snd, m, err); /* XXX - DRVAPI */ | ||||
if (err == 0) | if (err == 0) | ||||
iflib_altq_if_start(ifp); | iflib_altq_if_start(ifp); | ||||
} else | } else | ||||
err = iflib_if_transmit(ifp, m); | err = iflib_if_transmit(ifp, m); | ||||
return (err); | return (err); | ||||
} | } | ||||
#endif /* ALTQ */ | #endif /* ALTQ */ | ||||
▲ Show 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | iflib_add_pfil(if_ctx_t ctx) | ||||
struct pfil_head *pfil; | struct pfil_head *pfil; | ||||
struct pfil_head_args pa; | struct pfil_head_args pa; | ||||
iflib_rxq_t rxq; | iflib_rxq_t rxq; | ||||
int i; | int i; | ||||
pa.pa_version = PFIL_VERSION; | pa.pa_version = PFIL_VERSION; | ||||
pa.pa_flags = PFIL_IN; | pa.pa_flags = PFIL_IN; | ||||
pa.pa_type = PFIL_TYPE_ETHERNET; | pa.pa_type = PFIL_TYPE_ETHERNET; | ||||
pa.pa_headname = ctx->ifc_ifp->if_xname; | pa.pa_headname = if_name(ctx->ifc_ifp); | ||||
pfil = pfil_head_register(&pa); | pfil = pfil_head_register(&pa); | ||||
for (i = 0, rxq = ctx->ifc_rxqs; i < NRXQSETS(ctx); i++, rxq++) { | for (i = 0, rxq = ctx->ifc_rxqs; i < NRXQSETS(ctx); i++, rxq++) { | ||||
rxq->pfil = pfil; | rxq->pfil = pfil; | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 626 Lines • ▼ Show 20 Lines | |||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
if (scctx->isc_capabilities & 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_capabilities | 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; | if_setflagbits(ifp, IFF_NOGROUP, 0); | ||||
if (sctx->isc_flags & IFLIB_PSEUDO) { | if (sctx->isc_flags & IFLIB_PSEUDO) { | ||||
ifmedia_add(ctx->ifc_mediap, IFM_ETHER | IFM_AUTO, 0, NULL); | ifmedia_add(ctx->ifc_mediap, IFM_ETHER | IFM_AUTO, 0, NULL); | ||||
ifmedia_set(ctx->ifc_mediap, IFM_ETHER | IFM_AUTO); | ifmedia_set(ctx->ifc_mediap, IFM_ETHER | IFM_AUTO); | ||||
if (sctx->isc_flags & IFLIB_PSEUDO_ETHER) { | if (sctx->isc_flags & IFLIB_PSEUDO_ETHER) { | ||||
ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac.octet); | ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac.octet); | ||||
} else { | } else { | ||||
if_attach(ctx->ifc_ifp); | if_attach(ctx->ifc_ifp); | ||||
bpfattach(ctx->ifc_ifp, DLT_NULL, sizeof(u_int32_t)); | bpfattach(ctx->ifc_ifp, DLT_NULL, sizeof(u_int32_t)); | ||||
▲ Show 20 Lines • Show All 1,849 Lines • Show Last 20 Lines |