aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/scan.c
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2014-02-07 19:23:36 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-02-12 15:36:13 -0500
commitd44b5c2f2ec54569006dc85c7dbe25ccd41cfb73 (patch)
treea417c2808cab83b13b3b3ae8928b9b2dfcaf424c /drivers/net/wireless/mwifiex/scan.c
parent3b4d5c644204476265083a554dad56868b93b9dd (diff)
mwifiex: separate out next scan command queueing logic
This new function will be useful later for extended scan feature. Signed-off-by: Amitkumar Karwar <akarwar@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.c133
1 files changed, 71 insertions, 62 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 28f0a38ff2d9..3633347f50f6 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1726,6 +1726,76 @@ mwifiex_parse_single_response_buf(struct mwifiex_private *priv, u8 **bss_info,
1726 return 0; 1726 return 0;
1727} 1727}
1728 1728
1729static void mwifiex_check_next_scan_command(struct mwifiex_private *priv)
1730{
1731 struct mwifiex_adapter *adapter = priv->adapter;
1732 struct cmd_ctrl_node *cmd_node;
1733 unsigned long flags;
1734
1735 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
1736 if (list_empty(&adapter->scan_pending_q)) {
1737 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
1738 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1739 adapter->scan_processing = false;
1740 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1741
1742 /* Need to indicate IOCTL complete */
1743 if (adapter->curr_cmd->wait_q_enabled) {
1744 adapter->cmd_wait_q.status = 0;
1745 if (!priv->scan_request) {
1746 dev_dbg(adapter->dev,
1747 "complete internal scan\n");
1748 mwifiex_complete_cmd(adapter,
1749 adapter->curr_cmd);
1750 }
1751 }
1752 if (priv->report_scan_result)
1753 priv->report_scan_result = false;
1754
1755 if (priv->scan_request) {
1756 dev_dbg(adapter->dev, "info: notifying scan done\n");
1757 cfg80211_scan_done(priv->scan_request, 0);
1758 priv->scan_request = NULL;
1759 } else {
1760 priv->scan_aborting = false;
1761 dev_dbg(adapter->dev, "info: scan already aborted\n");
1762 }
1763 } else {
1764 if ((priv->scan_aborting && !priv->scan_request) ||
1765 priv->scan_block) {
1766 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1767 flags);
1768 adapter->scan_delay_cnt = MWIFIEX_MAX_SCAN_DELAY_CNT;
1769 mod_timer(&priv->scan_delay_timer, jiffies);
1770 dev_dbg(priv->adapter->dev,
1771 "info: %s: triggerring scan abort\n", __func__);
1772 } else if (!mwifiex_wmm_lists_empty(adapter) &&
1773 (priv->scan_request && (priv->scan_request->flags &
1774 NL80211_SCAN_FLAG_LOW_PRIORITY))) {
1775 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1776 flags);
1777 adapter->scan_delay_cnt = 1;
1778 mod_timer(&priv->scan_delay_timer, jiffies +
1779 msecs_to_jiffies(MWIFIEX_SCAN_DELAY_MSEC));
1780 dev_dbg(priv->adapter->dev,
1781 "info: %s: deferring scan\n", __func__);
1782 } else {
1783 /* Get scan command from scan_pending_q and put to
1784 * cmd_pending_q
1785 */
1786 cmd_node = list_first_entry(&adapter->scan_pending_q,
1787 struct cmd_ctrl_node, list);
1788 list_del(&cmd_node->list);
1789 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1790 flags);
1791 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node,
1792 true);
1793 }
1794 }
1795
1796 return;
1797}
1798
1729/* 1799/*
1730 * This function handles the command response of scan. 1800 * This function handles the command response of scan.
1731 * 1801 *
@@ -1750,7 +1820,6 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1750{ 1820{
1751 int ret = 0; 1821 int ret = 0;
1752 struct mwifiex_adapter *adapter = priv->adapter; 1822 struct mwifiex_adapter *adapter = priv->adapter;
1753 struct cmd_ctrl_node *cmd_node;
1754 struct host_cmd_ds_802_11_scan_rsp *scan_rsp; 1823 struct host_cmd_ds_802_11_scan_rsp *scan_rsp;
1755 struct mwifiex_ie_types_data *tlv_data; 1824 struct mwifiex_ie_types_data *tlv_data;
1756 struct mwifiex_ie_types_tsf_timestamp *tsf_tlv; 1825 struct mwifiex_ie_types_tsf_timestamp *tsf_tlv;
@@ -1762,7 +1831,6 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1762 struct mwifiex_ie_types_chan_band_list_param_set *chan_band_tlv; 1831 struct mwifiex_ie_types_chan_band_list_param_set *chan_band_tlv;
1763 struct chan_band_param_set *chan_band; 1832 struct chan_band_param_set *chan_band;
1764 u8 is_bgscan_resp; 1833 u8 is_bgscan_resp;
1765 unsigned long flags;
1766 __le64 fw_tsf = 0; 1834 __le64 fw_tsf = 0;
1767 u8 *radio_type; 1835 u8 *radio_type;
1768 1836
@@ -1852,66 +1920,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1852 } 1920 }
1853 1921
1854check_next_scan: 1922check_next_scan:
1855 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); 1923 mwifiex_check_next_scan_command(priv);
1856 if (list_empty(&adapter->scan_pending_q)) {
1857 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
1858 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1859 adapter->scan_processing = false;
1860 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1861
1862 /* Need to indicate IOCTL complete */
1863 if (adapter->curr_cmd->wait_q_enabled) {
1864 adapter->cmd_wait_q.status = 0;
1865 if (!priv->scan_request) {
1866 dev_dbg(adapter->dev,
1867 "complete internal scan\n");
1868 mwifiex_complete_cmd(adapter,
1869 adapter->curr_cmd);
1870 }
1871 }
1872 if (priv->report_scan_result)
1873 priv->report_scan_result = false;
1874
1875 if (priv->scan_request) {
1876 dev_dbg(adapter->dev, "info: notifying scan done\n");
1877 cfg80211_scan_done(priv->scan_request, 0);
1878 priv->scan_request = NULL;
1879 } else {
1880 priv->scan_aborting = false;
1881 dev_dbg(adapter->dev, "info: scan already aborted\n");
1882 }
1883 } else {
1884 if ((priv->scan_aborting && !priv->scan_request) ||
1885 priv->scan_block) {
1886 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1887 flags);
1888 adapter->scan_delay_cnt = MWIFIEX_MAX_SCAN_DELAY_CNT;
1889 mod_timer(&priv->scan_delay_timer, jiffies);
1890 dev_dbg(priv->adapter->dev,
1891 "info: %s: triggerring scan abort\n", __func__);
1892 } else if (!mwifiex_wmm_lists_empty(adapter) &&
1893 (priv->scan_request && (priv->scan_request->flags &
1894 NL80211_SCAN_FLAG_LOW_PRIORITY))) {
1895 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1896 flags);
1897 adapter->scan_delay_cnt = 1;
1898 mod_timer(&priv->scan_delay_timer, jiffies +
1899 msecs_to_jiffies(MWIFIEX_SCAN_DELAY_MSEC));
1900 dev_dbg(priv->adapter->dev,
1901 "info: %s: deferring scan\n", __func__);
1902 } else {
1903 /* Get scan command from scan_pending_q and put to
1904 cmd_pending_q */
1905 cmd_node = list_first_entry(&adapter->scan_pending_q,
1906 struct cmd_ctrl_node, list);
1907 list_del(&cmd_node->list);
1908 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1909 flags);
1910 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node,
1911 true);
1912 }
1913 }
1914
1915 return ret; 1924 return ret;
1916} 1925}
1917 1926