Lines Matching refs:adapter

29 static void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
61 mwifiex_get_cmd_node(struct mwifiex_adapter *adapter) in mwifiex_get_cmd_node() argument
65 spin_lock_bh(&adapter->cmd_free_q_lock); in mwifiex_get_cmd_node()
66 if (list_empty(&adapter->cmd_free_q)) { in mwifiex_get_cmd_node()
67 mwifiex_dbg(adapter, ERROR, in mwifiex_get_cmd_node()
69 spin_unlock_bh(&adapter->cmd_free_q_lock); in mwifiex_get_cmd_node()
72 cmd_node = list_first_entry(&adapter->cmd_free_q, in mwifiex_get_cmd_node()
75 spin_unlock_bh(&adapter->cmd_free_q_lock); in mwifiex_get_cmd_node()
92 mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter, in mwifiex_clean_cmd_node() argument
104 adapter->if_ops.cmdrsp_complete(adapter, cmd_node->resp_skb); in mwifiex_clean_cmd_node()
116 mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_free_q() argument
123 mwifiex_complete_cmd(adapter, cmd_node); in mwifiex_insert_cmd_to_free_q()
125 mwifiex_clean_cmd_node(adapter, cmd_node); in mwifiex_insert_cmd_to_free_q()
128 spin_lock_bh(&adapter->cmd_free_q_lock); in mwifiex_insert_cmd_to_free_q()
129 list_add_tail(&cmd_node->list, &adapter->cmd_free_q); in mwifiex_insert_cmd_to_free_q()
130 spin_unlock_bh(&adapter->cmd_free_q_lock); in mwifiex_insert_cmd_to_free_q()
134 void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, in mwifiex_recycle_cmd_node() argument
139 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_recycle_cmd_node()
141 atomic_dec(&adapter->cmd_pending); in mwifiex_recycle_cmd_node()
142 mwifiex_dbg(adapter, CMD, in mwifiex_recycle_cmd_node()
145 atomic_read(&adapter->cmd_pending)); in mwifiex_recycle_cmd_node()
161 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_host_cmd()
178 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_dnld_cmd_to_fw() local
184 if (!adapter || !cmd_node) in mwifiex_dnld_cmd_to_fw()
191 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
195 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
196 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
204 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && in mwifiex_dnld_cmd_to_fw()
207 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
210 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_dnld_cmd_to_fw()
211 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_dnld_cmd_to_fw()
216 adapter->seq_num++; in mwifiex_dnld_cmd_to_fw()
218 (adapter->seq_num, in mwifiex_dnld_cmd_to_fw()
222 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
223 adapter->curr_cmd = cmd_node; in mwifiex_dnld_cmd_to_fw()
224 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
241 mwifiex_dbg(adapter, CMD, in mwifiex_dnld_cmd_to_fw()
246 mwifiex_dbg_dump(adapter, CMD_D, "cmd buffer:", host_cmd, cmd_size); in mwifiex_dnld_cmd_to_fw()
248 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_cmd_to_fw()
252 adapter->cmd_sent = true; in mwifiex_dnld_cmd_to_fw()
253 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_cmd_to_fw()
260 skb_push(cmd_node->cmd_skb, adapter->intf_hdr_len); in mwifiex_dnld_cmd_to_fw()
261 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_cmd_to_fw()
263 skb_pull(cmd_node->cmd_skb, adapter->intf_hdr_len); in mwifiex_dnld_cmd_to_fw()
267 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_cmd_to_fw()
269 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_dnld_cmd_to_fw()
270 adapter->cmd_sent = false; in mwifiex_dnld_cmd_to_fw()
272 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
273 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_dnld_cmd_to_fw()
275 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
276 adapter->curr_cmd = NULL; in mwifiex_dnld_cmd_to_fw()
277 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_dnld_cmd_to_fw()
279 adapter->dbg.num_cmd_host_to_card_failure++; in mwifiex_dnld_cmd_to_fw()
284 adapter->dbg.last_cmd_index = in mwifiex_dnld_cmd_to_fw()
285 (adapter->dbg.last_cmd_index + 1) % DBG_CMD_NUM; in mwifiex_dnld_cmd_to_fw()
286 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index] = cmd_code; in mwifiex_dnld_cmd_to_fw()
287 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] = in mwifiex_dnld_cmd_to_fw()
294 mod_timer(&adapter->cmd_timer, in mwifiex_dnld_cmd_to_fw()
312 static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) in mwifiex_dnld_sleep_confirm_cmd() argument
318 adapter->sleep_cfm->data; in mwifiex_dnld_sleep_confirm_cmd()
321 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_dnld_sleep_confirm_cmd()
323 adapter->seq_num++; in mwifiex_dnld_sleep_confirm_cmd()
326 (adapter->seq_num, priv->bss_num, in mwifiex_dnld_sleep_confirm_cmd()
329 mwifiex_dbg(adapter, CMD, in mwifiex_dnld_sleep_confirm_cmd()
335 mwifiex_dbg_dump(adapter, CMD_D, "SLEEP_CFM buffer: ", sleep_cfm_buf, in mwifiex_dnld_sleep_confirm_cmd()
338 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_sleep_confirm_cmd()
343 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_sleep_confirm_cmd()
352 adapter->sleep_cfm->data, in mwifiex_dnld_sleep_confirm_cmd()
354 ret = adapter->if_ops.host_to_card(adapter, in mwifiex_dnld_sleep_confirm_cmd()
360 skb_push(adapter->sleep_cfm, adapter->intf_hdr_len); in mwifiex_dnld_sleep_confirm_cmd()
361 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, in mwifiex_dnld_sleep_confirm_cmd()
362 adapter->sleep_cfm, NULL); in mwifiex_dnld_sleep_confirm_cmd()
363 skb_pull(adapter->sleep_cfm, adapter->intf_hdr_len); in mwifiex_dnld_sleep_confirm_cmd()
367 mwifiex_dbg(adapter, ERROR, "SLEEP_CFM: failed\n"); in mwifiex_dnld_sleep_confirm_cmd()
368 adapter->dbg.num_cmd_sleep_cfm_host_to_card_failure++; in mwifiex_dnld_sleep_confirm_cmd()
374 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_dnld_sleep_confirm_cmd()
376 adapter->ps_state = PS_STATE_SLEEP_CFM; in mwifiex_dnld_sleep_confirm_cmd()
379 (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags) && in mwifiex_dnld_sleep_confirm_cmd()
380 !adapter->sleep_period.period)) { in mwifiex_dnld_sleep_confirm_cmd()
381 adapter->pm_wakeup_card_req = true; in mwifiex_dnld_sleep_confirm_cmd()
383 (adapter, MWIFIEX_BSS_ROLE_ANY), true); in mwifiex_dnld_sleep_confirm_cmd()
401 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_alloc_cmd_buffer() argument
412 adapter->cmd_pool = cmd_array; in mwifiex_alloc_cmd_buffer()
418 mwifiex_dbg(adapter, ERROR, in mwifiex_alloc_cmd_buffer()
425 mwifiex_insert_cmd_to_free_q(adapter, &cmd_array[i]); in mwifiex_alloc_cmd_buffer()
436 void mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) in mwifiex_free_cmd_buffer() argument
442 if (!adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
443 mwifiex_dbg(adapter, FATAL, in mwifiex_free_cmd_buffer()
448 cmd_array = adapter->cmd_pool; in mwifiex_free_cmd_buffer()
453 mwifiex_dbg(adapter, CMD, in mwifiex_free_cmd_buffer()
460 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_free_cmd_buffer()
461 adapter->if_ops.cmdrsp_complete(adapter, in mwifiex_free_cmd_buffer()
467 if (adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
468 mwifiex_dbg(adapter, CMD, in mwifiex_free_cmd_buffer()
470 kfree(adapter->cmd_pool); in mwifiex_free_cmd_buffer()
471 adapter->cmd_pool = NULL; in mwifiex_free_cmd_buffer()
485 int mwifiex_process_event(struct mwifiex_adapter *adapter) in mwifiex_process_event() argument
489 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
490 struct sk_buff *skb = adapter->event_skb; in mwifiex_process_event()
494 if ((adapter->event_cause & EVENT_ID_MASK) == EVENT_RADAR_DETECTED) { in mwifiex_process_event()
495 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_process_event()
496 priv = adapter->priv[i]; in mwifiex_process_event()
498 adapter->event_cause |= in mwifiex_process_event()
506 eventcause = adapter->event_cause; in mwifiex_process_event()
509 adapter->dbg.last_event_index = in mwifiex_process_event()
510 (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM; in mwifiex_process_event()
511 adapter->dbg.last_event[adapter->dbg.last_event_index] = in mwifiex_process_event()
515 priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause), in mwifiex_process_event()
518 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_event()
522 adapter->event_cause = eventcause; in mwifiex_process_event()
529 mwifiex_dbg_dump(adapter, EVT_D, "Event Buf:", in mwifiex_process_event()
533 mwifiex_dbg(adapter, EVENT, "EVENT: cause: %#x\n", eventcause); in mwifiex_process_event()
540 adapter->event_cause = 0; in mwifiex_process_event()
541 adapter->event_skb = NULL; in mwifiex_process_event()
542 adapter->if_ops.event_complete(adapter, skb); in mwifiex_process_event()
562 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_send_cmd() local
566 if (!adapter) { in mwifiex_send_cmd()
571 if (test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { in mwifiex_send_cmd()
572 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
577 if (test_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags) && in mwifiex_send_cmd()
579 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
584 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) { in mwifiex_send_cmd()
585 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
590 if (test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { in mwifiex_send_cmd()
591 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
596 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET) { in mwifiex_send_cmd()
598 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
606 if (adapter->mfg_mode && cmd_no) { in mwifiex_send_cmd()
607 dev_dbg(adapter->dev, "Ignoring commands in manufacturing mode\n"); in mwifiex_send_cmd()
611 if (priv->adapter->hs_activated_manually && in mwifiex_send_cmd()
614 priv->adapter->hs_activated_manually = false; in mwifiex_send_cmd()
618 cmd_node = mwifiex_get_cmd_node(adapter); in mwifiex_send_cmd()
621 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
630 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
667 mwifiex_dbg(adapter, ERROR, in mwifiex_send_cmd()
670 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_send_cmd()
679 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node); in mwifiex_send_cmd()
680 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_send_cmd()
682 ret = mwifiex_wait_queue_complete(adapter, cmd_node); in mwifiex_send_cmd()
696 mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, in mwifiex_insert_cmd_to_pending_q() argument
705 mwifiex_dbg(adapter, ERROR, "QUEUE_CMD: host_cmd is NULL\n"); in mwifiex_insert_cmd_to_pending_q()
717 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_insert_cmd_to_pending_q()
731 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_insert_cmd_to_pending_q()
733 list_add_tail(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
735 list_add(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
736 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_insert_cmd_to_pending_q()
738 atomic_inc(&adapter->cmd_pending); in mwifiex_insert_cmd_to_pending_q()
739 mwifiex_dbg(adapter, CMD, in mwifiex_insert_cmd_to_pending_q()
741 command, atomic_read(&adapter->cmd_pending)); in mwifiex_insert_cmd_to_pending_q()
755 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) in mwifiex_exec_next_cmd() argument
763 if (adapter->curr_cmd) { in mwifiex_exec_next_cmd()
764 mwifiex_dbg(adapter, FATAL, in mwifiex_exec_next_cmd()
769 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
771 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
772 if (list_empty(&adapter->cmd_pending_q)) { in mwifiex_exec_next_cmd()
773 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
774 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
777 cmd_node = list_first_entry(&adapter->cmd_pending_q, in mwifiex_exec_next_cmd()
783 if (adapter->ps_state != PS_STATE_AWAKE) { in mwifiex_exec_next_cmd()
784 mwifiex_dbg(adapter, ERROR, in mwifiex_exec_next_cmd()
787 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
788 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
793 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
795 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
797 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_exec_next_cmd()
804 if (adapter->hs_activated) { in mwifiex_exec_next_cmd()
806 &adapter->work_flags); in mwifiex_exec_next_cmd()
820 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) in mwifiex_process_cmdresp() argument
824 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
830 if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) { in mwifiex_process_cmdresp()
831 resp = (struct host_cmd_ds_command *) adapter->upld_buf; in mwifiex_process_cmdresp()
832 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
838 resp = (struct host_cmd_ds_command *)adapter->curr_cmd->resp_skb->data; in mwifiex_process_cmdresp()
842 if (adapter->curr_cmd->cmd_no != cmdresp_no) { in mwifiex_process_cmdresp()
843 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
845 adapter->curr_cmd->cmd_no, cmdresp_no); in mwifiex_process_cmdresp()
849 del_timer_sync(&adapter->cmd_timer); in mwifiex_process_cmdresp()
850 clear_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_process_cmdresp()
852 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
856 mwifiex_dbg(adapter, INFO, in mwifiex_process_cmdresp()
859 if (adapter->curr_cmd->data_buf) { in mwifiex_process_cmdresp()
860 hostcmd = adapter->curr_cmd->data_buf; in mwifiex_process_cmdresp()
867 priv = mwifiex_get_priv_by_id(adapter, in mwifiex_process_cmdresp()
871 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_cmdresp()
879 adapter->dbg.last_cmd_resp_index = in mwifiex_process_cmdresp()
880 (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM; in mwifiex_process_cmdresp()
881 adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] = in mwifiex_process_cmdresp()
884 mwifiex_dbg(adapter, CMD, in mwifiex_process_cmdresp()
888 mwifiex_dbg_dump(adapter, CMD_D, "CMD_RESP buffer:", resp, in mwifiex_process_cmdresp()
892 mwifiex_dbg(adapter, ERROR, "CMD_RESP: invalid cmd resp\n"); in mwifiex_process_cmdresp()
893 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
894 adapter->cmd_wait_q.status = -1; in mwifiex_process_cmdresp()
896 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
897 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
898 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
899 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
903 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
904 adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; in mwifiex_process_cmdresp()
914 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_process_cmdresp()
916 mwifiex_dbg(adapter, ERROR, in mwifiex_process_cmdresp()
919 mwifiex_init_fw_complete(adapter); in mwifiex_process_cmdresp()
921 } else if (adapter->last_init_cmd == cmdresp_no) in mwifiex_process_cmdresp()
922 adapter->hw_status = MWIFIEX_HW_STATUS_INIT_DONE; in mwifiex_process_cmdresp()
925 if (adapter->curr_cmd) { in mwifiex_process_cmdresp()
926 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
927 adapter->cmd_wait_q.status = ret; in mwifiex_process_cmdresp()
929 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
931 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
932 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
933 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
947 struct mwifiex_adapter *adapter = from_timer(adapter, t, cmd_timer); in mwifiex_cmd_timeout_func() local
950 set_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_cmd_timeout_func()
951 if (!adapter->curr_cmd) { in mwifiex_cmd_timeout_func()
952 mwifiex_dbg(adapter, ERROR, in mwifiex_cmd_timeout_func()
956 cmd_node = adapter->curr_cmd; in mwifiex_cmd_timeout_func()
958 adapter->dbg.timeout_cmd_id = in mwifiex_cmd_timeout_func()
959 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
960 adapter->dbg.timeout_cmd_act = in mwifiex_cmd_timeout_func()
961 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
962 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
964 adapter->dbg.timeout_cmd_id, in mwifiex_cmd_timeout_func()
965 adapter->dbg.timeout_cmd_act); in mwifiex_cmd_timeout_func()
967 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
969 adapter->dbg.num_tx_host_to_card_failure); in mwifiex_cmd_timeout_func()
970 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
972 adapter->dbg.num_cmd_host_to_card_failure); in mwifiex_cmd_timeout_func()
974 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
977 &adapter->work_flags)); in mwifiex_cmd_timeout_func()
978 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
980 adapter->dbg.num_tx_timeout); in mwifiex_cmd_timeout_func()
982 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
984 adapter->dbg.last_cmd_index); in mwifiex_cmd_timeout_func()
985 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
987 (int)sizeof(adapter->dbg.last_cmd_id), in mwifiex_cmd_timeout_func()
988 adapter->dbg.last_cmd_id); in mwifiex_cmd_timeout_func()
989 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
991 (int)sizeof(adapter->dbg.last_cmd_act), in mwifiex_cmd_timeout_func()
992 adapter->dbg.last_cmd_act); in mwifiex_cmd_timeout_func()
994 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
996 adapter->dbg.last_cmd_resp_index); in mwifiex_cmd_timeout_func()
997 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
999 (int)sizeof(adapter->dbg.last_cmd_resp_id), in mwifiex_cmd_timeout_func()
1000 adapter->dbg.last_cmd_resp_id); in mwifiex_cmd_timeout_func()
1002 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
1004 adapter->dbg.last_event_index); in mwifiex_cmd_timeout_func()
1005 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
1007 (int)sizeof(adapter->dbg.last_event), in mwifiex_cmd_timeout_func()
1008 adapter->dbg.last_event); in mwifiex_cmd_timeout_func()
1010 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
1012 adapter->data_sent, adapter->cmd_sent); in mwifiex_cmd_timeout_func()
1014 mwifiex_dbg(adapter, MSG, in mwifiex_cmd_timeout_func()
1016 adapter->ps_mode, adapter->ps_state); in mwifiex_cmd_timeout_func()
1019 adapter->cmd_wait_q.status = -ETIMEDOUT; in mwifiex_cmd_timeout_func()
1020 mwifiex_cancel_pending_ioctl(adapter); in mwifiex_cmd_timeout_func()
1023 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_cmd_timeout_func()
1024 mwifiex_init_fw_complete(adapter); in mwifiex_cmd_timeout_func()
1028 if (adapter->if_ops.device_dump) in mwifiex_cmd_timeout_func()
1029 adapter->if_ops.device_dump(adapter); in mwifiex_cmd_timeout_func()
1031 if (adapter->if_ops.card_reset) in mwifiex_cmd_timeout_func()
1032 adapter->if_ops.card_reset(adapter); in mwifiex_cmd_timeout_func()
1036 mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter) in mwifiex_cancel_pending_scan_cmd() argument
1041 spin_lock_bh(&adapter->scan_pending_q_lock); in mwifiex_cancel_pending_scan_cmd()
1043 &adapter->scan_pending_q, list) { in mwifiex_cancel_pending_scan_cmd()
1046 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); in mwifiex_cancel_pending_scan_cmd()
1048 spin_unlock_bh(&adapter->scan_pending_q_lock); in mwifiex_cancel_pending_scan_cmd()
1059 mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) in mwifiex_cancel_all_pending_cmd() argument
1063 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_all_pending_cmd()
1065 if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_all_pending_cmd()
1066 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1067 mwifiex_complete_cmd(adapter, adapter->curr_cmd); in mwifiex_cancel_all_pending_cmd()
1068 adapter->curr_cmd->wait_q_enabled = false; in mwifiex_cancel_all_pending_cmd()
1072 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_cancel_all_pending_cmd()
1074 &adapter->cmd_pending_q, list) { in mwifiex_cancel_all_pending_cmd()
1078 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1079 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_all_pending_cmd()
1081 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_cancel_all_pending_cmd()
1082 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_all_pending_cmd()
1084 mwifiex_cancel_scan(adapter); in mwifiex_cancel_all_pending_cmd()
1098 mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) in mwifiex_cancel_pending_ioctl() argument
1102 if ((adapter->curr_cmd) && in mwifiex_cancel_pending_ioctl()
1103 (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_pending_ioctl()
1104 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_pending_ioctl()
1105 cmd_node = adapter->curr_cmd; in mwifiex_cancel_pending_ioctl()
1114 adapter->curr_cmd = NULL; in mwifiex_cancel_pending_ioctl()
1115 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_pending_ioctl()
1117 mwifiex_recycle_cmd_node(adapter, cmd_node); in mwifiex_cancel_pending_ioctl()
1120 mwifiex_cancel_scan(adapter); in mwifiex_cancel_pending_ioctl()
1133 mwifiex_check_ps_cond(struct mwifiex_adapter *adapter) in mwifiex_check_ps_cond() argument
1135 if (!adapter->cmd_sent && !atomic_read(&adapter->tx_hw_pending) && in mwifiex_check_ps_cond()
1136 !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter)) in mwifiex_check_ps_cond()
1137 mwifiex_dnld_sleep_confirm_cmd(adapter); in mwifiex_check_ps_cond()
1139 mwifiex_dbg(adapter, CMD, in mwifiex_check_ps_cond()
1141 (adapter->cmd_sent) ? "D" : "", in mwifiex_check_ps_cond()
1142 atomic_read(&adapter->tx_hw_pending) ? "T" : "", in mwifiex_check_ps_cond()
1143 (adapter->curr_cmd) ? "C" : "", in mwifiex_check_ps_cond()
1144 (IS_CARD_RX_RCVD(adapter)) ? "R" : ""); in mwifiex_check_ps_cond()
1157 &priv->adapter->work_flags)) { in mwifiex_hs_activated_event()
1158 priv->adapter->hs_activated = true; in mwifiex_hs_activated_event()
1159 mwifiex_update_rxreor_flags(priv->adapter, in mwifiex_hs_activated_event()
1161 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1163 priv->adapter->hs_activate_wait_q_woken = true; in mwifiex_hs_activated_event()
1165 &priv->adapter->hs_activate_wait_q); in mwifiex_hs_activated_event()
1167 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1171 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1173 priv->adapter->hs_activated = false; in mwifiex_hs_activated_event()
1190 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_802_11_hs_cfg() local
1196 adapter->iface_type != MWIFIEX_USB) { in mwifiex_ret_802_11_hs_cfg()
1200 mwifiex_dbg(adapter, CMD, in mwifiex_ret_802_11_hs_cfg()
1208 set_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_ret_802_11_hs_cfg()
1209 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_ret_802_11_hs_cfg()
1212 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_ret_802_11_hs_cfg()
1213 if (adapter->hs_activated) in mwifiex_ret_802_11_hs_cfg()
1225 mwifiex_process_hs_config(struct mwifiex_adapter *adapter) in mwifiex_process_hs_config() argument
1227 mwifiex_dbg(adapter, INFO, in mwifiex_process_hs_config()
1232 adapter->if_ops.wakeup(adapter); in mwifiex_process_hs_config()
1234 if (adapter->hs_activated_manually) { in mwifiex_process_hs_config()
1235 mwifiex_cancel_hs(mwifiex_get_priv (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_process_hs_config()
1237 adapter->hs_activated_manually = false; in mwifiex_process_hs_config()
1240 adapter->hs_activated = false; in mwifiex_process_hs_config()
1241 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_process_hs_config()
1242 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_process_hs_config()
1243 mwifiex_hs_activated_event(mwifiex_get_priv(adapter, in mwifiex_process_hs_config()
1255 mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter, in mwifiex_process_sleep_confirm_resp() argument
1260 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_sleep_confirm_resp()
1266 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1271 mwifiex_dbg(adapter, CMD, in mwifiex_process_sleep_confirm_resp()
1276 priv = mwifiex_get_priv_by_id(adapter, HostCmd_GET_BSS_NO(seq_num), in mwifiex_process_sleep_confirm_resp()
1279 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_process_sleep_confirm_resp()
1287 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1294 mwifiex_dbg(adapter, ERROR, in mwifiex_process_sleep_confirm_resp()
1297 adapter->pm_wakeup_card_req = false; in mwifiex_process_sleep_confirm_resp()
1298 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_process_sleep_confirm_resp()
1301 adapter->pm_wakeup_card_req = true; in mwifiex_process_sleep_confirm_resp()
1302 if (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags)) in mwifiex_process_sleep_confirm_resp()
1304 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_process_sleep_confirm_resp()
1306 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_process_sleep_confirm_resp()
1352 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cmd_enh_power_mode() local
1361 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1364 cpu_to_le16(adapter->null_pkt_interval); in mwifiex_cmd_enh_power_mode()
1366 cpu_to_le16(adapter->multiple_dtim); in mwifiex_cmd_enh_power_mode()
1368 cpu_to_le16(adapter->bcn_miss_time_out); in mwifiex_cmd_enh_power_mode()
1370 cpu_to_le16(adapter->local_listen_interval); in mwifiex_cmd_enh_power_mode()
1372 cpu_to_le16(adapter->adhoc_awake_period); in mwifiex_cmd_enh_power_mode()
1374 cpu_to_le16(adapter->delay_to_ps); in mwifiex_cmd_enh_power_mode()
1375 ps_mode->mode = cpu_to_le16(adapter->enhanced_ps_mode); in mwifiex_cmd_enh_power_mode()
1392 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1412 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_enh_power_mode() local
1420 mwifiex_dbg(adapter, INFO, in mwifiex_ret_enh_power_mode()
1425 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1427 priv->adapter->is_deep_sleep = true; in mwifiex_ret_enh_power_mode()
1430 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1432 if (adapter->sleep_period.period) in mwifiex_ret_enh_power_mode()
1433 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1438 priv->adapter->is_deep_sleep = false; in mwifiex_ret_enh_power_mode()
1439 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1443 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1445 if (adapter->sleep_period.period) { in mwifiex_ret_enh_power_mode()
1446 adapter->delay_null_pkt = false; in mwifiex_ret_enh_power_mode()
1447 adapter->tx_lock_flag = false; in mwifiex_ret_enh_power_mode()
1448 adapter->pps_uapsd_mode = false; in mwifiex_ret_enh_power_mode()
1453 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; in mwifiex_ret_enh_power_mode()
1455 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_ret_enh_power_mode()
1457 mwifiex_dbg(adapter, CMD, in mwifiex_ret_enh_power_mode()
1516 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_get_hw_spec() local
1523 adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); in mwifiex_ret_get_hw_spec()
1525 if (IS_SUPPORT_MULTI_BANDS(adapter)) in mwifiex_ret_get_hw_spec()
1526 adapter->fw_bands = (u8) GET_FW_DEFAULT_BANDS(adapter); in mwifiex_ret_get_hw_spec()
1528 adapter->fw_bands = BAND_B; in mwifiex_ret_get_hw_spec()
1530 adapter->config_bands = adapter->fw_bands; in mwifiex_ret_get_hw_spec()
1532 if (adapter->fw_bands & BAND_A) { in mwifiex_ret_get_hw_spec()
1533 if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1534 adapter->config_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1535 adapter->fw_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1537 if (adapter->fw_bands & BAND_AN) { in mwifiex_ret_get_hw_spec()
1538 adapter->adhoc_start_band = BAND_A | BAND_AN; in mwifiex_ret_get_hw_spec()
1539 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1541 adapter->adhoc_start_band = BAND_A; in mwifiex_ret_get_hw_spec()
1544 } else if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1545 adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN; in mwifiex_ret_get_hw_spec()
1547 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1548 } else if (adapter->fw_bands & BAND_G) { in mwifiex_ret_get_hw_spec()
1549 adapter->adhoc_start_band = BAND_G | BAND_B; in mwifiex_ret_get_hw_spec()
1551 } else if (adapter->fw_bands & BAND_B) { in mwifiex_ret_get_hw_spec()
1552 adapter->adhoc_start_band = BAND_B; in mwifiex_ret_get_hw_spec()
1556 adapter->fw_release_number = le32_to_cpu(hw_spec->fw_release_number); in mwifiex_ret_get_hw_spec()
1557 adapter->fw_api_ver = (adapter->fw_release_number >> 16) & 0xff; in mwifiex_ret_get_hw_spec()
1558 adapter->number_of_antenna = in mwifiex_ret_get_hw_spec()
1562 adapter->is_hw_11ac_capable = true; in mwifiex_ret_get_hw_spec()
1565 adapter->hw_dot_11ac_dev_cap = in mwifiex_ret_get_hw_spec()
1567 adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1569 adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1573 adapter->hw_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1575 adapter->usr_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1576 adapter->hw_dot_11ac_mcs_support; in mwifiex_ret_get_hw_spec()
1578 adapter->is_hw_11ac_capable = false; in mwifiex_ret_get_hw_spec()
1593 adapter->key_api_major_ver = in mwifiex_ret_get_hw_spec()
1595 adapter->key_api_minor_ver = in mwifiex_ret_get_hw_spec()
1597 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1599 adapter->key_api_major_ver, in mwifiex_ret_get_hw_spec()
1600 adapter->key_api_minor_ver); in mwifiex_ret_get_hw_spec()
1603 adapter->fw_api_ver = in mwifiex_ret_get_hw_spec()
1605 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1607 adapter->fw_api_ver, in mwifiex_ret_get_hw_spec()
1611 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1617 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1623 mwifiex_dbg(adapter, FATAL, in mwifiex_ret_get_hw_spec()
1631 adapter->max_p2p_conn = max_conn->max_p2p_conn; in mwifiex_ret_get_hw_spec()
1632 adapter->max_sta_conn = max_conn->max_sta_conn; in mwifiex_ret_get_hw_spec()
1633 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1635 adapter->max_p2p_conn); in mwifiex_ret_get_hw_spec()
1636 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1638 adapter->max_sta_conn); in mwifiex_ret_get_hw_spec()
1641 mwifiex_dbg(adapter, FATAL, in mwifiex_ret_get_hw_spec()
1653 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1655 adapter->fw_release_number); in mwifiex_ret_get_hw_spec()
1656 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1659 mwifiex_dbg(adapter, INFO, in mwifiex_ret_get_hw_spec()
1664 ether_addr_copy(priv->adapter->perm_addr, hw_spec->permanent_addr); in mwifiex_ret_get_hw_spec()
1665 adapter->region_code = le16_to_cpu(hw_spec->region_code); in mwifiex_ret_get_hw_spec()
1669 if (adapter->region_code == region_code_index[i]) in mwifiex_ret_get_hw_spec()
1674 adapter->region_code = 0x00; in mwifiex_ret_get_hw_spec()
1675 mwifiex_dbg(adapter, WARN, in mwifiex_ret_get_hw_spec()
1679 adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap); in mwifiex_ret_get_hw_spec()
1680 adapter->hw_dev_mcs_support = hw_spec->dev_mcs_support; in mwifiex_ret_get_hw_spec()
1681 adapter->user_dev_mcs_support = adapter->hw_dev_mcs_support; in mwifiex_ret_get_hw_spec()
1683 if (adapter->if_ops.update_mp_end_port) in mwifiex_ret_get_hw_spec()
1684 adapter->if_ops.update_mp_end_port(adapter, in mwifiex_ret_get_hw_spec()
1687 if (adapter->fw_api_ver == MWIFIEX_FW_V15) in mwifiex_ret_get_hw_spec()
1688 adapter->scan_chan_gap_enabled = true; in mwifiex_ret_get_hw_spec()