diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c --- a/sys/dev/axgbe/if_axgbe_pci.c +++ b/sys/dev/axgbe/if_axgbe_pci.c @@ -2405,7 +2405,6 @@ axgbe_if_get_counter(if_ctx_t ctx, ift_counter cnt) { struct axgbe_if_softc *sc = iflib_get_softc(ctx); - if_t ifp = iflib_get_ifp(ctx); struct xgbe_prv_data *pdata = &sc->pdata; struct xgbe_mmc_stats *pstats = &pdata->mmc_stats; @@ -2426,7 +2425,7 @@ case IFCOUNTER_OBYTES: return (pstats->txoctetcount_gb); default: - return (if_get_counter_default(ifp, cnt)); + return (iflib_if_get_counter_default(ctx, cnt)); } } diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -314,7 +314,7 @@ DEVMETHOD(ifdi_media_status, bnxt_media_status), DEVMETHOD(ifdi_media_change, bnxt_media_change), DEVMETHOD(ifdi_promisc_set, bnxt_promisc_set), - DEVMETHOD(ifdi_get_counter, bnxt_get_counter), + DEVMETHOD(ifdi_get_counter, iflib_if_get_counter_default), DEVMETHOD(ifdi_update_admin_status, bnxt_update_admin_status), DEVMETHOD(ifdi_timer, bnxt_if_timer), @@ -3219,17 +3219,6 @@ return rc; } -static uint64_t -bnxt_get_counter(if_ctx_t ctx, ift_counter cnt) -{ - if_t ifp = iflib_get_ifp(ctx); - - if (cnt < IFCOUNTERS) - return if_get_counter_default(ifp, cnt); - - return 0; -} - static void bnxt_update_admin_status(if_ctx_t ctx) { diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -4350,7 +4350,6 @@ em_if_get_counter(if_ctx_t ctx, ift_counter cnt) { struct e1000_softc *sc = iflib_get_softc(ctx); - if_t ifp = iflib_get_ifp(ctx); switch (cnt) { case IFCOUNTER_COLLISIONS: @@ -4364,7 +4363,7 @@ return (sc->stats.ecol + sc->stats.latecol + sc->watchdog_events); default: - return (if_get_counter_default(ifp, cnt)); + return (iflib_if_get_counter_default(ctx, cnt)); } } diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c --- a/sys/dev/enetc/if_enetc.c +++ b/sys/dev/enetc/if_enetc.c @@ -1335,10 +1335,8 @@ enetc_get_counter(if_ctx_t ctx, ift_counter cnt) { struct enetc_softc *sc; - if_t ifp; sc = iflib_get_softc(ctx); - ifp = iflib_get_ifp(ctx); switch (cnt) { case IFCOUNTER_IERRORS: @@ -1346,7 +1344,7 @@ case IFCOUNTER_OERRORS: return (ENETC_PORT_RD8(sc, ENETC_PM0_TERR)); default: - return (if_get_counter_default(ifp, cnt)); + return (iflib_if_get_counter_default(ctx, cnt)); } } diff --git a/sys/dev/enic/if_enic.c b/sys/dev/enic/if_enic.c --- a/sys/dev/enic/if_enic.c +++ b/sys/dev/enic/if_enic.c @@ -88,7 +88,6 @@ static void enic_media_status(if_ctx_t, struct ifmediareq *); static int enic_media_change(if_ctx_t); static int enic_promisc_set(if_ctx_t, int); -static uint64_t enic_get_counter(if_ctx_t, ift_counter); static void enic_update_admin_status(if_ctx_t); static void enic_txq_timer(if_ctx_t, uint16_t); static int enic_link_is_up(struct enic_softc *); @@ -165,7 +164,7 @@ DEVMETHOD(ifdi_media_status, enic_media_status), DEVMETHOD(ifdi_media_change, enic_media_change), DEVMETHOD(ifdi_promisc_set, enic_promisc_set), - DEVMETHOD(ifdi_get_counter, enic_get_counter), + DEVMETHOD(ifdi_get_counter, iflib_if_get_counter_default), DEVMETHOD(ifdi_update_admin_status, enic_update_admin_status), DEVMETHOD(ifdi_timer, enic_txq_timer), @@ -1012,16 +1011,6 @@ return (0); } -static uint64_t -enic_get_counter(if_ctx_t ctx, ift_counter cnt) { - if_t ifp = iflib_get_ifp(ctx); - - if (cnt < IFCOUNTERS) - return if_get_counter_default(ifp, cnt); - - return (0); -} - static void enic_update_admin_status(if_ctx_t ctx) { diff --git a/sys/dev/iavf/if_iavf_iflib.c b/sys/dev/iavf/if_iavf_iflib.c --- a/sys/dev/iavf/if_iavf_iflib.c +++ b/sys/dev/iavf/if_iavf_iflib.c @@ -1491,7 +1491,7 @@ case IFCOUNTER_IQDROPS: return (vsi->iqdrops); case IFCOUNTER_OQDROPS: - return (vsi->oqdrops); + return (vsi->oqdrops + iflib_if_get_counter_default(ctx, cnt)); case IFCOUNTER_NOPROTO: return (vsi->noproto); default: diff --git a/sys/dev/ice/ice_lib.c b/sys/dev/ice/ice_lib.c --- a/sys/dev/ice/ice_lib.c +++ b/sys/dev/ice/ice_lib.c @@ -7649,7 +7649,8 @@ case IFCOUNTER_IQDROPS: return (es->rx_discards); case IFCOUNTER_OQDROPS: - return (hs->tx_dropped_link_down); + return (hs->tx_dropped_link_down + + iflib_if_get_counter_default(vsi->sc->ctx, counter)); case IFCOUNTER_NOPROTO: return (es->rx_unknown_protocol); default: diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -2371,7 +2371,6 @@ igc_if_get_counter(if_ctx_t ctx, ift_counter cnt) { struct igc_adapter *adapter = iflib_get_softc(ctx); - if_t ifp = iflib_get_ifp(ctx); switch (cnt) { case IFCOUNTER_COLLISIONS: @@ -2385,7 +2384,7 @@ return (adapter->stats.ecol + adapter->stats.latecol + adapter->watchdog_events); default: - return (if_get_counter_default(ifp, cnt)); + return (iflib_if_get_counter_default(ctx, cnt)); } } diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -1205,7 +1205,6 @@ ixgbe_if_get_counter(if_ctx_t ctx, ift_counter cnt) { struct ixgbe_softc *sc = iflib_get_softc(ctx); - if_t ifp = iflib_get_ifp(ctx); switch (cnt) { case IFCOUNTER_IPACKETS: @@ -1224,12 +1223,10 @@ return (0); case IFCOUNTER_IQDROPS: return (sc->iqdrops); - case IFCOUNTER_OQDROPS: - return (0); case IFCOUNTER_IERRORS: return (sc->ierrors); default: - return (if_get_counter_default(ifp, cnt)); + return (iflib_if_get_counter_default(ctx, cnt)); } } /* ixgbe_if_get_counter */ diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -1175,7 +1175,6 @@ ixv_if_get_counter(if_ctx_t ctx, ift_counter cnt) { struct ixgbe_softc *sc = iflib_get_softc(ctx); - if_t ifp = iflib_get_ifp(ctx); switch (cnt) { case IFCOUNTER_IPACKETS: @@ -1189,7 +1188,7 @@ case IFCOUNTER_IMCASTS: return (sc->imcasts); default: - return (if_get_counter_default(ifp, cnt)); + return (iflib_if_get_counter_default(ctx, cnt)); } } /* ixv_if_get_counter */ diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -1791,7 +1791,7 @@ case IFCOUNTER_IQDROPS: return (vsi->iqdrops); case IFCOUNTER_OQDROPS: - return (vsi->oqdrops); + return (vsi->oqdrops + iflib_if_get_counter_default(ctx, cnt)); case IFCOUNTER_NOPROTO: return (vsi->noproto); default: diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -141,7 +141,6 @@ static void vmxnet3_media_status(if_ctx_t, struct ifmediareq *); static int vmxnet3_media_change(if_ctx_t); static int vmxnet3_promisc_set(if_ctx_t, int); -static uint64_t vmxnet3_get_counter(if_ctx_t, ift_counter); static void vmxnet3_update_admin_status(if_ctx_t); static void vmxnet3_txq_timer(if_ctx_t, uint16_t); @@ -230,7 +229,7 @@ DEVMETHOD(ifdi_media_status, vmxnet3_media_status), DEVMETHOD(ifdi_media_change, vmxnet3_media_change), DEVMETHOD(ifdi_promisc_set, vmxnet3_promisc_set), - DEVMETHOD(ifdi_get_counter, vmxnet3_get_counter), + DEVMETHOD(ifdi_get_counter, iflib_if_get_counter_default), DEVMETHOD(ifdi_update_admin_status, vmxnet3_update_admin_status), DEVMETHOD(ifdi_timer, vmxnet3_txq_timer), @@ -2039,17 +2038,6 @@ return (0); } -static uint64_t -vmxnet3_get_counter(if_ctx_t ctx, ift_counter cnt) -{ - if_t ifp = iflib_get_ifp(ctx); - - if (cnt < IFCOUNTERS) - return if_get_counter_default(ifp, cnt); - - return (0); -} - static void vmxnet3_update_admin_status(if_ctx_t ctx) {