aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin McCabe <colin@cozybit.com>2008-12-01 16:38:55 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-05 09:35:47 -0500
commitd97809dbbf1b8a6df79c82be75fa0cababec783b (patch)
treeeadd628167157a49384b7c7297ac3fbabd325863
parent33fd8195529d74c0fe23cddd1c76fe7e03bbd324 (diff)
ath9k: Replace ath9k_opmode with nl80211_iftype
This patch kills ath9k's ath9k_opmode enum by replacing it with nl80211_iftype. Signed-off-by: Colin McCabe <colin@cozybit.com> Signed-off-by: Andrey Yurovsky <andrey@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath9k/ani.c12
-rw-r--r--drivers/net/wireless/ath9k/ath9k.h10
-rw-r--r--drivers/net/wireless/ath9k/beacon.c24
-rw-r--r--drivers/net/wireless/ath9k/core.h2
-rw-r--r--drivers/net/wireless/ath9k/hw.c29
-rw-r--r--drivers/net/wireless/ath9k/main.c51
-rw-r--r--drivers/net/wireless/ath9k/rc.c6
-rw-r--r--drivers/net/wireless/ath9k/recv.c16
-rw-r--r--drivers/net/wireless/ath9k/regd.c2
-rw-r--r--drivers/net/wireless/ath9k/xmit.c3
10 files changed, 81 insertions, 74 deletions
diff --git a/drivers/net/wireless/ath9k/ani.c b/drivers/net/wireless/ath9k/ani.c
index c25b72be1139..251e2d9a7a4a 100644
--- a/drivers/net/wireless/ath9k/ani.c
+++ b/drivers/net/wireless/ath9k/ani.c
@@ -303,7 +303,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
303 } 303 }
304 } 304 }
305 305
306 if (ah->ah_opmode == ATH9K_M_HOSTAP) { 306 if (ah->ah_opmode == NL80211_IFTYPE_AP) {
307 if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) { 307 if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
308 ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 308 ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
309 aniState->firstepLevel + 1); 309 aniState->firstepLevel + 1);
@@ -368,7 +368,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah)
368 return; 368 return;
369 } 369 }
370 } 370 }
371 if (ah->ah_opmode == ATH9K_M_HOSTAP) { 371 if (ah->ah_opmode == NL80211_IFTYPE_AP) {
372 if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) { 372 if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
373 ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 373 ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
374 aniState->firstepLevel + 1); 374 aniState->firstepLevel + 1);
@@ -398,7 +398,7 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah)
398 398
399 aniState = ahp->ah_curani; 399 aniState = ahp->ah_curani;
400 400
401 if (ah->ah_opmode == ATH9K_M_HOSTAP) { 401 if (ah->ah_opmode == NL80211_IFTYPE_AP) {
402 if (aniState->firstepLevel > 0) { 402 if (aniState->firstepLevel > 0) {
403 if (ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 403 if (ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
404 aniState->firstepLevel - 1)) 404 aniState->firstepLevel - 1))
@@ -487,8 +487,8 @@ void ath9k_ani_reset(struct ath_hal *ah)
487 aniState = &ahp->ah_ani[index]; 487 aniState = &ahp->ah_ani[index];
488 ahp->ah_curani = aniState; 488 ahp->ah_curani = aniState;
489 489
490 if (DO_ANI(ah) && ah->ah_opmode != ATH9K_M_STA 490 if (DO_ANI(ah) && ah->ah_opmode != NL80211_IFTYPE_STATION
491 && ah->ah_opmode != ATH9K_M_IBSS) { 491 && ah->ah_opmode != NL80211_IFTYPE_ADHOC) {
492 DPRINTF(ah->ah_sc, ATH_DBG_ANI, 492 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
493 "Reset ANI state opmode %u\n", ah->ah_opmode); 493 "Reset ANI state opmode %u\n", ah->ah_opmode);
494 ahp->ah_stats.ast_ani_reset++; 494 ahp->ah_stats.ast_ani_reset++;
@@ -504,7 +504,7 @@ void ath9k_ani_reset(struct ath_hal *ah)
504 ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) | 504 ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) |
505 ATH9K_RX_FILTER_PHYERR); 505 ATH9K_RX_FILTER_PHYERR);
506 506
507 if (ah->ah_opmode == ATH9K_M_HOSTAP) { 507 if (ah->ah_opmode == NL80211_IFTYPE_AP) {
508 ahp->ah_curani->ofdmTrigHigh = 508 ahp->ah_curani->ofdmTrigHigh =
509 ah->ah_config.ofdm_trig_high; 509 ah->ah_config.ofdm_trig_high;
510 ahp->ah_curani->ofdmTrigLow = 510 ahp->ah_curani->ofdmTrigLow =
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index 9eaa3fce631c..9520aa0898e3 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -647,13 +647,6 @@ enum ath9k_ant_setting {
647 ATH9K_ANT_FIXED_B 647 ATH9K_ANT_FIXED_B
648}; 648};
649 649
650enum ath9k_opmode {
651 ATH9K_M_STA = 1,
652 ATH9K_M_IBSS = 0,
653 ATH9K_M_HOSTAP = 6,
654 ATH9K_M_MONITOR = 8
655};
656
657#define ATH9K_SLOT_TIME_6 6 650#define ATH9K_SLOT_TIME_6 6
658#define ATH9K_SLOT_TIME_9 9 651#define ATH9K_SLOT_TIME_9 9
659#define ATH9K_SLOT_TIME_20 20 652#define ATH9K_SLOT_TIME_20 20
@@ -780,7 +773,8 @@ struct ath_hal {
780 773
781 void __iomem *ah_sh; 774 void __iomem *ah_sh;
782 struct ath_softc *ah_sc; 775 struct ath_softc *ah_sc;
783 enum ath9k_opmode ah_opmode; 776
777 enum nl80211_iftype ah_opmode;
784 struct ath9k_ops_config ah_config; 778 struct ath9k_ops_config ah_config;
785 struct ath9k_hw_capabilities ah_caps; 779 struct ath9k_hw_capabilities ah_caps;
786 780
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index ca5782fa7627..fe6929dc2937 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -27,7 +27,7 @@ static int ath_beaconq_config(struct ath_softc *sc)
27 struct ath9k_tx_queue_info qi; 27 struct ath9k_tx_queue_info qi;
28 28
29 ath9k_hw_get_txq_props(ah, sc->sc_bhalq, &qi); 29 ath9k_hw_get_txq_props(ah, sc->sc_bhalq, &qi);
30 if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) { 30 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) {
31 /* Always burst out beacon and CAB traffic. */ 31 /* Always burst out beacon and CAB traffic. */
32 qi.tqi_aifs = 1; 32 qi.tqi_aifs = 1;
33 qi.tqi_cwmin = 0; 33 qi.tqi_cwmin = 0;
@@ -82,7 +82,7 @@ static void ath_beacon_setup(struct ath_softc *sc,
82 82
83 flags = ATH9K_TXDESC_NOACK; 83 flags = ATH9K_TXDESC_NOACK;
84 84
85 if (sc->sc_ah->ah_opmode == ATH9K_M_IBSS && 85 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC &&
86 (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) { 86 (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
87 ds->ds_link = bf->bf_daddr; /* self-linked */ 87 ds->ds_link = bf->bf_daddr; /* self-linked */
88 flags |= ATH9K_TXDESC_VEOL; 88 flags |= ATH9K_TXDESC_VEOL;
@@ -302,7 +302,7 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
302 struct ath_buf, list); 302 struct ath_buf, list);
303 list_del(&avp->av_bcbuf->list); 303 list_del(&avp->av_bcbuf->list);
304 304
305 if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP || 305 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP ||
306 !(sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) { 306 !(sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
307 int slot; 307 int slot;
308 /* 308 /*
@@ -607,16 +607,16 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
607 struct ath_hal *ah = sc->sc_ah; 607 struct ath_hal *ah = sc->sc_ah;
608 struct ath_beacon_config conf; 608 struct ath_beacon_config conf;
609 struct ath_vap *avp; 609 struct ath_vap *avp;
610 enum ath9k_opmode av_opmode; 610 enum nl80211_iftype opmode;
611 u32 nexttbtt, intval; 611 u32 nexttbtt, intval;
612 612
613 if (if_id != ATH_IF_ID_ANY) { 613 if (if_id != ATH_IF_ID_ANY) {
614 vif = sc->sc_vaps[if_id]; 614 vif = sc->sc_vaps[if_id];
615 ASSERT(vif); 615 ASSERT(vif);
616 avp = (void *)vif->drv_priv; 616 avp = (void *)vif->drv_priv;
617 av_opmode = avp->av_opmode; 617 opmode = avp->av_opmode;
618 } else { 618 } else {
619 av_opmode = sc->sc_ah->ah_opmode; 619 opmode = sc->sc_ah->ah_opmode;
620 } 620 }
621 621
622 memset(&conf, 0, sizeof(struct ath_beacon_config)); 622 memset(&conf, 0, sizeof(struct ath_beacon_config));
@@ -632,7 +632,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
632 nexttbtt = TSF_TO_TU(sc->bc_tstamp >> 32, sc->bc_tstamp); 632 nexttbtt = TSF_TO_TU(sc->bc_tstamp >> 32, sc->bc_tstamp);
633 633
634 /* XXX conditionalize multi-bss support? */ 634 /* XXX conditionalize multi-bss support? */
635 if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) { 635 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) {
636 /* 636 /*
637 * For multi-bss ap support beacons are either staggered 637 * For multi-bss ap support beacons are either staggered
638 * evenly over N slots or burst together. For the former 638 * evenly over N slots or burst together. For the former
@@ -654,8 +654,8 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
654 DPRINTF(sc, ATH_DBG_BEACON, "nexttbtt %u intval %u (%u)\n", 654 DPRINTF(sc, ATH_DBG_BEACON, "nexttbtt %u intval %u (%u)\n",
655 nexttbtt, intval, conf.beacon_interval); 655 nexttbtt, intval, conf.beacon_interval);
656 656
657 /* Check for ATH9K_M_HOSTAP and sc_nostabeacons for WDS client */ 657 /* Check for NL80211_IFTYPE_AP and sc_nostabeacons for WDS client */
658 if (sc->sc_ah->ah_opmode == ATH9K_M_STA) { 658 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) {
659 struct ath9k_beacon_state bs; 659 struct ath9k_beacon_state bs;
660 u64 tsf; 660 u64 tsf;
661 u32 tsftu; 661 u32 tsftu;
@@ -774,7 +774,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
774 ath9k_hw_set_interrupts(ah, 0); 774 ath9k_hw_set_interrupts(ah, 0);
775 if (nexttbtt == intval) 775 if (nexttbtt == intval)
776 intval |= ATH9K_BEACON_RESET_TSF; 776 intval |= ATH9K_BEACON_RESET_TSF;
777 if (sc->sc_ah->ah_opmode == ATH9K_M_IBSS) { 777 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC) {
778 /* 778 /*
779 * Pull nexttbtt forward to reflect the current 779 * Pull nexttbtt forward to reflect the current
780 * TSF 780 * TSF
@@ -806,7 +806,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
806 if (!(ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) 806 if (!(ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL))
807 sc->sc_imask |= ATH9K_INT_SWBA; 807 sc->sc_imask |= ATH9K_INT_SWBA;
808 ath_beaconq_config(sc); 808 ath_beaconq_config(sc);
809 } else if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) { 809 } else if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) {
810 /* 810 /*
811 * In AP mode we enable the beacon timers and 811 * In AP mode we enable the beacon timers and
812 * SWBA interrupts to prepare beacon frames. 812 * SWBA interrupts to prepare beacon frames.
@@ -822,7 +822,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
822 * When using a self-linked beacon descriptor in 822 * When using a self-linked beacon descriptor in
823 * ibss mode load it once here. 823 * ibss mode load it once here.
824 */ 824 */
825 if (sc->sc_ah->ah_opmode == ATH9K_M_IBSS && 825 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC &&
826 (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) 826 (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL))
827 ath_beacon_start_adhoc(sc, 0); 827 ath_beacon_start_adhoc(sc, 0);
828 } 828 }
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 8c11c0f5c644..a500d1770534 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -474,7 +474,7 @@ void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid
474 474
475struct ath_vap { 475struct ath_vap {
476 int av_bslot; 476 int av_bslot;
477 enum ath9k_opmode av_opmode; 477 enum nl80211_iftype av_opmode;
478 struct ath_buf *av_bcbuf; 478 struct ath_buf *av_bcbuf;
479 struct ath_tx_control av_btxctl; 479 struct ath_tx_control av_btxctl;
480}; 480};
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index b3f2899026d6..668865dce533 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -1040,7 +1040,8 @@ static void ath9k_hw_init_chain_masks(struct ath_hal *ah)
1040 REG_READ(ah, AR_PHY_ANALOG_SWAP) | 0x00000001); 1040 REG_READ(ah, AR_PHY_ANALOG_SWAP) | 0x00000001);
1041} 1041}
1042 1042
1043static void ath9k_hw_init_interrupt_masks(struct ath_hal *ah, enum ath9k_opmode opmode) 1043static void ath9k_hw_init_interrupt_masks(struct ath_hal *ah,
1044 enum nl80211_iftype opmode)
1044{ 1045{
1045 struct ath_hal_5416 *ahp = AH5416(ah); 1046 struct ath_hal_5416 *ahp = AH5416(ah);
1046 1047
@@ -1057,7 +1058,7 @@ static void ath9k_hw_init_interrupt_masks(struct ath_hal *ah, enum ath9k_opmode
1057 1058
1058 ahp->ah_maskReg |= AR_IMR_TXOK; 1059 ahp->ah_maskReg |= AR_IMR_TXOK;
1059 1060
1060 if (opmode == ATH9K_M_HOSTAP) 1061 if (opmode == NL80211_IFTYPE_AP)
1061 ahp->ah_maskReg |= AR_IMR_MIB; 1062 ahp->ah_maskReg |= AR_IMR_MIB;
1062 1063
1063 REG_WRITE(ah, AR_IMR, ahp->ah_maskReg); 1064 REG_WRITE(ah, AR_IMR, ahp->ah_maskReg);
@@ -1423,18 +1424,18 @@ static void ath9k_hw_set_operating_mode(struct ath_hal *ah, int opmode)
1423 val = REG_READ(ah, AR_STA_ID1); 1424 val = REG_READ(ah, AR_STA_ID1);
1424 val &= ~(AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC); 1425 val &= ~(AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC);
1425 switch (opmode) { 1426 switch (opmode) {
1426 case ATH9K_M_HOSTAP: 1427 case NL80211_IFTYPE_AP:
1427 REG_WRITE(ah, AR_STA_ID1, val | AR_STA_ID1_STA_AP 1428 REG_WRITE(ah, AR_STA_ID1, val | AR_STA_ID1_STA_AP
1428 | AR_STA_ID1_KSRCH_MODE); 1429 | AR_STA_ID1_KSRCH_MODE);
1429 REG_CLR_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION); 1430 REG_CLR_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION);
1430 break; 1431 break;
1431 case ATH9K_M_IBSS: 1432 case NL80211_IFTYPE_ADHOC:
1432 REG_WRITE(ah, AR_STA_ID1, val | AR_STA_ID1_ADHOC 1433 REG_WRITE(ah, AR_STA_ID1, val | AR_STA_ID1_ADHOC
1433 | AR_STA_ID1_KSRCH_MODE); 1434 | AR_STA_ID1_KSRCH_MODE);
1434 REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION); 1435 REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION);
1435 break; 1436 break;
1436 case ATH9K_M_STA: 1437 case NL80211_IFTYPE_STATION:
1437 case ATH9K_M_MONITOR: 1438 case NL80211_IFTYPE_MONITOR:
1438 REG_WRITE(ah, AR_STA_ID1, val | AR_STA_ID1_KSRCH_MODE); 1439 REG_WRITE(ah, AR_STA_ID1, val | AR_STA_ID1_KSRCH_MODE);
1439 break; 1440 break;
1440 } 1441 }
@@ -3054,14 +3055,14 @@ void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period)
3054 ahp->ah_beaconInterval = beacon_period; 3055 ahp->ah_beaconInterval = beacon_period;
3055 3056
3056 switch (ah->ah_opmode) { 3057 switch (ah->ah_opmode) {
3057 case ATH9K_M_STA: 3058 case NL80211_IFTYPE_STATION:
3058 case ATH9K_M_MONITOR: 3059 case NL80211_IFTYPE_MONITOR:
3059 REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(next_beacon)); 3060 REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(next_beacon));
3060 REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT, 0xffff); 3061 REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT, 0xffff);
3061 REG_WRITE(ah, AR_NEXT_SWBA, 0x7ffff); 3062 REG_WRITE(ah, AR_NEXT_SWBA, 0x7ffff);
3062 flags |= AR_TBTT_TIMER_EN; 3063 flags |= AR_TBTT_TIMER_EN;
3063 break; 3064 break;
3064 case ATH9K_M_IBSS: 3065 case NL80211_IFTYPE_ADHOC:
3065 REG_SET_BIT(ah, AR_TXCFG, 3066 REG_SET_BIT(ah, AR_TXCFG,
3066 AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY); 3067 AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY);
3067 REG_WRITE(ah, AR_NEXT_NDP_TIMER, 3068 REG_WRITE(ah, AR_NEXT_NDP_TIMER,
@@ -3069,7 +3070,7 @@ void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period)
3069 (ahp->ah_atimWindow ? ahp-> 3070 (ahp->ah_atimWindow ? ahp->
3070 ah_atimWindow : 1))); 3071 ah_atimWindow : 1)));
3071 flags |= AR_NDP_TIMER_EN; 3072 flags |= AR_NDP_TIMER_EN;
3072 case ATH9K_M_HOSTAP: 3073 case NL80211_IFTYPE_AP:
3073 REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(next_beacon)); 3074 REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(next_beacon));
3074 REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT, 3075 REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT,
3075 TU_TO_USEC(next_beacon - 3076 TU_TO_USEC(next_beacon -
@@ -3082,6 +3083,12 @@ void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period)
3082 flags |= 3083 flags |=
3083 AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN; 3084 AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN;
3084 break; 3085 break;
3086 default:
3087 DPRINTF(ah->ah_sc, ATH_DBG_BEACON,
3088 "%s: unsupported opmode: %d\n",
3089 __func__, ah->ah_opmode);
3090 return;
3091 break;
3085 } 3092 }
3086 3093
3087 REG_WRITE(ah, AR_BEACON_PERIOD, TU_TO_USEC(beacon_period)); 3094 REG_WRITE(ah, AR_BEACON_PERIOD, TU_TO_USEC(beacon_period));
@@ -3177,7 +3184,7 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
3177 3184
3178 capField = ath9k_hw_get_eeprom(ah, EEP_OP_CAP); 3185 capField = ath9k_hw_get_eeprom(ah, EEP_OP_CAP);
3179 3186
3180 if (ah->ah_opmode != ATH9K_M_HOSTAP && 3187 if (ah->ah_opmode != NL80211_IFTYPE_AP &&
3181 ah->ah_subvendorid == AR_SUBVENDOR_ID_NEW_A) { 3188 ah->ah_subvendorid == AR_SUBVENDOR_ID_NEW_A) {
3182 if (ah->ah_currentRD == 0x64 || ah->ah_currentRD == 0x65) 3189 if (ah->ah_currentRD == 0x64 || ah->ah_currentRD == 0x65)
3183 ah->ah_currentRD += 5; 3190 ah->ah_currentRD += 5;
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index ac37605d65af..3d7111e9b8d8 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -754,13 +754,17 @@ static int ath_key_config(struct ath_softc *sc,
754 754
755 /* 755 /*
756 * Strategy: 756 * Strategy:
757 * For _M_STA mc tx, we will not setup a key at all since we never 757 * For STA mc tx, we will not setup a key at
758 * tx mc. 758 * all since we never tx mc.
759 * _M_STA mc rx, we will use the keyID. 759 *
760 * for _M_IBSS mc tx, we will use the keyID, and no macaddr. 760 * For STA mc rx, we will use the keyID.
761 * for _M_IBSS mc rx, we will alloc a slot and plumb the mac of the 761 *
762 * peer node. BUT we will plumb a cleartext key so that we can do 762 * For ADHOC mc tx, we will use the keyID, and no macaddr.
763 * perSta default key table lookup in software. 763 *
764 * For ADHOC mc rx, we will alloc a slot and plumb the mac of
765 * the peer node.
766 * BUT we will plumb a cleartext key so that we can do
767 * per-Sta default key table lookup in software.
764 */ 768 */
765 if (is_broadcast_ether_addr(addr)) { 769 if (is_broadcast_ether_addr(addr)) {
766 switch (opmode) { 770 switch (opmode) {
@@ -861,7 +865,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
861 DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info ASSOC %d\n", bss_conf->aid); 865 DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info ASSOC %d\n", bss_conf->aid);
862 866
863 /* New association, store aid */ 867 /* New association, store aid */
864 if (avp->av_opmode == ATH9K_M_STA) { 868 if (avp->av_opmode == NL80211_IFTYPE_STATION) {
865 sc->sc_curaid = bss_conf->aid; 869 sc->sc_curaid = bss_conf->aid;
866 ath9k_hw_write_associd(sc->sc_ah, sc->sc_curbssid, 870 ath9k_hw_write_associd(sc->sc_ah, sc->sc_curbssid,
867 sc->sc_curaid); 871 sc->sc_curaid);
@@ -1373,7 +1377,8 @@ static int ath_init(u16 devid, struct ath_softc *sc)
1373 goto bad; 1377 goto bad;
1374 1378
1375 /* default to MONITOR mode */ 1379 /* default to MONITOR mode */
1376 sc->sc_ah->ah_opmode = ATH9K_M_MONITOR; 1380 sc->sc_ah->ah_opmode = NL80211_IFTYPE_MONITOR;
1381
1377 1382
1378 /* Setup rate tables */ 1383 /* Setup rate tables */
1379 1384
@@ -1938,8 +1943,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
1938 * Note we only do this (at the moment) for station mode. 1943 * Note we only do this (at the moment) for station mode.
1939 */ 1944 */
1940 if (ath9k_hw_phycounters(sc->sc_ah) && 1945 if (ath9k_hw_phycounters(sc->sc_ah) &&
1941 ((sc->sc_ah->ah_opmode == ATH9K_M_STA) || 1946 ((sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) ||
1942 (sc->sc_ah->ah_opmode == ATH9K_M_IBSS))) 1947 (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC)))
1943 sc->sc_imask |= ATH9K_INT_MIB; 1948 sc->sc_imask |= ATH9K_INT_MIB;
1944 /* 1949 /*
1945 * Some hardware processes the TIM IE and fires an 1950 * Some hardware processes the TIM IE and fires an
@@ -1948,7 +1953,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1948 * enable the TIM interrupt when operating as station. 1953 * enable the TIM interrupt when operating as station.
1949 */ 1954 */
1950 if ((sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_ENHANCEDPM) && 1955 if ((sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_ENHANCEDPM) &&
1951 (sc->sc_ah->ah_opmode == ATH9K_M_STA) && 1956 (sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) &&
1952 !sc->sc_config.swBeaconProcess) 1957 !sc->sc_config.swBeaconProcess)
1953 sc->sc_imask |= ATH9K_INT_TIM; 1958 sc->sc_imask |= ATH9K_INT_TIM;
1954 1959
@@ -2064,7 +2069,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
2064{ 2069{
2065 struct ath_softc *sc = hw->priv; 2070 struct ath_softc *sc = hw->priv;
2066 struct ath_vap *avp = (void *)conf->vif->drv_priv; 2071 struct ath_vap *avp = (void *)conf->vif->drv_priv;
2067 int ic_opmode = 0; 2072 enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED;
2068 2073
2069 /* Support only vap for now */ 2074 /* Support only vap for now */
2070 2075
@@ -2073,13 +2078,13 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
2073 2078
2074 switch (conf->type) { 2079 switch (conf->type) {
2075 case NL80211_IFTYPE_STATION: 2080 case NL80211_IFTYPE_STATION:
2076 ic_opmode = ATH9K_M_STA; 2081 ic_opmode = NL80211_IFTYPE_STATION;
2077 break; 2082 break;
2078 case NL80211_IFTYPE_ADHOC: 2083 case NL80211_IFTYPE_ADHOC:
2079 ic_opmode = ATH9K_M_IBSS; 2084 ic_opmode = NL80211_IFTYPE_ADHOC;
2080 break; 2085 break;
2081 case NL80211_IFTYPE_AP: 2086 case NL80211_IFTYPE_AP:
2082 ic_opmode = ATH9K_M_HOSTAP; 2087 ic_opmode = NL80211_IFTYPE_AP;
2083 break; 2088 break;
2084 default: 2089 default:
2085 DPRINTF(sc, ATH_DBG_FATAL, 2090 DPRINTF(sc, ATH_DBG_FATAL,
@@ -2093,7 +2098,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
2093 avp->av_opmode = ic_opmode; 2098 avp->av_opmode = ic_opmode;
2094 avp->av_bslot = -1; 2099 avp->av_bslot = -1;
2095 2100
2096 if (ic_opmode == ATH9K_M_HOSTAP) 2101 if (ic_opmode == NL80211_IFTYPE_AP)
2097 ath9k_hw_set_tsfadjust(sc->sc_ah, 1); 2102 ath9k_hw_set_tsfadjust(sc->sc_ah, 1);
2098 2103
2099 sc->sc_vaps[0] = conf->vif; 2104 sc->sc_vaps[0] = conf->vif;
@@ -2127,8 +2132,8 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
2127 del_timer_sync(&sc->sc_ani.timer); 2132 del_timer_sync(&sc->sc_ani.timer);
2128 2133
2129 /* Reclaim beacon resources */ 2134 /* Reclaim beacon resources */
2130 if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP || 2135 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP ||
2131 sc->sc_ah->ah_opmode == ATH9K_M_IBSS) { 2136 sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC) {
2132 ath9k_hw_stoptxdma(sc->sc_ah, sc->sc_bhalq); 2137 ath9k_hw_stoptxdma(sc->sc_ah, sc->sc_bhalq);
2133 ath_beacon_return(sc, avp); 2138 ath_beacon_return(sc, avp);
2134 } 2139 }
@@ -2163,7 +2168,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
2163 (curchan->band == IEEE80211_BAND_2GHZ) ? 2168 (curchan->band == IEEE80211_BAND_2GHZ) ?
2164 CHANNEL_G : CHANNEL_A; 2169 CHANNEL_G : CHANNEL_A;
2165 2170
2166 if ((sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) && 2171 if ((sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) &&
2167 (conf->ht.enabled)) { 2172 (conf->ht.enabled)) {
2168 sc->tx_chan_width = (!!conf->ht.sec_chan_offset) ? 2173 sc->tx_chan_width = (!!conf->ht.sec_chan_offset) ?
2169 ATH9K_HT_MACMODE_2040 : ATH9K_HT_MACMODE_20; 2174 ATH9K_HT_MACMODE_2040 : ATH9K_HT_MACMODE_20;
@@ -2202,8 +2207,8 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
2202 /* TODO: Need to decide which hw opmode to use for multi-interface 2207 /* TODO: Need to decide which hw opmode to use for multi-interface
2203 * cases */ 2208 * cases */
2204 if (vif->type == NL80211_IFTYPE_AP && 2209 if (vif->type == NL80211_IFTYPE_AP &&
2205 ah->ah_opmode != ATH9K_M_HOSTAP) { 2210 ah->ah_opmode != NL80211_IFTYPE_AP) {
2206 ah->ah_opmode = ATH9K_M_HOSTAP; 2211 ah->ah_opmode = NL80211_IFTYPE_STATION;
2207 ath9k_hw_setopmode(ah); 2212 ath9k_hw_setopmode(ah);
2208 ath9k_hw_write_associd(ah, sc->sc_myaddr, 0); 2213 ath9k_hw_write_associd(ah, sc->sc_myaddr, 0);
2209 /* Request full reset to get hw opmode changed properly */ 2214 /* Request full reset to get hw opmode changed properly */
@@ -2258,7 +2263,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
2258 } 2263 }
2259 2264
2260 /* Check for WLAN_CAPABILITY_PRIVACY ? */ 2265 /* Check for WLAN_CAPABILITY_PRIVACY ? */
2261 if ((avp->av_opmode != ATH9K_M_STA)) { 2266 if ((avp->av_opmode != NL80211_IFTYPE_STATION)) {
2262 for (i = 0; i < IEEE80211_WEP_NKID; i++) 2267 for (i = 0; i < IEEE80211_WEP_NKID; i++)
2263 if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i)) 2268 if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i))
2264 ath9k_hw_keysetmac(sc->sc_ah, 2269 ath9k_hw_keysetmac(sc->sc_ah,
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 7d5affda3b8b..76acd2b75fcd 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -1347,13 +1347,13 @@ static void ath_rc_init(struct ath_softc *sc,
1347 u8 i, j, k, hi = 0, hthi = 0; 1347 u8 i, j, k, hi = 0, hthi = 0;
1348 1348
1349 /* FIXME: Adhoc */ 1349 /* FIXME: Adhoc */
1350 if ((sc->sc_ah->ah_opmode == ATH9K_M_STA) || 1350 if ((sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) ||
1351 (sc->sc_ah->ah_opmode == ATH9K_M_IBSS)) { 1351 (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC)) {
1352 bool is_cw_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40; 1352 bool is_cw_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40;
1353 rate_table = ath_choose_rate_table(sc, sband->band, 1353 rate_table = ath_choose_rate_table(sc, sband->band,
1354 sta->ht_cap.ht_supported, 1354 sta->ht_cap.ht_supported,
1355 is_cw_40); 1355 is_cw_40);
1356 } else if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) { 1356 } else if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) {
1357 /* sc_curmode would be set on init through config() */ 1357 /* sc_curmode would be set on init through config() */
1358 rate_table = sc->hw_rate_table[sc->sc_curmode]; 1358 rate_table = sc->hw_rate_table[sc->sc_curmode];
1359 } 1359 }
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 0b9a3d9c5824..51e058710d17 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -165,7 +165,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
165 * discard the frame. Enable this if you want to see 165 * discard the frame. Enable this if you want to see
166 * error frames in Monitor mode. 166 * error frames in Monitor mode.
167 */ 167 */
168 if (sc->sc_ah->ah_opmode != ATH9K_M_MONITOR) 168 if (sc->sc_ah->ah_opmode != NL80211_IFTYPE_MONITOR)
169 goto rx_next; 169 goto rx_next;
170 } else if (ds->ds_rxstat.rs_status != 0) { 170 } else if (ds->ds_rxstat.rs_status != 0) {
171 if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC) 171 if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC)
@@ -191,7 +191,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
191 * decryption and MIC failures. For monitor mode, 191 * decryption and MIC failures. For monitor mode,
192 * we also ignore the CRC error. 192 * we also ignore the CRC error.
193 */ 193 */
194 if (sc->sc_ah->ah_opmode == ATH9K_M_MONITOR) { 194 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_MONITOR) {
195 if (ds->ds_rxstat.rs_status & 195 if (ds->ds_rxstat.rs_status &
196 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | 196 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC |
197 ATH9K_RXERR_CRC)) 197 ATH9K_RXERR_CRC))
@@ -361,25 +361,25 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
361 | ATH9K_RX_FILTER_MCAST; 361 | ATH9K_RX_FILTER_MCAST;
362 362
363 /* If not a STA, enable processing of Probe Requests */ 363 /* If not a STA, enable processing of Probe Requests */
364 if (sc->sc_ah->ah_opmode != ATH9K_M_STA) 364 if (sc->sc_ah->ah_opmode != NL80211_IFTYPE_STATION)
365 rfilt |= ATH9K_RX_FILTER_PROBEREQ; 365 rfilt |= ATH9K_RX_FILTER_PROBEREQ;
366 366
367 /* Can't set HOSTAP into promiscous mode */ 367 /* Can't set HOSTAP into promiscous mode */
368 if (((sc->sc_ah->ah_opmode != ATH9K_M_HOSTAP) && 368 if (((sc->sc_ah->ah_opmode != NL80211_IFTYPE_AP) &&
369 (sc->rx_filter & FIF_PROMISC_IN_BSS)) || 369 (sc->rx_filter & FIF_PROMISC_IN_BSS)) ||
370 (sc->sc_ah->ah_opmode == ATH9K_M_MONITOR)) { 370 (sc->sc_ah->ah_opmode == NL80211_IFTYPE_MONITOR)) {
371 rfilt |= ATH9K_RX_FILTER_PROM; 371 rfilt |= ATH9K_RX_FILTER_PROM;
372 /* ??? To prevent from sending ACK */ 372 /* ??? To prevent from sending ACK */
373 rfilt &= ~ATH9K_RX_FILTER_UCAST; 373 rfilt &= ~ATH9K_RX_FILTER_UCAST;
374 } 374 }
375 375
376 if (sc->sc_ah->ah_opmode == ATH9K_M_STA || 376 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION ||
377 sc->sc_ah->ah_opmode == ATH9K_M_IBSS) 377 sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC)
378 rfilt |= ATH9K_RX_FILTER_BEACON; 378 rfilt |= ATH9K_RX_FILTER_BEACON;
379 379
380 /* If in HOSTAP mode, want to enable reception of PSPOLL frames 380 /* If in HOSTAP mode, want to enable reception of PSPOLL frames
381 & beacon frames */ 381 & beacon frames */
382 if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) 382 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP)
383 rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL); 383 rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL);
384 384
385 return rfilt; 385 return rfilt;
diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c
index e3dd91f7b7b7..42ce1d9abad0 100644
--- a/drivers/net/wireless/ath9k/regd.c
+++ b/drivers/net/wireless/ath9k/regd.c
@@ -456,7 +456,7 @@ ath9k_regd_add_channel(struct ath_hal *ah,
456 return false; 456 return false;
457 } 457 }
458 458
459 if ((rd->flags & NO_HOSTAP) && (ah->ah_opmode == ATH9K_M_HOSTAP)) { 459 if ((rd->flags & NO_HOSTAP) && (ah->ah_opmode == NL80211_IFTYPE_AP)) {
460 DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, 460 DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
461 "Skipping HOSTAP channel\n"); 461 "Skipping HOSTAP channel\n");
462 return false; 462 return false;
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index fc52f61ef3ed..5cf83111e1a7 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -760,7 +760,8 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
760 * when perform internal reset in this routine. 760 * when perform internal reset in this routine.
761 * Only enable reset in STA mode for now. 761 * Only enable reset in STA mode for now.
762 */ 762 */
763 if (sc->sc_ah->ah_opmode == ATH9K_M_STA) 763 if (sc->sc_ah->ah_opmode ==
764 NL80211_IFTYPE_STATION)
764 needreset = 1; 765 needreset = 1;
765 } 766 }
766 } else { 767 } else {