[ofa-general] Re: [PATCH]: mlx4: move table_find from fmr_alloc to fmr_enable

Roland Dreier rdreier at cisco.com
Mon Feb 18 11:48:48 PST 2008


 > I'm nervous about freeing ICM table entries when HW2SW fails (hw may still access the
 > memory.

Hmm, from that point of view, the current code is risky because it
frees the MTT entries even if HW2SW_MPT fails.  Maybe the below:

 > (P.S., please note the priv-> in the patch).

heh, I compiled my tree this time, and I even put both closing
parenthesis in "key_to_hw_index(mr->key));"  ;)


diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
index 79b317b..a185c44 100644
--- a/drivers/net/mlx4/mr.c
+++ b/drivers/net/mlx4/mr.c
@@ -285,8 +285,13 @@ void mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr)
 		err = mlx4_HW2SW_MPT(dev, NULL,
 				     key_to_hw_index(mr->key) &
 				     (dev->caps.num_mpts - 1));
-		if (err)
+		if (err) {
 			mlx4_warn(dev, "HW2SW_MPT failed (%d)\n", err);
+			return;
+		}
+
+		mlx4_table_put(dev, &priv->mr_table.dmpt_table,
+			       key_to_hw_index(mr->key));
 	}
 
 	mlx4_mtt_cleanup(dev, &mr->mtt);



More information about the general mailing list