Re: 1e918876 breaks r8169 (linux-3.18+)

From: Eric Dumazet
Date: Sat Feb 21 2015 - 14:54:15 EST


On Sat, 2015-02-21 at 20:05 +0100, Tomas Szepe wrote:

> 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 ?

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index ad0020af2193..18d0decb5093 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -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).


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/