freebsd-dev/sys/net
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
..
altq net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
route Refactor rt_addrmsg() and rt_routemsg(). 2021-01-07 19:38:19 +00:00
bpf_buffer.c Add an external mbuf buffer type that holds multiple unmapped pages. 2019-06-29 00:48:33 +00:00
bpf_buffer.h
bpf_filter.c
bpf_jitter.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
bpf_jitter.h
bpf_zerocopy.c Change synchonization rules for vm_page reference counting. 2019-09-09 21:32:42 +00:00
bpf_zerocopy.h
bpf.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
bpf.h
bpfdesc.h
bridgestp.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
bridgestp.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
debugnet_inet.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
debugnet_int.h Implement NetGDB(4) 2019-10-17 21:33:01 +00:00
debugnet.c Convert debugnet to the new routing KPI. 2020-04-26 18:42:38 +00:00
debugnet.h Implement NetGDB(4) 2019-10-17 21:33:01 +00:00
dlt.h MFV r353141 (by phillip): 2019-12-21 21:01:03 +00:00
ethernet.h net: add ETHER_IS_IPV6_MULTICAST 2020-10-30 13:32:58 +00:00
firewire.h
ieee8023ad_lacp.c LACP: When suppressing distributing, return ENOBUFS 2020-11-18 14:55:49 +00:00
ieee8023ad_lacp.h LACP: When suppressing distributing, return ENOBUFS 2020-11-18 14:55:49 +00:00
ieee_oui.h Fix a typo in r349969 2019-07-14 03:49:48 +00:00
if_arp.h
if_bridge.c bridge: call member interface ioctl() without NET_EPOCH 2020-10-06 19:19:56 +00:00
if_bridgevar.h libifconfig: Add function to get bridge status 2020-07-01 02:32:41 +00:00
if_clone.c Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q). 2020-10-21 21:28:20 +00:00
if_clone.h epair: Do not abuse params to register the second interface 2020-01-28 22:44:24 +00:00
if_dead.c This adds the third step in getting BBR into the tree. BBR and 2019-08-01 14:17:31 +00:00
if_debug.c
if_disc.c
if_dl.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_edsc.c if_edsc: generate an arbitrary MAC address 2020-03-02 02:45:57 +00:00
if_enc.c Consistently include opt_ipsec.h for consumers of <netipsec/ipsec.h>. 2020-05-29 19:22:40 +00:00
if_enc.h
if_epair.c net: Revert vnet/epair cleanup race mitigation 2020-12-01 16:34:43 +00:00
if_ethersubr.c Remove not needed variable initialization. 2020-12-23 12:04:46 +01:00
if_fwsubr.c
if_gif.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_gif.h gif_transmit() must always be called in the network epoch. 2020-01-15 06:18:32 +00:00
if_gre.c Add if_reassing method to all tunneling interfaces. 2020-06-03 13:02:31 +00:00
if_gre.h
if_infiniband.c Streamline the infiniband code according to the ethernet code. 2020-12-31 10:07:02 +01:00
if_ipsec.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_ipsec.h
if_lagg.c Fix for IPoIB over lagg(4). 2020-12-29 17:35:06 +01:00
if_lagg.h Fix for IPoIB over lagg(4). 2020-12-29 17:35:06 +01:00
if_llatbl.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_llatbl.h Implement optional table entry limits for if_llatbl. 2020-03-04 17:17:02 +00:00
if_llc.h
if_loop.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_me.c Add if_reassing method to all tunneling interfaces. 2020-06-03 13:02:31 +00:00
if_media.c if_media.c SIOCGMEDIAX handler: improve loop 2020-11-03 14:33:04 +00:00
if_media.h if_media: definitions for 40GE LM4 ethernet media type 2020-09-16 14:45:16 +00:00
if_mib.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_mib.h
if_pflog.h
if_pfsync.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_sppp.h
if_spppfr.c
if_spppsubr.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_stf.c Complete conversions from fib<4|6>_lookup_nh_<basic|ext> to fib<4|6>_lookup(). 2020-07-02 21:04:08 +00:00
if_tap.h tap: add support for virtio-net offloads 2019-10-18 21:53:27 +00:00
if_tun.h if_tuntap(4): Add TUNGIFNAME 2019-07-25 22:23:34 +00:00
if_tuntap.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_types.h Add support for IP over infiniband, IPoIB, to lagg(4). Currently only 2020-10-22 09:47:12 +00:00
if_var.h if: Remove ifnet_rwlock 2020-11-25 10:56:38 +00:00
if_vlan_var.h Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q). 2020-10-21 21:28:20 +00:00
if_vlan.c Add m_snd_tag_alloc() as a wrapper around if_snd_tag_alloc(). 2020-10-29 23:28:39 +00:00
if_vxlan.c vxlan: stop checking CSUM_ENCAP_VXLAN when converting inner CSUM flags into normal, for decapsulation. 2020-12-23 10:54:06 +02:00
if_vxlan.h if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS. 2020-09-18 02:37:57 +00:00
if.c net: Revert vnet/epair cleanup race mitigation 2020-12-01 16:34:43 +00:00
if.h style(9): Correct whitespace in struct definitions 2020-12-11 01:00:07 +00:00
ifdi_if.m iflib: Stop interface before (un)registering VLAN 2020-04-27 22:02:44 +00:00
iflib_clone.c Import kernel WireGuard support 2020-11-29 19:38:03 +00:00
iflib_private.h - Replace unused and only ever written to members of public iflib(9) 2019-06-15 11:07:41 +00:00
iflib.c iflib: ensure that tx interrupts enabled and cleanups 2021-01-07 14:07:35 -08:00
iflib.h iflib: ensure that tx interrupts enabled and cleanups 2021-01-07 14:07:35 -08:00
ifq.h Make net/ifq.h C++ friendly 2020-11-20 14:45:45 +00:00
infiniband.h Factor out generic IP over infiniband, IPoIB, definitions and code 2020-10-22 09:09:53 +00:00
mp_ring.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
mp_ring.h
mppc.h
mppcc.c kernel: provide panicky version of __unreachable 2020-05-13 18:07:37 +00:00
mppcd.c
netisr_internal.h
netisr.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
netisr.h
netmap_legacy.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
netmap_user.h netmap: fix constness warnings generated by "-Wcast-qual" 2020-10-03 09:33:29 +00:00
netmap_virt.h netmap: disable passthrough with no hypervisor support 2020-01-13 21:47:23 +00:00
netmap.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
paravirt.h
pfil.c Since now drivers that support pfil run their interrupts in the network 2020-01-23 01:49:22 +00:00
pfil.h
pfkeyv2.h Add SADB_SAFLAGS_ESN flag 2020-10-16 11:22:29 +00:00
pfvar.h pf: Convert pfi_kkif to use counter_u64 2021-01-05 23:35:37 +01:00
ppp_defs.h
radix.c Fix definition of rn_addmask() 2020-11-08 19:02:22 +00:00
radix.h
raw_cb.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
raw_cb.h
raw_usrreq.c
rndis.h
route.c Refactor rt_addrmsg() and rt_routemsg(). 2021-01-07 19:38:19 +00:00
route.h Refactor rt_addrmsg() and rt_routemsg(). 2021-01-07 19:38:19 +00:00
rss_config.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
rss_config.h
rtsock.c Refactor rt_addrmsg() and rt_routemsg(). 2021-01-07 19:38:19 +00:00
sff8436.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sff8472.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
slcompress.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
slcompress.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
toeplitz.c
toeplitz.h
vnet.c Partially revert VNET change and expand VNET structure. 2020-02-17 11:08:50 +00:00
vnet.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00