[openib-general] [PATCHv2 1/2] mthca support for max_map_per_fmr device attribute

Or Gerlitz ogerlitz at voltaire.com
Sun May 28 05:02:19 PDT 2006


OK, here's a modified version of the patch to support both mem full/free HCAs, 
in the memfree case the code relies on this quote from the (section 4.2 pp 45) 
memfree PRM:

"A memory key is composed of two fields, a 24-bit index and an 8-bit key. 
The key field is an arbitrarily chosen number. The index field is unique 
number used as an index to an MPT table entry, ..."

Or.

implement max_map_per_fmr device attribute for mthca

Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>

Index: hw/mthca/mthca_provider.c
===================================================================
--- hw/mthca/mthca_provider.c	(revision 7031)
+++ hw/mthca/mthca_provider.c	(working copy)
@@ -116,6 +116,15 @@ static int mthca_query_device(struct ib_
  	props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
  					   props->max_mcast_grp;

+	/* on memfull HCA an FMR can be remapped 2^B - 1 times where B < 32 is 
+	 * the number of bits which are not used for MPT addressing, on memfree
+	 * HCA B=8 so an FMR can be remapped 255 times.
+	 */
+	if(!mthca_is_memfree(mdev))
+		props->max_map_per_fmr = (1 << (32 - 
+					long_log2(mdev->limits.num_mpts))) - 1;
+	else
+		props->max_map_per_fmr = (1 << 8) - 1;
  	err = 0;
   out:
  	kfree(in_mad);





More information about the general mailing list