Lines Matching refs:adapter

17 static void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
49 mwifiex_get_cmd_node(struct mwifiex_adapter *adapter) in mwifiex_get_cmd_node() argument
53 spin_lock_bh(&adapter->cmd_free_q_lock); in mwifiex_get_cmd_node()
54 if (list_empty(&adapter->cmd_free_q)) { in mwifiex_get_cmd_node()
55 mwifiex_dbg(adapter, ERROR, in mwifiex_get_cmd_node()
57 spin_unlock_bh(&adapter->cmd_free_q_lock); in mwifiex_get_cmd_node()
60 cmd_node = list_first_entry(&adapter->cmd_free_q, in mwifiex_get_cmd_node()
63 spin_unlock_bh(&adapter->cmd_free_q_lock); in mwifiex_get_cmd_node()
80 mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter, in mwifiex_clean_cmd_node() argument
92 adapter->if_ops.cmdrsp_complete(adapter, cmd_node->resp_skb); in mwifiex_clean_cmd_node()
104 mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_free_q() argument
111 mwifiex_complete_cmd(adapter, cmd_node); in mwifiex_insert_cmd_to_free_q()
113 mwifiex_clean_cmd_node(adapter, cmd_node); in mwifiex_insert_cmd_to_free_q()
116 spin_lock_bh(&adapter->cmd_free_q_lock); in mwifiex_insert_cmd_to_free_q()
117 list_add_tail(&cmd_node->list, &adapter->cmd_free_q); in mwifiex_insert_cmd_to_free_q()
118 spin_unlock_bh(&adapter->cmd_free_q_lock); in mwifiex_insert_cmd_to_free_q()
122 void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, in mwifiex_recycle_cmd_node() argument
127 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_recycle_cmd_node()
129 atomic_dec(&adapter->cmd_pending); in mwifiex_recycle_cmd_node()
130 mwifiex_dbg(adapter, CMD, in mwifiex_recycle_cmd_node()
133 atomic_read(&adapter->cmd_pending)); in mwifiex_recycle_cmd_node()
149 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_host_cmd()
166 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_dnld_cmd_to_fw() local
172 if (!adapter || !cmd_node) in mwifiex_dnld_cmd_to_fw()
179 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
183 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
184 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
192 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && in mwifiex_dnld_cmd_to_fw()
195 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
198 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
199 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_dnld_cmd_to_fw()
204 adapter->seq_num++; in mwifiex_dnld_cmd_to_fw()
206 (adapter->seq_num, in mwifiex_dnld_cmd_to_fw()
210 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
211 adapter->curr_cmd = cmd_node; in mwifiex_dnld_cmd_to_fw()
212 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
229 mwifiex_dbg(adapter, CMD, in mwifiex_dnld_cmd_to_fw()
234 mwifiex_dbg_dump(adapter, CMD_D, "cmd buffer:", host_cmd, cmd_size); in mwifiex_dnld_cmd_to_fw()
236 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_cmd_to_fw()
240 adapter->cmd_sent = true; in mwifiex_dnld_cmd_to_fw()
241 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_cmd_to_fw()
248 skb_push(cmd_node->cmd_skb, adapter->intf_hdr_len); in mwifiex_dnld_cmd_to_fw()
249 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_cmd_to_fw()
251 skb_pull(cmd_node->cmd_skb, adapter->intf_hdr_len); in mwifiex_dnld_cmd_to_fw()
255 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
257 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_dnld_cmd_to_fw()
258 adapter->cmd_sent = false; in mwifiex_dnld_cmd_to_fw()
260 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
261 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_dnld_cmd_to_fw()
263 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
264 adapter->curr_cmd = NULL; in mwifiex_dnld_cmd_to_fw()
265 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
267 adapter->dbg.num_cmd_host_to_card_failure++; in mwifiex_dnld_cmd_to_fw()
272 adapter->dbg.last_cmd_index = in mwifiex_dnld_cmd_to_fw()
273 (adapter->dbg.last_cmd_index + 1) % DBG_CMD_NUM; in mwifiex_dnld_cmd_to_fw()
274 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index] = cmd_code; in mwifiex_dnld_cmd_to_fw()
275 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] = in mwifiex_dnld_cmd_to_fw()
282 mod_timer(&adapter->cmd_timer, in mwifiex_dnld_cmd_to_fw()
300 static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) in mwifiex_dnld_sleep_confirm_cmd() argument
306 adapter->sleep_cfm->data; in mwifiex_dnld_sleep_confirm_cmd()
309 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_dnld_sleep_confirm_cmd()
311 adapter->seq_num++; in mwifiex_dnld_sleep_confirm_cmd()
314 (adapter->seq_num, priv->bss_num, in mwifiex_dnld_sleep_confirm_cmd()
317 mwifiex_dbg(adapter, CMD, in mwifiex_dnld_sleep_confirm_cmd()
323 mwifiex_dbg_dump(adapter, CMD_D, "SLEEP_CFM buffer: ", sleep_cfm_buf, in mwifiex_dnld_sleep_confirm_cmd()
326 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_sleep_confirm_cmd()
331 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_sleep_confirm_cmd()
340 adapter->sleep_cfm->data, in mwifiex_dnld_sleep_confirm_cmd()
342 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_sleep_confirm_cmd()
348 skb_push(adapter->sleep_cfm, adapter->intf_hdr_len); in mwifiex_dnld_sleep_confirm_cmd()
349 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_sleep_confirm_cmd()
350 adapter->sleep_cfm, NULL); in mwifiex_dnld_sleep_confirm_cmd()
351 skb_pull(adapter->sleep_cfm, adapter->intf_hdr_len); in mwifiex_dnld_sleep_confirm_cmd()
355 mwifiex_dbg(adapter, ERROR, "SLEEP_CFM: failed\n"); in mwifiex_dnld_sleep_confirm_cmd()
356 adapter->dbg.num_cmd_sleep_cfm_host_to_card_failure++; in mwifiex_dnld_sleep_confirm_cmd()
362 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_dnld_sleep_confirm_cmd()
364 adapter->ps_state = PS_STATE_SLEEP_CFM; in mwifiex_dnld_sleep_confirm_cmd()
367 (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags) && in mwifiex_dnld_sleep_confirm_cmd()
368 !adapter->sleep_period.period)) { in mwifiex_dnld_sleep_confirm_cmd()
369 adapter->pm_wakeup_card_req = true; in mwifiex_dnld_sleep_confirm_cmd()
371 (adapter, MWIFIEX_BSS_ROLE_ANY), true); in mwifiex_dnld_sleep_confirm_cmd()
389 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_alloc_cmd_buffer() argument
400 adapter->cmd_pool = cmd_array; in mwifiex_alloc_cmd_buffer()
406 mwifiex_dbg(adapter, ERROR, in mwifiex_alloc_cmd_buffer()
413 mwifiex_insert_cmd_to_free_q(adapter, &cmd_array[i]); in mwifiex_alloc_cmd_buffer()
424 void mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_free_cmd_buffer() argument
430 if (!adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
431 mwifiex_dbg(adapter, FATAL, in mwifiex_free_cmd_buffer()
436 cmd_array = adapter->cmd_pool; in mwifiex_free_cmd_buffer()
441 mwifiex_dbg(adapter, CMD, in mwifiex_free_cmd_buffer()
448 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_free_cmd_buffer()
449 adapter->if_ops.cmdrsp_complete(adapter, in mwifiex_free_cmd_buffer()
455 if (adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
456 mwifiex_dbg(adapter, CMD, in mwifiex_free_cmd_buffer()
458 kfree(adapter->cmd_pool); in mwifiex_free_cmd_buffer()
459 adapter->cmd_pool = NULL; in mwifiex_free_cmd_buffer()
473 int mwifiex_process_event(struct mwifiex_adapter *adapter) in mwifiex_process_event() argument
477 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
478 struct sk_buff *skb = adapter->event_skb; in mwifiex_process_event()
482 if ((adapter->event_cause & EVENT_ID_MASK) == EVENT_RADAR_DETECTED) { in mwifiex_process_event()
483 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_process_event()
484 priv = adapter->priv[i]; in mwifiex_process_event()
486 adapter->event_cause |= in mwifiex_process_event()
494 eventcause = adapter->event_cause; in mwifiex_process_event()
497 adapter->dbg.last_event_index = in mwifiex_process_event()
498 (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM; in mwifiex_process_event()
499 adapter->dbg.last_event[adapter->dbg.last_event_index] = in mwifiex_process_event()
503 priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause), in mwifiex_process_event()
506 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
510 adapter->event_cause = eventcause; in mwifiex_process_event()
517 mwifiex_dbg_dump(adapter, EVT_D, "Event Buf:", in mwifiex_process_event()
521 mwifiex_dbg(adapter, EVENT, "EVENT: cause: %#x\n", eventcause); in mwifiex_process_event()
528 adapter->event_cause = 0; in mwifiex_process_event()
529 adapter->event_skb = NULL; in mwifiex_process_event()
530 adapter->if_ops.event_complete(adapter, skb); in mwifiex_process_event()
550 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_send_cmd() local
554 if (!adapter) { in mwifiex_send_cmd()
559 if (test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { in mwifiex_send_cmd()
560 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
565 if (test_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags) && in mwifiex_send_cmd()
567 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
572 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) { in mwifiex_send_cmd()
573 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
578 if (test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { in mwifiex_send_cmd()
579 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
584 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET) { in mwifiex_send_cmd()
586 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
594 if (adapter->mfg_mode && cmd_no) { in mwifiex_send_cmd()
595 dev_dbg(adapter->dev, "Ignoring commands in manufacturing mode\n"); in mwifiex_send_cmd()
599 if (priv->adapter->hs_activated_manually && in mwifiex_send_cmd()
602 priv->adapter->hs_activated_manually = false; in mwifiex_send_cmd()
606 cmd_node = mwifiex_get_cmd_node(adapter); in mwifiex_send_cmd()
609 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
618 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
655 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
658 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_send_cmd()
667 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node); in mwifiex_send_cmd()
668 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_send_cmd()
670 ret = mwifiex_wait_queue_complete(adapter, cmd_node); in mwifiex_send_cmd()
684 mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_pending_q() argument
693 mwifiex_dbg(adapter, ERROR, "QUEUE_CMD: host_cmd is NULL\n"); in mwifiex_insert_cmd_to_pending_q()
705 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_insert_cmd_to_pending_q()
719 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_insert_cmd_to_pending_q()
721 list_add_tail(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
723 list_add(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
724 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_insert_cmd_to_pending_q()
726 atomic_inc(&adapter->cmd_pending); in mwifiex_insert_cmd_to_pending_q()
727 mwifiex_dbg(adapter, CMD, in mwifiex_insert_cmd_to_pending_q()
729 command, atomic_read(&adapter->cmd_pending)); in mwifiex_insert_cmd_to_pending_q()
743 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) in mwifiex_exec_next_cmd() argument
751 if (adapter->curr_cmd) { in mwifiex_exec_next_cmd()
752 mwifiex_dbg(adapter, FATAL, in mwifiex_exec_next_cmd()
757 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
759 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
760 if (list_empty(&adapter->cmd_pending_q)) { in mwifiex_exec_next_cmd()
761 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
762 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
765 cmd_node = list_first_entry(&adapter->cmd_pending_q, in mwifiex_exec_next_cmd()
771 if (adapter->ps_state != PS_STATE_AWAKE) { in mwifiex_exec_next_cmd()
772 mwifiex_dbg(adapter, ERROR, in mwifiex_exec_next_cmd()
775 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
776 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
781 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
783 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
785 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_exec_next_cmd()
792 if (adapter->hs_activated) { in mwifiex_exec_next_cmd()
794 &adapter->work_flags); in mwifiex_exec_next_cmd()
808 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) in mwifiex_process_cmdresp() argument
812 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
818 if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) { in mwifiex_process_cmdresp()
819 resp = (struct host_cmd_ds_command *) adapter->upld_buf; in mwifiex_process_cmdresp()
820 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
826 resp = (struct host_cmd_ds_command *)adapter->curr_cmd->resp_skb->data; in mwifiex_process_cmdresp()
830 if (adapter->curr_cmd->cmd_no != cmdresp_no) { in mwifiex_process_cmdresp()
831 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
833 adapter->curr_cmd->cmd_no, cmdresp_no); in mwifiex_process_cmdresp()
837 del_timer_sync(&adapter->cmd_timer); in mwifiex_process_cmdresp()
838 clear_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_process_cmdresp()
840 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
844 mwifiex_dbg(adapter, INFO, in mwifiex_process_cmdresp()
847 if (adapter->curr_cmd->data_buf) { in mwifiex_process_cmdresp()
848 hostcmd = adapter->curr_cmd->data_buf; in mwifiex_process_cmdresp()
855 priv = mwifiex_get_priv_by_id(adapter, in mwifiex_process_cmdresp()
859 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
867 adapter->dbg.last_cmd_resp_index = in mwifiex_process_cmdresp()
868 (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM; in mwifiex_process_cmdresp()
869 adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] = in mwifiex_process_cmdresp()
872 mwifiex_dbg(adapter, CMD, in mwifiex_process_cmdresp()
876 mwifiex_dbg_dump(adapter, CMD_D, "CMD_RESP buffer:", resp, in mwifiex_process_cmdresp()
880 mwifiex_dbg(adapter, ERROR, "CMD_RESP: invalid cmd resp\n"); in mwifiex_process_cmdresp()
881 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
882 adapter->cmd_wait_q.status = -1; in mwifiex_process_cmdresp()
884 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
885 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
886 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
887 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
891 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
892 adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; in mwifiex_process_cmdresp()
902 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_process_cmdresp()
904 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
907 mwifiex_init_fw_complete(adapter); in mwifiex_process_cmdresp()
909 } else if (adapter->last_init_cmd == cmdresp_no) in mwifiex_process_cmdresp()
910 adapter->hw_status = MWIFIEX_HW_STATUS_INIT_DONE; in mwifiex_process_cmdresp()
913 if (adapter->curr_cmd) { in mwifiex_process_cmdresp()
914 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
915 adapter->cmd_wait_q.status = ret; in mwifiex_process_cmdresp()
917 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
919 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
920 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
921 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
935 struct mwifiex_adapter *adapter = from_timer(adapter, t, cmd_timer); in mwifiex_cmd_timeout_func() local
938 set_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_cmd_timeout_func()
939 if (!adapter->curr_cmd) { in mwifiex_cmd_timeout_func()
940 mwifiex_dbg(adapter, ERROR, in mwifiex_cmd_timeout_func()
944 cmd_node = adapter->curr_cmd; in mwifiex_cmd_timeout_func()
946 adapter->dbg.timeout_cmd_id = in mwifiex_cmd_timeout_func()
947 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
948 adapter->dbg.timeout_cmd_act = in mwifiex_cmd_timeout_func()
949 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
950 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
952 adapter->dbg.timeout_cmd_id, in mwifiex_cmd_timeout_func()
953 adapter->dbg.timeout_cmd_act); in mwifiex_cmd_timeout_func()
955 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
957 adapter->dbg.num_tx_host_to_card_failure); in mwifiex_cmd_timeout_func()
958 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
960 adapter->dbg.num_cmd_host_to_card_failure); in mwifiex_cmd_timeout_func()
962 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
965 &adapter->work_flags)); in mwifiex_cmd_timeout_func()
966 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
968 adapter->dbg.num_tx_timeout); in mwifiex_cmd_timeout_func()
970 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
972 adapter->dbg.last_cmd_index); in mwifiex_cmd_timeout_func()
973 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
975 (int)sizeof(adapter->dbg.last_cmd_id), in mwifiex_cmd_timeout_func()
976 adapter->dbg.last_cmd_id); in mwifiex_cmd_timeout_func()
977 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
979 (int)sizeof(adapter->dbg.last_cmd_act), in mwifiex_cmd_timeout_func()
980 adapter->dbg.last_cmd_act); in mwifiex_cmd_timeout_func()
982 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
984 adapter->dbg.last_cmd_resp_index); in mwifiex_cmd_timeout_func()
985 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
987 (int)sizeof(adapter->dbg.last_cmd_resp_id), in mwifiex_cmd_timeout_func()
988 adapter->dbg.last_cmd_resp_id); in mwifiex_cmd_timeout_func()
990 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
992 adapter->dbg.last_event_index); in mwifiex_cmd_timeout_func()
993 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
995 (int)sizeof(adapter->dbg.last_event), in mwifiex_cmd_timeout_func()
996 adapter->dbg.last_event); in mwifiex_cmd_timeout_func()
998 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
1000 adapter->data_sent, adapter->cmd_sent); in mwifiex_cmd_timeout_func()
1002 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
1004 adapter->ps_mode, adapter->ps_state); in mwifiex_cmd_timeout_func()
1007 adapter->cmd_wait_q.status = -ETIMEDOUT; in mwifiex_cmd_timeout_func()
1008 mwifiex_cancel_pending_ioctl(adapter); in mwifiex_cmd_timeout_func()
1011 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_cmd_timeout_func()
1012 mwifiex_init_fw_complete(adapter); in mwifiex_cmd_timeout_func()
1016 if (adapter->if_ops.device_dump) in mwifiex_cmd_timeout_func()
1017 adapter->if_ops.device_dump(adapter); in mwifiex_cmd_timeout_func()
1019 if (adapter->if_ops.card_reset) in mwifiex_cmd_timeout_func()
1020 adapter->if_ops.card_reset(adapter); in mwifiex_cmd_timeout_func()
1024 mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter) in mwifiex_cancel_pending_scan_cmd() argument
1029 spin_lock_bh(&adapter->scan_pending_q_lock); in mwifiex_cancel_pending_scan_cmd()
1031 &adapter->scan_pending_q, list) { in mwifiex_cancel_pending_scan_cmd()
1034 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_cancel_pending_scan_cmd()
1036 spin_unlock_bh(&adapter->scan_pending_q_lock); in mwifiex_cancel_pending_scan_cmd()
1047 mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) in mwifiex_cancel_all_pending_cmd() argument
1051 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_all_pending_cmd()
1053 if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_all_pending_cmd()
1054 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1055 mwifiex_complete_cmd(adapter, adapter->curr_cmd); in mwifiex_cancel_all_pending_cmd()
1056 adapter->curr_cmd->wait_q_enabled = false; in mwifiex_cancel_all_pending_cmd()
1060 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_cancel_all_pending_cmd()
1062 &adapter->cmd_pending_q, list) { in mwifiex_cancel_all_pending_cmd()
1066 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1067 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_all_pending_cmd()
1069 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_cancel_all_pending_cmd()
1070 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_all_pending_cmd()
1072 mwifiex_cancel_scan(adapter); in mwifiex_cancel_all_pending_cmd()
1086 mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) in mwifiex_cancel_pending_ioctl() argument
1090 if ((adapter->curr_cmd) && in mwifiex_cancel_pending_ioctl()
1091 (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_pending_ioctl()
1092 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_pending_ioctl()
1093 cmd_node = adapter->curr_cmd; in mwifiex_cancel_pending_ioctl()
1102 adapter->curr_cmd = NULL; in mwifiex_cancel_pending_ioctl()
1103 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_pending_ioctl()
1105 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_pending_ioctl()
1108 mwifiex_cancel_scan(adapter); in mwifiex_cancel_pending_ioctl()
1121 mwifiex_check_ps_cond(struct mwifiex_adapter *adapter) in mwifiex_check_ps_cond() argument
1123 if (!adapter->cmd_sent && !atomic_read(&adapter->tx_hw_pending) && in mwifiex_check_ps_cond()
1124 !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter)) in mwifiex_check_ps_cond()
1125 mwifiex_dnld_sleep_confirm_cmd(adapter); in mwifiex_check_ps_cond()
1127 mwifiex_dbg(adapter, CMD, in mwifiex_check_ps_cond()
1129 (adapter->cmd_sent) ? "D" : "", in mwifiex_check_ps_cond()
1130 atomic_read(&adapter->tx_hw_pending) ? "T" : "", in mwifiex_check_ps_cond()
1131 (adapter->curr_cmd) ? "C" : "", in mwifiex_check_ps_cond()
1132 (IS_CARD_RX_RCVD(adapter)) ? "R" : ""); in mwifiex_check_ps_cond()
1145 &priv->adapter->work_flags)) { in mwifiex_hs_activated_event()
1146 priv->adapter->hs_activated = true; in mwifiex_hs_activated_event()
1147 mwifiex_update_rxreor_flags(priv->adapter, in mwifiex_hs_activated_event()
1149 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1151 priv->adapter->hs_activate_wait_q_woken = true; in mwifiex_hs_activated_event()
1153 &priv->adapter->hs_activate_wait_q); in mwifiex_hs_activated_event()
1155 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1159 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1161 priv->adapter->hs_activated = false; in mwifiex_hs_activated_event()
1178 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_802_11_hs_cfg() local
1184 adapter->iface_type != MWIFIEX_USB) { in mwifiex_ret_802_11_hs_cfg()
1188 mwifiex_dbg(adapter, CMD, in mwifiex_ret_802_11_hs_cfg()
1196 set_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_ret_802_11_hs_cfg()
1197 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_ret_802_11_hs_cfg()
1200 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_ret_802_11_hs_cfg()
1201 if (adapter->hs_activated) in mwifiex_ret_802_11_hs_cfg()
1213 mwifiex_process_hs_config(struct mwifiex_adapter *adapter) in mwifiex_process_hs_config() argument
1215 mwifiex_dbg(adapter, INFO, in mwifiex_process_hs_config()
1220 adapter->if_ops.wakeup(adapter); in mwifiex_process_hs_config()
1222 if (adapter->hs_activated_manually) { in mwifiex_process_hs_config()
1223 mwifiex_cancel_hs(mwifiex_get_priv (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_process_hs_config()
1225 adapter->hs_activated_manually = false; in mwifiex_process_hs_config()
1228 adapter->hs_activated = false; in mwifiex_process_hs_config()
1229 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_process_hs_config()
1230 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_process_hs_config()
1231 mwifiex_hs_activated_event(mwifiex_get_priv(adapter, in mwifiex_process_hs_config()
1243 mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter, in mwifiex_process_sleep_confirm_resp() argument
1248 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_sleep_confirm_resp()
1254 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1259 mwifiex_dbg(adapter, CMD, in mwifiex_process_sleep_confirm_resp()
1264 priv = mwifiex_get_priv_by_id(adapter, HostCmd_GET_BSS_NO(seq_num), in mwifiex_process_sleep_confirm_resp()
1267 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_sleep_confirm_resp()
1275 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1282 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1285 adapter->pm_wakeup_card_req = false; in mwifiex_process_sleep_confirm_resp()
1286 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_process_sleep_confirm_resp()
1289 adapter->pm_wakeup_card_req = true; in mwifiex_process_sleep_confirm_resp()
1290 if (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags)) in mwifiex_process_sleep_confirm_resp()
1292 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_process_sleep_confirm_resp()
1294 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_process_sleep_confirm_resp()
1340 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cmd_enh_power_mode() local
1349 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1352 cpu_to_le16(adapter->null_pkt_interval); in mwifiex_cmd_enh_power_mode()
1354 cpu_to_le16(adapter->multiple_dtim); in mwifiex_cmd_enh_power_mode()
1356 cpu_to_le16(adapter->bcn_miss_time_out); in mwifiex_cmd_enh_power_mode()
1358 cpu_to_le16(adapter->local_listen_interval); in mwifiex_cmd_enh_power_mode()
1360 cpu_to_le16(adapter->adhoc_awake_period); in mwifiex_cmd_enh_power_mode()
1362 cpu_to_le16(adapter->delay_to_ps); in mwifiex_cmd_enh_power_mode()
1363 ps_mode->mode = cpu_to_le16(adapter->enhanced_ps_mode); in mwifiex_cmd_enh_power_mode()
1380 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1400 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_enh_power_mode() local
1408 mwifiex_dbg(adapter, INFO, in mwifiex_ret_enh_power_mode()
1413 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1415 priv->adapter->is_deep_sleep = true; in mwifiex_ret_enh_power_mode()
1418 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1420 if (adapter->sleep_period.period) in mwifiex_ret_enh_power_mode()
1421 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1426 priv->adapter->is_deep_sleep = false; in mwifiex_ret_enh_power_mode()
1427 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1431 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1433 if (adapter->sleep_period.period) { in mwifiex_ret_enh_power_mode()
1434 adapter->delay_null_pkt = false; in mwifiex_ret_enh_power_mode()
1435 adapter->tx_lock_flag = false; in mwifiex_ret_enh_power_mode()
1436 adapter->pps_uapsd_mode = false; in mwifiex_ret_enh_power_mode()
1441 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; in mwifiex_ret_enh_power_mode()
1443 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_ret_enh_power_mode()
1445 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1504 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_get_hw_spec() local
1511 adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); in mwifiex_ret_get_hw_spec()
1513 if (IS_SUPPORT_MULTI_BANDS(adapter)) in mwifiex_ret_get_hw_spec()
1514 adapter->fw_bands = (u8) GET_FW_DEFAULT_BANDS(adapter); in mwifiex_ret_get_hw_spec()
1516 adapter->fw_bands = BAND_B; in mwifiex_ret_get_hw_spec()
1518 adapter->config_bands = adapter->fw_bands; in mwifiex_ret_get_hw_spec()
1520 if (adapter->fw_bands & BAND_A) { in mwifiex_ret_get_hw_spec()
1521 if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1522 adapter->config_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1523 adapter->fw_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1525 if (adapter->fw_bands & BAND_AN) { in mwifiex_ret_get_hw_spec()
1526 adapter->adhoc_start_band = BAND_A | BAND_AN; in mwifiex_ret_get_hw_spec()
1527 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1529 adapter->adhoc_start_band = BAND_A; in mwifiex_ret_get_hw_spec()
1532 } else if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1533 adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN; in mwifiex_ret_get_hw_spec()
1535 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1536 } else if (adapter->fw_bands & BAND_G) { in mwifiex_ret_get_hw_spec()
1537 adapter->adhoc_start_band = BAND_G | BAND_B; in mwifiex_ret_get_hw_spec()
1539 } else if (adapter->fw_bands & BAND_B) { in mwifiex_ret_get_hw_spec()
1540 adapter->adhoc_start_band = BAND_B; in mwifiex_ret_get_hw_spec()
1544 adapter->fw_release_number = le32_to_cpu(hw_spec->fw_release_number); in mwifiex_ret_get_hw_spec()
1545 adapter->fw_api_ver = (adapter->fw_release_number >> 16) & 0xff; in mwifiex_ret_get_hw_spec()
1546 adapter->number_of_antenna = in mwifiex_ret_get_hw_spec()
1550 adapter->is_hw_11ac_capable = true; in mwifiex_ret_get_hw_spec()
1553 adapter->hw_dot_11ac_dev_cap = in mwifiex_ret_get_hw_spec()
1555 adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1557 adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1561 adapter->hw_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1563 adapter->usr_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1564 adapter->hw_dot_11ac_mcs_support; in mwifiex_ret_get_hw_spec()
1566 adapter->is_hw_11ac_capable = false; in mwifiex_ret_get_hw_spec()
1581 adapter->key_api_major_ver = in mwifiex_ret_get_hw_spec()
1583 adapter->key_api_minor_ver = in mwifiex_ret_get_hw_spec()
1585 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1587 adapter->key_api_major_ver, in mwifiex_ret_get_hw_spec()
1588 adapter->key_api_minor_ver); in mwifiex_ret_get_hw_spec()
1591 adapter->fw_api_ver = in mwifiex_ret_get_hw_spec()
1593 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1595 adapter->fw_api_ver, in mwifiex_ret_get_hw_spec()
1599 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1605 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1611 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1616 mwifiex_dbg(adapter, FATAL, in mwifiex_ret_get_hw_spec()
1624 adapter->max_p2p_conn = max_conn->max_p2p_conn; in mwifiex_ret_get_hw_spec()
1625 adapter->max_sta_conn = max_conn->max_sta_conn; in mwifiex_ret_get_hw_spec()
1626 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1628 adapter->max_p2p_conn); in mwifiex_ret_get_hw_spec()
1629 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1631 adapter->max_sta_conn); in mwifiex_ret_get_hw_spec()
1634 mwifiex_dbg(adapter, FATAL, in mwifiex_ret_get_hw_spec()
1646 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1648 adapter->fw_release_number); in mwifiex_ret_get_hw_spec()
1649 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1652 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1657 ether_addr_copy(priv->adapter->perm_addr, hw_spec->permanent_addr); in mwifiex_ret_get_hw_spec()
1658 adapter->region_code = le16_to_cpu(hw_spec->region_code); in mwifiex_ret_get_hw_spec()
1662 if (adapter->region_code == region_code_index[i]) in mwifiex_ret_get_hw_spec()
1667 adapter->region_code = 0x00; in mwifiex_ret_get_hw_spec()
1668 mwifiex_dbg(adapter, WARN, in mwifiex_ret_get_hw_spec()
1672 adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap); in mwifiex_ret_get_hw_spec()
1673 adapter->hw_dev_mcs_support = hw_spec->dev_mcs_support; in mwifiex_ret_get_hw_spec()
1674 adapter->user_dev_mcs_support = adapter->hw_dev_mcs_support; in mwifiex_ret_get_hw_spec()
1676 if (adapter->if_ops.update_mp_end_port) in mwifiex_ret_get_hw_spec()
1677 adapter->if_ops.update_mp_end_port(adapter, in mwifiex_ret_get_hw_spec()
1680 if (adapter->fw_api_ver == MWIFIEX_FW_V15) in mwifiex_ret_get_hw_spec()
1681 adapter->scan_chan_gap_enabled = true; in mwifiex_ret_get_hw_spec()