Lines Matching +full:auto +full:- +full:sleep +full:- +full:disabled

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright 2011-2020 NXP
32 cmd_node->priv = priv; in mwifiex_init_cmd_node()
33 cmd_node->cmd_no = cmd_no; in mwifiex_init_cmd_node()
36 cmd_node->wait_q_enabled = true; in mwifiex_init_cmd_node()
37 cmd_node->cmd_wait_q_woken = false; in mwifiex_init_cmd_node()
38 cmd_node->condition = &cmd_node->cmd_wait_q_woken; in mwifiex_init_cmd_node()
40 cmd_node->data_buf = data_buf; in mwifiex_init_cmd_node()
41 cmd_node->cmd_skb = cmd_node->skb; in mwifiex_init_cmd_node()
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()
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()
62 list_del(&cmd_node->list); in mwifiex_get_cmd_node()
63 spin_unlock_bh(&adapter->cmd_free_q_lock); in mwifiex_get_cmd_node()
83 cmd_node->cmd_no = 0; in mwifiex_clean_cmd_node()
84 cmd_node->cmd_flag = 0; in mwifiex_clean_cmd_node()
85 cmd_node->data_buf = NULL; in mwifiex_clean_cmd_node()
86 cmd_node->wait_q_enabled = false; in mwifiex_clean_cmd_node()
88 if (cmd_node->cmd_skb) in mwifiex_clean_cmd_node()
89 skb_trim(cmd_node->cmd_skb, 0); in mwifiex_clean_cmd_node()
91 if (cmd_node->resp_skb) { in mwifiex_clean_cmd_node()
92 adapter->if_ops.cmdrsp_complete(adapter, cmd_node->resp_skb); in mwifiex_clean_cmd_node()
93 cmd_node->resp_skb = NULL; in mwifiex_clean_cmd_node()
101 * cleaning the command node and re-inserting it into the free queue.
110 if (cmd_node->wait_q_enabled) 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()
125 struct host_cmd_ds_command *host_cmd = (void *)cmd_node->cmd_skb->data; in mwifiex_recycle_cmd_node()
129 atomic_dec(&adapter->cmd_pending); in mwifiex_recycle_cmd_node()
132 le16_to_cpu(host_cmd->command), in mwifiex_recycle_cmd_node()
133 atomic_read(&adapter->cmd_pending)); in mwifiex_recycle_cmd_node()
148 memcpy(cmd, pcmd_ptr->cmd, pcmd_ptr->len); in mwifiex_cmd_host_cmd()
149 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_host_cmd()
150 "cmd: host cmd size = %d\n", pcmd_ptr->len); in mwifiex_cmd_host_cmd()
166 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_dnld_cmd_to_fw()
173 return -1; in mwifiex_dnld_cmd_to_fw()
175 host_cmd = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); in mwifiex_dnld_cmd_to_fw()
178 if (host_cmd->size == 0) { in mwifiex_dnld_cmd_to_fw()
182 if (cmd_node->wait_q_enabled) in mwifiex_dnld_cmd_to_fw()
183 adapter->cmd_wait_q.status = -1; in mwifiex_dnld_cmd_to_fw()
185 return -1; in mwifiex_dnld_cmd_to_fw()
188 cmd_code = le16_to_cpu(host_cmd->command); in mwifiex_dnld_cmd_to_fw()
189 cmd_node->cmd_no = cmd_code; in mwifiex_dnld_cmd_to_fw()
190 cmd_size = le16_to_cpu(host_cmd->size); in mwifiex_dnld_cmd_to_fw()
192 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && in mwifiex_dnld_cmd_to_fw()
199 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_dnld_cmd_to_fw()
200 return -1; in mwifiex_dnld_cmd_to_fw()
204 adapter->seq_num++; in mwifiex_dnld_cmd_to_fw()
205 host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO in mwifiex_dnld_cmd_to_fw()
206 (adapter->seq_num, in mwifiex_dnld_cmd_to_fw()
207 cmd_node->priv->bss_num, in mwifiex_dnld_cmd_to_fw()
208 cmd_node->priv->bss_type)); 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()
215 if (cmd_node->cmd_skb->len > cmd_size) in mwifiex_dnld_cmd_to_fw()
220 skb_trim(cmd_node->cmd_skb, cmd_size); in mwifiex_dnld_cmd_to_fw()
221 else if (cmd_node->cmd_skb->len < cmd_size) in mwifiex_dnld_cmd_to_fw()
227 skb_put(cmd_node->cmd_skb, cmd_size - cmd_node->cmd_skb->len); in mwifiex_dnld_cmd_to_fw()
233 cmd_size, le16_to_cpu(host_cmd->seq_num)); in mwifiex_dnld_cmd_to_fw()
236 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_cmd_to_fw()
237 skb_push(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN); in mwifiex_dnld_cmd_to_fw()
239 cmd_node->cmd_skb->data); 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()
243 cmd_node->cmd_skb, NULL); in mwifiex_dnld_cmd_to_fw()
244 skb_pull(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN); in mwifiex_dnld_cmd_to_fw()
245 if (ret == -EBUSY) in mwifiex_dnld_cmd_to_fw()
246 cmd_node->cmd_skb = NULL; 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()
250 cmd_node->cmd_skb, NULL); in mwifiex_dnld_cmd_to_fw()
251 skb_pull(cmd_node->cmd_skb, adapter->intf_hdr_len); in mwifiex_dnld_cmd_to_fw()
254 if (ret == -1) { 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()
259 if (cmd_node->wait_q_enabled) 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()
268 return -1; 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()
292 * This function downloads a sleep confirm command to the firmware.
298 * No responses are needed for sleep confirm command.
306 adapter->sleep_cfm->data; in mwifiex_dnld_sleep_confirm_cmd()
311 adapter->seq_num++; in mwifiex_dnld_sleep_confirm_cmd()
312 sleep_cfm_buf->seq_num = in mwifiex_dnld_sleep_confirm_cmd()
314 (adapter->seq_num, priv->bss_num, in mwifiex_dnld_sleep_confirm_cmd()
315 priv->bss_type)); in mwifiex_dnld_sleep_confirm_cmd()
319 le16_to_cpu(sleep_cfm_buf->command), in mwifiex_dnld_sleep_confirm_cmd()
320 le16_to_cpu(sleep_cfm_buf->action), in mwifiex_dnld_sleep_confirm_cmd()
321 le16_to_cpu(sleep_cfm_buf->size), in mwifiex_dnld_sleep_confirm_cmd()
322 le16_to_cpu(sleep_cfm_buf->seq_num)); in mwifiex_dnld_sleep_confirm_cmd()
324 le16_to_cpu(sleep_cfm_buf->size)); in mwifiex_dnld_sleep_confirm_cmd()
326 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_dnld_sleep_confirm_cmd()
333 return -ENOMEM; in mwifiex_dnld_sleep_confirm_cmd()
338 put_unaligned_le32(MWIFIEX_USB_TYPE_CMD, sleep_cfm_tmp->data); in mwifiex_dnld_sleep_confirm_cmd()
339 memcpy(sleep_cfm_tmp->data + MWIFIEX_TYPE_LEN, 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()
345 if (ret != -EBUSY) 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()
354 if (ret == -1) { in mwifiex_dnld_sleep_confirm_cmd()
356 adapter->dbg.num_cmd_sleep_cfm_host_to_card_failure++; in mwifiex_dnld_sleep_confirm_cmd()
357 return -1; in mwifiex_dnld_sleep_confirm_cmd()
360 if (!le16_to_cpu(sleep_cfm_buf->resp_ctrl)) in mwifiex_dnld_sleep_confirm_cmd()
361 /* Response is not needed for sleep confirm command */ 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()
366 if (!le16_to_cpu(sleep_cfm_buf->resp_ctrl) && 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()
398 return -ENOMEM; in mwifiex_alloc_cmd_buffer()
400 adapter->cmd_pool = cmd_array; in mwifiex_alloc_cmd_buffer()
408 return -ENOMEM; in mwifiex_alloc_cmd_buffer()
430 if (!adapter->cmd_pool) { in mwifiex_free_cmd_buffer()
436 cmd_array = adapter->cmd_pool; 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()
458 kfree(adapter->cmd_pool); in mwifiex_free_cmd_buffer()
459 adapter->cmd_pool = NULL; in mwifiex_free_cmd_buffer()
467 * saved), only the event ID is used. Some events are re-invoked by
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()
487 ((priv->bss_num & 0xff) << 16) | in mwifiex_process_event()
488 ((priv->bss_type & 0xff) << 24); 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()
510 adapter->event_cause = eventcause; in mwifiex_process_event()
515 rx_info->bss_num = priv->bss_num; in mwifiex_process_event()
516 rx_info->bss_type = priv->bss_type; in mwifiex_process_event()
518 skb->data, skb->len); in mwifiex_process_event()
523 if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) 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()
538 * Preparation includes -
539 * - Sanity tests to make sure the card is still present or the FW
541 * - Getting a new command node from the command free queue
542 * - Initializing the command node for default parameters
543 * - Fill up the non-default parameters and buffer pointers
544 * - Add the command to pending queue
550 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_send_cmd()
556 return -1; in mwifiex_send_cmd()
559 if (test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { in mwifiex_send_cmd()
562 return -1; in mwifiex_send_cmd()
565 if (test_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags) && in mwifiex_send_cmd()
568 "PREP_CMD: host entering sleep state\n"); in mwifiex_send_cmd()
569 return -1; in mwifiex_send_cmd()
572 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) { in mwifiex_send_cmd()
575 return -1; in mwifiex_send_cmd()
578 if (test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { in mwifiex_send_cmd()
581 return -1; in mwifiex_send_cmd()
584 if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET) { in mwifiex_send_cmd()
588 return -1; 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()
596 return -1; 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()
611 return -1; in mwifiex_send_cmd()
617 if (!cmd_node->cmd_skb) { in mwifiex_send_cmd()
620 return -1; in mwifiex_send_cmd()
623 skb_put_zero(cmd_node->cmd_skb, sizeof(struct host_cmd_ds_command)); in mwifiex_send_cmd()
625 cmd_ptr = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); in mwifiex_send_cmd()
626 cmd_ptr->command = cpu_to_le16(cmd_no); in mwifiex_send_cmd()
627 cmd_ptr->result = 0; in mwifiex_send_cmd()
652 cmd_node->cmd_flag |= CMD_F_HOSTCMD; in mwifiex_send_cmd()
661 return -1; in mwifiex_send_cmd()
670 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_send_cmd()
671 if (cmd_node->wait_q_enabled) in mwifiex_send_cmd()
693 host_cmd = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); in mwifiex_insert_cmd_to_pending_q()
699 command = le16_to_cpu(host_cmd->command); in mwifiex_insert_cmd_to_pending_q()
704 &host_cmd->params.psmode_enh; in mwifiex_insert_cmd_to_pending_q()
705 if ((le16_to_cpu(pm->action) == DIS_PS) || in mwifiex_insert_cmd_to_pending_q()
706 (le16_to_cpu(pm->action) == DIS_AUTO_PS)) { in mwifiex_insert_cmd_to_pending_q()
707 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_insert_cmd_to_pending_q()
712 /* Same with exit host sleep cmd, luckily that can't happen at the same time as EXIT_PS */ in mwifiex_insert_cmd_to_pending_q()
715 &host_cmd->params.opt_hs_cfg; in mwifiex_insert_cmd_to_pending_q()
717 if (le16_to_cpu(hs_cfg->action) == HS_ACTIVATE) in mwifiex_insert_cmd_to_pending_q()
721 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_insert_cmd_to_pending_q()
723 list_add_tail(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
725 list_add(&cmd_node->list, &adapter->cmd_pending_q); in mwifiex_insert_cmd_to_pending_q()
726 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_insert_cmd_to_pending_q()
728 atomic_inc(&adapter->cmd_pending); in mwifiex_insert_cmd_to_pending_q()
731 command, atomic_read(&adapter->cmd_pending)); in mwifiex_insert_cmd_to_pending_q()
741 * If the device is currently in host sleep mode, any commands, except the
742 * host sleep configuration command will de-activate the host sleep. For PS
743 * mode, the function will put the firmware back to sleep if applicable.
753 if (adapter->curr_cmd) { in mwifiex_exec_next_cmd()
756 return -1; in mwifiex_exec_next_cmd()
759 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
761 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
762 if (list_empty(&adapter->cmd_pending_q)) { in mwifiex_exec_next_cmd()
763 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
764 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
767 cmd_node = list_first_entry(&adapter->cmd_pending_q, in mwifiex_exec_next_cmd()
770 host_cmd = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); in mwifiex_exec_next_cmd()
771 priv = cmd_node->priv; in mwifiex_exec_next_cmd()
773 if (adapter->ps_state != PS_STATE_AWAKE) { in mwifiex_exec_next_cmd()
775 "%s: cannot send cmd in sleep state,\t" in mwifiex_exec_next_cmd()
777 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
778 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
782 list_del(&cmd_node->list); in mwifiex_exec_next_cmd()
783 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_exec_next_cmd()
785 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_exec_next_cmd()
788 /* Any command sent to the firmware when host is in sleep in mwifiex_exec_next_cmd()
789 * mode should de-configure host sleep. We should skip the in mwifiex_exec_next_cmd()
790 * host sleep configuration command itself though in mwifiex_exec_next_cmd()
792 if (priv && (host_cmd->command != in mwifiex_exec_next_cmd()
794 if (adapter->hs_activated) { in mwifiex_exec_next_cmd()
796 &adapter->work_flags); in mwifiex_exec_next_cmd()
820 if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) { in mwifiex_process_cmdresp()
821 resp = (struct host_cmd_ds_command *) adapter->upld_buf; in mwifiex_process_cmdresp()
824 le16_to_cpu(resp->command)); in mwifiex_process_cmdresp()
825 return -1; in mwifiex_process_cmdresp()
828 resp = (struct host_cmd_ds_command *)adapter->curr_cmd->resp_skb->data; in mwifiex_process_cmdresp()
829 orig_cmdresp_no = le16_to_cpu(resp->command); in mwifiex_process_cmdresp()
832 if (adapter->curr_cmd->cmd_no != cmdresp_no) { in mwifiex_process_cmdresp()
835 adapter->curr_cmd->cmd_no, cmdresp_no); in mwifiex_process_cmdresp()
836 return -1; in mwifiex_process_cmdresp()
839 del_timer_sync(&adapter->cmd_timer); in mwifiex_process_cmdresp()
840 clear_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_process_cmdresp()
842 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
845 uint16_t size = le16_to_cpu(resp->size); in mwifiex_process_cmdresp()
849 if (adapter->curr_cmd->data_buf) { in mwifiex_process_cmdresp()
850 hostcmd = adapter->curr_cmd->data_buf; in mwifiex_process_cmdresp()
851 hostcmd->len = size; in mwifiex_process_cmdresp()
852 memcpy(hostcmd->cmd, resp, size); in mwifiex_process_cmdresp()
858 HostCmd_GET_BSS_NO(le16_to_cpu(resp->seq_num)), in mwifiex_process_cmdresp()
859 HostCmd_GET_BSS_TYPE(le16_to_cpu(resp->seq_num))); in mwifiex_process_cmdresp()
863 resp->command = cpu_to_le16(orig_cmdresp_no & HostCmd_CMD_ID_MASK); in mwifiex_process_cmdresp()
865 cmdresp_no = le16_to_cpu(resp->command); in mwifiex_process_cmdresp()
866 cmdresp_result = le16_to_cpu(resp->result); in mwifiex_process_cmdresp()
869 adapter->dbg.last_cmd_resp_index = in mwifiex_process_cmdresp()
870 (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM; in mwifiex_process_cmdresp()
871 adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] = in mwifiex_process_cmdresp()
877 le16_to_cpu(resp->size), le16_to_cpu(resp->seq_num)); in mwifiex_process_cmdresp()
879 le16_to_cpu(resp->size)); in mwifiex_process_cmdresp()
883 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
884 adapter->cmd_wait_q.status = -1; in mwifiex_process_cmdresp()
886 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
887 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
888 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
889 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
890 return -1; in mwifiex_process_cmdresp()
893 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { in mwifiex_process_cmdresp()
894 adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; in mwifiex_process_cmdresp()
904 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_process_cmdresp()
910 return -1; in mwifiex_process_cmdresp()
911 } else if (adapter->last_init_cmd == cmdresp_no) in mwifiex_process_cmdresp()
912 adapter->hw_status = MWIFIEX_HW_STATUS_INIT_DONE; in mwifiex_process_cmdresp()
915 if (adapter->curr_cmd) { in mwifiex_process_cmdresp()
916 if (adapter->curr_cmd->wait_q_enabled) in mwifiex_process_cmdresp()
917 adapter->cmd_wait_q.status = ret; in mwifiex_process_cmdresp()
919 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_process_cmdresp()
921 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
922 adapter->curr_cmd = NULL; in mwifiex_process_cmdresp()
923 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_process_cmdresp()
932 .uapsd_queues = -1, in mwifiex_process_assoc_resp()
937 if (priv->assoc_rsp_size) { in mwifiex_process_assoc_resp()
938 assoc_resp.links[0].bss = priv->req_bss; in mwifiex_process_assoc_resp()
939 assoc_resp.buf = priv->assoc_rsp_buf; in mwifiex_process_assoc_resp()
940 assoc_resp.len = priv->assoc_rsp_size; in mwifiex_process_assoc_resp()
941 wiphy_lock(priv->wdev.wiphy); in mwifiex_process_assoc_resp()
942 cfg80211_rx_assoc_resp(priv->netdev, in mwifiex_process_assoc_resp()
944 wiphy_unlock(priv->wdev.wiphy); in mwifiex_process_assoc_resp()
945 priv->assoc_rsp_size = 0; in mwifiex_process_assoc_resp()
952 * It will re-send the same command again.
960 set_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_cmd_timeout_func()
961 if (!adapter->curr_cmd) { in mwifiex_cmd_timeout_func()
966 cmd_node = adapter->curr_cmd; in mwifiex_cmd_timeout_func()
968 adapter->dbg.timeout_cmd_id = in mwifiex_cmd_timeout_func()
969 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
970 adapter->dbg.timeout_cmd_act = in mwifiex_cmd_timeout_func()
971 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index]; in mwifiex_cmd_timeout_func()
974 adapter->dbg.timeout_cmd_id, in mwifiex_cmd_timeout_func()
975 adapter->dbg.timeout_cmd_act); in mwifiex_cmd_timeout_func()
979 adapter->dbg.num_tx_host_to_card_failure); in mwifiex_cmd_timeout_func()
982 adapter->dbg.num_cmd_host_to_card_failure); in mwifiex_cmd_timeout_func()
987 &adapter->work_flags)); in mwifiex_cmd_timeout_func()
990 adapter->dbg.num_tx_timeout); in mwifiex_cmd_timeout_func()
994 adapter->dbg.last_cmd_index); in mwifiex_cmd_timeout_func()
997 (int)sizeof(adapter->dbg.last_cmd_id), in mwifiex_cmd_timeout_func()
998 adapter->dbg.last_cmd_id); in mwifiex_cmd_timeout_func()
1001 (int)sizeof(adapter->dbg.last_cmd_act), in mwifiex_cmd_timeout_func()
1002 adapter->dbg.last_cmd_act); in mwifiex_cmd_timeout_func()
1006 adapter->dbg.last_cmd_resp_index); in mwifiex_cmd_timeout_func()
1009 (int)sizeof(adapter->dbg.last_cmd_resp_id), in mwifiex_cmd_timeout_func()
1010 adapter->dbg.last_cmd_resp_id); in mwifiex_cmd_timeout_func()
1014 adapter->dbg.last_event_index); in mwifiex_cmd_timeout_func()
1017 (int)sizeof(adapter->dbg.last_event), in mwifiex_cmd_timeout_func()
1018 adapter->dbg.last_event); in mwifiex_cmd_timeout_func()
1022 adapter->data_sent, adapter->cmd_sent); in mwifiex_cmd_timeout_func()
1026 adapter->ps_mode, adapter->ps_state); in mwifiex_cmd_timeout_func()
1028 if (cmd_node->wait_q_enabled) { in mwifiex_cmd_timeout_func()
1029 adapter->cmd_wait_q.status = -ETIMEDOUT; in mwifiex_cmd_timeout_func()
1033 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { in mwifiex_cmd_timeout_func()
1038 if (adapter->if_ops.device_dump) in mwifiex_cmd_timeout_func()
1039 adapter->if_ops.device_dump(adapter); in mwifiex_cmd_timeout_func()
1041 if (adapter->if_ops.card_reset) in mwifiex_cmd_timeout_func()
1042 adapter->if_ops.card_reset(adapter); in mwifiex_cmd_timeout_func()
1051 spin_lock_bh(&adapter->scan_pending_q_lock); in mwifiex_cancel_pending_scan_cmd()
1053 &adapter->scan_pending_q, list) { in mwifiex_cancel_pending_scan_cmd()
1054 list_del(&cmd_node->list); in mwifiex_cancel_pending_scan_cmd()
1055 cmd_node->wait_q_enabled = false; in mwifiex_cancel_pending_scan_cmd()
1058 spin_unlock_bh(&adapter->scan_pending_q_lock); in mwifiex_cancel_pending_scan_cmd()
1073 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_all_pending_cmd()
1075 if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_all_pending_cmd()
1076 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1077 mwifiex_complete_cmd(adapter, adapter->curr_cmd); in mwifiex_cancel_all_pending_cmd()
1078 adapter->curr_cmd->wait_q_enabled = false; in mwifiex_cancel_all_pending_cmd()
1082 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_cancel_all_pending_cmd()
1084 &adapter->cmd_pending_q, list) { in mwifiex_cancel_all_pending_cmd()
1085 list_del(&cmd_node->list); in mwifiex_cancel_all_pending_cmd()
1087 if (cmd_node->wait_q_enabled) in mwifiex_cancel_all_pending_cmd()
1088 adapter->cmd_wait_q.status = -1; in mwifiex_cancel_all_pending_cmd()
1091 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_cancel_all_pending_cmd()
1092 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_all_pending_cmd()
1112 if ((adapter->curr_cmd) && in mwifiex_cancel_pending_ioctl()
1113 (adapter->curr_cmd->wait_q_enabled)) { in mwifiex_cancel_pending_ioctl()
1114 spin_lock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_pending_ioctl()
1115 cmd_node = adapter->curr_cmd; in mwifiex_cancel_pending_ioctl()
1124 adapter->curr_cmd = NULL; in mwifiex_cancel_pending_ioctl()
1125 spin_unlock_bh(&adapter->mwifiex_cmd_lock); in mwifiex_cancel_pending_ioctl()
1134 * This function sends the sleep confirm command to firmware, if
1137 * The sleep confirm command cannot be issued if command response,
1145 if (!adapter->cmd_sent && !atomic_read(&adapter->tx_hw_pending) && in mwifiex_check_ps_cond()
1146 !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter)) in mwifiex_check_ps_cond()
1150 "cmd: Delay Sleep Confirm (%s%s%s%s)\n", in mwifiex_check_ps_cond()
1151 (adapter->cmd_sent) ? "D" : "", in mwifiex_check_ps_cond()
1152 atomic_read(&adapter->tx_hw_pending) ? "T" : "", in mwifiex_check_ps_cond()
1153 (adapter->curr_cmd) ? "C" : "", in mwifiex_check_ps_cond()
1158 * This function sends a Host Sleep activated event to applications.
1167 &priv->adapter->work_flags)) { in mwifiex_hs_activated_event()
1168 priv->adapter->hs_activated = true; in mwifiex_hs_activated_event()
1169 mwifiex_update_rxreor_flags(priv->adapter, in mwifiex_hs_activated_event()
1171 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1173 priv->adapter->hs_activate_wait_q_woken = true; in mwifiex_hs_activated_event()
1175 &priv->adapter->hs_activate_wait_q); in mwifiex_hs_activated_event()
1177 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1181 mwifiex_dbg(priv->adapter, EVENT, in mwifiex_hs_activated_event()
1183 priv->adapter->hs_activated = false; in mwifiex_hs_activated_event()
1188 * This function handles the command response of a Host Sleep configuration
1192 * and setting the current host sleep activation status in driver.
1194 * In case host sleep status change, the function generates an event to
1200 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_802_11_hs_cfg()
1202 &resp->params.opt_hs_cfg; in mwifiex_ret_802_11_hs_cfg()
1203 uint32_t conditions = le32_to_cpu(phs_cfg->params.hs_config.conditions); in mwifiex_ret_802_11_hs_cfg()
1205 if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE) && in mwifiex_ret_802_11_hs_cfg()
1206 adapter->iface_type != MWIFIEX_USB) { in mwifiex_ret_802_11_hs_cfg()
1213 resp->result, conditions, in mwifiex_ret_802_11_hs_cfg()
1214 phs_cfg->params.hs_config.gpio, in mwifiex_ret_802_11_hs_cfg()
1215 phs_cfg->params.hs_config.gap); in mwifiex_ret_802_11_hs_cfg()
1218 set_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_ret_802_11_hs_cfg()
1219 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_ret_802_11_hs_cfg()
1222 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_ret_802_11_hs_cfg()
1223 if (adapter->hs_activated) in mwifiex_ret_802_11_hs_cfg()
1231 * This function wakes up the adapter and generates a Host Sleep
1238 "info: %s: auto cancelling host sleep\t" in mwifiex_process_hs_config()
1242 adapter->if_ops.wakeup(adapter); in mwifiex_process_hs_config()
1244 if (adapter->hs_activated_manually) { in mwifiex_process_hs_config()
1247 adapter->hs_activated_manually = false; in mwifiex_process_hs_config()
1250 adapter->hs_activated = false; in mwifiex_process_hs_config()
1251 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_process_hs_config()
1252 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_process_hs_config()
1260 * This function handles the command response of a sleep confirm command.
1262 * The function sets the card state to SLEEP if the response indicates success.
1269 uint16_t result = le16_to_cpu(cmd->result); in mwifiex_process_sleep_confirm_resp()
1270 uint16_t command = le16_to_cpu(cmd->command); in mwifiex_process_sleep_confirm_resp()
1271 uint16_t seq_num = le16_to_cpu(cmd->seq_num); in mwifiex_process_sleep_confirm_resp()
1281 command, result, le16_to_cpu(cmd->size), seq_num); in mwifiex_process_sleep_confirm_resp()
1297 "%s: sleep confirm cmd failed\n", in mwifiex_process_sleep_confirm_resp()
1299 adapter->pm_wakeup_card_req = false; in mwifiex_process_sleep_confirm_resp()
1300 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_process_sleep_confirm_resp()
1303 adapter->pm_wakeup_card_req = true; in mwifiex_process_sleep_confirm_resp()
1304 if (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags)) in mwifiex_process_sleep_confirm_resp()
1308 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_process_sleep_confirm_resp()
1309 cmd->command = cpu_to_le16(command); in mwifiex_process_sleep_confirm_resp()
1310 cmd->seq_num = cpu_to_le16(seq_num); in mwifiex_process_sleep_confirm_resp()
1318 * power save with auto PS or STA PS or auto deep sleep.
1320 * Preparation includes -
1321 * - Setting command ID, action and proper size
1322 * - Setting Power Save bitmap, PS parameters TLV, PS mode TLV,
1323 * auto deep sleep TLV (as required)
1324 * - Ensuring correct endian-ness
1332 &cmd->params.psmode_enh; in mwifiex_cmd_enh_power_mode()
1336 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH); in mwifiex_cmd_enh_power_mode()
1338 psmode_enh->action = cpu_to_le16(DIS_AUTO_PS); in mwifiex_cmd_enh_power_mode()
1339 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); in mwifiex_cmd_enh_power_mode()
1340 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) + in mwifiex_cmd_enh_power_mode()
1341 sizeof(psmode_enh->params.ps_bitmap)); in mwifiex_cmd_enh_power_mode()
1343 psmode_enh->action = cpu_to_le16(GET_PS); in mwifiex_cmd_enh_power_mode()
1344 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); in mwifiex_cmd_enh_power_mode()
1345 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) + in mwifiex_cmd_enh_power_mode()
1346 sizeof(psmode_enh->params.ps_bitmap)); in mwifiex_cmd_enh_power_mode()
1348 psmode_enh->action = cpu_to_le16(EN_AUTO_PS); in mwifiex_cmd_enh_power_mode()
1349 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); in mwifiex_cmd_enh_power_mode()
1350 cmd_size = S_DS_GEN + sizeof(psmode_enh->action) + in mwifiex_cmd_enh_power_mode()
1351 sizeof(psmode_enh->params.ps_bitmap); in mwifiex_cmd_enh_power_mode()
1354 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cmd_enh_power_mode()
1357 struct mwifiex_ps_param *ps_mode = &ps_tlv->param; in mwifiex_cmd_enh_power_mode()
1358 ps_tlv->header.type = cpu_to_le16(TLV_TYPE_PS_PARAM); in mwifiex_cmd_enh_power_mode()
1359 ps_tlv->header.len = cpu_to_le16(sizeof(*ps_tlv) - in mwifiex_cmd_enh_power_mode()
1363 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1365 ps_mode->null_pkt_interval = in mwifiex_cmd_enh_power_mode()
1366 cpu_to_le16(adapter->null_pkt_interval); in mwifiex_cmd_enh_power_mode()
1367 ps_mode->multiple_dtims = in mwifiex_cmd_enh_power_mode()
1368 cpu_to_le16(adapter->multiple_dtim); in mwifiex_cmd_enh_power_mode()
1369 ps_mode->bcn_miss_timeout = in mwifiex_cmd_enh_power_mode()
1370 cpu_to_le16(adapter->bcn_miss_time_out); in mwifiex_cmd_enh_power_mode()
1371 ps_mode->local_listen_interval = in mwifiex_cmd_enh_power_mode()
1372 cpu_to_le16(adapter->local_listen_interval); in mwifiex_cmd_enh_power_mode()
1373 ps_mode->adhoc_wake_period = in mwifiex_cmd_enh_power_mode()
1374 cpu_to_le16(adapter->adhoc_awake_period); in mwifiex_cmd_enh_power_mode()
1375 ps_mode->delay_to_ps = in mwifiex_cmd_enh_power_mode()
1376 cpu_to_le16(adapter->delay_to_ps); in mwifiex_cmd_enh_power_mode()
1377 ps_mode->mode = cpu_to_le16(adapter->enhanced_ps_mode); in mwifiex_cmd_enh_power_mode()
1385 auto_ds_tlv->header.type = in mwifiex_cmd_enh_power_mode()
1387 auto_ds_tlv->header.len = in mwifiex_cmd_enh_power_mode()
1388 cpu_to_le16(sizeof(*auto_ds_tlv) - in mwifiex_cmd_enh_power_mode()
1393 idletime = auto_ds->idle_time; in mwifiex_cmd_enh_power_mode()
1394 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cmd_enh_power_mode()
1395 "cmd: PS Command: Enter Auto Deep Sleep\n"); in mwifiex_cmd_enh_power_mode()
1396 auto_ds_tlv->deep_sleep_timeout = cpu_to_le16(idletime); in mwifiex_cmd_enh_power_mode()
1398 cmd->size = cpu_to_le16(cmd_size); in mwifiex_cmd_enh_power_mode()
1414 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_enh_power_mode()
1416 &resp->params.psmode_enh; in mwifiex_ret_enh_power_mode()
1417 uint16_t action = le16_to_cpu(ps_mode->action); in mwifiex_ret_enh_power_mode()
1418 uint16_t ps_bitmap = le16_to_cpu(ps_mode->params.ps_bitmap); in mwifiex_ret_enh_power_mode()
1420 le16_to_cpu(ps_mode->params.ps_bitmap); in mwifiex_ret_enh_power_mode()
1424 __func__, resp->result, action); in mwifiex_ret_enh_power_mode()
1428 "cmd: Enabled auto deep sleep\n"); in mwifiex_ret_enh_power_mode()
1429 priv->adapter->is_deep_sleep = true; in mwifiex_ret_enh_power_mode()
1434 if (adapter->sleep_period.period) in mwifiex_ret_enh_power_mode()
1440 priv->adapter->is_deep_sleep = false; in mwifiex_ret_enh_power_mode()
1442 "cmd: Disabled auto deep sleep\n"); in mwifiex_ret_enh_power_mode()
1446 "cmd: Disabled STA power save\n"); in mwifiex_ret_enh_power_mode()
1447 if (adapter->sleep_period.period) { in mwifiex_ret_enh_power_mode()
1448 adapter->delay_null_pkt = false; in mwifiex_ret_enh_power_mode()
1449 adapter->tx_lock_flag = false; in mwifiex_ret_enh_power_mode()
1450 adapter->pps_uapsd_mode = false; in mwifiex_ret_enh_power_mode()
1455 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; in mwifiex_ret_enh_power_mode()
1457 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_ret_enh_power_mode()
1465 pm_cfg->param.ps_mode = 1; in mwifiex_ret_enh_power_mode()
1467 pm_cfg->param.ps_mode = 0; in mwifiex_ret_enh_power_mode()
1476 * Preparation includes -
1477 * - Setting command ID, action and proper size
1478 * - Setting permanent address parameter
1479 * - Ensuring correct endian-ness
1484 struct host_cmd_ds_get_hw_spec *hw_spec = &cmd->params.hw_spec; in mwifiex_cmd_get_hw_spec()
1486 cmd->command = cpu_to_le16(HostCmd_CMD_GET_HW_SPEC); in mwifiex_cmd_get_hw_spec()
1487 cmd->size = in mwifiex_cmd_get_hw_spec()
1489 memcpy(hw_spec->permanent_addr, priv->curr_addr, ETH_ALEN); in mwifiex_cmd_get_hw_spec()
1499 * and saving/updating the following parameters in driver -
1500 * - Firmware capability information
1501 * - Firmware band settings
1502 * - Ad-hoc start band and channel
1503 * - Ad-hoc 11n activation status
1504 * - Firmware release number
1505 * - Number of antennas
1506 * - Hardware address
1507 * - Hardware interface version
1508 * - Firmware version
1509 * - Region code
1510 * - 11n capabilities
1511 * - MCS support fields
1512 * - MP end port
1517 struct host_cmd_ds_get_hw_spec *hw_spec = &resp->params.hw_spec; in mwifiex_ret_get_hw_spec()
1518 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_ret_get_hw_spec()
1525 adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); in mwifiex_ret_get_hw_spec()
1528 adapter->fw_bands = (u8) GET_FW_DEFAULT_BANDS(adapter); in mwifiex_ret_get_hw_spec()
1530 adapter->fw_bands = BAND_B; in mwifiex_ret_get_hw_spec()
1532 adapter->config_bands = adapter->fw_bands; in mwifiex_ret_get_hw_spec()
1534 if (adapter->fw_bands & BAND_A) { in mwifiex_ret_get_hw_spec()
1535 if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1536 adapter->config_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1537 adapter->fw_bands |= BAND_AN; in mwifiex_ret_get_hw_spec()
1539 if (adapter->fw_bands & BAND_AN) { in mwifiex_ret_get_hw_spec()
1540 adapter->adhoc_start_band = BAND_A | BAND_AN; in mwifiex_ret_get_hw_spec()
1541 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1543 adapter->adhoc_start_band = BAND_A; in mwifiex_ret_get_hw_spec()
1545 priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL_A; in mwifiex_ret_get_hw_spec()
1546 } else if (adapter->fw_bands & BAND_GN) { in mwifiex_ret_get_hw_spec()
1547 adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN; in mwifiex_ret_get_hw_spec()
1548 priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; in mwifiex_ret_get_hw_spec()
1549 adapter->adhoc_11n_enabled = true; in mwifiex_ret_get_hw_spec()
1550 } else if (adapter->fw_bands & BAND_G) { in mwifiex_ret_get_hw_spec()
1551 adapter->adhoc_start_band = BAND_G | BAND_B; in mwifiex_ret_get_hw_spec()
1552 priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; in mwifiex_ret_get_hw_spec()
1553 } else if (adapter->fw_bands & BAND_B) { in mwifiex_ret_get_hw_spec()
1554 adapter->adhoc_start_band = BAND_B; in mwifiex_ret_get_hw_spec()
1555 priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; in mwifiex_ret_get_hw_spec()
1558 adapter->fw_release_number = le32_to_cpu(hw_spec->fw_release_number); in mwifiex_ret_get_hw_spec()
1559 adapter->fw_api_ver = (adapter->fw_release_number >> 16) & 0xff; in mwifiex_ret_get_hw_spec()
1560 adapter->number_of_antenna = in mwifiex_ret_get_hw_spec()
1561 le16_to_cpu(hw_spec->number_of_antenna) & 0xf; in mwifiex_ret_get_hw_spec()
1563 if (le32_to_cpu(hw_spec->dot_11ac_dev_cap)) { in mwifiex_ret_get_hw_spec()
1564 adapter->is_hw_11ac_capable = true; in mwifiex_ret_get_hw_spec()
1567 adapter->hw_dot_11ac_dev_cap = in mwifiex_ret_get_hw_spec()
1568 le32_to_cpu(hw_spec->dot_11ac_dev_cap); in mwifiex_ret_get_hw_spec()
1569 adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1571 adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap in mwifiex_ret_get_hw_spec()
1575 adapter->hw_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1576 le32_to_cpu(hw_spec->dot_11ac_mcs_support); in mwifiex_ret_get_hw_spec()
1577 adapter->usr_dot_11ac_mcs_support = in mwifiex_ret_get_hw_spec()
1578 adapter->hw_dot_11ac_mcs_support; in mwifiex_ret_get_hw_spec()
1580 adapter->is_hw_11ac_capable = false; in mwifiex_ret_get_hw_spec()
1583 resp_size = le16_to_cpu(resp->size) - S_DS_GEN; in mwifiex_ret_get_hw_spec()
1586 left_len = resp_size - sizeof(struct host_cmd_ds_get_hw_spec); in mwifiex_ret_get_hw_spec()
1588 tlv = (void *)&hw_spec->tlvs + parsed_len; in mwifiex_ret_get_hw_spec()
1589 switch (le16_to_cpu(tlv->type)) { in mwifiex_ret_get_hw_spec()
1592 api_id = le16_to_cpu(api_rev->api_id); in mwifiex_ret_get_hw_spec()
1595 adapter->key_api_major_ver = in mwifiex_ret_get_hw_spec()
1596 api_rev->major_ver; in mwifiex_ret_get_hw_spec()
1597 adapter->key_api_minor_ver = in mwifiex_ret_get_hw_spec()
1598 api_rev->minor_ver; in mwifiex_ret_get_hw_spec()
1601 adapter->key_api_major_ver, in mwifiex_ret_get_hw_spec()
1602 adapter->key_api_minor_ver); in mwifiex_ret_get_hw_spec()
1605 adapter->fw_api_ver = in mwifiex_ret_get_hw_spec()
1606 api_rev->major_ver; in mwifiex_ret_get_hw_spec()
1609 adapter->fw_api_ver, in mwifiex_ret_get_hw_spec()
1610 api_rev->minor_ver); in mwifiex_ret_get_hw_spec()
1615 api_rev->major_ver, in mwifiex_ret_get_hw_spec()
1616 api_rev->minor_ver); in mwifiex_ret_get_hw_spec()
1621 api_rev->major_ver, in mwifiex_ret_get_hw_spec()
1622 api_rev->minor_ver); in mwifiex_ret_get_hw_spec()
1627 api_rev->major_ver); in mwifiex_ret_get_hw_spec()
1638 adapter->max_p2p_conn = max_conn->max_p2p_conn; in mwifiex_ret_get_hw_spec()
1639 adapter->max_sta_conn = max_conn->max_sta_conn; in mwifiex_ret_get_hw_spec()
1642 adapter->max_p2p_conn); in mwifiex_ret_get_hw_spec()
1645 adapter->max_sta_conn); in mwifiex_ret_get_hw_spec()
1650 le16_to_cpu(tlv->type)); in mwifiex_ret_get_hw_spec()
1653 parsed_len += le16_to_cpu(tlv->len) + in mwifiex_ret_get_hw_spec()
1655 left_len -= le16_to_cpu(tlv->len) + in mwifiex_ret_get_hw_spec()
1661 "info: GET_HW_SPEC: fw_release_number- %#x\n", in mwifiex_ret_get_hw_spec()
1662 adapter->fw_release_number); in mwifiex_ret_get_hw_spec()
1665 hw_spec->permanent_addr); in mwifiex_ret_get_hw_spec()
1668 le16_to_cpu(hw_spec->hw_if_version), in mwifiex_ret_get_hw_spec()
1669 le16_to_cpu(hw_spec->version)); in mwifiex_ret_get_hw_spec()
1671 ether_addr_copy(priv->adapter->perm_addr, hw_spec->permanent_addr); in mwifiex_ret_get_hw_spec()
1672 adapter->region_code = le16_to_cpu(hw_spec->region_code); in mwifiex_ret_get_hw_spec()
1676 if (adapter->region_code == region_code_index[i]) in mwifiex_ret_get_hw_spec()
1681 adapter->region_code = 0x00; in mwifiex_ret_get_hw_spec()
1686 adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap); in mwifiex_ret_get_hw_spec()
1687 adapter->hw_dev_mcs_support = hw_spec->dev_mcs_support; in mwifiex_ret_get_hw_spec()
1688 adapter->user_dev_mcs_support = adapter->hw_dev_mcs_support; in mwifiex_ret_get_hw_spec()
1690 if (adapter->if_ops.update_mp_end_port) in mwifiex_ret_get_hw_spec()
1691 adapter->if_ops.update_mp_end_port(adapter, in mwifiex_ret_get_hw_spec()
1692 le16_to_cpu(hw_spec->mp_end_port)); in mwifiex_ret_get_hw_spec()
1694 if (adapter->fw_api_ver == MWIFIEX_FW_V15) in mwifiex_ret_get_hw_spec()
1695 adapter->scan_chan_gap_enabled = true; in mwifiex_ret_get_hw_spec()
1697 if (adapter->key_api_major_ver != KEY_API_VER_MAJOR_V2) in mwifiex_ret_get_hw_spec()
1698 adapter->host_mlme_enabled = false; in mwifiex_ret_get_hw_spec()
1701 adapter->host_mlme_enabled ? "enable" : "disable", in mwifiex_ret_get_hw_spec()
1702 adapter->key_api_major_ver); in mwifiex_ret_get_hw_spec()
1714 wakeup_reason->wakeup_reason = in mwifiex_ret_wakeup_reason()
1715 resp->params.hs_wakeup_reason.wakeup_reason; in mwifiex_ret_wakeup_reason()