diff options
| author | Or Gerlitz <ogerlitz@mellanox.com> | 2015-12-18 03:59:46 -0500 |
|---|---|---|
| committer | Doug Ledford <dledford@redhat.com> | 2015-12-22 14:39:00 -0500 |
| commit | 4a061b287b1eb58676875cc45929679911d1ca38 (patch) | |
| tree | 8ed8dad4965bdc2592f7547593aaf2ed01e3bfae /drivers/infiniband/ulp/iser | |
| parent | 86bee4c9c126b4f73e3f152cd43c806cac9135ad (diff) | |
IB/ulps: Avoid calling ib_query_device
Instead, use the cached copy of the attributes present on the device.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp/iser')
| -rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 4 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.h | 2 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iser_memory.c | 9 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iser_verbs.c | 38 |
4 files changed, 22 insertions, 31 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 9080161e01af..237e3bc6fe3c 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
| @@ -644,7 +644,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, | |||
| 644 | 644 | ||
| 645 | ib_conn = &iser_conn->ib_conn; | 645 | ib_conn = &iser_conn->ib_conn; |
| 646 | if (ib_conn->pi_support) { | 646 | if (ib_conn->pi_support) { |
| 647 | u32 sig_caps = ib_conn->device->dev_attr.sig_prot_cap; | 647 | u32 sig_caps = ib_conn->device->ib_device->attrs.sig_prot_cap; |
| 648 | 648 | ||
| 649 | scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps)); | 649 | scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps)); |
| 650 | scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP | | 650 | scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP | |
| @@ -656,7 +656,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, | |||
| 656 | * max fastreg page list length. | 656 | * max fastreg page list length. |
| 657 | */ | 657 | */ |
| 658 | shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize, | 658 | shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize, |
| 659 | ib_conn->device->dev_attr.max_fast_reg_page_list_len); | 659 | ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len); |
| 660 | shost->max_sectors = min_t(unsigned int, | 660 | shost->max_sectors = min_t(unsigned int, |
| 661 | 1024, (shost->sg_tablesize * PAGE_SIZE) >> 9); | 661 | 1024, (shost->sg_tablesize * PAGE_SIZE) >> 9); |
| 662 | 662 | ||
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index 8a5998e6a407..502063b244e0 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h | |||
| @@ -380,7 +380,6 @@ struct iser_reg_ops { | |||
| 380 | * | 380 | * |
| 381 | * @ib_device: RDMA device | 381 | * @ib_device: RDMA device |
| 382 | * @pd: Protection Domain for this device | 382 | * @pd: Protection Domain for this device |
| 383 | * @dev_attr: Device attributes container | ||
| 384 | * @mr: Global DMA memory region | 383 | * @mr: Global DMA memory region |
| 385 | * @event_handler: IB events handle routine | 384 | * @event_handler: IB events handle routine |
| 386 | * @ig_list: entry in devices list | 385 | * @ig_list: entry in devices list |
| @@ -393,7 +392,6 @@ struct iser_reg_ops { | |||
| 393 | struct iser_device { | 392 | struct iser_device { |
| 394 | struct ib_device *ib_device; | 393 | struct ib_device *ib_device; |
| 395 | struct ib_pd *pd; | 394 | struct ib_pd *pd; |
| 396 | struct ib_device_attr dev_attr; | ||
| 397 | struct ib_mr *mr; | 395 | struct ib_mr *mr; |
| 398 | struct ib_event_handler event_handler; | 396 | struct ib_event_handler event_handler; |
| 399 | struct list_head ig_list; | 397 | struct list_head ig_list; |
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index ea765fb9664d..47b47615acc5 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c | |||
| @@ -69,15 +69,14 @@ static struct iser_reg_ops fmr_ops = { | |||
| 69 | 69 | ||
| 70 | int iser_assign_reg_ops(struct iser_device *device) | 70 | int iser_assign_reg_ops(struct iser_device *device) |
| 71 | { | 71 | { |
| 72 | struct ib_device_attr *dev_attr = &device->dev_attr; | 72 | struct ib_device *ib_dev = device->ib_device; |
| 73 | 73 | ||
| 74 | /* Assign function handles - based on FMR support */ | 74 | /* Assign function handles - based on FMR support */ |
| 75 | if (device->ib_device->alloc_fmr && device->ib_device->dealloc_fmr && | 75 | if (ib_dev->alloc_fmr && ib_dev->dealloc_fmr && |
| 76 | device->ib_device->map_phys_fmr && device->ib_device->unmap_fmr) { | 76 | ib_dev->map_phys_fmr && ib_dev->unmap_fmr) { |
| 77 | iser_info("FMR supported, using FMR for registration\n"); | 77 | iser_info("FMR supported, using FMR for registration\n"); |
| 78 | device->reg_ops = &fmr_ops; | 78 | device->reg_ops = &fmr_ops; |
| 79 | } else | 79 | } else if (ib_dev->attrs.device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) { |
| 80 | if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) { | ||
| 81 | iser_info("FastReg supported, using FastReg for registration\n"); | 80 | iser_info("FastReg supported, using FastReg for registration\n"); |
| 82 | device->reg_ops = &fastreg_ops; | 81 | device->reg_ops = &fastreg_ops; |
| 83 | } else { | 82 | } else { |
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 42f4da620f2e..84b7b07170c7 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
| @@ -78,34 +78,28 @@ static void iser_event_handler(struct ib_event_handler *handler, | |||
| 78 | */ | 78 | */ |
| 79 | static int iser_create_device_ib_res(struct iser_device *device) | 79 | static int iser_create_device_ib_res(struct iser_device *device) |
| 80 | { | 80 | { |
| 81 | struct ib_device_attr *dev_attr = &device->dev_attr; | 81 | struct ib_device *ib_dev = device->ib_device; |
| 82 | int ret, i, max_cqe; | 82 | int ret, i, max_cqe; |
| 83 | 83 | ||
| 84 | ret = ib_query_device(device->ib_device, dev_attr); | ||
| 85 | if (ret) { | ||
| 86 | pr_warn("Query device failed for %s\n", device->ib_device->name); | ||
| 87 | return ret; | ||
| 88 | } | ||
| 89 | |||
| 90 | ret = iser_assign_reg_ops(device); | 84 | ret = iser_assign_reg_ops(device); |
| 91 | if (ret) | 85 | if (ret) |
| 92 | return ret; | 86 | return ret; |
| 93 | 87 | ||
| 94 | device->comps_used = min_t(int, num_online_cpus(), | 88 | device->comps_used = min_t(int, num_online_cpus(), |
| 95 | device->ib_device->num_comp_vectors); | 89 | ib_dev->num_comp_vectors); |
| 96 | 90 | ||
| 97 | device->comps = kcalloc(device->comps_used, sizeof(*device->comps), | 91 | device->comps = kcalloc(device->comps_used, sizeof(*device->comps), |
| 98 | GFP_KERNEL); | 92 | GFP_KERNEL); |
| 99 | if (!device->comps) | 93 | if (!device->comps) |
| 100 | goto comps_err; | 94 | goto comps_err; |
| 101 | 95 | ||
| 102 | max_cqe = min(ISER_MAX_CQ_LEN, dev_attr->max_cqe); | 96 | max_cqe = min(ISER_MAX_CQ_LEN, ib_dev->attrs.max_cqe); |
| 103 | 97 | ||
| 104 | iser_info("using %d CQs, device %s supports %d vectors max_cqe %d\n", | 98 | iser_info("using %d CQs, device %s supports %d vectors max_cqe %d\n", |
| 105 | device->comps_used, device->ib_device->name, | 99 | device->comps_used, ib_dev->name, |
| 106 | device->ib_device->num_comp_vectors, max_cqe); | 100 | ib_dev->num_comp_vectors, max_cqe); |
| 107 | 101 | ||
| 108 | device->pd = ib_alloc_pd(device->ib_device); | 102 | device->pd = ib_alloc_pd(ib_dev); |
| 109 | if (IS_ERR(device->pd)) | 103 | if (IS_ERR(device->pd)) |
| 110 | goto pd_err; | 104 | goto pd_err; |
| 111 | 105 | ||
| @@ -116,7 +110,7 @@ static int iser_create_device_ib_res(struct iser_device *device) | |||
| 116 | comp->device = device; | 110 | comp->device = device; |
| 117 | cq_attr.cqe = max_cqe; | 111 | cq_attr.cqe = max_cqe; |
| 118 | cq_attr.comp_vector = i; | 112 | cq_attr.comp_vector = i; |
| 119 | comp->cq = ib_create_cq(device->ib_device, | 113 | comp->cq = ib_create_cq(ib_dev, |
| 120 | iser_cq_callback, | 114 | iser_cq_callback, |
| 121 | iser_cq_event_callback, | 115 | iser_cq_event_callback, |
| 122 | (void *)comp, | 116 | (void *)comp, |
| @@ -464,7 +458,7 @@ static int iser_create_ib_conn_res(struct ib_conn *ib_conn) | |||
| 464 | struct iser_conn *iser_conn = container_of(ib_conn, struct iser_conn, | 458 | struct iser_conn *iser_conn = container_of(ib_conn, struct iser_conn, |
| 465 | ib_conn); | 459 | ib_conn); |
| 466 | struct iser_device *device; | 460 | struct iser_device *device; |
| 467 | struct ib_device_attr *dev_attr; | 461 | struct ib_device *ib_dev; |
| 468 | struct ib_qp_init_attr init_attr; | 462 | struct ib_qp_init_attr init_attr; |
| 469 | int ret = -ENOMEM; | 463 | int ret = -ENOMEM; |
| 470 | int index, min_index = 0; | 464 | int index, min_index = 0; |
| @@ -472,7 +466,7 @@ static int iser_create_ib_conn_res(struct ib_conn *ib_conn) | |||
| 472 | BUG_ON(ib_conn->device == NULL); | 466 | BUG_ON(ib_conn->device == NULL); |
| 473 | 467 | ||
| 474 | device = ib_conn->device; | 468 | device = ib_conn->device; |
| 475 | dev_attr = &device->dev_attr; | 469 | ib_dev = device->ib_device; |
| 476 | 470 | ||
| 477 | memset(&init_attr, 0, sizeof init_attr); | 471 | memset(&init_attr, 0, sizeof init_attr); |
| 478 | 472 | ||
| @@ -503,16 +497,16 @@ static int iser_create_ib_conn_res(struct ib_conn *ib_conn) | |||
| 503 | iser_conn->max_cmds = | 497 | iser_conn->max_cmds = |
| 504 | ISER_GET_MAX_XMIT_CMDS(ISER_QP_SIG_MAX_REQ_DTOS); | 498 | ISER_GET_MAX_XMIT_CMDS(ISER_QP_SIG_MAX_REQ_DTOS); |
| 505 | } else { | 499 | } else { |
| 506 | if (dev_attr->max_qp_wr > ISER_QP_MAX_REQ_DTOS) { | 500 | if (ib_dev->attrs.max_qp_wr > ISER_QP_MAX_REQ_DTOS) { |
| 507 | init_attr.cap.max_send_wr = ISER_QP_MAX_REQ_DTOS + 1; | 501 | init_attr.cap.max_send_wr = ISER_QP_MAX_REQ_DTOS + 1; |
| 508 | iser_conn->max_cmds = | 502 | iser_conn->max_cmds = |
| 509 | ISER_GET_MAX_XMIT_CMDS(ISER_QP_MAX_REQ_DTOS); | 503 | ISER_GET_MAX_XMIT_CMDS(ISER_QP_MAX_REQ_DTOS); |
| 510 | } else { | 504 | } else { |
| 511 | init_attr.cap.max_send_wr = dev_attr->max_qp_wr; | 505 | init_attr.cap.max_send_wr = ib_dev->attrs.max_qp_wr; |
| 512 | iser_conn->max_cmds = | 506 | iser_conn->max_cmds = |
| 513 | ISER_GET_MAX_XMIT_CMDS(dev_attr->max_qp_wr); | 507 | ISER_GET_MAX_XMIT_CMDS(ib_dev->attrs.max_qp_wr); |
| 514 | iser_dbg("device %s supports max_send_wr %d\n", | 508 | iser_dbg("device %s supports max_send_wr %d\n", |
| 515 | device->ib_device->name, dev_attr->max_qp_wr); | 509 | device->ib_device->name, ib_dev->attrs.max_qp_wr); |
| 516 | } | 510 | } |
| 517 | } | 511 | } |
| 518 | 512 | ||
| @@ -756,7 +750,7 @@ iser_calc_scsi_params(struct iser_conn *iser_conn, | |||
| 756 | 750 | ||
| 757 | sg_tablesize = DIV_ROUND_UP(max_sectors * 512, SIZE_4K); | 751 | sg_tablesize = DIV_ROUND_UP(max_sectors * 512, SIZE_4K); |
| 758 | sup_sg_tablesize = min_t(unsigned, ISCSI_ISER_MAX_SG_TABLESIZE, | 752 | sup_sg_tablesize = min_t(unsigned, ISCSI_ISER_MAX_SG_TABLESIZE, |
| 759 | device->dev_attr.max_fast_reg_page_list_len); | 753 | device->ib_device->attrs.max_fast_reg_page_list_len); |
| 760 | 754 | ||
| 761 | if (sg_tablesize > sup_sg_tablesize) { | 755 | if (sg_tablesize > sup_sg_tablesize) { |
| 762 | sg_tablesize = sup_sg_tablesize; | 756 | sg_tablesize = sup_sg_tablesize; |
| @@ -799,7 +793,7 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id) | |||
| 799 | 793 | ||
| 800 | /* connection T10-PI support */ | 794 | /* connection T10-PI support */ |
| 801 | if (iser_pi_enable) { | 795 | if (iser_pi_enable) { |
| 802 | if (!(device->dev_attr.device_cap_flags & | 796 | if (!(device->ib_device->attrs.device_cap_flags & |
| 803 | IB_DEVICE_SIGNATURE_HANDOVER)) { | 797 | IB_DEVICE_SIGNATURE_HANDOVER)) { |
| 804 | iser_warn("T10-PI requested but not supported on %s, " | 798 | iser_warn("T10-PI requested but not supported on %s, " |
| 805 | "continue without T10-PI\n", | 799 | "continue without T10-PI\n", |
| @@ -841,7 +835,7 @@ static void iser_route_handler(struct rdma_cm_id *cma_id) | |||
| 841 | goto failure; | 835 | goto failure; |
| 842 | 836 | ||
| 843 | memset(&conn_param, 0, sizeof conn_param); | 837 | memset(&conn_param, 0, sizeof conn_param); |
| 844 | conn_param.responder_resources = device->dev_attr.max_qp_rd_atom; | 838 | conn_param.responder_resources = device->ib_device->attrs.max_qp_rd_atom; |
| 845 | conn_param.initiator_depth = 1; | 839 | conn_param.initiator_depth = 1; |
| 846 | conn_param.retry_count = 7; | 840 | conn_param.retry_count = 7; |
| 847 | conn_param.rnr_retry_count = 6; | 841 | conn_param.rnr_retry_count = 6; |
