Lines Matching refs:ctrl
99 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in alloc_mcc_wrb()
103 spin_lock(&phba->ctrl.mcc_lock); in alloc_mcc_wrb()
108 mccq->used, phba->ctrl.mcc_tag_available); in alloc_mcc_wrb()
112 if (!phba->ctrl.mcc_tag_available) in alloc_mcc_wrb()
115 tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index]; in alloc_mcc_wrb()
120 phba->ctrl.mcc_tag_available, in alloc_mcc_wrb()
121 phba->ctrl.mcc_alloc_index); in alloc_mcc_wrb()
127 phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0; in alloc_mcc_wrb()
128 phba->ctrl.mcc_tag_status[tag] = 0; in alloc_mcc_wrb()
129 phba->ctrl.ptag_state[tag].tag_state = 0; in alloc_mcc_wrb()
130 phba->ctrl.ptag_state[tag].cbfn = NULL; in alloc_mcc_wrb()
131 phba->ctrl.mcc_tag_available--; in alloc_mcc_wrb()
132 if (phba->ctrl.mcc_alloc_index == (MAX_MCC_CMD - 1)) in alloc_mcc_wrb()
133 phba->ctrl.mcc_alloc_index = 0; in alloc_mcc_wrb()
135 phba->ctrl.mcc_alloc_index++; in alloc_mcc_wrb()
145 spin_unlock(&phba->ctrl.mcc_lock); in alloc_mcc_wrb()
149 void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag) in free_mcc_wrb() argument
151 struct be_queue_info *mccq = &ctrl->mcc_obj.q; in free_mcc_wrb()
153 spin_lock(&ctrl->mcc_lock); in free_mcc_wrb()
155 ctrl->mcc_tag[ctrl->mcc_free_index] = tag; in free_mcc_wrb()
156 if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1)) in free_mcc_wrb()
157 ctrl->mcc_free_index = 0; in free_mcc_wrb()
159 ctrl->mcc_free_index++; in free_mcc_wrb()
160 ctrl->mcc_tag_available++; in free_mcc_wrb()
162 spin_unlock(&ctrl->mcc_lock); in free_mcc_wrb()
181 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in __beiscsi_mcc_compl_status()
189 mcc_tag_status = phba->ctrl.mcc_tag_status[tag]; in __beiscsi_mcc_compl_status()
257 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
262 rc = wait_event_interruptible_timeout(phba->ctrl.mcc_wait[tag], in beiscsi_mccq_compl_wait()
263 phba->ctrl.mcc_tag_status[tag], in beiscsi_mccq_compl_wait()
273 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
290 tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state; in beiscsi_mccq_compl_wait()
301 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
312 free_mcc_wrb(&phba->ctrl, tag); in beiscsi_mccq_compl_wait()
327 static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl, in beiscsi_process_mbox_compl() argument
330 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_process_mbox_compl()
331 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_process_mbox_compl()
492 int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl, in beiscsi_process_mcc_compl() argument
495 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_process_mcc_compl()
505 &ctrl->ptag_state[tag].tag_state)) { in beiscsi_process_mcc_compl()
513 clear_bit(MCC_TAG_STATE_RUNNING, &ctrl->ptag_state[tag].tag_state); in beiscsi_process_mcc_compl()
515 if (test_bit(MCC_TAG_STATE_TIMEOUT, &ctrl->ptag_state[tag].tag_state)) { in beiscsi_process_mcc_compl()
524 tag_mem = &ctrl->ptag_state[tag].tag_mem_state; in beiscsi_process_mcc_compl()
526 pci_free_consistent(ctrl->pdev, tag_mem->size, in beiscsi_process_mcc_compl()
530 free_mcc_wrb(ctrl, tag); in beiscsi_process_mcc_compl()
542 ctrl->mcc_tag_status[tag] = CQE_VALID_MASK; in beiscsi_process_mcc_compl()
543 ctrl->mcc_tag_status[tag] |= (wrb_idx << CQE_STATUS_WRB_SHIFT); in beiscsi_process_mcc_compl()
544 ctrl->mcc_tag_status[tag] |= (extd_status << CQE_STATUS_ADDL_SHIFT) & in beiscsi_process_mcc_compl()
546 ctrl->mcc_tag_status[tag] |= (compl_status & CQE_STATUS_MASK); in beiscsi_process_mcc_compl()
548 if (test_bit(MCC_TAG_STATE_ASYNC, &ctrl->ptag_state[tag].tag_state)) { in beiscsi_process_mcc_compl()
549 if (ctrl->ptag_state[tag].cbfn) in beiscsi_process_mcc_compl()
550 ctrl->ptag_state[tag].cbfn(phba, tag); in beiscsi_process_mcc_compl()
554 free_mcc_wrb(ctrl, tag); in beiscsi_process_mcc_compl()
558 if (test_bit(MCC_TAG_STATE_IGNORE, &ctrl->ptag_state[tag].tag_state)) { in beiscsi_process_mcc_compl()
561 free_mcc_wrb(ctrl, tag); in beiscsi_process_mcc_compl()
565 wake_up_interruptible(&ctrl->mcc_wait[tag]); in beiscsi_process_mcc_compl()
571 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in be_mcc_notify()
574 set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state); in be_mcc_notify()
593 static int be_mbox_db_ready_poll(struct be_ctrl_info *ctrl) in be_mbox_db_ready_poll() argument
597 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_db_ready_poll()
598 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mbox_db_ready_poll()
643 static int be_mbox_notify(struct be_ctrl_info *ctrl) in be_mbox_notify() argument
647 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_notify()
648 struct be_dma_mem *mbox_mem = &ctrl->mbox_mem; in be_mbox_notify()
651 status = be_mbox_db_ready_poll(ctrl); in be_mbox_notify()
660 status = be_mbox_db_ready_poll(ctrl); in be_mbox_notify()
670 status = be_mbox_db_ready_poll(ctrl); in be_mbox_notify()
677 status = beiscsi_process_mbox_compl(ctrl, &mbox->compl); in be_mbox_notify()
743 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, in beiscsi_cmd_eq_create() argument
746 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_eq_create()
752 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_eq_create()
763 PCI_FUNC(ctrl->pdev->devfn)); in beiscsi_cmd_eq_create()
774 status = be_mbox_notify(ctrl); in beiscsi_cmd_eq_create()
779 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_eq_create()
783 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, in beiscsi_cmd_cq_create() argument
787 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_cq_create()
790 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_cq_create()
795 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_cq_create()
816 PCI_FUNC(ctrl->pdev->devfn)); in beiscsi_cmd_cq_create()
836 status = be_mbox_notify(ctrl); in beiscsi_cmd_cq_create()
845 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_cq_create()
865 struct be_ctrl_info *ctrl; in beiscsi_cmd_mccq_create() local
869 mutex_lock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
870 ctrl = &phba->ctrl; in beiscsi_cmd_mccq_create()
871 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_mccq_create()
897 status = be_mbox_notify(ctrl); in beiscsi_cmd_mccq_create()
903 mutex_unlock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
908 int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, in beiscsi_cmd_q_destroy() argument
911 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_q_destroy()
913 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_q_destroy()
921 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
951 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
959 status = be_mbox_notify(ctrl); in beiscsi_cmd_q_destroy()
961 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
983 int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl, in be_cmd_create_default_pdu_queue() argument
989 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_create_default_pdu_queue()
992 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_create_default_pdu_queue()
996 mutex_lock(&ctrl->mbox_lock); in be_cmd_create_default_pdu_queue()
1017 pci_func_id, ctxt, PCI_FUNC(ctrl->pdev->devfn)); in be_cmd_create_default_pdu_queue()
1045 status = be_mbox_notify(ctrl); in be_cmd_create_default_pdu_queue()
1068 mutex_unlock(&ctrl->mbox_lock); in be_cmd_create_default_pdu_queue()
1084 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, in be_cmd_wrbq_create() argument
1090 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_wrbq_create()
1093 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_wrbq_create()
1096 mutex_lock(&ctrl->mbox_lock); in be_cmd_wrbq_create()
1113 status = be_mbox_notify(ctrl); in be_cmd_wrbq_create()
1127 mutex_unlock(&ctrl->mbox_lock); in be_cmd_wrbq_create()
1131 int be_cmd_iscsi_post_template_hdr(struct be_ctrl_info *ctrl, in be_cmd_iscsi_post_template_hdr() argument
1134 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_post_template_hdr()
1138 mutex_lock(&ctrl->mbox_lock); in be_cmd_iscsi_post_template_hdr()
1150 status = be_mbox_notify(ctrl); in be_cmd_iscsi_post_template_hdr()
1151 mutex_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_post_template_hdr()
1155 int be_cmd_iscsi_remove_template_hdr(struct be_ctrl_info *ctrl) in be_cmd_iscsi_remove_template_hdr() argument
1157 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_remove_template_hdr()
1161 mutex_lock(&ctrl->mbox_lock); in be_cmd_iscsi_remove_template_hdr()
1171 status = be_mbox_notify(ctrl); in be_cmd_iscsi_remove_template_hdr()
1172 mutex_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_remove_template_hdr()
1176 int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl, in be_cmd_iscsi_post_sgl_pages() argument
1180 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_post_sgl_pages()
1182 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_iscsi_post_sgl_pages()
1191 mutex_lock(&ctrl->mbox_lock); in be_cmd_iscsi_post_sgl_pages()
1211 status = be_mbox_notify(ctrl); in be_cmd_iscsi_post_sgl_pages()
1220 mutex_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_post_sgl_pages()
1222 beiscsi_cmd_q_destroy(ctrl, NULL, QTYPE_SGL); in be_cmd_iscsi_post_sgl_pages()
1242 struct be_ctrl_info *ctrl = &phba->ctrl; in be_cmd_set_vlan() local
1244 if (mutex_lock_interruptible(&ctrl->mbox_lock)) in be_cmd_set_vlan()
1248 mutex_unlock(&ctrl->mbox_lock); in be_cmd_set_vlan()
1262 mutex_unlock(&ctrl->mbox_lock); in be_cmd_set_vlan()
1267 int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, in beiscsi_check_supported_fw() argument
1271 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_check_supported_fw()
1276 nonemb_cmd.va = pci_alloc_consistent(ctrl->pdev, in beiscsi_check_supported_fw()
1288 mutex_lock(&ctrl->mbox_lock); in beiscsi_check_supported_fw()
1296 status = be_mbox_notify(ctrl); in beiscsi_check_supported_fw()
1319 mutex_unlock(&ctrl->mbox_lock); in beiscsi_check_supported_fw()
1321 pci_free_consistent(ctrl->pdev, nonemb_cmd.size, in beiscsi_check_supported_fw()
1339 int beiscsi_get_fw_config(struct be_ctrl_info *ctrl, in beiscsi_get_fw_config() argument
1342 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_get_fw_config()
1348 mutex_lock(&ctrl->mbox_lock); in beiscsi_get_fw_config()
1356 if (be_mbox_notify(ctrl)) { in beiscsi_get_fw_config()
1483 mutex_unlock(&ctrl->mbox_lock); in beiscsi_get_fw_config()
1495 int beiscsi_get_port_name(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba) in beiscsi_get_port_name() argument
1501 mutex_lock(&ctrl->mbox_lock); in beiscsi_get_port_name()
1502 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_get_port_name()
1510 ret = be_mbox_notify(ctrl); in beiscsi_get_port_name()
1524 mutex_unlock(&ctrl->mbox_lock); in beiscsi_get_port_name()
1530 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_set_uer_feature() local
1535 mutex_lock(&ctrl->mbox_lock); in beiscsi_set_uer_feature()
1536 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_set_uer_feature()
1547 ret = be_mbox_notify(ctrl); in beiscsi_set_uer_feature()
1564 mutex_unlock(&ctrl->mbox_lock); in beiscsi_set_uer_feature()
1606 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_cmd_function_reset() local
1607 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_function_reset()
1611 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_function_reset()
1617 status = be_mbox_notify(ctrl); in beiscsi_cmd_function_reset()
1619 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_function_reset()
1623 int beiscsi_cmd_special_wrb(struct be_ctrl_info *ctrl, u32 load) in beiscsi_cmd_special_wrb() argument
1625 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_special_wrb()
1626 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_special_wrb()
1630 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_special_wrb()
1657 status = be_mbox_notify(ctrl); in beiscsi_cmd_special_wrb()
1661 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_special_wrb()
1692 return beiscsi_cmd_special_wrb(&phba->ctrl, 1); in beiscsi_init_sliport()
1706 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_cmd_iscsi_cleanup() local
1712 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_iscsi_cleanup()
1713 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_iscsi_cleanup()
1736 status = be_mbox_notify(ctrl); in beiscsi_cmd_iscsi_cleanup()
1740 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_iscsi_cleanup()