aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJitendra Bhivare <jitendra.bhivare@broadcom.com>2016-02-04 05:19:14 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2016-02-23 21:27:02 -0500
commit69fd6d7b42374400f311d2eff59fc37cc184b6b2 (patch)
tree848598f003d4ed3d94c14aeef3df04fde1232c81 /drivers/scsi
parenta264f5e80d56ae675e25f0e4158e12f4df5efb9d (diff)
be2iscsi: Fix be_mcc_compl_poll to use tag_state
be_mcc_compl_poll waits till 'used' count of MCC WRBQ is zero. This is to determine the completion of an MCC sent. Change function to poll for the tag of MCC sent, instead, and wait till its tag_state is cleared. Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.c92
1 files changed, 47 insertions, 45 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 12b60dd8d1c9..60db2de9ed8a 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -104,19 +104,6 @@ int be_chk_reset_complete(struct beiscsi_hba *phba)
104 return 0; 104 return 0;
105} 105}
106 106
107void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
108{
109 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
110 u32 val = 0;
111
112 set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state);
113 val |= mccq->id & DB_MCCQ_RING_ID_MASK;
114 val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
115 /* ring doorbell after all of request and state is written */
116 wmb();
117 iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
118}
119
120unsigned int alloc_mcc_tag(struct beiscsi_hba *phba) 107unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
121{ 108{
122 unsigned int tag = 0; 109 unsigned int tag = 0;
@@ -139,6 +126,28 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
139 return tag; 126 return tag;
140} 127}
141 128
129void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
130{
131 spin_lock_bh(&ctrl->mcc_lock);
132 tag = tag & MCC_Q_CMD_TAG_MASK;
133 ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
134 if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
135 ctrl->mcc_free_index = 0;
136 else
137 ctrl->mcc_free_index++;
138 ctrl->mcc_tag_available++;
139 spin_unlock_bh(&ctrl->mcc_lock);
140}
141
142/**
143 * beiscsi_fail_session(): Closing session with appropriate error
144 * @cls_session: ptr to session
145 **/
146void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
147{
148 iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
149}
150
142/* 151/*
143 * beiscsi_mccq_compl_wait()- Process completion in MCC CQ 152 * beiscsi_mccq_compl_wait()- Process completion in MCC CQ
144 * @phba: Driver private structure 153 * @phba: Driver private structure
@@ -254,19 +263,6 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
254 return rc; 263 return rc;
255} 264}
256 265
257void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
258{
259 spin_lock(&ctrl->mcc_lock);
260 tag = tag & MCC_Q_CMD_TAG_MASK;
261 ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
262 if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
263 ctrl->mcc_free_index = 0;
264 else
265 ctrl->mcc_free_index++;
266 ctrl->mcc_tag_available++;
267 spin_unlock(&ctrl->mcc_lock);
268}
269
270static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl) 266static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
271{ 267{
272 if (compl->flags != 0) { 268 if (compl->flags != 0) {
@@ -328,15 +324,6 @@ static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl,
328 return 0; 324 return 0;
329} 325}
330 326
331/**
332 * beiscsi_fail_session(): Closing session with appropriate error
333 * @cls_session: ptr to session
334 **/
335void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
336{
337 iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
338}
339
340static void beiscsi_process_async_link(struct beiscsi_hba *phba, 327static void beiscsi_process_async_link(struct beiscsi_hba *phba,
341 struct be_mcc_compl *compl) 328 struct be_mcc_compl *compl)
342{ 329{
@@ -532,6 +519,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
532 **/ 519 **/
533int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag) 520int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
534{ 521{
522 struct be_ctrl_info *ctrl = &phba->ctrl;
535 int i; 523 int i;
536 524
537 for (i = 0; i < mcc_timeout; i++) { 525 for (i = 0; i < mcc_timeout; i++) {
@@ -540,19 +528,33 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
540 528
541 beiscsi_process_mcc_cq(phba); 529 beiscsi_process_mcc_cq(phba);
542 530
543 if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0) 531 if (!test_bit(MCC_TAG_STATE_RUNNING,
532 &ctrl->ptag_state[tag].tag_state))
544 break; 533 break;
545 udelay(100); 534 udelay(100);
546 } 535 }
547 if (i == mcc_timeout) { 536
548 beiscsi_log(phba, KERN_ERR, 537 if (i < mcc_timeout)
549 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 538 return 0;
550 "BC_%d : FW Timed Out\n"); 539
551 phba->fw_timeout = true; 540 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
552 beiscsi_ue_detect(phba); 541 "BC_%d : FW Timed Out\n");
553 return -EBUSY; 542 phba->fw_timeout = true;
554 } 543 beiscsi_ue_detect(phba);
555 return 0; 544 return -EBUSY;
545}
546
547void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
548{
549 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
550 u32 val = 0;
551
552 set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state);
553 val |= mccq->id & DB_MCCQ_RING_ID_MASK;
554 val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
555 /* make request available for DMA */
556 wmb();
557 iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
556} 558}
557 559
558/* 560/*