]> git.baikalelectronics.ru Git - kernel.git/commit
bna: Add synchronization for tx ring.
authorBenjamin Poirier <bpoirier@suse.com>
Mon, 7 Nov 2016 09:57:56 +0000 (17:57 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Nov 2016 18:31:10 +0000 (13:31 -0500)
commitb2e33b269143a8a611d43b156a99803f004d2044
tree7ed61aa920207a95b8f1bbcfb89d6623f0336e37
parent29236b1a0cb336241f0d0f8f05abd0987a60eccf
bna: Add synchronization for tx ring.

We received two reports of BUG_ON in bnad_txcmpl_process() where
hw_consumer_index appeared to be ahead of producer_index. Out of order
write/read of these variables could explain these reports.

bnad_start_xmit(), as a producer of tx descriptors, has a few memory
barriers sprinkled around writes to producer_index and the device's
doorbell but they're not paired with anything in bnad_txcmpl_process(), a
consumer.

Since we are synchronizing with a device, we must use mandatory barriers,
not smp_*. Also, I didn't see the purpose of the last smp_mb() in
bnad_start_xmit().

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/brocade/bna/bnad.c