[ofa-general] [PATCH]: mlx4: move table_find from fmr_alloc to fmr_enable
Jack Morgenstein
jackm at dev.mellanox.co.il
Thu Feb 14 03:41:29 PST 2008
mlx4: move table_find from fmr_alloc to fmr_enable.
mlx4_table_find (for fmr mpt's) requires that ICM memory already
be mapped. Before this fix, fmr allocation depended on ICM memory
already being mapped for the mpt entry. If all currently mapped
entries are taken, the find operation fails (even if the ICM mpt
table still had more entries, which were as yet unmapped).
This fix moves the mpt find operation to fmr_enable, to guarantee
that any required ICM memory mapping has already occurred.
Found by: Oren Duer of Mellanox
Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>
Index: ofed_kernel/drivers/infiniband/hw/mlx4/mr.c
===================================================================
--- ofed_kernel.orig/drivers/infiniband/hw/mlx4/mr.c 2007-12-05 10:34:47.000000000 +0200
+++ ofed_kernel/drivers/infiniband/hw/mlx4/mr.c 2008-02-14 12:05:08.661414000 +0200
@@ -199,7 +199,7 @@ struct ib_fmr *mlx4_ib_fmr_alloc(struct
if (err)
goto err_free;
- err = mlx4_mr_enable(to_mdev(pd->device)->dev, &fmr->mfmr.mr);
+ err = mlx4_fmr_enable(to_mdev(pd->device)->dev, &fmr->mfmr);
if (err)
goto err_mr;
Index: ofed_kernel/drivers/net/mlx4/mr.c
===================================================================
--- ofed_kernel.orig/drivers/net/mlx4/mr.c 2007-12-05 10:34:53.000000000 +0200
+++ ofed_kernel/drivers/net/mlx4/mr.c 2008-02-14 12:12:26.302248000 +0200
@@ -578,13 +578,6 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev,
goto err_free;
}
- fmr->mpt = mlx4_table_find(&priv->mr_table.dmpt_table,
- key_to_hw_index(fmr->mr.key), NULL);
- if (!fmr->mpt) {
- err = -ENOMEM;
- goto err_free;
- }
-
return 0;
err_free:
@@ -595,7 +588,19 @@ EXPORT_SYMBOL_GPL(mlx4_fmr_alloc);
int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
{
- return mlx4_mr_enable(dev, &fmr->mr);
+ struct mlx4_priv *priv = mlx4_priv(dev);
+ int err;
+
+ err = mlx4_mr_enable(dev, &fmr->mr);
+ if (err)
+ return err;
+
+ fmr->mpt = mlx4_table_find(&priv->mr_table.dmpt_table,
+ key_to_hw_index(fmr->mr.key), NULL);
+ if (!fmr->mpt)
+ return -ENOMEM;
+
+ return 0;
}
EXPORT_SYMBOL_GPL(mlx4_fmr_enable);
More information about the general
mailing list