Date: Sat, 08 Aug 2026 10:01:31 +0000 From: Kevin Bowling <kbowling@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d6f97c6bbca6 - main - iflib: Add sysctl stat for TX watchdog reset events Message-ID: <6a76fe7b.22f36.708979b3@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=d6f97c6bbca689f00d5edcfd9c8f31b0910edbaf commit d6f97c6bbca689f00d5edcfd9c8f31b0910edbaf Author: Kevin Bowling <kbowling@FreeBSD.org> AuthorDate: 2026-08-08 07:50:08 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2026-08-08 10:01:24 +0000 iflib: Add sysctl stat for TX watchdog reset events iflib counts resets initiated by its transmit watchdog in 69c3e0de01c1. Export the counter in the per-device iflib sysctl tree so every driver provides the diagnostic without a driver callback or duplicate storage. A watchdog reset does not establish how many packets failed. It can recover a hardware stall involving several queued packets or a missed completion involving no packet loss. Stop adding one output error per watchdog event in em(4), igb(4), and igc(4). Remove the redundant driver counters and move the diagnostic to dev.<driver>.<unit>.iflib.tx_watchdog_events. MFC after: 1 month Relnotes: yes --- share/man/man4/iflib.4 | 7 ++++++- share/man/man9/iflibdi.9 | 6 +++--- sys/dev/e1000/if_em.c | 24 +----------------------- sys/dev/e1000/if_em.h | 1 - sys/dev/igc/if_igc.c | 19 +------------------ sys/dev/igc/if_igc.h | 2 -- sys/dev/ixgbe/if_ix.c | 2 -- sys/dev/ixgbe/if_ixv.c | 2 -- sys/dev/ixgbe/ixgbe.h | 1 - sys/net/iflib.c | 7 +++++-- 10 files changed, 16 insertions(+), 55 deletions(-) diff --git a/share/man/man4/iflib.4 b/share/man/man4/iflib.4 index b7e09de40875..9ddba8933ed8 100644 --- a/share/man/man4/iflib.4 +++ b/share/man/man4/iflib.4 @@ -1,4 +1,4 @@ -.Dd August 4, 2026 +.Dd August 8, 2026 .Dt IFLIB 4 .Os .Sh NAME @@ -145,6 +145,11 @@ variables are read-only: .Bl -tag -width indent .It Va driver_version A string indicating the internal version of the driver. +.It Va tx_watchdog_events +Number of transmit watchdog resets initiated by +.Nm . +This counts recovery events, not failed packets, and is not included in the +interface output error counter. .El .Pp There are a number of queue state diff --git a/share/man/man9/iflibdi.9 b/share/man/man9/iflibdi.9 index 57fa02c60b25..b148f74c560b 100644 --- a/share/man/man9/iflibdi.9 +++ b/share/man/man9/iflibdi.9 @@ -1,4 +1,4 @@ -.Dd May 21, 2019 +.Dd August 8, 2026 .Dt IFLIBDI 9 .Os .Sh NAME @@ -148,8 +148,8 @@ Its possible values are either active or inactive. .Pq Vt "eventhandler_tag" .It Va ifc_pause_frames .Pq Vt "int" -.It Va ifc_watchdog_events -.Pq Vt "int" +.It Va ifc_tx_watchdog_events +.Pq Vt "uint32_t" .It Va ifc_mac .Pq Vt "uint8_t" .It Va ifc_msix_mem diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 361d44168623..6ef36eb579b6 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -431,7 +431,6 @@ static int em_if_mtu_set(if_ctx_t, uint32_t); static void em_if_timer(if_ctx_t, uint16_t); static void em_if_vlan_register(if_ctx_t, u16); static void em_if_vlan_unregister(if_ctx_t, u16); -static void em_if_watchdog_reset(if_ctx_t); static bool em_if_needs_restart(if_ctx_t, enum iflib_restart_event); static void em_identify_hardware(if_ctx_t); @@ -617,7 +616,6 @@ static device_method_t em_if_methods[] = { DEVMETHOD(ifdi_mtu_set, em_if_mtu_set), DEVMETHOD(ifdi_promisc_set, em_if_set_promisc), DEVMETHOD(ifdi_timer, em_if_timer), - DEVMETHOD(ifdi_watchdog_reset, em_if_watchdog_reset), DEVMETHOD(ifdi_vlan_register, em_if_vlan_register), DEVMETHOD(ifdi_vlan_unregister, em_if_vlan_unregister), DEVMETHOD(ifdi_get_counter, em_if_get_counter), @@ -655,7 +653,6 @@ static device_method_t igb_if_methods[] = { DEVMETHOD(ifdi_mtu_set, em_if_mtu_set), DEVMETHOD(ifdi_promisc_set, em_if_set_promisc), DEVMETHOD(ifdi_timer, em_if_timer), - DEVMETHOD(ifdi_watchdog_reset, em_if_watchdog_reset), DEVMETHOD(ifdi_vlan_register, em_if_vlan_register), DEVMETHOD(ifdi_vlan_unregister, em_if_vlan_unregister), DEVMETHOD(ifdi_get_counter, em_if_get_counter), @@ -698,7 +695,6 @@ static device_method_t igbv_if_methods[] = { DEVMETHOD(ifdi_mtu_set, em_if_mtu_set), DEVMETHOD(ifdi_promisc_set, em_if_set_promisc), DEVMETHOD(ifdi_timer, em_if_timer), - DEVMETHOD(ifdi_watchdog_reset, em_if_watchdog_reset), DEVMETHOD(ifdi_vlan_register, em_if_vlan_register), DEVMETHOD(ifdi_vlan_unregister, em_if_vlan_unregister), DEVMETHOD(ifdi_get_counter, em_if_get_counter), @@ -2791,18 +2787,6 @@ em_if_update_admin_status(if_ctx_t ctx) lem_smartspeed(sc); } -static void -em_if_watchdog_reset(if_ctx_t ctx) -{ - struct e1000_softc *sc = iflib_get_softc(ctx); - - /* - * Just count the event; iflib(4) will already trigger a - * sufficient reset of the controller. - */ - sc->watchdog_events++; -} - /********************************************************************* * * This routine disables all traffic on the adapter by issuing a @@ -5579,9 +5563,6 @@ em_if_get_vf_counter(if_ctx_t ctx, ift_counter cnt) switch (cnt) { case IFCOUNTER_IERRORS: return sc->dropped_pkts; - case IFCOUNTER_OERRORS: - return (if_get_counter_default(ifp, cnt) + - sc->watchdog_events); default: return (if_get_counter_default(ifp, cnt)); } @@ -5609,7 +5590,7 @@ em_if_get_counter(if_ctx_t ctx, ift_counter cnt) stats->mpc + stats->cexterr); case IFCOUNTER_OERRORS: return (if_get_counter_default(ifp, cnt) + - stats->ecol + stats->latecol + sc->watchdog_events); + stats->ecol + stats->latecol); default: return (if_get_counter_default(ifp, cnt)); } @@ -5762,9 +5743,6 @@ em_add_hw_stats(struct e1000_softc *sc) SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", CTLFLAG_RD, &sc->rx_overruns, "RX overruns"); - SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_timeouts", - CTLFLAG_RD, &sc->watchdog_events, - "Watchdog timeouts"); if (!sc->vf_ifp) { SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "device_control", CTLTYPE_UINT | CTLFLAG_RD, diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 4204dee4d982..6d3f312715d4 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -640,7 +640,6 @@ struct e1000_softc { unsigned long dropped_pkts; unsigned long link_irq; unsigned long rx_overruns; - unsigned long watchdog_events; u64 rx_csum_good; u64 rx_csum_errors; diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index 0900689e5f01..84012414ec27 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -110,7 +110,6 @@ static int igc_if_mtu_set(if_ctx_t, uint32_t); static void igc_if_timer(if_ctx_t, uint16_t); static void igc_if_vlan_register(if_ctx_t, u16); static void igc_if_vlan_unregister(if_ctx_t, u16); -static void igc_if_watchdog_reset(if_ctx_t); static bool igc_if_needs_restart(if_ctx_t, enum iflib_restart_event); static void igc_identify_hardware(if_ctx_t); @@ -225,7 +224,6 @@ static device_method_t igc_if_methods[] = { DEVMETHOD(ifdi_mtu_set, igc_if_mtu_set), DEVMETHOD(ifdi_promisc_set, igc_if_set_promisc), DEVMETHOD(ifdi_timer, igc_if_timer), - DEVMETHOD(ifdi_watchdog_reset, igc_if_watchdog_reset), DEVMETHOD(ifdi_vlan_register, igc_if_vlan_register), DEVMETHOD(ifdi_vlan_unregister, igc_if_vlan_unregister), DEVMETHOD(ifdi_get_counter, igc_if_get_counter), @@ -1486,18 +1484,6 @@ igc_if_update_admin_status(if_ctx_t ctx) igc_update_stats_counters(sc); } -static void -igc_if_watchdog_reset(if_ctx_t ctx) -{ - struct igc_softc *sc = iflib_get_softc(ctx); - - /* - * Just count the event; iflib(4) will already trigger a - * sufficient reset of the controller. - */ - sc->watchdog_events++; -} - /********************************************************************* * * This routine disables all traffic on the adapter by issuing a @@ -2790,7 +2776,7 @@ igc_if_get_counter(if_ctx_t ctx, ift_counter cnt) sc->stats.mpc); case IFCOUNTER_OERRORS: return (if_get_counter_default(ifp, cnt) + - sc->stats.ecol + sc->stats.latecol + sc->watchdog_events); + sc->stats.ecol + sc->stats.latecol); default: return (if_get_counter_default(ifp, cnt)); } @@ -2891,9 +2877,6 @@ igc_add_hw_stats(struct igc_softc *sc) SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", CTLFLAG_RD, &sc->rx_overruns, "RX overruns"); - SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_timeouts", - CTLFLAG_RD, &sc->watchdog_events, - "Watchdog timeouts"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "device_control", CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, IGC_CTRL, igc_sysctl_reg_handler, "IU", diff --git a/sys/dev/igc/if_igc.h b/sys/dev/igc/if_igc.h index d9834212fee8..57b3fdcb0f13 100644 --- a/sys/dev/igc/if_igc.h +++ b/sys/dev/igc/if_igc.h @@ -414,8 +414,6 @@ struct igc_softc { unsigned long dropped_pkts; unsigned long link_irq; unsigned long rx_overruns; - unsigned long watchdog_events; - struct igc_hw_stats stats; u16 vf_ifp; }; diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 0c40feed48c9..1aa6c039ad74 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -2067,8 +2067,6 @@ ixgbe_add_hw_stats(struct ixgbe_softc *sc) /* Driver Statistics */ SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", CTLFLAG_RD, &sc->dropped_pkts, "Driver dropped packets"); - SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_events", - CTLFLAG_RD, &sc->watchdog_events, "Watchdog timeouts"); SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq", CTLFLAG_RD, &sc->link_irq, "Link MSI-X IRQ Handled"); diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 7fffc5ec00bb..c77e768a2a0b 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -2100,8 +2100,6 @@ ixv_add_stats_sysctls(struct ixgbe_softc *sc) char namebuf[QUEUE_NAME_LEN]; /* Driver Statistics */ - SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_events", - CTLFLAG_RD, &sc->watchdog_events, "Watchdog timeouts"); SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq", CTLFLAG_RD, &sc->link_irq, "Link MSI-X IRQ Handled"); diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 90ce3e470686..7c3f2aee7216 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -491,7 +491,6 @@ struct ixgbe_softc { unsigned long dropped_pkts; unsigned long mbuf_header_failed; unsigned long mbuf_packet_failed; - unsigned long watchdog_events; unsigned long link_irq; union { struct ixgbe_hw_stats pf; diff --git a/sys/net/iflib.c b/sys/net/iflib.c index da26926c8b17..c56f15cc00bc 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -178,7 +178,7 @@ struct iflib_ctx { uint32_t ifc_rx_mbuf_sz; int ifc_link_state; - int ifc_watchdog_events; + uint32_t ifc_tx_watchdog_events; struct cdev *ifc_led_dev; struct resource *ifc_msix_mem; @@ -4212,7 +4212,7 @@ _task_fn_admin(void *context, int pending) if (ctx->ifc_sctx->isc_flags & IFLIB_HAS_ADMINCQ) IFDI_ADMIN_COMPLETION_HANDLE(ctx); if (do_watchdog) { - ctx->ifc_watchdog_events++; + ctx->ifc_tx_watchdog_events++; IFDI_WATCHDOG_RESET(ctx); } IFDI_UPDATE_ADMIN_STATUS(ctx); @@ -6970,6 +6970,9 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx) SYSCTL_ADD_CONST_STRING(&ctx->ifc_sysctl_ctx, oid_list, OID_AUTO, "driver_version", CTLFLAG_RD, ctx->ifc_sctx->isc_driver_version, "driver version"); + SYSCTL_ADD_U32(&ctx->ifc_sysctl_ctx, oid_list, OID_AUTO, + "tx_watchdog_events", CTLFLAG_RD, &ctx->ifc_tx_watchdog_events, 0, + "TX watchdog resets initiated by iflib"); SYSCTL_ADD_BOOL(&ctx->ifc_sysctl_ctx, oid_list, OID_AUTO, "simple_tx", CTLFLAG_RDTUN, &ctx->ifc_sysctl_simple_tx, 0,home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a76fe7b.22f36.708979b3>
