Commit 0c9c4a09 authored by Amitkumar Karwar's avatar Amitkumar Karwar Committed by John W. Linville

mwifiex: replace num_cmd_timeout with is_cmd_timedout

Command timeout happens when firmware goes into bad state.
There is no chance that next command will be successful after
this. Hence we will maintain a flag instead of count.
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e50e06fd
...@@ -131,7 +131,7 @@ info ...@@ -131,7 +131,7 @@ info
hs_configured = <0/1, host sleep not configured/configured> hs_configured = <0/1, host sleep not configured/configured>
hs_activated = <0/1, extended host sleep not activated/activated> hs_activated = <0/1, extended host sleep not activated/activated>
num_tx_timeout = <number of Tx timeout> num_tx_timeout = <number of Tx timeout>
num_cmd_timeout = <number of timeout commands> is_cmd_timedout = <0/1 command timeout not occurred/occurred>
timeout_cmd_id = <command id of the last timeout command> timeout_cmd_id = <command id of the last timeout command>
timeout_cmd_act = <command action of the last timeout command> timeout_cmd_act = <command action of the last timeout command>
last_cmd_id = <command id of the last several commands sent to device> last_cmd_id = <command id of the last several commands sent to device>
......
...@@ -514,7 +514,7 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no, ...@@ -514,7 +514,7 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
return -1; return -1;
} }
if (adapter->num_cmd_timeout) { if (adapter->is_cmd_timedout) {
dev_err(adapter->dev, "PREP_CMD: FW is in bad state\n"); dev_err(adapter->dev, "PREP_CMD: FW is in bad state\n");
return -1; return -1;
} }
...@@ -780,7 +780,7 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) ...@@ -780,7 +780,7 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
return -1; return -1;
} }
adapter->num_cmd_timeout = 0; adapter->is_cmd_timedout = 0;
resp = (struct host_cmd_ds_command *) adapter->curr_cmd->resp_skb->data; resp = (struct host_cmd_ds_command *) adapter->curr_cmd->resp_skb->data;
if (adapter->curr_cmd->cmd_flag & CMD_F_CANCELED) { if (adapter->curr_cmd->cmd_flag & CMD_F_CANCELED) {
...@@ -891,7 +891,7 @@ mwifiex_cmd_timeout_func(unsigned long function_context) ...@@ -891,7 +891,7 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
struct cmd_ctrl_node *cmd_node; struct cmd_ctrl_node *cmd_node;
struct timeval tstamp; struct timeval tstamp;
adapter->num_cmd_timeout++; adapter->is_cmd_timedout = 1;
if (!adapter->curr_cmd) { if (!adapter->curr_cmd) {
dev_dbg(adapter->dev, "cmd: empty curr_cmd\n"); dev_dbg(adapter->dev, "cmd: empty curr_cmd\n");
return; return;
...@@ -914,8 +914,8 @@ mwifiex_cmd_timeout_func(unsigned long function_context) ...@@ -914,8 +914,8 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
dev_err(adapter->dev, "num_cmd_h2c_failure = %d\n", dev_err(adapter->dev, "num_cmd_h2c_failure = %d\n",
adapter->dbg.num_cmd_host_to_card_failure); adapter->dbg.num_cmd_host_to_card_failure);
dev_err(adapter->dev, "num_cmd_timeout = %d\n", dev_err(adapter->dev, "is_cmd_timedout = %d\n",
adapter->num_cmd_timeout); adapter->is_cmd_timedout);
dev_err(adapter->dev, "num_tx_timeout = %d\n", dev_err(adapter->dev, "num_tx_timeout = %d\n",
adapter->dbg.num_tx_timeout); adapter->dbg.num_tx_timeout);
......
...@@ -85,8 +85,8 @@ static struct mwifiex_debug_data items[] = { ...@@ -85,8 +85,8 @@ static struct mwifiex_debug_data items[] = {
item_addr(hs_activated), 1}, item_addr(hs_activated), 1},
{"num_tx_timeout", item_size(num_tx_timeout), {"num_tx_timeout", item_size(num_tx_timeout),
item_addr(num_tx_timeout), 1}, item_addr(num_tx_timeout), 1},
{"num_cmd_timeout", item_size(num_cmd_timeout), {"is_cmd_timedout", item_size(is_cmd_timedout),
item_addr(num_cmd_timeout), 1}, item_addr(is_cmd_timedout), 1},
{"timeout_cmd_id", item_size(timeout_cmd_id), {"timeout_cmd_id", item_size(timeout_cmd_id),
item_addr(timeout_cmd_id), 1}, item_addr(timeout_cmd_id), 1},
{"timeout_cmd_act", item_size(timeout_cmd_act), {"timeout_cmd_act", item_size(timeout_cmd_act),
......
...@@ -209,7 +209,7 @@ struct mwifiex_debug_info { ...@@ -209,7 +209,7 @@ struct mwifiex_debug_info {
u32 num_cmd_assoc_success; u32 num_cmd_assoc_success;
u32 num_cmd_assoc_failure; u32 num_cmd_assoc_failure;
u32 num_tx_timeout; u32 num_tx_timeout;
u32 num_cmd_timeout; u8 is_cmd_timedout;
u16 timeout_cmd_id; u16 timeout_cmd_id;
u16 timeout_cmd_act; u16 timeout_cmd_act;
u16 last_cmd_id[DBG_CMD_NUM]; u16 last_cmd_id[DBG_CMD_NUM];
......
...@@ -719,7 +719,7 @@ struct mwifiex_adapter { ...@@ -719,7 +719,7 @@ struct mwifiex_adapter {
struct cmd_ctrl_node *curr_cmd; struct cmd_ctrl_node *curr_cmd;
/* spin lock for command */ /* spin lock for command */
spinlock_t mwifiex_cmd_lock; spinlock_t mwifiex_cmd_lock;
u32 num_cmd_timeout; u8 is_cmd_timedout;
u16 last_init_cmd; u16 last_init_cmd;
struct timer_list cmd_timer; struct timer_list cmd_timer;
struct list_head cmd_free_q; struct list_head cmd_free_q;
......
...@@ -116,7 +116,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) ...@@ -116,7 +116,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code)
adapter->tx_lock_flag = false; adapter->tx_lock_flag = false;
adapter->pps_uapsd_mode = false; adapter->pps_uapsd_mode = false;
if (adapter->num_cmd_timeout && adapter->curr_cmd) if (adapter->is_cmd_timedout && adapter->curr_cmd)
return; return;
priv->media_connected = false; priv->media_connected = false;
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
......
...@@ -104,7 +104,7 @@ int mwifiex_get_debug_info(struct mwifiex_private *priv, ...@@ -104,7 +104,7 @@ int mwifiex_get_debug_info(struct mwifiex_private *priv,
info->pm_wakeup_fw_try = adapter->pm_wakeup_fw_try; info->pm_wakeup_fw_try = adapter->pm_wakeup_fw_try;
info->is_hs_configured = adapter->is_hs_configured; info->is_hs_configured = adapter->is_hs_configured;
info->hs_activated = adapter->hs_activated; info->hs_activated = adapter->hs_activated;
info->num_cmd_timeout = adapter->num_cmd_timeout; info->is_cmd_timedout = adapter->is_cmd_timedout;
info->num_cmd_host_to_card_failure info->num_cmd_host_to_card_failure
= adapter->dbg.num_cmd_host_to_card_failure; = adapter->dbg.num_cmd_host_to_card_failure;
info->num_cmd_sleep_cfm_host_to_card_failure info->num_cmd_sleep_cfm_host_to_card_failure
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment