This is a note to let you know that I've just added the patch titled
r8169: fix unsigned int wraparound with TSO
to the 3.0-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
r8169-fix-unsigned-int-wraparound-with-tso.patch
and it can be found in the queue-3.0 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From [email protected] Sat Oct 6 06:49:18 2012
From: Francois Romieu <[email protected]>
Date: Fri, 5 Oct 2012 23:29:20 +0200
Subject: r8169: fix unsigned int wraparound with TSO
To: [email protected]
Cc: Hayes Wang <[email protected]>, Jonathan Nieder <[email protected]>
From: Julien Ducourthial <[email protected]>
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 <[email protected]>
Acked-by: Francois Romieu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Reviewed-by: Jonathan Nieder <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/net/r8169.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -58,8 +58,12 @@
#define R8169_MSG_DEFAULT \
(NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN)
-#define TX_BUFFS_AVAIL(tp) \
- (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1)
+#define TX_SLOTS_AVAIL(tp) \
+ (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx)
+
+/* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */
+#define TX_FRAGS_READY_FOR(tp,nr_frags) \
+ (TX_SLOTS_AVAIL(tp) >= (nr_frags + 1))
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
The RTL chips use a 64 element hash table based on the Ethernet CRC. */
@@ -4924,7 +4928,7 @@ static netdev_tx_t rtl8169_start_xmit(st
u32 opts[2];
int frags;
- if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) {
+ if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) {
netif_err(tp, drv, dev, "BUG! Tx Ring full when queue
awake!\n");
goto err_stop_0;
}
@@ -4972,10 +4976,10 @@ static netdev_tx_t rtl8169_start_xmit(st
RTL_W8(TxPoll, NPQ);
- if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) {
+ if (!TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
netif_stop_queue(dev);
smp_mb();
- if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)
+ if (TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS))
netif_wake_queue(dev);
}
@@ -5077,7 +5081,7 @@ static void rtl8169_tx_interrupt(struct
tp->dirty_tx = dirty_tx;
smp_mb();
if (netif_queue_stopped(dev) &&
- (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) {
+ TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
netif_wake_queue(dev);
}
/*
Patches currently in stable-queue which might be from [email protected] are
queue-3.0/r8169-fix-config2-msienable-bit-setting.patch
queue-3.0/r8169-remove-erroneous-processing-of-always-set-bit.patch
queue-3.0/r8169-fix-wake-on-lan-setting-for-non-8111e.patch
queue-3.0/r8169-8168c-and-later-require-bit-0x20-to-be-set-in-config2-for-pme-signaling.patch
queue-3.0/r8169-config1-is-read-only-on-8168c-and-later.patch
queue-3.0/r8169-rx-fifo-overflow-fixes.patch
queue-3.0/r8169-jumbo-fixes.patch
queue-3.0/r8169-runtime-resume-before-shutdown.patch
queue-3.0/r8169-increase-the-delay-parameter-of-pm_schedule_suspend.patch
queue-3.0/r8169-don-t-enable-rx-when-shutdown.patch
queue-3.0/r8169-missing-barriers.patch
queue-3.0/r8169-fix-unsigned-int-wraparound-with-tso.patch
queue-3.0/r8169-expand-received-packet-length-indication.patch
queue-3.0/r8169-call-netif_napi_del-at-errpaths-and-at-driver-unload.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html