sfc: Properly sync RX DMA buffer when it is not the last in the page
authorBen Hutchings <bhutchings@solarflare.com>
Thu, 20 Dec 2012 18:48:20 +0000 (18:48 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 27 Mar 2013 02:41:09 +0000 (02:41 +0000)
commit2abb802779b6dca5bafa8a16923ea222189a35cc
treed562ea6002fc143cda0c71e64d5229bd939e3704
parent26af00506d193b3f2be779f46fe5fe7821b56a7a
sfc: Properly sync RX DMA buffer when it is not the  last in the page

[ Upstream commit 3a68f19d7afb80f548d016effbc6ed52643a8085 ]

We may currently allocate two RX DMA buffers to a page, and only unmap
the page when the second is completed.  We do not sync the first RX
buffer to be completed; this can result in packet loss or corruption
if the last RX buffer completed in a NAPI poll is the first in a page
and is not DMA-coherent.  (In the middle of a NAPI poll, we will
handle the following RX completion and unmap the page *before* looking
at the content of the first buffer.)

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/ethernet/sfc/rx.c