From 1722eeac95b03e63f66a49fdd019d0bd02104438 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Mon, 6 May 2019 20:56:41 +0000 Subject: [PATCH] - Remove the unused ifc_link_irq and ifc_mtx_name members of struct iflib_ctx. - Remove the only ever written to ift_db_mtx_name member of struct iflib_txq. - Remove the unused or only ever written to ifr_size, ifr_cq_pidx, ifr_cq_gen and ifr_lro_enabled members of struct iflib_rxq. - Consistently spell DMA, RX and TX uppercase in comments, messages etc. instead of mixing with some lowercase variants. - Consistently use if_t instead of a mix of if_t and struct ifnet pointers. - Bring the function comments of _iflib_fl_refill(), iflib_rx_sds_free() and iflib_fl_setup() in line with reality. - Judging problem reports, people are wondering what on earth messages like: "TX(0) desc avail = 1024, pidx = 0" are trying to indicate. Thus, extend this string to be more like that of non-iflib(4) Ethernet MAC drivers, notifying about a watchdog timeout due to which the interface will be reset. - Take advantage of the M_HAS_VLANTAG macro. - Use false/true rather than FALSE/TRUE for variables of type bool. - Use FALLTHROUGH as advocated by style(9). --- sys/net/iflib.c | 150 +++++++++++++++++++----------------------- sys/net/iflib.h | 2 +- sys/net/iflib_clone.c | 10 +-- 3 files changed, 73 insertions(+), 89 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index d72091059ebb..51bb4e7d4261 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -172,7 +172,6 @@ struct iflib_ctx { uint32_t ifc_rx_mbuf_sz; int ifc_link_state; - int ifc_link_irq; int ifc_watchdog_events; struct cdev *ifc_led_dev; struct resource *ifc_msix_mem; @@ -210,10 +209,8 @@ struct iflib_ctx { eventhandler_tag ifc_vlan_attach_event; eventhandler_tag ifc_vlan_detach_event; struct ether_addr ifc_mac; - char ifc_mtx_name[16]; }; - void * iflib_get_softc(if_ctx_t ctx) { @@ -289,7 +286,6 @@ typedef struct iflib_sw_tx_desc_array { struct mbuf **ifsd_m; /* pkthdr mbufs */ } if_txsd_vec_t; - /* magic number that should be high enough for any hardware */ #define IFLIB_MAX_TX_SEGS 128 #define IFLIB_RX_COPY_THRESH 128 @@ -308,10 +304,10 @@ typedef struct iflib_sw_tx_desc_array { #define IFLIB_RESTART_BUDGET 8 - #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) + struct iflib_txq { qidx_t ift_in_use; qidx_t ift_cidx; @@ -361,7 +357,6 @@ struct iflib_txq { iflib_dma_info_t ift_ifdi; #define MTX_NAME_LEN 16 char ift_mtx_name[MTX_NAME_LEN]; - char ift_db_mtx_name[MTX_NAME_LEN]; bus_dma_segment_t ift_segs[IFLIB_MAX_TX_SEGS] __aligned(CACHE_LINE_SIZE); #ifdef IFLIB_DIAGNOSTICS uint64_t ift_cpu_exec_count[256]; @@ -424,25 +419,20 @@ get_inuse(int size, qidx_t cidx, qidx_t pidx, uint8_t gen) ((head) >= (tail) ? (head) - (tail) : (wrap) - (tail) + (head)) struct iflib_rxq { - /* If there is a separate completion queue - - * these are the cq cidx and pidx. Otherwise - * these are unused. - */ - qidx_t ifr_size; - qidx_t ifr_cq_cidx; - qidx_t ifr_cq_pidx; - uint8_t ifr_cq_gen; - uint8_t ifr_fl_offset; - if_ctx_t ifr_ctx; iflib_fl_t ifr_fl; uint64_t ifr_rx_irq; struct pfil_head *pfil; + /* + * If there is a separate completion queue (IFLIB_HAS_RXCQ), this is + * the command queue consumer index. Otherwise it's unused. + */ + qidx_t ifr_cq_cidx; uint16_t ifr_id; - uint8_t ifr_lro_enabled; uint8_t ifr_nfl; uint8_t ifr_ntxqirq; uint8_t ifr_txqid[IFLIB_MAX_TX_SHARED_INTR]; + uint8_t ifr_fl_offset; struct lro_ctrl ifr_lc; struct grouptask ifr_task; struct iflib_filter_info ifr_filter_info; @@ -540,14 +530,11 @@ rxd_info_zero(if_rxd_info_t ri) #define CTX_UNLOCK(ctx) sx_xunlock(&(ctx)->ifc_ctx_sx) #define CTX_LOCK_DESTROY(ctx) sx_destroy(&(ctx)->ifc_ctx_sx) - #define STATE_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_state_mtx, _name, "iflib state lock", MTX_DEF) #define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx) #define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx) #define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx) - - #define CALLOUT_LOCK(txq) mtx_lock(&txq->ift_mtx) #define CALLOUT_UNLOCK(txq) mtx_unlock(&txq->ift_mtx) @@ -610,15 +597,15 @@ static int iflib_fl_refills_large; static int iflib_tx_frees; SYSCTL_INT(_net_iflib, OID_AUTO, tx_seen, CTLFLAG_RD, - &iflib_tx_seen, 0, "# tx mbufs seen"); + &iflib_tx_seen, 0, "# TX mbufs seen"); SYSCTL_INT(_net_iflib, OID_AUTO, tx_sent, CTLFLAG_RD, - &iflib_tx_sent, 0, "# tx mbufs sent"); + &iflib_tx_sent, 0, "# TX mbufs sent"); SYSCTL_INT(_net_iflib, OID_AUTO, tx_encap, CTLFLAG_RD, - &iflib_tx_encap, 0, "# tx mbufs encapped"); + &iflib_tx_encap, 0, "# TX mbufs encapped"); SYSCTL_INT(_net_iflib, OID_AUTO, tx_frees, CTLFLAG_RD, - &iflib_tx_frees, 0, "# tx frees"); + &iflib_tx_frees, 0, "# TX frees"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_allocs, CTLFLAG_RD, - &iflib_rx_allocs, 0, "# rx allocations"); + &iflib_rx_allocs, 0, "# RX allocations"); SYSCTL_INT(_net_iflib, OID_AUTO, fl_refills, CTLFLAG_RD, &iflib_fl_refills, 0, "# refills"); SYSCTL_INT(_net_iflib, OID_AUTO, fl_refills_large, CTLFLAG_RD, @@ -664,7 +651,7 @@ static int iflib_verbose_debug; SYSCTL_INT(_net_iflib, OID_AUTO, task_fn_rx, CTLFLAG_RD, &iflib_task_fn_rxs, 0, "# task_fn_rx calls"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_intr_enables, CTLFLAG_RD, - &iflib_rx_intr_enables, 0, "# rx intr enables"); + &iflib_rx_intr_enables, 0, "# RX intr enables"); SYSCTL_INT(_net_iflib, OID_AUTO, fast_intrs, CTLFLAG_RD, &iflib_fast_intrs, 0, "# fast_intr calls"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_unavail, CTLFLAG_RD, @@ -768,13 +755,13 @@ SYSCTL_DECL(_dev_netmap); int iflib_crcstrip = 1; SYSCTL_INT(_dev_netmap, OID_AUTO, iflib_crcstrip, - CTLFLAG_RW, &iflib_crcstrip, 1, "strip CRC on rx frames"); + CTLFLAG_RW, &iflib_crcstrip, 1, "strip CRC on RX frames"); int iflib_rx_miss, iflib_rx_miss_bufs; SYSCTL_INT(_dev_netmap, OID_AUTO, iflib_rx_miss, - CTLFLAG_RW, &iflib_rx_miss, 0, "potentially missed rx intr"); + CTLFLAG_RW, &iflib_rx_miss, 0, "potentially missed RX intr"); SYSCTL_INT(_dev_netmap, OID_AUTO, iflib_rx_miss_bufs, - CTLFLAG_RW, &iflib_rx_miss_bufs, 0, "potentially missed rx intr bufs"); + CTLFLAG_RW, &iflib_rx_miss_bufs, 0, "potentially missed RX intr bufs"); /* * Register/unregister. We are already under netmap lock. @@ -783,7 +770,7 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, iflib_rx_miss_bufs, static int iflib_netmap_register(struct netmap_adapter *na, int onoff) { - struct ifnet *ifp = na->ifp; + if_t ifp = na->ifp; if_ctx_t ctx = ifp->if_softc; int status; @@ -913,7 +900,7 @@ static int iflib_netmap_txsync(struct netmap_kring *kring, int flags) { struct netmap_adapter *na = kring->na; - struct ifnet *ifp = na->ifp; + if_t ifp = na->ifp; struct netmap_ring *ring = kring->ring; u_int nm_i; /* index into the netmap kring */ u_int nic_i; /* index into the NIC ring */ @@ -1061,6 +1048,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) { struct netmap_adapter *na = kring->na; struct netmap_ring *ring = kring->ring; + if_t ifp = na->ifp; iflib_fl_t fl; uint32_t nm_i; /* index into the netmap ring */ uint32_t nic_i; /* index into the NIC ring */ @@ -1070,7 +1058,6 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; struct if_rxd_info ri; - struct ifnet *ifp = na->ifp; if_ctx_t ctx = ifp->if_softc; iflib_rxq_t rxq = &ctx->ifc_rxqs[kring->ring_id]; if (head > lim) @@ -1154,8 +1141,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) static void iflib_netmap_intr(struct netmap_adapter *na, int onoff) { - struct ifnet *ifp = na->ifp; - if_ctx_t ctx = ifp->if_softc; + if_ctx_t ctx = na->ifp->if_softc; CTX_LOCK(ctx); if (onoff) { @@ -1929,13 +1915,13 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) } /** - * rxq_refill - refill an rxq free-buffer list - * @ctx: the iflib context - * @rxq: the free-list to refill - * @n: the number of new buffers to allocate + * _iflib_fl_refill - refill an rxq free-buffer list + * @ctx: the iflib context + * @fl: the free list to refill + * @count: the number of new buffers to allocate * - * (Re)populate an rxq free-buffer list with up to @n new packet buffers. - * The caller must assure that @n does not exceed the queue's capacity. + * (Re)populate an rxq free-buffer list with up to @count new packet buffers. + * The caller must assure that @count does not exceed the queue's capacity. */ static void _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) @@ -2088,6 +2074,7 @@ uint8_t iflib_in_detach(if_ctx_t ctx) { bool in_detach; + STATE_LOCK(ctx); in_detach = !!(ctx->ifc_flags & IFC_IN_DETACH); STATE_UNLOCK(ctx); @@ -2145,7 +2132,7 @@ iflib_fl_bufs_free(iflib_fl_t fl) /********************************************************************* * - * Initialize a receive ring and its buffers. + * Initialize a free list and its buffers. * **********************************************************************/ static int @@ -2228,13 +2215,12 @@ iflib_rx_sds_free(iflib_rxq_t rxq) } free(rxq->ifr_fl, M_IFLIB); rxq->ifr_fl = NULL; - rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; + rxq->ifr_cq_cidx = 0; } } /* - * MI independent logic - * + * Timer routine */ static void iflib_timer(void *arg) @@ -2247,6 +2233,7 @@ iflib_timer(void *arg) if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) return; + /* ** Check on the state of the TX queue(s), this ** can be done without the lock because its RO @@ -2276,9 +2263,11 @@ iflib_timer(void *arg) if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) callout_reset_on(&txq->ift_timer, reset_on, iflib_timer, txq, txq->ift_timer.c_cpu); return; + hung: - device_printf(ctx->ifc_dev, "TX(%d) desc avail = %d, pidx = %d\n", - txq->ift_id, TXQ_AVAIL(txq), txq->ift_pidx); + device_printf(ctx->ifc_dev, + "Watchdog timeout (TX: %d desc avail: %d pidx: %d) -- resetting\n", + txq->ift_id, TXQ_AVAIL(txq), txq->ift_pidx); STATE_LOCK(ctx); if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET); @@ -2304,6 +2293,7 @@ iflib_calc_rx_mbuf_sz(if_ctx_t ctx) uint32_t iflib_get_rx_mbuf_sz(if_ctx_t ctx) { + return (ctx->ifc_rx_mbuf_sz); } @@ -2318,7 +2308,6 @@ iflib_init_locked(if_ctx_t ctx) iflib_rxq_t rxq; int i, j, tx_ip_csum_flags, tx_ip6_csum_flags; - if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); IFDI_INTR_DISABLE(ctx); @@ -2447,7 +2436,7 @@ iflib_stop(if_ctx_t ctx) for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ - rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; + rxq->ifr_cq_cidx = 0; for (j = 0, di = rxq->ifr_ifdi; j < sctx->isc_nrxqs; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ @@ -2733,6 +2722,7 @@ iflib_get_ip_forwarding(struct lro_ctrl *lc __unused, bool *v4 __unused, bool *v static bool iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) { + if_t ifp; if_ctx_t ctx = rxq->ifr_ctx; if_shared_ctx_t sctx = ctx->ifc_sctx; if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; @@ -2741,7 +2731,6 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) struct if_rxd_info ri; int err, budget_left, rx_bytes, rx_pkts; iflib_fl_t fl; - struct ifnet *ifp; int lro_enabled; bool v4_forwarding, v6_forwarding, lro_possible; @@ -2792,10 +2781,8 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) *cidxp = ri.iri_cidx; /* Update our consumer index */ /* XXX NB: shurd - check if this is still safe */ - while (rxq->ifr_cq_cidx >= scctx->isc_nrxd[0]) { + while (rxq->ifr_cq_cidx >= scctx->isc_nrxd[0]) rxq->ifr_cq_cidx -= scctx->isc_nrxd[0]; - rxq->ifr_cq_gen = 0; - } /* was this only a completion queue message? */ if (__predict_false(ri.iri_nfrags == 0)) continue; @@ -3311,7 +3298,7 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp) pi.ipi_qsidx = txq->ift_id; pi.ipi_len = m_head->m_pkthdr.len; pi.ipi_csum_flags = m_head->m_pkthdr.csum_flags; - pi.ipi_vtag = (m_head->m_flags & M_VLANTAG) ? m_head->m_pkthdr.ether_vtag : 0; + pi.ipi_vtag = M_HAS_VLANTAG(m_head) ? m_head->m_pkthdr.ether_vtag : 0; /* deliberate bitwise OR to make one condition */ if (__predict_true((pi.ipi_csum_flags | pi.ipi_vtag))) { @@ -3584,7 +3571,7 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) { iflib_txq_t txq = r->cookie; if_ctx_t ctx = txq->ift_ctx; - struct ifnet *ifp = ctx->ifc_ifp; + if_t ifp = ctx->ifc_ifp; struct mbuf **mp, *m; int i, count, consumed, pkt_sent, bytes_sent, mcast_sent, avail; int reclaimed, err, in_use_prev, desc_used; @@ -4099,18 +4086,18 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; #endif - bool avoid_reset = FALSE; + bool avoid_reset = false; int err = 0, reinit = 0, bits; switch (command) { case SIOCSIFADDR: #ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) - avoid_reset = TRUE; + avoid_reset = true; #endif #ifdef INET6 if (ifa->ifa_addr->sa_family == AF_INET6) - avoid_reset = TRUE; + avoid_reset = true; #endif /* ** Calling init results in link renegotiation, @@ -4182,7 +4169,7 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) CTX_LOCK(ctx); IFDI_MEDIA_SET(ctx); CTX_UNLOCK(ctx); - /* falls thru */ + /* FALLTHROUGH */ case SIOCGIFMEDIA: case SIOCGIFXMEDIA: err = ifmedia_ioctl(ifp, ifr, ctx->ifc_mediap, command); @@ -4604,12 +4591,13 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct main_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0; /* XXX change for per-queue sizes */ - device_printf(dev, "Using %d tx descriptors and %d rx descriptors\n", + device_printf(dev, "Using %d TX descriptors and %d RX descriptors\n", scctx->isc_ntxd[main_txq], scctx->isc_nrxd[main_rxq]); for (i = 0; i < sctx->isc_nrxqs; i++) { if (!powerof2(scctx->isc_nrxd[i])) { /* round down instead? */ - device_printf(dev, "# rx descriptors must be a power of 2\n"); + device_printf(dev, + "# RX descriptors must be a power of 2\n"); err = EINVAL; goto fail_iflib_detach; } @@ -4617,7 +4605,7 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct for (i = 0; i < sctx->isc_ntxqs; i++) { if (!powerof2(scctx->isc_ntxd[i])) { device_printf(dev, - "# tx descriptors must be a power of 2"); + "# TX descriptors must be a power of 2"); err = EINVAL; goto fail_iflib_detach; } @@ -4871,12 +4859,13 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp, main_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0; /* XXX change for per-queue sizes */ - device_printf(dev, "Using %d tx descriptors and %d rx descriptors\n", + device_printf(dev, "Using %d TX descriptors and %d RX descriptors\n", scctx->isc_ntxd[main_txq], scctx->isc_nrxd[main_rxq]); for (i = 0; i < sctx->isc_nrxqs; i++) { if (!powerof2(scctx->isc_nrxd[i])) { /* round down instead? */ - device_printf(dev, "# rx descriptors must be a power of 2\n"); + device_printf(dev, + "# RX descriptors must be a power of 2\n"); err = EINVAL; goto fail_iflib_detach; } @@ -4884,7 +4873,7 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp, for (i = 0; i < sctx->isc_ntxqs; i++) { if (!powerof2(scctx->isc_ntxd[i])) { device_printf(dev, - "# tx descriptors must be a power of 2"); + "# TX descriptors must be a power of 2"); err = EINVAL; goto fail_iflib_detach; } @@ -5447,14 +5436,11 @@ iflib_queues_alloc(if_ctx_t ctx) } /* Initialize the TX lock */ - snprintf(txq->ift_mtx_name, MTX_NAME_LEN, "%s:tx(%d):callout", + snprintf(txq->ift_mtx_name, MTX_NAME_LEN, "%s:TX(%d):callout", device_get_nameunit(dev), txq->ift_id); mtx_init(&txq->ift_mtx, txq->ift_mtx_name, NULL, MTX_DEF); callout_init_mtx(&txq->ift_timer, &txq->ift_mtx, 0); - snprintf(txq->ift_db_mtx_name, MTX_NAME_LEN, "%s:tx(%d):db", - device_get_nameunit(dev), txq->ift_id); - err = ifmp_ring_alloc(&txq->ift_br, 2048, txq, iflib_txq_drain, iflib_txq_can_drain, M_IFLIB, M_WAITOK); if (err) { @@ -5634,7 +5620,6 @@ iflib_rx_structures_setup(if_ctx_t ctx) device_printf(ctx->ifc_dev, "LRO Initialization failed!\n"); goto fail; } - rxq->ifr_lro_enabled = TRUE; #endif IFDI_RXQ_SETUP(ctx, rxq->ifr_id); } @@ -5649,7 +5634,7 @@ fail: rxq = ctx->ifc_rxqs; for (i = 0; i < q; ++i, rxq++) { iflib_rx_sds_free(rxq); - rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; + rxq->ifr_cq_cidx = 0; } return (err); #endif @@ -6278,8 +6263,8 @@ iflib_msix_init(if_ctx_t ctx) rx_queues = min(rx_queues, tx_queues); } - device_printf(dev, "Using %d rx queues %d tx queues\n", - rx_queues, tx_queues); + device_printf(dev, "Using %d RX queues %d TX queues\n", rx_queues, + tx_queues); vectors = rx_queues + admincnt; if ((err = pci_alloc_msix(dev, &vectors)) == 0) { @@ -6433,10 +6418,10 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx) "disable MSI-X (default 0)"); SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "rx_budget", CTLFLAG_RWTUN, &ctx->ifc_sysctl_rx_budget, 0, - "set the rx budget"); + "set the RX budget"); SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "tx_abdicate", CTLFLAG_RWTUN, &ctx->ifc_sysctl_tx_abdicate, 0, - "cause tx to abdicate instead of running to completion"); + "cause TX to abdicate instead of running to completion"); ctx->ifc_sysctl_core_offset = CORE_OFFSET_UNSPECIFIED; SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "core_offset", CTLFLAG_RDTUN, &ctx->ifc_sysctl_core_offset, 0, @@ -6449,11 +6434,11 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx) SYSCTL_ADD_PROC(ctx_list, oid_list, OID_AUTO, "override_ntxds", CTLTYPE_STRING|CTLFLAG_RWTUN, ctx, IFLIB_NTXD_HANDLER, mp_ndesc_handler, "A", - "list of # of tx descriptors to use, 0 = use default #"); + "list of # of TX descriptors to use, 0 = use default #"); SYSCTL_ADD_PROC(ctx_list, oid_list, OID_AUTO, "override_nrxds", CTLTYPE_STRING|CTLFLAG_RWTUN, ctx, IFLIB_NRXD_HANDLER, mp_ndesc_handler, "A", - "list of # of rx descriptors to use, 0 = use default #"); + "list of # of RX descriptors to use, 0 = use default #"); } static void @@ -6510,7 +6495,7 @@ iflib_add_device_sysctl_post(if_ctx_t ctx) &txq->ift_no_desc_avail, "# of times no descriptors were available"); SYSCTL_ADD_QUAD(ctx_list, queue_list, OID_AUTO, "tx_map_failed", CTLFLAG_RD, - &txq->ift_map_failed, "# of times dma map failed"); + &txq->ift_map_failed, "# of times DMA map failed"); SYSCTL_ADD_QUAD(ctx_list, queue_list, OID_AUTO, "txd_encap_efbig", CTLFLAG_RD, &txq->ift_txd_encap_efbig, "# of times txd_encap returned EFBIG"); @@ -6570,9 +6555,6 @@ iflib_add_device_sysctl_post(if_ctx_t ctx) CTLFLAG_RD, NULL, "Queue Name"); queue_list = SYSCTL_CHILDREN(queue_node); if (sctx->isc_flags & IFLIB_HAS_RXCQ) { - SYSCTL_ADD_U16(ctx_list, queue_list, OID_AUTO, "rxq_cq_pidx", - CTLFLAG_RD, - &rxq->ifr_cq_pidx, 1, "Producer Index"); SYSCTL_ADD_U16(ctx_list, queue_list, OID_AUTO, "rxq_cq_cidx", CTLFLAG_RD, &rxq->ifr_cq_cidx, 1, "Consumer Index"); @@ -6650,7 +6632,7 @@ iflib_fixup_rx(struct mbuf *m) #ifdef NETDUMP static void -iflib_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +iflib_netdump_init(if_t ifp, int *nrxr, int *ncl, int *clsize) { if_ctx_t ctx; @@ -6663,7 +6645,7 @@ iflib_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) } static void -iflib_netdump_event(struct ifnet *ifp, enum netdump_ev event) +iflib_netdump_event(if_t ifp, enum netdump_ev event) { if_ctx_t ctx; if_softc_ctx_t scctx; @@ -6691,7 +6673,7 @@ iflib_netdump_event(struct ifnet *ifp, enum netdump_ev event) } static int -iflib_netdump_transmit(struct ifnet *ifp, struct mbuf *m) +iflib_netdump_transmit(if_t ifp, struct mbuf *m) { if_ctx_t ctx; iflib_txq_t txq; @@ -6710,7 +6692,7 @@ iflib_netdump_transmit(struct ifnet *ifp, struct mbuf *m) } static int -iflib_netdump_poll(struct ifnet *ifp, int count) +iflib_netdump_poll(if_t ifp, int count) { if_ctx_t ctx; if_softc_ctx_t scctx; diff --git a/sys/net/iflib.h b/sys/net/iflib.h index 6b33330c035a..156d318a1027 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -79,7 +79,7 @@ typedef struct if_rxd_info { /* XXX redundant with the new irf_len field */ uint16_t iri_len; /* packet length */ qidx_t iri_cidx; /* consumer index of cq */ - struct ifnet *iri_ifp; /* some drivers >1 interface per softc */ + if_t iri_ifp; /* driver may have >1 iface per softc */ /* updated by driver */ if_rxd_frag_t iri_frags; diff --git a/sys/net/iflib_clone.c b/sys/net/iflib_clone.c index 7406eb007889..cfd304152bfe 100644 --- a/sys/net/iflib_clone.c +++ b/sys/net/iflib_clone.c @@ -153,16 +153,18 @@ iflib_ip_insert(if_pseudo_t ip) } static void -iflib_ifdetach(void *arg __unused, struct ifnet *ifp) +iflib_ifdetach(void *arg __unused, if_t ifp) { + /* If the ifnet is just being renamed, don't do anything. */ if (ifp->if_flags & IFF_RENAMING) return; } static void -iflib_iflladdr(void *arg __unused, struct ifnet *ifp) +iflib_iflladdr(void *arg __unused, if_t ifp __unused) { + } static int @@ -218,15 +220,15 @@ iflib_clone_create(struct if_clone *ifc, int unit, caddr_t params) } static void -iflib_clone_destroy(struct ifnet *ifp) +iflib_clone_destroy(if_t ifp) { if_ctx_t ctx; device_t dev; struct sx *ctx_lock; int rc; + /* * Detach device / free / free unit - * */ ctx = if_getsoftc(ifp); dev = iflib_get_dev(ctx);