ionic: use mutex to protect queue operations
authorShannon Nelson <snelson@pensando.io>
Mon, 20 Jul 2020 23:00:17 +0000 (16:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jul 2020 08:19:45 +0000 (10:19 +0200)
commit79a7ab49b1c80939d89c21e3b738642834356118
treede002a75e8f7e2c6165cc5b7cd1e9126d3611bf6
parent41ab3bd11cc4d556a98e6244b160a048cdddb5c0
ionic: use mutex to protect queue operations

[ Upstream commit 0925e9db4dc86daf666d9a3d53c7db14ac6d5d00 ]

The ionic_wait_on_bit_lock() was a open-coded mutex knock-off
used only for protecting the queue reset operations, and there
was no reason not to use the real thing.  We can use the lock
more correctly and to better protect the queue stop and start
operations from cross threading.  We can also remove a useless
and expensive bit operation from the Rx path.

This fixes a case found where the link_status_check from a link
flap could run into an MTU change and cause a crash.

Fixes: beead698b173 ("ionic: Add the basic NDO callbacks for netdev support")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/pensando/ionic/ionic_lif.c
drivers/net/ethernet/pensando/ionic/ionic_lif.h
drivers/net/ethernet/pensando/ionic/ionic_txrx.c