With direct dispatch the receive task transmits each forwarded packet from
inside its pass, and on a lightly used ring every packet rings the doorbell.
On an Intel I226 (igc) a doorbell write costs about 400 cycles, a fifth of
forwarding a packet with pf disabled.
Hold the doorbell for the length of the receive pass instead. The pass keeps
a batch on its stack, reached through td_netbatch; the transmit queues it
sends on are claimed by the batch and rung once at the end of the pass, which
covers the LRO flush and tcp_lro_queue_mbuf() inside the receive loop. The
hold is the lowest band of iflib_txd_db_check(): where the policy would ring
for every packet, at most an eighth full, a pass on the calling thread holds
the queue instead; above that the policy is unchanged. Both the mp_ring and
simple transmit paths take part; other transmitters, and the backstops that
must ring a held queue (timer, pass end, completion task), are unchanged.
Off by default until exercised on more drivers; net.iflib.tx_db_batched=1 in
loader.conf turns it on.
iflib_device_deregister() now waits for the network epoch after iflib_stop():
if_detach() waits before it replaces the methods, so a receive task on another
interface can still be in iflib_if_transmit() when the queues are freed, and
a pass can hold one of them until it ends.
mlx5en has held its send queues' doorbells across receive processing since
2d5e5a0d75b0.
Sponsored by: Rubicon Communications, LLC ("Netgate")