aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-11-17 22:35:35 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-26 09:47:25 -0500
commit2b406f1e68dd5348384fd166ac532af46bfc87fc (patch)
treebf03d3978ae1fc8a2f900b18a56cffe37a7f8b7e
parent46494e6df8f6d9739d56c8b980229af4e5d2353f (diff)
ath9k: Nuke fixed rate handling in driver
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath9k/core.c4
-rw-r--r--drivers/net/wireless/ath9k/core.h8
-rw-r--r--drivers/net/wireless/ath9k/main.c8
-rw-r--r--drivers/net/wireless/ath9k/rc.c92
-rw-r--r--drivers/net/wireless/ath9k/rc.h29
5 files changed, 4 insertions, 137 deletions
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c
index bab9eaa18da4..ea332a2f18fe 100644
--- a/drivers/net/wireless/ath9k/core.c
+++ b/drivers/net/wireless/ath9k/core.c
@@ -89,13 +89,9 @@ static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode)
89 const struct ath9k_rate_table *rt; 89 const struct ath9k_rate_table *rt;
90 int i; 90 int i;
91 91
92 memset(sc->sc_rixmap, 0xff, sizeof(sc->sc_rixmap));
93 rt = ath9k_hw_getratetable(sc->sc_ah, mode); 92 rt = ath9k_hw_getratetable(sc->sc_ah, mode);
94 BUG_ON(!rt); 93 BUG_ON(!rt);
95 94
96 for (i = 0; i < rt->rateCount; i++)
97 sc->sc_rixmap[rt->info[i].rateCode] = (u8) i;
98
99 memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap)); 95 memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap));
100 for (i = 0; i < 256; i++) { 96 for (i = 0; i < 256; i++) {
101 u8 ix = rt->rateCodeToIndex[i]; 97 u8 ix = rt->rateCodeToIndex[i];
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 69e8d3e41131..fe9dc99cc3e5 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -641,19 +641,12 @@ void ath_get_beaconconfig(struct ath_softc *sc,
641#define ATH_SET_VAP_BSSID_MASK(bssid_mask) \ 641#define ATH_SET_VAP_BSSID_MASK(bssid_mask) \
642 ((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02)) 642 ((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))
643 643
644/* VAP configuration (from protocol layer) */
645struct ath_vap_config {
646 u32 av_fixed_rateset;
647 u32 av_fixed_retryset;
648};
649
650/* driver-specific vap state */ 644/* driver-specific vap state */
651struct ath_vap { 645struct ath_vap {
652 int av_bslot; /* beacon slot index */ 646 int av_bslot; /* beacon slot index */
653 enum ath9k_opmode av_opmode; /* VAP operational mode */ 647 enum ath9k_opmode av_opmode; /* VAP operational mode */
654 struct ath_buf *av_bcbuf; /* beacon buffer */ 648 struct ath_buf *av_bcbuf; /* beacon buffer */
655 struct ath_tx_control av_btxctl; /* txctl information for beacon */ 649 struct ath_tx_control av_btxctl; /* txctl information for beacon */
656 struct ath_vap_config av_config;/* vap configuration parameters*/
657 struct ath_rate_node *rc_node; 650 struct ath_rate_node *rc_node;
658}; 651};
659 652
@@ -915,7 +908,6 @@ struct ath_softc {
915 /* Rate */ 908 /* Rate */
916 struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX]; 909 struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX];
917 const struct ath9k_rate_table *sc_currates; 910 const struct ath9k_rate_table *sc_currates;
918 u8 sc_rixmap[256]; /* IEEE to h/w rate table ix */
919 u8 sc_protrix; /* protection rate index */ 911 u8 sc_protrix; /* protection rate index */
920 struct { 912 struct {
921 u32 rateKbps; /* transfer rate in kbs */ 913 u32 rateKbps; /* transfer rate in kbs */
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 4c2c58e2db47..60319d7ad24e 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -379,7 +379,6 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
379 "%s: Unable to set channel\n", 379 "%s: Unable to set channel\n",
380 __func__); 380 __func__);
381 381
382 ath_rate_newstate(sc, avp);
383 /* Update ratectrl about the new state */ 382 /* Update ratectrl about the new state */
384 ath_rc_node_update(hw, avp->rc_node); 383 ath_rc_node_update(hw, avp->rc_node);
385 384
@@ -1099,10 +1098,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1099 /* Set the device opmode */ 1098 /* Set the device opmode */
1100 sc->sc_ah->ah_opmode = ic_opmode; 1099 sc->sc_ah->ah_opmode = ic_opmode;
1101 1100
1102 /* default VAP configuration */
1103 avp->av_config.av_fixed_rateset = IEEE80211_FIXED_RATE_NONE;
1104 avp->av_config.av_fixed_retryset = 0x03030303;
1105
1106 if (conf->type == NL80211_IFTYPE_AP) { 1101 if (conf->type == NL80211_IFTYPE_AP) {
1107 /* TODO: is this a suitable place to start ANI for AP mode? */ 1102 /* TODO: is this a suitable place to start ANI for AP mode? */
1108 /* Start ANI */ 1103 /* Start ANI */
@@ -1205,9 +1200,6 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
1205 switch (vif->type) { 1200 switch (vif->type) {
1206 case NL80211_IFTYPE_STATION: 1201 case NL80211_IFTYPE_STATION:
1207 case NL80211_IFTYPE_ADHOC: 1202 case NL80211_IFTYPE_ADHOC:
1208 /* Update ratectrl about the new state */
1209 ath_rate_newstate(sc, avp);
1210
1211 /* Set BSSID */ 1203 /* Set BSSID */
1212 memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN); 1204 memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN);
1213 sc->sc_curaid = 0; 1205 sc->sc_curaid = 0;
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index aafd10df9279..8a45b2502d23 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -709,27 +709,6 @@ u8 ath_rate_findrateix(struct ath_softc *sc,
709 return 0; 709 return 0;
710} 710}
711 711
712/*
713 * Update rate-control state on a device state change. When
714 * operating as a station this includes associate/reassociate
715 * with an AP. Otherwise this gets called, for example, when
716 * the we transition to run state when operating as an AP.
717 */
718void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp)
719{
720 struct ath_rate_softc *asc = sc->sc_rc;
721
722 if (avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) {
723 asc->fixedrix =
724 sc->sc_rixmap[avp->av_config.av_fixed_rateset & 0xff];
725 /* NB: check the fixed rate exists */
726 if (asc->fixedrix == 0xff)
727 asc->fixedrix = IEEE80211_FIXED_RATE_NONE;
728 } else {
729 asc->fixedrix = IEEE80211_FIXED_RATE_NONE;
730 }
731}
732
733static u8 ath_rc_ratefind_ht(struct ath_softc *sc, 712static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
734 struct ath_rate_node *ath_rc_priv, 713 struct ath_rate_node *ath_rc_priv,
735 const struct ath_rate_table *rate_table, 714 const struct ath_rate_table *rate_table,
@@ -1009,73 +988,11 @@ static void ath_rate_findrate(struct ath_softc *sc,
1009 int *is_probe, 988 int *is_probe,
1010 int is_retry) 989 int is_retry)
1011{ 990{
1012 struct ath_vap *avp = ath_rc_priv->avp;
1013
1014 DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
1015
1016 if (!num_rates || !num_tries) 991 if (!num_rates || !num_tries)
1017 return; 992 return;
1018 993
1019 if (avp->av_config.av_fixed_rateset == IEEE80211_FIXED_RATE_NONE) { 994 ath_rc_ratefind(sc, ath_rc_priv, num_tries, num_rates,
1020 ath_rc_ratefind(sc, ath_rc_priv, num_tries, num_rates, 995 rcflag, series, is_probe, is_retry);
1021 rcflag, series, is_probe, is_retry);
1022 } else {
1023 /* Fixed rate */
1024 int idx;
1025 u8 flags;
1026 u32 rix;
1027 struct ath_rate_softc *asc = ath_rc_priv->asc;
1028 struct ath_rate_table *rate_table;
1029
1030 rate_table = (struct ath_rate_table *)
1031 asc->hw_rate_table[sc->sc_curmode];
1032
1033 for (idx = 0; idx < 4; idx++) {
1034 unsigned int mcs;
1035 u8 series_rix = 0;
1036
1037 series[idx].tries = IEEE80211_RATE_IDX_ENTRY(
1038 avp->av_config.av_fixed_retryset, idx);
1039
1040 mcs = IEEE80211_RATE_IDX_ENTRY(
1041 avp->av_config.av_fixed_rateset, idx);
1042
1043 if (idx == 3 && (mcs & 0xf0) == 0x70)
1044 mcs = (mcs & ~0xf0)|0x80;
1045
1046 if (!(mcs & 0x80))
1047 flags = 0;
1048 else
1049 flags = ((ath_rc_priv->ht_cap &
1050 WLAN_RC_DS_FLAG) ?
1051 ATH_RC_DS_FLAG : 0) |
1052 ((ath_rc_priv->ht_cap &
1053 WLAN_RC_40_FLAG) ?
1054 ATH_RC_CW40_FLAG : 0) |
1055 ((ath_rc_priv->ht_cap &
1056 WLAN_RC_SGI_FLAG) ?
1057 ((ath_rc_priv->ht_cap &
1058 WLAN_RC_40_FLAG) ?
1059 ATH_RC_SGI_FLAG : 0) : 0);
1060
1061 series[idx].rix = sc->sc_rixmap[mcs];
1062 series_rix = series[idx].rix;
1063
1064 /* XXX: Give me some cleanup love */
1065 if ((flags & ATH_RC_CW40_FLAG) &&
1066 (flags & ATH_RC_SGI_FLAG))
1067 rix = rate_table->info[series_rix].ht_index;
1068 else if (flags & ATH_RC_SGI_FLAG)
1069 rix = rate_table->info[series_rix].sgi_index;
1070 else if (flags & ATH_RC_CW40_FLAG)
1071 rix = rate_table->info[series_rix].cw40index;
1072 else
1073 rix = rate_table->info[series_rix].base_index;
1074 series[idx].max_4ms_framelen =
1075 rate_table->info[rix].max_4ms_framelen;
1076 series[idx].flags = flags;
1077 }
1078 }
1079} 996}
1080 997
1081static void ath_rc_update_ht(struct ath_softc *sc, 998static void ath_rc_update_ht(struct ath_softc *sc,
@@ -1498,11 +1415,8 @@ static void ath_rate_tx_complete(struct ath_softc *sc,
1498{ 1415{
1499 int final_ts_idx = info_priv->tx.ts_rateindex; 1416 int final_ts_idx = info_priv->tx.ts_rateindex;
1500 int tx_status = 0, is_underrun = 0; 1417 int tx_status = 0, is_underrun = 0;
1501 struct ath_vap *avp;
1502 1418
1503 avp = rc_priv->avp; 1419 if (info_priv->tx.ts_status & ATH9K_TXERR_FILT)
1504 if ((avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) ||
1505 (info_priv->tx.ts_status & ATH9K_TXERR_FILT))
1506 return; 1420 return;
1507 1421
1508 if (info_priv->tx.ts_rssi > 0) { 1422 if (info_priv->tx.ts_rssi > 0) {
diff --git a/drivers/net/wireless/ath9k/rc.h b/drivers/net/wireless/ath9k/rc.h
index 2d8df836d533..8d0650a510a2 100644
--- a/drivers/net/wireless/ath9k/rc.h
+++ b/drivers/net/wireless/ath9k/rc.h
@@ -60,16 +60,6 @@ struct ath_softc;
60 60
61#define ATH_RATE_MAX 30 61#define ATH_RATE_MAX 30
62 62
63enum ieee80211_fixed_rate_mode {
64 IEEE80211_FIXED_RATE_NONE = 0,
65 IEEE80211_FIXED_RATE_MCS = 1 /* HT rates */
66};
67
68/*
69 * Use the hal os glue code to get ms time
70 */
71#define IEEE80211_RATE_IDX_ENTRY(val, idx) (((val&(0xff<<(idx*8)))>>(idx*8)))
72
73#define WLAN_PHY_HT_20_SS WLAN_RC_PHY_HT_20_SS 63#define WLAN_PHY_HT_20_SS WLAN_RC_PHY_HT_20_SS
74#define WLAN_PHY_HT_20_DS WLAN_RC_PHY_HT_20_DS 64#define WLAN_PHY_HT_20_DS WLAN_RC_PHY_HT_20_DS
75#define WLAN_PHY_HT_20_DS_HGI WLAN_RC_PHY_HT_20_DS_HGI 65#define WLAN_PHY_HT_20_DS_HGI WLAN_RC_PHY_HT_20_DS_HGI
@@ -287,27 +277,10 @@ struct ath_tx_info_priv {
287 u8 min_rate; 277 u8 min_rate;
288}; 278};
289 279
290/*
291 * Attach/detach a rate control module.
292 */
293struct ath_rate_softc *ath_rate_attach(struct ath_softc *sch); 280struct ath_rate_softc *ath_rate_attach(struct ath_softc *sch);
294void ath_rate_detach(struct ath_rate_softc *asc); 281void ath_rate_detach(struct ath_rate_softc *asc);
295
296/*
297 * Update/reset rate control state for 802.11 state transitions.
298 * Important mostly as the analog to ath_rate_newassoc when operating
299 * in station mode.
300 */
301void ath_rc_node_update(struct ieee80211_hw *hw, struct ath_rate_node *rc_priv); 282void ath_rc_node_update(struct ieee80211_hw *hw, struct ath_rate_node *rc_priv);
302void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp); 283u8 ath_rate_findrateix(struct ath_softc *sc, u8 dot11_rate);
303
304/*
305 * Return rate index for given Dot11 Rate.
306 */
307u8 ath_rate_findrateix(struct ath_softc *sc,
308 u8 dot11_rate);
309
310/* Routines to register/unregister rate control algorithm */
311int ath_rate_control_register(void); 284int ath_rate_control_register(void);
312void ath_rate_control_unregister(void); 285void ath_rate_control_unregister(void);
313 286