kernel - Revamp ifsq_watchdog*() a bit
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 1 Sep 2020 18:06:23 +0000 (11:06 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 1 Sep 2020 18:06:23 +0000 (11:06 -0700)
commite2292763210b551b05c63fd27fe614dedee1c0de
treedec23d72def2e828ed4323805f96f73920fef91c
parenteb227e4ddb9d197830d265e31dde59859ff2a27f
kernel - Revamp ifsq_watchdog*() a bit

* Add a flags argument to ifsq_watchdog_init() and implement two
  flags:

  IF_WDOG_ALLTICKS Watchdog callback occurs each second
prior to terminal count, and on terminal
count.

  IF_WDOG_LASTTICK Watchdog callback occurs one second prior
to terminal count, and on terminal count.

  0 Watchdog callback only occurs on terminal
count.

  Note that the ifnet lock is fully serialized when a watchdog
  callback is made, so generally speaking to avoid hicups you
  only want to use IF_WDOG_LASTTICK.

* This feature allows the watchdog code to flush any tx buffers
  (call *_txeof()) that have completed transmission.  Many NICs
  and virtual NICs don't bother to generate interrupts to clean-up
  such buffers when the rings are only lightly loaded.

* Fix spurious vtnet watchdog events on lightly loaded vtnet
  interfaces, loosly using the same code that FreeBSD uses
  (just txeof from the second-prior watchdog callback and then
  check on terminal count).
sys/dev/netif/bce/if_bce.c
sys/dev/netif/bnx/if_bnx.c
sys/dev/netif/emx/if_emx.c
sys/dev/netif/igb/if_igb.c
sys/dev/netif/ix/if_ix.c
sys/dev/netif/mxge/if_mxge.c
sys/dev/virtual/virtio/net/if_vtnet.c
sys/net/if.c
sys/net/if_var.h
sys/net/ifq_var.h