> 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);
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to