mv643xx_eth: prevent breakage when link goes down during transmit
authorLennert Buytenhek <buytenh@wantstofly.org>
Fri, 11 Jul 2008 17:38:34 +0000 (19:38 +0200)
committerLennert Buytenhek <buytenh@marvell.com>
Thu, 24 Jul 2008 04:22:50 +0000 (06:22 +0200)
commit6b368f6859c80343e5d7c6e2a7c49df0a8a273c1
treea94206bb0a36cdfb19e08907dcc4031b51e9348b
parent8fa89bf5de066b11190ac804903021700c2b1185
mv643xx_eth: prevent breakage when link goes down during transmit

When the ethernet link goes down while mv643xx_eth is transmitting
data, transmit DMA can stop before all queued transmit descriptors
have been processed.  But even the descriptors that _have_ been
processed might not be properly marked as done before the transmit
DMA unit shuts down.

Then when the link comes up again, the hardware transmit pointer
might have advanced while not all previous packet descriptors have
been marked as transmitted, causing software transmit reclaim to
hang waiting for the hardware to finish transmitting a descriptor
that it has already skipped.

This patch forcibly reclaims all packets on the transmit ring on a
link down interrupt, and then resyncs the hardware transmit pointer to
what the software's idea of the first free descriptor is.  Also, we
need to prevent re-waking the transmit queue if we get a 'transmit
done' interrupt at the same time as a 'link down' interrupt, which
this patch does as well.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
drivers/net/mv643xx_eth.c