Lines Matching full:ctrl

91 	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;  in alloc_mcc_wrb()
95 spin_lock(&phba->ctrl.mcc_lock); in alloc_mcc_wrb()
100 mccq->used, phba->ctrl.mcc_tag_available); in alloc_mcc_wrb()
104 if (!phba->ctrl.mcc_tag_available) in alloc_mcc_wrb()
107 tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index]; in alloc_mcc_wrb()
112 phba->ctrl.mcc_tag_available, in alloc_mcc_wrb()
113 phba->ctrl.mcc_alloc_index); in alloc_mcc_wrb()
119 phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0; in alloc_mcc_wrb()
120 phba->ctrl.mcc_tag_status[tag] = 0; in alloc_mcc_wrb()
121 phba->ctrl.ptag_state[tag].tag_state = 0; in alloc_mcc_wrb()
122 phba->ctrl.ptag_state[tag].cbfn = NULL; in alloc_mcc_wrb()
123 phba->ctrl.mcc_tag_available--; in alloc_mcc_wrb()
124 if (phba->ctrl.mcc_alloc_index == (MAX_MCC_CMD - 1)) in alloc_mcc_wrb()
125 phba->ctrl.mcc_alloc_index = 0; in alloc_mcc_wrb()
127 phba->ctrl.mcc_alloc_index++; in alloc_mcc_wrb()
137 spin_unlock(&phba->ctrl.mcc_lock); in alloc_mcc_wrb()
141 void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag) in free_mcc_wrb() argument
143 struct be_queue_info *mccq = &ctrl->mcc_obj.q; in free_mcc_wrb()
145 spin_lock(&ctrl->mcc_lock); in free_mcc_wrb()
147 ctrl->mcc_tag[ctrl->mcc_free_index] = tag; in free_mcc_wrb()
148 if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1)) in free_mcc_wrb()
149 ctrl->mcc_free_index = 0; in free_mcc_wrb()
151 ctrl->mcc_free_index++; in free_mcc_wrb()
152 ctrl->mcc_tag_available++; in free_mcc_wrb()
154 spin_unlock(&ctrl->mcc_lock); in free_mcc_wrb()
173 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in __beiscsi_mcc_compl_status()
181 mcc_tag_status = phba->ctrl.mcc_tag_status[tag]; in __beiscsi_mcc_compl_status()
249 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
254 rc = wait_event_interruptible_timeout(phba->ctrl.mcc_wait[tag], in beiscsi_mccq_compl_wait()
255 phba->ctrl.mcc_tag_status[tag], in beiscsi_mccq_compl_wait()
265 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
282 tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state; in beiscsi_mccq_compl_wait()
293 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
304 free_mcc_wrb(&phba->ctrl, tag); in beiscsi_mccq_compl_wait()
310 * @ctrl: Function specific MBX data structure
319 static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl, in beiscsi_process_mbox_compl() argument
322 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_process_mbox_compl()
323 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_process_mbox_compl()
484 int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl, in beiscsi_process_mcc_compl() argument
487 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_process_mcc_compl()
497 &ctrl->ptag_state[tag].tag_state)) { in beiscsi_process_mcc_compl()
505 clear_bit(MCC_TAG_STATE_RUNNING, &ctrl->ptag_state[tag].tag_state); in beiscsi_process_mcc_compl()
507 if (test_bit(MCC_TAG_STATE_TIMEOUT, &ctrl->ptag_state[tag].tag_state)) { in beiscsi_process_mcc_compl()
516 tag_mem = &ctrl->ptag_state[tag].tag_mem_state; in beiscsi_process_mcc_compl()
518 dma_free_coherent(&ctrl->pdev->dev, tag_mem->size, in beiscsi_process_mcc_compl()
522 free_mcc_wrb(ctrl, tag); in beiscsi_process_mcc_compl()
530 /* The ctrl.mcc_tag_status[tag] is filled with in beiscsi_process_mcc_compl()
534 ctrl->mcc_tag_status[tag] = CQE_VALID_MASK; in beiscsi_process_mcc_compl()
535 ctrl->mcc_tag_status[tag] |= (wrb_idx << CQE_STATUS_WRB_SHIFT); in beiscsi_process_mcc_compl()
536 ctrl->mcc_tag_status[tag] |= (extd_status << CQE_STATUS_ADDL_SHIFT) & in beiscsi_process_mcc_compl()
538 ctrl->mcc_tag_status[tag] |= (compl_status & CQE_STATUS_MASK); in beiscsi_process_mcc_compl()
540 if (test_bit(MCC_TAG_STATE_ASYNC, &ctrl->ptag_state[tag].tag_state)) { in beiscsi_process_mcc_compl()
541 if (ctrl->ptag_state[tag].cbfn) in beiscsi_process_mcc_compl()
542 ctrl->ptag_state[tag].cbfn(phba, tag); in beiscsi_process_mcc_compl()
546 free_mcc_wrb(ctrl, tag); in beiscsi_process_mcc_compl()
550 if (test_bit(MCC_TAG_STATE_IGNORE, &ctrl->ptag_state[tag].tag_state)) { in beiscsi_process_mcc_compl()
553 free_mcc_wrb(ctrl, tag); in beiscsi_process_mcc_compl()
557 wake_up_interruptible(&ctrl->mcc_wait[tag]); in beiscsi_process_mcc_compl()
563 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in be_mcc_notify()
566 set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state); in be_mcc_notify()
576 * @ctrl: Function specific MBX data structure
585 static int be_mbox_db_ready_poll(struct be_ctrl_info *ctrl) in be_mbox_db_ready_poll() argument
589 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_db_ready_poll()
590 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mbox_db_ready_poll()
626 * @ctrl: Function specific MBX data structure
635 static int be_mbox_notify(struct be_ctrl_info *ctrl) in be_mbox_notify() argument
639 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_notify()
640 struct be_dma_mem *mbox_mem = &ctrl->mbox_mem; in be_mbox_notify()
643 status = be_mbox_db_ready_poll(ctrl); in be_mbox_notify()
652 status = be_mbox_db_ready_poll(ctrl); in be_mbox_notify()
662 status = be_mbox_db_ready_poll(ctrl); in be_mbox_notify()
669 status = beiscsi_process_mbox_compl(ctrl, &mbox->compl); in be_mbox_notify()
735 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, in beiscsi_cmd_eq_create() argument
738 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_eq_create()
744 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_eq_create()
755 PCI_FUNC(ctrl->pdev->devfn)); in beiscsi_cmd_eq_create()
766 status = be_mbox_notify(ctrl); in beiscsi_cmd_eq_create()
771 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_eq_create()
775 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, in beiscsi_cmd_cq_create() argument
779 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_cq_create()
782 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_cq_create()
787 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_cq_create()
808 PCI_FUNC(ctrl->pdev->devfn)); in beiscsi_cmd_cq_create()
828 status = be_mbox_notify(ctrl); in beiscsi_cmd_cq_create()
837 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_cq_create()
857 struct be_ctrl_info *ctrl; in beiscsi_cmd_mccq_create() local
861 mutex_lock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
862 ctrl = &phba->ctrl; in beiscsi_cmd_mccq_create()
863 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_mccq_create()
889 status = be_mbox_notify(ctrl); in beiscsi_cmd_mccq_create()
895 mutex_unlock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
900 int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, in beiscsi_cmd_q_destroy() argument
903 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_q_destroy()
905 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_q_destroy()
913 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
943 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
950 status = be_mbox_notify(ctrl); in beiscsi_cmd_q_destroy()
952 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
958 * @ctrl: ptr to ctrl_info
974 int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl, in be_cmd_create_default_pdu_queue() argument
980 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_create_default_pdu_queue()
983 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_create_default_pdu_queue()
987 mutex_lock(&ctrl->mbox_lock); in be_cmd_create_default_pdu_queue()
1008 pci_func_id, ctxt, PCI_FUNC(ctrl->pdev->devfn)); in be_cmd_create_default_pdu_queue()
1036 status = be_mbox_notify(ctrl); in be_cmd_create_default_pdu_queue()
1059 mutex_unlock(&ctrl->mbox_lock); in be_cmd_create_default_pdu_queue()
1066 * @ctrl: ptr to ctrl_info
1075 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, in be_cmd_wrbq_create() argument
1081 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_wrbq_create()
1084 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_wrbq_create()
1087 mutex_lock(&ctrl->mbox_lock); in be_cmd_wrbq_create()
1104 status = be_mbox_notify(ctrl); in be_cmd_wrbq_create()
1118 mutex_unlock(&ctrl->mbox_lock); in be_cmd_wrbq_create()
1122 int be_cmd_iscsi_post_template_hdr(struct be_ctrl_info *ctrl, in be_cmd_iscsi_post_template_hdr() argument
1125 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_post_template_hdr()
1129 mutex_lock(&ctrl->mbox_lock); in be_cmd_iscsi_post_template_hdr()
1141 status = be_mbox_notify(ctrl); in be_cmd_iscsi_post_template_hdr()
1142 mutex_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_post_template_hdr()
1146 int be_cmd_iscsi_remove_template_hdr(struct be_ctrl_info *ctrl) in be_cmd_iscsi_remove_template_hdr() argument
1148 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_remove_template_hdr()
1152 mutex_lock(&ctrl->mbox_lock); in be_cmd_iscsi_remove_template_hdr()
1162 status = be_mbox_notify(ctrl); in be_cmd_iscsi_remove_template_hdr()
1163 mutex_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_remove_template_hdr()
1167 int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl, in be_cmd_iscsi_post_sgl_pages() argument
1171 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_post_sgl_pages()
1173 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_iscsi_post_sgl_pages()
1181 mutex_lock(&ctrl->mbox_lock); in be_cmd_iscsi_post_sgl_pages()
1200 status = be_mbox_notify(ctrl); in be_cmd_iscsi_post_sgl_pages()
1209 mutex_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_post_sgl_pages()
1211 beiscsi_cmd_q_destroy(ctrl, NULL, QTYPE_SGL); in be_cmd_iscsi_post_sgl_pages()
1231 struct be_ctrl_info *ctrl = &phba->ctrl; in be_cmd_set_vlan() local
1233 if (mutex_lock_interruptible(&ctrl->mbox_lock)) in be_cmd_set_vlan()
1237 mutex_unlock(&ctrl->mbox_lock); in be_cmd_set_vlan()
1251 mutex_unlock(&ctrl->mbox_lock); in be_cmd_set_vlan()
1256 int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, in beiscsi_check_supported_fw() argument
1260 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_check_supported_fw()
1265 nonemb_cmd.va = dma_alloc_coherent(&ctrl->pdev->dev, in beiscsi_check_supported_fw()
1277 mutex_lock(&ctrl->mbox_lock); in beiscsi_check_supported_fw()
1285 status = be_mbox_notify(ctrl); in beiscsi_check_supported_fw()
1308 mutex_unlock(&ctrl->mbox_lock); in beiscsi_check_supported_fw()
1310 dma_free_coherent(&ctrl->pdev->dev, nonemb_cmd.size, in beiscsi_check_supported_fw()
1318 * @ctrl: ptr to Ctrl Info
1328 int beiscsi_get_fw_config(struct be_ctrl_info *ctrl, in beiscsi_get_fw_config() argument
1331 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_get_fw_config()
1337 mutex_lock(&ctrl->mbox_lock); in beiscsi_get_fw_config()
1345 if (be_mbox_notify(ctrl)) { in beiscsi_get_fw_config()
1472 mutex_unlock(&ctrl->mbox_lock); in beiscsi_get_fw_config()
1478 * @ctrl: ptr to Ctrl Info
1484 int beiscsi_get_port_name(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba) in beiscsi_get_port_name() argument
1490 mutex_lock(&ctrl->mbox_lock); in beiscsi_get_port_name()
1491 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_get_port_name()
1499 ret = be_mbox_notify(ctrl); in beiscsi_get_port_name()
1513 mutex_unlock(&ctrl->mbox_lock); in beiscsi_get_port_name()
1519 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_set_host_data() local
1527 mutex_lock(&ctrl->mbox_lock); in beiscsi_set_host_data()
1528 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_set_host_data()
1544 ret = be_mbox_notify(ctrl); in beiscsi_set_host_data()
1559 mutex_unlock(&ctrl->mbox_lock); in beiscsi_set_host_data()
1565 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_set_uer_feature() local
1570 mutex_lock(&ctrl->mbox_lock); in beiscsi_set_uer_feature()
1571 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_set_uer_feature()
1582 ret = be_mbox_notify(ctrl); in beiscsi_set_uer_feature()
1599 mutex_unlock(&ctrl->mbox_lock); in beiscsi_set_uer_feature()
1641 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_cmd_function_reset() local
1642 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_function_reset()
1646 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_function_reset()
1652 status = be_mbox_notify(ctrl); in beiscsi_cmd_function_reset()
1654 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_function_reset()
1658 int beiscsi_cmd_special_wrb(struct be_ctrl_info *ctrl, u32 load) in beiscsi_cmd_special_wrb() argument
1660 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_special_wrb()
1661 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_special_wrb()
1665 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_special_wrb()
1692 status = be_mbox_notify(ctrl); in beiscsi_cmd_special_wrb()
1696 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_special_wrb()
1727 return beiscsi_cmd_special_wrb(&phba->ctrl, 1); in beiscsi_init_sliport()
1741 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_cmd_iscsi_cleanup() local
1748 mutex_lock(&ctrl->mbox_lock); in beiscsi_cmd_iscsi_cleanup()
1749 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_iscsi_cleanup()
1774 status = be_mbox_notify(ctrl); in beiscsi_cmd_iscsi_cleanup()
1778 mutex_unlock(&ctrl->mbox_lock); in beiscsi_cmd_iscsi_cleanup()