Skip to contentSkip to conversation

1e918876 breaks r8169 (linux-3.18+)

DISCUSSION Tomas Szepe 5 participants 19 messages Feb 3, 2015 – Feb 22, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

Since linux-3.18.0, r8169 is having problems driving one of my add-on PCIe NICs. The interface is losing link for several seconds at a time, the frequency being about once a minute when the traffic is high.

The first loss of link is accompanied by the message "NETDEV WATCHDOG:
eth1 (r8169): transmit queue 0 timed out" and a call trace, while subsequent occurrences only report "r8169 0000:01:00.0 eth1: link up" (w/o the complementary "link down" message).

I've traced the culprit down to commit 1e918876, "r8169: add support for Byte Queue Limits" by Florian Westphal <[email protected]>. Reverting the patch appears to fix the problem on linux-3.18.5.

The same issue might already have been reported by Marco Berizzi here:
http://lkml.org/lkml/2014/12/11/65

The NIC is:
01:00.0 0200: 10ec:8168 (Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller) (rev 01)
Subsystem: 10ec:8168 (Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller)
Flags: bus master, fast devsel, latency 0, IRQ 27
I/O ports at e000 [size=256]
Memory at f7d00000 (64-bit, non-prefetchable) [size=4K]
Expansion ROM at f7d20000 [disabled] [size=128K]
Capabilities: [40] Power Management version 2
Capabilities: [48] Vital Product Data
Capabilities: [50] MSI: Enable+ Count=1/2 Maskable- 64bit+
Capabilities: [60] Express Endpoint, MSI 00
Capabilities: [84] Vendor Specific Information: Len=4c <?>
Capabilities: [100] Advanced Error Reporting
Capabilities: [12c] Virtual Channel
Capabilities: [148] Device Serial Number 98-2d-00-00-10-ec-81-68
Capabilities: [154] Power Budgeting <?>

Best regards,

Signature · 1 line
Tomas Szepe <[email protected]>
#1 lore raw
Quoted 11 lines · Tomas Szepe

Hi,

Since linux-3.18.0, r8169 is having problems driving one of my add-on PCIe NICs. The interface is losing link for several seconds at a time, the frequency being about once a minute when the traffic is high.

The first loss of link is accompanied by the message "NETDEV WATCHDOG:
eth1 (r8169): transmit queue 0 timed out" and a call trace, while subsequent occurrences only report "r8169 0000:01:00.0 eth1: link up" (w/o the complementary "link down" message).

Quoted 5 lines

I've traced the culprit down to commit 1e918876, "r8169: add support for Byte Queue Limits" by Florian Westphal <[email protected]>. Reverting the patch appears to fix the problem on linux-3.18.5.
The same issue might already have been reported by Marco Berizzi here:
http://lkml.org/lkml/2014/12/11/65

Thanks for reporting this! I'm no lkml subscriber and thus did not see earlier report.

I'll try to reproduce this but unfortunately I am currently travelling and won't have access to my r8169 nic until Feb 10th.

If you're willing to experiment (not even compile tested):

drivers/net/ethernet/realtek/r8169.c +5 -4
@@ -5067,8 +5067,6 @@ static void rtl_hw_reset(struct rtl8169_private *tp)
 	RTL_W8(ChipCmd, CmdReset);
 
 	rtl_udelay_loop_wait_low(tp, &rtl_chipcmd_cond, 100, 100);
-
-	netdev_reset_queue(tp->dev);
 }
 
 static void rtl_request_uncached_firmware(struct rtl8169_private *tp)
@@ -6773,6 +6771,7 @@ static void rtl8169_tx_clear(struct rtl8169_private *tp)
 {
 	rtl8169_tx_clear_range(tp, tp->dirty_tx, NUM_TX_DESC);
 	tp->cur_tx = tp->dirty_tx = 0;
+	netdev_reset_queue(tp->dev);
 }
 
 static void rtl_reset_work(struct rtl8169_private *tp)
@@ -7231,9 +7230,9 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
 		tx_left--;
 	}
 
-	if (tp->dirty_tx != dirty_tx) {
-		netdev_completed_queue(tp->dev, pkts_compl, bytes_compl);
+	netdev_completed_queue(tp->dev, pkts_compl, bytes_compl);
 
+	if (tp->dirty_tx != dirty_tx) {
 		u64_stats_update_begin(&tp->tx_stats.syncp);
 		tp->tx_stats.packets += pkts_compl;
 		tp->tx_stats.bytes += bytes_compl;
@@ -7263,6 +7262,8 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
 
 			RTL_W8(TxPoll, NPQ);
 		}
+	} else {
+		WARN_ON_ONCE(pkts_compl);
 	}
 }
 
#2 lore raw

Ehlo,

Quoted 7 lines
Quoted 4 lines

Since linux-3.18.0, r8169 is having problems driving one of my add-on PCIe NICs. The interface is losing link for several seconds at a time, the frequency being about once a minute when the traffic is high.
...

Thanks for reporting this! I'm no lkml subscriber and thus did not see earlier report.

Np, I just like my eth interfaces being up when they're supposed to be up. :)

drivers/net/ethernet/realtek/r8169.c

Quoted 7 lines

I'll try to reproduce this but unfortunately I am currently travelling and won't have access to my r8169 nic until Feb 10th.

If you're willing to experiment (not even compile tested):

drivers/net/ethernet/realtek/r8169.c +0 -0
...

I'm happy to report this patch fixes the problem (tested on vanilla 3.18.5), and the throughput of the link seems fine in both directions, too.

Best regards,

Signature · 1 line
Tomáš Szépe <[email protected]>
#3 lore raw
Quoted 13 lines
Quoted 7 lines
Quoted 4 lines

Since linux-3.18.0, r8169 is having problems driving one of my add-on PCIe NICs. The interface is losing link for several seconds at a time, the frequency being about once a minute when the traffic is high.
...

Thanks for reporting this! I'm no lkml subscriber and thus did not see earlier report.

Np, I just like my eth interfaces being up when they're supposed to be up. :)

Quoted 3 lines

I'll try to reproduce this but unfortunately I am currently travelling and won't have access to my r8169 nic until Feb 10th.

Quoted 8 lines

drivers/net/ethernet/realtek/r8169.c

Quoted 4 lines

If you're willing to experiment (not even compile tested):

drivers/net/ethernet/realtek/r8169.c +0 -0
...

I'm happy to report this patch fixes the problem (tested on vanilla 3.18.5), and the throughput of the link seems fine in both directions, too.

Unfortunately, I have to take this back. I made the conclusion too early. The problem appears with this patch applied, too, only perhaps later and with a different frequency pattern.

Sorry about the confusion,

Signature · 1 line
Tomas Szepe <[email protected]>
#4 lore raw
Quoted 3 lines · Tomas Szepe

Unfortunately, I have to take this back. I made the conclusion too early. The problem appears with this patch applied, too, only perhaps later and with a different frequency pattern.

+1 can confirm - I also see the stack trace in question [1] from time to time, however even under low/moderate load and more or less randomly. This also used to happen with 3.14.x, so I don't think it has anything to do woth the BQL patch pe se.

I *think* - and have suspected for some time now - that this is caused by a change in TSO/GSO or other offload settings, and that some r8169 models consequently suffer occasional (or in your case frequent) hiccups. BQL and/or a qdisc doing requeues might just interfer with whatever upsets the driver or HW.

I used to turn on all possible settings via ethtool, but am now back to defaults, which disables sg/tso/gso. Exactly which of these settings is the culprit remains to be seen.

Holger

[1] https://lkml.org/lkml/2014/12/11/65

#5 lore raw
In reply to Florian Westphal
Quoted 18 lines · Florian Westphal
Quoted 11 lines · Tomas Szepe

Hi,

Since linux-3.18.0, r8169 is having problems driving one of my add-on PCIe NICs. The interface is losing link for several seconds at a time, the frequency being about once a minute when the traffic is high.

The first loss of link is accompanied by the message "NETDEV WATCHDOG:
eth1 (r8169): transmit queue 0 timed out" and a call trace, while subsequent occurrences only report "r8169 0000:01:00.0 eth1: link up" (w/o the complementary "link down" message).

Quoted 5 lines

I've traced the culprit down to commit 1e918876, "r8169: add support for Byte Queue Limits" by Florian Westphal <[email protected]>. Reverting the patch appears to fix the problem on linux-3.18.5.
The same issue might already have been reported by Marco Berizzi here:
http://lkml.org/lkml/2014/12/11/65

Quoted 5 lines

Thanks for reporting this! I'm no lkml subscriber and thus did not see earlier report.

I'll try to reproduce this but unfortunately I am currently travelling and won't have access to my r8169 nic until Feb 10th.

I tried to reproduce this without success so far on my RTL8168d/8111d device. I've been running 40 parallel netperf TCP_STREAM tests (1gbit) for the last 5 hours and so far I saw no watchdog tx timeouts.

I'll keep this running for a day or so to see if it just takes more time to trigger.

Do you use any "special" settings (e.g. offload features off, mtu > 1500, etc)?

Thanks.

#6 lore raw

Hi,

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines

Since linux-3.18.0, r8169 is having problems driving one of my add-on PCIe NICs. The interface is losing link for several seconds at a time, the frequency being about once a minute when the traffic is high.

The first loss of link is accompanied by the message "NETDEV WATCHDOG:
eth1 (r8169): transmit queue 0 timed out" and a call trace, while subsequent occurrences only report "r8169 0000:01:00.0 eth1: link up" (w/o the complementary "link down" message).

I've traced the culprit down to commit 1e918876, "r8169: add support for Byte Queue Limits" by Florian Westphal <[email protected]>. Reverting the patch appears to fix the problem on linux-3.18.5.
The same issue might already have been reported by Marco Berizzi here:
http://lkml.org/lkml/2014/12/11/65

Quoted 7 lines
Quoted 5 lines

Thanks for reporting this! I'm no lkml subscriber and thus did not see earlier report.

I'll try to reproduce this but unfortunately I am currently travelling and won't have access to my r8169 nic until Feb 10th.

I tried to reproduce this without success so far on my RTL8168d/8111d device.

I was afraid it might come to this. Of all the ~15 r8169 interfaces (mostly onboard) I've got running in about 10 machines, only a single one is affected.

Quoted 5 lines

I've been running 40 parallel netperf TCP_STREAM tests (1gbit) for the last 5 hours and so far I saw no watchdog tx timeouts.

I'll keep this running for a day or so to see if it just takes more time to trigger.

Ok, but if the bug were to manifest itself in the same manner as it does over here, it wouldn't require so much pressure.

Quoted 1 line

Do you use any "special" settings (e.g. offload features off, mtu > 1500, etc)?

Nothing special.

modprobe r8169
nameif eth1 xx:xx:xx:xx:xx:xx
ip link set eth1 up
ip addr add 192.168.x.y/24 brd + dev eth1
And that's it, really.

Seeya,

Signature · 1 line
Tomáš Szépe <[email protected]>
#7 lore raw
In reply to Florian Westphal
Quoted 21 lines
Quoted 15 lines
Quoted 9 lines

Since linux-3.18.0, r8169 is having problems driving one of my add-on PCIe NICs. The interface is losing link for several seconds at a time, the frequency being about once a minute when the traffic is high.

The first loss of link is accompanied by the message "NETDEV WATCHDOG:
eth1 (r8169): transmit queue 0 timed out" and a call trace, while subsequent occurrences only report "r8169 0000:01:00.0 eth1: link up" (w/o the complementary "link down" message).

Quoted 5 lines

I've traced the culprit down to commit 1e918876, "r8169: add support for Byte Queue Limits" by Florian Westphal <[email protected]>. Reverting the patch appears to fix the problem on linux-3.18.5.
The same issue might already have been reported by Marco Berizzi here:
http://lkml.org/lkml/2014/12/11/65

Quoted 5 lines

Thanks for reporting this! I'm no lkml subscriber and thus did not see earlier report.

I'll try to reproduce this but unfortunately I am currently travelling and won't have access to my r8169 nic until Feb 10th.

Quoted 6 lines

I tried to reproduce this without success so far on my RTL8168d/8111d device. I've been running 40 parallel netperf TCP_STREAM tests (1gbit) for the last 5 hours and so far I saw no watchdog tx timeouts.

I'll keep this running for a day or so to see if it just takes more time to trigger.

So, how's this coming along? Don't you think the patch should be reverted until the problem is diagnosed/understood/fixed?

Signature · 1 line
Tomas Szepe <[email protected]>
#8 lore raw
Quoted 9 lines · Tomas Szepe
Quoted 6 lines

I tried to reproduce this without success so far on my RTL8168d/8111d device. I've been running 40 parallel netperf TCP_STREAM tests (1gbit) for the last 5 hours and so far I saw no watchdog tx timeouts.

I'll keep this running for a day or so to see if it just takes more time to trigger.

So, how's this coming along? Don't you think the patch should be reverted until the problem is diagnosed/understood/fixed?

Sorry.

David, please consider reverting

1e918876853aa85435e0f17fd8b4a92dcfff53d6
(r8169: add support for Byte Queue Limits)

and

0bec3b700d106a8b0a34227b2976d1a582f1aab7
(r8169: add support for xmit_more)

I cannot reproduce any hangs (tried for 2days with 40 parallel netperfs using both 100mbit and 1gbit receiver).

And I don't see anything wrong with the change either. Seems like some revisions of the HW are just dodgy?

I hate giving up, but I have no means to diagnose this any further. Even reporter says it doesn't affect all of his r8169 nics.

So I think the change is correct per se, but might be revealing some HW/firmware bug.

#9 lore raw
Quoted 26 lines · Florian Westphal
Quoted 9 lines · Tomas Szepe
Quoted 6 lines

I tried to reproduce this without success so far on my RTL8168d/8111d device. I've been running 40 parallel netperf TCP_STREAM tests (1gbit) for the last 5 hours and so far I saw no watchdog tx timeouts.

I'll keep this running for a day or so to see if it just takes more time to trigger.

So, how's this coming along? Don't you think the patch should be reverted until the problem is diagnosed/understood/fixed?

Sorry.

David, please consider reverting

1e918876853aa85435e0f17fd8b4a92dcfff53d6
(r8169: add support for Byte Queue Limits)

and

0bec3b700d106a8b0a34227b2976d1a582f1aab7
(r8169: add support for xmit_more)

I cannot reproduce any hangs (tried for 2days with 40 parallel netperfs using both 100mbit and 1gbit receiver).

Quoted 8 lines

And I don't see anything wrong with the change either. Seems like some revisions of the HW are just dodgy?

I hate giving up, but I have no means to diagnose this any further. Even reporter says it doesn't affect all of his r8169 nics.

So I think the change is correct per se, but might be revealing some HW/firmware bug.

Florian,

have you experimented with offload settings? The only times r8169 seems to hiccup is with sg/tso enabled. I've reverted my NIC settings back to mostly defaults (which does not enable sg/tso) and had no hangs, spurious timeouts or other problems ever since, despite BQL, xmit_more and client/server use for 24/7.

Tomas never said whether his setup enabled any offload settings; it's not inconceivable that a distribution might try to automatically "optimize" things.

-h

#10 lore raw
In reply to Florian Westphal
Quoted 26 lines · Florian Westphal
Quoted 9 lines · Tomas Szepe
Quoted 6 lines

I tried to reproduce this without success so far on my RTL8168d/8111d device. I've been running 40 parallel netperf TCP_STREAM tests (1gbit) for the last 5 hours and so far I saw no watchdog tx timeouts.

I'll keep this running for a day or so to see if it just takes more time to trigger.

So, how's this coming along? Don't you think the patch should be reverted until the problem is diagnosed/understood/fixed?

Sorry.

David, please consider reverting

1e918876853aa85435e0f17fd8b4a92dcfff53d6
(r8169: add support for Byte Queue Limits)

and

0bec3b700d106a8b0a34227b2976d1a582f1aab7
(r8169: add support for xmit_more)

I cannot reproduce any hangs (tried for 2days with 40 parallel netperfs using both 100mbit and 1gbit receiver).

Quoted 8 lines

And I don't see anything wrong with the change either. Seems like some revisions of the HW are just dodgy?

I hate giving up, but I have no means to diagnose this any further. Even reporter says it doesn't affect all of his r8169 nics.

So I think the change is correct per se, but might be revealing some HW/firmware bug.

Hold on.

I believe there is one race in the way you access skb->xmit_more _after_

txd->opts1 = cpu_to_le32(status);

After this point, TX might have completed and TX completion already have freed skb

Could Tomas try following fix ?

drivers/net/ethernet/realtek/r8169.c +3 -2
index ad0020af2193..f2764366a36c 100644
@@ -7050,6 +7050,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 	u32 opts[2];
 	int frags;
 	bool stop_queue;
+	bool xmit_more;
 
 	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");
@@ -7091,7 +7092,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 	txd->opts2 = cpu_to_le32(opts[1]);
 
 	netdev_sent_queue(dev, skb->len);
-
+	xmit_more = skb->xmit_more;
 	skb_tx_timestamp(skb);
 
 	/* Force memory writes to complete before releasing descriptor */
@@ -7108,7 +7109,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
 	stop_queue = !TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS);
 
-	if (!skb->xmit_more || stop_queue ||
+	if (!xmit_more || stop_queue ||
 	    netif_xmit_stopped(netdev_get_tx_queue(dev, 0))) {
 		RTL_W8(TxPoll, NPQ);
 
#11 lore raw
Quoted 8 lines · Eric Dumazet

Hold on.

I believe there is one race in the way you access skb->xmit_more _after_

txd->opts1 = cpu_to_le32(status);

After this point, TX might have completed and TX completion already have freed skb

Hmm, I _thought_ HW would not start xmit of this descriptor/skb until after

RTL_W8(TxPoll, NPQ);

call a bit later... your patch surely looks safer though, thanks for looking into this.

Quoted 1 line

Could Tomas try following fix ?

In addition -- Tomas, on your affected board -- did you try turning off gso/tso?

Holger Hoffstätte mentioned on lkml that his affected r8169 nic is stable with xmit_more+bql after disabling gso/tso on the nic

(ethtool -k $dev to display settings, "-K $dev tso off gso off" to
disable offloads).

#12 lore raw
Quoted 5 lines · Florian Westphal
Quoted 4 lines · Eric Dumazet

Hold on.

I believe there is one race in the way you access skb->xmit_more _after_

Quoted 8 lines
Quoted 4 lines

txd->opts1 = cpu_to_le32(status);

After this point, TX might have completed and TX completion already have freed skb

Hmm, I _thought_ HW would not start xmit of this descriptor/skb until after

RTL_W8(TxPoll, NPQ);

Note this 'kick' does not provide tail ptr.

NIC basically looks at TX descriptors to find ones with the DescOwn bit set. It stops when if find one TX descriptor _without_ DescOwn.

So what can happen here is the NIC was kicked earlier (prior transmit), but found your TX descriptor, before you got a chance to read skb->xmit_more

This is why we have these wmb() everywhere. We want to do

txd->opts1 = XXX

Only when we are really ready.

#13 lore raw
Quoted 11 lines · Eric Dumazet
Quoted 10 lines · Florian Westphal
Quoted 8 lines · Eric Dumazet

Hold on.

I believe there is one race in the way you access skb->xmit_more _after_

txd->opts1 = cpu_to_le32(status);

After this point, TX might have completed and TX completion already have freed skb

Quoted 8 lines
Quoted 3 lines

Hmm, I _thought_ HW would not start xmit of this descriptor/skb until after

RTL_W8(TxPoll, NPQ);

Note this 'kick' does not provide tail ptr.

NIC basically looks at TX descriptors to find ones with the DescOwn bit set. It stops when if find one TX descriptor _without_ DescOwn.

Makes sense, thanks for explaining this.

#15 lore raw
In reply to Eric Dumazet
Quoted 35 lines
Quoted 13 lines

David, please consider reverting

1e918876853aa85435e0f17fd8b4a92dcfff53d6
(r8169: add support for Byte Queue Limits)

and

0bec3b700d106a8b0a34227b2976d1a582f1aab7
(r8169: add support for xmit_more)

I cannot reproduce any hangs (tried for 2days with 40 parallel netperfs using both 100mbit and 1gbit receiver).

Quoted 8 lines

And I don't see anything wrong with the change either. Seems like some revisions of the HW are just dodgy?

I hate giving up, but I have no means to diagnose this any further. Even reporter says it doesn't affect all of his r8169 nics.

So I think the change is correct per se, but might be revealing some HW/firmware bug.

Hold on.

I believe there is one race in the way you access skb->xmit_more _after_

txd->opts1 = cpu_to_le32(status);

After this point, TX might have completed and TX completion already have freed skb

Could Tomas try following fix ?

drivers/net/ethernet/realtek/r8169.c +0 -0
index ad0020af2193..f2764366a36c 100644

drivers/net/ethernet/realtek/r8169.c

Quoted 1 line
drivers/net/ethernet/realtek/r8169.c +0 -0
...

Sure, just did. Unfortunately, 3.19.0 + 0bec3b70 + this patch results in a driver that retains the problem.

Sorry,

Signature · 1 line
Tomas Szepe <[email protected]>
#14 lore raw
In reply to Florian Westphal
Quoted 10 lines
Quoted 1 line

Could Tomas try following fix ?

In addition -- Tomas, on your affected board -- did you try turning off gso/tso?

Holger Hoffstätte mentioned on lkml that his affected r8169 nic is stable with xmit_more+bql after disabling gso/tso on the nic

(ethtool -k $dev to display settings, "-K $dev tso off gso off" to
disable offloads).

They're always off on this NIC (cannot be turned on).

# ethtool -k eth1| grep segmentation-offload
tcp-segmentation-offload: off
generic-segmentation-offload: off [requested on]
# ethtool -K eth1 gso on tso on
Could not change any device features
# ethtool -k eth1| grep segmentation-offload
tcp-segmentation-offload: off
generic-segmentation-offload: off [requested on]
Signature · 1 line
Tomas Szepe <[email protected]>
#16 lore raw
In reply to Tomas Szepe
Quoted 2 lines · Tomas Szepe

Sure, just did. Unfortunately, 3.19.0 + 0bec3b70 + this patch results in a driver that retains the problem.

OK, could you test following patch instead ?

drivers/net/ethernet/realtek/r8169.c +10 -7
index ad0020af2193..18d0decb5093 100644
@@ -7050,6 +7050,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 	u32 opts[2];
 	int frags;
 	bool stop_queue;
+	bool xmit_more;
 
 	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");
@@ -7091,7 +7092,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 	txd->opts2 = cpu_to_le32(opts[1]);
 
 	netdev_sent_queue(dev, skb->len);
-
+	xmit_more = skb->xmit_more;
 	skb_tx_timestamp(skb);
 
 	/* Force memory writes to complete before releasing descriptor */
@@ -7108,7 +7109,14 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
 	stop_queue = !TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS);
 
-	if (!skb->xmit_more || stop_queue ||
+	if (stop_queue) {
+		/* Avoid wrongly optimistic queue wake-up: rtl_tx thread must
+		 * not miss a ring update when it notices a stopped queue.
+		 */
+		smp_wmb();
+		netif_stop_queue(dev);
+	}
+	if (!xmit_more ||
 	    netif_xmit_stopped(netdev_get_tx_queue(dev, 0))) {
 		RTL_W8(TxPoll, NPQ);
 
@@ -7116,11 +7124,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 	}
 
 	if (stop_queue) {
-		/* Avoid wrongly optimistic queue wake-up: rtl_tx thread must
-		 * not miss a ring update when it notices a stopped queue.
-		 */
-		smp_wmb();
-		netif_stop_queue(dev);
 		/* Sync with rtl_tx:
 		 * - publish queue status and cur_tx ring index (write barrier)
 		 * - refresh dirty_tx ring index (read barrier).
#17 lore raw
Quoted 4 lines
Quoted 2 lines

Sure, just did. Unfortunately, 3.19.0 + 0bec3b70 + this patch results in a driver that retains the problem.

OK, could you test following patch instead ?

Yup, but tough luck: 3.19.0 + 0bec3b70 + this patch -> problem present.

Signature · 1 line
Tomas Szepe <[email protected]>
maintainer
#18 lore raw

From: Tomas Szepe <[email protected]>
Date: Sun, 22 Feb 2015 01:41:51 +0100

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Sure, just did. Unfortunately, 3.19.0 + 0bec3b70 + this patch results in a driver that retains the problem.

OK, could you test following patch instead ?

Yup, but tough luck: 3.19.0 + 0bec3b70 + this patch -> problem present.

I'm reverting the two commits for now, as below.

We can put them back in if we can resolve the problems.

====================
[PATCH] r8169: Revert BQL and xmit_more support.

There are certain regressions which are pointing to these two commits which we are having a hard time resolving. So revert them for now.

Specifically this reverts:

	commit 0bec3b700d106a8b0a34227b2976d1a582f1aab7
	Author: Florian Westphal <[email protected]>
	Date:   Wed Jan 7 10:49:49 2015 +0100

	    r8169: add support for xmit_more

and

	commit 1e918876853aa85435e0f17fd8b4a92dcfff53d6
	Author: Florian Westphal <[email protected]>
	Date:   Wed Oct 1 13:38:03 2014 +0200

	    r8169: add support for Byte Queue Limits

There were some attempts by Eric Dumazet to address some obvious problems in the TX flow, to see if they would fix the problems, but none of them seem to help for the regression reporters.

---
 drivers/net/ethernet/realtek/r8169.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)
drivers/net/ethernet/realtek/r8169.c +7 -23
index ad0020a..b156092 100644
@@ -5067,8 +5067,6 @@ static void rtl_hw_reset(struct rtl8169_private *tp)
 	RTL_W8(ChipCmd, CmdReset);
 
 	rtl_udelay_loop_wait_low(tp, &rtl_chipcmd_cond, 100, 100);
-
-	netdev_reset_queue(tp->dev);
 }
 
 static void rtl_request_uncached_firmware(struct rtl8169_private *tp)
@@ -7049,7 +7047,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 	u32 status, len;
 	u32 opts[2];
 	int frags;
-	bool stop_queue;
 
 	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");
@@ -7090,8 +7087,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
 	txd->opts2 = cpu_to_le32(opts[1]);
 
-	netdev_sent_queue(dev, skb->len);
-
 	skb_tx_timestamp(skb);
 
 	/* Force memory writes to complete before releasing descriptor */
@@ -7106,16 +7101,11 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
 	tp->cur_tx += frags + 1;
 
-	stop_queue = !TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS);
+	RTL_W8(TxPoll, NPQ);
 
-	if (!skb->xmit_more || stop_queue ||
-	    netif_xmit_stopped(netdev_get_tx_queue(dev, 0))) {
-		RTL_W8(TxPoll, NPQ);
-
-		mmiowb();
-	}
+	mmiowb();
 
-	if (stop_queue) {
+	if (!TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
 		/* Avoid wrongly optimistic queue wake-up: rtl_tx thread must
 		 * not miss a ring update when it notices a stopped queue.
 		 */
@@ -7198,7 +7188,6 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev)
 static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
 {
 	unsigned int dirty_tx, tx_left;
-	unsigned int bytes_compl = 0, pkts_compl = 0;
 
 	dirty_tx = tp->dirty_tx;
 	smp_rmb();
@@ -7222,8 +7211,10 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
 		rtl8169_unmap_tx_skb(&tp->pci_dev->dev, tx_skb,
 				     tp->TxDescArray + entry);
 		if (status & LastFrag) {
-			pkts_compl++;
-			bytes_compl += tx_skb->skb->len;
+			u64_stats_update_begin(&tp->tx_stats.syncp);
+			tp->tx_stats.packets++;
+			tp->tx_stats.bytes += tx_skb->skb->len;
+			u64_stats_update_end(&tp->tx_stats.syncp);
 			dev_kfree_skb_any(tx_skb->skb);
 			tx_skb->skb = NULL;
 		}
@@ -7232,13 +7223,6 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
 	}
 
 	if (tp->dirty_tx != dirty_tx) {
-		netdev_completed_queue(tp->dev, pkts_compl, bytes_compl);
-
-		u64_stats_update_begin(&tp->tx_stats.syncp);
-		tp->tx_stats.packets += pkts_compl;
-		tp->tx_stats.bytes += bytes_compl;
-		u64_stats_update_end(&tp->tx_stats.syncp);
-
 		tp->dirty_tx = dirty_tx;
 		/* Sync with rtl8169_start_xmit:
 		 * - publish dirty_tx ring index (write barrier)
Signature · 1 line
2.1.0