aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-08-14 03:57:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:24:04 -0400
commitff9b662dab1fcd885fb728de3a8c13ebb5455117 (patch)
treef07e329f9a9f4f446f407318fd1694d3df84f6d9 /drivers/net
parentdc2222a85fd63103b9aad0d4b77c4d87b78c58a2 (diff)
ath9k: Miscellaneous fixes
This patch removes ath_vap_listen() and dma wrapper macros. Also, Inline abuse is cleaned up and a few typos are fixed. Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath9k/beacon.c52
-rw-r--r--drivers/net/wireless/ath9k/core.c74
-rw-r--r--drivers/net/wireless/ath9k/core.h6
-rw-r--r--drivers/net/wireless/ath9k/hw.c68
-rw-r--r--drivers/net/wireless/ath9k/main.c19
-rw-r--r--drivers/net/wireless/ath9k/xmit.c29
6 files changed, 79 insertions, 169 deletions
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index a020f9a21544..89e5c65accd0 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -114,21 +114,21 @@ static void ath_beacon_setup(struct ath_softc *sc,
114 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) 114 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
115 rate |= rt->info[rix].shortPreamble; 115 rate |= rt->info[rix].shortPreamble;
116 116
117 ath9k_hw_set11n_txdesc(ah, ds 117 ath9k_hw_set11n_txdesc(ah, ds,
118 , skb->len + FCS_LEN /* frame length */ 118 skb->len + FCS_LEN, /* frame length */
119 , ATH9K_PKT_TYPE_BEACON /* Atheros packet type */ 119 ATH9K_PKT_TYPE_BEACON, /* Atheros packet type */
120 , avp->av_btxctl.txpower /* txpower XXX */ 120 avp->av_btxctl.txpower, /* txpower XXX */
121 , ATH9K_TXKEYIX_INVALID /* no encryption */ 121 ATH9K_TXKEYIX_INVALID, /* no encryption */
122 , ATH9K_KEY_TYPE_CLEAR /* no encryption */ 122 ATH9K_KEY_TYPE_CLEAR, /* no encryption */
123 , flags /* no ack, veol for beacons */ 123 flags /* no ack, veol for beacons */
124 ); 124 );
125 125
126 /* NB: beacon's BufLen must be a multiple of 4 bytes */ 126 /* NB: beacon's BufLen must be a multiple of 4 bytes */
127 ath9k_hw_filltxdesc(ah, ds 127 ath9k_hw_filltxdesc(ah, ds,
128 , roundup(skb->len, 4) /* buffer length */ 128 roundup(skb->len, 4), /* buffer length */
129 , true /* first segment */ 129 true, /* first segment */
130 , true /* last segment */ 130 true, /* last segment */
131 , ds /* first descriptor */ 131 ds /* first descriptor */
132 ); 132 );
133 133
134 memzero(series, sizeof(struct ath9k_11n_rate_series) * 4); 134 memzero(series, sizeof(struct ath9k_11n_rate_series) * 4);
@@ -551,7 +551,7 @@ void ath_beacon_free(struct ath_softc *sc)
551 551
552void ath9k_beacon_tasklet(unsigned long data) 552void ath9k_beacon_tasklet(unsigned long data)
553{ 553{
554#define TSF_TO_TU(_h,_l) \ 554#define TSF_TO_TU(_h,_l) \
555 ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) 555 ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
556 556
557 struct ath_softc *sc = (struct ath_softc *)data; 557 struct ath_softc *sc = (struct ath_softc *)data;
@@ -898,19 +898,19 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
898 "cfp:period %u " 898 "cfp:period %u "
899 "maxdur %u " 899 "maxdur %u "
900 "next %u " 900 "next %u "
901 "timoffset %u\n" 901 "timoffset %u\n",
902 , __func__ 902 __func__,
903 , (unsigned long long)tsf, tsftu 903 (unsigned long long)tsf, tsftu,
904 , bs.bs_intval 904 bs.bs_intval,
905 , bs.bs_nexttbtt 905 bs.bs_nexttbtt,
906 , bs.bs_dtimperiod 906 bs.bs_dtimperiod,
907 , bs.bs_nextdtim 907 bs.bs_nextdtim,
908 , bs.bs_bmissthreshold 908 bs.bs_bmissthreshold,
909 , bs.bs_sleepduration 909 bs.bs_sleepduration,
910 , bs.bs_cfpperiod 910 bs.bs_cfpperiod,
911 , bs.bs_cfpmaxduration 911 bs.bs_cfpmaxduration,
912 , bs.bs_cfpnext 912 bs.bs_cfpnext,
913 , bs.bs_timoffset 913 bs.bs_timoffset
914 ); 914 );
915 915
916 ath9k_hw_set_interrupts(ah, 0); 916 ath9k_hw_set_interrupts(ah, 0);
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c
index e3682b6ccfb2..57645ee83efb 100644
--- a/drivers/net/wireless/ath9k/core.c
+++ b/drivers/net/wireless/ath9k/core.c
@@ -51,10 +51,8 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz)
51 * Set current operating mode 51 * Set current operating mode
52 * 52 *
53 * This function initializes and fills the rate table in the ATH object based 53 * This function initializes and fills the rate table in the ATH object based
54 * on the operating mode. The blink rates are also set up here, although 54 * on the operating mode.
55 * they have been superceeded by the ath_led module.
56*/ 55*/
57
58static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode) 56static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode)
59{ 57{
60 const struct ath9k_rate_table *rt; 58 const struct ath9k_rate_table *rt;
@@ -232,7 +230,7 @@ static int ath_setup_channels(struct ath_softc *sc)
232 * Determine mode from channel flags 230 * Determine mode from channel flags
233 * 231 *
234 * This routine will provide the enumerated WIRELESSS_MODE value based 232 * This routine will provide the enumerated WIRELESSS_MODE value based
235 * on the settings of the channel flags. If ho valid set of flags 233 * on the settings of the channel flags. If no valid set of flags
236 * exist, the lowest mode (11b) is selected. 234 * exist, the lowest mode (11b) is selected.
237*/ 235*/
238 236
@@ -257,7 +255,8 @@ static enum wireless_mode ath_chan2mode(struct ath9k_channel *chan)
257 else if (chan->chanmode == CHANNEL_G_HT40MINUS) 255 else if (chan->chanmode == CHANNEL_G_HT40MINUS)
258 return ATH9K_MODE_11NG_HT40MINUS; 256 return ATH9K_MODE_11NG_HT40MINUS;
259 257
260 /* NB: should not get here */ 258 WARN_ON(1); /* should not get here */
259
261 return ATH9K_MODE_11B; 260 return ATH9K_MODE_11B;
262} 261}
263 262
@@ -278,8 +277,6 @@ static int ath_stop(struct ath_softc *sc)
278 /* 277 /*
279 * Shutdown the hardware and driver: 278 * Shutdown the hardware and driver:
280 * stop output from above 279 * stop output from above
281 * reset 802.11 state machine
282 * (sends station deassoc/deauth frames)
283 * turn off timers 280 * turn off timers
284 * disable interrupts 281 * disable interrupts
285 * clear transmit machinery 282 * clear transmit machinery
@@ -499,69 +496,6 @@ void ath_update_chainmask(struct ath_softc *sc, int is_ht)
499/* VAP management */ 496/* VAP management */
500/******************/ 497/******************/
501 498
502/*
503 * VAP in Listen mode
504 *
505 * This routine brings the VAP out of the down state into a "listen" state
506 * where it waits for association requests. This is used in AP and AdHoc
507 * modes.
508*/
509
510int ath_vap_listen(struct ath_softc *sc, int if_id)
511{
512 struct ath_hal *ah = sc->sc_ah;
513 struct ath_vap *avp;
514 u32 rfilt = 0;
515 DECLARE_MAC_BUF(mac);
516
517 avp = sc->sc_vaps[if_id];
518 if (avp == NULL) {
519 DPRINTF(sc, ATH_DBG_FATAL, "%s: invalid interface id %u\n",
520 __func__, if_id);
521 return -EINVAL;
522 }
523
524#ifdef CONFIG_SLOW_ANT_DIV
525 ath_slow_ant_div_stop(&sc->sc_antdiv);
526#endif
527
528 /* update ratectrl about the new state */
529 ath_rate_newstate(sc, avp);
530
531 rfilt = ath_calcrxfilter(sc);
532 ath9k_hw_setrxfilter(ah, rfilt);
533
534 if (sc->sc_ah->ah_opmode == ATH9K_M_STA ||
535 sc->sc_ah->ah_opmode == ATH9K_M_IBSS) {
536 memcpy(sc->sc_curbssid, ath_bcast_mac, ETH_ALEN);
537 ath9k_hw_write_associd(ah, sc->sc_curbssid, sc->sc_curaid);
538 } else
539 sc->sc_curaid = 0;
540
541 DPRINTF(sc, ATH_DBG_CONFIG,
542 "%s: RX filter 0x%x bssid %s aid 0x%x\n",
543 __func__, rfilt, print_mac(mac,
544 sc->sc_curbssid), sc->sc_curaid);
545
546 /*
547 * XXXX
548 * Disable BMISS interrupt when we're not associated
549 */
550 if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) {
551 ath9k_hw_set_interrupts(ah, sc->sc_imask & ~ATH9K_INT_BMISS);
552 sc->sc_imask &= ~ATH9K_INT_BMISS;
553 } else {
554 ath9k_hw_set_interrupts(
555 ah,
556 sc->sc_imask & ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS));
557 sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
558 }
559 /* need to reconfigure the beacons when it moves to RUN */
560 sc->sc_flags &= ~SC_OP_BEACONS;
561
562 return 0;
563}
564
565int ath_vap_attach(struct ath_softc *sc, 499int ath_vap_attach(struct ath_softc *sc,
566 int if_id, 500 int if_id,
567 struct ieee80211_vif *if_data, 501 struct ieee80211_vif *if_data,
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 51bf528e4c15..406225ba4521 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -82,9 +82,6 @@ struct ath_node;
82/* XXX: remove */ 82/* XXX: remove */
83#define memzero(_buf, _len) memset(_buf, 0, _len) 83#define memzero(_buf, _len) memset(_buf, 0, _len)
84 84
85#define get_dma_mem_context(var, field) (&((var)->field))
86#define copy_dma_mem_context(dst, src) (*dst = *src)
87
88#define ATH9K_BH_STATUS_INTACT 0 85#define ATH9K_BH_STATUS_INTACT 0
89#define ATH9K_BH_STATUS_CHANGE 1 86#define ATH9K_BH_STATUS_CHANGE 1
90 87
@@ -769,8 +766,7 @@ int ath_vap_attach(struct ath_softc *sc,
769 enum ath9k_opmode opmode); 766 enum ath9k_opmode opmode);
770int ath_vap_detach(struct ath_softc *sc, int if_id); 767int ath_vap_detach(struct ath_softc *sc, int if_id);
771int ath_vap_config(struct ath_softc *sc, 768int ath_vap_config(struct ath_softc *sc,
772 int if_id, struct ath_vap_config *if_config); 769 int if_id, struct ath_vap_config *if_config);
773int ath_vap_listen(struct ath_softc *sc, int if_id);
774 770
775/*********************/ 771/*********************/
776/* Antenna diversity */ 772/* Antenna diversity */
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 7d8c908d69d5..47c60acac41f 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -348,7 +348,7 @@ static void ath9k_hw_set_defaults(struct ath_hal *ah)
348 ah->ah_config.intr_mitigation = 0; 348 ah->ah_config.intr_mitigation = 0;
349} 349}
350 350
351static inline void ath9k_hw_override_ini(struct ath_hal *ah, 351static void ath9k_hw_override_ini(struct ath_hal *ah,
352 struct ath9k_channel *chan) 352 struct ath9k_channel *chan)
353{ 353{
354 if (!AR_SREV_5416_V20_OR_LATER(ah) 354 if (!AR_SREV_5416_V20_OR_LATER(ah)
@@ -358,8 +358,8 @@ static inline void ath9k_hw_override_ini(struct ath_hal *ah,
358 REG_WRITE(ah, 0x9800 + (651 << 2), 0x11); 358 REG_WRITE(ah, 0x9800 + (651 << 2), 0x11);
359} 359}
360 360
361static inline void ath9k_hw_init_bb(struct ath_hal *ah, 361static void ath9k_hw_init_bb(struct ath_hal *ah,
362 struct ath9k_channel *chan) 362 struct ath9k_channel *chan)
363{ 363{
364 u32 synthDelay; 364 u32 synthDelay;
365 365
@@ -374,8 +374,8 @@ static inline void ath9k_hw_init_bb(struct ath_hal *ah,
374 udelay(synthDelay + BASE_ACTIVATE_DELAY); 374 udelay(synthDelay + BASE_ACTIVATE_DELAY);
375} 375}
376 376
377static inline void ath9k_hw_init_interrupt_masks(struct ath_hal *ah, 377static void ath9k_hw_init_interrupt_masks(struct ath_hal *ah,
378 enum ath9k_opmode opmode) 378 enum ath9k_opmode opmode)
379{ 379{
380 struct ath_hal_5416 *ahp = AH5416(ah); 380 struct ath_hal_5416 *ahp = AH5416(ah);
381 381
@@ -405,7 +405,7 @@ static inline void ath9k_hw_init_interrupt_masks(struct ath_hal *ah,
405 } 405 }
406} 406}
407 407
408static inline void ath9k_hw_init_qos(struct ath_hal *ah) 408static void ath9k_hw_init_qos(struct ath_hal *ah)
409{ 409{
410 REG_WRITE(ah, AR_MIC_QOS_CONTROL, 0x100aa); 410 REG_WRITE(ah, AR_MIC_QOS_CONTROL, 0x100aa);
411 REG_WRITE(ah, AR_MIC_QOS_SELECT, 0x3210); 411 REG_WRITE(ah, AR_MIC_QOS_SELECT, 0x3210);
@@ -500,7 +500,7 @@ static inline bool ath9k_hw_nvram_read(struct ath_hal *ah,
500 return ath9k_hw_eeprom_read(ah, off, data); 500 return ath9k_hw_eeprom_read(ah, off, data);
501} 501}
502 502
503static inline bool ath9k_hw_fill_eeprom(struct ath_hal *ah) 503static bool ath9k_hw_fill_eeprom(struct ath_hal *ah)
504{ 504{
505 struct ath_hal_5416 *ahp = AH5416(ah); 505 struct ath_hal_5416 *ahp = AH5416(ah);
506 struct ar5416_eeprom *eep = &ahp->ah_eeprom; 506 struct ar5416_eeprom *eep = &ahp->ah_eeprom;
@@ -767,7 +767,7 @@ ath9k_hw_eeprom_set_board_values(struct ath_hal *ah,
767 return true; 767 return true;
768} 768}
769 769
770static inline int ath9k_hw_check_eeprom(struct ath_hal *ah) 770static int ath9k_hw_check_eeprom(struct ath_hal *ah)
771{ 771{
772 u32 sum = 0, el; 772 u32 sum = 0, el;
773 u16 *eepdata; 773 u16 *eepdata;
@@ -1272,7 +1272,7 @@ u32 ath9k_hw_get_eeprom(struct ath_hal_5416 *ahp,
1272 } 1272 }
1273} 1273}
1274 1274
1275static inline int ath9k_hw_get_radiorev(struct ath_hal *ah) 1275static int ath9k_hw_get_radiorev(struct ath_hal *ah)
1276{ 1276{
1277 u32 val; 1277 u32 val;
1278 int i; 1278 int i;
@@ -1285,7 +1285,7 @@ static inline int ath9k_hw_get_radiorev(struct ath_hal *ah)
1285 return ath9k_hw_reverse_bits(val, 8); 1285 return ath9k_hw_reverse_bits(val, 8);
1286} 1286}
1287 1287
1288static inline int ath9k_hw_init_macaddr(struct ath_hal *ah) 1288static int ath9k_hw_init_macaddr(struct ath_hal *ah)
1289{ 1289{
1290 u32 sum; 1290 u32 sum;
1291 int i; 1291 int i;
@@ -1367,7 +1367,7 @@ static u16 ath9k_hw_eeprom_get_spur_chan(struct ath_hal *ah,
1367 return spur_val; 1367 return spur_val;
1368} 1368}
1369 1369
1370static inline int ath9k_hw_rfattach(struct ath_hal *ah) 1370static int ath9k_hw_rfattach(struct ath_hal *ah)
1371{ 1371{
1372 bool rfStatus = false; 1372 bool rfStatus = false;
1373 int ecode = 0; 1373 int ecode = 0;
@@ -1412,8 +1412,8 @@ static int ath9k_hw_rf_claim(struct ath_hal *ah)
1412 return 0; 1412 return 0;
1413} 1413}
1414 1414
1415static inline void ath9k_hw_init_pll(struct ath_hal *ah, 1415static void ath9k_hw_init_pll(struct ath_hal *ah,
1416 struct ath9k_channel *chan) 1416 struct ath9k_channel *chan)
1417{ 1417{
1418 u32 pll; 1418 u32 pll;
1419 1419
@@ -1531,7 +1531,7 @@ static void ath9k_hw_set_operating_mode(struct ath_hal *ah, int opmode)
1531 } 1531 }
1532} 1532}
1533 1533
1534static inline void 1534static void
1535ath9k_hw_set_rfmode(struct ath_hal *ah, struct ath9k_channel *chan) 1535ath9k_hw_set_rfmode(struct ath_hal *ah, struct ath9k_channel *chan)
1536{ 1536{
1537 u32 rfMode = 0; 1537 u32 rfMode = 0;
@@ -1601,7 +1601,7 @@ static bool ath9k_hw_set_reset(struct ath_hal *ah, int type)
1601 return true; 1601 return true;
1602} 1602}
1603 1603
1604static inline bool ath9k_hw_set_reset_power_on(struct ath_hal *ah) 1604static bool ath9k_hw_set_reset_power_on(struct ath_hal *ah)
1605{ 1605{
1606 REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN | 1606 REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN |
1607 AR_RTC_FORCE_WAKE_ON_INT); 1607 AR_RTC_FORCE_WAKE_ON_INT);
@@ -1642,7 +1642,7 @@ static bool ath9k_hw_set_reset_reg(struct ath_hal *ah,
1642 } 1642 }
1643} 1643}
1644 1644
1645static inline 1645static
1646struct ath9k_channel *ath9k_hw_check_chan(struct ath_hal *ah, 1646struct ath9k_channel *ath9k_hw_check_chan(struct ath_hal *ah,
1647 struct ath9k_channel *chan) 1647 struct ath9k_channel *chan)
1648{ 1648{
@@ -2076,7 +2076,7 @@ static void ath9k_hw_ani_attach(struct ath_hal *ah)
2076 ahp->ah_procPhyErr |= HAL_PROCESS_ANI; 2076 ahp->ah_procPhyErr |= HAL_PROCESS_ANI;
2077} 2077}
2078 2078
2079static inline void ath9k_hw_ani_setup(struct ath_hal *ah) 2079static void ath9k_hw_ani_setup(struct ath_hal *ah)
2080{ 2080{
2081 struct ath_hal_5416 *ahp = AH5416(ah); 2081 struct ath_hal_5416 *ahp = AH5416(ah);
2082 int i; 2082 int i;
@@ -2861,7 +2861,7 @@ static u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio)
2861 } 2861 }
2862} 2862}
2863 2863
2864static inline int ath9k_hw_post_attach(struct ath_hal *ah) 2864static int ath9k_hw_post_attach(struct ath_hal *ah)
2865{ 2865{
2866 int ecode; 2866 int ecode;
2867 2867
@@ -3573,7 +3573,7 @@ static inline bool ath9k_hw_fill_vpd_table(u8 pwrMin,
3573 return true; 3573 return true;
3574} 3574}
3575 3575
3576static inline void 3576static void
3577ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hal *ah, 3577ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hal *ah,
3578 struct ath9k_channel *chan, 3578 struct ath9k_channel *chan,
3579 struct cal_data_per_freq *pRawDataSet, 3579 struct cal_data_per_freq *pRawDataSet,
@@ -3755,7 +3755,7 @@ ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hal *ah,
3755 return; 3755 return;
3756} 3756}
3757 3757
3758static inline bool 3758static bool
3759ath9k_hw_set_power_cal_table(struct ath_hal *ah, 3759ath9k_hw_set_power_cal_table(struct ath_hal *ah,
3760 struct ar5416_eeprom *pEepData, 3760 struct ar5416_eeprom *pEepData,
3761 struct ath9k_channel *chan, 3761 struct ath9k_channel *chan,
@@ -3958,7 +3958,7 @@ void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore)
3958 } 3958 }
3959} 3959}
3960 3960
3961static inline void 3961static void
3962ath9k_hw_get_legacy_target_powers(struct ath_hal *ah, 3962ath9k_hw_get_legacy_target_powers(struct ath_hal *ah,
3963 struct ath9k_channel *chan, 3963 struct ath9k_channel *chan,
3964 struct cal_target_power_leg *powInfo, 3964 struct cal_target_power_leg *powInfo,
@@ -4024,7 +4024,7 @@ ath9k_hw_get_legacy_target_powers(struct ath_hal *ah,
4024 } 4024 }
4025} 4025}
4026 4026
4027static inline void 4027static void
4028ath9k_hw_get_target_powers(struct ath_hal *ah, 4028ath9k_hw_get_target_powers(struct ath_hal *ah,
4029 struct ath9k_channel *chan, 4029 struct ath9k_channel *chan,
4030 struct cal_target_power_ht *powInfo, 4030 struct cal_target_power_ht *powInfo,
@@ -4091,7 +4091,7 @@ ath9k_hw_get_target_powers(struct ath_hal *ah,
4091 } 4091 }
4092} 4092}
4093 4093
4094static inline u16 4094static u16
4095ath9k_hw_get_max_edge_power(u16 freq, 4095ath9k_hw_get_max_edge_power(u16 freq,
4096 struct cal_ctl_edges *pRdEdgesPower, 4096 struct cal_ctl_edges *pRdEdgesPower,
4097 bool is2GHz) 4097 bool is2GHz)
@@ -4121,7 +4121,7 @@ ath9k_hw_get_max_edge_power(u16 freq,
4121 return twiceMaxEdgePower; 4121 return twiceMaxEdgePower;
4122} 4122}
4123 4123
4124static inline bool 4124static bool
4125ath9k_hw_set_power_per_rate_table(struct ath_hal *ah, 4125ath9k_hw_set_power_per_rate_table(struct ath_hal *ah,
4126 struct ar5416_eeprom *pEepData, 4126 struct ar5416_eeprom *pEepData,
4127 struct ath9k_channel *chan, 4127 struct ath9k_channel *chan,
@@ -5100,7 +5100,7 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah,
5100 REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); 5100 REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
5101} 5101}
5102 5102
5103static inline void ath9k_hw_init_chain_masks(struct ath_hal *ah) 5103static void ath9k_hw_init_chain_masks(struct ath_hal *ah)
5104{ 5104{
5105 struct ath_hal_5416 *ahp = AH5416(ah); 5105 struct ath_hal_5416 *ahp = AH5416(ah);
5106 int rx_chainmask, tx_chainmask; 5106 int rx_chainmask, tx_chainmask;
@@ -5304,7 +5304,7 @@ bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us)
5304 } 5304 }
5305} 5305}
5306 5306
5307static inline void ath9k_hw_init_user_settings(struct ath_hal *ah) 5307static void ath9k_hw_init_user_settings(struct ath_hal *ah)
5308{ 5308{
5309 struct ath_hal_5416 *ahp = AH5416(ah); 5309 struct ath_hal_5416 *ahp = AH5416(ah);
5310 5310
@@ -5323,7 +5323,7 @@ static inline void ath9k_hw_init_user_settings(struct ath_hal *ah)
5323 ath9k_hw_set_global_txtimeout(ah, ahp->ah_globaltxtimeout); 5323 ath9k_hw_set_global_txtimeout(ah, ahp->ah_globaltxtimeout);
5324} 5324}
5325 5325
5326static inline int 5326static int
5327ath9k_hw_process_ini(struct ath_hal *ah, 5327ath9k_hw_process_ini(struct ath_hal *ah,
5328 struct ath9k_channel *chan, 5328 struct ath9k_channel *chan,
5329 enum ath9k_ht_macmode macmode) 5329 enum ath9k_ht_macmode macmode)
@@ -5454,7 +5454,7 @@ ath9k_hw_process_ini(struct ath_hal *ah,
5454 return 0; 5454 return 0;
5455} 5455}
5456 5456
5457static inline void ath9k_hw_setup_calibration(struct ath_hal *ah, 5457static void ath9k_hw_setup_calibration(struct ath_hal *ah,
5458 struct hal_cal_list *currCal) 5458 struct hal_cal_list *currCal)
5459{ 5459{
5460 REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(0), 5460 REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(0),
@@ -5490,8 +5490,8 @@ static inline void ath9k_hw_setup_calibration(struct ath_hal *ah,
5490 AR_PHY_TIMING_CTRL4_DO_CAL); 5490 AR_PHY_TIMING_CTRL4_DO_CAL);
5491} 5491}
5492 5492
5493static inline void ath9k_hw_reset_calibration(struct ath_hal *ah, 5493static void ath9k_hw_reset_calibration(struct ath_hal *ah,
5494 struct hal_cal_list *currCal) 5494 struct hal_cal_list *currCal)
5495{ 5495{
5496 struct ath_hal_5416 *ahp = AH5416(ah); 5496 struct ath_hal_5416 *ahp = AH5416(ah);
5497 int i; 5497 int i;
@@ -5510,7 +5510,7 @@ static inline void ath9k_hw_reset_calibration(struct ath_hal *ah,
5510 ahp->ah_CalSamples = 0; 5510 ahp->ah_CalSamples = 0;
5511} 5511}
5512 5512
5513static inline void 5513static void
5514ath9k_hw_per_calibration(struct ath_hal *ah, 5514ath9k_hw_per_calibration(struct ath_hal *ah,
5515 struct ath9k_channel *ichan, 5515 struct ath9k_channel *ichan,
5516 u8 rxchainmask, 5516 u8 rxchainmask,
@@ -5600,7 +5600,7 @@ static inline bool ath9k_hw_run_init_cals(struct ath_hal *ah,
5600 return true; 5600 return true;
5601} 5601}
5602 5602
5603static inline bool 5603static bool
5604ath9k_hw_channel_change(struct ath_hal *ah, 5604ath9k_hw_channel_change(struct ath_hal *ah,
5605 struct ath9k_channel *chan, 5605 struct ath9k_channel *chan,
5606 enum ath9k_ht_macmode macmode) 5606 enum ath9k_ht_macmode macmode)
@@ -5777,8 +5777,8 @@ static bool ath9k_hw_iscal_supported(struct ath_hal *ah,
5777 return retval; 5777 return retval;
5778} 5778}
5779 5779
5780static inline bool ath9k_hw_init_cal(struct ath_hal *ah, 5780static bool ath9k_hw_init_cal(struct ath_hal *ah,
5781 struct ath9k_channel *chan) 5781 struct ath9k_channel *chan)
5782{ 5782{
5783 struct ath_hal_5416 *ahp = AH5416(ah); 5783 struct ath_hal_5416 *ahp = AH5416(ah);
5784 struct ath9k_channel *ichan = 5784 struct ath9k_channel *ichan =
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 8fbde897406e..605599eb6d3f 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -212,12 +212,10 @@ static int ath_key_config(struct ath_softc *sc,
212 212
213static void ath_key_delete(struct ath_softc *sc, struct ieee80211_key_conf *key) 213static void ath_key_delete(struct ath_softc *sc, struct ieee80211_key_conf *key)
214{ 214{
215#define ATH_MAX_NUM_KEYS 4
216 int freeslot; 215 int freeslot;
217 216
218 freeslot = (key->keyidx >= ATH_MAX_NUM_KEYS) ? 1 : 0; 217 freeslot = (key->keyidx >= 4) ? 1 : 0;
219 ath_key_reset(sc, key->keyidx, freeslot); 218 ath_key_reset(sc, key->keyidx, freeslot);
220#undef ATH_MAX_NUM_KEYS
221} 219}
222 220
223static void setup_ht_cap(struct ieee80211_ht_info *ht_info) 221static void setup_ht_cap(struct ieee80211_ht_info *ht_info)
@@ -620,7 +618,8 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
620 } 618 }
621 619
622 if ((conf->changed & IEEE80211_IFCC_BEACON) && 620 if ((conf->changed & IEEE80211_IFCC_BEACON) &&
623 (vif->type == IEEE80211_IF_TYPE_IBSS)) { 621 ((vif->type == IEEE80211_IF_TYPE_IBSS) ||
622 (vif->type == IEEE80211_IF_TYPE_AP))) {
624 /* 623 /*
625 * Allocate and setup the beacon frame. 624 * Allocate and setup the beacon frame.
626 * 625 *
@@ -638,18 +637,6 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
638 ath_beacon_sync(sc, 0); 637 ath_beacon_sync(sc, 0);
639 } 638 }
640 639
641 if ((conf->changed & IEEE80211_IFCC_BEACON) &&
642 (vif->type == IEEE80211_IF_TYPE_AP)) {
643 ath9k_hw_stoptxdma(sc->sc_ah, sc->sc_bhalq);
644
645 error = ath_beacon_alloc(sc, 0);
646 if (error != 0)
647 return error;
648
649 ath_beacon_config(sc, 0);
650 sc->sc_flags |= SC_OP_BEACONS;
651 }
652
653 /* Check for WLAN_CAPABILITY_PRIVACY ? */ 640 /* Check for WLAN_CAPABILITY_PRIVACY ? */
654 if ((avp->av_opmode != IEEE80211_IF_TYPE_STA)) { 641 if ((avp->av_opmode != IEEE80211_IF_TYPE_STA)) {
655 for (i = 0; i < IEEE80211_WEP_NKID; i++) 642 for (i = 0; i < IEEE80211_WEP_NKID; i++)
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 8d31ad7952be..04f94d2c8010 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -499,7 +499,6 @@ static void ath_tx_complete_buf(struct ath_softc *sc,
499{ 499{
500 struct sk_buff *skb = bf->bf_mpdu; 500 struct sk_buff *skb = bf->bf_mpdu;
501 struct ath_xmit_status tx_status; 501 struct ath_xmit_status tx_status;
502 dma_addr_t *pa;
503 502
504 /* 503 /*
505 * Set retry information. 504 * Set retry information.
@@ -519,9 +518,8 @@ static void ath_tx_complete_buf(struct ath_softc *sc,
519 tx_status.flags |= ATH_TX_XRETRY; 518 tx_status.flags |= ATH_TX_XRETRY;
520 } 519 }
521 /* Unmap this frame */ 520 /* Unmap this frame */
522 pa = get_dma_mem_context(bf, bf_dmacontext);
523 pci_unmap_single(sc->pdev, 521 pci_unmap_single(sc->pdev,
524 *pa, 522 bf->bf_dmacontext,
525 skb->len, 523 skb->len,
526 PCI_DMA_TODEVICE); 524 PCI_DMA_TODEVICE);
527 /* complete this frame */ 525 /* complete this frame */
@@ -1172,11 +1170,8 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
1172 tbf->bf_lastfrm->bf_desc); 1170 tbf->bf_lastfrm->bf_desc);
1173 1171
1174 /* copy the DMA context */ 1172 /* copy the DMA context */
1175 copy_dma_mem_context( 1173 tbf->bf_dmacontext =
1176 get_dma_mem_context(tbf, 1174 bf_last->bf_dmacontext;
1177 bf_dmacontext),
1178 get_dma_mem_context(bf_last,
1179 bf_dmacontext));
1180 } 1175 }
1181 list_add_tail(&tbf->list, &bf_head); 1176 list_add_tail(&tbf->list, &bf_head);
1182 } else { 1177 } else {
@@ -1185,7 +1180,7 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
1185 * software retry 1180 * software retry
1186 */ 1181 */
1187 ath9k_hw_cleartxdesc(sc->sc_ah, 1182 ath9k_hw_cleartxdesc(sc->sc_ah,
1188 bf->bf_lastfrm->bf_desc); 1183 bf->bf_lastfrm->bf_desc);
1189 } 1184 }
1190 1185
1191 /* 1186 /*
@@ -2045,8 +2040,7 @@ static int ath_tx_start_dma(struct ath_softc *sc,
2045 /* 2040 /*
2046 * Save the DMA context in the first ath_buf 2041 * Save the DMA context in the first ath_buf
2047 */ 2042 */
2048 copy_dma_mem_context(get_dma_mem_context(bf, bf_dmacontext), 2043 bf->bf_dmacontext = txctl->dmacontext;
2049 get_dma_mem_context(txctl, dmacontext));
2050 2044
2051 /* 2045 /*
2052 * Formulate first tx descriptor with tx controls. 2046 * Formulate first tx descriptor with tx controls.
@@ -2127,25 +2121,26 @@ static int ath_tx_start_dma(struct ath_softc *sc,
2127 2121
2128static void xmit_map_sg(struct ath_softc *sc, 2122static void xmit_map_sg(struct ath_softc *sc,
2129 struct sk_buff *skb, 2123 struct sk_buff *skb,
2130 dma_addr_t *pa,
2131 struct ath_tx_control *txctl) 2124 struct ath_tx_control *txctl)
2132{ 2125{
2133 struct ath_xmit_status tx_status; 2126 struct ath_xmit_status tx_status;
2134 struct ath_atx_tid *tid; 2127 struct ath_atx_tid *tid;
2135 struct scatterlist sg; 2128 struct scatterlist sg;
2136 2129
2137 *pa = pci_map_single(sc->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); 2130 txctl->dmacontext = pci_map_single(sc->pdev, skb->data,
2131 skb->len, PCI_DMA_TODEVICE);
2138 2132
2139 /* setup S/G list */ 2133 /* setup S/G list */
2140 memset(&sg, 0, sizeof(struct scatterlist)); 2134 memset(&sg, 0, sizeof(struct scatterlist));
2141 sg_dma_address(&sg) = *pa; 2135 sg_dma_address(&sg) = txctl->dmacontext;
2142 sg_dma_len(&sg) = skb->len; 2136 sg_dma_len(&sg) = skb->len;
2143 2137
2144 if (ath_tx_start_dma(sc, skb, &sg, 1, txctl) != 0) { 2138 if (ath_tx_start_dma(sc, skb, &sg, 1, txctl) != 0) {
2145 /* 2139 /*
2146 * We have to do drop frame here. 2140 * We have to do drop frame here.
2147 */ 2141 */
2148 pci_unmap_single(sc->pdev, *pa, skb->len, PCI_DMA_TODEVICE); 2142 pci_unmap_single(sc->pdev, txctl->dmacontext,
2143 skb->len, PCI_DMA_TODEVICE);
2149 2144
2150 tx_status.retries = 0; 2145 tx_status.retries = 0;
2151 tx_status.flags = ATH_TX_ERROR; 2146 tx_status.flags = ATH_TX_ERROR;
@@ -2419,9 +2414,7 @@ int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb)
2419 * ath_tx_start_dma() will be called either synchronously 2414 * ath_tx_start_dma() will be called either synchronously
2420 * or asynchrounsly once DMA is complete. 2415 * or asynchrounsly once DMA is complete.
2421 */ 2416 */
2422 xmit_map_sg(sc, skb, 2417 xmit_map_sg(sc, skb, &txctl);
2423 get_dma_mem_context(&txctl, dmacontext),
2424 &txctl);
2425 else 2418 else
2426 ath_node_put(sc, txctl.an, ATH9K_BH_STATUS_CHANGE); 2419 ath_node_put(sc, txctl.an, ATH9K_BH_STATUS_CHANGE);
2427 2420