diff --git a/FreeBSD/sys/dev/axgbe/if_axgbe_pci.c b/FreeBSD/sys/dev/axgbe/if_axgbe_pci.c --- a/FreeBSD/sys/dev/axgbe/if_axgbe_pci.c +++ b/FreeBSD/sys/dev/axgbe/if_axgbe_pci.c @@ -2416,6 +2416,8 @@ return (pstats->txframecount_gb); case IFCOUNTER_OERRORS: return (pstats->txframecount_gb - pstats->txframecount_g); + case IFCOUNTER_OQDROPS: + return (0); case IFCOUNTER_IBYTES: return (pstats->rxoctetcount_gb); case IFCOUNTER_OBYTES: diff --git a/FreeBSD/sys/dev/bnxt/bnxt_en/if_bnxt.c b/FreeBSD/sys/dev/bnxt/bnxt_en/if_bnxt.c --- a/FreeBSD/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/FreeBSD/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -3605,7 +3605,8 @@ { if_t ifp = iflib_get_ifp(ctx); - if (cnt < IFCOUNTERS) + if (cnt < IFCOUNTERS && cnt != IFCOUNTER_OQDROPS && + cnt != IFCOUNTER_OERRORS) return if_get_counter_default(ifp, cnt); return 0; diff --git a/FreeBSD/sys/dev/e1000/if_em.c b/FreeBSD/sys/dev/e1000/if_em.c --- a/FreeBSD/sys/dev/e1000/if_em.c +++ b/FreeBSD/sys/dev/e1000/if_em.c @@ -4818,6 +4818,8 @@ case IFCOUNTER_OERRORS: return (sc->stats.ecol + sc->stats.latecol + sc->watchdog_events); + case IFCOUNTER_OQDROPS: + return (0); default: return (if_get_counter_default(ifp, cnt)); } diff --git a/FreeBSD/sys/dev/enetc/if_enetc.c b/FreeBSD/sys/dev/enetc/if_enetc.c --- a/FreeBSD/sys/dev/enetc/if_enetc.c +++ b/FreeBSD/sys/dev/enetc/if_enetc.c @@ -1344,6 +1344,8 @@ return (ENETC_PORT_RD8(sc, ENETC_PM0_RERR)); case IFCOUNTER_OERRORS: return (ENETC_PORT_RD8(sc, ENETC_PM0_TERR)); + case IFCOUNTER_OQDROPS: + return (0); default: return (if_get_counter_default(ifp, cnt)); } diff --git a/FreeBSD/sys/dev/enic/if_enic.c b/FreeBSD/sys/dev/enic/if_enic.c --- a/FreeBSD/sys/dev/enic/if_enic.c +++ b/FreeBSD/sys/dev/enic/if_enic.c @@ -1151,7 +1151,8 @@ enic_get_counter(if_ctx_t ctx, ift_counter cnt) { if_t ifp = iflib_get_ifp(ctx); - if (cnt < IFCOUNTERS) + if (cnt < IFCOUNTERS && cnt != IFCOUNTER_OQDROPS && + cnt != IFCOUNTER_OERRORS) return if_get_counter_default(ifp, cnt); return (0); diff --git a/FreeBSD/sys/dev/igc/if_igc.c b/FreeBSD/sys/dev/igc/if_igc.c --- a/FreeBSD/sys/dev/igc/if_igc.c +++ b/FreeBSD/sys/dev/igc/if_igc.c @@ -2601,6 +2601,8 @@ case IFCOUNTER_OERRORS: return (sc->stats.ecol + sc->stats.latecol + sc->watchdog_events); + case IFCOUNTER_OQDROPS: + return (0); default: return (if_get_counter_default(ifp, cnt)); } diff --git a/FreeBSD/sys/dev/ixgbe/if_ix.c b/FreeBSD/sys/dev/ixgbe/if_ix.c --- a/FreeBSD/sys/dev/ixgbe/if_ix.c +++ b/FreeBSD/sys/dev/ixgbe/if_ix.c @@ -1299,6 +1299,7 @@ return (0); case IFCOUNTER_IQDROPS: return (sc->iqdrops); + case IFCOUNTER_OERRORS: case IFCOUNTER_OQDROPS: return (0); case IFCOUNTER_IERRORS: diff --git a/FreeBSD/sys/dev/ixgbe/if_ixv.c b/FreeBSD/sys/dev/ixgbe/if_ixv.c --- a/FreeBSD/sys/dev/ixgbe/if_ixv.c +++ b/FreeBSD/sys/dev/ixgbe/if_ixv.c @@ -1205,6 +1205,9 @@ return (sc->obytes); case IFCOUNTER_IMCASTS: return (sc->imcasts); + case IFCOUNTER_OERRORS: + case IFCOUNTER_OQDROPS: + return (0); default: return (if_get_counter_default(ifp, cnt)); } diff --git a/FreeBSD/sys/dev/vmware/vmxnet3/if_vmx.c b/FreeBSD/sys/dev/vmware/vmxnet3/if_vmx.c --- a/FreeBSD/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/FreeBSD/sys/dev/vmware/vmxnet3/if_vmx.c @@ -2044,7 +2044,8 @@ { if_t ifp = iflib_get_ifp(ctx); - if (cnt < IFCOUNTERS) + if (cnt < IFCOUNTERS && cnt != IFCOUNTER_OQDROPS && + cnt != IFCOUNTER_OERRORS) return if_get_counter_default(ifp, cnt); return (0); diff --git a/FreeBSD/sys/net/iflib.c b/FreeBSD/sys/net/iflib.c --- a/FreeBSD/sys/net/iflib.c +++ b/FreeBSD/sys/net/iflib.c @@ -3666,6 +3666,12 @@ bus_dmamap_unload(buf_tag, map); DBG_COUNTER_INC(encap_txq_avail_fail); DBG_COUNTER_INC(encap_txd_encap_fail); + if (ctx->ifc_sysctl_simple_tx) { + *m_headp = m_head = iflib_remove_mbuf(txq); + m_freem(*m_headp); + DBG_COUNTER_INC(tx_frees); + *m_headp = NULL; + } if ((txq->ift_task.gt_task.ta_flags & TASK_ENQUEUED) == 0) GROUPTASK_ENQUEUE(&txq->ift_task); return (ENOBUFS); @@ -4319,6 +4325,10 @@ ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); m_freem(m); DBG_COUNTER_INC(tx_frees); + if (err == ENOBUFS) + if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1); + else + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } return (err); @@ -4589,9 +4599,19 @@ static uint64_t iflib_if_get_counter(if_t ifp, ift_counter cnt) { + uint64_t rv; if_ctx_t ctx = if_getsoftc(ifp); - return (IFDI_GET_COUNTER(ctx, cnt)); + rv = IFDI_GET_COUNTER(ctx, cnt); + switch (cnt) { + case IFCOUNTER_OQDROPS: + case IFCOUNTER_OERRORS: + rv += if_get_counter_default(ifp, cnt); + break; + default: + break; + } + return (rv); } /********************************************************************* @@ -7173,6 +7193,11 @@ bytes_sent += m->m_pkthdr.len; mcast_sent += !!(m->m_flags & M_MCAST); (void)iflib_txd_db_check(txq, true); + } else { + if (error == ENOBUFS) + if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1); + else + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } (void)iflib_completed_tx_reclaim(txq, RECLAIM_THRESH(ctx)); mtx_unlock(&txq->ift_mtx);