aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/be2iscsi/be_main.c')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c64
1 files changed, 48 insertions, 16 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 2e6abe7b7324..fe0c5143f8e6 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1198,14 +1198,16 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
1198 * alloc_wrb_handle - To allocate a wrb handle 1198 * alloc_wrb_handle - To allocate a wrb handle
1199 * @phba: The hba pointer 1199 * @phba: The hba pointer
1200 * @cid: The cid to use for allocation 1200 * @cid: The cid to use for allocation
1201 * @pwrb_context: ptr to ptr to wrb context
1201 * 1202 *
1202 * This happens under session_lock until submission to chip 1203 * This happens under session_lock until submission to chip
1203 */ 1204 */
1204struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid) 1205struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid,
1206 struct hwi_wrb_context **pcontext)
1205{ 1207{
1206 struct hwi_wrb_context *pwrb_context; 1208 struct hwi_wrb_context *pwrb_context;
1207 struct hwi_controller *phwi_ctrlr; 1209 struct hwi_controller *phwi_ctrlr;
1208 struct wrb_handle *pwrb_handle, *pwrb_handle_tmp; 1210 struct wrb_handle *pwrb_handle;
1209 uint16_t cri_index = BE_GET_CRI_FROM_CID(cid); 1211 uint16_t cri_index = BE_GET_CRI_FROM_CID(cid);
1210 1212
1211 phwi_ctrlr = phba->phwi_ctrlr; 1213 phwi_ctrlr = phba->phwi_ctrlr;
@@ -1219,9 +1221,9 @@ struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid)
1219 pwrb_context->alloc_index = 0; 1221 pwrb_context->alloc_index = 0;
1220 else 1222 else
1221 pwrb_context->alloc_index++; 1223 pwrb_context->alloc_index++;
1222 pwrb_handle_tmp = pwrb_context->pwrb_handle_base[ 1224
1223 pwrb_context->alloc_index]; 1225 /* Return the context address */
1224 pwrb_handle->nxt_wrb_index = pwrb_handle_tmp->wrb_index; 1226 *pcontext = pwrb_context;
1225 } else 1227 } else
1226 pwrb_handle = NULL; 1228 pwrb_handle = NULL;
1227 return pwrb_handle; 1229 return pwrb_handle;
@@ -3184,7 +3186,7 @@ be_sgl_create_contiguous(void *virtual_address,
3184{ 3186{
3185 WARN_ON(!virtual_address); 3187 WARN_ON(!virtual_address);
3186 WARN_ON(!physical_address); 3188 WARN_ON(!physical_address);
3187 WARN_ON(!length > 0); 3189 WARN_ON(!length);
3188 WARN_ON(!sgl); 3190 WARN_ON(!sgl);
3189 3191
3190 sgl->va = virtual_address; 3192 sgl->va = virtual_address;
@@ -4678,6 +4680,7 @@ beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn,
4678 struct beiscsi_offload_params *params) 4680 struct beiscsi_offload_params *params)
4679{ 4681{
4680 struct wrb_handle *pwrb_handle; 4682 struct wrb_handle *pwrb_handle;
4683 struct hwi_wrb_context *pwrb_context = NULL;
4681 struct beiscsi_hba *phba = beiscsi_conn->phba; 4684 struct beiscsi_hba *phba = beiscsi_conn->phba;
4682 struct iscsi_task *task = beiscsi_conn->task; 4685 struct iscsi_task *task = beiscsi_conn->task;
4683 struct iscsi_session *session = task->conn->session; 4686 struct iscsi_session *session = task->conn->session;
@@ -4692,14 +4695,17 @@ beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn,
4692 beiscsi_cleanup_task(task); 4695 beiscsi_cleanup_task(task);
4693 spin_unlock_bh(&session->back_lock); 4696 spin_unlock_bh(&session->back_lock);
4694 4697
4695 pwrb_handle = alloc_wrb_handle(phba, beiscsi_conn->beiscsi_conn_cid); 4698 pwrb_handle = alloc_wrb_handle(phba, beiscsi_conn->beiscsi_conn_cid,
4699 &pwrb_context);
4696 4700
4697 /* Check for the adapter family */ 4701 /* Check for the adapter family */
4698 if (is_chip_be2_be3r(phba)) 4702 if (is_chip_be2_be3r(phba))
4699 beiscsi_offload_cxn_v0(params, pwrb_handle, 4703 beiscsi_offload_cxn_v0(params, pwrb_handle,
4700 phba->init_mem); 4704 phba->init_mem,
4705 pwrb_context);
4701 else 4706 else
4702 beiscsi_offload_cxn_v2(params, pwrb_handle); 4707 beiscsi_offload_cxn_v2(params, pwrb_handle,
4708 pwrb_context);
4703 4709
4704 be_dws_le_to_cpu(pwrb_handle->pwrb, 4710 be_dws_le_to_cpu(pwrb_handle->pwrb,
4705 sizeof(struct iscsi_target_context_update_wrb)); 4711 sizeof(struct iscsi_target_context_update_wrb));
@@ -4769,7 +4775,8 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
4769 goto free_hndls; 4775 goto free_hndls;
4770 } 4776 }
4771 io_task->pwrb_handle = alloc_wrb_handle(phba, 4777 io_task->pwrb_handle = alloc_wrb_handle(phba,
4772 beiscsi_conn->beiscsi_conn_cid); 4778 beiscsi_conn->beiscsi_conn_cid,
4779 &io_task->pwrb_context);
4773 if (!io_task->pwrb_handle) { 4780 if (!io_task->pwrb_handle) {
4774 beiscsi_log(phba, KERN_ERR, 4781 beiscsi_log(phba, KERN_ERR,
4775 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG, 4782 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
@@ -4803,7 +4810,8 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
4803 io_task->psgl_handle; 4810 io_task->psgl_handle;
4804 io_task->pwrb_handle = 4811 io_task->pwrb_handle =
4805 alloc_wrb_handle(phba, 4812 alloc_wrb_handle(phba,
4806 beiscsi_conn->beiscsi_conn_cid); 4813 beiscsi_conn->beiscsi_conn_cid,
4814 &io_task->pwrb_context);
4807 if (!io_task->pwrb_handle) { 4815 if (!io_task->pwrb_handle) {
4808 beiscsi_log(phba, KERN_ERR, 4816 beiscsi_log(phba, KERN_ERR,
4809 BEISCSI_LOG_IO | 4817 BEISCSI_LOG_IO |
@@ -4839,7 +4847,8 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
4839 } 4847 }
4840 io_task->pwrb_handle = 4848 io_task->pwrb_handle =
4841 alloc_wrb_handle(phba, 4849 alloc_wrb_handle(phba,
4842 beiscsi_conn->beiscsi_conn_cid); 4850 beiscsi_conn->beiscsi_conn_cid,
4851 &io_task->pwrb_context);
4843 if (!io_task->pwrb_handle) { 4852 if (!io_task->pwrb_handle) {
4844 beiscsi_log(phba, KERN_ERR, 4853 beiscsi_log(phba, KERN_ERR,
4845 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG, 4854 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
@@ -4925,7 +4934,12 @@ int beiscsi_iotask_v2(struct iscsi_task *task, struct scatterlist *sg,
4925 4934
4926 hwi_write_sgl_v2(pwrb, sg, num_sg, io_task); 4935 hwi_write_sgl_v2(pwrb, sg, num_sg, io_task);
4927 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, ptr2nextwrb, pwrb, 4936 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, ptr2nextwrb, pwrb,
4928 io_task->pwrb_handle->nxt_wrb_index); 4937 io_task->pwrb_handle->wrb_index);
4938 if (io_task->pwrb_context->plast_wrb)
4939 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, ptr2nextwrb,
4940 io_task->pwrb_context->plast_wrb,
4941 io_task->pwrb_handle->wrb_index);
4942 io_task->pwrb_context->plast_wrb = pwrb;
4929 4943
4930 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb)); 4944 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb));
4931 4945
@@ -4982,7 +4996,13 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
4982 hwi_write_sgl(pwrb, sg, num_sg, io_task); 4996 hwi_write_sgl(pwrb, sg, num_sg, io_task);
4983 4997
4984 AMAP_SET_BITS(struct amap_iscsi_wrb, ptr2nextwrb, pwrb, 4998 AMAP_SET_BITS(struct amap_iscsi_wrb, ptr2nextwrb, pwrb,
4985 io_task->pwrb_handle->nxt_wrb_index); 4999 io_task->pwrb_handle->wrb_index);
5000 if (io_task->pwrb_context->plast_wrb)
5001 AMAP_SET_BITS(struct amap_iscsi_wrb, ptr2nextwrb,
5002 io_task->pwrb_context->plast_wrb,
5003 io_task->pwrb_handle->wrb_index);
5004 io_task->pwrb_context->plast_wrb = pwrb;
5005
4986 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb)); 5006 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb));
4987 5007
4988 doorbell |= beiscsi_conn->beiscsi_conn_cid & DB_WRB_POST_CID_MASK; 5008 doorbell |= beiscsi_conn->beiscsi_conn_cid & DB_WRB_POST_CID_MASK;
@@ -5020,7 +5040,13 @@ static int beiscsi_mtask(struct iscsi_task *task)
5020 AMAP_SET_BITS(struct amap_iscsi_wrb, r2t_exp_dtl, pwrb, 5040 AMAP_SET_BITS(struct amap_iscsi_wrb, r2t_exp_dtl, pwrb,
5021 task->data_count); 5041 task->data_count);
5022 AMAP_SET_BITS(struct amap_iscsi_wrb, ptr2nextwrb, pwrb, 5042 AMAP_SET_BITS(struct amap_iscsi_wrb, ptr2nextwrb, pwrb,
5023 io_task->pwrb_handle->nxt_wrb_index); 5043 io_task->pwrb_handle->wrb_index);
5044 if (io_task->pwrb_context->plast_wrb)
5045 AMAP_SET_BITS(struct amap_iscsi_wrb, ptr2nextwrb,
5046 io_task->pwrb_context->plast_wrb,
5047 io_task->pwrb_handle->wrb_index);
5048 io_task->pwrb_context->plast_wrb = pwrb;
5049
5024 pwrb_typeoffset = BE_WRB_TYPE_OFFSET; 5050 pwrb_typeoffset = BE_WRB_TYPE_OFFSET;
5025 } else { 5051 } else {
5026 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, cmdsn_itt, pwrb, 5052 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, cmdsn_itt, pwrb,
@@ -5032,7 +5058,13 @@ static int beiscsi_mtask(struct iscsi_task *task)
5032 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, r2t_exp_dtl, pwrb, 5058 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, r2t_exp_dtl, pwrb,
5033 task->data_count); 5059 task->data_count);
5034 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, ptr2nextwrb, pwrb, 5060 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, ptr2nextwrb, pwrb,
5035 io_task->pwrb_handle->nxt_wrb_index); 5061 io_task->pwrb_handle->wrb_index);
5062 if (io_task->pwrb_context->plast_wrb)
5063 AMAP_SET_BITS(struct amap_iscsi_wrb_v2, ptr2nextwrb,
5064 io_task->pwrb_context->plast_wrb,
5065 io_task->pwrb_handle->wrb_index);
5066 io_task->pwrb_context->plast_wrb = pwrb;
5067
5036 pwrb_typeoffset = SKH_WRB_TYPE_OFFSET; 5068 pwrb_typeoffset = SKH_WRB_TYPE_OFFSET;
5037 } 5069 }
5038 5070