aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJitendra Bhivare <jitendra.bhivare@broadcom.com>2016-08-19 05:50:17 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-08-23 22:42:44 -0400
commitf79929deb56e1b8053c36adf7ee8d34b39e673a8 (patch)
treed3f2533f35ed409f1d41bb006b3cfdfa8ffa52b2
parent4d2ee1e688a26ee580b9f3e824afa278bbb178a5 (diff)
scsi: be2iscsi: Add V1 of EPFW cleanup IOCTL
mgmt_epfw_cleanup does not implement v1 of OPCODE_COMMON_ISCSI_CLEANUP IOCTL for SkyHawk. Replace use of MCCQ with BMBX for issuing the IOCTL. Remove be_mcc_compl_poll which is no longer needed. Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.c96
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.h15
-rw-r--r--drivers/scsi/be2iscsi/be_main.c27
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.c42
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.h1
5 files changed, 73 insertions, 108 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 771670c0682b..6f3cd82c4295 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -478,53 +478,6 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
478 return 0; 478 return 0;
479} 479}
480 480
481/*
482 * be_mcc_compl_poll()- Wait for MBX completion
483 * @phba: driver private structure
484 *
485 * Wait till no more pending mcc requests are present
486 *
487 * return
488 * Success: 0
489 * Failure: Non-Zero
490 *
491 **/
492int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
493{
494 struct be_ctrl_info *ctrl = &phba->ctrl;
495 int i;
496
497 if (!test_bit(MCC_TAG_STATE_RUNNING,
498 &ctrl->ptag_state[tag].tag_state)) {
499 beiscsi_log(phba, KERN_ERR,
500 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
501 "BC_%d: tag %u state not running\n", tag);
502 return 0;
503 }
504 for (i = 0; i < mcc_timeout; i++) {
505 if (beiscsi_hba_in_error(phba))
506 return -EIO;
507
508 beiscsi_process_mcc_cq(phba);
509 /* after polling, wrb and tag need to be released */
510 if (!test_bit(MCC_TAG_STATE_RUNNING,
511 &ctrl->ptag_state[tag].tag_state)) {
512 free_mcc_wrb(ctrl, tag);
513 break;
514 }
515 udelay(100);
516 }
517
518 if (i < mcc_timeout)
519 return 0;
520
521 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
522 "BC_%d : FW Timed Out\n");
523 set_bit(BEISCSI_HBA_FW_TIMEOUT, &phba->state);
524 beiscsi_ue_detect(phba);
525 return -EBUSY;
526}
527
528void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag) 481void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
529{ 482{
530 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; 483 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
@@ -1645,3 +1598,52 @@ int beiscsi_init_sliport(struct beiscsi_hba *phba)
1645 /* indicate driver is loading */ 1598 /* indicate driver is loading */
1646 return beiscsi_cmd_special_wrb(&phba->ctrl, 1); 1599 return beiscsi_cmd_special_wrb(&phba->ctrl, 1);
1647} 1600}
1601
1602/**
1603 * beiscsi_cmd_iscsi_cleanup()- Inform FW to cleanup EP data structures.
1604 * @phba: pointer to dev priv structure
1605 * @ulp: ULP number.
1606 *
1607 * return
1608 * Success: 0
1609 * Failure: Non-Zero Value
1610 **/
1611int beiscsi_cmd_iscsi_cleanup(struct beiscsi_hba *phba, unsigned short ulp)
1612{
1613 struct be_ctrl_info *ctrl = &phba->ctrl;
1614 struct iscsi_cleanup_req_v1 *req_v1;
1615 struct iscsi_cleanup_req *req;
1616 struct be_mcc_wrb *wrb;
1617 int status;
1618
1619 mutex_lock(&ctrl->mbox_lock);
1620 wrb = wrb_from_mbox(&ctrl->mbox_mem);
1621 req = embedded_payload(wrb);
1622 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
1623 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
1624 OPCODE_COMMON_ISCSI_CLEANUP, sizeof(*req));
1625
1626 /**
1627 * TODO: Check with FW folks the chute value to be set.
1628 * For now, use the ULP_MASK as the chute value.
1629 */
1630 if (is_chip_be2_be3r(phba)) {
1631 req->chute = (1 << ulp);
1632 req->hdr_ring_id = HWI_GET_DEF_HDRQ_ID(phba, ulp);
1633 req->data_ring_id = HWI_GET_DEF_BUFQ_ID(phba, ulp);
1634 } else {
1635 req_v1 = (struct iscsi_cleanup_req_v1 *)req;
1636 req_v1->hdr.version = 1;
1637 req_v1->hdr_ring_id = cpu_to_le16(HWI_GET_DEF_HDRQ_ID(phba,
1638 ulp));
1639 req_v1->data_ring_id = cpu_to_le16(HWI_GET_DEF_BUFQ_ID(phba,
1640 ulp));
1641 }
1642
1643 status = be_mbox_notify(ctrl);
1644 if (status)
1645 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
1646 "BG_%d : %s failed %d\n", __func__, ulp);
1647 mutex_unlock(&ctrl->mbox_lock);
1648 return status;
1649}
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 47b7197f17a2..cf4239987acf 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -768,6 +768,8 @@ int beiscsi_check_fw_rdy(struct beiscsi_hba *phba);
768 768
769int beiscsi_init_sliport(struct beiscsi_hba *phba); 769int beiscsi_init_sliport(struct beiscsi_hba *phba);
770 770
771int beiscsi_cmd_iscsi_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num);
772
771int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, 773int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
772 struct be_queue_info *eq, int eq_delay); 774 struct be_queue_info *eq, int eq_delay);
773 775
@@ -782,8 +784,6 @@ int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
782 struct be_queue_info *mccq, 784 struct be_queue_info *mccq,
783 struct be_queue_info *cq); 785 struct be_queue_info *cq);
784 786
785int be_poll_mcc(struct be_ctrl_info *ctrl);
786
787unsigned int be_cmd_get_initname(struct beiscsi_hba *phba); 787unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
788 788
789void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag); 789void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag);
@@ -798,9 +798,7 @@ int __beiscsi_mcc_compl_status(struct beiscsi_hba *phba,
798 unsigned int tag, 798 unsigned int tag,
799 struct be_mcc_wrb **wrb, 799 struct be_mcc_wrb **wrb,
800 struct be_dma_mem *mbx_cmd_mem); 800 struct be_dma_mem *mbx_cmd_mem);
801/*ISCSI Functuions */
802struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem); 801struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
803int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag);
804void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag); 802void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag);
805struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba, 803struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba,
806 unsigned int *ref_tag); 804 unsigned int *ref_tag);
@@ -1063,7 +1061,16 @@ struct iscsi_cleanup_req {
1063 u16 chute; 1061 u16 chute;
1064 u8 hdr_ring_id; 1062 u8 hdr_ring_id;
1065 u8 data_ring_id; 1063 u8 data_ring_id;
1064} __packed;
1066 1065
1066struct iscsi_cleanup_req_v1 {
1067 struct be_cmd_req_hdr hdr;
1068 u16 chute;
1069 u16 rsvd1;
1070 u16 hdr_ring_id;
1071 u16 rsvd2;
1072 u16 data_ring_id;
1073 u16 rsvd3;
1067} __packed; 1074} __packed;
1068 1075
1069struct eq_delay { 1076struct eq_delay {
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index b4e6fc222d60..e7741072995a 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3249,7 +3249,6 @@ beiscsi_create_def_hdr(struct beiscsi_hba *phba,
3249 "BM_%d : iscsi hdr def pdu id for ULP : %d is %d\n", 3249 "BM_%d : iscsi hdr def pdu id for ULP : %d is %d\n",
3250 ulp_num, 3250 ulp_num,
3251 phwi_context->be_def_hdrq[ulp_num].id); 3251 phwi_context->be_def_hdrq[ulp_num].id);
3252 hwi_post_async_buffers(phba, BEISCSI_DEFQ_HDR, ulp_num);
3253 return 0; 3252 return 0;
3254} 3253}
3255 3254
@@ -3304,11 +3303,9 @@ beiscsi_create_def_data(struct beiscsi_hba *phba,
3304 ulp_num, 3303 ulp_num,
3305 phwi_context->be_def_dataq[ulp_num].id); 3304 phwi_context->be_def_dataq[ulp_num].id);
3306 3305
3307 hwi_post_async_buffers(phba, BEISCSI_DEFQ_DATA, ulp_num);
3308 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, 3306 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3309 "BM_%d : DEFAULT PDU DATA RING CREATED" 3307 "BM_%d : DEFAULT PDU DATA RING CREATED"
3310 "on ULP : %d\n", ulp_num); 3308 "on ULP : %d\n", ulp_num);
3311
3312 return 0; 3309 return 0;
3313} 3310}
3314 3311
@@ -3757,6 +3754,15 @@ static int hwi_init_port(struct beiscsi_hba *phba)
3757 ulp_num); 3754 ulp_num);
3758 goto error; 3755 goto error;
3759 } 3756 }
3757 /**
3758 * Now that the default PDU rings have been created,
3759 * let EP know about it.
3760 * Call beiscsi_cmd_iscsi_cleanup before posting?
3761 */
3762 hwi_post_async_buffers(phba, BEISCSI_DEFQ_HDR,
3763 ulp_num);
3764 hwi_post_async_buffers(phba, BEISCSI_DEFQ_DATA,
3765 ulp_num);
3760 } 3766 }
3761 } 3767 }
3762 3768
@@ -4235,19 +4241,12 @@ static void hwi_purge_eq(struct beiscsi_hba *phba)
4235 4241
4236static void beiscsi_cleanup_port(struct beiscsi_hba *phba) 4242static void beiscsi_cleanup_port(struct beiscsi_hba *phba)
4237{ 4243{
4238 int mgmt_status, ulp_num;
4239 struct ulp_cid_info *ptr_cid_info = NULL; 4244 struct ulp_cid_info *ptr_cid_info = NULL;
4245 int ulp_num;
4240 4246
4241 for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) { 4247 for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++)
4242 if (test_bit(ulp_num, (void *)&phba->fw_config.ulp_supported)) { 4248 if (test_bit(ulp_num, (void *)&phba->fw_config.ulp_supported))
4243 mgmt_status = mgmt_epfw_cleanup(phba, ulp_num); 4249 beiscsi_cmd_iscsi_cleanup(phba, ulp_num);
4244 if (mgmt_status)
4245 beiscsi_log(phba, KERN_WARNING,
4246 BEISCSI_LOG_INIT,
4247 "BM_%d : mgmt_epfw_cleanup FAILED"
4248 " for ULP_%d\n", ulp_num);
4249 }
4250 }
4251 4250
4252 hwi_purge_eq(phba); 4251 hwi_purge_eq(phba);
4253 hwi_cleanup_port(phba); 4252 hwi_cleanup_port(phba);
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 706a817b8313..a844299ea979 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -256,48 +256,6 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
256 return tag; 256 return tag;
257} 257}
258 258
259/**
260 * mgmt_epfw_cleanup()- Inform FW to cleanup data structures.
261 * @phba: pointer to dev priv structure
262 * @ulp_num: ULP number.
263 *
264 * return
265 * Success: 0
266 * Failure: Non-Zero Value
267 **/
268int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num)
269{
270 struct be_ctrl_info *ctrl = &phba->ctrl;
271 struct be_mcc_wrb *wrb;
272 struct iscsi_cleanup_req *req;
273 unsigned int tag;
274 int status;
275
276 mutex_lock(&ctrl->mbox_lock);
277 wrb = alloc_mcc_wrb(phba, &tag);
278 if (!wrb) {
279 mutex_unlock(&ctrl->mbox_lock);
280 return -EBUSY;
281 }
282
283 req = embedded_payload(wrb);
284 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
285 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
286 OPCODE_COMMON_ISCSI_CLEANUP, sizeof(*req));
287
288 req->chute = (1 << ulp_num);
289 req->hdr_ring_id = cpu_to_le16(HWI_GET_DEF_HDRQ_ID(phba, ulp_num));
290 req->data_ring_id = cpu_to_le16(HWI_GET_DEF_BUFQ_ID(phba, ulp_num));
291
292 be_mcc_notify(phba, tag);
293 status = be_mcc_compl_poll(phba, tag);
294 if (status)
295 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
296 "BG_%d : mgmt_epfw_cleanup , FAILED\n");
297 mutex_unlock(&ctrl->mbox_lock);
298 return status;
299}
300
301unsigned int mgmt_invalidate_icds(struct beiscsi_hba *phba, 259unsigned int mgmt_invalidate_icds(struct beiscsi_hba *phba,
302 struct invalidate_command_table *inv_tbl, 260 struct invalidate_command_table *inv_tbl,
303 unsigned int num_invalidate, unsigned int cid, 261 unsigned int num_invalidate, unsigned int cid,
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h
index f8d27783f207..dab128fb2ce3 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.h
+++ b/drivers/scsi/be2iscsi/be_mgmt.h
@@ -96,7 +96,6 @@ struct mcc_wrb {
96 struct mcc_wrb_payload payload; 96 struct mcc_wrb_payload payload;
97}; 97};
98 98
99int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute);
100int mgmt_open_connection(struct beiscsi_hba *phba, 99int mgmt_open_connection(struct beiscsi_hba *phba,
101 struct sockaddr *dst_addr, 100 struct sockaddr *dst_addr,
102 struct beiscsi_endpoint *beiscsi_ep, 101 struct beiscsi_endpoint *beiscsi_ep,