aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c31
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.h3
2 files changed, 21 insertions, 13 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 4ec7dddbbf49..376d640487d2 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2300,7 +2300,7 @@ static void srp_add_one(struct ib_device *device)
2300 struct ib_device_attr *dev_attr; 2300 struct ib_device_attr *dev_attr;
2301 struct ib_fmr_pool_param fmr_param; 2301 struct ib_fmr_pool_param fmr_param;
2302 struct srp_host *host; 2302 struct srp_host *host;
2303 int fmr_page_shift, s, e, p; 2303 int max_pages_per_fmr, fmr_page_shift, s, e, p;
2304 2304
2305 dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL); 2305 dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL);
2306 if (!dev_attr) 2306 if (!dev_attr)
@@ -2340,17 +2340,24 @@ static void srp_add_one(struct ib_device *device)
2340 if (IS_ERR(srp_dev->mr)) 2340 if (IS_ERR(srp_dev->mr))
2341 goto err_pd; 2341 goto err_pd;
2342 2342
2343 memset(&fmr_param, 0, sizeof fmr_param); 2343 for (max_pages_per_fmr = SRP_FMR_SIZE;
2344 fmr_param.pool_size = SRP_FMR_POOL_SIZE; 2344 max_pages_per_fmr >= SRP_FMR_MIN_SIZE;
2345 fmr_param.dirty_watermark = SRP_FMR_DIRTY_SIZE; 2345 max_pages_per_fmr /= 2, srp_dev->fmr_max_size /= 2) {
2346 fmr_param.cache = 1; 2346 memset(&fmr_param, 0, sizeof fmr_param);
2347 fmr_param.max_pages_per_fmr = SRP_FMR_SIZE; 2347 fmr_param.pool_size = SRP_FMR_POOL_SIZE;
2348 fmr_param.page_shift = fmr_page_shift; 2348 fmr_param.dirty_watermark = SRP_FMR_DIRTY_SIZE;
2349 fmr_param.access = (IB_ACCESS_LOCAL_WRITE | 2349 fmr_param.cache = 1;
2350 IB_ACCESS_REMOTE_WRITE | 2350 fmr_param.max_pages_per_fmr = max_pages_per_fmr;
2351 IB_ACCESS_REMOTE_READ); 2351 fmr_param.page_shift = fmr_page_shift;
2352 2352 fmr_param.access = (IB_ACCESS_LOCAL_WRITE |
2353 srp_dev->fmr_pool = ib_create_fmr_pool(srp_dev->pd, &fmr_param); 2353 IB_ACCESS_REMOTE_WRITE |
2354 IB_ACCESS_REMOTE_READ);
2355
2356 srp_dev->fmr_pool = ib_create_fmr_pool(srp_dev->pd, &fmr_param);
2357 if (!IS_ERR(srp_dev->fmr_pool))
2358 break;
2359 }
2360
2354 if (IS_ERR(srp_dev->fmr_pool)) 2361 if (IS_ERR(srp_dev->fmr_pool))
2355 srp_dev->fmr_pool = NULL; 2362 srp_dev->fmr_pool = NULL;
2356 2363
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
index cf696218eeeb..020caf0c3789 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.h
+++ b/drivers/infiniband/ulp/srp/ib_srp.h
@@ -69,7 +69,8 @@ enum {
69 SRP_TAG_NO_REQ = ~0U, 69 SRP_TAG_NO_REQ = ~0U,
70 SRP_TAG_TSK_MGMT = 1U << 31, 70 SRP_TAG_TSK_MGMT = 1U << 31,
71 71
72 SRP_FMR_SIZE = 256, 72 SRP_FMR_SIZE = 512,
73 SRP_FMR_MIN_SIZE = 128,
73 SRP_FMR_POOL_SIZE = 1024, 74 SRP_FMR_POOL_SIZE = 1024,
74 SRP_FMR_DIRTY_SIZE = SRP_FMR_POOL_SIZE / 4, 75 SRP_FMR_DIRTY_SIZE = SRP_FMR_POOL_SIZE / 4,
75 76