]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mwifiex: rework internal scan for association
authorAvinash Patil <patila@marvell.com>
Fri, 12 Sep 2014 14:38:48 +0000 (20:08 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 15 Sep 2014 19:00:51 +0000 (15:00 -0400)
There was an issue with internal scan during association wherein
we would complete internal scan on first scan command response.
This would cause association failure if AP is not found in first scan
response e.g. APs from A band.
This patch fixes this issue by completing internal scan only when all
scan commands from scan pending queue and command pending queue are
sent to FW and response to last scan command is received.

Tested-by: Xinmin Hu <huxm@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marc Yang <yangyang@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/scan.c

index 195ef0ca343f1f451f4c039259f64fde5f0f86b1..0c9ed2c730d72a84696da6ef252a4674fa57680b 100644 (file)
@@ -1971,9 +1971,34 @@ int mwifiex_cmd_802_11_scan_ext(struct mwifiex_private *priv,
 /* This function handles the command response of extended scan */
 int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv)
 {
+       struct mwifiex_adapter *adapter = priv->adapter;
+       struct host_cmd_ds_command *cmd_ptr;
+       struct cmd_ctrl_node *cmd_node;
+       unsigned long cmd_flags, scan_flags;
+       bool complete_scan = false;
+
        dev_dbg(priv->adapter->dev, "info: EXT scan returns successfully\n");
 
-       mwifiex_complete_scan(priv);
+       spin_lock_irqsave(&adapter->cmd_pending_q_lock, cmd_flags);
+       spin_lock_irqsave(&adapter->scan_pending_q_lock, scan_flags);
+       if (list_empty(&adapter->scan_pending_q)) {
+               complete_scan = true;
+               list_for_each_entry(cmd_node, &adapter->cmd_pending_q, list) {
+                       cmd_ptr = (void *)cmd_node->cmd_skb->data;
+                       if (le16_to_cpu(cmd_ptr->command) ==
+                           HostCmd_CMD_802_11_SCAN_EXT) {
+                               dev_dbg(priv->adapter->dev,
+                                       "Scan pending in command pending list");
+                               complete_scan = false;
+                               break;
+                       }
+               }
+       }
+       spin_unlock_irqrestore(&adapter->scan_pending_q_lock, scan_flags);
+       spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, cmd_flags);
+
+       if (complete_scan)
+               mwifiex_complete_scan(priv);
 
        return 0;
 }