diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-07 16:33:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-07 16:33:07 -0500 |
commit | ab9f2faf8f40604551336e5b0a18e0910a57b92c (patch) | |
tree | 9068c73acf24452762d6e2b096df19e29436183e /drivers/infiniband/hw/qib/qib_mr.c | |
parent | 75021d28594d9b6fb4d05bbc41f77948a0db0e02 (diff) | |
parent | db7489e07669073970358b6cacf6a9dd8dc9275e (diff) |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull rdma updates from Doug Ledford:
"This is my initial round of 4.4 merge window patches. There are a few
other things I wish to get in for 4.4 that aren't in this pull, as
this represents what has gone through merge/build/run testing and not
what is the last few items for which testing is not yet complete.
- "Checksum offload support in user space" enablement
- Misc cxgb4 fixes, add T6 support
- Misc usnic fixes
- 32 bit build warning fixes
- Misc ocrdma fixes
- Multicast loopback prevention extension
- Extend the GID cache to store and return attributes of GIDs
- Misc iSER updates
- iSER clustering update
- Network NameSpace support for rdma CM
- Work Request cleanup series
- New Memory Registration API"
* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (76 commits)
IB/core, cma: Make __attribute_const__ declarations sparse-friendly
IB/core: Remove old fast registration API
IB/ipath: Remove fast registration from the code
IB/hfi1: Remove fast registration from the code
RDMA/nes: Remove old FRWR API
IB/qib: Remove old FRWR API
iw_cxgb4: Remove old FRWR API
RDMA/cxgb3: Remove old FRWR API
RDMA/ocrdma: Remove old FRWR API
IB/mlx4: Remove old FRWR API support
IB/mlx5: Remove old FRWR API support
IB/srp: Dont allocate a page vector when using fast_reg
IB/srp: Remove srp_finish_mapping
IB/srp: Convert to new registration API
IB/srp: Split srp_map_sg
RDS/IW: Convert to new memory registration API
svcrdma: Port to new memory registration API
xprtrdma: Port to new memory registration API
iser-target: Port to new memory registration API
IB/iser: Port to new fast registration API
...
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_mr.c')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_mr.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/drivers/infiniband/hw/qib/qib_mr.c b/drivers/infiniband/hw/qib/qib_mr.c index 19220dcb9a3b..294f5c706be9 100644 --- a/drivers/infiniband/hw/qib/qib_mr.c +++ b/drivers/infiniband/hw/qib/qib_mr.c | |||
@@ -303,6 +303,7 @@ int qib_dereg_mr(struct ib_mr *ibmr) | |||
303 | int ret = 0; | 303 | int ret = 0; |
304 | unsigned long timeout; | 304 | unsigned long timeout; |
305 | 305 | ||
306 | kfree(mr->pages); | ||
306 | qib_free_lkey(&mr->mr); | 307 | qib_free_lkey(&mr->mr); |
307 | 308 | ||
308 | qib_put_mr(&mr->mr); /* will set completion if last */ | 309 | qib_put_mr(&mr->mr); /* will set completion if last */ |
@@ -323,7 +324,7 @@ out: | |||
323 | 324 | ||
324 | /* | 325 | /* |
325 | * Allocate a memory region usable with the | 326 | * Allocate a memory region usable with the |
326 | * IB_WR_FAST_REG_MR send work request. | 327 | * IB_WR_REG_MR send work request. |
327 | * | 328 | * |
328 | * Return the memory region on success, otherwise return an errno. | 329 | * Return the memory region on success, otherwise return an errno. |
329 | */ | 330 | */ |
@@ -340,37 +341,38 @@ struct ib_mr *qib_alloc_mr(struct ib_pd *pd, | |||
340 | if (IS_ERR(mr)) | 341 | if (IS_ERR(mr)) |
341 | return (struct ib_mr *)mr; | 342 | return (struct ib_mr *)mr; |
342 | 343 | ||
344 | mr->pages = kcalloc(max_num_sg, sizeof(u64), GFP_KERNEL); | ||
345 | if (!mr->pages) | ||
346 | goto err; | ||
347 | |||
343 | return &mr->ibmr; | 348 | return &mr->ibmr; |
349 | |||
350 | err: | ||
351 | qib_dereg_mr(&mr->ibmr); | ||
352 | return ERR_PTR(-ENOMEM); | ||
344 | } | 353 | } |
345 | 354 | ||
346 | struct ib_fast_reg_page_list * | 355 | static int qib_set_page(struct ib_mr *ibmr, u64 addr) |
347 | qib_alloc_fast_reg_page_list(struct ib_device *ibdev, int page_list_len) | ||
348 | { | 356 | { |
349 | unsigned size = page_list_len * sizeof(u64); | 357 | struct qib_mr *mr = to_imr(ibmr); |
350 | struct ib_fast_reg_page_list *pl; | ||
351 | |||
352 | if (size > PAGE_SIZE) | ||
353 | return ERR_PTR(-EINVAL); | ||
354 | |||
355 | pl = kzalloc(sizeof(*pl), GFP_KERNEL); | ||
356 | if (!pl) | ||
357 | return ERR_PTR(-ENOMEM); | ||
358 | 358 | ||
359 | pl->page_list = kzalloc(size, GFP_KERNEL); | 359 | if (unlikely(mr->npages == mr->mr.max_segs)) |
360 | if (!pl->page_list) | 360 | return -ENOMEM; |
361 | goto err_free; | ||
362 | 361 | ||
363 | return pl; | 362 | mr->pages[mr->npages++] = addr; |
364 | 363 | ||
365 | err_free: | 364 | return 0; |
366 | kfree(pl); | ||
367 | return ERR_PTR(-ENOMEM); | ||
368 | } | 365 | } |
369 | 366 | ||
370 | void qib_free_fast_reg_page_list(struct ib_fast_reg_page_list *pl) | 367 | int qib_map_mr_sg(struct ib_mr *ibmr, |
368 | struct scatterlist *sg, | ||
369 | int sg_nents) | ||
371 | { | 370 | { |
372 | kfree(pl->page_list); | 371 | struct qib_mr *mr = to_imr(ibmr); |
373 | kfree(pl); | 372 | |
373 | mr->npages = 0; | ||
374 | |||
375 | return ib_sg_to_pages(ibmr, sg, sg_nents, qib_set_page); | ||
374 | } | 376 | } |
375 | 377 | ||
376 | /** | 378 | /** |