diff options
30 files changed, 728 insertions, 364 deletions
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 2e2d903db838..8d44a4060634 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c | |||
| @@ -41,11 +41,11 @@ | |||
| 41 | #include "iscsi_iser.h" | 41 | #include "iscsi_iser.h" |
| 42 | 42 | ||
| 43 | /* Register user buffer memory and initialize passive rdma | 43 | /* Register user buffer memory and initialize passive rdma |
| 44 | * dto descriptor. Total data size is stored in | 44 | * dto descriptor. Data size is stored in |
| 45 | * iser_task->data[ISER_DIR_IN].data_len | 45 | * task->data[ISER_DIR_IN].data_len, Protection size |
| 46 | * os stored in task->prot[ISER_DIR_IN].data_len | ||
| 46 | */ | 47 | */ |
| 47 | static int iser_prepare_read_cmd(struct iscsi_task *task, | 48 | static int iser_prepare_read_cmd(struct iscsi_task *task) |
| 48 | unsigned int edtl) | ||
| 49 | 49 | ||
| 50 | { | 50 | { |
| 51 | struct iscsi_iser_task *iser_task = task->dd_data; | 51 | struct iscsi_iser_task *iser_task = task->dd_data; |
| @@ -73,14 +73,6 @@ static int iser_prepare_read_cmd(struct iscsi_task *task, | |||
| 73 | return err; | 73 | return err; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | if (edtl > iser_task->data[ISER_DIR_IN].data_len) { | ||
| 77 | iser_err("Total data length: %ld, less than EDTL: " | ||
| 78 | "%d, in READ cmd BHS itt: %d, conn: 0x%p\n", | ||
| 79 | iser_task->data[ISER_DIR_IN].data_len, edtl, | ||
| 80 | task->itt, iser_task->ib_conn); | ||
| 81 | return -EINVAL; | ||
| 82 | } | ||
| 83 | |||
| 84 | err = device->iser_reg_rdma_mem(iser_task, ISER_DIR_IN); | 76 | err = device->iser_reg_rdma_mem(iser_task, ISER_DIR_IN); |
| 85 | if (err) { | 77 | if (err) { |
| 86 | iser_err("Failed to set up Data-IN RDMA\n"); | 78 | iser_err("Failed to set up Data-IN RDMA\n"); |
| @@ -100,8 +92,9 @@ static int iser_prepare_read_cmd(struct iscsi_task *task, | |||
| 100 | } | 92 | } |
| 101 | 93 | ||
| 102 | /* Register user buffer memory and initialize passive rdma | 94 | /* Register user buffer memory and initialize passive rdma |
| 103 | * dto descriptor. Total data size is stored in | 95 | * dto descriptor. Data size is stored in |
| 104 | * task->data[ISER_DIR_OUT].data_len | 96 | * task->data[ISER_DIR_OUT].data_len, Protection size |
| 97 | * is stored at task->prot[ISER_DIR_OUT].data_len | ||
| 105 | */ | 98 | */ |
| 106 | static int | 99 | static int |
| 107 | iser_prepare_write_cmd(struct iscsi_task *task, | 100 | iser_prepare_write_cmd(struct iscsi_task *task, |
| @@ -135,14 +128,6 @@ iser_prepare_write_cmd(struct iscsi_task *task, | |||
| 135 | return err; | 128 | return err; |
| 136 | } | 129 | } |
| 137 | 130 | ||
| 138 | if (edtl > iser_task->data[ISER_DIR_OUT].data_len) { | ||
| 139 | iser_err("Total data length: %ld, less than EDTL: %d, " | ||
| 140 | "in WRITE cmd BHS itt: %d, conn: 0x%p\n", | ||
| 141 | iser_task->data[ISER_DIR_OUT].data_len, | ||
| 142 | edtl, task->itt, task->conn); | ||
| 143 | return -EINVAL; | ||
| 144 | } | ||
| 145 | |||
| 146 | err = device->iser_reg_rdma_mem(iser_task, ISER_DIR_OUT); | 131 | err = device->iser_reg_rdma_mem(iser_task, ISER_DIR_OUT); |
| 147 | if (err != 0) { | 132 | if (err != 0) { |
| 148 | iser_err("Failed to register write cmd RDMA mem\n"); | 133 | iser_err("Failed to register write cmd RDMA mem\n"); |
| @@ -417,11 +402,12 @@ int iser_send_command(struct iscsi_conn *conn, | |||
| 417 | if (scsi_prot_sg_count(sc)) { | 402 | if (scsi_prot_sg_count(sc)) { |
| 418 | prot_buf->buf = scsi_prot_sglist(sc); | 403 | prot_buf->buf = scsi_prot_sglist(sc); |
| 419 | prot_buf->size = scsi_prot_sg_count(sc); | 404 | prot_buf->size = scsi_prot_sg_count(sc); |
| 420 | prot_buf->data_len = sc->prot_sdb->length; | 405 | prot_buf->data_len = data_buf->data_len >> |
| 406 | ilog2(sc->device->sector_size) * 8; | ||
| 421 | } | 407 | } |
| 422 | 408 | ||
| 423 | if (hdr->flags & ISCSI_FLAG_CMD_READ) { | 409 | if (hdr->flags & ISCSI_FLAG_CMD_READ) { |
| 424 | err = iser_prepare_read_cmd(task, edtl); | 410 | err = iser_prepare_read_cmd(task); |
| 425 | if (err) | 411 | if (err) |
| 426 | goto send_command_error; | 412 | goto send_command_error; |
| 427 | } | 413 | } |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index b9d647468b99..d4c7928a0f36 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
| @@ -663,8 +663,9 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
| 663 | 663 | ||
| 664 | pi_support = np->tpg_np->tpg->tpg_attrib.t10_pi; | 664 | pi_support = np->tpg_np->tpg->tpg_attrib.t10_pi; |
| 665 | if (pi_support && !device->pi_capable) { | 665 | if (pi_support && !device->pi_capable) { |
| 666 | pr_err("Protection information requested but not supported\n"); | 666 | pr_err("Protection information requested but not supported, " |
| 667 | ret = -EINVAL; | 667 | "rejecting connect request\n"); |
| 668 | ret = rdma_reject(cma_id, NULL, 0); | ||
| 668 | goto out_mr; | 669 | goto out_mr; |
| 669 | } | 670 | } |
| 670 | 671 | ||
| @@ -787,14 +788,12 @@ isert_disconnect_work(struct work_struct *work) | |||
| 787 | isert_put_conn(isert_conn); | 788 | isert_put_conn(isert_conn); |
| 788 | return; | 789 | return; |
| 789 | } | 790 | } |
| 790 | if (!isert_conn->logout_posted) { | 791 | |
| 791 | pr_debug("Calling rdma_disconnect for !logout_posted from" | 792 | if (isert_conn->disconnect) { |
| 792 | " isert_disconnect_work\n"); | 793 | /* Send DREQ/DREP towards our initiator */ |
| 793 | rdma_disconnect(isert_conn->conn_cm_id); | 794 | rdma_disconnect(isert_conn->conn_cm_id); |
| 794 | mutex_unlock(&isert_conn->conn_mutex); | ||
| 795 | iscsit_cause_connection_reinstatement(isert_conn->conn, 0); | ||
| 796 | goto wake_up; | ||
| 797 | } | 795 | } |
| 796 | |||
| 798 | mutex_unlock(&isert_conn->conn_mutex); | 797 | mutex_unlock(&isert_conn->conn_mutex); |
| 799 | 798 | ||
| 800 | wake_up: | 799 | wake_up: |
| @@ -803,10 +802,11 @@ wake_up: | |||
| 803 | } | 802 | } |
| 804 | 803 | ||
| 805 | static void | 804 | static void |
| 806 | isert_disconnected_handler(struct rdma_cm_id *cma_id) | 805 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) |
| 807 | { | 806 | { |
| 808 | struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; | 807 | struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; |
| 809 | 808 | ||
| 809 | isert_conn->disconnect = disconnect; | ||
| 810 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); | 810 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); |
| 811 | sc | ||
