OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008-2009 Atheros Communications Inc. | 2 * Copyright (c) 2008-2009 Atheros Communications Inc. |
3 * | 3 * |
4 * Permission to use, copy, modify, and/or distribute this software for any | 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 | 5 * purpose with or without fee is hereby granted, provided that the above |
6 * copyright notice and this permission notice appear in all copies. | 6 * copyright notice and this permission notice appear in all copies. |
7 * | 7 * |
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 spin_unlock_bh(&sc->sc_pcu_lock); | 263 spin_unlock_bh(&sc->sc_pcu_lock); |
264 | 264 |
265 ath9k_ps_restore(sc); | 265 ath9k_ps_restore(sc); |
266 return r; | 266 return r; |
267 } | 267 } |
268 | 268 |
269 static void ath_paprd_activate(struct ath_softc *sc) | 269 static void ath_paprd_activate(struct ath_softc *sc) |
270 { | 270 { |
271 struct ath_hw *ah = sc->sc_ah; | 271 struct ath_hw *ah = sc->sc_ah; |
272 struct ath9k_hw_cal_data *caldata = ah->caldata; | 272 struct ath9k_hw_cal_data *caldata = ah->caldata; |
| 273 struct ath_common *common = ath9k_hw_common(ah); |
273 int chain; | 274 int chain; |
274 | 275 |
275 if (!caldata || !caldata->paprd_done) | 276 if (!caldata || !caldata->paprd_done) |
276 return; | 277 return; |
277 | 278 |
278 ath9k_ps_wakeup(sc); | 279 ath9k_ps_wakeup(sc); |
279 ar9003_paprd_enable(ah, false); | 280 ar9003_paprd_enable(ah, false); |
280 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { | 281 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
281 » » if (!(ah->caps.tx_chainmask & BIT(chain))) | 282 » » if (!(common->tx_chainmask & BIT(chain))) |
282 continue; | 283 continue; |
283 | 284 |
284 ar9003_paprd_populate_single_table(ah, caldata, chain); | 285 ar9003_paprd_populate_single_table(ah, caldata, chain); |
285 } | 286 } |
286 | 287 |
287 ar9003_paprd_enable(ah, true); | 288 ar9003_paprd_enable(ah, true); |
288 ath9k_ps_restore(sc); | 289 ath9k_ps_restore(sc); |
289 } | 290 } |
290 | 291 |
291 void ath_paprd_calibrate(struct work_struct *work) | 292 void ath_paprd_calibrate(struct work_struct *work) |
292 { | 293 { |
293 struct ath_softc *sc = container_of(work, struct ath_softc, paprd_work); | 294 struct ath_softc *sc = container_of(work, struct ath_softc, paprd_work); |
294 struct ieee80211_hw *hw = sc->hw; | 295 struct ieee80211_hw *hw = sc->hw; |
295 struct ath_hw *ah = sc->sc_ah; | 296 struct ath_hw *ah = sc->sc_ah; |
296 struct ieee80211_hdr *hdr; | 297 struct ieee80211_hdr *hdr; |
297 struct sk_buff *skb = NULL; | 298 struct sk_buff *skb = NULL; |
298 struct ieee80211_tx_info *tx_info; | 299 struct ieee80211_tx_info *tx_info; |
299 int band = hw->conf.channel->band; | 300 int band = hw->conf.channel->band; |
300 struct ieee80211_supported_band *sband = &sc->sbands[band]; | 301 struct ieee80211_supported_band *sband = &sc->sbands[band]; |
301 struct ath_tx_control txctl; | 302 struct ath_tx_control txctl; |
302 struct ath9k_hw_cal_data *caldata = ah->caldata; | 303 struct ath9k_hw_cal_data *caldata = ah->caldata; |
303 » int qnum, ftype; | 304 » struct ath_common *common = ath9k_hw_common(ah); |
| 305 » int ftype; |
304 int chain_ok = 0; | 306 int chain_ok = 0; |
305 int chain; | 307 int chain; |
306 int len = 1800; | 308 int len = 1800; |
307 int time_left; | 309 int time_left; |
308 int i; | 310 int i; |
309 | 311 |
310 if (!caldata) | 312 if (!caldata) |
311 return; | 313 return; |
312 | 314 |
313 skb = alloc_skb(len, GFP_KERNEL); | 315 skb = alloc_skb(len, GFP_KERNEL); |
314 if (!skb) | 316 if (!skb) |
315 return; | 317 return; |
316 | 318 |
317 tx_info = IEEE80211_SKB_CB(skb); | 319 tx_info = IEEE80211_SKB_CB(skb); |
318 | 320 |
319 skb_put(skb, len); | 321 skb_put(skb, len); |
320 memset(skb->data, 0, len); | 322 memset(skb->data, 0, len); |
321 hdr = (struct ieee80211_hdr *)skb->data; | 323 hdr = (struct ieee80211_hdr *)skb->data; |
322 ftype = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC; | 324 ftype = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC; |
323 hdr->frame_control = cpu_to_le16(ftype); | 325 hdr->frame_control = cpu_to_le16(ftype); |
324 hdr->duration_id = cpu_to_le16(10); | 326 hdr->duration_id = cpu_to_le16(10); |
325 memcpy(hdr->addr1, hw->wiphy->perm_addr, ETH_ALEN); | 327 memcpy(hdr->addr1, hw->wiphy->perm_addr, ETH_ALEN); |
326 memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); | 328 memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); |
327 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); | 329 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); |
328 | 330 |
329 memset(&txctl, 0, sizeof(txctl)); | 331 memset(&txctl, 0, sizeof(txctl)); |
330 » qnum = sc->tx.hwq_map[WME_AC_BE]; | 332 » txctl.txq = sc->tx.txq_map[WME_AC_BE]; |
331 » txctl.txq = &sc->tx.txq[qnum]; | |
332 | 333 |
333 ath9k_ps_wakeup(sc); | 334 ath9k_ps_wakeup(sc); |
334 ar9003_paprd_init_table(ah); | 335 ar9003_paprd_init_table(ah); |
335 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { | 336 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
336 » » if (!(ah->caps.tx_chainmask & BIT(chain))) | 337 » » if (!(common->tx_chainmask & BIT(chain))) |
337 continue; | 338 continue; |
338 | 339 |
339 chain_ok = 0; | 340 chain_ok = 0; |
340 memset(tx_info, 0, sizeof(*tx_info)); | 341 memset(tx_info, 0, sizeof(*tx_info)); |
341 tx_info->band = band; | 342 tx_info->band = band; |
342 | 343 |
343 for (i = 0; i < 4; i++) { | 344 for (i = 0; i < 4; i++) { |
344 tx_info->control.rates[i].idx = sband->n_bitrates - 1; | 345 tx_info->control.rates[i].idx = sband->n_bitrates - 1; |
345 tx_info->control.rates[i].count = 6; | 346 tx_info->control.rates[i].count = 6; |
346 } | 347 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 int i; | 545 int i; |
545 | 546 |
546 ath9k_ps_wakeup(sc); | 547 ath9k_ps_wakeup(sc); |
547 | 548 |
548 for (i = 0; i < 3; i++) { | 549 for (i = 0; i < 3; i++) { |
549 if (ath9k_hw_check_alive(sc->sc_ah)) | 550 if (ath9k_hw_check_alive(sc->sc_ah)) |
550 goto out; | 551 goto out; |
551 | 552 |
552 msleep(1); | 553 msleep(1); |
553 } | 554 } |
554 » ath_reset(sc, false); | 555 » ath_reset(sc, true); |
555 | 556 |
556 out: | 557 out: |
557 ath9k_ps_restore(sc); | 558 ath9k_ps_restore(sc); |
558 } | 559 } |
559 | 560 |
560 void ath9k_tasklet(unsigned long data) | 561 void ath9k_tasklet(unsigned long data) |
561 { | 562 { |
562 struct ath_softc *sc = (struct ath_softc *)data; | 563 struct ath_softc *sc = (struct ath_softc *)data; |
563 struct ath_hw *ah = sc->sc_ah; | 564 struct ath_hw *ah = sc->sc_ah; |
564 struct ath_common *common = ath9k_hw_common(ah); | 565 struct ath_common *common = ath9k_hw_common(ah); |
565 | 566 |
566 u32 status = sc->intrstatus; | 567 u32 status = sc->intrstatus; |
567 u32 rxmask; | 568 u32 rxmask; |
568 | 569 |
569 ath9k_ps_wakeup(sc); | 570 ath9k_ps_wakeup(sc); |
570 | 571 |
571 if (status & ATH9K_INT_FATAL) { | 572 if (status & ATH9K_INT_FATAL) { |
572 » » ath_reset(sc, false); | 573 » » ath_reset(sc, true); |
573 ath9k_ps_restore(sc); | 574 ath9k_ps_restore(sc); |
574 return; | 575 return; |
575 } | 576 } |
576 | 577 |
577 spin_lock_bh(&sc->sc_pcu_lock); | 578 spin_lock_bh(&sc->sc_pcu_lock); |
578 | 579 |
579 if (!ath9k_hw_check_alive(ah)) | 580 if (!ath9k_hw_check_alive(ah)) |
580 ieee80211_queue_work(sc->hw, &sc->hw_check_work); | 581 ieee80211_queue_work(sc->hw, &sc->hw_check_work); |
581 | 582 |
582 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | 583 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 | 980 |
980 ieee80211_wake_queues(hw); | 981 ieee80211_wake_queues(hw); |
981 spin_unlock_bh(&sc->sc_pcu_lock); | 982 spin_unlock_bh(&sc->sc_pcu_lock); |
982 | 983 |
983 /* Start ANI */ | 984 /* Start ANI */ |
984 ath_start_ani(common); | 985 ath_start_ani(common); |
985 | 986 |
986 return r; | 987 return r; |
987 } | 988 } |
988 | 989 |
989 static int ath_get_hal_qnum(u16 queue, struct ath_softc *sc) | |
990 { | |
991 int qnum; | |
992 | |
993 switch (queue) { | |
994 case 0: | |
995 qnum = sc->tx.hwq_map[WME_AC_VO]; | |
996 break; | |
997 case 1: | |
998 qnum = sc->tx.hwq_map[WME_AC_VI]; | |
999 break; | |
1000 case 2: | |
1001 qnum = sc->tx.hwq_map[WME_AC_BE]; | |
1002 break; | |
1003 case 3: | |
1004 qnum = sc->tx.hwq_map[WME_AC_BK]; | |
1005 break; | |
1006 default: | |
1007 qnum = sc->tx.hwq_map[WME_AC_BE]; | |
1008 break; | |
1009 } | |
1010 | |
1011 return qnum; | |
1012 } | |
1013 | |
1014 int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc) | |
1015 { | |
1016 int qnum; | |
1017 | |
1018 switch (queue) { | |
1019 case WME_AC_VO: | |
1020 qnum = 0; | |
1021 break; | |
1022 case WME_AC_VI: | |
1023 qnum = 1; | |
1024 break; | |
1025 case WME_AC_BE: | |
1026 qnum = 2; | |
1027 break; | |
1028 case WME_AC_BK: | |
1029 qnum = 3; | |
1030 break; | |
1031 default: | |
1032 qnum = -1; | |
1033 break; | |
1034 } | |
1035 | |
1036 return qnum; | |
1037 } | |
1038 | |
1039 /* XXX: Remove me once we don't depend on ath9k_channel for all | 990 /* XXX: Remove me once we don't depend on ath9k_channel for all |
1040 * this redundant data */ | 991 * this redundant data */ |
1041 void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw, | 992 void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw, |
1042 struct ath9k_channel *ichan) | 993 struct ath9k_channel *ichan) |
1043 { | 994 { |
1044 struct ieee80211_channel *chan = hw->conf.channel; | 995 struct ieee80211_channel *chan = hw->conf.channel; |
1045 struct ieee80211_conf *conf = &hw->conf; | 996 struct ieee80211_conf *conf = &hw->conf; |
1046 | 997 |
1047 ichan->channel = chan->center_freq; | 998 ichan->channel = chan->center_freq; |
1048 ichan->chan = chan; | 999 ichan->chan = chan; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 static int ath9k_tx(struct ieee80211_hw *hw, | 1152 static int ath9k_tx(struct ieee80211_hw *hw, |
1202 struct sk_buff *skb) | 1153 struct sk_buff *skb) |
1203 { | 1154 { |
1204 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1155 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1205 struct ath_wiphy *aphy = hw->priv; | 1156 struct ath_wiphy *aphy = hw->priv; |
1206 struct ath_softc *sc = aphy->sc; | 1157 struct ath_softc *sc = aphy->sc; |
1207 struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1158 struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1208 struct ath_tx_control txctl; | 1159 struct ath_tx_control txctl; |
1209 int padpos, padsize; | 1160 int padpos, padsize; |
1210 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1161 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1211 int qnum; | |
1212 | 1162 |
1213 if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) { | 1163 if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) { |
1214 ath_print(common, ATH_DBG_XMIT, | 1164 ath_print(common, ATH_DBG_XMIT, |
1215 "ath9k: %s: TX in unexpected wiphy state " | 1165 "ath9k: %s: TX in unexpected wiphy state " |
1216 "%d\n", wiphy_name(hw->wiphy), aphy->state); | 1166 "%d\n", wiphy_name(hw->wiphy), aphy->state); |
1217 goto exit; | 1167 goto exit; |
1218 } | 1168 } |
1219 | 1169 |
1220 if (sc->ps_enabled) { | 1170 if (sc->ps_enabled) { |
1221 /* | 1171 /* |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 /* Add the padding after the header if this is not already done */ | 1224 /* Add the padding after the header if this is not already done */ |
1275 padpos = ath9k_cmn_padpos(hdr->frame_control); | 1225 padpos = ath9k_cmn_padpos(hdr->frame_control); |
1276 padsize = padpos & 3; | 1226 padsize = padpos & 3; |
1277 if (padsize && skb->len>padpos) { | 1227 if (padsize && skb->len>padpos) { |
1278 if (skb_headroom(skb) < padsize) | 1228 if (skb_headroom(skb) < padsize) |
1279 return -1; | 1229 return -1; |
1280 skb_push(skb, padsize); | 1230 skb_push(skb, padsize); |
1281 memmove(skb->data, skb->data + padsize, padpos); | 1231 memmove(skb->data, skb->data + padsize, padpos); |
1282 } | 1232 } |
1283 | 1233 |
1284 » qnum = ath_get_hal_qnum(skb_get_queue_mapping(skb), sc); | 1234 » txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; |
1285 » txctl.txq = &sc->tx.txq[qnum]; | |
1286 | 1235 |
1287 ath_print(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb); | 1236 ath_print(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb); |
1288 | 1237 |
1289 if (ath_tx_start(hw, skb, &txctl) != 0) { | 1238 if (ath_tx_start(hw, skb, &txctl) != 0) { |
1290 ath_print(common, ATH_DBG_XMIT, "TX failed\n"); | 1239 ath_print(common, ATH_DBG_XMIT, "TX failed\n"); |
1291 goto exit; | 1240 goto exit; |
1292 } | 1241 } |
1293 | 1242 |
1294 return 0; | 1243 return 0; |
1295 exit: | 1244 exit: |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 | 1678 |
1730 return 0; | 1679 return 0; |
1731 } | 1680 } |
1732 | 1681 |
1733 static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, | 1682 static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, |
1734 const struct ieee80211_tx_queue_params *params) | 1683 const struct ieee80211_tx_queue_params *params) |
1735 { | 1684 { |
1736 struct ath_wiphy *aphy = hw->priv; | 1685 struct ath_wiphy *aphy = hw->priv; |
1737 struct ath_softc *sc = aphy->sc; | 1686 struct ath_softc *sc = aphy->sc; |
1738 struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1687 struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
| 1688 struct ath_txq *txq; |
1739 struct ath9k_tx_queue_info qi; | 1689 struct ath9k_tx_queue_info qi; |
1740 » int ret = 0, qnum; | 1690 » int ret = 0; |
1741 | 1691 |
1742 if (queue >= WME_NUM_AC) | 1692 if (queue >= WME_NUM_AC) |
1743 return 0; | 1693 return 0; |
1744 | 1694 |
| 1695 txq = sc->tx.txq_map[queue]; |
| 1696 |
1745 mutex_lock(&sc->mutex); | 1697 mutex_lock(&sc->mutex); |
1746 | 1698 |
1747 memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); | 1699 memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); |
1748 | 1700 |
1749 qi.tqi_aifs = params->aifs; | 1701 qi.tqi_aifs = params->aifs; |
1750 qi.tqi_cwmin = params->cw_min; | 1702 qi.tqi_cwmin = params->cw_min; |
1751 qi.tqi_cwmax = params->cw_max; | 1703 qi.tqi_cwmax = params->cw_max; |
1752 qi.tqi_burstTime = params->txop; | 1704 qi.tqi_burstTime = params->txop; |
1753 qnum = ath_get_hal_qnum(queue, sc); | |
1754 | 1705 |
1755 ath_print(common, ATH_DBG_CONFIG, | 1706 ath_print(common, ATH_DBG_CONFIG, |
1756 "Configure tx [queue/halq] [%d/%d], " | 1707 "Configure tx [queue/halq] [%d/%d], " |
1757 "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", | 1708 "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", |
1758 » » queue, qnum, params->aifs, params->cw_min, | 1709 » » queue, txq->axq_qnum, params->aifs, params->cw_min, |
1759 params->cw_max, params->txop); | 1710 params->cw_max, params->txop); |
1760 | 1711 |
1761 » ret = ath_txq_update(sc, qnum, &qi); | 1712 » ret = ath_txq_update(sc, txq->axq_qnum, &qi); |
1762 if (ret) | 1713 if (ret) |
1763 ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n"); | 1714 ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n"); |
1764 | 1715 |
1765 if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) | 1716 if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) |
1766 » » if ((qnum == sc->tx.hwq_map[WME_AC_BE]) && !ret) | 1717 » » if (queue == WME_AC_BE && !ret) |
1767 ath_beaconq_config(sc); | 1718 ath_beaconq_config(sc); |
1768 | 1719 |
1769 mutex_unlock(&sc->mutex); | 1720 mutex_unlock(&sc->mutex); |
1770 | 1721 |
1771 return ret; | 1722 return ret; |
1772 } | 1723 } |
1773 | 1724 |
1774 static int ath9k_set_key(struct ieee80211_hw *hw, | 1725 static int ath9k_set_key(struct ieee80211_hw *hw, |
1775 enum set_key_cmd cmd, | 1726 enum set_key_cmd cmd, |
1776 struct ieee80211_vif *vif, | 1727 struct ieee80211_vif *vif, |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 .get_tsf = ath9k_get_tsf, | 2049 .get_tsf = ath9k_get_tsf, |
2099 .set_tsf = ath9k_set_tsf, | 2050 .set_tsf = ath9k_set_tsf, |
2100 .reset_tsf = ath9k_reset_tsf, | 2051 .reset_tsf = ath9k_reset_tsf, |
2101 .ampdu_action = ath9k_ampdu_action, | 2052 .ampdu_action = ath9k_ampdu_action, |
2102 .get_survey = ath9k_get_survey, | 2053 .get_survey = ath9k_get_survey, |
2103 .sw_scan_start = ath9k_sw_scan_start, | 2054 .sw_scan_start = ath9k_sw_scan_start, |
2104 .sw_scan_complete = ath9k_sw_scan_complete, | 2055 .sw_scan_complete = ath9k_sw_scan_complete, |
2105 .rfkill_poll = ath9k_rfkill_poll_state, | 2056 .rfkill_poll = ath9k_rfkill_poll_state, |
2106 .set_coverage_class = ath9k_set_coverage_class, | 2057 .set_coverage_class = ath9k_set_coverage_class, |
2107 }; | 2058 }; |
OLD | NEW |