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 dev_err(adapter->dev, "GET_CMD_NODE: cmd node not available\n"); in mwifiex_get_cmd_node()
66 spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); in mwifiex_get_cmd_node()
69 cmd_node = list_first_entry(&adapter->cmd_free_q, in mwifiex_get_cmd_node()
72 spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); in mwifiex_get_cmd_node()
89 mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter, in mwifiex_clean_cmd_node() argument
101 adapter->if_ops.cmdrsp_complete(adapter, cmd_node->resp_skb); in mwifiex_clean_cmd_node()
119 dev_dbg(priv->adapter->dev, "cmd: host cmd size = %d\n", pcmd_ptr->len); in mwifiex_cmd_host_cmd()
135 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_dnld_cmd_to_fw() local
143 if (!adapter || !cmd_node) in mwifiex_dnld_cmd_to_fw()
150 dev_err(adapter->dev, "DNLD_CMD: host_cmd is null" in mwifiex_dnld_cmd_to_fw()
153 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
154 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
161 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && in mwifiex_dnld_cmd_to_fw()
164 dev_err(adapter->dev, in mwifiex_dnld_cmd_to_fw()
168 mwifiex_complete_cmd(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
169 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
170 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_dnld_cmd_to_fw()
175 adapter->seq_num++; in mwifiex_dnld_cmd_to_fw()
177 (adapter->seq_num, in mwifiex_dnld_cmd_to_fw()
181 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_dnld_cmd_to_fw()
182 adapter->curr_cmd = cmd_node; in mwifiex_dnld_cmd_to_fw()
183 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_dnld_cmd_to_fw()
200 dev_dbg(adapter->dev, in mwifiex_dnld_cmd_to_fw()
205 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_cmd_to_fw()
209 adapter->cmd_sent = true; in mwifiex_dnld_cmd_to_fw()
210 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_cmd_to_fw()
218 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_cmd_to_fw()
224 dev_err(adapter->dev, "DNLD_CMD: host to card failed\n"); in mwifiex_dnld_cmd_to_fw()
225 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_dnld_cmd_to_fw()
226 adapter->cmd_sent = false; in mwifiex_dnld_cmd_to_fw()
228 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
229 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_dnld_cmd_to_fw()
231 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_dnld_cmd_to_fw()
232 adapter->curr_cmd = NULL; in mwifiex_dnld_cmd_to_fw()
233 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_dnld_cmd_to_fw()
235 adapter->dbg.num_cmd_host_to_card_failure++; in mwifiex_dnld_cmd_to_fw()
240 adapter->dbg.last_cmd_index = in mwifiex_dnld_cmd_to_fw()
241 (adapter->dbg.last_cmd_index + 1) % DBG_CMD_NUM; in mwifiex_dnld_cmd_to_fw()
242 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index] = cmd_code; in mwifiex_dnld_cmd_to_fw()
243 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] = in mwifiex_dnld_cmd_to_fw()
250 mod_timer(&adapter->cmd_timer, in mwifiex_dnld_cmd_to_fw()
265 static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) in mwifiex_dnld_sleep_confirm_cmd() argument
271 adapter->sleep_cfm->data; in mwifiex_dnld_sleep_confirm_cmd()
275 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_dnld_sleep_confirm_cmd()
277 adapter->seq_num++; in mwifiex_dnld_sleep_confirm_cmd()
280 (adapter->seq_num, priv->bss_num, in mwifiex_dnld_sleep_confirm_cmd()
283 dev_dbg(adapter->dev, in mwifiex_dnld_sleep_confirm_cmd()
290 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_sleep_confirm_cmd()
299 adapter->sleep_cfm->data, in mwifiex_dnld_sleep_confirm_cmd()
301 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_sleep_confirm_cmd()
307 skb_push(adapter->sleep_cfm, INTF_HEADER_LEN); in mwifiex_dnld_sleep_confirm_cmd()
308 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_sleep_confirm_cmd()
309 adapter->sleep_cfm, NULL); in mwifiex_dnld_sleep_confirm_cmd()
310 skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN); in mwifiex_dnld_sleep_confirm_cmd()
314 dev_err(adapter->dev, "SLEEP_CFM: failed\n"); in mwifiex_dnld_sleep_confirm_cmd()
315 adapter->dbg.num_cmd_sleep_cfm_host_to_card_failure++; in mwifiex_dnld_sleep_confirm_cmd()
321 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_dnld_sleep_confirm_cmd()
323 adapter->ps_state = PS_STATE_SLEEP_CFM; in mwifiex_dnld_sleep_confirm_cmd()
326 (adapter->is_hs_configured && in mwifiex_dnld_sleep_confirm_cmd()
327 !adapter->sleep_period.period)) { in mwifiex_dnld_sleep_confirm_cmd()
328 adapter->pm_wakeup_card_req = true; in mwifiex_dnld_sleep_confirm_cmd()
330 (adapter, MWIFIEX_BSS_ROLE_ANY), true); in mwifiex_dnld_sleep_confirm_cmd()
348 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_alloc_cmd_buffer() argument
359 adapter->cmd_pool = cmd_array; in mwifiex_alloc_cmd_buffer()
365 dev_err(adapter->dev, "ALLOC_CMD_BUF: out of memory\n"); in mwifiex_alloc_cmd_buffer()
371 mwifiex_insert_cmd_to_free_q(adapter, &cmd_array[i]); in mwifiex_alloc_cmd_buffer()
382 int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_free_cmd_buffer() argument
388 if (!adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
389 dev_dbg(adapter->dev, "info: FREE_CMD_BUF: cmd_pool is null\n"); in mwifiex_free_cmd_buffer()
393 cmd_array = adapter->cmd_pool; in mwifiex_free_cmd_buffer()
398 dev_dbg(adapter->dev, "cmd: free cmd buffer %d\n", i); in mwifiex_free_cmd_buffer()
404 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_free_cmd_buffer()
405 adapter->if_ops.cmdrsp_complete(adapter, in mwifiex_free_cmd_buffer()
411 if (adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
412 dev_dbg(adapter->dev, "cmd: free cmd pool\n"); in mwifiex_free_cmd_buffer()
413 kfree(adapter->cmd_pool); in mwifiex_free_cmd_buffer()
414 adapter->cmd_pool = NULL; in mwifiex_free_cmd_buffer()
430 int mwifiex_process_event(struct mwifiex_adapter *adapter) in mwifiex_process_event() argument
434 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
435 struct sk_buff *skb = adapter->event_skb; in mwifiex_process_event()
436 u32 eventcause = adapter->event_cause; in mwifiex_process_event()
440 adapter->dbg.last_event_index = in mwifiex_process_event()
441 (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM; in mwifiex_process_event()
442 adapter->dbg.last_event[adapter->dbg.last_event_index] = in mwifiex_process_event()
446 priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause), in mwifiex_process_event()
449 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
453 adapter->event_cause = eventcause; in mwifiex_process_event()
462 dev_dbg(adapter->dev, "EVENT: cause: %#x\n", eventcause); in mwifiex_process_event()
469 adapter->event_cause = 0; in mwifiex_process_event()
470 adapter->event_skb = NULL; in mwifiex_process_event()
471 adapter->if_ops.event_complete(adapter, skb); in mwifiex_process_event()
491 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_send_cmd() local
495 if (!adapter) { in mwifiex_send_cmd()
500 if (adapter->is_suspended) { in mwifiex_send_cmd()
501 dev_err(adapter->dev, "PREP_CMD: device in suspended state\n"); in mwifiex_send_cmd()
505 if (adapter->hs_enabling && cmd_no != HostCmd_CMD_802_11_HS_CFG_ENH) { in mwifiex_send_cmd()
506 dev_err(adapter->dev, "PREP_CMD: host entering sleep state\n"); in mwifiex_send_cmd()
510 if (adapter->surprise_removed) { in mwifiex_send_cmd()
511 dev_err(adapter->dev, "PREP_CMD: card is removed\n"); in mwifiex_send_cmd()
515 if (adapter->is_cmd_timedout) { in mwifiex_send_cmd()
516 dev_err(adapter->dev, "PREP_CMD: FW is in bad state\n"); in mwifiex_send_cmd()
520 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET) { in mwifiex_send_cmd()
522 dev_err(adapter->dev, "PREP_CMD: FW in reset state\n"); in mwifiex_send_cmd()
528 cmd_node = mwifiex_get_cmd_node(adapter); in mwifiex_send_cmd()
531 dev_err(adapter->dev, "PREP_CMD: no free cmd node\n"); in mwifiex_send_cmd()
539 dev_err(adapter->dev, "PREP_CMD: no free cmd buf\n"); in mwifiex_send_cmd()
574 dev_err(adapter->dev, "PREP_CMD: cmd %#x preparation failed\n", in mwifiex_send_cmd()
576 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_send_cmd()
585 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); in mwifiex_send_cmd()
586 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_send_cmd()
588 ret = mwifiex_wait_queue_complete(adapter, cmd_node); in mwifiex_send_cmd()
601 mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_free_q() argument
610 mwifiex_complete_cmd(adapter, cmd_node); in mwifiex_insert_cmd_to_free_q()
612 mwifiex_clean_cmd_node(adapter, cmd_node); in mwifiex_insert_cmd_to_free_q()
615 spin_lock_irqsave(&adapter->cmd_free_q_lock, flags); in mwifiex_insert_cmd_to_free_q()
616 list_add_tail(&cmd_node->list, &adapter->cmd_free_q); in mwifiex_insert_cmd_to_free_q()
617 spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); in mwifiex_insert_cmd_to_free_q()
621 void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, in mwifiex_recycle_cmd_node() argument
626 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_recycle_cmd_node()
628 atomic_dec(&adapter->cmd_pending); in mwifiex_recycle_cmd_node()
629 dev_dbg(adapter->dev, "cmd: FREE_CMD: cmd=%#x, cmd_pending=%d\n", in mwifiex_recycle_cmd_node()
631 atomic_read(&adapter->cmd_pending)); in mwifiex_recycle_cmd_node()
642 mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_pending_q() argument
651 dev_err(adapter->dev, "QUEUE_CMD: host_cmd is NULL\n"); in mwifiex_insert_cmd_to_pending_q()
663 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_insert_cmd_to_pending_q()
668 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); in mwifiex_insert_cmd_to_pending_q()
670 list_add_tail(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
672 list_add(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
673 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); in mwifiex_insert_cmd_to_pending_q()
675 atomic_inc(&adapter->cmd_pending); in mwifiex_insert_cmd_to_pending_q()
676 dev_dbg(adapter->dev, "cmd: QUEUE_CMD: cmd=%#x, cmd_pending=%d\n", in mwifiex_insert_cmd_to_pending_q()
677 command, atomic_read(&adapter->cmd_pending)); in mwifiex_insert_cmd_to_pending_q()
691 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) in mwifiex_exec_next_cmd() argument
701 if (adapter->curr_cmd) { in mwifiex_exec_next_cmd()
702 dev_err(adapter->dev, "EXEC_NEXT_CMD: cmd in processing\n"); in mwifiex_exec_next_cmd()
706 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_exec_next_cmd()
708 spin_lock_irqsave(&adapter->cmd_pending_q_lock, cmd_pending_q_flags); in mwifiex_exec_next_cmd()
709 if (list_empty(&adapter->cmd_pending_q)) { in mwifiex_exec_next_cmd()
710 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, in mwifiex_exec_next_cmd()
712 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_exec_next_cmd()
715 cmd_node = list_first_entry(&adapter->cmd_pending_q, in mwifiex_exec_next_cmd()
717 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, in mwifiex_exec_next_cmd()
723 if (adapter->ps_state != PS_STATE_AWAKE) { in mwifiex_exec_next_cmd()
724 dev_err(adapter->dev, "%s: cannot send cmd in sleep state," in mwifiex_exec_next_cmd()
726 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_exec_next_cmd()
730 spin_lock_irqsave(&adapter->cmd_pending_q_lock, cmd_pending_q_flags); in mwifiex_exec_next_cmd()
732 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, in mwifiex_exec_next_cmd()
735 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_exec_next_cmd()
737 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_exec_next_cmd()
744 if (adapter->hs_activated) { in mwifiex_exec_next_cmd()
745 adapter->is_hs_configured = false; in mwifiex_exec_next_cmd()
759 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) in mwifiex_process_cmdresp() argument
763 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
771 del_timer_sync(&adapter->cmd_timer); in mwifiex_process_cmdresp()
773 if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) { in mwifiex_process_cmdresp()
774 resp = (struct host_cmd_ds_command *) adapter->upld_buf; in mwifiex_process_cmdresp()
775 dev_err(adapter->dev, "CMD_RESP: NULL curr_cmd, %#x\n", in mwifiex_process_cmdresp()
780 adapter->is_cmd_timedout = 0; in mwifiex_process_cmdresp()
782 resp = (struct host_cmd_ds_command *) adapter->curr_cmd->resp_skb->data; in mwifiex_process_cmdresp()
783 if (adapter->curr_cmd->cmd_flag & CMD_F_CANCELED) { in mwifiex_process_cmdresp()
784 dev_err(adapter->dev, "CMD_RESP: %#x been canceled\n", in mwifiex_process_cmdresp()
786 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
787 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
788 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
789 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
793 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
797 dev_dbg(adapter->dev, "info: host cmd resp size = %d\n", size); in mwifiex_process_cmdresp()
799 if (adapter->curr_cmd->data_buf) { in mwifiex_process_cmdresp()
800 hostcmd = adapter->curr_cmd->data_buf; in mwifiex_process_cmdresp()
808 priv = mwifiex_get_priv_by_id(adapter, in mwifiex_process_cmdresp()
812 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
820 adapter->dbg.last_cmd_resp_index = in mwifiex_process_cmdresp()
821 (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM; in mwifiex_process_cmdresp()
822 adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] = in mwifiex_process_cmdresp()
825 dev_dbg(adapter->dev, in mwifiex_process_cmdresp()
831 dev_err(adapter->dev, "CMD_RESP: invalid cmd resp\n"); in mwifiex_process_cmdresp()
832 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
833 adapter->cmd_wait_q.status = -1; in mwifiex_process_cmdresp()
835 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
836 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
837 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
838 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
842 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
843 adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; in mwifiex_process_cmdresp()
853 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_process_cmdresp()
855 dev_err(adapter->dev, "%s: cmd %#x failed during " in mwifiex_process_cmdresp()
857 mwifiex_init_fw_complete(adapter); in mwifiex_process_cmdresp()
859 } else if (adapter->last_init_cmd == cmdresp_no) in mwifiex_process_cmdresp()
860 adapter->hw_status = MWIFIEX_HW_STATUS_INIT_DONE; in mwifiex_process_cmdresp()
863 if (adapter->curr_cmd) { in mwifiex_process_cmdresp()
864 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
865 adapter->cmd_wait_q.status = ret; in mwifiex_process_cmdresp()
867 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
869 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
870 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
871 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); in mwifiex_process_cmdresp()
885 struct mwifiex_adapter *adapter = in mwifiex_cmd_timeout_func() local
889 adapter->is_cmd_timedout = 1; in mwifiex_cmd_timeout_func()
890 if (!adapter->curr_cmd) { in mwifiex_cmd_timeout_func()
891 dev_dbg(adapter->dev, "cmd: empty curr_cmd\n"); in mwifiex_cmd_timeout_func()
894 cmd_node = adapter->curr_cmd; in mwifiex_cmd_timeout_func()
896 adapter->dbg.timeout_cmd_id = in mwifiex_cmd_timeout_func()
897 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
898 adapter->dbg.timeout_cmd_act = in mwifiex_cmd_timeout_func()
899 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
900 dev_err(adapter->dev, in mwifiex_cmd_timeout_func()
902 adapter->dbg.timeout_cmd_id, in mwifiex_cmd_timeout_func()
903 adapter->dbg.timeout_cmd_act); in mwifiex_cmd_timeout_func()
905 dev_err(adapter->dev, "num_data_h2c_failure = %d\n", in mwifiex_cmd_timeout_func()
906 adapter->dbg.num_tx_host_to_card_failure); in mwifiex_cmd_timeout_func()
907 dev_err(adapter->dev, "num_cmd_h2c_failure = %d\n", in mwifiex_cmd_timeout_func()
908 adapter->dbg.num_cmd_host_to_card_failure); in mwifiex_cmd_timeout_func()
910 dev_err(adapter->dev, "is_cmd_timedout = %d\n", in mwifiex_cmd_timeout_func()
911 adapter->is_cmd_timedout); in mwifiex_cmd_timeout_func()
912 dev_err(adapter->dev, "num_tx_timeout = %d\n", in mwifiex_cmd_timeout_func()
913 adapter->dbg.num_tx_timeout); in mwifiex_cmd_timeout_func()
915 dev_err(adapter->dev, "last_cmd_index = %d\n", in mwifiex_cmd_timeout_func()
916 adapter->dbg.last_cmd_index); in mwifiex_cmd_timeout_func()
917 dev_err(adapter->dev, "last_cmd_id: %*ph\n", in mwifiex_cmd_timeout_func()
918 (int)sizeof(adapter->dbg.last_cmd_id), in mwifiex_cmd_timeout_func()
919 adapter->dbg.last_cmd_id); in mwifiex_cmd_timeout_func()
920 dev_err(adapter->dev, "last_cmd_act: %*ph\n", in mwifiex_cmd_timeout_func()
921 (int)sizeof(adapter->dbg.last_cmd_act), in mwifiex_cmd_timeout_func()
922 adapter->dbg.last_cmd_act); in mwifiex_cmd_timeout_func()
924 dev_err(adapter->dev, "last_cmd_resp_index = %d\n", in mwifiex_cmd_timeout_func()
925 adapter->dbg.last_cmd_resp_index); in mwifiex_cmd_timeout_func()
926 dev_err(adapter->dev, "last_cmd_resp_id: %*ph\n", in mwifiex_cmd_timeout_func()
927 (int)sizeof(adapter->dbg.last_cmd_resp_id), in mwifiex_cmd_timeout_func()
928 adapter->dbg.last_cmd_resp_id); in mwifiex_cmd_timeout_func()
930 dev_err(adapter->dev, "last_event_index = %d\n", in mwifiex_cmd_timeout_func()
931 adapter->dbg.last_event_index); in mwifiex_cmd_timeout_func()
932 dev_err(adapter->dev, "last_event: %*ph\n", in mwifiex_cmd_timeout_func()
933 (int)sizeof(adapter->dbg.last_event), in mwifiex_cmd_timeout_func()
934 adapter->dbg.last_event); in mwifiex_cmd_timeout_func()
936 dev_err(adapter->dev, "data_sent=%d cmd_sent=%d\n", in mwifiex_cmd_timeout_func()
937 adapter->data_sent, adapter->cmd_sent); in mwifiex_cmd_timeout_func()
939 dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n", in mwifiex_cmd_timeout_func()
940 adapter->ps_mode, adapter->ps_state); in mwifiex_cmd_timeout_func()
943 adapter->cmd_wait_q.status = -ETIMEDOUT; in mwifiex_cmd_timeout_func()
944 wake_up_interruptible(&adapter->cmd_wait_q.wait); in mwifiex_cmd_timeout_func()
945 mwifiex_cancel_pending_ioctl(adapter); in mwifiex_cmd_timeout_func()
948 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) in mwifiex_cmd_timeout_func()
949 mwifiex_init_fw_complete(adapter); in mwifiex_cmd_timeout_func()
951 if (adapter->if_ops.fw_dump) in mwifiex_cmd_timeout_func()
952 adapter->if_ops.fw_dump(adapter); in mwifiex_cmd_timeout_func()
954 if (adapter->if_ops.card_reset) in mwifiex_cmd_timeout_func()
955 adapter->if_ops.card_reset(adapter); in mwifiex_cmd_timeout_func()
966 mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) in mwifiex_cancel_all_pending_cmd() argument
973 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_all_pending_cmd()
975 if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_all_pending_cmd()
976 adapter->curr_cmd->wait_q_enabled = false; in mwifiex_cancel_all_pending_cmd()
977 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
978 mwifiex_complete_cmd(adapter, adapter->curr_cmd); in mwifiex_cancel_all_pending_cmd()
981 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
983 &adapter->cmd_pending_q, list) { in mwifiex_cancel_all_pending_cmd()
985 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
988 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
989 mwifiex_complete_cmd(adapter, cmd_node); in mwifiex_cancel_all_pending_cmd()
992 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_all_pending_cmd()
993 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
995 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
996 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_all_pending_cmd()
999 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
1001 &adapter->scan_pending_q, list) { in mwifiex_cancel_all_pending_cmd()
1005 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_cancel_all_pending_cmd()
1007 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); in mwifiex_cancel_all_pending_cmd()
1009 if (adapter->scan_processing) { in mwifiex_cancel_all_pending_cmd()
1010 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_all_pending_cmd()
1011 adapter->scan_processing = false; in mwifiex_cancel_all_pending_cmd()
1012 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_all_pending_cmd()
1013 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cancel_all_pending_cmd()
1014 priv = adapter->priv[i]; in mwifiex_cancel_all_pending_cmd()
1018 dev_dbg(adapter->dev, "info: aborting scan\n"); in mwifiex_cancel_all_pending_cmd()
1037 mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) in mwifiex_cancel_pending_ioctl() argument
1045 if ((adapter->curr_cmd) && in mwifiex_cancel_pending_ioctl()
1046 (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_pending_ioctl()
1047 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_pending_ioctl()
1048 cmd_node = adapter->curr_cmd; in mwifiex_cancel_pending_ioctl()
1051 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_pending_ioctl()
1052 mwifiex_complete_cmd(adapter, adapter->curr_cmd); in mwifiex_cancel_pending_ioctl()
1053 adapter->curr_cmd = NULL; in mwifiex_cancel_pending_ioctl()
1054 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_pending_ioctl()
1058 spin_lock_irqsave(&adapter->scan_pending_q_lock, in mwifiex_cancel_pending_ioctl()
1061 &adapter->scan_pending_q, list) { in mwifiex_cancel_pending_ioctl()
1064 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_cancel_pending_ioctl()
1066 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, in mwifiex_cancel_pending_ioctl()
1069 if (adapter->scan_processing) { in mwifiex_cancel_pending_ioctl()
1070 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_pending_ioctl()
1071 adapter->scan_processing = false; in mwifiex_cancel_pending_ioctl()
1072 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); in mwifiex_cancel_pending_ioctl()
1073 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cancel_pending_ioctl()
1074 priv = adapter->priv[i]; in mwifiex_cancel_pending_ioctl()
1078 dev_dbg(adapter->dev, "info: aborting scan\n"); in mwifiex_cancel_pending_ioctl()
1084 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_pending_ioctl()
1097 mwifiex_check_ps_cond(struct mwifiex_adapter *adapter) in mwifiex_check_ps_cond() argument
1099 if (!adapter->cmd_sent && in mwifiex_check_ps_cond()
1100 !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter)) in mwifiex_check_ps_cond()
1101 mwifiex_dnld_sleep_confirm_cmd(adapter); in mwifiex_check_ps_cond()
1103 dev_dbg(adapter->dev, in mwifiex_check_ps_cond()
1105 (adapter->cmd_sent) ? "D" : "", in mwifiex_check_ps_cond()
1106 (adapter->curr_cmd) ? "C" : "", in mwifiex_check_ps_cond()
1107 (IS_CARD_RX_RCVD(adapter)) ? "R" : ""); in mwifiex_check_ps_cond()
1119 if (priv->adapter->is_hs_configured) { in mwifiex_hs_activated_event()
1120 priv->adapter->hs_activated = true; in mwifiex_hs_activated_event()
1121 mwifiex_update_rxreor_flags(priv->adapter, in mwifiex_hs_activated_event()
1123 dev_dbg(priv->adapter->dev, "event: hs_activated\n"); in mwifiex_hs_activated_event()
1124 priv->adapter->hs_activate_wait_q_woken = true; in mwifiex_hs_activated_event()
1126 &priv->adapter->hs_activate_wait_q); in mwifiex_hs_activated_event()
1128 dev_dbg(priv->adapter->dev, "event: HS not configured\n"); in mwifiex_hs_activated_event()
1131 dev_dbg(priv->adapter->dev, "event: hs_deactivated\n"); in mwifiex_hs_activated_event()
1132 priv->adapter->hs_activated = false; in mwifiex_hs_activated_event()
1149 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_802_11_hs_cfg() local
1155 adapter->iface_type != MWIFIEX_USB) { in mwifiex_ret_802_11_hs_cfg()
1159 dev_dbg(adapter->dev, "cmd: CMD_RESP: HS_CFG cmd reply" in mwifiex_ret_802_11_hs_cfg()
1166 adapter->is_hs_configured = true; in mwifiex_ret_802_11_hs_cfg()
1167 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_ret_802_11_hs_cfg()
1170 adapter->is_hs_configured = false; in mwifiex_ret_802_11_hs_cfg()
1171 if (adapter->hs_activated) in mwifiex_ret_802_11_hs_cfg()
1183 mwifiex_process_hs_config(struct mwifiex_adapter *adapter) in mwifiex_process_hs_config() argument
1185 dev_dbg(adapter->dev, "info: %s: auto cancelling host sleep" in mwifiex_process_hs_config()
1188 adapter->if_ops.wakeup(adapter); in mwifiex_process_hs_config()
1189 adapter->hs_activated = false; in mwifiex_process_hs_config()
1190 adapter->is_hs_configured = false; in mwifiex_process_hs_config()
1191 adapter->is_suspended = false; in mwifiex_process_hs_config()
1192 mwifiex_hs_activated_event(mwifiex_get_priv(adapter, in mwifiex_process_hs_config()
1204 mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter, in mwifiex_process_sleep_confirm_resp() argument
1209 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_sleep_confirm_resp()
1215 dev_err(adapter->dev, "%s: cmd size is 0\n", __func__); in mwifiex_process_sleep_confirm_resp()
1219 dev_dbg(adapter->dev, in mwifiex_process_sleep_confirm_resp()
1224 priv = mwifiex_get_priv_by_id(adapter, HostCmd_GET_BSS_NO(seq_num), in mwifiex_process_sleep_confirm_resp()
1227 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_sleep_confirm_resp()
1235 dev_err(adapter->dev, in mwifiex_process_sleep_confirm_resp()
1242 dev_err(adapter->dev, "%s: sleep confirm cmd failed\n", in mwifiex_process_sleep_confirm_resp()
1244 adapter->pm_wakeup_card_req = false; in mwifiex_process_sleep_confirm_resp()
1245 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_process_sleep_confirm_resp()
1248 adapter->pm_wakeup_card_req = true; in mwifiex_process_sleep_confirm_resp()
1249 if (adapter->is_hs_configured) in mwifiex_process_sleep_confirm_resp()
1251 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_process_sleep_confirm_resp()
1253 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_process_sleep_confirm_resp()
1299 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cmd_enh_power_mode() local
1308 dev_dbg(adapter->dev, "cmd: PS Command: Enter PS\n"); in mwifiex_cmd_enh_power_mode()
1310 cpu_to_le16(adapter->null_pkt_interval); in mwifiex_cmd_enh_power_mode()
1312 cpu_to_le16(adapter->multiple_dtim); in mwifiex_cmd_enh_power_mode()
1314 cpu_to_le16(adapter->bcn_miss_time_out); in mwifiex_cmd_enh_power_mode()
1316 cpu_to_le16(adapter->local_listen_interval); in mwifiex_cmd_enh_power_mode()
1318 cpu_to_le16(adapter->adhoc_awake_period); in mwifiex_cmd_enh_power_mode()
1320 cpu_to_le16(adapter->delay_to_ps); in mwifiex_cmd_enh_power_mode()
1321 ps_mode->mode = cpu_to_le16(adapter->enhanced_ps_mode); in mwifiex_cmd_enh_power_mode()
1338 dev_dbg(priv->adapter->dev, in mwifiex_cmd_enh_power_mode()
1358 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_enh_power_mode() local
1366 dev_dbg(adapter->dev, in mwifiex_ret_enh_power_mode()
1371 dev_dbg(adapter->dev, "cmd: Enabled auto deep sleep\n"); in mwifiex_ret_enh_power_mode()
1372 priv->adapter->is_deep_sleep = true; in mwifiex_ret_enh_power_mode()
1375 dev_dbg(adapter->dev, "cmd: Enabled STA power save\n"); in mwifiex_ret_enh_power_mode()
1376 if (adapter->sleep_period.period) in mwifiex_ret_enh_power_mode()
1377 dev_dbg(adapter->dev, in mwifiex_ret_enh_power_mode()
1382 priv->adapter->is_deep_sleep = false; in mwifiex_ret_enh_power_mode()
1383 dev_dbg(adapter->dev, "cmd: Disabled auto deep sleep\n"); in mwifiex_ret_enh_power_mode()
1386 dev_dbg(adapter->dev, "cmd: Disabled STA power save\n"); in mwifiex_ret_enh_power_mode()
1387 if (adapter->sleep_period.period) { in mwifiex_ret_enh_power_mode()
1388 adapter->delay_null_pkt = false; in mwifiex_ret_enh_power_mode()
1389 adapter->tx_lock_flag = false; in mwifiex_ret_enh_power_mode()
1390 adapter->pps_uapsd_mode = false; in mwifiex_ret_enh_power_mode()
1395 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; in mwifiex_ret_enh_power_mode()
1397 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_ret_enh_power_mode()
1399 dev_dbg(adapter->dev, "cmd: ps_bitmap=%#x\n", ps_bitmap); in mwifiex_ret_enh_power_mode()
1457 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_get_hw_spec() local
1463 adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); in mwifiex_ret_get_hw_spec()
1465 if (IS_SUPPORT_MULTI_BANDS(adapter)) in mwifiex_ret_get_hw_spec()
1466 adapter->fw_bands = (u8) GET_FW_DEFAULT_BANDS(adapter); in mwifiex_ret_get_hw_spec()
1468 adapter->fw_bands = BAND_B; in mwifiex_ret_get_hw_spec()
1470 adapter->config_bands = adapter->fw_bands; in mwifiex_ret_get_hw_spec()
1472 if (adapter->fw_bands & BAND_A) { in mwifiex_ret_get_hw_spec()
1473 if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1474 adapter->config_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1475 adapter->fw_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1477 if (adapter->fw_bands & BAND_AN) { in mwifiex_ret_get_hw_spec()
1478 adapter->adhoc_start_band = BAND_A | BAND_AN; in mwifiex_ret_get_hw_spec()
1479 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1481 adapter->adhoc_start_band = BAND_A; in mwifiex_ret_get_hw_spec()
1484 } else if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1485 adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN; in mwifiex_ret_get_hw_spec()
1487 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1488 } else if (adapter->fw_bands & BAND_G) { in mwifiex_ret_get_hw_spec()
1489 adapter->adhoc_start_band = BAND_G | BAND_B; in mwifiex_ret_get_hw_spec()
1491 } else if (adapter->fw_bands & BAND_B) { in mwifiex_ret_get_hw_spec()
1492 adapter->adhoc_start_band = BAND_B; in mwifiex_ret_get_hw_spec()
1496 adapter->fw_release_number = le32_to_cpu(hw_spec->fw_release_number); in mwifiex_ret_get_hw_spec()
1497 adapter->fw_api_ver = (adapter->fw_release_number >> 16) & 0xff; in mwifiex_ret_get_hw_spec()
1498 adapter->number_of_antenna = le16_to_cpu(hw_spec->number_of_antenna); in mwifiex_ret_get_hw_spec()
1501 adapter->is_hw_11ac_capable = true; in mwifiex_ret_get_hw_spec()
1504 adapter->hw_dot_11ac_dev_cap = in mwifiex_ret_get_hw_spec()
1506 adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1508 adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1512 adapter->hw_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1514 adapter->usr_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1515 adapter->hw_dot_11ac_mcs_support; in mwifiex_ret_get_hw_spec()
1517 adapter->is_hw_11ac_capable = false; in mwifiex_ret_get_hw_spec()
1532 adapter->key_api_major_ver = in mwifiex_ret_get_hw_spec()
1534 adapter->key_api_minor_ver = in mwifiex_ret_get_hw_spec()
1536 dev_dbg(adapter->dev, in mwifiex_ret_get_hw_spec()
1538 adapter->key_api_major_ver, in mwifiex_ret_get_hw_spec()
1539 adapter->key_api_minor_ver); in mwifiex_ret_get_hw_spec()
1542 adapter->fw_api_ver = in mwifiex_ret_get_hw_spec()
1544 dev_dbg(adapter->dev, in mwifiex_ret_get_hw_spec()
1546 adapter->fw_api_ver); in mwifiex_ret_get_hw_spec()
1549 dev_warn(adapter->dev, in mwifiex_ret_get_hw_spec()
1556 dev_warn(adapter->dev, in mwifiex_ret_get_hw_spec()
1568 dev_dbg(adapter->dev, "info: GET_HW_SPEC: fw_release_number- %#x\n", in mwifiex_ret_get_hw_spec()
1569 adapter->fw_release_number); in mwifiex_ret_get_hw_spec()
1570 dev_dbg(adapter->dev, "info: GET_HW_SPEC: permanent addr: %pM\n", in mwifiex_ret_get_hw_spec()
1572 dev_dbg(adapter->dev, in mwifiex_ret_get_hw_spec()
1577 ether_addr_copy(priv->adapter->perm_addr, hw_spec->permanent_addr); in mwifiex_ret_get_hw_spec()
1578 adapter->region_code = le16_to_cpu(hw_spec->region_code); in mwifiex_ret_get_hw_spec()
1582 if (adapter->region_code == region_code_index[i]) in mwifiex_ret_get_hw_spec()
1587 adapter->region_code = 0x10; in mwifiex_ret_get_hw_spec()
1588 dev_dbg(adapter->dev, in mwifiex_ret_get_hw_spec()
1592 adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap); in mwifiex_ret_get_hw_spec()
1593 adapter->hw_dev_mcs_support = hw_spec->dev_mcs_support; in mwifiex_ret_get_hw_spec()
1594 adapter->user_dev_mcs_support = adapter->hw_dev_mcs_support; in mwifiex_ret_get_hw_spec()
1596 if (adapter->if_ops.update_mp_end_port) in mwifiex_ret_get_hw_spec()
1597 adapter->if_ops.update_mp_end_port(adapter, in mwifiex_ret_get_hw_spec()
1600 if (adapter->fw_api_ver == MWIFIEX_FW_V15) in mwifiex_ret_get_hw_spec()
1601 adapter->scan_chan_gap_enabled = true; in mwifiex_ret_get_hw_spec()