aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/scan.c
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2011-10-12 23:28:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-10-14 14:48:20 -0400
commitefaaa8b8414e0ab4ba09aaaf79ab92a34b75797b (patch)
treefb5680389af8de71154859c468adc83c04b7c1e4 /drivers/net/wireless/mwifiex/scan.c
parent207ae4a3733686df2aabd2dd6feefbde4e69cdd5 (diff)
mwifiex: use separate wait condition for each command node
Currently global wait condition (adapter->cmd_wait_q.condition) is used while sending synchronous commands to FW. When two threads enter in mwifiex_send_cmd_sync() routine at the same time, both the threads wait for their command responses. Since wait condition is same for both, they wake up simultaneously after getting response of 1st command. After this when a thread is waiting for command response of 3rd command, it wakes up after getting response of 2nd command and so on. Therefore we don't wait for the response of last command(0xaa) during unload. Hence while next time loading the driver command time out is seen for INIT command. This problem is resolved by having separate wait condition flag for each command(except scan command). Since scan command is treated differently (by maintaining scan pending q etc.), newly defined flag (scan_wait_q_woken) is used as a scan wait condition. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/scan.c')
-rw-r--r--drivers/net/wireless/mwifiex/scan.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index ca3761965e85..5456dcbf037c 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -185,7 +185,7 @@ int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv,
185{ 185{
186 int status; 186 int status;
187 187
188 priv->adapter->cmd_wait_q.condition = false; 188 priv->adapter->scan_wait_q_woken = false;
189 189
190 status = mwifiex_scan_networks(priv, scan_req); 190 status = mwifiex_scan_networks(priv, scan_req);
191 if (!status) 191 if (!status)
@@ -1380,6 +1380,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1380 list_del(&cmd_node->list); 1380 list_del(&cmd_node->list);
1381 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, 1381 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1382 flags); 1382 flags);
1383 adapter->cmd_queued = cmd_node;
1383 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, 1384 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node,
1384 true); 1385 true);
1385 } else { 1386 } else {
@@ -1788,7 +1789,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1788 /* Need to indicate IOCTL complete */ 1789 /* Need to indicate IOCTL complete */
1789 if (adapter->curr_cmd->wait_q_enabled) { 1790 if (adapter->curr_cmd->wait_q_enabled) {
1790 adapter->cmd_wait_q.status = 0; 1791 adapter->cmd_wait_q.status = 0;
1791 mwifiex_complete_cmd(adapter); 1792 mwifiex_complete_cmd(adapter, adapter->curr_cmd);
1792 } 1793 }
1793 if (priv->report_scan_result) 1794 if (priv->report_scan_result)
1794 priv->report_scan_result = false; 1795 priv->report_scan_result = false;
@@ -1845,6 +1846,7 @@ mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
1845 unsigned long flags; 1846 unsigned long flags;
1846 1847
1847 cmd_node->wait_q_enabled = true; 1848 cmd_node->wait_q_enabled = true;
1849 cmd_node->condition = &adapter->scan_wait_q_woken;
1848 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); 1850 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
1849 list_add_tail(&cmd_node->list, &adapter->scan_pending_q); 1851 list_add_tail(&cmd_node->list, &adapter->scan_pending_q);
1850 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); 1852 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
@@ -1911,7 +1913,7 @@ int mwifiex_request_scan(struct mwifiex_private *priv,
1911 } 1913 }
1912 priv->scan_pending_on_block = true; 1914 priv->scan_pending_on_block = true;
1913 1915
1914 priv->adapter->cmd_wait_q.condition = false; 1916 priv->adapter->scan_wait_q_woken = false;
1915 1917
1916 if (req_ssid && req_ssid->ssid_len != 0) 1918 if (req_ssid && req_ssid->ssid_len != 0)
1917 /* Specific SSID scan */ 1919 /* Specific SSID scan */