diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2008-12-02 01:32:14 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:23 -0500 |
commit | 2ff79d52d56eebcffd83e9327b89d7daedf1e897 (patch) | |
tree | 66746804ba4965f7ffdc9ed32ce2f8c29e8dbac9 /drivers | |
parent | 262ef63627977acb7d8dd38c4f0f290bf49fbbfd (diff) |
[SCSI] libiscsi: pass opcode into alloc_pdu callout
We do not need to allocate a itt for data_out, so this
passes the opcode to the alloc_pdu callout.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 2 | ||||
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libiscsi.c | 14 | ||||
-rw-r--r-- | drivers/scsi/libiscsi_tcp.c | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 78bf5e4538cb..12876392516e 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -119,7 +119,7 @@ error: | |||
119 | iscsi_conn_failure(conn, rc); | 119 | iscsi_conn_failure(conn, rc); |
120 | } | 120 | } |
121 | 121 | ||
122 | static int iscsi_iser_pdu_alloc(struct iscsi_task *task) | 122 | static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode) |
123 | { | 123 | { |
124 | struct iscsi_iser_task *iser_task = task->dd_data; | 124 | struct iscsi_iser_task *iser_task = task->dd_data; |
125 | 125 | ||
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 07d9eb14721b..de5c9b3e51fb 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -457,7 +457,7 @@ static int iscsi_sw_tcp_pdu_init(struct iscsi_task *task, | |||
457 | return 0; | 457 | return 0; |
458 | } | 458 | } |
459 | 459 | ||
460 | static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task) | 460 | static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task, uint8_t opcode) |
461 | { | 461 | { |
462 | struct iscsi_tcp_task *tcp_task = task->dd_data; | 462 | struct iscsi_tcp_task *tcp_task = task->dd_data; |
463 | 463 | ||
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 6c4034b1561c..ddf53978f0be 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -225,13 +225,18 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) | |||
225 | itt_t itt; | 225 | itt_t itt; |
226 | int rc; | 226 | int rc; |
227 | 227 | ||
228 | rc = conn->session->tt->alloc_pdu(task); | 228 | rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_CMD); |
229 | if (rc) | 229 | if (rc) |
230 | return rc; | 230 | return rc; |
231 | hdr = (struct iscsi_cmd *) task->hdr; | 231 | hdr = (struct iscsi_cmd *) task->hdr; |
232 | itt = hdr->itt; | 232 | itt = hdr->itt; |
233 | memset(hdr, 0, sizeof(*hdr)); | 233 | memset(hdr, 0, sizeof(*hdr)); |
234 | 234 | ||
235 | if (session->tt->parse_pdu_itt) | ||
236 | hdr->itt = task->hdr_itt = itt; | ||
237 | else | ||
238 | hdr->itt = task->hdr_itt = build_itt(task->itt, | ||
239 | task->conn->session->age); | ||
235 | task->hdr_len = 0; | 240 | task->hdr_len = 0; |
236 | rc = iscsi_add_hdr(task, sizeof(*hdr)); | 241 | rc = iscsi_add_hdr(task, sizeof(*hdr)); |
237 | if (rc) | 242 | if (rc) |
@@ -240,11 +245,6 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) | |||
240 | hdr->flags = ISCSI_ATTR_SIMPLE; | 245 | hdr->flags = ISCSI_ATTR_SIMPLE; |
241 | int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); | 246 | int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); |
242 | memcpy(task->lun, hdr->lun, sizeof(task->lun)); | 247 | memcpy(task->lun, hdr->lun, sizeof(task->lun)); |
243 | if (session->tt->parse_pdu_itt) | ||
244 | hdr->itt = task->hdr_itt = itt; | ||
245 | else | ||
246 | hdr->itt = task->hdr_itt = build_itt(task->itt, | ||
247 | task->conn->session->age); | ||
248 | hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn); | 248 | hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn); |
249 | session->cmdsn++; | 249 | session->cmdsn++; |
250 | hdr->exp_statsn = cpu_to_be32(conn->exp_statsn); | 250 | hdr->exp_statsn = cpu_to_be32(conn->exp_statsn); |
@@ -532,7 +532,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
532 | } else | 532 | } else |
533 | task->data_count = 0; | 533 | task->data_count = 0; |
534 | 534 | ||
535 | if (conn->session->tt->alloc_pdu(task)) { | 535 | if (conn->session->tt->alloc_pdu(task, hdr->opcode)) { |
536 | iscsi_conn_printk(KERN_ERR, conn, "Could not allocate " | 536 | iscsi_conn_printk(KERN_ERR, conn, "Could not allocate " |
537 | "pdu for mgmt task.\n"); | 537 | "pdu for mgmt task.\n"); |
538 | goto requeue_task; | 538 | goto requeue_task; |
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index e86508936314..9df6b3436e4a 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c | |||
@@ -1021,7 +1021,7 @@ flush: | |||
1021 | return 0; | 1021 | return 0; |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | rc = conn->session->tt->alloc_pdu(task); | 1024 | rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_DATA_OUT); |
1025 | if (rc) | 1025 | if (rc) |
1026 | return rc; | 1026 | return rc; |
1027 | iscsi_prep_data_out_pdu(task, r2t, (struct iscsi_data *) task->hdr); | 1027 | iscsi_prep_data_out_pdu(task, r2t, (struct iscsi_data *) task->hdr); |