Page MenuHomeFreeBSD

Further correct and optimize the bus_dma(9) usage of iflib(4)
ClosedPublic

Authored by marius on Feb 5 2019, 12:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 12 2024, 1:39 PM
Unknown Object (File)
Oct 29 2024, 11:40 AM
Unknown Object (File)
Oct 28 2024, 6:29 AM
Unknown Object (File)
Oct 24 2024, 11:39 PM
Unknown Object (File)
Oct 24 2024, 11:39 PM
Unknown Object (File)
Oct 24 2024, 11:39 PM
Unknown Object (File)
Oct 24 2024, 11:18 PM
Unknown Object (File)
Sep 27 2024, 12:46 AM
Subscribers

Details

Summary
  • Correct the obvious bugs in the netmap(4) parts:
    • No longer check for the existence of DMA maps as bus_dma(9) is used unconditionally in iflib(4) since r341095.
    • Supply the correct DMA tag and map pairs to bus_dma(9) functions (see also the commit message of r343753).
    • In iflib_netmap_timer_adjust(), add synchronization of the TX descriptors before calling ift_txd_credits_update method as the latter evaluates the TX descriptors possibly updated by the MAC.
    • In _task_fn_tx(), wrap the netmap(4)-specific bits in #ifdef DEV_NETMAP just as done in _task_fn_admin() and _task_fn_rx() respectively.
  • In iflib_fast_intr_rxtx(), synchronize the TX rather than the RX descriptors before calling the ift_txd_credits_update method (see also above).
  • There's no need to synchronize an RX buffer that is going to be recycled in iflib_rxd_pkt_get(), yet; it's sufficient to do that as late as passing RX buffers to the MAC via the ift_rxd_refill method. Hence, combine that synchronization with the synchronization of new buffers into a common spot in _iflib_fl_refill().
  • There's no need to synchronize the RX descriptors of a free list in preparation of the MAC updating their statuses with every invocation of rxd_frag_to_sd(); it's enough to do this once before handing control over to the MAC, i. e. before calling ift_rxd_flush method in _iflib_fl_refill(), which already performs the necessary synchronization.
  • Given that the ift_rxd_available method evaluates the RX descriptors which possibly have been altered by the MAC, synchronize as appropriate beforehand. Most notably this is now done in iflib_rxd_avail(), which in turn means that we don't need to issue the same synchronization yet again before calling the ift_rxd_pkt_get method in iflib_rxeof().
  • In iflib_txd_db_check(), synchronize the TX descriptors before handing them over to the MAC for transmission via the ift_txd_flush method.
  • In iflib_encap(), move the TX buffer synchronization after the invocation of the ift_txd_encap() method. If the MAC driver fails to encapsulate the packet and we retry with a defragmented mbuf chain or finally fail, the cycles for TX buffer synchronization have been wasted. Synchronizing afterwards matches what non-iflib(4) drivers typically do and is sufficient as the MAC will not actually start with the transmission before - in this case - the ift_txd_flush method is called. Moreover, for the latter reason the synchronization of the TX descriptors in iflib_encap() can go as it's enough to synchronize them before passing control over to the MAC by issuing the ift_txd_flush() method (see above).
  • In iflib_txq_can_drain(), only synchronize TX descriptors if the ift_txd_credits_update method accessing these is actually called.
Test Plan

The patch survived testing with EM-class gear here, including not triggering faults when enabling DMAR usage.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 22347