Lines Matching full: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()
162 static int mwifiex_dnld_cmd_to_fw(struct mwifiex_adapter *adapter, in mwifiex_dnld_cmd_to_fw() argument
170 if (!adapter || !cmd_node) in mwifiex_dnld_cmd_to_fw()
177 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
181 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
182 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
190 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && in mwifiex_dnld_cmd_to_fw()
193 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
196 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
197 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_dnld_cmd_to_fw()
202 adapter->seq_num++; in mwifiex_dnld_cmd_to_fw()
204 (adapter->seq_num, in mwifiex_dnld_cmd_to_fw()
208 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
209 adapter->curr_cmd = cmd_node; in mwifiex_dnld_cmd_to_fw()
210 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
227 mwifiex_dbg(adapter, CMD, in mwifiex_dnld_cmd_to_fw()
232 mwifiex_dbg_dump(adapter, CMD_D, "cmd buffer:", host_cmd, cmd_size); in mwifiex_dnld_cmd_to_fw()
234 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_cmd_to_fw()
238 adapter->cmd_sent = true; in mwifiex_dnld_cmd_to_fw()
239 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_cmd_to_fw()
246 skb_push(cmd_node->cmd_skb, adapter->intf_hdr_len); in mwifiex_dnld_cmd_to_fw()
247 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_cmd_to_fw()
249 skb_pull(cmd_node->cmd_skb, adapter->intf_hdr_len); in mwifiex_dnld_cmd_to_fw()
253 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
255 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_dnld_cmd_to_fw()
256 adapter->cmd_sent = false; in mwifiex_dnld_cmd_to_fw()
258 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
259 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_dnld_cmd_to_fw()
261 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
262 adapter->curr_cmd = NULL; in mwifiex_dnld_cmd_to_fw()
263 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
265 adapter->dbg.num_cmd_host_to_card_failure++; in mwifiex_dnld_cmd_to_fw()
270 adapter->dbg.last_cmd_index = in mwifiex_dnld_cmd_to_fw()
271 (adapter->dbg.last_cmd_index + 1) % DBG_CMD_NUM; in mwifiex_dnld_cmd_to_fw()
272 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index] = cmd_code; in mwifiex_dnld_cmd_to_fw()
273 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] = in mwifiex_dnld_cmd_to_fw()
280 mod_timer(&adapter->cmd_timer, in mwifiex_dnld_cmd_to_fw()
298 static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) in mwifiex_dnld_sleep_confirm_cmd() argument
304 adapter->sleep_cfm->data; in mwifiex_dnld_sleep_confirm_cmd()
307 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_dnld_sleep_confirm_cmd()
309 adapter->seq_num++; in mwifiex_dnld_sleep_confirm_cmd()
312 (adapter->seq_num, priv->bss_num, in mwifiex_dnld_sleep_confirm_cmd()
315 mwifiex_dbg(adapter, CMD, in mwifiex_dnld_sleep_confirm_cmd()
321 mwifiex_dbg_dump(adapter, CMD_D, "SLEEP_CFM buffer: ", sleep_cfm_buf, in mwifiex_dnld_sleep_confirm_cmd()
324 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_sleep_confirm_cmd()
329 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_sleep_confirm_cmd()
338 adapter->sleep_cfm->data, in mwifiex_dnld_sleep_confirm_cmd()
340 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_sleep_confirm_cmd()
346 skb_push(adapter->sleep_cfm, adapter->intf_hdr_len); in mwifiex_dnld_sleep_confirm_cmd()
347 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_sleep_confirm_cmd()
348 adapter->sleep_cfm, NULL); in mwifiex_dnld_sleep_confirm_cmd()
349 skb_pull(adapter->sleep_cfm, adapter->intf_hdr_len); in mwifiex_dnld_sleep_confirm_cmd()
353 mwifiex_dbg(adapter, ERROR, "SLEEP_CFM: failed\n"); in mwifiex_dnld_sleep_confirm_cmd()
354 adapter->dbg.num_cmd_sleep_cfm_host_to_card_failure++; in mwifiex_dnld_sleep_confirm_cmd()
360 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_dnld_sleep_confirm_cmd()
362 adapter->ps_state = PS_STATE_SLEEP_CFM; in mwifiex_dnld_sleep_confirm_cmd()
365 (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags) && in mwifiex_dnld_sleep_confirm_cmd()
366 !adapter->sleep_period.period)) { in mwifiex_dnld_sleep_confirm_cmd()
367 adapter->pm_wakeup_card_req = true; in mwifiex_dnld_sleep_confirm_cmd()
368 mwifiex_hs_activated_event(adapter, true); in mwifiex_dnld_sleep_confirm_cmd()
386 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_alloc_cmd_buffer() argument
397 adapter->cmd_pool = cmd_array; in mwifiex_alloc_cmd_buffer()
403 mwifiex_dbg(adapter, ERROR, in mwifiex_alloc_cmd_buffer()
410 mwifiex_insert_cmd_to_free_q(adapter, &cmd_array[i]); in mwifiex_alloc_cmd_buffer()
421 void mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_free_cmd_buffer() argument
427 if (!adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
428 mwifiex_dbg(adapter, FATAL, in mwifiex_free_cmd_buffer()
433 cmd_array = adapter->cmd_pool; in mwifiex_free_cmd_buffer()
438 mwifiex_dbg(adapter, CMD, in mwifiex_free_cmd_buffer()
445 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_free_cmd_buffer()
446 adapter->if_ops.cmdrsp_complete(adapter, in mwifiex_free_cmd_buffer()
452 if (adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
453 mwifiex_dbg(adapter, CMD, in mwifiex_free_cmd_buffer()
455 kfree(adapter->cmd_pool); in mwifiex_free_cmd_buffer()
456 adapter->cmd_pool = NULL; in mwifiex_free_cmd_buffer()
470 int mwifiex_process_event(struct mwifiex_adapter *adapter) in mwifiex_process_event() argument
474 struct sk_buff *skb = adapter->event_skb; in mwifiex_process_event()
478 if ((adapter->event_cause & EVENT_ID_MASK) == EVENT_RADAR_DETECTED) { in mwifiex_process_event()
479 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_process_event()
480 priv = adapter->priv[i]; in mwifiex_process_event()
482 adapter->event_cause |= in mwifiex_process_event()
490 eventcause = adapter->event_cause; in mwifiex_process_event()
493 adapter->dbg.last_event_index = in mwifiex_process_event()
494 (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM; in mwifiex_process_event()
495 adapter->dbg.last_event[adapter->dbg.last_event_index] = in mwifiex_process_event()
499 priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause), in mwifiex_process_event()
502 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
506 adapter->event_cause = eventcause; in mwifiex_process_event()
513 mwifiex_dbg_dump(adapter, EVT_D, "Event Buf:", in mwifiex_process_event()
517 mwifiex_dbg(adapter, EVENT, "EVENT: cause: %#x\n", eventcause); in mwifiex_process_event()
524 adapter->event_cause = 0; in mwifiex_process_event()
525 adapter->event_skb = NULL; in mwifiex_process_event()
526 adapter->if_ops.event_complete(adapter, skb); in mwifiex_process_event()
546 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_send_cmd() local
550 if (!adapter) { in mwifiex_send_cmd()
551 pr_err("PREP_CMD: adapter is NULL\n"); in mwifiex_send_cmd()
555 if (test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { in mwifiex_send_cmd()
556 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
561 if (test_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags) && in mwifiex_send_cmd()
563 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
568 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) { in mwifiex_send_cmd()
569 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
574 if (test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { in mwifiex_send_cmd()
575 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
580 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET) { in mwifiex_send_cmd()
582 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
590 if (adapter->mfg_mode && cmd_no) { in mwifiex_send_cmd()
591 dev_dbg(adapter->dev, "Ignoring commands in manufacturing mode\n"); in mwifiex_send_cmd()
595 if (priv->adapter->hs_activated_manually && in mwifiex_send_cmd()
598 priv->adapter->hs_activated_manually = false; in mwifiex_send_cmd()
602 cmd_node = mwifiex_get_cmd_node(adapter); in mwifiex_send_cmd()
605 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
614 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
653 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
656 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_send_cmd()
665 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node); in mwifiex_send_cmd()
666 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_send_cmd()
668 ret = mwifiex_wait_queue_complete(adapter, cmd_node); in mwifiex_send_cmd()
682 mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_pending_q() argument
691 mwifiex_dbg(adapter, ERROR, "QUEUE_CMD: host_cmd is NULL\n"); in mwifiex_insert_cmd_to_pending_q()
703 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_insert_cmd_to_pending_q()
717 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_insert_cmd_to_pending_q()
719 list_add_tail(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
721 list_add(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
722 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_insert_cmd_to_pending_q()
724 atomic_inc(&adapter->cmd_pending); in mwifiex_insert_cmd_to_pending_q()
725 mwifiex_dbg(adapter, CMD, in mwifiex_insert_cmd_to_pending_q()
727 command, atomic_read(&adapter->cmd_pending)); in mwifiex_insert_cmd_to_pending_q()
741 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) in mwifiex_exec_next_cmd() argument
748 if (adapter->curr_cmd) { in mwifiex_exec_next_cmd()
749 mwifiex_dbg(adapter, FATAL, in mwifiex_exec_next_cmd()
754 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
756 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
757 if (list_empty(&adapter->cmd_pending_q)) { in mwifiex_exec_next_cmd()
758 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
759 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
762 cmd_node = list_first_entry(&adapter->cmd_pending_q, in mwifiex_exec_next_cmd()
767 if (adapter->ps_state != PS_STATE_AWAKE) { in mwifiex_exec_next_cmd()
768 mwifiex_dbg(adapter, ERROR, in mwifiex_exec_next_cmd()
771 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
772 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
777 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
779 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
780 ret = mwifiex_dnld_cmd_to_fw(adapter, cmd_node); in mwifiex_exec_next_cmd()
787 if (adapter->hs_activated) { in mwifiex_exec_next_cmd()
789 &adapter->work_flags); in mwifiex_exec_next_cmd()
790 mwifiex_hs_activated_event(adapter, false); in mwifiex_exec_next_cmd()
803 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) in mwifiex_process_cmdresp() argument
812 if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) { in mwifiex_process_cmdresp()
813 resp = (struct host_cmd_ds_command *) adapter->upld_buf; in mwifiex_process_cmdresp()
814 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
820 resp = (struct host_cmd_ds_command *)adapter->curr_cmd->resp_skb->data; in mwifiex_process_cmdresp()
824 if (adapter->curr_cmd->cmd_no != cmdresp_no) { in mwifiex_process_cmdresp()
825 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
827 adapter->curr_cmd->cmd_no, cmdresp_no); in mwifiex_process_cmdresp()
831 timer_delete_sync(&adapter->cmd_timer); in mwifiex_process_cmdresp()
832 clear_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_process_cmdresp()
834 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
838 mwifiex_dbg(adapter, INFO, in mwifiex_process_cmdresp()
841 if (adapter->curr_cmd->data_buf) { in mwifiex_process_cmdresp()
842 hostcmd = adapter->curr_cmd->data_buf; in mwifiex_process_cmdresp()
849 priv = mwifiex_get_priv_by_id(adapter, in mwifiex_process_cmdresp()
853 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
861 adapter->dbg.last_cmd_resp_index = in mwifiex_process_cmdresp()
862 (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM; in mwifiex_process_cmdresp()
863 adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] = in mwifiex_process_cmdresp()
866 mwifiex_dbg(adapter, CMD, in mwifiex_process_cmdresp()
870 mwifiex_dbg_dump(adapter, CMD_D, "CMD_RESP buffer:", resp, in mwifiex_process_cmdresp()
874 mwifiex_dbg(adapter, ERROR, "CMD_RESP: invalid cmd resp\n"); in mwifiex_process_cmdresp()
875 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
876 adapter->cmd_wait_q.status = -1; in mwifiex_process_cmdresp()
878 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
879 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
880 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
881 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
885 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
886 adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; in mwifiex_process_cmdresp()
895 if (adapter->curr_cmd) { in mwifiex_process_cmdresp()
896 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
897 adapter->cmd_wait_q.status = ret; in mwifiex_process_cmdresp()
899 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
901 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
902 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
903 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
909 void mwifiex_process_assoc_resp(struct mwifiex_adapter *adapter) in mwifiex_process_assoc_resp() argument
915 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); in mwifiex_process_assoc_resp()
937 struct mwifiex_adapter *adapter = timer_container_of(adapter, t, in mwifiex_cmd_timeout_func() local
941 set_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_cmd_timeout_func()
942 if (!adapter->curr_cmd) { in mwifiex_cmd_timeout_func()
943 mwifiex_dbg(adapter, ERROR, in mwifiex_cmd_timeout_func()
947 cmd_node = adapter->curr_cmd; in mwifiex_cmd_timeout_func()
949 adapter->dbg.timeout_cmd_id = in mwifiex_cmd_timeout_func()
950 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
951 adapter->dbg.timeout_cmd_act = in mwifiex_cmd_timeout_func()
952 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
953 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
955 adapter->dbg.timeout_cmd_id, in mwifiex_cmd_timeout_func()
956 adapter->dbg.timeout_cmd_act); in mwifiex_cmd_timeout_func()
958 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
960 adapter->dbg.num_tx_host_to_card_failure); in mwifiex_cmd_timeout_func()
961 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
963 adapter->dbg.num_cmd_host_to_card_failure); in mwifiex_cmd_timeout_func()
965 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
968 &adapter->work_flags)); in mwifiex_cmd_timeout_func()
969 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
971 adapter->dbg.num_tx_timeout); in mwifiex_cmd_timeout_func()
973 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
975 adapter->dbg.last_cmd_index); in mwifiex_cmd_timeout_func()
976 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
978 (int)sizeof(adapter->dbg.last_cmd_id), in mwifiex_cmd_timeout_func()
979 adapter->dbg.last_cmd_id); in mwifiex_cmd_timeout_func()
980 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
982 (int)sizeof(adapter->dbg.last_cmd_act), in mwifiex_cmd_timeout_func()
983 adapter->dbg.last_cmd_act); in mwifiex_cmd_timeout_func()
985 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
987 adapter->dbg.last_cmd_resp_index); in mwifiex_cmd_timeout_func()
988 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
990 (int)sizeof(adapter->dbg.last_cmd_resp_id), in mwifiex_cmd_timeout_func()
991 adapter->dbg.last_cmd_resp_id); in mwifiex_cmd_timeout_func()
993 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
995 adapter->dbg.last_event_index); in mwifiex_cmd_timeout_func()
996 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
998 (int)sizeof(adapter->dbg.last_event), in mwifiex_cmd_timeout_func()
999 adapter->dbg.last_event); in mwifiex_cmd_timeout_func()
1001 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
1003 adapter->data_sent, adapter->cmd_sent); in mwifiex_cmd_timeout_func()
1005 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
1007 adapter->ps_mode, adapter->ps_state); in mwifiex_cmd_timeout_func()
1010 adapter->cmd_wait_q.status = -ETIMEDOUT; in mwifiex_cmd_timeout_func()
1011 mwifiex_cancel_pending_ioctl(adapter); in mwifiex_cmd_timeout_func()
1015 if (adapter->if_ops.device_dump) in mwifiex_cmd_timeout_func()
1016 adapter->if_ops.device_dump(adapter); in mwifiex_cmd_timeout_func()
1018 if (adapter->if_ops.card_reset) in mwifiex_cmd_timeout_func()
1019 adapter->if_ops.card_reset(adapter); in mwifiex_cmd_timeout_func()
1023 mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter) in mwifiex_cancel_pending_scan_cmd() argument
1028 spin_lock_bh(&adapter->scan_pending_q_lock); in mwifiex_cancel_pending_scan_cmd()
1030 &adapter->scan_pending_q, list) { in mwifiex_cancel_pending_scan_cmd()
1033 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_cancel_pending_scan_cmd()
1035 spin_unlock_bh(&adapter->scan_pending_q_lock); in mwifiex_cancel_pending_scan_cmd()
1046 mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) in mwifiex_cancel_all_pending_cmd() argument
1050 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_all_pending_cmd()
1052 if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_all_pending_cmd()
1053 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1054 mwifiex_complete_cmd(adapter, adapter->curr_cmd); in mwifiex_cancel_all_pending_cmd()
1055 adapter->curr_cmd->wait_q_enabled = false; in mwifiex_cancel_all_pending_cmd()
1059 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_cancel_all_pending_cmd()
1061 &adapter->cmd_pending_q, list) { in mwifiex_cancel_all_pending_cmd()
1065 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1066 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_all_pending_cmd()
1068 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_cancel_all_pending_cmd()
1069 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_all_pending_cmd()
1071 mwifiex_cancel_scan(adapter); in mwifiex_cancel_all_pending_cmd()
1085 mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) in mwifiex_cancel_pending_ioctl() argument
1089 if ((adapter->curr_cmd) && in mwifiex_cancel_pending_ioctl()
1090 (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_pending_ioctl()
1091 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_pending_ioctl()
1092 cmd_node = adapter->curr_cmd; in mwifiex_cancel_pending_ioctl()
1101 adapter->curr_cmd = NULL; in mwifiex_cancel_pending_ioctl()
1102 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_pending_ioctl()
1104 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_pending_ioctl()
1107 mwifiex_cancel_scan(adapter); in mwifiex_cancel_pending_ioctl()
1120 mwifiex_check_ps_cond(struct mwifiex_adapter *adapter) in mwifiex_check_ps_cond() argument
1122 if (!adapter->cmd_sent && !atomic_read(&adapter->tx_hw_pending) && in mwifiex_check_ps_cond()
1123 !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter)) in mwifiex_check_ps_cond()
1124 mwifiex_dnld_sleep_confirm_cmd(adapter); in mwifiex_check_ps_cond()
1126 mwifiex_dbg(adapter, CMD, in mwifiex_check_ps_cond()
1128 (adapter->cmd_sent) ? "D" : "", in mwifiex_check_ps_cond()
1129 atomic_read(&adapter->tx_hw_pending) ? "T" : "", in mwifiex_check_ps_cond()
1130 (adapter->curr_cmd) ? "C" : "", in mwifiex_check_ps_cond()
1131 (IS_CARD_RX_RCVD(adapter)) ? "R" : ""); in mwifiex_check_ps_cond()
1140 mwifiex_hs_activated_event(struct mwifiex_adapter *adapter, u8 activated) in mwifiex_hs_activated_event() argument
1144 &adapter->work_flags)) { in mwifiex_hs_activated_event()
1145 adapter->hs_activated = true; in mwifiex_hs_activated_event()
1146 mwifiex_update_rxreor_flags(adapter, in mwifiex_hs_activated_event()
1148 mwifiex_dbg(adapter, EVENT, in mwifiex_hs_activated_event()
1150 adapter->hs_activate_wait_q_woken = true; in mwifiex_hs_activated_event()
1152 &adapter->hs_activate_wait_q); in mwifiex_hs_activated_event()
1154 mwifiex_dbg(adapter, EVENT, in mwifiex_hs_activated_event()
1158 mwifiex_dbg(adapter, EVENT, in mwifiex_hs_activated_event()
1160 adapter->hs_activated = false; in mwifiex_hs_activated_event()
1177 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_802_11_hs_cfg() local
1183 adapter->iface_type != MWIFIEX_USB) { in mwifiex_ret_802_11_hs_cfg()
1184 mwifiex_hs_activated_event(adapter, true); in mwifiex_ret_802_11_hs_cfg()
1187 mwifiex_dbg(adapter, CMD, in mwifiex_ret_802_11_hs_cfg()
1195 set_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_ret_802_11_hs_cfg()
1196 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_ret_802_11_hs_cfg()
1197 mwifiex_hs_activated_event(adapter, true); in mwifiex_ret_802_11_hs_cfg()
1199 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_ret_802_11_hs_cfg()
1200 if (adapter->hs_activated) in mwifiex_ret_802_11_hs_cfg()
1201 mwifiex_hs_activated_event(adapter, false); in mwifiex_ret_802_11_hs_cfg()
1208 * This function wakes up the adapter and generates a Host Sleep
1212 mwifiex_process_hs_config(struct mwifiex_adapter *adapter) in mwifiex_process_hs_config() argument
1214 mwifiex_dbg(adapter, INFO, in mwifiex_process_hs_config()
1219 adapter->if_ops.wakeup(adapter); in mwifiex_process_hs_config()
1221 if (adapter->hs_activated_manually) { in mwifiex_process_hs_config()
1222 mwifiex_cancel_hs(mwifiex_get_priv (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_process_hs_config()
1224 adapter->hs_activated_manually = false; in mwifiex_process_hs_config()
1227 adapter->hs_activated = false; in mwifiex_process_hs_config()
1228 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_process_hs_config()
1229 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_process_hs_config()
1230 mwifiex_hs_activated_event(adapter, false); in mwifiex_process_hs_config()
1240 mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter, in mwifiex_process_sleep_confirm_resp() argument
1249 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1254 mwifiex_dbg(adapter, CMD, in mwifiex_process_sleep_confirm_resp()
1264 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1271 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1274 adapter->pm_wakeup_card_req = false; in mwifiex_process_sleep_confirm_resp()
1275 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_process_sleep_confirm_resp()
1278 adapter->pm_wakeup_card_req = true; in mwifiex_process_sleep_confirm_resp()
1279 if (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags)) in mwifiex_process_sleep_confirm_resp()
1280 mwifiex_hs_activated_event(adapter, true); in mwifiex_process_sleep_confirm_resp()
1281 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_process_sleep_confirm_resp()
1327 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cmd_enh_power_mode() local
1336 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1339 cpu_to_le16(adapter->null_pkt_interval); in mwifiex_cmd_enh_power_mode()
1341 cpu_to_le16(adapter->multiple_dtim); in mwifiex_cmd_enh_power_mode()
1343 cpu_to_le16(adapter->bcn_miss_time_out); in mwifiex_cmd_enh_power_mode()
1345 cpu_to_le16(adapter->local_listen_interval); in mwifiex_cmd_enh_power_mode()
1347 cpu_to_le16(adapter->adhoc_awake_period); in mwifiex_cmd_enh_power_mode()
1349 cpu_to_le16(adapter->delay_to_ps); in mwifiex_cmd_enh_power_mode()
1350 ps_mode->mode = cpu_to_le16(adapter->enhanced_ps_mode); in mwifiex_cmd_enh_power_mode()
1367 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1387 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_enh_power_mode() local
1395 mwifiex_dbg(adapter, INFO, in mwifiex_ret_enh_power_mode()
1400 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1402 priv->adapter->is_deep_sleep = true; in mwifiex_ret_enh_power_mode()
1405 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1407 if (adapter->sleep_period.period) in mwifiex_ret_enh_power_mode()
1408 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1413 priv->adapter->is_deep_sleep = false; in mwifiex_ret_enh_power_mode()
1414 mwifiex_dbg(adapter, CMD, 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 adapter->delay_null_pkt = false; in mwifiex_ret_enh_power_mode()
1422 adapter->tx_lock_flag = false; in mwifiex_ret_enh_power_mode()
1423 adapter->pps_uapsd_mode = false; in mwifiex_ret_enh_power_mode()
1428 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; in mwifiex_ret_enh_power_mode()
1430 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_ret_enh_power_mode()
1432 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1491 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_get_hw_spec() local
1498 adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); in mwifiex_ret_get_hw_spec()
1500 if (IS_SUPPORT_MULTI_BANDS(adapter)) in mwifiex_ret_get_hw_spec()
1501 adapter->fw_bands = (u8) GET_FW_DEFAULT_BANDS(adapter); in mwifiex_ret_get_hw_spec()
1503 adapter->fw_bands = BAND_B; in mwifiex_ret_get_hw_spec()
1505 adapter->config_bands = adapter->fw_bands; in mwifiex_ret_get_hw_spec()
1507 if (adapter->fw_bands & BAND_A) { in mwifiex_ret_get_hw_spec()
1508 if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1509 adapter->config_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1510 adapter->fw_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1512 if (adapter->fw_bands & BAND_AN) { in mwifiex_ret_get_hw_spec()
1513 adapter->adhoc_start_band = BAND_A | BAND_AN; in mwifiex_ret_get_hw_spec()
1514 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1516 adapter->adhoc_start_band = BAND_A; in mwifiex_ret_get_hw_spec()
1519 } else if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1520 adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN; in mwifiex_ret_get_hw_spec()
1522 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1523 } else if (adapter->fw_bands & BAND_G) { in mwifiex_ret_get_hw_spec()
1524 adapter->adhoc_start_band = BAND_G | BAND_B; in mwifiex_ret_get_hw_spec()
1526 } else if (adapter->fw_bands & BAND_B) { in mwifiex_ret_get_hw_spec()
1527 adapter->adhoc_start_band = BAND_B; in mwifiex_ret_get_hw_spec()
1531 adapter->fw_release_number = le32_to_cpu(hw_spec->fw_release_number); in mwifiex_ret_get_hw_spec()
1532 adapter->fw_api_ver = (adapter->fw_release_number >> 16) & 0xff; in mwifiex_ret_get_hw_spec()
1533 adapter->number_of_antenna = in mwifiex_ret_get_hw_spec()
1537 adapter->is_hw_11ac_capable = true; in mwifiex_ret_get_hw_spec()
1540 adapter->hw_dot_11ac_dev_cap = in mwifiex_ret_get_hw_spec()
1542 adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1544 adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1548 adapter->hw_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1550 adapter->usr_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1551 adapter->hw_dot_11ac_mcs_support; in mwifiex_ret_get_hw_spec()
1553 adapter->is_hw_11ac_capable = false; in mwifiex_ret_get_hw_spec()
1568 adapter->key_api_major_ver = in mwifiex_ret_get_hw_spec()
1570 adapter->key_api_minor_ver = in mwifiex_ret_get_hw_spec()
1572 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1574 adapter->key_api_major_ver, in mwifiex_ret_get_hw_spec()
1575 adapter->key_api_minor_ver); in mwifiex_ret_get_hw_spec()
1578 adapter->fw_api_ver = in mwifiex_ret_get_hw_spec()
1580 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1582 adapter->fw_api_ver, in mwifiex_ret_get_hw_spec()
1586 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1592 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1598 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1603 mwifiex_dbg(adapter, FATAL, in mwifiex_ret_get_hw_spec()
1611 adapter->max_p2p_conn = max_conn->max_p2p_conn; in mwifiex_ret_get_hw_spec()
1612 adapter->max_sta_conn = max_conn->max_sta_conn; in mwifiex_ret_get_hw_spec()
1613 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1615 adapter->max_p2p_conn); in mwifiex_ret_get_hw_spec()
1616 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1618 adapter->max_sta_conn); in mwifiex_ret_get_hw_spec()
1621 mwifiex_dbg(adapter, FATAL, in mwifiex_ret_get_hw_spec()
1633 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1635 adapter->fw_release_number); in mwifiex_ret_get_hw_spec()
1636 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1639 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1644 ether_addr_copy(priv->adapter->perm_addr, hw_spec->permanent_addr); in mwifiex_ret_get_hw_spec()
1645 adapter->region_code = le16_to_cpu(hw_spec->region_code); in mwifiex_ret_get_hw_spec()
1649 if (adapter->region_code == region_code_index[i]) in mwifiex_ret_get_hw_spec()
1654 adapter->region_code = 0x00; in mwifiex_ret_get_hw_spec()
1655 mwifiex_dbg(adapter, WARN, in mwifiex_ret_get_hw_spec()
1659 adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap); in mwifiex_ret_get_hw_spec()
1660 adapter->hw_dev_mcs_support = hw_spec->dev_mcs_support; in mwifiex_ret_get_hw_spec()
1661 adapter->user_dev_mcs_support = adapter->hw_dev_mcs_support; in mwifiex_ret_get_hw_spec()
1663 if (adapter->if_ops.update_mp_end_port) in mwifiex_ret_get_hw_spec()
1664 adapter->if_ops.update_mp_end_port(adapter, in mwifiex_ret_get_hw_spec()
1667 if (adapter->fw_api_ver == MWIFIEX_FW_V15) in mwifiex_ret_get_hw_spec()
1668 adapter->scan_chan_gap_enabled = true; in mwifiex_ret_get_hw_spec()
1670 if (adapter->key_api_major_ver != KEY_API_VER_MAJOR_V2) in mwifiex_ret_get_hw_spec()
1671 adapter->host_mlme_enabled = false; in mwifiex_ret_get_hw_spec()
1673 mwifiex_dbg(adapter, MSG, "host_mlme: %s, key_api: %d\n", in mwifiex_ret_get_hw_spec()
1674 adapter->host_mlme_enabled ? "enable" : "disable", in mwifiex_ret_get_hw_spec()
1675 adapter->key_api_major_ver); in mwifiex_ret_get_hw_spec()