aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libiscsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r--drivers/scsi/libiscsi.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 865dd5739f0e..4d85ce100192 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -140,7 +140,7 @@ static void iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
140 hdr->flags = ISCSI_ATTR_SIMPLE; 140 hdr->flags = ISCSI_ATTR_SIMPLE;
141 int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); 141 int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun);
142 hdr->itt = build_itt(ctask->itt, conn->id, session->age); 142 hdr->itt = build_itt(ctask->itt, conn->id, session->age);
143 hdr->data_length = cpu_to_be32(sc->request_bufflen); 143 hdr->data_length = cpu_to_be32(scsi_bufflen(sc));
144 hdr->cmdsn = cpu_to_be32(session->cmdsn); 144 hdr->cmdsn = cpu_to_be32(session->cmdsn);
145 session->cmdsn++; 145 session->cmdsn++;
146 hdr->exp_statsn = cpu_to_be32(conn->exp_statsn); 146 hdr->exp_statsn = cpu_to_be32(conn->exp_statsn);
@@ -172,11 +172,11 @@ static void iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
172 ctask->unsol_datasn = 0; 172 ctask->unsol_datasn = 0;
173 173
174 if (session->imm_data_en) { 174 if (session->imm_data_en) {
175 if (sc->request_bufflen >= session->first_burst) 175 if (scsi_bufflen(sc) >= session->first_burst)
176 ctask->imm_count = min(session->first_burst, 176 ctask->imm_count = min(session->first_burst,
177 conn->max_xmit_dlength); 177 conn->max_xmit_dlength);
178 else 178 else
179 ctask->imm_count = min(sc->request_bufflen, 179 ctask->imm_count = min(scsi_bufflen(sc),
180 conn->max_xmit_dlength); 180 conn->max_xmit_dlength);
181 hton24(ctask->hdr->dlength, ctask->imm_count); 181 hton24(ctask->hdr->dlength, ctask->imm_count);
182 } else 182 } else
@@ -184,7 +184,7 @@ static void iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
184 184
185 if (!session->initial_r2t_en) { 185 if (!session->initial_r2t_en) {
186 ctask->unsol_count = min((session->first_burst), 186 ctask->unsol_count = min((session->first_burst),
187 (sc->request_bufflen)) - ctask->imm_count; 187 (scsi_bufflen(sc))) - ctask->imm_count;
188 ctask->unsol_offset = ctask->imm_count; 188 ctask->unsol_offset = ctask->imm_count;
189 } 189 }
190 190
@@ -204,7 +204,7 @@ static void iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
204 debug_scsi("iscsi prep [%s cid %d sc %p cdb 0x%x itt 0x%x len %d " 204 debug_scsi("iscsi prep [%s cid %d sc %p cdb 0x%x itt 0x%x len %d "
205 "cmdsn %d win %d]\n", 205 "cmdsn %d win %d]\n",
206 sc->sc_data_direction == DMA_TO_DEVICE ? "write" : "read", 206 sc->sc_data_direction == DMA_TO_DEVICE ? "write" : "read",
207 conn->id, sc, sc->cmnd[0], ctask->itt, sc->request_bufflen, 207 conn->id, sc, sc->cmnd[0], ctask->itt, scsi_bufflen(sc),
208 session->cmdsn, session->max_cmdsn - session->exp_cmdsn + 1); 208 session->cmdsn, session->max_cmdsn - session->exp_cmdsn + 1);
209} 209}
210 210
@@ -297,14 +297,14 @@ invalid_datalen:
297 if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) { 297 if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) {
298 int res_count = be32_to_cpu(rhdr->residual_count); 298 int res_count = be32_to_cpu(rhdr->residual_count);
299 299
300 if (res_count > 0 && res_count <= sc->request_bufflen) 300 if (res_count > 0 && res_count <= scsi_bufflen(sc))
301 sc->resid = res_count; 301 scsi_set_resid(sc, res_count);
302 else 302 else
303 sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; 303 sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status;
304 } else if (rhdr->flags & ISCSI_FLAG_CMD_BIDI_UNDERFLOW) 304 } else if (rhdr->flags & ISCSI_FLAG_CMD_BIDI_UNDERFLOW)
305 sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; 305 sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status;
306 else if (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW) 306 else if (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW)
307 sc->resid = be32_to_cpu(rhdr->residual_count); 307 scsi_set_resid(sc, be32_to_cpu(rhdr->residual_count));
308 308
309out: 309out:
310 debug_scsi("done [sc %lx res %d itt 0x%x]\n", 310 debug_scsi("done [sc %lx res %d itt 0x%x]\n",
@@ -876,7 +876,7 @@ fault:
876 printk(KERN_ERR "iscsi: cmd 0x%x is not queued (%d)\n", 876 printk(KERN_ERR "iscsi: cmd 0x%x is not queued (%d)\n",
877 sc->cmnd[0], reason); 877 sc->cmnd[0], reason);
878 sc->result = (DID_NO_CONNECT << 16); 878 sc->result = (DID_NO_CONNECT << 16);
879 sc->resid = sc->request_bufflen; 879 scsi_set_resid(sc, scsi_bufflen(sc));
880 sc->scsi_done(sc); 880 sc->scsi_done(sc);
881 return 0; 881 return 0;
882} 882}
@@ -1145,7 +1145,7 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
1145 iscsi_ctask_mtask_cleanup(ctask); 1145 iscsi_ctask_mtask_cleanup(ctask);
1146 1146
1147 sc->result = err; 1147 sc->result = err;
1148 sc->resid = sc->request_bufflen; 1148 scsi_set_resid(sc, scsi_bufflen(sc));
1149 if (conn->ctask == ctask) 1149 if (conn->ctask == ctask)
1150 conn->ctask = NULL; 1150 conn->ctask = NULL;
1151 /* release ref from queuecommand */ 1151 /* release ref from queuecommand */