freebsd-nq/sys/dev/ice
Matt Macy 81be655266 iflib: ensure that tx interrupts enabled and cleanups
Doing a 'dd' over iscsi will reliably cause stalls. Tx
cleaning _should_ reliably happen as data is sent.
However, currently if the transmit queue fills it will
wait until the iflib timer (hz/2) runs.

This change causes the the tx taskq thread to be run
if there are completed descriptors.

While here:

- make timer interrupt delay a sysctl

- simplify txd_db_check handling

- comment on INTR types

Background on the change:

Initially doorbell updates were minimized by only writing to the register
on every fourth packet. If txq_drain would return without writing to the
doorbell it scheduled a callout on the next tick to do the doorbell write
to ensure that the write otherwise happened "soon". At that time a sysctl
was added for users to avoid the potential added latency by simply writing
to the doorbell register on every packet. This worked perfectly well for
e1000 and ixgbe ... and appeared to work well on ixl. However, as it
turned out there was a race to this approach that would lockup the ixl MAC.
It was possible for a lower producer index to be written after a higher one.
On e1000 and ixgbe this was harmless - on ixl it was fatal. My initial
response was to add a lock around doorbell writes - fixing the problem but
adding an unacceptable amount of lock contention.

The next iteration was to use transmit interrupts to drive delayed doorbell
writes. If there were no packets in the queue all doorbell writes would be
immediate as the queue started to fill up we could delay doorbell writes
further and further. At the start of drain if we've cleaned any packets we
know we've moved the state machine along and we write the doorbell (an
obvious missing optimization was to skip that doorbell write if db_pending
is zero). This change required that tx interrupts be scheduled periodically
as opposed to just when the hardware txq was full. However, that just leads
to our next problem.

Initially dedicated msix vectors were used for both tx and rx. However, it
was often possible to use up all available vectors before we set up all the
queues we wanted. By having rx and tx share a vector for a given queue we
could halve the number of vectors used by a given configuration. The problem
here is that with this change only e1000 passed the necessary value to have
the fast interrupt drive tx when appropriate.

Reported by: mav@
Tested by: mav@
Reviewed by:    gallatin@
MFC after:      1 month
Sponsored by:   iXsystems
Differential Revision:  https://reviews.freebsd.org/D27683
2021-01-07 14:07:35 -08:00
..
ice_adminq_cmd.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_alloc.h
ice_bitops.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_common_sysctls.h
ice_common_txrx.h
ice_common.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_common.h ice: quiet -Wredundant-decls 2020-12-17 22:53:45 +00:00
ice_controlq.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_controlq.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_dcb.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_dcb.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_devids.h
ice_drv_info.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_features.h
ice_flex_pipe.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_flex_pipe.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_flex_type.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_flow.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_flow.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_hw_autogen.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_iflib_recovery_txrx.c
ice_iflib_sysctls.h
ice_iflib_txrx.c
ice_iflib.h
ice_lan_tx_rx.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_lib.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_lib.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_nvm.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_nvm.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_opts.h
ice_osdep.c
ice_osdep.h
ice_protocol_type.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_resmgr.c
ice_resmgr.h
ice_rss.h
ice_sbq_cmd.h
ice_sched.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_sched.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_sriov.c
ice_sriov.h
ice_status.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_strings.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_switch.c ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_switch.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
ice_type.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
if_ice_iflib.c iflib: ensure that tx interrupts enabled and cleanups 2021-01-07 14:07:35 -08:00
virtchnl_inline_ipsec.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00
virtchnl.h ice(4): Update to 0.26.16 2020-09-10 23:46:13 +00:00