43 if (priv->
adapter->cmd_wait_q_required) {
45 priv->
adapter->cmd_wait_q_required =
false;
65 dev_err(adapter->
dev,
"GET_CMD_NODE: cmd node not available\n");
144 if (!adapter || !cmd_node)
150 if (host_cmd ==
NULL || host_cmd->
size == 0) {
151 dev_err(adapter->
dev,
"DNLD_CMD: host_cmd is null"
152 " or cmd size is 0, not sending\n");
163 cmd_node->
priv->bss_num,
164 cmd_node->
priv->bss_type));
174 if (cmd_node->
cmd_skb->len > cmd_size)
180 else if (cmd_node->
cmd_skb->len < cmd_size)
189 dev_dbg(adapter->
dev,
"cmd: DNLD_CMD: (%lu.%lu): %#x, act %#x, len %d,"
200 ret = adapter->
if_ops.host_to_card(adapter,
214 dev_err(adapter->
dev,
"DNLD_CMD: host to card failed\n");
225 adapter->
dbg.num_cmd_host_to_card_failure++;
230 adapter->
dbg.last_cmd_index =
233 adapter->
dbg.last_cmd_act[adapter->
dbg.last_cmd_index] =
255 static int mwifiex_dnld_sleep_confirm_cmd(
struct mwifiex_adapter *adapter)
284 ret = adapter->
if_ops.host_to_card(adapter,
286 sleep_cfm_tmp,
NULL);
298 adapter->
dbg.num_cmd_sleep_cfm_host_to_card_failure++;
344 dev_err(adapter->
dev,
"%s: failed to alloc cmd_array\n",
355 if (!cmd_array[i].
skb) {
356 dev_err(adapter->
dev,
"ALLOC_CMD_BUF: out of memory\n");
380 dev_dbg(adapter->
dev,
"info: FREE_CMD_BUF: cmd_pool is null\n");
388 if (cmd_array[i].
skb) {
389 dev_dbg(adapter->
dev,
"cmd: free cmd buffer %d\n", i);
396 adapter->
if_ops.cmdrsp_complete(adapter,
397 cmd_array[i].resp_skb);
403 dev_dbg(adapter->
dev,
"cmd: free cmd pool\n");
432 adapter->
dbg.last_event_index =
434 adapter->
dbg.last_event[adapter->
dbg.last_event_index] =
447 rx_info = MWIFIEX_SKB_RXCB(skb);
454 dev_dbg(adapter->
dev,
"event: %lu.%lu: cause: %#x\n",
470 adapter->
if_ops.event_complete(adapter, skb);
482 u16 cmd_action,
u32 cmd_oid,
void *data_buf)
510 u16 cmd_action,
u32 cmd_oid,
void *data_buf)
518 pr_err(
"PREP_CMD: adapter is NULL\n");
523 dev_err(adapter->
dev,
"PREP_CMD: device in suspended state\n");
528 dev_err(adapter->
dev,
"PREP_CMD: card is removed\n");
534 dev_err(adapter->
dev,
"PREP_CMD: FW in reset state\n");
540 cmd_node = mwifiex_get_cmd_node(adapter);
543 dev_err(adapter->
dev,
"PREP_CMD: no free cmd node\n");
548 mwifiex_init_cmd_node(priv, cmd_node, cmd_oid, data_buf);
551 dev_err(adapter->
dev,
"PREP_CMD: no free cmd buf\n");
579 ret = mwifiex_cmd_host_cmd(priv, cmd_ptr, data_buf);
585 dev_err(adapter->
dev,
"PREP_CMD: cmd %#x preparation failed\n",
621 mwifiex_clean_cmd_node(adapter, cmd_node);
646 dev_err(adapter->
dev,
"QUEUE_CMD: host_cmd is NULL\n");
670 dev_dbg(adapter->
dev,
"cmd: QUEUE_CMD: cmd=%#x is queued\n", command);
690 unsigned long cmd_flags;
691 unsigned long cmd_pending_q_flags;
695 dev_err(adapter->
dev,
"EXEC_NEXT_CMD: cmd in processing\n");
704 cmd_pending_q_flags);
711 cmd_pending_q_flags);
714 priv = cmd_node->
priv;
717 dev_err(adapter->
dev,
"%s: cannot send cmd in sleep state,"
718 " this should not happen\n", __func__);
726 cmd_pending_q_flags);
729 ret = mwifiex_dnld_cmd_to_fw(priv, cmd_node);
735 if (priv && (host_cmd->
command !=
769 dev_err(adapter->
dev,
"CMD_RESP: NULL curr_cmd, %#x\n",
778 dev_err(adapter->
dev,
"CMD_RESP: %#x been canceled\n",
791 dev_dbg(adapter->
dev,
"info: host cmd resp size = %d\n", size);
794 hostcmd = adapter->
curr_cmd->data_buf;
802 priv = mwifiex_get_priv_by_id(adapter,
814 adapter->
dbg.last_cmd_resp_index =
816 adapter->
dbg.last_cmd_resp_id[adapter->
dbg.last_cmd_resp_index] =
820 dev_dbg(adapter->
dev,
"cmd: CMD_RESP: (%lu.%lu): 0x%x, result %d,"
821 " len %d, seqno 0x%x\n",
822 tstamp.
tv_sec, tstamp.
tv_usec, orig_cmdresp_no, cmdresp_result,
826 dev_err(adapter->
dev,
"CMD_RESP: invalid cmd resp\n");
827 if (adapter->
curr_cmd->wait_q_enabled)
850 dev_err(adapter->
dev,
"%s: cmd %#x failed during "
851 "initialization\n", __func__, cmdresp_no);
859 if (adapter->
curr_cmd->wait_q_enabled)
887 adapter->
dbg.num_cmd_timeout++;
889 dev_dbg(adapter->
dev,
"cmd: empty curr_cmd\n");
894 adapter->
dbg.timeout_cmd_id =
895 adapter->
dbg.last_cmd_id[adapter->
dbg.last_cmd_index];
896 adapter->
dbg.timeout_cmd_act =
897 adapter->
dbg.last_cmd_act[adapter->
dbg.last_cmd_index];
900 "%s: Timeout cmd id (%lu.%lu) = %#x, act = %#x\n",
902 adapter->
dbg.timeout_cmd_id,
903 adapter->
dbg.timeout_cmd_act);
905 dev_err(adapter->
dev,
"num_data_h2c_failure = %d\n",
906 adapter->
dbg.num_tx_host_to_card_failure);
907 dev_err(adapter->
dev,
"num_cmd_h2c_failure = %d\n",
908 adapter->
dbg.num_cmd_host_to_card_failure);
910 dev_err(adapter->
dev,
"num_cmd_timeout = %d\n",
911 adapter->
dbg.num_cmd_timeout);
912 dev_err(adapter->
dev,
"num_tx_timeout = %d\n",
913 adapter->
dbg.num_tx_timeout);
915 dev_err(adapter->
dev,
"last_cmd_index = %d\n",
916 adapter->
dbg.last_cmd_index);
922 dev_err(adapter->
dev,
"last_cmd_resp_index = %d\n",
923 adapter->
dbg.last_cmd_resp_index);
925 adapter->
dbg.last_cmd_resp_id,
928 dev_err(adapter->
dev,
"last_event_index = %d\n",
929 adapter->
dbg.last_event_index);
933 dev_err(adapter->
dev,
"data_sent=%d cmd_sent=%d\n",
936 dev_err(adapter->
dev,
"ps_mode=%d ps_state=%d\n",
967 adapter->
curr_cmd->wait_q_enabled =
false;
1021 unsigned long cmd_flags;
1022 unsigned long scan_pending_q_flags;
1026 (adapter->
curr_cmd->wait_q_enabled)) {
1039 scan_pending_q_flags);
1044 scan_pending_q_flags);
1048 scan_pending_q_flags);
1049 cancel_scan_cmd =
true;
1052 scan_pending_q_flags);
1054 if (cancel_scan_cmd) {
1076 mwifiex_dnld_sleep_confirm_cmd(adapter);
1079 "cmd: Delay Sleep Confirm (%s%s%s)\n",
1094 if (priv->
adapter->is_hs_configured) {
1095 priv->
adapter->hs_activated =
true;
1099 priv->
adapter->hs_activate_wait_q_woken =
true;
1101 &priv->
adapter->hs_activate_wait_q);
1107 priv->
adapter->hs_activated =
false;
1134 dev_dbg(adapter->
dev,
"cmd: CMD_RESP: HS_CFG cmd reply"
1135 " result=%#x, conditions=0x%x gpio=0x%x gap=0x%x\n",
1136 resp->
result, conditions,
1161 dev_dbg(adapter->
dev,
"info: %s: auto cancelling host sleep"
1162 " since there is interrupt from the firmware\n", __func__);
1164 adapter->
if_ops.wakeup(adapter);
1180 u8 *pbuf,
u32 upld_len)
1190 dev_err(adapter->
dev,
"%s: cmd size is 0\n", __func__);
1207 "%s: rcvd unexpected resp for cmd %#x, result = %x\n",
1208 __func__, command, result);
1213 dev_err(adapter->
dev,
"%s: sleep confirm cmd failed\n",
1258 }
else if (cmd_action ==
GET_PS) {
1268 tlv = (
u8 *) cmd + cmd_size;
1277 cmd_size +=
sizeof(*ps_tlv);
1278 tlv +=
sizeof(*ps_tlv);
1279 dev_dbg(adapter->
dev,
"cmd: PS Command: Enter PS\n");
1300 auto_ds_tlv->
header.type =
1302 auto_ds_tlv->
header.len =
1305 cmd_size +=
sizeof(*auto_ds_tlv);
1306 tlv +=
sizeof(*auto_ds_tlv);
1310 "cmd: PS Command: Enter Auto Deep Sleep\n");
1338 "info: %s: PS_MODE cmd reply result=%#x action=%#X\n",
1339 __func__, resp->
result, action);
1342 dev_dbg(adapter->
dev,
"cmd: Enabled auto deep sleep\n");
1343 priv->
adapter->is_deep_sleep =
true;
1346 dev_dbg(adapter->
dev,
"cmd: Enabled STA power save\n");
1349 "cmd: set to uapsd/pps mode\n");
1353 priv->
adapter->is_deep_sleep =
false;
1354 dev_dbg(adapter->
dev,
"cmd: Disabled auto deep sleep\n");
1357 dev_dbg(adapter->
dev,
"cmd: Disabled STA power save\n");
1364 }
else if (action ==
GET_PS) {
1370 dev_dbg(adapter->
dev,
"cmd: ps_bitmap=%#x\n", ps_bitmap);
1374 if (ps_bitmap & BITMAP_STA_PS)
1467 dev_dbg(adapter->
dev,
"info: GET_HW_SPEC: fw_release_number- %#x\n",
1469 dev_dbg(adapter->
dev,
"info: GET_HW_SPEC: permanent addr: %pM\n",
1472 "info: GET_HW_SPEC: hw_if_version=%#x version=%#x\n",
1487 if (i >= MWIFIEX_MAX_REGION_CODE) {
1490 "cmd: unknown region code, use default (USA)\n");
1496 if (adapter->
if_ops.update_mp_end_port)
1497 adapter->
if_ops.update_mp_end_port(adapter,