[MTHCA] return a real max_map_per_fmr
authorsleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 13 Dec 2006 07:50:04 +0000 (07:50 +0000)
committersleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 13 Dec 2006 07:50:04 +0000 (07:50 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@557 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mthca/kernel/mthca_provider.c

index 81f811e..6618cec 100644 (file)
@@ -128,6 +128,17 @@ int mthca_query_device(struct ib_device *ibdev,
        props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * 
                                           props->max_mcast_grp;
 
+       /*
+        * If Sinai memory key optimization is being used, then only
+        * the 8-bit key portion will change.  For other HCAs, the
+        * unused index bits will also be used for FMR remapping.
+        */
+       if (mdev->mthca_flags & MTHCA_FLAG_SINAI_OPT)
+               props->max_map_per_fmr = 255;
+       else
+               props->max_map_per_fmr =
+                       (1 << (32 - long_log2(mdev->limits.num_mpts))) - 1;
+
        err = 0;
  out:
        kfree(in_mad);