[openib-general] [PATCH] ipoib: tx ring overrun

Michael S. Tsirkin mst at mellanox.co.il
Tue Jan 10 10:55:15 PST 2006


Dont try to post more send work requests if the TX ring is full.
Setting netif_stop_queue is insufficient: linux can still land
a tx packet on us.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: openib/drivers/infiniband/ulp/ipoib/ipoib_ib.c
===================================================================
--- openib.orig/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2006-01-10 15:38:36.000000000 +0200
+++ openib/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2006-01-10 18:49:33.000000000 +0200
@@ -344,6 +344,13 @@ void ipoib_send(struct net_device *dev, 
 	 * means we have to make sure everything is properly recorded and
 	 * our state is consistent before we call post_send().
 	 */
+	if (unlikely(priv->tx_head - priv->tx_tail == IPOIB_TX_RING_SIZE)) {
+		ipoib_dbg(priv, "TX ring full, dropping packet\n");
+		++priv->stats.tx_errors;
+		dev_kfree_skb_any(skb);
+		return;
+	}
+
 	tx_req = &priv->tx_ring[priv->tx_head & (IPOIB_TX_RING_SIZE - 1)];
 	tx_req->skb = skb;
 	addr = dma_map_single(priv->ca->dma_device, skb->data, skb->len,

-- 
MST



More information about the general mailing list