aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2013-08-16 04:46:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-08-16 14:17:47 -0400
commit0671894f977b6f03b63fddc33743474f495db4eb (patch)
treecc4a56a8b4be11858848141757c3be55d55dd6c2 /drivers/net/wireless/ath
parent92367fe7f24159d6ba83276bc7a0f45c6f663837 (diff)
ath9k: use chandef instead of channel_type
To enable support for 5/10 MHz, some internal functions must be converted from using the (old) channel_type to chandef. This is a good chance to change all remaining occurences. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c67
-rw-r--r--drivers/net/wireless/ath/ath9k/common.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c4
6 files changed, 51 insertions, 40 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index 344fdde1d7a3..d3063c21e16c 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -49,37 +49,40 @@ int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb)
49} 49}
50EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype); 50EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype);
51 51
52static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan, 52static u32 ath9k_get_extchanmode(struct cfg80211_chan_def *chandef)
53 enum nl80211_channel_type channel_type)
54{ 53{
55 u32 chanmode = 0; 54 u32 chanmode = 0;
56 55
57 switch (chan->band) { 56 switch (chandef->chan->band) {
58 case IEEE80211_BAND_2GHZ: 57 case IEEE80211_BAND_2GHZ:
59 switch (channel_type) { 58 switch (chandef->width) {
60 case NL80211_CHAN_NO_HT: 59 case NL80211_CHAN_WIDTH_20_NOHT:
61 case NL80211_CHAN_HT20: 60 case NL80211_CHAN_WIDTH_20:
62 chanmode = CHANNEL_G_HT20; 61 chanmode = CHANNEL_G_HT20;
63 break; 62 break;
64 case NL80211_CHAN_HT40PLUS: 63 case NL80211_CHAN_WIDTH_40:
65 chanmode = CHANNEL_G_HT40PLUS; 64 if (chandef->center_freq1 > chandef->chan->center_freq)
65 chanmode = CHANNEL_G_HT40PLUS;
66 else
67 chanmode = CHANNEL_G_HT40MINUS;
66 break; 68 break;
67 case NL80211_CHAN_HT40MINUS: 69 default:
68 chanmode = CHANNEL_G_HT40MINUS;
69 break; 70 break;
70 } 71 }
71 break; 72 break;
72 case IEEE80211_BAND_5GHZ: 73 case IEEE80211_BAND_5GHZ:
73 switch (channel_type) { 74 switch (chandef->width) {
74 case NL80211_CHAN_NO_HT: 75 case NL80211_CHAN_WIDTH_20_NOHT:
75 case NL80211_CHAN_HT20: 76 case NL80211_CHAN_WIDTH_20:
76 chanmode = CHANNEL_A_HT20; 77 chanmode = CHANNEL_A_HT20;
77 break; 78 break;
78 case NL80211_CHAN_HT40PLUS: 79 case NL80211_CHAN_WIDTH_40:
79 chanmode = CHANNEL_A_HT40PLUS; 80 if (chandef->center_freq1 > chandef->chan->center_freq)
81 chanmode = CHANNEL_A_HT40PLUS;
82 else
83 chanmode = CHANNEL_A_HT40MINUS;
80 break; 84 break;
81 case NL80211_CHAN_HT40MINUS: 85 default:
82 chanmode = CHANNEL_A_HT40MINUS;
83 break; 86 break;
84 } 87 }
85 break; 88 break;
@@ -94,13 +97,12 @@ static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan,
94 * Update internal channel flags. 97 * Update internal channel flags.
95 */ 98 */
96void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, 99void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
97 struct ieee80211_channel *chan, 100 struct cfg80211_chan_def *chandef)
98 enum nl80211_channel_type channel_type)
99{ 101{
100 ichan->channel = chan->center_freq; 102 ichan->channel = chandef->chan->center_freq;
101 ichan->chan = chan; 103 ichan->chan = chandef->chan;
102 104
103 if (chan->band == IEEE80211_BAND_2GHZ) { 105 if (chandef->chan->band == IEEE80211_BAND_2GHZ) {
104 ichan->chanmode = CHANNEL_G; 106 ichan->chanmode = CHANNEL_G;
105 ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM; 107 ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM;
106 } else { 108 } else {
@@ -108,8 +110,22 @@ void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
108 ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM; 110 ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM;
109 } 111 }
110 112
111 if (channel_type != NL80211_CHAN_NO_HT) 113 switch (chandef->width) {
112 ichan->chanmode = ath9k_get_extchanmode(chan, channel_type); 114 case NL80211_CHAN_WIDTH_5:
115 ichan->channelFlags |= CHANNEL_QUARTER;
116 break;
117 case NL80211_CHAN_WIDTH_10:
118 ichan->channelFlags |= CHANNEL_HALF;
119 break;
120 case NL80211_CHAN_WIDTH_20_NOHT:
121 break;
122 case NL80211_CHAN_WIDTH_20:
123 case NL80211_CHAN_WIDTH_40:
124 ichan->chanmode = ath9k_get_extchanmode(chandef);
125 break;
126 default:
127 WARN_ON(1);
128 }
113} 129}
114EXPORT_SYMBOL(ath9k_cmn_update_ichannel); 130EXPORT_SYMBOL(ath9k_cmn_update_ichannel);
115 131
@@ -125,8 +141,7 @@ struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
125 141
126 chan_idx = curchan->hw_value; 142 chan_idx = curchan->hw_value;
127 channel = &ah->channels[chan_idx]; 143 channel = &ah->channels[chan_idx];
128 ath9k_cmn_update_ichannel(channel, curchan, 144 ath9k_cmn_update_ichannel(channel, &hw->conf.chandef);
129 cfg80211_get_chandef_type(&hw->conf.chandef));
130 145
131 return channel; 146 return channel;
132} 147}
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h
index 207d06995b15..e039bcbfbd79 100644
--- a/drivers/net/wireless/ath/ath9k/common.h
+++ b/drivers/net/wireless/ath/ath9k/common.h
@@ -44,8 +44,7 @@
44 44
45int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); 45int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb);
46void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, 46void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
47 struct ieee80211_channel *chan, 47 struct cfg80211_chan_def *chandef);
48 enum nl80211_channel_type channel_type);
49struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, 48struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
50 struct ath_hw *ah); 49 struct ath_hw *ah);
51int ath9k_cmn_count_streams(unsigned int chainmask, int max); 50int ath9k_cmn_count_streams(unsigned int chainmask, int max);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 5c1bec18c9e3..d44258172c0f 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1203,16 +1203,13 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
1203 1203
1204 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) { 1204 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) {
1205 struct ieee80211_channel *curchan = hw->conf.chandef.chan; 1205 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
1206 enum nl80211_channel_type channel_type =
1207 cfg80211_get_chandef_type(&hw->conf.chandef);
1208 int pos = curchan->hw_value; 1206 int pos = curchan->hw_value;
1209 1207
1210 ath_dbg(common, CONFIG, "Set channel: %d MHz\n", 1208 ath_dbg(common, CONFIG, "Set channel: %d MHz\n",
1211 curchan->center_freq); 1209 curchan->center_freq);
1212 1210
1213 ath9k_cmn_update_ichannel(&priv->ah->channels[pos], 1211 ath9k_cmn_update_ichannel(&priv->ah->channels[pos],
1214 hw->conf.chandef.chan, 1212 &hw->conf.chandef);
1215 channel_type);
1216 1213
1217 if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { 1214 if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) {
1218 ath_err(common, "Unable to set channel\n"); 1215 ath_err(common, "Unable to set channel\n");
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 3b56c2e7efe7..85015bf537c2 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -726,13 +726,15 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
726 struct ieee80211_supported_band *sband; 726 struct ieee80211_supported_band *sband;
727 struct ieee80211_channel *chan; 727 struct ieee80211_channel *chan;
728 struct ath_hw *ah = sc->sc_ah; 728 struct ath_hw *ah = sc->sc_ah;
729 struct cfg80211_chan_def chandef;
729 int i; 730 int i;
730 731
731 sband = &sc->sbands[band]; 732 sband = &sc->sbands[band];
732 for (i = 0; i < sband->n_channels; i++) { 733 for (i = 0; i < sband->n_channels; i++) {
733 chan = &sband->channels[i]; 734 chan = &sband->channels[i];
734 ah->curchan = &ah->channels[chan->hw_value]; 735 ah->curchan = &ah->channels[chan->hw_value];
735 ath9k_cmn_update_ichannel(ah->curchan, chan, NL80211_CHAN_HT20); 736 cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20);
737 ath9k_cmn_update_ichannel(ah->curchan, &chandef);
736 ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true); 738 ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true);
737 } 739 }
738} 740}
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 0bee105064bd..ba382a8c8b9a 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1201,8 +1201,6 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1201 1201
1202 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) { 1202 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) {
1203 struct ieee80211_channel *curchan = hw->conf.chandef.chan; 1203 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
1204 enum nl80211_channel_type channel_type =
1205 cfg80211_get_chandef_type(&conf->chandef);
1206 int pos = curchan->hw_value; 1204 int pos = curchan->hw_value;
1207 int old_pos = -1; 1205 int old_pos = -1;
1208 unsigned long flags; 1206 unsigned long flags;
@@ -1210,8 +1208,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1210 if (ah->curchan) 1208 if (ah->curchan)
1211 old_pos = ah->curchan - &ah->channels[0]; 1209 old_pos = ah->curchan - &ah->channels[0];
1212 1210
1213 ath_dbg(common, CONFIG, "Set channel: %d MHz type: %d\n", 1211 ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n",
1214 curchan->center_freq, channel_type); 1212 curchan->center_freq, hw->conf.chandef.width);
1215 1213
1216 /* update survey stats for the old channel before switching */ 1214 /* update survey stats for the old channel before switching */
1217 spin_lock_irqsave(&common->cc_lock, flags); 1215 spin_lock_irqsave(&common->cc_lock, flags);
@@ -1219,7 +1217,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1219 spin_unlock_irqrestore(&common->cc_lock, flags); 1217 spin_unlock_irqrestore(&common->cc_lock, flags);
1220 1218
1221 ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos], 1219 ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
1222 curchan, channel_type); 1220 &conf->chandef);
1223 1221
1224 /* 1222 /*
1225 * If the operating channel changes, change the survey in-use flags 1223 * If the operating channel changes, change the survey in-use flags
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index a3c4ca0c94bf..7e86abb98808 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1326,8 +1326,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1326 ath_rc_init(sc, priv_sta); 1326 ath_rc_init(sc, priv_sta);
1327 1327
1328 ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG, 1328 ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG,
1329 "Operating HT Bandwidth changed to: %d\n", 1329 "Operating Bandwidth changed to: %d\n",
1330 cfg80211_get_chandef_type(&sc->hw->conf.chandef)); 1330 sc->hw->conf.chandef.width);
1331 } 1331 }
1332} 1332}
1333 1333