]> git.baikalelectronics.ru Git - kernel.git/commit
bnxt: don't lock the tx queue from napi poll
authorJakub Kicinski <kuba@kernel.org>
Thu, 12 Aug 2021 21:42:39 +0000 (14:42 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 13 Aug 2021 17:26:17 +0000 (10:26 -0700)
commit11e708c2ad06e410c2c7602f73361ad908550ed7
treecd220b76f2c0889dba7db82c3ab770481737a740
parente5b74d1733a73c64f9224520a7d6995641c14a3c
bnxt: don't lock the tx queue from napi poll

We can't take the tx lock from the napi poll routine, because
netpoll can poll napi at any moment, including with the tx lock
already held.

The tx lock is protecting against two paths - the disable
path, and (as Michael points out) the NETDEV_TX_BUSY case
which may occur if NAPI completions race with start_xmit
and both decide to re-enable the queue.

For the disable/ifdown path use synchronize_net() to make sure
closing the device does not race we restarting the queues.
Annotate accesses to dev_state against data races.

For the NAPI cleanup vs start_xmit path - appropriate barriers
are already in place in the main spot where Tx queue is stopped
but we need to do the same careful dance in the TX_BUSY case.

Fixes: dfe047769e71 ("bnxt_en: New Broadcom ethernet driver.")
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c