]> git.baikalelectronics.ru Git - kernel.git/commit
rtl818x: Make sure the TX descriptor "valid" flag is written by last
authorandrea merello <andrea.merello@gmail.com>
Tue, 18 Feb 2014 01:10:45 +0000 (02:10 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 4 Mar 2014 18:07:52 +0000 (13:07 -0500)
commit3923f34bf5e22c693ce395b39c58b2c1307f0c6f
treecfbf800800d32c35bdf742d277dc037b99eecf27
parenteae94317b77009f70839236689f2e41ad9f568dc
rtl818x: Make sure the TX descriptor "valid" flag is written by last

The TX descriptors are consumed by the HW using DMA.
Even if in the driver code the memory write that sets the "valid"
flag appears after all other writes, the CPU may reorder writes,
causing the HW to consider as valid a not-fully-written yet
descriptor.

This may cause HW incorrect behaviour.

This can happen because (AFAIK) the HW may attempt DMA
asynchronously without waiting to be kicked by the following
register write.

This patch adds a write memory barrier to enforce writes ordering.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtl818x/rtl8180/dev.c