diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2014-01-09 11:40:49 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-01-18 21:22:07 -0500 |
commit | eb6ab13267be87dcad3e611500b7cb404ed4479c (patch) | |
tree | ae774616fe515a28b181713959e820616bd45aaf /drivers/infiniband/ulp/isert/ib_isert.c | |
parent | 59dedde2b67130bf81a2df55df464909c7459df5 (diff) |
IB/isert: seperate connection protection domains and dma MRs
It is more correct to seperate connections protection domains
and dma_mr handles. protection information support requires to
do so.
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/infiniband/ulp/isert/ib_isert.c')
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 6be57c38638d..3dd24272b1cd 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -248,13 +248,6 @@ isert_create_device_ib_res(struct isert_device *device) | |||
248 | } | 248 | } |
249 | cq_desc = device->cq_desc; | 249 | cq_desc = device->cq_desc; |
250 | 250 | ||
251 | device->dev_pd = ib_alloc_pd(ib_dev); | ||
252 | if (IS_ERR(device->dev_pd)) { | ||
253 | ret = PTR_ERR(device->dev_pd); | ||
254 | pr_err("ib_alloc_pd failed for dev_pd: %d\n", ret); | ||
255 | goto out_cq_desc; | ||
256 | } | ||
257 | |||
258 | for (i = 0; i < device->cqs_used; i++) { | 251 | for (i = 0; i < device->cqs_used; i++) { |
259 | cq_desc[i].device = device; | 252 | cq_desc[i].device = device; |
260 | cq_desc[i].cq_index = i; | 253 | cq_desc[i].cq_index = i; |
@@ -282,13 +275,6 @@ isert_create_device_ib_res(struct isert_device *device) | |||
282 | goto out_cq; | 275 | goto out_cq; |
283 | } | 276 | } |
284 | 277 | ||
285 | device->dev_mr = ib_get_dma_mr(device->dev_pd, IB_ACCESS_LOCAL_WRITE); | ||
286 | if (IS_ERR(device->dev_mr)) { | ||
287 | ret = PTR_ERR(device->dev_mr); | ||
288 | pr_err("ib_get_dma_mr failed for dev_mr: %d\n", ret); | ||
289 | goto out_cq; | ||
290 | } | ||
291 | |||
292 | return 0; | 278 | return 0; |
293 | 279 | ||
294 | out_cq: | 280 | out_cq: |
@@ -304,9 +290,6 @@ out_cq: | |||
304 | ib_destroy_cq(device->dev_tx_cq[j]); | 290 | ib_destroy_cq(device->dev_tx_cq[j]); |
305 | } | 291 | } |
306 | } | 292 | } |
307 | ib_dealloc_pd(device->dev_pd); | ||
308 | |||
309 | out_cq_desc: | ||
310 | kfree(device->cq_desc); | 293 | kfree(device->cq_desc); |
311 | 294 | ||
312 | return ret; | 295 | return ret; |
@@ -329,8 +312,6 @@ isert_free_device_ib_res(struct isert_device *device) | |||
329 | device->dev_tx_cq[i] = NULL; | 312 | device->dev_tx_cq[i] = NULL; |
330 | } | 313 | } |
331 | 314 | ||
332 | ib_dereg_mr(device->dev_mr); | ||
333 | ib_dealloc_pd(device->dev_pd); | ||
334 | kfree(device->cq_desc); | 315 | kfree(device->cq_desc); |
335 | } | 316 | } |
336 | 317 | ||
@@ -437,7 +418,7 @@ isert_conn_create_frwr_pool(struct isert_conn *isert_conn) | |||
437 | goto err; | 418 | goto err; |
438 | } | 419 | } |
439 | 420 | ||
440 | fr_desc->data_mr = ib_alloc_fast_reg_mr(device->dev_pd, | 421 | fr_desc->data_mr = ib_alloc_fast_reg_mr(isert_conn->conn_pd, |
441 | ISCSI_ISER_SG_TABLESIZE); | 422 | ISCSI_ISER_SG_TABLESIZE); |
442 | if (IS_ERR(fr_desc->data_mr)) { | 423 | if (IS_ERR(fr_desc->data_mr)) { |
443 | pr_err("Failed to allocate frmr err=%ld\n", | 424 | pr_err("Failed to allocate frmr err=%ld\n", |
@@ -546,8 +527,22 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
546 | } | 527 | } |
547 | 528 | ||
548 | isert_conn->conn_device = device; | 529 | isert_conn->conn_device = device; |
549 | isert_conn->conn_pd = device->dev_pd; | 530 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); |
550 | isert_conn->conn_mr = device->dev_mr; | 531 | if (IS_ERR(isert_conn->conn_pd)) { |
532 | ret = PTR_ERR(isert_conn->conn_pd); | ||
533 | pr_err("ib_alloc_pd failed for conn %p: ret=%d\n", | ||
534 | isert_conn, ret); | ||
535 | goto out_pd; | ||
536 | } | ||
537 | |||
538 | isert_conn->conn_mr = ib_get_dma_mr(isert_conn->conn_pd, | ||
539 | IB_ACCESS_LOCAL_WRITE); | ||
540 | if (IS_ERR(isert_conn->conn_mr)) { | ||
541 | ret = PTR_ERR(isert_conn->conn_mr); | ||
542 | pr_err("ib_get_dma_mr failed for conn %p: ret=%d\n", | ||
543 | isert_conn, ret); | ||
544 | goto out_mr; | ||
545 | } | ||
551 | 546 | ||
552 | if (device->use_frwr) { | 547 | if (device->use_frwr) { |
553 | ret = isert_conn_create_frwr_pool(isert_conn); | 548 | ret = isert_conn_create_frwr_pool(isert_conn); |
@@ -573,6 +568,10 @@ out_conn_dev: | |||
573 | if (device->use_frwr) | 568 | if (device->use_frwr) |
574 | isert_conn_free_frwr_pool(isert_conn); | 569 | isert_conn_free_frwr_pool(isert_conn); |
575 | out_frwr: | 570 | out_frwr: |
571 | ib_dereg_mr(isert_conn->conn_mr); | ||
572 | out_mr: | ||
573 | ib_dealloc_pd(isert_conn->conn_pd); | ||
574 | out_pd: | ||
576 | isert_device_try_release(device); | 575 | isert_device_try_release(device); |
577 | out_rsp_dma_map: | 576 | out_rsp_dma_map: |
578 | ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, | 577 | ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, |
@@ -611,6 +610,9 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
611 | isert_free_rx_descriptors(isert_conn); | 610 | isert_free_rx_descriptors(isert_conn); |
612 | rdma_destroy_id(isert_conn->conn_cm_id); | 611 | rdma_destroy_id(isert_conn->conn_cm_id); |
613 | 612 | ||
613 | ib_dereg_mr(isert_conn->conn_mr); | ||
614 | ib_dealloc_pd(isert_conn->conn_pd); | ||
615 | |||
614 | if (isert_conn->login_buf) { | 616 | if (isert_conn->login_buf) { |
615 | ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, | 617 | ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, |
616 | ISER_RX_LOGIN_SIZE, DMA_TO_DEVICE); | 618 | ISER_RX_LOGIN_SIZE, DMA_TO_DEVICE); |