aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorManish Rangankar <manish.rangankar@qlogic.com>2011-10-07 19:55:50 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-10-16 12:11:22 -0400
commit69ca216e9bbbe2baf7f441ab57c5d791f439f775 (patch)
treea6bda8a56d9f5beeb5a382b9f2b878092ad19f6b /drivers/scsi
parentf922da79fd602dddb169f89471e3266cc692750a (diff)
[SCSI] qla4xxx: Fixed target discovery failed issue.
When sendtargets response is greater then max receive data segment length, the passthrough IOCB failed with data overrun status. Solution is to allocate space for iSCSI header in the IOCB response buffer. JIRA Key: UPSISCSI-147 Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla4xxx/ql4_def.h1
-rw-r--r--drivers/scsi/qla4xxx/ql4_iocb.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c9
3 files changed, 7 insertions, 5 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index fcb1dff9bc19..ace637bf254e 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -631,6 +631,7 @@ struct ql4_task_data {
631 dma_addr_t data_dma; 631 dma_addr_t data_dma;
632 void *req_buffer; 632 void *req_buffer;
633 dma_addr_t req_dma; 633 dma_addr_t req_dma;
634 uint32_t req_len;
634 void *resp_buffer; 635 void *resp_buffer;
635 dma_addr_t resp_dma; 636 dma_addr_t resp_dma;
636 uint32_t resp_len; 637 uint32_t resp_len;
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index ad40a613bcf1..410669351906 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -407,7 +407,7 @@ int qla4xxx_send_passthru0(struct iscsi_task *task)
407 passthru_iocb->timeout = cpu_to_le16(PT_DEFAULT_TIMEOUT); 407 passthru_iocb->timeout = cpu_to_le16(PT_DEFAULT_TIMEOUT);
408 408
409 /* Setup the out & in DSDs */ 409 /* Setup the out & in DSDs */
410 if (task->data_count) { 410 if (task_data->req_len) {
411 memcpy((uint8_t *)task_data->req_buffer + 411 memcpy((uint8_t *)task_data->req_buffer +
412 sizeof(struct iscsi_hdr), task->data, task->data_count); 412 sizeof(struct iscsi_hdr), task->data, task->data_count);
413 ctrl_flags |= PT_FLAG_SEND_BUFFER; 413 ctrl_flags |= PT_FLAG_SEND_BUFFER;
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 8ed3e2fc1584..fca3d2b96651 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1272,7 +1272,7 @@ static int qla4xxx_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
1272 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: MaxRecvLen %u, iscsi hrd %d\n", 1272 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: MaxRecvLen %u, iscsi hrd %d\n",
1273 __func__, task->conn->max_recv_dlength, hdr_len)); 1273 __func__, task->conn->max_recv_dlength, hdr_len));
1274 1274
1275 task_data->resp_len = task->conn->max_recv_dlength; 1275 task_data->resp_len = task->conn->max_recv_dlength + hdr_len;
1276 task_data->resp_buffer = dma_alloc_coherent(&ha->pdev->dev, 1276 task_data->resp_buffer = dma_alloc_coherent(&ha->pdev->dev,
1277 task_data->resp_len, 1277 task_data->resp_len,
1278 &task_data->resp_dma, 1278 &task_data->resp_dma,
@@ -1280,8 +1280,9 @@ static int qla4xxx_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
1280 if (!task_data->resp_buffer) 1280 if (!task_data->resp_buffer)
1281 goto exit_alloc_pdu; 1281 goto exit_alloc_pdu;
1282 1282
1283 task_data->req_len = task->data_count + hdr_len;
1283 task_data->req_buffer = dma_alloc_coherent(&ha->pdev->dev, 1284 task_data->req_buffer = dma_alloc_coherent(&ha->pdev->dev,
1284 task->data_count + hdr_len, 1285 task_data->req_len,
1285 &task_data->req_dma, 1286 &task_data->req_dma,
1286 GFP_ATOMIC); 1287 GFP_ATOMIC);
1287 if (!task_data->req_buffer) 1288 if (!task_data->req_buffer)
@@ -1299,7 +1300,7 @@ exit_alloc_pdu:
1299 task_data->resp_buffer, task_data->resp_dma); 1300 task_data->resp_buffer, task_data->resp_dma);
1300 1301
1301 if (task_data->req_buffer) 1302 if (task_data->req_buffer)
1302 dma_free_coherent(&ha->pdev->dev, task->data_count + hdr_len, 1303 dma_free_coherent(&ha->pdev->dev, task_data->req_len,
1303 task_data->req_buffer, task_data->req_dma); 1304 task_data->req_buffer, task_data->req_dma);
1304 return -ENOMEM; 1305 return -ENOMEM;
1305} 1306}
@@ -1328,7 +1329,7 @@ static void qla4xxx_task_cleanup(struct iscsi_task *task)
1328 1329
1329 dma_free_coherent(&ha->pdev->dev, task_data->resp_len, 1330 dma_free_coherent(&ha->pdev->dev, task_data->resp_len,
1330 task_data->resp_buffer, task_data->resp_dma); 1331 task_data->resp_buffer, task_data->resp_dma);
1331 dma_free_coherent(&ha->pdev->dev, task->data_count + hdr_len, 1332 dma_free_coherent(&ha->pdev->dev, task_data->req_len,
1332 task_data->req_buffer, task_data->req_dma); 1333 task_data->req_buffer, task_data->req_dma);
1333 return; 1334 return;
1334} 1335}