diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2014-06-11 05:09:58 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-06-11 16:06:45 -0400 |
commit | d77e65350f2d82dfa0557707d505711f5a43c8fd (patch) | |
tree | 04adddbd63d60ebdaae4ee5a7c320dd6b9412d76 /drivers/infiniband/ulp/iser/iser_initiator.c | |
parent | 8846bab180fa2bcfe02d4ba5288fbaba12c8f4f3 (diff) |
libiscsi, iser: Adjust data_length to include protection information
In case protection information exists over the wire
iscsi header data length is required to include it.
Use protection information aware scsi helpers to set
the correct transfer length.
In order to avoid breakage, remove iser transfer length
checks for each task as they are not always true and
somewhat redundant anyway.
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Acked-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: stable@vger.kernel.org # 3.15+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/infiniband/ulp/iser/iser_initiator.c')
-rw-r--r-- | drivers/infiniband/ulp/iser/iser_initiator.c | 34 |
1 files changed, 10 insertions, 24 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 | } |