]> err.no Git - linux-2.6/commitdiff
IB/mthca: Fill in max_map_per_fmr device attribute
authorOr Gerlitz <ogerlitz@voltaire.com>
Sun, 18 Jun 2006 03:37:37 +0000 (20:37 -0700)
committerRoland Dreier <rolandd@cisco.com>
Sun, 18 Jun 2006 03:37:37 +0000 (20:37 -0700)
Report the true max_map_per_fmr value from mthca_query_device(),
taking into account the change in FMR remapping introduced by the
Sinai performance optimization.

Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mthca/mthca_provider.c

index a2eae8a30167e3d9cc076b6885028c54485a8285..8f89ba7c9147ee2c034d0db05aa940bd8f646aad 100644 (file)
@@ -115,6 +115,16 @@ static int mthca_query_device(struct ib_device *ibdev,
        props->max_mcast_qp_attach = MTHCA_QP_PER_MGM;
        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: