diff options
author | Michal Kazior <michal.kazior@tieto.com> | 2012-04-11 02:47:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-13 14:32:50 -0400 |
commit | 4ee73f338a528f44fd90496adfbfd9c119401850 (patch) | |
tree | 665c02d2ec013a09b252713c8f94b604f6050cc7 /net/mac80211/util.c | |
parent | f58cc809d2fe60989095c7b55fd14e1935a2f72a (diff) |
mac80211: remove hw.conf.channel usage where possible
Removes hw.conf.channel usage from the following functions:
* ieee80211_mandatory_rates
* ieee80211_sta_get_rates
* ieee80211_frame_duration
* ieee80211_rts_duration
* ieee80211_ctstoself_duration
This is in preparation for multi-channel operation.
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r-- | net/mac80211/util.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index e67fe5c1def9..9d255a2e37ee 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -106,7 +106,7 @@ void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx) | |||
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, | 109 | int ieee80211_frame_duration(enum ieee80211_band band, size_t len, |
110 | int rate, int erp, int short_preamble) | 110 | int rate, int erp, int short_preamble) |
111 | { | 111 | { |
112 | int dur; | 112 | int dur; |
@@ -120,7 +120,7 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, | |||
120 | * DIV_ROUND_UP() operations. | 120 | * DIV_ROUND_UP() operations. |
121 | */ | 121 | */ |
122 | 122 | ||
123 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ || erp) { | 123 | if (band == IEEE80211_BAND_5GHZ || erp) { |
124 | /* | 124 | /* |
125 | * OFDM: | 125 | * OFDM: |
126 | * | 126 | * |
@@ -162,10 +162,10 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, | |||
162 | /* Exported duration function for driver use */ | 162 | /* Exported duration function for driver use */ |
163 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, | 163 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, |
164 | struct ieee80211_vif *vif, | 164 | struct ieee80211_vif *vif, |
165 | enum ieee80211_band band, | ||
165 | size_t frame_len, | 166 | size_t frame_len, |
166 | struct ieee80211_rate *rate) | 167 | struct ieee80211_rate *rate) |
167 | { | 168 | { |
168 | struct ieee80211_local *local = hw_to_local(hw); | ||
169 | struct ieee80211_sub_if_data *sdata; | 169 | struct ieee80211_sub_if_data *sdata; |
170 | u16 dur; | 170 | u16 dur; |
171 | int erp; | 171 | int erp; |
@@ -179,7 +179,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, | |||
179 | erp = rate->flags & IEEE80211_RATE_ERP_G; | 179 | erp = rate->flags & IEEE80211_RATE_ERP_G; |
180 | } | 180 | } |
181 | 181 | ||
182 | dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, erp, | 182 | dur = ieee80211_frame_duration(band, frame_len, rate->bitrate, erp, |
183 | short_preamble); | 183 | short_preamble); |
184 | 184 | ||
185 | return cpu_to_le16(dur); | 185 | return cpu_to_le16(dur); |
@@ -198,7 +198,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | |||
198 | u16 dur; | 198 | u16 dur; |
199 | struct ieee80211_supported_band *sband; | 199 | struct ieee80211_supported_band *sband; |
200 | 200 | ||
201 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 201 | sband = local->hw.wiphy->bands[frame_txctl->band]; |
202 | 202 | ||
203 | short_preamble = false; | 203 | short_preamble = false; |
204 | 204 | ||
@@ -213,13 +213,13 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | |||
213 | } | 213 | } |
214 | 214 | ||
215 | /* CTS duration */ | 215 | /* CTS duration */ |
216 | dur = ieee80211_frame_duration(local, 10, rate->bitrate, | 216 | dur = ieee80211_frame_duration(sband->band, 10, rate->bitrate, |
217 | erp, short_preamble); | 217 | erp, short_preamble); |
218 | /* Data frame duration */ | 218 | /* Data frame duration */ |
219 | dur += ieee80211_frame_duration(local, frame_len, rate->bitrate, | 219 | dur += ieee80211_frame_duration(sband->band, frame_len, rate->bitrate, |
220 | erp, short_preamble); | 220 | erp, short_preamble); |
221 | /* ACK duration */ | 221 | /* ACK duration */ |
222 | dur += ieee80211_frame_duration(local, 10, rate->bitrate, | 222 | dur += ieee80211_frame_duration(sband->band, 10, rate->bitrate, |
223 | erp, short_preamble); | 223 | erp, short_preamble); |
224 | 224 | ||
225 | return cpu_to_le16(dur); | 225 | return cpu_to_le16(dur); |
@@ -239,7 +239,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, | |||
239 | u16 dur; | 239 | u16 dur; |
240 | struct ieee80211_supported_band *sband; | 240 | struct ieee80211_supported_band *sband; |
241 | 241 | ||
242 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 242 | sband = local->hw.wiphy->bands[frame_txctl->band]; |
243 | 243 | ||
244 | short_preamble = false; | 244 | short_preamble = false; |
245 | 245 | ||
@@ -253,11 +253,11 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, | |||
253 | } | 253 | } |
254 | 254 | ||
255 | /* Data frame duration */ | 255 | /* Data frame duration */ |
256 | dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, | 256 | dur = ieee80211_frame_duration(sband->band, frame_len, rate->bitrate, |
257 | erp, short_preamble); | 257 | erp, short_preamble); |
258 | if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) { | 258 | if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) { |
259 | /* ACK duration */ | 259 | /* ACK duration */ |
260 | dur += ieee80211_frame_duration(local, 10, rate->bitrate, | 260 | dur += ieee80211_frame_duration(sband->band, 10, rate->bitrate, |
261 | erp, short_preamble); | 261 | erp, short_preamble); |
262 | } | 262 | } |
263 | 263 | ||
@@ -909,10 +909,8 @@ u32 ieee80211_mandatory_rates(struct ieee80211_local *local, | |||
909 | int i; | 909 | int i; |
910 | 910 | ||
911 | sband = local->hw.wiphy->bands[band]; | 911 | sband = local->hw.wiphy->bands[band]; |
912 | if (!sband) { | 912 | if (WARN_ON(!sband)) |
913 | WARN_ON(1); | 913 | return 1; |
914 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
915 | } | ||
916 | 914 | ||
917 | if (band == IEEE80211_BAND_2GHZ) | 915 | if (band == IEEE80211_BAND_2GHZ) |
918 | mandatory_flag = IEEE80211_RATE_MANDATORY_B; | 916 | mandatory_flag = IEEE80211_RATE_MANDATORY_B; |
@@ -1146,10 +1144,8 @@ u32 ieee80211_sta_get_rates(struct ieee80211_local *local, | |||
1146 | int i, j; | 1144 | int i, j; |
1147 | sband = local->hw.wiphy->bands[band]; | 1145 | sband = local->hw.wiphy->bands[band]; |
1148 | 1146 | ||
1149 | if (!sband) { | 1147 | if (WARN_ON(!sband)) |
1150 | WARN_ON(1); | 1148 | return 1; |
1151 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1152 | } | ||
1153 | 1149 | ||
1154 | bitrates = sband->bitrates; | 1150 | bitrates = sband->bitrates; |
1155 | num_rates = sband->n_bitrates; | 1151 | num_rates = sband->n_bitrates; |