aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libiscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2009-05-13 18:57:39 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-05-23 16:44:09 -0400
commit184b57c630c86d35b7f92d4b6545fdf07647c5d5 (patch)
treed6e46048015ccfefec0f47662d2202e5dc26d6fb /drivers/scsi/libiscsi.c
parent10eb0f013c63c71c82ede77945a5f390c10cfda6 (diff)
[SCSI] libiscsi: check of LLD has a alloc pdu callout.
bnx2i does not have one. It currently preallocates the bdt when the session is setup. We probably want to change that to a dma pool, then allocate from the pool in the alloc pdu. Until then check if there is a 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/scsi/libiscsi.c')
-rw-r--r--drivers/scsi/libiscsi.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index e72b4ad47d35..11bc3e1fbd5a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -257,9 +257,11 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
257 itt_t itt; 257 itt_t itt;
258 int rc; 258 int rc;
259 259
260 rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_CMD); 260 if (conn->session->tt->alloc_pdu) {
261 if (rc) 261 rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_CMD);
262 return rc; 262 if (rc)
263 return rc;
264 }
263 hdr = (struct iscsi_cmd *) task->hdr; 265 hdr = (struct iscsi_cmd *) task->hdr;
264 itt = hdr->itt; 266 itt = hdr->itt;
265 memset(hdr, 0, sizeof(*hdr)); 267 memset(hdr, 0, sizeof(*hdr));
@@ -566,11 +568,14 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
566 } else 568 } else
567 task->data_count = 0; 569 task->data_count = 0;
568 570
569 if (conn->session->tt->alloc_pdu(task, hdr->opcode)) { 571 if (conn->session->tt->alloc_pdu) {
570 iscsi_conn_printk(KERN_ERR, conn, "Could not allocate " 572 if (conn->session->tt->alloc_pdu(task, hdr->opcode)) {
571 "pdu for mgmt task.\n"); 573 iscsi_conn_printk(KERN_ERR, conn, "Could not allocate "
572 goto requeue_task; 574 "pdu for mgmt task.\n");
575 goto requeue_task;
576 }
573 } 577 }
578
574 itt = task->hdr->itt; 579 itt = task->hdr->itt;
575 task->hdr_len = sizeof(struct iscsi_hdr); 580 task->hdr_len = sizeof(struct iscsi_hdr);
576 memcpy(task->hdr, hdr, sizeof(struct iscsi_hdr)); 581 memcpy(task->hdr, hdr, sizeof(struct iscsi_hdr));