[ewg] [PATCH] non srq panic patch

David J. Wilder dwilder at us.ibm.com
Wed Jun 25 15:31:17 PDT 2008


This patch fixes a panic when shared receive queues are not used.

Signed-off-by: David Wilder <dwilder at us.ibm.com>
---
 drivers/infiniband/ulp/ipoib/ipoib_cm.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 41bed52..955934a 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -231,7 +231,10 @@ static void ipoib_cm_free_rx_ring(struct net_device *dev,
 			dev_kfree_skb_any(rx_ring[i].skb);
 		}
 
-	ipoib_vfree(&priv->cm.rx_vmap_srq_ring);
+	if (ipoib_cm_has_srq(dev))
+		ipoib_vfree(&priv->cm.rx_vmap_srq_ring);
+	else
+		kfree(rx_ring);
 }
 
 static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv *priv)
@@ -1605,21 +1608,21 @@ void ipoib_cm_dev_cleanup(struct net_device *dev)
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
 	int ret;
 
+	ipoib_dbg(priv, "Cleanup ipoib connected mode.\n");
+
 	if (!priv->cm.srq)
 		return;
 
-	ipoib_dbg(priv, "Cleanup ipoib connected mode.\n");
+	if (priv->cm.srq_ring) {
+		ipoib_cm_free_rx_ring(dev, priv->cm.srq_ring);
+		priv->cm.srq_ring = NULL;
+	}
 
 	ret = ib_destroy_srq(priv->cm.srq);
 	if (ret)
 		ipoib_warn(priv, "ib_destroy_srq failed: %d\n", ret);
-
-	priv->cm.srq = NULL;
-	if (!priv->cm.srq_ring)
-		return;
-
-	ipoib_cm_free_rx_ring(dev, priv->cm.srq_ring);
-	priv->cm.srq_ring = NULL;
+	else
+		priv->cm.srq = NULL;
 
 	ipoib_vfree(&priv->cm.rx_vmap_wr_arr);
 }





More information about the ewg mailing list