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)
commit3c603136c9f82833813af77185618de5af67676c
treecd220b76f2c0889dba7db82c3ab770481737a740
parentf8e6dfc64f6135d1b6c5215c14cd30b9b60a0008
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: c0c050c58d84 ("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