diff options
| -rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 19 | ||||
| -rw-r--r-- | drivers/scsi/be2iscsi/be_main.h | 3 |
2 files changed, 11 insertions, 11 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 139002395d9..ac76b14ec4c 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
| @@ -629,29 +629,30 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | |||
| 629 | * alloc_wrb_handle - To allocate a wrb handle | 629 | * alloc_wrb_handle - To allocate a wrb handle |
| 630 | * @phba: The hba pointer | 630 | * @phba: The hba pointer |
| 631 | * @cid: The cid to use for allocation | 631 | * @cid: The cid to use for allocation |
| 632 | * @index: index allocation and wrb index | ||
| 633 | * | 632 | * |
| 634 | * This happens under session_lock until submission to chip | 633 | * This happens under session_lock until submission to chip |
| 635 | */ | 634 | */ |
| 636 | struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid, | 635 | struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid) |
| 637 | int index) | ||
| 638 | { | 636 | { |
| 639 | struct hwi_wrb_context *pwrb_context; | 637 | struct hwi_wrb_context *pwrb_context; |
| 640 | struct hwi_controller *phwi_ctrlr; | 638 | struct hwi_controller *phwi_ctrlr; |
| 641 | struct wrb_handle *pwrb_handle; | 639 | struct wrb_handle *pwrb_handle, *pwrb_handle_tmp; |
| 642 | 640 | ||
| 643 | phwi_ctrlr = phba->phwi_ctrlr; | 641 | phwi_ctrlr = phba->phwi_ctrlr; |
| 644 | pwrb_context = &phwi_ctrlr->wrb_context[cid]; | 642 | pwrb_context = &phwi_ctrlr->wrb_context[cid]; |
| 645 | if (pwrb_context->wrb_handles_available) { | 643 | if (pwrb_context->wrb_handles_available >= 2) { |
| 646 | pwrb_handle = pwrb_context->pwrb_handle_base[ | 644 | pwrb_handle = pwrb_context->pwrb_handle_base[ |
| 647 | pwrb_context->alloc_index]; | 645 | pwrb_context->alloc_index]; |
| 648 | pwrb_context->wrb_handles_available--; | 646 | pwrb_context->wrb_handles_available--; |
| 649 | pwrb_handle->nxt_wrb_index = pwrb_handle->wrb_index; | ||
| 650 | if (pwrb_context->alloc_index == | 647 | if (pwrb_context->alloc_index == |
| 651 | (phba->params.wrbs_per_cxn - 1)) | 648 | (phba->params.wrbs_per_cxn - 1)) |
| 652 | pwrb_context->alloc_index = 0; | 649 | pwrb_context->alloc_index = 0; |
| 653 | else | 650 | else |
| 654 | pwrb_context->alloc_index++; | 651 | pwrb_context->alloc_index++; |
| 652 | |||
| 653 | pwrb_handle_tmp = pwrb_context->pwrb_handle_base[ | ||
| 654 | pwrb_context->alloc_index]; | ||
| 655 | pwrb_handle->nxt_wrb_index = pwrb_handle_tmp->wrb_index; | ||
| 655 | } else | 656 | } else |
| 656 | pwrb_handle = NULL; | 657 | pwrb_handle = NULL; |
| 657 | return pwrb_handle; | 658 | return pwrb_handle; |
| @@ -3206,7 +3207,7 @@ beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn, | |||
| 3206 | * login/startup related tasks. | 3207 | * login/startup related tasks. |
| 3207 | */ | 3208 | */ |
| 3208 | pwrb_handle = alloc_wrb_handle(phba, (beiscsi_conn->beiscsi_conn_cid - | 3209 | pwrb_handle = alloc_wrb_handle(phba, (beiscsi_conn->beiscsi_conn_cid - |
| 3209 | phba->fw_config.iscsi_cid_start), 0); | 3210 | phba->fw_config.iscsi_cid_start)); |
| 3210 | pwrb = (struct iscsi_target_context_update_wrb *)pwrb_handle->pwrb; | 3211 | pwrb = (struct iscsi_target_context_update_wrb *)pwrb_handle->pwrb; |
| 3211 | memset(pwrb, 0, sizeof(*pwrb)); | 3212 | memset(pwrb, 0, sizeof(*pwrb)); |
| 3212 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, | 3213 | AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb, |
| @@ -3316,8 +3317,8 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
| 3316 | io_task->libiscsi_itt = (itt_t)task->itt; | 3317 | io_task->libiscsi_itt = (itt_t)task->itt; |
| 3317 | io_task->pwrb_handle = alloc_wrb_handle(phba, | 3318 | io_task->pwrb_handle = alloc_wrb_handle(phba, |
| 3318 | beiscsi_conn->beiscsi_conn_cid - | 3319 | beiscsi_conn->beiscsi_conn_cid - |
| 3319 | phba->fw_config.iscsi_cid_start, | 3320 | phba->fw_config.iscsi_cid_start |
| 3320 | task->itt); | 3321 | ); |
| 3321 | io_task->conn = beiscsi_conn; | 3322 | io_task->conn = beiscsi_conn; |
| 3322 | 3323 | ||
| 3323 | task->hdr = (struct iscsi_hdr *)&io_task->cmd_bhs->iscsi_hdr; | 3324 | task->hdr = (struct iscsi_hdr *)&io_task->cmd_bhs->iscsi_hdr; |
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index 0e2eac627be..0553f49db9b 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h | |||
| @@ -651,8 +651,7 @@ struct amap_iscsi_wrb { | |||
| 651 | 651 | ||
| 652 | } __packed; | 652 | } __packed; |
| 653 | 653 | ||
| 654 | struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid, | 654 | struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid); |
| 655 | int index); | ||
| 656 | void | 655 | void |
| 657 | free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle); | 656 | free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle); |
| 658 | 657 | ||
