]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
iflib: add per-tx-queue netmap timer
authorVincenzo Maffione <vmaffione@FreeBSD.org>
Tue, 27 Oct 2020 21:53:33 +0000 (21:53 +0000)
committerVincenzo Maffione <vmaffione@FreeBSD.org>
Tue, 27 Oct 2020 21:53:33 +0000 (21:53 +0000)
commit17cec474c0af858a5b913d092bd88c0bfcf73c26
tree1f1d872b935fa378c97fc8087dc502b779cc6e0a
parentde7b5f1c524f99ccd0c94210e09e4676eead17af
iflib: add per-tx-queue netmap timer

The way netmap TX is handled in iflib when TX interrupts are not
used (IFC_NETMAP_TX_IRQ not set) has some issues:
  - The netmap_tx_irq() function gets called by iflib_timer(), which
    gets scheduled with tick granularity (hz). This is not frequent
    enough for 10Gbps NICs and beyond (e.g., ixgbe or ixl). The end
    result is that the transmitting netmap application is not woken
    up fast enough to saturate the link with small packets.
  - The iflib_timer() functions also calls isc_txd_credits_update()
    to ask for more TX completion updates. However, this violates
    the netmap requirement that only txsync can access the TX queue
    for datapath operations. Only netmap_tx_irq() may be called out
    of the txsync context.

This change introduces per-tx-queue netmap timers, using microsecond
granularity to ensure that netmap_tx_irq() can be called often enough
to allow for maximum packet rate. The timer routine simply calls
netmap_tx_irq() to wake up the netmap application. The latter will
wake up and call txsync to collect TX completion updates.

This change brings back line rate speed with small packets for ixgbe.
For the time being, timer expiration is hardcoded to 90 microseconds,
in order to avoid introducing a new sysctl.
We may eventually implement an adaptive expiration period or use another
deferred work mechanism in place of timers.

Also, fix the timers usage to make sure that each queue is serviced
by a different CPU.

PR: 248652
Reported by: sg@efficientip.com
MFC after: 2 weeks
sys/net/iflib.c