[ofw] mlx4: move table_find from fmr_alloc to fmr_enable.

Tzachi Dar tzachid at mellanox.co.il
Mon May 5 13:52:52 PDT 2008


Here is the Linux description of the patch named:
mlx4_0270_fmr_enable.patch

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
<mailto:jackm at dev.mellanox.co.il> >

 
Bellow is the windows porting of the patch.
Important info: This patch was tested using a specific fmr tests. SRP
which also used fmr was not tested. I'll be very happy if one can test
that.
 
Thanks
Tzachi
 
Index: mlx4/kernel/bus/ib/mr.c
 
===================================================================
 
--- mlx4/kernel/bus/ib/mr.c (revision 1126)
 
+++ mlx4/kernel/bus/ib/mr.c (working copy)
 
@@ -198,7 +198,7 @@
 
  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.mr);
  if (err)
   goto err_mr;
 
Index: mlx4/kernel/bus/net/mr.c
 
===================================================================
 
--- mlx4/kernel/bus/net/mr.c (revision 1126)
 
+++ mlx4/kernel/bus/net/mr.c (working copy)
 
@@ -576,14 +576,6 @@
 
   err = -ENOMEM;
   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:
@@ -594,7 +586,19 @@
 
 
 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);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080505/26252301/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fmr.diff
Type: application/octet-stream
Size: 1298 bytes
Desc: fmr.diff
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080505/26252301/attachment.obj>


More information about the ofw mailing list