Lines Matching refs:adapter
58 mwifiex_get_cmd_node(struct mwifiex_adapter *adapter) in mwifiex_get_cmd_node() argument
63 spin_lock_irqsave(&adapter->cmd_free_q_lock, flags); in mwifiex_get_cmd_node()
64 if (list_empty(&adapter->cmd_free_q)) { in mwifiex_get_cmd_node()
65 mwifiex_dbg(adapter, ERROR, in mwifiex_get_cmd_node()
67 spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); in mwifiex_get_cmd_node()
70 cmd_node = list_first_entry(&adapter->cmd_free_q, in mwifiex_get_cmd_node()
73 spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); in mwifiex_get_cmd_node()
90 mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter, in mwifiex_clean_cmd_node() argument
102 adapter->if_ops.cmdrsp_complete(adapter, cmd_node->resp_skb); in mwifiex_clean_cmd_node()
120 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_host_cmd()
137 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_dnld_cmd_to_fw() local
145 if (!adapter || !cmd_node) in mwifiex_dnld_cmd_to_fw()
152 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
156 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
157 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
164 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && in mwifiex_dnld_cmd_to_fw()
167 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
170 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
171 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_dnld_cmd_to_fw()
176 adapter->seq_num++; in mwifiex_dnld_cmd_to_fw()
178 (adapter->seq_num, in mwifiex_dnld_cmd_to_fw()
182 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_dnld_cmd_to_fw()
183 adapter->curr_cmd = cmd_node; in mwifiex_dnld_cmd_to_fw()
184 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_dnld_cmd_to_fw()
201 mwifiex_dbg(adapter, CMD, in mwifiex_dnld_cmd_to_fw()
206 mwifiex_dbg_dump(adapter, CMD_D, "cmd buffer:", host_cmd, cmd_size); in mwifiex_dnld_cmd_to_fw()
208 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_cmd_to_fw()
212 adapter->cmd_sent = true; in mwifiex_dnld_cmd_to_fw()
213 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_cmd_to_fw()
221 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_cmd_to_fw()
227 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
229 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_dnld_cmd_to_fw()
230 adapter->cmd_sent = false; in mwifiex_dnld_cmd_to_fw()
232 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
233 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_dnld_cmd_to_fw()
235 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_dnld_cmd_to_fw()
236 adapter->curr_cmd = NULL; in mwifiex_dnld_cmd_to_fw()
237 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_dnld_cmd_to_fw()
239 adapter->dbg.num_cmd_host_to_card_failure++; in mwifiex_dnld_cmd_to_fw()
244 adapter->dbg.last_cmd_index = in mwifiex_dnld_cmd_to_fw()
245 (adapter->dbg.last_cmd_index + 1) % DBG_CMD_NUM; in mwifiex_dnld_cmd_to_fw()
246 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index] = cmd_code; in mwifiex_dnld_cmd_to_fw()
247 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] = in mwifiex_dnld_cmd_to_fw()
254 mod_timer(&adapter->cmd_timer, in mwifiex_dnld_cmd_to_fw()
269 static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) in mwifiex_dnld_sleep_confirm_cmd() argument
275 adapter->sleep_cfm->data; in mwifiex_dnld_sleep_confirm_cmd()
279 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_dnld_sleep_confirm_cmd()
281 adapter->seq_num++; in mwifiex_dnld_sleep_confirm_cmd()
284 (adapter->seq_num, priv->bss_num, in mwifiex_dnld_sleep_confirm_cmd()
287 mwifiex_dbg(adapter, CMD, in mwifiex_dnld_sleep_confirm_cmd()
293 mwifiex_dbg_dump(adapter, CMD_D, "SLEEP_CFM buffer: ", sleep_cfm_buf, in mwifiex_dnld_sleep_confirm_cmd()
296 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_sleep_confirm_cmd()
305 adapter->sleep_cfm->data, in mwifiex_dnld_sleep_confirm_cmd()
307 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_sleep_confirm_cmd()
313 skb_push(adapter->sleep_cfm, INTF_HEADER_LEN); in mwifiex_dnld_sleep_confirm_cmd()
314 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_sleep_confirm_cmd()
315 adapter->sleep_cfm, NULL); in mwifiex_dnld_sleep_confirm_cmd()
316 skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN); in mwifiex_dnld_sleep_confirm_cmd()
320 mwifiex_dbg(adapter, ERROR, "SLEEP_CFM: failed\n"); in mwifiex_dnld_sleep_confirm_cmd()
321 adapter->dbg.num_cmd_sleep_cfm_host_to_card_failure++; in mwifiex_dnld_sleep_confirm_cmd()
327 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_dnld_sleep_confirm_cmd()
329 adapter->ps_state = PS_STATE_SLEEP_CFM; in mwifiex_dnld_sleep_confirm_cmd()
332 (adapter->is_hs_configured && in mwifiex_dnld_sleep_confirm_cmd()
333 !adapter->sleep_period.period)) { in mwifiex_dnld_sleep_confirm_cmd()
334 adapter->pm_wakeup_card_req = true; in mwifiex_dnld_sleep_confirm_cmd()
336 (adapter, MWIFIEX_BSS_ROLE_ANY), true); in mwifiex_dnld_sleep_confirm_cmd()
354 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_alloc_cmd_buffer() argument
365 adapter->cmd_pool = cmd_array; in mwifiex_alloc_cmd_buffer()
371 mwifiex_dbg(adapter, ERROR, in mwifiex_alloc_cmd_buffer()
378 mwifiex_insert_cmd_to_free_q(adapter, &cmd_array[i]); in mwifiex_alloc_cmd_buffer()
389 int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_free_cmd_buffer() argument
395 if (!adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
396 mwifiex_dbg(adapter, FATAL, in mwifiex_free_cmd_buffer()
401 cmd_array = adapter->cmd_pool; in mwifiex_free_cmd_buffer()
406 mwifiex_dbg(adapter, CMD, in mwifiex_free_cmd_buffer()
413 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_free_cmd_buffer()
414 adapter->if_ops.cmdrsp_complete(adapter, in mwifiex_free_cmd_buffer()
420 if (adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
421 mwifiex_dbg(adapter, CMD, in mwifiex_free_cmd_buffer()
423 kfree(adapter->cmd_pool); in mwifiex_free_cmd_buffer()
424 adapter->cmd_pool = NULL; in mwifiex_free_cmd_buffer()
440 int mwifiex_process_event(struct mwifiex_adapter *adapter) in mwifiex_process_event() argument
444 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
445 struct sk_buff *skb = adapter->event_skb; in mwifiex_process_event()
446 u32 eventcause = adapter->event_cause; in mwifiex_process_event()
450 adapter->dbg.last_event_index = in mwifiex_process_event()
451 (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM; in mwifiex_process_event()
452 adapter->dbg.last_event[adapter->dbg.last_event_index] = in mwifiex_process_event()
456 priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause), in mwifiex_process_event()
459 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
463 adapter->event_cause = eventcause; in mwifiex_process_event()
470 mwifiex_dbg_dump(adapter, EVT_D, "Event Buf:", in mwifiex_process_event()
474 mwifiex_dbg(adapter, EVENT, "EVENT: cause: %#x\n", eventcause); in mwifiex_process_event()
481 adapter->event_cause = 0; in mwifiex_process_event()
482 adapter->event_skb = NULL; in mwifiex_process_event()
483 adapter->if_ops.event_complete(adapter, skb); in mwifiex_process_event()
503 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_send_cmd() local
507 if (!adapter) { in mwifiex_send_cmd()
512 if (adapter->is_suspended) { in mwifiex_send_cmd()
513 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
518 if (adapter->hs_enabling && cmd_no != HostCmd_CMD_802_11_HS_CFG_ENH) { in mwifiex_send_cmd()
519 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
524 if (adapter->surprise_removed) { in mwifiex_send_cmd()
525 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
530 if (adapter->is_cmd_timedout) { in mwifiex_send_cmd()
531 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
536 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET) { in mwifiex_send_cmd()
538 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
545 cmd_node = mwifiex_get_cmd_node(adapter); in mwifiex_send_cmd()
548 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
557 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
595 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
598 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_send_cmd()
607 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); in mwifiex_send_cmd()
608 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_send_cmd()
610 ret = mwifiex_wait_queue_complete(adapter, cmd_node); in mwifiex_send_cmd()
623 mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_free_q() argument
632 mwifiex_complete_cmd(adapter, cmd_node); in mwifiex_insert_cmd_to_free_q()
634 mwifiex_clean_cmd_node(adapter, cmd_node); in mwifiex_insert_cmd_to_free_q()
637 spin_lock_irqsave(&adapter->cmd_free_q_lock, flags); in mwifiex_insert_cmd_to_free_q()
638 list_add_tail(&cmd_node->list, &adapter->cmd_free_q); in mwifiex_insert_cmd_to_free_q()
639 spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); in mwifiex_insert_cmd_to_free_q()
643 void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, in mwifiex_recycle_cmd_node() argument
648 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_recycle_cmd_node()
650 atomic_dec(&adapter->cmd_pending); in mwifiex_recycle_cmd_node()
651 mwifiex_dbg(adapter, CMD, in mwifiex_recycle_cmd_node()
654 atomic_read(&adapter->cmd_pending)); in mwifiex_recycle_cmd_node()
665 mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_pending_q() argument
674 mwifiex_dbg(adapter, ERROR, "QUEUE_CMD: host_cmd is NULL\n"); in mwifiex_insert_cmd_to_pending_q()
686 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_insert_cmd_to_pending_q()
691 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); in mwifiex_insert_cmd_to_pending_q()
693 list_add_tail(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
695 list_add(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
696 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); in mwifiex_insert_cmd_to_pending_q()
698 atomic_inc(&adapter->cmd_pending); in mwifiex_insert_cmd_to_pending_q()
699 mwifiex_dbg(adapter, CMD, in mwifiex_insert_cmd_to_pending_q()
701 command, atomic_read(&adapter->cmd_pending)); in mwifiex_insert_cmd_to_pending_q()
715 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) in mwifiex_exec_next_cmd() argument
725 if (adapter->curr_cmd) { in mwifiex_exec_next_cmd()
726 mwifiex_dbg(adapter, FATAL, in mwifiex_exec_next_cmd()
731 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_exec_next_cmd()
733 spin_lock_irqsave(&adapter->cmd_pending_q_lock, cmd_pending_q_flags); in mwifiex_exec_next_cmd()
734 if (list_empty(&adapter->cmd_pending_q)) { in mwifiex_exec_next_cmd()
735 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, in mwifiex_exec_next_cmd()
737 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_exec_next_cmd()
740 cmd_node = list_first_entry(&adapter->cmd_pending_q, in mwifiex_exec_next_cmd()
742 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, in mwifiex_exec_next_cmd()
748 if (adapter->ps_state != PS_STATE_AWAKE) { in mwifiex_exec_next_cmd()
749 mwifiex_dbg(adapter, ERROR, in mwifiex_exec_next_cmd()
752 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_exec_next_cmd()
756 spin_lock_irqsave(&adapter->cmd_pending_q_lock, cmd_pending_q_flags); in mwifiex_exec_next_cmd()
758 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, in mwifiex_exec_next_cmd()
761 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_exec_next_cmd()
763 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_exec_next_cmd()
770 if (adapter->hs_activated) { in mwifiex_exec_next_cmd()
771 adapter->is_hs_configured = false; in mwifiex_exec_next_cmd()
785 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) in mwifiex_process_cmdresp() argument
789 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
797 del_timer_sync(&adapter->cmd_timer); in mwifiex_process_cmdresp()
799 if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) { in mwifiex_process_cmdresp()
800 resp = (struct host_cmd_ds_command *) adapter->upld_buf; in mwifiex_process_cmdresp()
801 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
807 adapter->is_cmd_timedout = 0; in mwifiex_process_cmdresp()
809 resp = (struct host_cmd_ds_command *) adapter->curr_cmd->resp_skb->data; in mwifiex_process_cmdresp()
810 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
814 mwifiex_dbg(adapter, INFO, in mwifiex_process_cmdresp()
817 if (adapter->curr_cmd->data_buf) { in mwifiex_process_cmdresp()
818 hostcmd = adapter->curr_cmd->data_buf; in mwifiex_process_cmdresp()
826 priv = mwifiex_get_priv_by_id(adapter, in mwifiex_process_cmdresp()
830 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
838 adapter->dbg.last_cmd_resp_index = in mwifiex_process_cmdresp()
839 (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM; in mwifiex_process_cmdresp()
840 adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] = in mwifiex_process_cmdresp()
843 mwifiex_dbg(adapter, CMD, in mwifiex_process_cmdresp()
847 mwifiex_dbg_dump(adapter, CMD_D, "CMD_RESP buffer:", resp, in mwifiex_process_cmdresp()
851 mwifiex_dbg(adapter, ERROR, "CMD_RESP: invalid cmd resp\n"); in mwifiex_process_cmdresp()
852 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
853 adapter->cmd_wait_q.status = -1; in mwifiex_process_cmdresp()
855 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
856 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
857 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
858 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
862 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
863 adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; in mwifiex_process_cmdresp()
873 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_process_cmdresp()
875 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
878 mwifiex_init_fw_complete(adapter); in mwifiex_process_cmdresp()
880 } else if (adapter->last_init_cmd == cmdresp_no) in mwifiex_process_cmdresp()
881 adapter->hw_status = MWIFIEX_HW_STATUS_INIT_DONE; in mwifiex_process_cmdresp()
884 if (adapter->curr_cmd) { in mwifiex_process_cmdresp()
885 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
886 adapter->cmd_wait_q.status = ret; in mwifiex_process_cmdresp()
888 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
890 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
891 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
892 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
906 struct mwifiex_adapter *adapter = in mwifiex_cmd_timeout_func() local
910 adapter->is_cmd_timedout = 1; in mwifiex_cmd_timeout_func()
911 if (!adapter->curr_cmd) { in mwifiex_cmd_timeout_func()
912 mwifiex_dbg(adapter, ERROR, in mwifiex_cmd_timeout_func()
916 cmd_node = adapter->curr_cmd; in mwifiex_cmd_timeout_func()
918 adapter->dbg.timeout_cmd_id = in mwifiex_cmd_timeout_func()
919 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
920 adapter->dbg.timeout_cmd_act = in mwifiex_cmd_timeout_func()
921 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
922 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
924 adapter->dbg.timeout_cmd_id, in mwifiex_cmd_timeout_func()
925 adapter->dbg.timeout_cmd_act); in mwifiex_cmd_timeout_func()
927 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
929 adapter->dbg.num_tx_host_to_card_failure); in mwifiex_cmd_timeout_func()
930 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
932 adapter->dbg.num_cmd_host_to_card_failure); in mwifiex_cmd_timeout_func()
934 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
936 adapter->is_cmd_timedout); in mwifiex_cmd_timeout_func()
937 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
939 adapter->dbg.num_tx_timeout); in mwifiex_cmd_timeout_func()
941 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
943 adapter->dbg.last_cmd_index); in mwifiex_cmd_timeout_func()
944 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
946 (int)sizeof(adapter->dbg.last_cmd_id), in mwifiex_cmd_timeout_func()
947 adapter->dbg.last_cmd_id); in mwifiex_cmd_timeout_func()
948 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
950 (int)sizeof(adapter->dbg.last_cmd_act), in mwifiex_cmd_timeout_func()
951 adapter->dbg.last_cmd_act); in mwifiex_cmd_timeout_func()
953 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
955 adapter->dbg.last_cmd_resp_index); in mwifiex_cmd_timeout_func()
956 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
958 (int)sizeof(adapter->dbg.last_cmd_resp_id), in mwifiex_cmd_timeout_func()
959 adapter->dbg.last_cmd_resp_id); in mwifiex_cmd_timeout_func()
961 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
963 adapter->dbg.last_event_index); in mwifiex_cmd_timeout_func()
964 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
966 (int)sizeof(adapter->dbg.last_event), in mwifiex_cmd_timeout_func()
967 adapter->dbg.last_event); in mwifiex_cmd_timeout_func()
969 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
971 adapter->data_sent, adapter->cmd_sent); in mwifiex_cmd_timeout_func()
973 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
975 adapter->ps_mode, adapter->ps_state); in mwifiex_cmd_timeout_func()
978 adapter->cmd_wait_q.status = -ETIMEDOUT; in mwifiex_cmd_timeout_func()
979 mwifiex_cancel_pending_ioctl(adapter); in mwifiex_cmd_timeout_func()
982 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_cmd_timeout_func()
983 mwifiex_init_fw_complete(adapter); in mwifiex_cmd_timeout_func()
987 if (adapter->if_ops.device_dump) in mwifiex_cmd_timeout_func()
988 adapter->if_ops.device_dump(adapter); in mwifiex_cmd_timeout_func()
990 if (adapter->if_ops.card_reset) in mwifiex_cmd_timeout_func()
991 adapter->if_ops.card_reset(adapter); in mwifiex_cmd_timeout_func()
1002 mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) in mwifiex_cancel_all_pending_cmd() argument
1009 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_all_pending_cmd()
1011 if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_all_pending_cmd()
1012 adapter->curr_cmd->wait_q_enabled = false; in mwifiex_cancel_all_pending_cmd()
1013 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1014 mwifiex_complete_cmd(adapter, adapter->curr_cmd); in mwifiex_cancel_all_pending_cmd()
1018 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
1020 &adapter->cmd_pending_q, list) { in mwifiex_cancel_all_pending_cmd()
1022 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
1025 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1026 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_all_pending_cmd()
1027 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
1029 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
1030 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_all_pending_cmd()
1033 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
1035 &adapter->scan_pending_q, list) { in mwifiex_cancel_all_pending_cmd()
1039 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_cancel_all_pending_cmd()
1041 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
1043 if (adapter->scan_processing) { in mwifiex_cancel_all_pending_cmd()
1044 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_all_pending_cmd()
1045 adapter->scan_processing = false; in mwifiex_cancel_all_pending_cmd()
1046 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_all_pending_cmd()
1047 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cancel_all_pending_cmd()
1048 priv = adapter->priv[i]; in mwifiex_cancel_all_pending_cmd()
1052 mwifiex_dbg(adapter, WARN, "info: aborting scan\n"); in mwifiex_cancel_all_pending_cmd()
1071 mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) in mwifiex_cancel_pending_ioctl() argument
1079 if ((adapter->curr_cmd) && in mwifiex_cancel_pending_ioctl()
1080 (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_pending_ioctl()
1081 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_pending_ioctl()
1082 cmd_node = adapter->curr_cmd; in mwifiex_cancel_pending_ioctl()
1091 adapter->curr_cmd = NULL; in mwifiex_cancel_pending_ioctl()
1092 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_pending_ioctl()
1094 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_pending_ioctl()
1098 spin_lock_irqsave(&adapter->scan_pending_q_lock, in mwifiex_cancel_pending_ioctl()
1101 &adapter->scan_pending_q, list) { in mwifiex_cancel_pending_ioctl()
1104 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_cancel_pending_ioctl()
1106 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, in mwifiex_cancel_pending_ioctl()
1109 if (adapter->scan_processing) { in mwifiex_cancel_pending_ioctl()
1110 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_pending_ioctl()
1111 adapter->scan_processing = false; in mwifiex_cancel_pending_ioctl()
1112 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_pending_ioctl()
1113 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cancel_pending_ioctl()
1114 priv = adapter->priv[i]; in mwifiex_cancel_pending_ioctl()
1118 mwifiex_dbg(adapter, WARN, "info: aborting scan\n"); in mwifiex_cancel_pending_ioctl()
1136 mwifiex_check_ps_cond(struct mwifiex_adapter *adapter) in mwifiex_check_ps_cond() argument
1138 if (!adapter->cmd_sent && in mwifiex_check_ps_cond()
1139 !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter)) in mwifiex_check_ps_cond()
1140 mwifiex_dnld_sleep_confirm_cmd(adapter); in mwifiex_check_ps_cond()
1142 mwifiex_dbg(adapter, CMD, in mwifiex_check_ps_cond()
1144 (adapter->cmd_sent) ? "D" : "", in mwifiex_check_ps_cond()
1145 (adapter->curr_cmd) ? "C" : "", in mwifiex_check_ps_cond()
1146 (IS_CARD_RX_RCVD(adapter)) ? "R" : ""); in mwifiex_check_ps_cond()
1158 if (priv->adapter->is_hs_configured) { in mwifiex_hs_activated_event()
1159 priv->adapter->hs_activated = true; in mwifiex_hs_activated_event()
1160 mwifiex_update_rxreor_flags(priv->adapter, in mwifiex_hs_activated_event()
1162 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1164 priv->adapter->hs_activate_wait_q_woken = true; in mwifiex_hs_activated_event()
1166 &priv->adapter->hs_activate_wait_q); in mwifiex_hs_activated_event()
1168 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1172 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1174 priv->adapter->hs_activated = false; in mwifiex_hs_activated_event()
1191 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_802_11_hs_cfg() local
1197 adapter->iface_type != MWIFIEX_USB) { in mwifiex_ret_802_11_hs_cfg()
1201 mwifiex_dbg(adapter, CMD, in mwifiex_ret_802_11_hs_cfg()
1209 adapter->is_hs_configured = true; in mwifiex_ret_802_11_hs_cfg()
1210 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_ret_802_11_hs_cfg()
1213 adapter->is_hs_configured = false; in mwifiex_ret_802_11_hs_cfg()
1214 if (adapter->hs_activated) in mwifiex_ret_802_11_hs_cfg()
1226 mwifiex_process_hs_config(struct mwifiex_adapter *adapter) in mwifiex_process_hs_config() argument
1228 mwifiex_dbg(adapter, INFO, in mwifiex_process_hs_config()
1233 adapter->if_ops.wakeup(adapter); in mwifiex_process_hs_config()
1234 adapter->hs_activated = false; in mwifiex_process_hs_config()
1235 adapter->is_hs_configured = false; in mwifiex_process_hs_config()
1236 adapter->is_suspended = false; in mwifiex_process_hs_config()
1237 mwifiex_hs_activated_event(mwifiex_get_priv(adapter, in mwifiex_process_hs_config()
1249 mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter, in mwifiex_process_sleep_confirm_resp() argument
1254 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_sleep_confirm_resp()
1260 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1265 mwifiex_dbg(adapter, CMD, in mwifiex_process_sleep_confirm_resp()
1270 priv = mwifiex_get_priv_by_id(adapter, HostCmd_GET_BSS_NO(seq_num), in mwifiex_process_sleep_confirm_resp()
1273 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_sleep_confirm_resp()
1281 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1288 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1291 adapter->pm_wakeup_card_req = false; in mwifiex_process_sleep_confirm_resp()
1292 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_process_sleep_confirm_resp()
1295 adapter->pm_wakeup_card_req = true; in mwifiex_process_sleep_confirm_resp()
1296 if (adapter->is_hs_configured) in mwifiex_process_sleep_confirm_resp()
1298 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_process_sleep_confirm_resp()
1300 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_process_sleep_confirm_resp()
1346 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cmd_enh_power_mode() local
1355 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1358 cpu_to_le16(adapter->null_pkt_interval); in mwifiex_cmd_enh_power_mode()
1360 cpu_to_le16(adapter->multiple_dtim); in mwifiex_cmd_enh_power_mode()
1362 cpu_to_le16(adapter->bcn_miss_time_out); in mwifiex_cmd_enh_power_mode()
1364 cpu_to_le16(adapter->local_listen_interval); in mwifiex_cmd_enh_power_mode()
1366 cpu_to_le16(adapter->adhoc_awake_period); in mwifiex_cmd_enh_power_mode()
1368 cpu_to_le16(adapter->delay_to_ps); in mwifiex_cmd_enh_power_mode()
1369 ps_mode->mode = cpu_to_le16(adapter->enhanced_ps_mode); in mwifiex_cmd_enh_power_mode()
1386 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1406 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_enh_power_mode() local
1414 mwifiex_dbg(adapter, INFO, in mwifiex_ret_enh_power_mode()
1419 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1421 priv->adapter->is_deep_sleep = true; in mwifiex_ret_enh_power_mode()
1424 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1426 if (adapter->sleep_period.period) in mwifiex_ret_enh_power_mode()
1427 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1432 priv->adapter->is_deep_sleep = false; in mwifiex_ret_enh_power_mode()
1433 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1437 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1439 if (adapter->sleep_period.period) { in mwifiex_ret_enh_power_mode()
1440 adapter->delay_null_pkt = false; in mwifiex_ret_enh_power_mode()
1441 adapter->tx_lock_flag = false; in mwifiex_ret_enh_power_mode()
1442 adapter->pps_uapsd_mode = false; in mwifiex_ret_enh_power_mode()
1447 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; in mwifiex_ret_enh_power_mode()
1449 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_ret_enh_power_mode()
1451 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1510 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_get_hw_spec() local
1516 adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); in mwifiex_ret_get_hw_spec()
1518 if (IS_SUPPORT_MULTI_BANDS(adapter)) in mwifiex_ret_get_hw_spec()
1519 adapter->fw_bands = (u8) GET_FW_DEFAULT_BANDS(adapter); in mwifiex_ret_get_hw_spec()
1521 adapter->fw_bands = BAND_B; in mwifiex_ret_get_hw_spec()
1523 adapter->config_bands = adapter->fw_bands; in mwifiex_ret_get_hw_spec()
1525 if (adapter->fw_bands & BAND_A) { in mwifiex_ret_get_hw_spec()
1526 if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1527 adapter->config_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1528 adapter->fw_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1530 if (adapter->fw_bands & BAND_AN) { in mwifiex_ret_get_hw_spec()
1531 adapter->adhoc_start_band = BAND_A | BAND_AN; in mwifiex_ret_get_hw_spec()
1532 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1534 adapter->adhoc_start_band = BAND_A; in mwifiex_ret_get_hw_spec()
1537 } else if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1538 adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN; in mwifiex_ret_get_hw_spec()
1540 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1541 } else if (adapter->fw_bands & BAND_G) { in mwifiex_ret_get_hw_spec()
1542 adapter->adhoc_start_band = BAND_G | BAND_B; in mwifiex_ret_get_hw_spec()
1544 } else if (adapter->fw_bands & BAND_B) { in mwifiex_ret_get_hw_spec()
1545 adapter->adhoc_start_band = BAND_B; in mwifiex_ret_get_hw_spec()
1549 adapter->fw_release_number = le32_to_cpu(hw_spec->fw_release_number); in mwifiex_ret_get_hw_spec()
1550 adapter->fw_api_ver = (adapter->fw_release_number >> 16) & 0xff; in mwifiex_ret_get_hw_spec()
1551 adapter->number_of_antenna = le16_to_cpu(hw_spec->number_of_antenna); in mwifiex_ret_get_hw_spec()
1554 adapter->is_hw_11ac_capable = true; in mwifiex_ret_get_hw_spec()
1557 adapter->hw_dot_11ac_dev_cap = in mwifiex_ret_get_hw_spec()
1559 adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1561 adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1565 adapter->hw_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1567 adapter->usr_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1568 adapter->hw_dot_11ac_mcs_support; in mwifiex_ret_get_hw_spec()
1570 adapter->is_hw_11ac_capable = false; in mwifiex_ret_get_hw_spec()
1585 adapter->key_api_major_ver = in mwifiex_ret_get_hw_spec()
1587 adapter->key_api_minor_ver = in mwifiex_ret_get_hw_spec()
1589 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1591 adapter->key_api_major_ver, in mwifiex_ret_get_hw_spec()
1592 adapter->key_api_minor_ver); in mwifiex_ret_get_hw_spec()
1595 adapter->fw_api_ver = in mwifiex_ret_get_hw_spec()
1597 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1599 adapter->fw_api_ver); in mwifiex_ret_get_hw_spec()
1602 mwifiex_dbg(adapter, FATAL, in mwifiex_ret_get_hw_spec()
1609 mwifiex_dbg(adapter, FATAL, in mwifiex_ret_get_hw_spec()
1621 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1623 adapter->fw_release_number); in mwifiex_ret_get_hw_spec()
1624 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1627 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1632 ether_addr_copy(priv->adapter->perm_addr, hw_spec->permanent_addr); in mwifiex_ret_get_hw_spec()
1633 adapter->region_code = le16_to_cpu(hw_spec->region_code); in mwifiex_ret_get_hw_spec()
1637 if (adapter->region_code == region_code_index[i]) in mwifiex_ret_get_hw_spec()
1642 adapter->region_code = 0x10; in mwifiex_ret_get_hw_spec()
1643 mwifiex_dbg(adapter, WARN, in mwifiex_ret_get_hw_spec()
1647 adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap); in mwifiex_ret_get_hw_spec()
1648 adapter->hw_dev_mcs_support = hw_spec->dev_mcs_support; in mwifiex_ret_get_hw_spec()
1649 adapter->user_dev_mcs_support = adapter->hw_dev_mcs_support; in mwifiex_ret_get_hw_spec()
1651 if (adapter->if_ops.update_mp_end_port) in mwifiex_ret_get_hw_spec()
1652 adapter->if_ops.update_mp_end_port(adapter, in mwifiex_ret_get_hw_spec()
1655 if (adapter->fw_api_ver == MWIFIEX_FW_V15) in mwifiex_ret_get_hw_spec()
1656 adapter->scan_chan_gap_enabled = true; in mwifiex_ret_get_hw_spec()