Lines Matching full:trans

166 	wq = create_singlethread_workqueue("bc-trans");  in qlcnic_sriov_init()
170 "Cannot create bc-trans workqueue\n"); in qlcnic_sriov_init()
239 struct qlcnic_bc_trans *trans; in qlcnic_sriov_cleanup_list() local
246 trans = list_first_entry(&t_list->wait_list, in qlcnic_sriov_cleanup_list()
248 list_del(&trans->list); in qlcnic_sriov_cleanup_list()
250 cmd.req.arg = (u32 *)trans->req_pay; in qlcnic_sriov_cleanup_list()
251 cmd.rsp.arg = (u32 *)trans->rsp_pay; in qlcnic_sriov_cleanup_list()
253 qlcnic_sriov_cleanup_transaction(trans); in qlcnic_sriov_cleanup_list()
695 static inline int qlcnic_sriov_alloc_bc_trans(struct qlcnic_bc_trans **trans) in qlcnic_sriov_alloc_bc_trans() argument
697 *trans = kzalloc(sizeof(struct qlcnic_bc_trans), GFP_ATOMIC); in qlcnic_sriov_alloc_bc_trans()
698 if (!*trans) in qlcnic_sriov_alloc_bc_trans()
701 init_completion(&(*trans)->resp_cmpl); in qlcnic_sriov_alloc_bc_trans()
748 static int qlcnic_sriov_prepare_bc_hdr(struct qlcnic_bc_trans *trans, in qlcnic_sriov_prepare_bc_hdr() argument
760 trans->req_pay = (struct qlcnic_bc_payload *)cmd->req.arg; in qlcnic_sriov_prepare_bc_hdr()
761 trans->rsp_pay = (struct qlcnic_bc_payload *)cmd->rsp.arg; in qlcnic_sriov_prepare_bc_hdr()
763 trans->req_pay_size = (num_regs * 4); in qlcnic_sriov_prepare_bc_hdr()
765 trans->rsp_pay_size = (num_regs * 4); in qlcnic_sriov_prepare_bc_hdr()
767 remainder = (trans->req_pay_size) % (bc_pay_sz); in qlcnic_sriov_prepare_bc_hdr()
768 num_frags = (trans->req_pay_size) / (bc_pay_sz); in qlcnic_sriov_prepare_bc_hdr()
772 if (qlcnic_sriov_alloc_bc_msg(&trans->req_hdr, num_frags)) in qlcnic_sriov_prepare_bc_hdr()
774 remainder = (trans->rsp_pay_size) % (bc_pay_sz); in qlcnic_sriov_prepare_bc_hdr()
775 num_frags = (trans->rsp_pay_size) / (bc_pay_sz); in qlcnic_sriov_prepare_bc_hdr()
778 if (qlcnic_sriov_alloc_bc_msg(&trans->rsp_hdr, num_frags)) in qlcnic_sriov_prepare_bc_hdr()
781 hdr = trans->req_hdr; in qlcnic_sriov_prepare_bc_hdr()
783 cmd->req.arg = (u32 *)trans->req_pay; in qlcnic_sriov_prepare_bc_hdr()
784 cmd->rsp.arg = (u32 *)trans->rsp_pay; in qlcnic_sriov_prepare_bc_hdr()
787 remainder = (trans->rsp_pay_size) % (bc_pay_sz); in qlcnic_sriov_prepare_bc_hdr()
788 num_frags = (trans->rsp_pay_size) / (bc_pay_sz); in qlcnic_sriov_prepare_bc_hdr()
791 cmd->req.num = trans->req_pay_size / 4; in qlcnic_sriov_prepare_bc_hdr()
792 cmd->rsp.num = trans->rsp_pay_size / 4; in qlcnic_sriov_prepare_bc_hdr()
793 hdr = trans->rsp_hdr; in qlcnic_sriov_prepare_bc_hdr()
794 cmd->op_type = trans->req_hdr->op_type; in qlcnic_sriov_prepare_bc_hdr()
797 trans->trans_id = seq; in qlcnic_sriov_prepare_bc_hdr()
798 trans->cmd_id = cmd_op; in qlcnic_sriov_prepare_bc_hdr()
812 static void qlcnic_sriov_cleanup_transaction(struct qlcnic_bc_trans *trans) in qlcnic_sriov_cleanup_transaction() argument
814 if (!trans) in qlcnic_sriov_cleanup_transaction()
816 kfree(trans->req_hdr); in qlcnic_sriov_cleanup_transaction()
817 kfree(trans->rsp_hdr); in qlcnic_sriov_cleanup_transaction()
818 kfree(trans); in qlcnic_sriov_cleanup_transaction()
822 struct qlcnic_bc_trans *trans, u8 type) in qlcnic_sriov_clear_trans() argument
832 list_del(&trans->list); in qlcnic_sriov_clear_trans()
857 static inline void qlcnic_sriov_wait_for_resp(struct qlcnic_bc_trans *trans) in qlcnic_sriov_wait_for_resp() argument
859 struct completion *cmpl = &trans->resp_cmpl; in qlcnic_sriov_wait_for_resp()
862 trans->trans_state = QLC_END; in qlcnic_sriov_wait_for_resp()
864 trans->trans_state = QLC_ABORT; in qlcnic_sriov_wait_for_resp()
869 static void qlcnic_sriov_handle_multi_frags(struct qlcnic_bc_trans *trans, in qlcnic_sriov_handle_multi_frags() argument
873 trans->curr_rsp_frag++; in qlcnic_sriov_handle_multi_frags()
874 if (trans->curr_rsp_frag < trans->rsp_hdr->num_frags) in qlcnic_sriov_handle_multi_frags()
875 trans->trans_state = QLC_INIT; in qlcnic_sriov_handle_multi_frags()
877 trans->trans_state = QLC_END; in qlcnic_sriov_handle_multi_frags()
879 trans->curr_req_frag++; in qlcnic_sriov_handle_multi_frags()
880 if (trans->curr_req_frag < trans->req_hdr->num_frags) in qlcnic_sriov_handle_multi_frags()
881 trans->trans_state = QLC_INIT; in qlcnic_sriov_handle_multi_frags()
883 trans->trans_state = QLC_WAIT_FOR_RESP; in qlcnic_sriov_handle_multi_frags()
887 static void qlcnic_sriov_wait_for_channel_free(struct qlcnic_bc_trans *trans, in qlcnic_sriov_wait_for_channel_free() argument
890 struct qlcnic_vf_info *vf = trans->vf; in qlcnic_sriov_wait_for_channel_free()
894 trans->trans_state = QLC_ABORT; in qlcnic_sriov_wait_for_channel_free()
899 qlcnic_sriov_handle_multi_frags(trans, type); in qlcnic_sriov_wait_for_channel_free()
933 static int qlcnic_sriov_issue_bc_post(struct qlcnic_bc_trans *trans, u8 type) in qlcnic_sriov_issue_bc_post() argument
935 struct qlcnic_vf_info *vf = trans->vf; in qlcnic_sriov_issue_bc_post()
939 u8 pci_func = trans->func_id; in qlcnic_sriov_issue_bc_post()
945 hdr = (u32 *)(trans->req_hdr + trans->curr_req_frag); in qlcnic_sriov_issue_bc_post()
946 pay = (u32 *)(trans->req_pay + trans->curr_req_frag); in qlcnic_sriov_issue_bc_post()
947 pay_size = qlcnic_sriov_get_bc_paysize(trans->req_pay_size, in qlcnic_sriov_issue_bc_post()
948 trans->curr_req_frag); in qlcnic_sriov_issue_bc_post()
951 hdr = (u32 *)(trans->rsp_hdr + trans->curr_rsp_frag); in qlcnic_sriov_issue_bc_post()
952 pay = (u32 *)(trans->rsp_pay + trans->curr_rsp_frag); in qlcnic_sriov_issue_bc_post()
953 pay_size = qlcnic_sriov_get_bc_paysize(trans->rsp_pay_size, in qlcnic_sriov_issue_bc_post()
954 trans->curr_rsp_frag); in qlcnic_sriov_issue_bc_post()
963 static int __qlcnic_sriov_send_bc_msg(struct qlcnic_bc_trans *trans, in __qlcnic_sriov_send_bc_msg() argument
972 trans->trans_state = QLC_ABORT; in __qlcnic_sriov_send_bc_msg()
974 switch (trans->trans_state) { in __qlcnic_sriov_send_bc_msg()
976 trans->trans_state = QLC_WAIT_FOR_CHANNEL_FREE; in __qlcnic_sriov_send_bc_msg()
977 if (qlcnic_sriov_issue_bc_post(trans, type)) in __qlcnic_sriov_send_bc_msg()
978 trans->trans_state = QLC_ABORT; in __qlcnic_sriov_send_bc_msg()
981 qlcnic_sriov_wait_for_channel_free(trans, type); in __qlcnic_sriov_send_bc_msg()
984 qlcnic_sriov_wait_for_resp(trans); in __qlcnic_sriov_send_bc_msg()
1004 struct qlcnic_bc_trans *trans, int pci_func) in qlcnic_sriov_send_bc_cmd() argument
1013 trans->vf = vf; in qlcnic_sriov_send_bc_cmd()
1014 trans->func_id = pci_func; in qlcnic_sriov_send_bc_cmd()
1020 trans->cmd_id != QLCNIC_BC_CMD_CHANNEL_INIT) in qlcnic_sriov_send_bc_cmd()
1025 vf->send_cmd = trans; in qlcnic_sriov_send_bc_cmd()
1026 err = __qlcnic_sriov_send_bc_msg(trans, vf, QLC_BC_COMMAND); in qlcnic_sriov_send_bc_cmd()
1027 qlcnic_sriov_clear_trans(vf, trans, QLC_BC_COMMAND); in qlcnic_sriov_send_bc_cmd()
1033 struct qlcnic_bc_trans *trans, in __qlcnic_sriov_process_bc_cmd() argument
1038 qlcnic_sriov_pf_process_bc_cmd(adapter, trans, cmd); in __qlcnic_sriov_process_bc_cmd()
1050 struct qlcnic_bc_trans *trans = NULL; in qlcnic_sriov_process_bc_cmd() local
1062 trans = list_first_entry(&vf->rcv_act.wait_list, in qlcnic_sriov_process_bc_cmd()
1066 if (qlcnic_sriov_prepare_bc_hdr(trans, &cmd, trans->req_hdr->seq_id, in qlcnic_sriov_process_bc_cmd()
1070 __qlcnic_sriov_process_bc_cmd(adapter, trans, &cmd); in qlcnic_sriov_process_bc_cmd()
1071 trans->trans_state = QLC_INIT; in qlcnic_sriov_process_bc_cmd()
1072 __qlcnic_sriov_send_bc_msg(trans, vf, QLC_BC_RESPONSE); in qlcnic_sriov_process_bc_cmd()
1076 req = qlcnic_sriov_clear_trans(vf, trans, QLC_BC_RESPONSE); in qlcnic_sriov_process_bc_cmd()
1077 qlcnic_sriov_cleanup_transaction(trans); in qlcnic_sriov_process_bc_cmd()
1086 struct qlcnic_bc_trans *trans; in qlcnic_sriov_handle_bc_resp() local
1092 trans = vf->send_cmd; in qlcnic_sriov_handle_bc_resp()
1094 if (trans == NULL) in qlcnic_sriov_handle_bc_resp()
1097 if (trans->trans_id != hdr->seq_id) in qlcnic_sriov_handle_bc_resp()
1100 pay_size = qlcnic_sriov_get_bc_paysize(trans->rsp_pay_size, in qlcnic_sriov_handle_bc_resp()
1101 trans->curr_rsp_frag); in qlcnic_sriov_handle_bc_resp()
1103 (u32 *)(trans->rsp_hdr + trans->curr_rsp_frag), in qlcnic_sriov_handle_bc_resp()
1104 (u32 *)(trans->rsp_pay + trans->curr_rsp_frag), in qlcnic_sriov_handle_bc_resp()
1106 if (++trans->curr_rsp_frag < trans->rsp_hdr->num_frags) in qlcnic_sriov_handle_bc_resp()
1109 complete(&trans->resp_cmpl); in qlcnic_sriov_handle_bc_resp()
1117 struct qlcnic_bc_trans *trans) in __qlcnic_sriov_add_act_list() argument
1122 list_add_tail(&trans->list, &t_list->wait_list); in __qlcnic_sriov_add_act_list()
1131 struct qlcnic_bc_trans *trans) in qlcnic_sriov_add_act_list() argument
1137 __qlcnic_sriov_add_act_list(sriov, vf, trans); in qlcnic_sriov_add_act_list()
1147 struct qlcnic_bc_trans *trans = NULL; in qlcnic_sriov_handle_pending_trans() local
1155 trans = list_entry(node, struct qlcnic_bc_trans, list); in qlcnic_sriov_handle_pending_trans()
1156 if (trans->trans_id == hdr->seq_id) { in qlcnic_sriov_handle_pending_trans()
1164 curr_frag = trans->curr_req_frag; in qlcnic_sriov_handle_pending_trans()
1165 pay_size = qlcnic_sriov_get_bc_paysize(trans->req_pay_size, in qlcnic_sriov_handle_pending_trans()
1168 (u32 *)(trans->req_hdr + curr_frag), in qlcnic_sriov_handle_pending_trans()
1169 (u32 *)(trans->req_pay + curr_frag), in qlcnic_sriov_handle_pending_trans()
1171 trans->curr_req_frag++; in qlcnic_sriov_handle_pending_trans()
1172 if (trans->curr_req_frag >= hdr->num_frags) { in qlcnic_sriov_handle_pending_trans()
1174 list_del(&trans->list); in qlcnic_sriov_handle_pending_trans()
1181 if (qlcnic_sriov_add_act_list(sriov, vf, trans)) in qlcnic_sriov_handle_pending_trans()
1182 qlcnic_sriov_cleanup_transaction(trans); in qlcnic_sriov_handle_pending_trans()
1191 struct qlcnic_bc_trans *trans; in qlcnic_sriov_handle_bc_cmd() local
1213 if (qlcnic_sriov_alloc_bc_trans(&trans)) in qlcnic_sriov_handle_bc_cmd()
1222 qlcnic_sriov_cleanup_transaction(trans); in qlcnic_sriov_handle_bc_cmd()
1227 if (qlcnic_sriov_prepare_bc_hdr(trans, &cmd, hdr->seq_id, in qlcnic_sriov_handle_bc_cmd()
1230 qlcnic_sriov_cleanup_transaction(trans); in qlcnic_sriov_handle_bc_cmd()
1234 pay_size = qlcnic_sriov_get_bc_paysize(trans->req_pay_size, in qlcnic_sriov_handle_bc_cmd()
1235 trans->curr_req_frag); in qlcnic_sriov_handle_bc_cmd()
1237 (u32 *)(trans->req_hdr + trans->curr_req_frag), in qlcnic_sriov_handle_bc_cmd()
1238 (u32 *)(trans->req_pay + trans->curr_req_frag), in qlcnic_sriov_handle_bc_cmd()
1240 trans->func_id = vf->pci_func; in qlcnic_sriov_handle_bc_cmd()
1241 trans->vf = vf; in qlcnic_sriov_handle_bc_cmd()
1242 trans->trans_id = hdr->seq_id; in qlcnic_sriov_handle_bc_cmd()
1243 trans->curr_req_frag++; in qlcnic_sriov_handle_bc_cmd()
1245 if (qlcnic_sriov_soft_flr_check(adapter, trans, vf)) in qlcnic_sriov_handle_bc_cmd()
1248 if (trans->curr_req_frag == trans->req_hdr->num_frags) { in qlcnic_sriov_handle_bc_cmd()
1249 if (qlcnic_sriov_add_act_list(sriov, vf, trans)) { in qlcnic_sriov_handle_bc_cmd()
1251 qlcnic_sriov_cleanup_transaction(trans); in qlcnic_sriov_handle_bc_cmd()
1255 list_add_tail(&trans->list, &vf->rcv_pend.wait_list); in qlcnic_sriov_handle_bc_cmd()
1350 struct qlcnic_bc_trans *trans) in qlcnic_sriov_retry_bc_cmd() argument
1358 clear_bit(QLC_BC_VF_CHANNEL, &trans->vf->state); in qlcnic_sriov_retry_bc_cmd()
1359 trans->trans_state = QLC_INIT; in qlcnic_sriov_retry_bc_cmd()
1375 struct qlcnic_bc_trans *trans; in __qlcnic_sriov_issue_cmd() local
1381 rsp = qlcnic_sriov_alloc_bc_trans(&trans); in __qlcnic_sriov_issue_cmd()
1385 rsp = qlcnic_sriov_prepare_bc_hdr(trans, cmd, seq, QLC_BC_COMMAND); in __qlcnic_sriov_issue_cmd()
1397 err = qlcnic_sriov_send_bc_cmd(adapter, trans, func); in __qlcnic_sriov_issue_cmd()
1406 if ((trans->req_hdr->cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT) && in __qlcnic_sriov_issue_cmd()
1407 !qlcnic_sriov_retry_bc_cmd(adapter, trans)) in __qlcnic_sriov_issue_cmd()
1442 qlcnic_sriov_cleanup_transaction(trans); in __qlcnic_sriov_issue_cmd()