r8169: fix unsigned int wraparound with TSO
authorJulien Ducourthial <jducourt@free.fr>
Fri, 5 Oct 2012 21:29:20 +0000 (23:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Oct 2012 20:28:14 +0000 (05:28 +0900)
commitc90334077ffa833ecf89f1645d21f0b9d5d51553
tree545b4a1d169048528e1bfa9e96993363d152a07a
parent768551e1212290b6f662d30a80b4b0dc0889be95
r8169: fix unsigned int wraparound with TSO

commit 477206a018f902895bfcd069dd820bfe94c187b1 upstream.

The r8169 may get stuck or show bad behaviour after activating TSO :
the net_device is not stopped when it has no more TX descriptors.
This problem comes from TX_BUFS_AVAIL which may reach -1 when all
transmit descriptors are in use. The patch simply tries to keep positive
values.

Tested with 8111d(onboard) on a D510MO, and with 8111e(onboard) on a
Zotac 890GXITX.

Signed-off-by: Julien Ducourthial <jducourt@free.fr>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/r8169.c