[ofa-general] [PATCH] mlx4: Do not invoke mlx4_bitmap_free for special QPs

Jack Morgenstein jackm at dev.mellanox.co.il
Mon Aug 6 07:11:58 PDT 2007


mlx4_bitmap_free should not be called for special QPs.

Found by Dotan Barak of Mellanox
Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>

Index: infiniband/drivers/infiniband/hw/mlx4/qp.c
===================================================================
--- infiniband.orig/drivers/infiniband/hw/mlx4/qp.c	2007-08-06 17:02:03.314019000 +0300
+++ infiniband/drivers/infiniband/hw/mlx4/qp.c	2007-08-06 17:02:21.790886000 +0300
@@ -508,7 +508,7 @@ static void destroy_qp_common(struct mlx
 
 	mlx4_ib_unlock_cqs(send_cq, recv_cq);
 
-	mlx4_qp_free(dev->dev, &qp->mqp);
+	mlx4_qp_free(dev->dev, is_sqp(dev, qp), &qp->mqp);
 	mlx4_mtt_cleanup(dev->dev, &qp->mtt);
 
 	if (is_user) {
Index: infiniband/drivers/net/mlx4/qp.c
===================================================================
--- infiniband.orig/drivers/net/mlx4/qp.c	2007-08-06 17:02:03.321009000 +0300
+++ infiniband/drivers/net/mlx4/qp.c	2007-08-06 17:02:21.798883000 +0300
@@ -226,7 +226,7 @@ void mlx4_qp_remove(struct mlx4_dev *dev
 }
 EXPORT_SYMBOL_GPL(mlx4_qp_remove);
 
-void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp)
+void mlx4_qp_free(struct mlx4_dev *dev, int is_sqp, struct mlx4_qp *qp)
 {
 	struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
 
@@ -240,7 +240,8 @@ void mlx4_qp_free(struct mlx4_dev *dev, 
 	mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn);
 	mlx4_table_put(dev, &qp_table->qp_table, qp->qpn);
 
-	mlx4_bitmap_free(&qp_table->bitmap, qp->qpn);
+	if (!is_sqp)
+		mlx4_bitmap_free(&qp_table->bitmap, qp->qpn);
 }
 EXPORT_SYMBOL_GPL(mlx4_qp_free);
 
Index: infiniband/include/linux/mlx4/device.h
===================================================================
--- infiniband.orig/include/linux/mlx4/device.h	2007-08-06 17:02:03.327010000 +0300
+++ infiniband/include/linux/mlx4/device.h	2007-08-06 17:02:21.805935000 +0300
@@ -317,7 +317,7 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, 
 void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
 
 int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp);
-void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp);
+void mlx4_qp_free(struct mlx4_dev *dev, int is_sqp, struct mlx4_qp *qp);
 
 int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt,
 		   u64 db_rec, struct mlx4_srq *srq);



More information about the general mailing list