aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJayamohan Kallickal <jayamohank@serverengines.com>2010-07-21 18:55:40 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:05:34 -0400
commitd2cecf0dcb2eb066756e0303d9f162ebe20d0591 (patch)
treebfcda4d785072b75b55b096f1346e6f87efd5476 /drivers
parente9b911935033ea9e28a2f7a274c9a81db1f8d91a (diff)
[SCSI] be2iscsi: Maintain same ITT across login
This patch ensures that the same ITT is maintained across all login pdu's Signed-off-by: Jayamohan Kallickal <jayamohank@serverengines.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c41
-rw-r--r--drivers/scsi/be2iscsi/be_main.h1
2 files changed, 37 insertions, 5 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 1a22125f520..fdd9161096c 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3452,14 +3452,12 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
3452 return -ENOMEM; 3452 return -ENOMEM;
3453 io_task->bhs_pa.u.a64.address = paddr; 3453 io_task->bhs_pa.u.a64.address = paddr;
3454 io_task->libiscsi_itt = (itt_t)task->itt; 3454 io_task->libiscsi_itt = (itt_t)task->itt;
3455 io_task->pwrb_handle = alloc_wrb_handle(phba,
3456 beiscsi_conn->beiscsi_conn_cid -
3457 phba->fw_config.iscsi_cid_start
3458 );
3459 io_task->conn = beiscsi_conn; 3455 io_task->conn = beiscsi_conn;
3460 3456
3461 task->hdr = (struct iscsi_hdr *)&io_task->cmd_bhs->iscsi_hdr; 3457 task->hdr = (struct iscsi_hdr *)&io_task->cmd_bhs->iscsi_hdr;
3462 task->hdr_max = sizeof(struct be_cmd_bhs); 3458 task->hdr_max = sizeof(struct be_cmd_bhs);
3459 io_task->psgl_handle = NULL;
3460 io_task->psgl_handle = NULL;
3463 3461
3464 if (task->sc) { 3462 if (task->sc) {
3465 spin_lock(&phba->io_sgl_lock); 3463 spin_lock(&phba->io_sgl_lock);
@@ -3467,6 +3465,11 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
3467 spin_unlock(&phba->io_sgl_lock); 3465 spin_unlock(&phba->io_sgl_lock);
3468 if (!io_task->psgl_handle) 3466 if (!io_task->psgl_handle)
3469 goto free_hndls; 3467 goto free_hndls;
3468 io_task->pwrb_handle = alloc_wrb_handle(phba,
3469 beiscsi_conn->beiscsi_conn_cid -
3470 phba->fw_config.iscsi_cid_start);
3471 if (!io_task->pwrb_handle)
3472 goto free_io_hndls;
3470 } else { 3473 } else {
3471 io_task->scsi_cmnd = NULL; 3474 io_task->scsi_cmnd = NULL;
3472 if ((opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) { 3475 if ((opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) {
@@ -3481,9 +3484,20 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
3481 beiscsi_conn->login_in_progress = 1; 3484 beiscsi_conn->login_in_progress = 1;
3482 beiscsi_conn->plogin_sgl_handle = 3485 beiscsi_conn->plogin_sgl_handle =
3483 io_task->psgl_handle; 3486 io_task->psgl_handle;
3487 io_task->pwrb_handle =
3488 alloc_wrb_handle(phba,
3489 beiscsi_conn->beiscsi_conn_cid -
3490 phba->fw_config.iscsi_cid_start);
3491 if (!io_task->pwrb_handle)
3492 goto free_io_hndls;
3493 beiscsi_conn->plogin_wrb_handle =
3494 io_task->pwrb_handle;
3495
3484 } else { 3496 } else {
3485 io_task->psgl_handle = 3497 io_task->psgl_handle =
3486 beiscsi_conn->plogin_sgl_handle; 3498 beiscsi_conn->plogin_sgl_handle;
3499 io_task->pwrb_handle =
3500 beiscsi_conn->plogin_wrb_handle;
3487 } 3501 }
3488 } else { 3502 } else {
3489 spin_lock(&phba->mgmt_sgl_lock); 3503 spin_lock(&phba->mgmt_sgl_lock);
@@ -3491,6 +3505,13 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
3491 spin_unlock(&phba->mgmt_sgl_lock); 3505 spin_unlock(&phba->mgmt_sgl_lock);
3492 if (!io_task->psgl_handle) 3506 if (!io_task->psgl_handle)
3493 goto free_hndls; 3507 goto free_hndls;
3508 io_task->pwrb_handle =
3509 alloc_wrb_handle(phba,
3510 beiscsi_conn->beiscsi_conn_cid -
3511 phba->fw_config.iscsi_cid_start);
3512 if (!io_task->pwrb_handle)
3513 goto free_mgmt_hndls;
3514
3494 } 3515 }
3495 } 3516 }
3496 itt = (itt_t) cpu_to_be32(((unsigned int)io_task->pwrb_handle-> 3517 itt = (itt_t) cpu_to_be32(((unsigned int)io_task->pwrb_handle->
@@ -3501,12 +3522,22 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
3501 io_task->cmd_bhs->iscsi_hdr.itt = itt; 3522 io_task->cmd_bhs->iscsi_hdr.itt = itt;
3502 return 0; 3523 return 0;
3503 3524
3525free_io_hndls:
3526 spin_lock(&phba->io_sgl_lock);
3527 free_io_sgl_handle(phba, io_task->psgl_handle);
3528 spin_unlock(&phba->io_sgl_lock);
3529 goto free_hndls;
3530free_mgmt_hndls:
3531 spin_lock(&phba->mgmt_sgl_lock);
3532 free_mgmt_sgl_handle(phba, io_task->psgl_handle);
3533 spin_unlock(&phba->mgmt_sgl_lock);
3504free_hndls: 3534free_hndls:
3505 phwi_ctrlr = phba->phwi_ctrlr; 3535 phwi_ctrlr = phba->phwi_ctrlr;
3506 pwrb_context = &phwi_ctrlr->wrb_context[ 3536 pwrb_context = &phwi_ctrlr->wrb_context[
3507 beiscsi_conn->beiscsi_conn_cid - 3537 beiscsi_conn->beiscsi_conn_cid -
3508 phba->fw_config.iscsi_cid_start]; 3538 phba->fw_config.iscsi_cid_start];
3509 free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle); 3539 if (io_task->pwrb_handle)
3540 free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle);
3510 io_task->pwrb_handle = NULL; 3541 io_task->pwrb_handle = NULL;
3511 pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs, 3542 pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
3512 io_task->bhs_pa.u.a64.address); 3543 io_task->bhs_pa.u.a64.address);
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 05ad76e48d8..08996d008ba 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -359,6 +359,7 @@ struct beiscsi_conn {
359 u32 beiscsi_conn_cid; 359 u32 beiscsi_conn_cid;
360 struct beiscsi_endpoint *ep; 360 struct beiscsi_endpoint *ep;
361 unsigned short login_in_progress; 361 unsigned short login_in_progress;
362 struct wrb_handle *plogin_wrb_handle;
362 struct sgl_handle *plogin_sgl_handle; 363 struct sgl_handle *plogin_sgl_handle;
363 struct beiscsi_session *beiscsi_sess; 364 struct beiscsi_session *beiscsi_sess;
364 struct iscsi_task *task; 365 struct iscsi_task *task;