Skip to content

Commit

Permalink
iwlagn: warn about nested SYNC commands
Browse files Browse the repository at this point in the history
Since there is no protection around SYNC host command mechanism, at least WARN
when collision happens between two SYNC host comamnds. I am not sure there is a
real  issue (beyond the HCMD_ACTIVE flag maintenance) with having two SYNC host
commands at the same time, but at least now, we will know about it.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
  • Loading branch information
egrumbach authored and wwguy committed Jun 18, 2011
1 parent 807caf2 commit 4b55b07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ struct iwl_priv {

/* command queue number */
u8 cmd_queue;
u8 last_sync_cmd_id;

/* max number of station keys */
u8 sta_key_max_num;
Expand Down
11 changes: 10 additions & 1 deletion drivers/net/wireless/iwlwifi/iwl-hcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,16 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n",
get_cmd_string(cmd->id));

set_bit(STATUS_HCMD_ACTIVE, &priv->status);
if (test_and_set_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
IWL_ERR(priv, "STATUS_HCMD_ACTIVE already set while sending %s"
". Previous SYNC cmdn is %s\n",
get_cmd_string(cmd->id),
get_cmd_string(priv->last_sync_cmd_id));
WARN_ON(1);
} else {
priv->last_sync_cmd_id = cmd->id;
}

IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n",
get_cmd_string(cmd->id));

Expand Down

0 comments on commit 4b55b07

Please sign in to comment.