| .. | .. |
|---|
| 205 | 205 | goto out; |
|---|
| 206 | 206 | } |
|---|
| 207 | 207 | |
|---|
| 208 | | - tx_desc->wr_idx = 0; |
|---|
| 208 | + tx_desc->inv_wr.next = NULL; |
|---|
| 209 | + tx_desc->reg_wr.wr.next = NULL; |
|---|
| 209 | 210 | tx_desc->mapped = true; |
|---|
| 210 | 211 | tx_desc->dma_addr = dma_addr; |
|---|
| 211 | 212 | tx_desc->tx_sg[0].addr = tx_desc->dma_addr; |
|---|
| .. | .. |
|---|
| 406 | 407 | iscsi_iser_check_protection(struct iscsi_task *task, sector_t *sector) |
|---|
| 407 | 408 | { |
|---|
| 408 | 409 | struct iscsi_iser_task *iser_task = task->dd_data; |
|---|
| 410 | + enum iser_data_dir dir = iser_task->dir[ISER_DIR_IN] ? |
|---|
| 411 | + ISER_DIR_IN : ISER_DIR_OUT; |
|---|
| 409 | 412 | |
|---|
| 410 | | - if (iser_task->dir[ISER_DIR_IN]) |
|---|
| 411 | | - return iser_check_task_pi_status(iser_task, ISER_DIR_IN, |
|---|
| 412 | | - sector); |
|---|
| 413 | | - else |
|---|
| 414 | | - return iser_check_task_pi_status(iser_task, ISER_DIR_OUT, |
|---|
| 415 | | - sector); |
|---|
| 413 | + return iser_check_task_pi_status(iser_task, dir, sector); |
|---|
| 416 | 414 | } |
|---|
| 417 | 415 | |
|---|
| 418 | 416 | /** |
|---|
| .. | .. |
|---|
| 501 | 499 | iser_conn->iscsi_conn = conn; |
|---|
| 502 | 500 | |
|---|
| 503 | 501 | out: |
|---|
| 502 | + iscsi_put_endpoint(ep); |
|---|
| 504 | 503 | mutex_unlock(&iser_conn->state_mutex); |
|---|
| 505 | 504 | return error; |
|---|
| 506 | 505 | } |
|---|
| .. | .. |
|---|
| 613 | 612 | struct Scsi_Host *shost; |
|---|
| 614 | 613 | struct iser_conn *iser_conn = NULL; |
|---|
| 615 | 614 | struct ib_conn *ib_conn; |
|---|
| 615 | + struct ib_device *ib_dev; |
|---|
| 616 | 616 | u32 max_fr_sectors; |
|---|
| 617 | 617 | |
|---|
| 618 | 618 | shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0); |
|---|
| .. | .. |
|---|
| 643 | 643 | } |
|---|
| 644 | 644 | |
|---|
| 645 | 645 | ib_conn = &iser_conn->ib_conn; |
|---|
| 646 | + ib_dev = ib_conn->device->ib_device; |
|---|
| 646 | 647 | if (ib_conn->pi_support) { |
|---|
| 647 | | - u32 sig_caps = ib_conn->device->ib_device->attrs.sig_prot_cap; |
|---|
| 648 | + u32 sig_caps = ib_dev->attrs.sig_prot_cap; |
|---|
| 648 | 649 | |
|---|
| 649 | 650 | shost->sg_prot_tablesize = shost->sg_tablesize; |
|---|
| 650 | 651 | scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps)); |
|---|
| .. | .. |
|---|
| 652 | 653 | SHOST_DIX_GUARD_CRC); |
|---|
| 653 | 654 | } |
|---|
| 654 | 655 | |
|---|
| 655 | | - if (iscsi_host_add(shost, |
|---|
| 656 | | - ib_conn->device->ib_device->dev.parent)) { |
|---|
| 656 | + if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG)) |
|---|
| 657 | + shost->virt_boundary_mask = SZ_4K - 1; |
|---|
| 658 | + |
|---|
| 659 | + if (iscsi_host_add(shost, ib_dev->dev.parent)) { |
|---|
| 657 | 660 | mutex_unlock(&iser_conn->state_mutex); |
|---|
| 658 | 661 | goto free_host; |
|---|
| 659 | 662 | } |
|---|
| .. | .. |
|---|
| 764 | 767 | enum iscsi_param param, char *buf) |
|---|
| 765 | 768 | { |
|---|
| 766 | 769 | struct iser_conn *iser_conn = ep->dd_data; |
|---|
| 767 | | - int len; |
|---|
| 768 | 770 | |
|---|
| 769 | 771 | switch (param) { |
|---|
| 770 | 772 | case ISCSI_PARAM_CONN_PORT: |
|---|
| .. | .. |
|---|
| 775 | 777 | return iscsi_conn_get_addr_param((struct sockaddr_storage *) |
|---|
| 776 | 778 | &iser_conn->ib_conn.cma_id->route.addr.dst_addr, |
|---|
| 777 | 779 | param, buf); |
|---|
| 778 | | - break; |
|---|
| 779 | 780 | default: |
|---|
| 780 | | - return -ENOSYS; |
|---|
| 781 | + break; |
|---|
| 781 | 782 | } |
|---|
| 782 | | - |
|---|
| 783 | | - return len; |
|---|
| 783 | + return -ENOSYS; |
|---|
| 784 | 784 | } |
|---|
| 785 | 785 | |
|---|
| 786 | 786 | /** |
|---|
| 787 | 787 | * iscsi_iser_ep_connect() - Initiate iSER connection establishment |
|---|
| 788 | 788 | * @shost: scsi_host |
|---|
| 789 | 789 | * @dst_addr: destination address |
|---|
| 790 | | - * @non-blocking: indicate if routine can block |
|---|
| 790 | + * @non_blocking: indicate if routine can block |
|---|
| 791 | 791 | * |
|---|
| 792 | 792 | * Allocate an iscsi endpoint, an iser_conn structure and bind them. |
|---|
| 793 | 793 | * After that start RDMA connection establishment via rdma_cm. We |
|---|
| .. | .. |
|---|
| 962 | 962 | return 0; |
|---|
| 963 | 963 | } |
|---|
| 964 | 964 | |
|---|
| 965 | | -static int iscsi_iser_slave_alloc(struct scsi_device *sdev) |
|---|
| 966 | | -{ |
|---|
| 967 | | - struct iscsi_session *session; |
|---|
| 968 | | - struct iser_conn *iser_conn; |
|---|
| 969 | | - struct ib_device *ib_dev; |
|---|
| 970 | | - |
|---|
| 971 | | - mutex_lock(&unbind_iser_conn_mutex); |
|---|
| 972 | | - |
|---|
| 973 | | - session = starget_to_session(scsi_target(sdev))->dd_data; |
|---|
| 974 | | - iser_conn = session->leadconn->dd_data; |
|---|
| 975 | | - if (!iser_conn) { |
|---|
| 976 | | - mutex_unlock(&unbind_iser_conn_mutex); |
|---|
| 977 | | - return -ENOTCONN; |
|---|
| 978 | | - } |
|---|
| 979 | | - ib_dev = iser_conn->ib_conn.device->ib_device; |
|---|
| 980 | | - |
|---|
| 981 | | - if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG)) |
|---|
| 982 | | - blk_queue_virt_boundary(sdev->request_queue, ~MASK_4K); |
|---|
| 983 | | - |
|---|
| 984 | | - mutex_unlock(&unbind_iser_conn_mutex); |
|---|
| 985 | | - |
|---|
| 986 | | - return 0; |
|---|
| 987 | | -} |
|---|
| 988 | | - |
|---|
| 989 | 965 | static struct scsi_host_template iscsi_iser_sht = { |
|---|
| 990 | 966 | .module = THIS_MODULE, |
|---|
| 991 | 967 | .name = "iSCSI Initiator over iSER", |
|---|
| .. | .. |
|---|
| 998 | 974 | .eh_device_reset_handler= iscsi_eh_device_reset, |
|---|
| 999 | 975 | .eh_target_reset_handler = iscsi_eh_recover_target, |
|---|
| 1000 | 976 | .target_alloc = iscsi_target_alloc, |
|---|
| 1001 | | - .use_clustering = ENABLE_CLUSTERING, |
|---|
| 1002 | | - .slave_alloc = iscsi_iser_slave_alloc, |
|---|
| 1003 | 977 | .proc_name = "iscsi_iser", |
|---|
| 1004 | 978 | .this_id = -1, |
|---|
| 1005 | 979 | .track_queue_depth = 1, |
|---|
| .. | .. |
|---|
| 1015 | 989 | /* connection management */ |
|---|
| 1016 | 990 | .create_conn = iscsi_iser_conn_create, |
|---|
| 1017 | 991 | .bind_conn = iscsi_iser_conn_bind, |
|---|
| 992 | + .unbind_conn = iscsi_conn_unbind, |
|---|
| 1018 | 993 | .destroy_conn = iscsi_conn_teardown, |
|---|
| 1019 | 994 | .attr_is_visible = iser_attr_is_visible, |
|---|
| 1020 | 995 | .set_param = iscsi_iser_set_param, |
|---|