Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jun 2019 15:11:52 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r349110 - stable/12/sys/net
Message-ID:  <201906161511.x5GFBqGo031331@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sun Jun 16 15:11:52 2019
New Revision: 349110
URL: https://svnweb.freebsd.org/changeset/base/349110

Log:
  MFC: r347211
  
  - 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).

Modified:
  stable/12/sys/net/iflib.c
  stable/12/sys/net/iflib.h
  stable/12/sys/net/iflib_clone.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/iflib.c
==============================================================================
--- stable/12/sys/net/iflib.c	Sun Jun 16 14:53:53 2019	(r349109)
+++ stable/12/sys/net/iflib.c	Sun Jun 16 15:11:52 2019	(r349110)
@@ -174,7 +174,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;
@@ -211,10 +210,8 @@ struct iflib_ctx {
 	eventhandler_tag ifc_vlan_attach_event;
 	eventhandler_tag ifc_vlan_detach_event;
 	uint8_t ifc_mac[ETHER_ADDR_LEN];
-	char ifc_mtx_name[16];
 };
 
-
 void *
 iflib_get_softc(if_ctx_t ctx)
 {
@@ -290,7 +287,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
@@ -309,10 +305,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;
@@ -362,7 +358,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];
@@ -425,24 +420,19 @@ get_inuse(int size, qidx_t cidx, qidx_t pidx, uint8_t 
 	((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;
+	/*
+	 * 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;
@@ -541,14 +531,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)
 
@@ -611,15 +598,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,
@@ -666,7 +653,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,
@@ -772,13 +759,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.
@@ -787,7 +774,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;
 
@@ -917,7 +904,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 */
@@ -1065,6 +1052,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl
 {
 	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 */
@@ -1074,7 +1062,6 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl
 	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)
@@ -1158,8 +1145,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl
 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) {
@@ -1965,13 +1951,13 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int
 }
 
 /**
- *	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)
@@ -2123,6 +2109,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);
@@ -2180,7 +2167,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
@@ -2263,13 +2250,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)
@@ -2282,6 +2268,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
@@ -2311,9 +2298,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);
@@ -2339,6 +2328,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);
 }
 
@@ -2353,7 +2343,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);
 
@@ -2482,7 +2471,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 */
@@ -2710,6 +2699,7 @@ iflib_get_ip_forwarding(struct lro_ctrl *lc __unused, 
 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;
@@ -2718,7 +2708,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;
 
@@ -2765,10 +2754,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;
@@ -3284,7 +3271,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))) {
@@ -3557,7 +3544,7 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui
 {
 	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;
@@ -4072,18 +4059,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,
@@ -4155,7 +4142,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_media, command);
@@ -4540,12 +4527,13 @@ iflib_device_register(device_t dev, void *sc, if_share
 	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;
 		}
@@ -4553,7 +4541,7 @@ iflib_device_register(device_t dev, void *sc, if_share
 	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;
 		}
@@ -4806,12 +4794,13 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sc
 	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;
 		}
@@ -4819,7 +4808,7 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sc
 	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;
 		}
@@ -5379,14 +5368,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) {
@@ -5566,7 +5552,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);
 	}
@@ -5581,7 +5566,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
@@ -6205,8 +6190,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) {
@@ -6360,10 +6345,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,
@@ -6376,11 +6361,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
@@ -6437,7 +6422,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");
@@ -6497,9 +6482,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");
@@ -6577,7 +6559,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;
 
@@ -6590,7 +6572,7 @@ iflib_netdump_init(struct ifnet *ifp, int *nrxr, int *
 }
 
 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;
@@ -6618,7 +6600,7 @@ iflib_netdump_event(struct ifnet *ifp, enum netdump_ev
 }
 
 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;
@@ -6637,7 +6619,7 @@ iflib_netdump_transmit(struct ifnet *ifp, struct mbuf 
 }
 
 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;

Modified: stable/12/sys/net/iflib.h
==============================================================================
--- stable/12/sys/net/iflib.h	Sun Jun 16 14:53:53 2019	(r349109)
+++ stable/12/sys/net/iflib.h	Sun Jun 16 15:11:52 2019	(r349110)
@@ -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;

Modified: stable/12/sys/net/iflib_clone.c
==============================================================================
--- stable/12/sys/net/iflib_clone.c	Sun Jun 16 14:53:53 2019	(r349109)
+++ stable/12/sys/net/iflib_clone.c	Sun Jun 16 15:11:52 2019	(r349110)
@@ -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, cad
 }
 
 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906161511.x5GFBqGo031331>