aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/main.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-01-24 13:23:16 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-28 15:41:59 -0500
commit7545daf498c43e548506212310e6c75382d2731d (patch)
treeee200bd829e29e41875c2576792c186bdde88264 /drivers/net/wireless/ath/ath9k/main.c
parent34302397e5b980ce561366b63504e9d82948e8b8 (diff)
ath9k: remove support for virtual wiphys
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c141
1 files changed, 5 insertions, 136 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 2b27c81b06c..2d995108086 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1089,29 +1089,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1089 1089
1090 mutex_lock(&sc->mutex); 1090 mutex_lock(&sc->mutex);
1091 1091
1092 if (ath9k_wiphy_started(sc)) {
1093 if (sc->chan_idx == curchan->hw_value) {
1094 /*
1095 * Already on the operational channel, the new wiphy
1096 * can be marked active.
1097 */
1098 aphy->state = ATH_WIPHY_ACTIVE;
1099 ieee80211_wake_queues(hw);
1100 } else {
1101 /*
1102 * Another wiphy is on another channel, start the new
1103 * wiphy in paused state.
1104 */
1105 aphy->state = ATH_WIPHY_PAUSED;
1106 ieee80211_stop_queues(hw);
1107 }
1108 mutex_unlock(&sc->mutex);
1109 return 0;
1110 }
1111 aphy->state = ATH_WIPHY_ACTIVE;
1112
1113 /* setup initial channel */ 1092 /* setup initial channel */
1114
1115 sc->chan_idx = curchan->hw_value; 1093 sc->chan_idx = curchan->hw_value;
1116 1094
1117 init_channel = ath_get_curchannel(sc, hw); 1095 init_channel = ath_get_curchannel(sc, hw);
@@ -1221,13 +1199,6 @@ static int ath9k_tx(struct ieee80211_hw *hw,
1221 struct ath_tx_control txctl; 1199 struct ath_tx_control txctl;
1222 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1200 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1223 1201
1224 if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) {
1225 ath_dbg(common, ATH_DBG_XMIT,
1226 "ath9k: %s: TX in unexpected wiphy state %d\n",
1227 wiphy_name(hw->wiphy), aphy->state);
1228 goto exit;
1229 }
1230
1231 if (sc->ps_enabled) { 1202 if (sc->ps_enabled) {
1232 /* 1203 /*
1233 * mac80211 does not set PM field for normal data frames, so we 1204 * mac80211 does not set PM field for normal data frames, so we
@@ -1290,12 +1261,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1290 struct ath_softc *sc = aphy->sc; 1261 struct ath_softc *sc = aphy->sc;
1291 struct ath_hw *ah = sc->sc_ah; 1262 struct ath_hw *ah = sc->sc_ah;
1292 struct ath_common *common = ath9k_hw_common(ah); 1263 struct ath_common *common = ath9k_hw_common(ah);
1293 int i;
1294 1264
1295 mutex_lock(&sc->mutex); 1265 mutex_lock(&sc->mutex);
1296 1266
1297 aphy->state = ATH_WIPHY_INACTIVE;
1298
1299 if (led_blink) 1267 if (led_blink)
1300 cancel_delayed_work_sync(&sc->ath_led_blink_work); 1268 cancel_delayed_work_sync(&sc->ath_led_blink_work);
1301 1269
@@ -1303,27 +1271,12 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1303 cancel_work_sync(&sc->paprd_work); 1271 cancel_work_sync(&sc->paprd_work);
1304 cancel_work_sync(&sc->hw_check_work); 1272 cancel_work_sync(&sc->hw_check_work);
1305 1273
1306 for (i = 0; i < sc->num_sec_wiphy; i++) {
1307 if (sc->sec_wiphy[i])
1308 break;
1309 }
1310
1311 if (i == sc->num_sec_wiphy) {
1312 cancel_delayed_work_sync(&sc->wiphy_work);
1313 cancel_work_sync(&sc->chan_work);
1314 }
1315
1316 if (sc->sc_flags & SC_OP_INVALID) { 1274 if (sc->sc_flags & SC_OP_INVALID) {
1317 ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); 1275 ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
1318 mutex_unlock(&sc->mutex); 1276 mutex_unlock(&sc->mutex);
1319 return; 1277 return;
1320 } 1278 }
1321 1279
1322 if (ath9k_wiphy_started(sc)) {
1323 mutex_unlock(&sc->mutex);
1324 return; /* another wiphy still in use */
1325 }
1326
1327 /* Ensure HW is awake when we try to shut it down. */ 1280 /* Ensure HW is awake when we try to shut it down. */
1328 ath9k_ps_wakeup(sc); 1281 ath9k_ps_wakeup(sc);
1329 1282
@@ -1355,7 +1308,6 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1355 ath9k_ps_restore(sc); 1308 ath9k_ps_restore(sc);
1356 1309
1357 sc->ps_idle = true; 1310 sc->ps_idle = true;
1358 ath9k_set_wiphy_idle(aphy, true);
1359 ath_radio_disable(sc, hw); 1311 ath_radio_disable(sc, hw);
1360 1312
1361 sc->sc_flags |= SC_OP_INVALID; 1313 sc->sc_flags |= SC_OP_INVALID;
@@ -1445,7 +1397,6 @@ void ath9k_calculate_iter_data(struct ieee80211_hw *hw,
1445 struct ath_softc *sc = aphy->sc; 1397 struct ath_softc *sc = aphy->sc;
1446 struct ath_hw *ah = sc->sc_ah; 1398 struct ath_hw *ah = sc->sc_ah;
1447 struct ath_common *common = ath9k_hw_common(ah); 1399 struct ath_common *common = ath9k_hw_common(ah);
1448 int i;
1449 1400
1450 /* 1401 /*
1451 * Use the hardware MAC address as reference, the hardware uses it 1402 * Use the hardware MAC address as reference, the hardware uses it
@@ -1459,16 +1410,8 @@ void ath9k_calculate_iter_data(struct ieee80211_hw *hw,
1459 ath9k_vif_iter(iter_data, vif->addr, vif); 1410 ath9k_vif_iter(iter_data, vif->addr, vif);
1460 1411
1461 /* Get list of all active MAC addresses */ 1412 /* Get list of all active MAC addresses */
1462 spin_lock_bh(&sc->wiphy_lock);
1463 ieee80211_iterate_active_interfaces_atomic(sc->hw, ath9k_vif_iter, 1413 ieee80211_iterate_active_interfaces_atomic(sc->hw, ath9k_vif_iter,
1464 iter_data); 1414 iter_data);
1465 for (i = 0; i < sc->num_sec_wiphy; i++) {
1466 if (sc->sec_wiphy[i] == NULL)
1467 continue;
1468 ieee80211_iterate_active_interfaces_atomic(
1469 sc->sec_wiphy[i]->hw, ath9k_vif_iter, iter_data);
1470 }
1471 spin_unlock_bh(&sc->wiphy_lock);
1472} 1415}
1473 1416
1474/* Called with sc->mutex held. */ 1417/* Called with sc->mutex held. */
@@ -1722,7 +1665,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1722 struct ath_hw *ah = sc->sc_ah; 1665 struct ath_hw *ah = sc->sc_ah;
1723 struct ath_common *common = ath9k_hw_common(ah); 1666 struct ath_common *common = ath9k_hw_common(ah);
1724 struct ieee80211_conf *conf = &hw->conf; 1667 struct ieee80211_conf *conf = &hw->conf;
1725 bool disable_radio; 1668 bool disable_radio = false;
1726 1669
1727 mutex_lock(&sc->mutex); 1670 mutex_lock(&sc->mutex);
1728 1671
@@ -1733,29 +1676,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1733 * the end. 1676 * the end.
1734 */ 1677 */
1735 if (changed & IEEE80211_CONF_CHANGE_IDLE) { 1678 if (changed & IEEE80211_CONF_CHANGE_IDLE) {
1736 bool enable_radio; 1679 sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE);
1737 bool all_wiphys_idle; 1680 if (!sc->ps_idle) {
1738 bool idle = !!(conf->flags & IEEE80211_CONF_IDLE);
1739
1740 spin_lock_bh(&sc->wiphy_lock);
1741 all_wiphys_idle = ath9k_all_wiphys_idle(sc);
1742 ath9k_set_wiphy_idle(aphy, idle);
1743
1744 enable_radio = (!idle && all_wiphys_idle);
1745
1746 /*
1747 * After we unlock here its possible another wiphy
1748 * can be re-renabled so to account for that we will
1749 * only disable the radio toward the end of this routine
1750 * if by then all wiphys are still idle.
1751 */
1752 spin_unlock_bh(&sc->wiphy_lock);
1753
1754 if (enable_radio) {
1755 sc->ps_idle = false;
1756 ath_radio_enable(sc, hw); 1681 ath_radio_enable(sc, hw);
1757 ath_dbg(common, ATH_DBG_CONFIG, 1682 ath_dbg(common, ATH_DBG_CONFIG,
1758 "not-idle: enabling radio\n"); 1683 "not-idle: enabling radio\n");
1684 } else {
1685 disable_radio = true;
1759 } 1686 }
1760 } 1687 }
1761 1688
@@ -1796,24 +1723,11 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1796 if (ah->curchan) 1723 if (ah->curchan)
1797 old_pos = ah->curchan - &ah->channels[0]; 1724 old_pos = ah->curchan - &ah->channels[0];
1798 1725
1799 aphy->chan_idx = pos;
1800 aphy->chan_is_ht = conf_is_ht(conf);
1801 if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) 1726 if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
1802 sc->sc_flags |= SC_OP_OFFCHANNEL; 1727 sc->sc_flags |= SC_OP_OFFCHANNEL;
1803 else 1728 else
1804 sc->sc_flags &= ~SC_OP_OFFCHANNEL; 1729 sc->sc_flags &= ~SC_OP_OFFCHANNEL;
1805 1730
1806 if (aphy->state == ATH_WIPHY_SCAN ||
1807 aphy->state == ATH_WIPHY_ACTIVE)
1808 ath9k_wiphy_pause_all_forced(sc, aphy);
1809 else {
1810 /*
1811 * Do not change operational channel based on a paused
1812 * wiphy changes.
1813 */
1814 goto skip_chan_change;
1815 }
1816
1817 ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n", 1731 ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
1818 curchan->center_freq); 1732 curchan->center_freq);
1819 1733
@@ -1860,19 +1774,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1860 ath_update_survey_nf(sc, old_pos); 1774 ath_update_survey_nf(sc, old_pos);
1861 } 1775 }
1862 1776
1863skip_chan_change:
1864 if (changed & IEEE80211_CONF_CHANGE_POWER) { 1777 if (changed & IEEE80211_CONF_CHANGE_POWER) {
1865 sc->config.txpowlimit = 2 * conf->power_level; 1778 sc->config.txpowlimit = 2 * conf->power_level;
1866 ath_update_txpow(sc); 1779 ath_update_txpow(sc);
1867 } 1780 }
1868 1781
1869 spin_lock_bh(&sc->wiphy_lock);
1870 disable_radio = ath9k_all_wiphys_idle(sc);
1871 spin_unlock_bh(&sc->wiphy_lock);
1872
1873 if (disable_radio) { 1782 if (disable_radio) {
1874 ath_dbg(common, ATH_DBG_CONFIG, "idle: disabling radio\n"); 1783 ath_dbg(common, ATH_DBG_CONFIG, "idle: disabling radio\n");
1875 sc->ps_idle = true;
1876 ath_radio_disable(sc, hw); 1784 ath_radio_disable(sc, hw);
1877 } 1785 }
1878 1786
@@ -2263,43 +2171,6 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
2263 return 0; 2171 return 0;
2264} 2172}
2265 2173
2266static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
2267{
2268 struct ath_wiphy *aphy = hw->priv;
2269 struct ath_softc *sc = aphy->sc;
2270
2271 mutex_lock(&sc->mutex);
2272 if (ath9k_wiphy_scanning(sc)) {
2273 /*
2274 * There is a race here in mac80211 but fixing it requires
2275 * we revisit how we handle the scan complete callback.
2276 * After mac80211 fixes we will not have configured hardware
2277 * to the home channel nor would we have configured the RX
2278 * filter yet.
2279 */
2280 mutex_unlock(&sc->mutex);
2281 return;
2282 }
2283
2284 aphy->state = ATH_WIPHY_SCAN;
2285 ath9k_wiphy_pause_all_forced(sc, aphy);
2286 mutex_unlock(&sc->mutex);
2287}
2288
2289/*
2290 * XXX: this requires a revisit after the driver
2291 * scan_complete gets moved to another place/removed in mac80211.
2292 */
2293static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
2294{
2295 struct ath_wiphy *aphy = hw->priv;
2296 struct ath_softc *sc = aphy->sc;
2297
2298 mutex_lock(&sc->mutex);
2299 aphy->state = ATH_WIPHY_ACTIVE;
2300 mutex_unlock(&sc->mutex);
2301}
2302
2303static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) 2174static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
2304{ 2175{
2305 struct ath_wiphy *aphy = hw->priv; 2176 struct ath_wiphy *aphy = hw->priv;
@@ -2331,8 +2202,6 @@ struct ieee80211_ops ath9k_ops = {
2331 .reset_tsf = ath9k_reset_tsf, 2202 .reset_tsf = ath9k_reset_tsf,
2332 .ampdu_action = ath9k_ampdu_action, 2203 .ampdu_action = ath9k_ampdu_action,
2333 .get_survey = ath9k_get_survey, 2204 .get_survey = ath9k_get_survey,
2334 .sw_scan_start = ath9k_sw_scan_start,
2335 .sw_scan_complete = ath9k_sw_scan_complete,
2336 .rfkill_poll = ath9k_rfkill_poll_state, 2205 .rfkill_poll = ath9k_rfkill_poll_state,
2337 .set_coverage_class = ath9k_set_coverage_class, 2206 .set_coverage_class = ath9k_set_coverage_class,
2338}; 2207};