main.c (088eef2219bd1e8cb82bfcb5b32c1c687aeea6d7) main.c (047dc3ac884f3285bc123461e5e3c38f44fb32a6)
1/*
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 179 unchanged lines hidden (view full) ---

188 bool ret = true;
189
190 ieee80211_stop_queues(sc->hw);
191
192 sc->hw_busy_count = 0;
193 ath_stop_ani(sc);
194 del_timer_sync(&sc->rx_poll_timer);
195
1/*
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 179 unchanged lines hidden (view full) ---

188 bool ret = true;
189
190 ieee80211_stop_queues(sc->hw);
191
192 sc->hw_busy_count = 0;
193 ath_stop_ani(sc);
194 del_timer_sync(&sc->rx_poll_timer);
195
196 ath9k_debug_samp_bb_mac(sc);
197 ath9k_hw_disable_interrupts(ah);
198
199 if (!ath_drain_all_txq(sc))
200 ret = false;
201
202 if (!ath_stoprecv(sc))
203 ret = false;
204

--- 29 unchanged lines hidden (view full) ---

234 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
235 } else {
236 ath9k_set_beacon(sc);
237 }
238 work:
239 ath_restart_work(sc);
240 }
241
196 ath9k_hw_disable_interrupts(ah);
197
198 if (!ath_drain_all_txq(sc))
199 ret = false;
200
201 if (!ath_stoprecv(sc))
202 ret = false;
203

--- 29 unchanged lines hidden (view full) ---

233 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
234 } else {
235 ath9k_set_beacon(sc);
236 }
237 work:
238 ath_restart_work(sc);
239 }
240
242 if ((ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) && sc->ant_rx != 3)
243 ath_ant_comb_update(sc);
244
245 ieee80211_wake_queues(sc->hw);
246
247 return true;
248}
249
250static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan)
251{
252 struct ath_hw *ah = sc->sc_ah;

--- 953 unchanged lines hidden (view full) ---

1206 ath_dbg(common, CONFIG, "Set channel: %d MHz type: %d\n",
1207 curchan->center_freq, channel_type);
1208
1209 /* update survey stats for the old channel before switching */
1210 spin_lock_irqsave(&common->cc_lock, flags);
1211 ath_update_survey_stats(sc);
1212 spin_unlock_irqrestore(&common->cc_lock, flags);
1213
241 ieee80211_wake_queues(sc->hw);
242
243 return true;
244}
245
246static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan)
247{
248 struct ath_hw *ah = sc->sc_ah;

--- 953 unchanged lines hidden (view full) ---

1202 ath_dbg(common, CONFIG, "Set channel: %d MHz type: %d\n",
1203 curchan->center_freq, channel_type);
1204
1205 /* update survey stats for the old channel before switching */
1206 spin_lock_irqsave(&common->cc_lock, flags);
1207 ath_update_survey_stats(sc);
1208 spin_unlock_irqrestore(&common->cc_lock, flags);
1209
1214 /*
1215 * Preserve the current channel values, before updating
1216 * the same channel
1217 */
1218 if (ah->curchan && (old_pos == pos))
1219 ath9k_hw_getnf(ah, ah->curchan);
1220
1221 ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
1222 curchan, channel_type);
1223
1224 /*
1225 * If the operating channel changes, change the survey in-use flags
1226 * along with it.
1227 * Reset the survey data for the new channel, unless we're switching
1228 * back to the operating channel from an off-channel operation.

--- 39 unchanged lines hidden (view full) ---

1268 rxfilter = ath9k_hw_getrxfilter(ah);
1269 rxfilter |= ATH9K_RX_FILTER_PHYRADAR |
1270 ATH9K_RX_FILTER_PHYERR;
1271 ath9k_hw_setrxfilter(ah, rxfilter);
1272 ath_dbg(common, DFS, "DFS enabled at freq %d\n",
1273 curchan->center_freq);
1274 } else {
1275 /* perform spectral scan if requested. */
1210 ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
1211 curchan, channel_type);
1212
1213 /*
1214 * If the operating channel changes, change the survey in-use flags
1215 * along with it.
1216 * Reset the survey data for the new channel, unless we're switching
1217 * back to the operating channel from an off-channel operation.

--- 39 unchanged lines hidden (view full) ---

1257 rxfilter = ath9k_hw_getrxfilter(ah);
1258 rxfilter |= ATH9K_RX_FILTER_PHYRADAR |
1259 ATH9K_RX_FILTER_PHYERR;
1260 ath9k_hw_setrxfilter(ah, rxfilter);
1261 ath_dbg(common, DFS, "DFS enabled at freq %d\n",
1262 curchan->center_freq);
1263 } else {
1264 /* perform spectral scan if requested. */
1276 if (sc->scanning &&
1265 if (test_bit(SC_OP_SCANNING, &sc->sc_flags) &&
1277 sc->spectral_mode == SPECTRAL_CHANSCAN)
1278 ath9k_spectral_scan_trigger(hw);
1279 }
1280 }
1281
1282 if (changed & IEEE80211_CONF_CHANGE_POWER) {
1283 ath_dbg(common, CONFIG, "Set power: %d\n", conf->power_level);
1284 sc->config.txpowlimit = 2 * conf->power_level;

--- 397 unchanged lines hidden (view full) ---

1682
1683static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1684 struct ieee80211_vif *vif,
1685 enum ieee80211_ampdu_mlme_action action,
1686 struct ieee80211_sta *sta,
1687 u16 tid, u16 *ssn, u8 buf_size)
1688{
1689 struct ath_softc *sc = hw->priv;
1266 sc->spectral_mode == SPECTRAL_CHANSCAN)
1267 ath9k_spectral_scan_trigger(hw);
1268 }
1269 }
1270
1271 if (changed & IEEE80211_CONF_CHANGE_POWER) {
1272 ath_dbg(common, CONFIG, "Set power: %d\n", conf->power_level);
1273 sc->config.txpowlimit = 2 * conf->power_level;

--- 397 unchanged lines hidden (view full) ---

1671
1672static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1673 struct ieee80211_vif *vif,
1674 enum ieee80211_ampdu_mlme_action action,
1675 struct ieee80211_sta *sta,
1676 u16 tid, u16 *ssn, u8 buf_size)
1677{
1678 struct ath_softc *sc = hw->priv;
1679 bool flush = false;
1690 int ret = 0;
1691
1680 int ret = 0;
1681
1692 local_bh_disable();
1682 mutex_lock(&sc->mutex);
1693
1694 switch (action) {
1695 case IEEE80211_AMPDU_RX_START:
1696 break;
1697 case IEEE80211_AMPDU_RX_STOP:
1698 break;
1699 case IEEE80211_AMPDU_TX_START:
1700 ath9k_ps_wakeup(sc);
1701 ret = ath_tx_aggr_start(sc, sta, tid, ssn);
1702 if (!ret)
1703 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1704 ath9k_ps_restore(sc);
1705 break;
1683
1684 switch (action) {
1685 case IEEE80211_AMPDU_RX_START:
1686 break;
1687 case IEEE80211_AMPDU_RX_STOP:
1688 break;
1689 case IEEE80211_AMPDU_TX_START:
1690 ath9k_ps_wakeup(sc);
1691 ret = ath_tx_aggr_start(sc, sta, tid, ssn);
1692 if (!ret)
1693 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1694 ath9k_ps_restore(sc);
1695 break;
1706 case IEEE80211_AMPDU_TX_STOP_CONT:
1707 case IEEE80211_AMPDU_TX_STOP_FLUSH:
1708 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
1696 case IEEE80211_AMPDU_TX_STOP_FLUSH:
1697 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
1698 flush = true;
1699 case IEEE80211_AMPDU_TX_STOP_CONT:
1709 ath9k_ps_wakeup(sc);
1710 ath_tx_aggr_stop(sc, sta, tid);
1700 ath9k_ps_wakeup(sc);
1701 ath_tx_aggr_stop(sc, sta, tid);
1711 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1702 if (!flush)
1703 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1712 ath9k_ps_restore(sc);
1713 break;
1714 case IEEE80211_AMPDU_TX_OPERATIONAL:
1715 ath9k_ps_wakeup(sc);
1716 ath_tx_aggr_resume(sc, sta, tid);
1717 ath9k_ps_restore(sc);
1718 break;
1719 default:
1720 ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n");
1721 }
1722
1704 ath9k_ps_restore(sc);
1705 break;
1706 case IEEE80211_AMPDU_TX_OPERATIONAL:
1707 ath9k_ps_wakeup(sc);
1708 ath_tx_aggr_resume(sc, sta, tid);
1709 ath9k_ps_restore(sc);
1710 break;
1711 default:
1712 ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n");
1713 }
1714
1723 local_bh_enable();
1715 mutex_unlock(&sc->mutex);
1724
1725 return ret;
1726}
1727
1728static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
1729 struct survey_info *survey)
1730{
1731 struct ath_softc *sc = hw->priv;

--- 267 unchanged lines hidden (view full) ---

1999 sc->wow_enabled = *wow_triggers;
2000
2001}
2002
2003static void ath9k_wow_add_disassoc_deauth_pattern(struct ath_softc *sc)
2004{
2005 struct ath_hw *ah = sc->sc_ah;
2006 struct ath_common *common = ath9k_hw_common(ah);
1716
1717 return ret;
1718}
1719
1720static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
1721 struct survey_info *survey)
1722{
1723 struct ath_softc *sc = hw->priv;

--- 267 unchanged lines hidden (view full) ---

1991 sc->wow_enabled = *wow_triggers;
1992
1993}
1994
1995static void ath9k_wow_add_disassoc_deauth_pattern(struct ath_softc *sc)
1996{
1997 struct ath_hw *ah = sc->sc_ah;
1998 struct ath_common *common = ath9k_hw_common(ah);
2007 struct ath9k_hw_capabilities *pcaps = &ah->caps;
2008 int pattern_count = 0;
2009 int i, byte_cnt;
2010 u8 dis_deauth_pattern[MAX_PATTERN_SIZE];
2011 u8 dis_deauth_mask[MAX_PATTERN_SIZE];
2012
2013 memset(dis_deauth_pattern, 0, MAX_PATTERN_SIZE);
2014 memset(dis_deauth_mask, 0, MAX_PATTERN_SIZE);
2015

--- 53 unchanged lines hidden (view full) ---

2069 byte_cnt += 6;
2070
2071 /* copy the bssid, its same as the source mac address */
2072
2073 memcpy((dis_deauth_pattern + byte_cnt), common->curbssid, ETH_ALEN);
2074
2075 /* Create Disassociate pattern mask */
2076
1999 int pattern_count = 0;
2000 int i, byte_cnt;
2001 u8 dis_deauth_pattern[MAX_PATTERN_SIZE];
2002 u8 dis_deauth_mask[MAX_PATTERN_SIZE];
2003
2004 memset(dis_deauth_pattern, 0, MAX_PATTERN_SIZE);
2005 memset(dis_deauth_mask, 0, MAX_PATTERN_SIZE);
2006

--- 53 unchanged lines hidden (view full) ---

2060 byte_cnt += 6;
2061
2062 /* copy the bssid, its same as the source mac address */
2063
2064 memcpy((dis_deauth_pattern + byte_cnt), common->curbssid, ETH_ALEN);
2065
2066 /* Create Disassociate pattern mask */
2067
2077 if (pcaps->hw_caps & ATH9K_HW_WOW_PATTERN_MATCH_EXACT) {
2068 dis_deauth_mask[0] = 0xfe;
2069 dis_deauth_mask[1] = 0x03;
2070 dis_deauth_mask[2] = 0xc0;
2078
2071
2079 if (pcaps->hw_caps & ATH9K_HW_WOW_PATTERN_MATCH_DWORD) {
2080 /*
2081 * for AR9280, because of hardware limitation, the
2082 * first 4 bytes have to be matched for all patterns.
2083 * the mask for disassociation and de-auth pattern
2084 * matching need to enable the first 4 bytes.
2085 * also the duration field needs to be filled.
2086 */
2087 dis_deauth_mask[0] = 0xf0;
2088
2089 /*
2090 * fill in duration field
2091 FIXME: what is the exact value ?
2092 */
2093 dis_deauth_pattern[2] = 0xff;
2094 dis_deauth_pattern[3] = 0xff;
2095 } else {
2096 dis_deauth_mask[0] = 0xfe;
2097 }
2098
2099 dis_deauth_mask[1] = 0x03;
2100 dis_deauth_mask[2] = 0xc0;
2101 } else {
2102 dis_deauth_mask[0] = 0xef;
2103 dis_deauth_mask[1] = 0x3f;
2104 dis_deauth_mask[2] = 0x00;
2105 dis_deauth_mask[3] = 0xfc;
2106 }
2107
2108 ath_dbg(common, WOW, "Adding disassoc/deauth patterns for WoW\n");
2109
2110 ath9k_hw_wow_apply_pattern(ah, dis_deauth_pattern, dis_deauth_mask,
2111 pattern_count, byte_cnt);
2112
2113 pattern_count++;
2114 /*
2115 * for de-authenticate pattern, only the first byte of the frame

--- 6 unchanged lines hidden (view full) ---

2122
2123}
2124
2125static void ath9k_wow_add_pattern(struct ath_softc *sc,
2126 struct cfg80211_wowlan *wowlan)
2127{
2128 struct ath_hw *ah = sc->sc_ah;
2129 struct ath9k_wow_pattern *wow_pattern = NULL;
2072 ath_dbg(common, WOW, "Adding disassoc/deauth patterns for WoW\n");
2073
2074 ath9k_hw_wow_apply_pattern(ah, dis_deauth_pattern, dis_deauth_mask,
2075 pattern_count, byte_cnt);
2076
2077 pattern_count++;
2078 /*
2079 * for de-authenticate pattern, only the first byte of the frame

--- 6 unchanged lines hidden (view full) ---

2086
2087}
2088
2089static void ath9k_wow_add_pattern(struct ath_softc *sc,
2090 struct cfg80211_wowlan *wowlan)
2091{
2092 struct ath_hw *ah = sc->sc_ah;
2093 struct ath9k_wow_pattern *wow_pattern = NULL;
2130 struct cfg80211_wowlan_trig_pkt_pattern *patterns = wowlan->patterns;
2094 struct cfg80211_pkt_pattern *patterns = wowlan->patterns;
2131 int mask_len;
2132 s8 i = 0;
2133
2134 if (!wowlan->n_patterns)
2135 return;
2136
2137 /*
2138 * Add the new user configured patterns

--- 195 unchanged lines hidden (view full) ---

2334 device_set_wakeup_enable(sc->dev, enabled);
2335 mutex_unlock(&sc->mutex);
2336}
2337
2338#endif
2339static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
2340{
2341 struct ath_softc *sc = hw->priv;
2095 int mask_len;
2096 s8 i = 0;
2097
2098 if (!wowlan->n_patterns)
2099 return;
2100
2101 /*
2102 * Add the new user configured patterns

--- 195 unchanged lines hidden (view full) ---

2298 device_set_wakeup_enable(sc->dev, enabled);
2299 mutex_unlock(&sc->mutex);
2300}
2301
2302#endif
2303static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
2304{
2305 struct ath_softc *sc = hw->priv;
2342
2343 sc->scanning = 1;
2306 set_bit(SC_OP_SCANNING, &sc->sc_flags);
2344}
2345
2346static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
2347{
2348 struct ath_softc *sc = hw->priv;
2307}
2308
2309static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
2310{
2311 struct ath_softc *sc = hw->priv;
2349
2350 sc->scanning = 0;
2312 clear_bit(SC_OP_SCANNING, &sc->sc_flags);
2351}
2352
2353struct ieee80211_ops ath9k_ops = {
2354 .tx = ath9k_tx,
2355 .start = ath9k_start,
2356 .stop = ath9k_stop,
2357 .add_interface = ath9k_add_interface,
2358 .change_interface = ath9k_change_interface,

--- 11 unchanged lines hidden (view full) ---

2370 .reset_tsf = ath9k_reset_tsf,
2371 .ampdu_action = ath9k_ampdu_action,
2372 .get_survey = ath9k_get_survey,
2373 .rfkill_poll = ath9k_rfkill_poll_state,
2374 .set_coverage_class = ath9k_set_coverage_class,
2375 .flush = ath9k_flush,
2376 .tx_frames_pending = ath9k_tx_frames_pending,
2377 .tx_last_beacon = ath9k_tx_last_beacon,
2313}
2314
2315struct ieee80211_ops ath9k_ops = {
2316 .tx = ath9k_tx,
2317 .start = ath9k_start,
2318 .stop = ath9k_stop,
2319 .add_interface = ath9k_add_interface,
2320 .change_interface = ath9k_change_interface,

--- 11 unchanged lines hidden (view full) ---

2332 .reset_tsf = ath9k_reset_tsf,
2333 .ampdu_action = ath9k_ampdu_action,
2334 .get_survey = ath9k_get_survey,
2335 .rfkill_poll = ath9k_rfkill_poll_state,
2336 .set_coverage_class = ath9k_set_coverage_class,
2337 .flush = ath9k_flush,
2338 .tx_frames_pending = ath9k_tx_frames_pending,
2339 .tx_last_beacon = ath9k_tx_last_beacon,
2340 .release_buffered_frames = ath9k_release_buffered_frames,
2378 .get_stats = ath9k_get_stats,
2379 .set_antenna = ath9k_set_antenna,
2380 .get_antenna = ath9k_get_antenna,
2381
2382#ifdef CONFIG_PM_SLEEP
2383 .suspend = ath9k_suspend,
2384 .resume = ath9k_resume,
2385 .set_wakeup = ath9k_set_wakeup,

--- 15 unchanged lines hidden ---
2341 .get_stats = ath9k_get_stats,
2342 .set_antenna = ath9k_set_antenna,
2343 .get_antenna = ath9k_get_antenna,
2344
2345#ifdef CONFIG_PM_SLEEP
2346 .suspend = ath9k_suspend,
2347 .resume = ath9k_resume,
2348 .set_wakeup = ath9k_set_wakeup,

--- 15 unchanged lines hidden ---