diff options
| -rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 46 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.h | 2 |
2 files changed, 24 insertions, 24 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); |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index 691f90ff2d83..dec74d4c4bad 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h | |||
| @@ -144,8 +144,6 @@ struct isert_device { | |||
| 144 | int refcount; | 144 | int refcount; |
| 145 | int cq_active_qps[ISERT_MAX_CQ]; | 145 | int cq_active_qps[ISERT_MAX_CQ]; |
| 146 | struct ib_device *ib_device; | 146 | struct ib_device *ib_device; |
| 147 | struct ib_pd *dev_pd; | ||
| 148 | struct ib_mr *dev_mr; | ||
| 149 | struct ib_cq *dev_rx_cq[ISERT_MAX_CQ]; | 147 | struct ib_cq *dev_rx_cq[ISERT_MAX_CQ]; |
| 150 | struct ib_cq *dev_tx_cq[ISERT_MAX_CQ]; | 148 | struct ib_cq *dev_tx_cq[ISERT_MAX_CQ]; |
| 151 | struct isert_cq_desc *cq_desc; | 149 | struct isert_cq_desc *cq_desc; |
