Index: share/man/man4/bnxt.4 =================================================================== --- share/man/man4/bnxt.4 +++ share/man/man4/bnxt.4 @@ -110,7 +110,7 @@ or through the use of .Xr kenv 1 . These are provided by the -.Xr iflib 9 +.Xr iflib 4 framework, and might be better documented there. .Bl -tag -width indent .It Va dev.bnxt.X.iflib.override_nrxds Index: sys/net/iflib.c =================================================================== --- sys/net/iflib.c +++ sys/net/iflib.c @@ -670,21 +670,14 @@ static int iflib_task_fn_rxs; static int iflib_rx_intr_enables; static int iflib_fast_intrs; -static int iflib_intr_link; -static int iflib_intr_msix; static int iflib_rx_unavail; static int iflib_rx_ctx_inactive; -static int iflib_rx_zero_len; static int iflib_rx_if_input; static int iflib_rx_mbuf_null; static int iflib_rxd_flush; static int iflib_verbose_debug; -SYSCTL_INT(_net_iflib, OID_AUTO, intr_link, CTLFLAG_RD, - &iflib_intr_link, 0, "# intr link calls"); -SYSCTL_INT(_net_iflib, OID_AUTO, intr_msix, CTLFLAG_RD, - &iflib_intr_msix, 0, "# intr msix calls"); 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, @@ -695,8 +688,6 @@ &iflib_rx_unavail, 0, "# times rxeof called with no available data"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_ctx_inactive, CTLFLAG_RD, &iflib_rx_ctx_inactive, 0, "# times rxeof called with inactive context"); -SYSCTL_INT(_net_iflib, OID_AUTO, rx_zero_len, CTLFLAG_RD, - &iflib_rx_zero_len, 0, "# times rxeof saw zero len mbuf"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_if_input, CTLFLAG_RD, &iflib_rx_if_input, 0, "# times rxeof called if_input"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_mbuf_null, CTLFLAG_RD, @@ -717,8 +708,8 @@ iflib_encap_load_mbuf_fail = iflib_encap_pad_mbuf_fail = iflib_encap_txq_avail_fail = iflib_encap_txd_encap_fail = iflib_task_fn_rxs = iflib_rx_intr_enables = iflib_fast_intrs = - iflib_intr_link = iflib_intr_msix = iflib_rx_unavail = - iflib_rx_ctx_inactive = iflib_rx_zero_len = iflib_rx_if_input = + iflib_rx_unavail = + iflib_rx_ctx_inactive = iflib_rx_if_input = iflib_rx_mbuf_null = iflib_rxd_flush = 0; } @@ -851,6 +842,8 @@ */ head = nm_prev(head, lim); nic_i = UINT_MAX; + // TODO: Should this increment fl_refills and fl_refills_large? + // If so, it appears that fl_refills and rxd_flush will always have the same value. while (nm_i != head) { for (int tmp_pidx = 0; tmp_pidx < IFLIB_MAX_RX_REFRESH && nm_i != head; tmp_pidx++) { struct netmap_slot *slot = &ring->slot[nm_i]; @@ -898,8 +891,10 @@ if (map) bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - if (__predict_true(nic_i != UINT_MAX)) + if (__predict_true(nic_i != UINT_MAX)) { ctx->isc_rxd_flush(ctx->ifc_softc, rxq->ifr_id, fl->ifl_id, nic_i); + DBG_COUNTER_INC(rxd_flush); + } return (0); } @@ -998,6 +993,7 @@ /* Fill the slot in the NIC ring. */ ctx->isc_txd_encap(ctx->ifc_softc, &pi); + DBG_COUNTER_INC(tx_encap); /* prefetch for next round */ __builtin_prefetch(&ring->slot[nm_i + 1]); @@ -1524,8 +1520,10 @@ cidx = rxq->ifr_fl[0].ifl_cidx; if (iflib_rxd_avail(ctx, rxq, cidx, 1)) GROUPTASK_ENQUEUE(gtask); - else + else { IFDI_RX_QUEUE_INTR_ENABLE(ctx, rxq->ifr_id); + DBG_COUNTER_INC(rx_intr_enables); + } return (FILTER_HANDLED); } @@ -2887,6 +2885,7 @@ return (ENOMEM); } else { m_freem(*mp); + DBG_COUNTER_INC(tx_frees); *mp = m; } } @@ -2994,6 +2993,7 @@ pi->ipi_ip_hlen = sizeof(struct ip6_hdr); if (__predict_false(m->m_len < pi->ipi_ehdrlen + sizeof(struct ip6_hdr))) { + txq->ift_pullups++; if (__predict_false((m = m_pullup(m, pi->ipi_ehdrlen + sizeof(struct ip6_hdr))) == NULL)) return (ENOMEM); } @@ -3042,7 +3042,7 @@ } static __noinline struct mbuf * -collapse_pkthdr(struct mbuf *m0) +collapse_pkthdr(struct mbuf *m0, iflib_txq_t txq) { struct mbuf *m, *m_next, *tmp; @@ -3059,6 +3059,7 @@ if (m_next == NULL) return (m); if ((m_next->m_flags & M_EXT) == 0) { + txq->ift_mbuf_defrag++; m = m_defrag(m, M_NOWAIT); } else { tmp = m_next->m_next; @@ -3118,7 +3119,7 @@ * Please don't ever do this */ if (__predict_false(m->m_len == 0)) - *m0 = collapse_pkthdr(m); + *m0 = collapse_pkthdr(m, txq); ctx = txq->ift_ctx; sctx = ctx->ifc_sctx; @@ -3259,6 +3260,7 @@ m_freem(*m_head); device_printf(dev, "cannot pad short frame, m_dup() failed"); DBG_COUNTER_INC(encap_pad_mbuf_fail); + DBG_COUNTER_INC(tx_frees); return ENOMEM; } m_freem(*m_head); @@ -3274,6 +3276,7 @@ m_freem(*m_head); device_printf(dev, "cannot pad short frame\n"); DBG_COUNTER_INC(encap_pad_mbuf_fail); + DBG_COUNTER_INC(tx_frees); return (ENOBUFS); } @@ -3370,12 +3373,13 @@ if (m_head == NULL) remap++; } - if (remap == 1) + if (remap == 1) { + txq->ift_mbuf_defrag++; m_head = m_defrag(*m_headp, M_NOWAIT); + } remap++; if (__predict_false(m_head == NULL)) goto defrag_failed; - txq->ift_mbuf_defrag++; *m_headp = m_head; goto retry; break; @@ -3472,6 +3476,8 @@ return (err); defrag_failed: + // XXX Do we really not want to DBG_COUNTER_INC(encap_txd_encap_fail) here? + // If we do, that makes txq_drain_encapfail redundant. If we don't, it's pretty weird isn't it? txq->ift_mbuf_defrag_failed++; txq->ift_map_failed++; m_freem(*m_headp); @@ -3680,7 +3686,6 @@ if (err == ENOBUFS) break; consumed++; - DBG_COUNTER_INC(txq_drain_encapfail); /* we can't send this packet - skip it */ continue; } @@ -3740,6 +3745,7 @@ if (__predict_false(*mp == (struct mbuf *)txq)) continue; m_freem(*mp); + DBG_COUNTER_INC(tx_frees); } MPASS(ifmp_ring_is_stalled(r) == 0); return (avail); @@ -3986,6 +3992,7 @@ next = m->m_nextpkt; m->m_nextpkt = NULL; m_freem(m); + DBG_COUNTER_INC(tx_frees); m = next; } return (ENOBUFS); @@ -4028,6 +4035,7 @@ #endif ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); m_freem(m); + DBG_COUNTER_INC(tx_frees); } return (err);