[openib-general] Calculation of maximum number of FMR remaps in mthca driver
Moni Shoua
monis at voltaire.com
Thu Mar 30 09:54:15 PST 2006
Hi,
Belwo is a suggested patch that makes ib_query_device (or more
precisely mthca_query device) to return the number of max_map_per_fmr
instead of zero.
This is used by ib_create_fmr_pool as the number for maximum allowed FMR
remaps instead of the constant IB_FMR_MAX_REMAPS.
Since this is only a suggestion for now I let myslf not to take care of
the other drivers for now.
I would be happy to get a feedback on this from the Mellanox driver guys
about the correctness of the calculation.
thanks
Moni S.
Index: infiniband/core/fmr_pool.c
===================================================================
--- infiniband/core/fmr_pool.c (revision 8504)
+++ infiniband/core/fmr_pool.c (working copy)
@@ -214,6 +214,7 @@
{
struct ib_device *device;
struct ib_fmr_pool *pool;
+ struct ib_device_attr device_attr;
int i;
int ret;
@@ -228,6 +229,12 @@
return ERR_PTR(-ENOSYS);
}
+ ret = ib_query_device(device, &device_attr);
+ if (ret) {
+ printk(KERN_WARNING "couldn't query device");
+ return ERR_PTR(ret);
+ }
+
pool = kmalloc(sizeof *pool, GFP_KERNEL);
if (!pool) {
printk(KERN_WARNING "couldn't allocate pool struct");
@@ -279,7 +286,7 @@
struct ib_pool_fmr *fmr;
struct ib_fmr_attr attr = {
.max_pages = params->max_pages_per_fmr,
- .max_maps = IB_FMR_MAX_REMAPS,
+ .max_maps = device_attr.max_map_per_fmr,
.page_shift = params->page_shift
};
Index: infiniband/hw/mthca/mthca_provider.c
===================================================================
--- infiniband/hw/mthca/mthca_provider.c (revision 8504)
+++ infiniband/hw/mthca/mthca_provider.c (working copy)
@@ -116,6 +116,8 @@
props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
props->max_mcast_grp;
+ props->max_map_per_fmr=(1 << (32 -
long_log2(mdev->limits.num_mpts))) - 1;
+
err = 0;
out:
kfree(in_mad)
More information about the general
mailing list