Skip to contentSkip to conversation

- Fix transmit queue stop mechanism

PATCH In review Divy Le Ray 2 participants 2 messages Mar 13, 2008 – Mar 17, 2008

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

PATCH 1/1 - Fix transmit queue stop mechanism

From: Divy Le Ray <[email protected]>

The last change in the Tx queue stop mechanism opens a window where the Tx queue might be stopped after pending credits returned.

Tx credits are returned via a control message generated by the HW. It returns tx credits on demand, triggered by a completion bit set in selective transmit packet headers.

The current code can lead to the Tx queue stopped with all pending credits returned, and the current frame not triggering a credit return. The Tx queue will then never be awaken.

The driver could alternatively request a completion for packets that stop the queue. It's however safer at this point to go back to the pre-existing behaviour.

---

 drivers/net/cxgb3/sge.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/cxgb3/sge.c +9 -3
index 979f3fc..db58687 100644
@@ -1107,9 +1107,15 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 	q->in_use += ndesc;
-	if (unlikely(credits - ndesc < q->stop_thres))
-		if (USE_GTS || !should_restart_tx(q))
-			t3_stop_queue(dev, qs, q);
+	if (unlikely(credits - ndesc < q->stop_thres)) {
+		t3_stop_queue(dev, qs, q);
+
+		if (should_restart_tx(q) &&
+		    test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) {
+			q->restarts++;
+			netif_wake_queue(dev);
+		}
+	}
 
 	gen = q->gen;
 	q->unacked += ndesc;
#1 lore raw
Quoted 19 lines · Divy Le Ray

From: Divy Le Ray <[email protected]>

The last change in the Tx queue stop mechanism opens a window where the Tx queue might be stopped after pending credits returned.

Tx credits are returned via a control message generated by the HW. It returns tx credits on demand, triggered by a completion bit set in selective transmit packet headers.

The current code can lead to the Tx queue stopped with all pending credits returned, and the current frame not triggering a credit return. The Tx queue will then never be awaken.

The driver could alternatively request a completion for packets that stop the queue. It's however safer at this point to go back to the pre-existing behaviour.

Quoted 5 lines

---

 drivers/net/cxgb3/sge.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

applied -- please include "cxgb3: " prefix in your subject line next time.

See http://linux.yyz.us/patch-format.html for more info.

Jeff