• Jakub Kicinski's avatar
    net: piggy back on the memory barrier in bql when waking queues · 301f227f
    Jakub Kicinski authored
    Drivers call netdev_tx_completed_queue() right before
    netif_txq_maybe_wake(). If BQL is enabled netdev_tx_completed_queue()
    should issue a memory barrier, so we can depend on that separating
    the stop check from the consumer index update, instead of adding
    another barrier in netif_txq_maybe_wake().
    
    This matters more than the barriers on the xmit path, because
    the wake condition is almost always true. So we issue the
    consumer side barrier often.
    
    Wrap netdev_tx_completed_queue() in a local helper to issue
    the barrier even if BQL is disabled. Keep the same semantics
    as netdev_tx_completed_queue() (barrier only if bytes != 0)
    to make it clear that the barrier is conditional.
    
    Plus since macro gets pkt/byte counts as arguments now -
    we can skip waking if there were no packets completed.
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    301f227f
netdev_queues.h 5.48 KB