summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2012-04-11 02:47:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-13 14:32:50 -0400
commit4ee73f338a528f44fd90496adfbfd9c119401850 (patch)
tree665c02d2ec013a09b252713c8f94b604f6050cc7
parentf58cc809d2fe60989095c7b55fd14e1935a2f72a (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>
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h2
-rw-r--r--drivers/net/wireless/ath/ath5k/pcu.c9
-rw-r--r--drivers/net/wireless/ath/ath5k/qcu.c8
-rw-r--r--drivers/net/wireless/b43/xmit.c3
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/xmit.c1
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/dev.c1
-rw-r--r--include/net/mac80211.h1
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/rc80211_minstrel.c13
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c5
-rw-r--r--net/mac80211/tx.c4
-rw-r--r--net/mac80211/util.c34
13 files changed, 45 insertions, 40 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 55ef93dd7438..64a453a6dfe4 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1527,7 +1527,7 @@ void ath5k_eeprom_detach(struct ath5k_hw *ah);
1527 1527
1528/* Protocol Control Unit Functions */ 1528/* Protocol Control Unit Functions */
1529/* Helpers */ 1529/* Helpers */
1530int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, 1530int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum ieee80211_band band,
1531 int len, struct ieee80211_rate *rate, bool shortpre); 1531 int len, struct ieee80211_rate *rate, bool shortpre);
1532unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah); 1532unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah);
1533unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah); 1533unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah);
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index cebfd6fd31d3..1f16b4227d8f 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -110,7 +110,7 @@ static const unsigned int ack_rates_high[] =
110 * bwmodes. 110 * bwmodes.
111 */ 111 */
112int 112int
113ath5k_hw_get_frame_duration(struct ath5k_hw *ah, 113ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum ieee80211_band band,
114 int len, struct ieee80211_rate *rate, bool shortpre) 114 int len, struct ieee80211_rate *rate, bool shortpre)
115{ 115{
116 int sifs, preamble, plcp_bits, sym_time; 116 int sifs, preamble, plcp_bits, sym_time;
@@ -120,7 +120,7 @@ ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
120 /* Fallback */ 120 /* Fallback */
121 if (!ah->ah_bwmode) { 121 if (!ah->ah_bwmode) {
122 __le16 raw_dur = ieee80211_generic_frame_duration(ah->hw, 122 __le16 raw_dur = ieee80211_generic_frame_duration(ah->hw,
123 NULL, len, rate); 123 NULL, band, len, rate);
124 124
125 /* subtract difference between long and short preamble */ 125 /* subtract difference between long and short preamble */
126 dur = le16_to_cpu(raw_dur); 126 dur = le16_to_cpu(raw_dur);
@@ -302,14 +302,15 @@ ath5k_hw_write_rate_duration(struct ath5k_hw *ah)
302 * actual rate for this rate. See mac80211 tx.c 302 * actual rate for this rate. See mac80211 tx.c
303 * ieee80211_duration() for a brief description of 303 * ieee80211_duration() for a brief description of
304 * what rate we should choose to TX ACKs. */ 304 * what rate we should choose to TX ACKs. */
305 tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, false); 305 tx_time = ath5k_hw_get_frame_duration(ah, band, 10,
306 rate, false);
306 307
307 ath5k_hw_reg_write(ah, tx_time, reg); 308 ath5k_hw_reg_write(ah, tx_time, reg);
308 309
309 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) 310 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE))
310 continue; 311 continue;
311 312
312 tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, true); 313 tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, true);
313 ath5k_hw_reg_write(ah, tx_time, 314 ath5k_hw_reg_write(ah, tx_time,
314 reg + (AR5K_SET_SHORT_PREAMBLE << 2)); 315 reg + (AR5K_SET_SHORT_PREAMBLE << 2));
315 } 316 }
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c
index a6de200538c3..65fe929529a8 100644
--- a/drivers/net/wireless/ath/ath5k/qcu.c
+++ b/drivers/net/wireless/ath/ath5k/qcu.c
@@ -565,6 +565,7 @@ ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
565int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time) 565int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
566{ 566{
567 struct ieee80211_channel *channel = ah->ah_current_channel; 567 struct ieee80211_channel *channel = ah->ah_current_channel;
568 enum ieee80211_band band;
568 struct ieee80211_rate *rate; 569 struct ieee80211_rate *rate;
569 u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock; 570 u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock;
570 u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time); 571 u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time);
@@ -600,11 +601,12 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
600 * Also we have different lowest rate for 802.11a 601 * Also we have different lowest rate for 802.11a
601 */ 602 */
602 if (channel->band == IEEE80211_BAND_5GHZ) 603 if (channel->band == IEEE80211_BAND_5GHZ)
603 rate = &ah->sbands[IEEE80211_BAND_5GHZ].bitrates[0]; 604 band = IEEE80211_BAND_5GHZ;
604 else 605 else
605 rate = &ah->sbands[IEEE80211_BAND_2GHZ].bitrates[0]; 606 band = IEEE80211_BAND_2GHZ;
606 607
607 ack_tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, false); 608 rate = &ah->sbands[band].bitrates[0];
609 ack_tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, false);
608 610
609 /* ack_tx_time includes an SIFS already */ 611 /* ack_tx_time includes an SIFS already */
610 eifs = ack_tx_time + sifs + 2 * slot_time; 612 eifs = ack_tx_time + sifs + 2 * slot_time;
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index cba413536270..b31ccc02fa21 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -290,7 +290,8 @@ int b43_generate_txhdr(struct b43_wldev *dev,
290 txhdr->dur_fb = wlhdr->duration_id; 290 txhdr->dur_fb = wlhdr->duration_id;
291 } else { 291 } else {
292 txhdr->dur_fb = ieee80211_generic_frame_duration( 292 txhdr->dur_fb = ieee80211_generic_frame_duration(
293 dev->wl->hw, info->control.vif, fragment_len, fbrate); 293 dev->wl->hw, info->control.vif, info->band,
294 fragment_len, fbrate);
294 } 295 }
295 296
296 plcp_fragment_len = fragment_len + FCS_LEN; 297 plcp_fragment_len = fragment_len + FCS_LEN;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index df7e16dfb36c..1be214b815fb 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1056,6 +1056,7 @@ static void b43legacy_write_probe_resp_plcp(struct b43legacy_wldev *dev,
1056 b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate->hw_value); 1056 b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate->hw_value);
1057 dur = ieee80211_generic_frame_duration(dev->wl->hw, 1057 dur = ieee80211_generic_frame_duration(dev->wl->hw,
1058 dev->wl->vif, 1058 dev->wl->vif,
1059 IEEE80211_BAND_2GHZ,
1059 size, 1060 size,
1060 rate); 1061 rate);
1061 /* Write PLCP in two parts and timing for packet transfer */ 1062 /* Write PLCP in two parts and timing for packet transfer */
@@ -1121,6 +1122,7 @@ static const u8 *b43legacy_generate_probe_resp(struct b43legacy_wldev *dev,
1121 IEEE80211_STYPE_PROBE_RESP); 1122 IEEE80211_STYPE_PROBE_RESP);
1122 dur = ieee80211_generic_frame_duration(dev->wl->hw, 1123 dur = ieee80211_generic_frame_duration(dev->wl->hw,
1123 dev->wl->vif, 1124 dev->wl->vif,
1125 IEEE80211_BAND_2GHZ,
1124 *dest_size, 1126 *dest_size,
1125 rate); 1127 rate);
1126 hdr->duration_id = dur; 1128 hdr->duration_id = dur;
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index e6c573af494d..a8012f2749ee 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -228,6 +228,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
228 } else { 228 } else {
229 txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, 229 txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw,
230 info->control.vif, 230 info->control.vif,
231 info->band,
231 fragment_len, 232 fragment_len,
232 rate_fb); 233 rate_fb);
233 } 234 }
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
index cf53ac9d6f23..d8114962b0c9 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
@@ -294,6 +294,7 @@ static void rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
294 hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8); 294 hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
295 hdr->tx_duration = 295 hdr->tx_duration =
296 ieee80211_generic_frame_duration(dev, priv->vif, 296 ieee80211_generic_frame_duration(dev, priv->vif,
297 info->band,
297 skb->len, txrate); 298 skb->len, txrate);
298 buf = hdr; 299 buf = hdr;
299 300
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 32cd5171fa22..eff00e6d105f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2947,6 +2947,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
2947 */ 2947 */
2948__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, 2948__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
2949 struct ieee80211_vif *vif, 2949 struct ieee80211_vif *vif,
2950 enum ieee80211_band band,
2950 size_t frame_len, 2951 size_t frame_len,
2951 struct ieee80211_rate *rate); 2952 struct ieee80211_rate *rate);
2952 2953
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 1fd8cb26b3ff..8cc4bc101409 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1404,7 +1404,7 @@ static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1404extern void *mac80211_wiphy_privid; /* for wiphy privid */ 1404extern void *mac80211_wiphy_privid; /* for wiphy privid */
1405u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 1405u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
1406 enum nl80211_iftype type); 1406 enum nl80211_iftype type);
1407int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, 1407int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
1408 int rate, int erp, int short_preamble); 1408 int rate, int erp, int short_preamble);
1409void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 1409void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
1410 struct ieee80211_hdr *hdr, const u8 *tsc, 1410 struct ieee80211_hdr *hdr, const u8 *tsc,
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index b39dda523f39..79633ae06fd6 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -334,14 +334,15 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
334 334
335 335
336static void 336static void
337calc_rate_durations(struct ieee80211_local *local, struct minstrel_rate *d, 337calc_rate_durations(enum ieee80211_band band,
338 struct minstrel_rate *d,
338 struct ieee80211_rate *rate) 339 struct ieee80211_rate *rate)
339{ 340{
340 int erp = !!(rate->flags & IEEE80211_RATE_ERP_G); 341 int erp = !!(rate->flags & IEEE80211_RATE_ERP_G);
341 342
342 d->perfect_tx_time = ieee80211_frame_duration(local, 1200, 343 d->perfect_tx_time = ieee80211_frame_duration(band, 1200,
343 rate->bitrate, erp, 1); 344 rate->bitrate, erp, 1);
344 d->ack_time = ieee80211_frame_duration(local, 10, 345 d->ack_time = ieee80211_frame_duration(band, 10,
345 rate->bitrate, erp, 1); 346 rate->bitrate, erp, 1);
346} 347}
347 348
@@ -379,14 +380,14 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
379{ 380{
380 struct minstrel_sta_info *mi = priv_sta; 381 struct minstrel_sta_info *mi = priv_sta;
381 struct minstrel_priv *mp = priv; 382 struct minstrel_priv *mp = priv;
382 struct ieee80211_local *local = hw_to_local(mp->hw);
383 struct ieee80211_rate *ctl_rate; 383 struct ieee80211_rate *ctl_rate;
384 unsigned int i, n = 0; 384 unsigned int i, n = 0;
385 unsigned int t_slot = 9; /* FIXME: get real slot time */ 385 unsigned int t_slot = 9; /* FIXME: get real slot time */
386 386
387 mi->lowest_rix = rate_lowest_index(sband, sta); 387 mi->lowest_rix = rate_lowest_index(sband, sta);
388 ctl_rate = &sband->bitrates[mi->lowest_rix]; 388 ctl_rate = &sband->bitrates[mi->lowest_rix];
389 mi->sp_ack_dur = ieee80211_frame_duration(local, 10, ctl_rate->bitrate, 389 mi->sp_ack_dur = ieee80211_frame_duration(sband->band, 10,
390 ctl_rate->bitrate,
390 !!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1); 391 !!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1);
391 392
392 for (i = 0; i < sband->n_bitrates; i++) { 393 for (i = 0; i < sband->n_bitrates; i++) {
@@ -402,7 +403,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
402 403
403 mr->rix = i; 404 mr->rix = i;
404 mr->bitrate = sband->bitrates[i].bitrate / 5; 405 mr->bitrate = sband->bitrates[i].bitrate / 5;
405 calc_rate_durations(local, mr, &sband->bitrates[i]); 406 calc_rate_durations(sband->band, mr, &sband->bitrates[i]);
406 407
407 /* calculate maximum number of retransmissions before 408 /* calculate maximum number of retransmissions before
408 * fallback (based on maximum segment size) */ 409 * fallback (based on maximum segment size) */
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 3b3dcae13bbc..2d1acc6c5445 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -692,7 +692,6 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
692 struct minstrel_ht_sta_priv *msp = priv_sta; 692 struct minstrel_ht_sta_priv *msp = priv_sta;
693 struct minstrel_ht_sta *mi = &msp->ht; 693 struct minstrel_ht_sta *mi = &msp->ht;
694 struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; 694 struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
695 struct ieee80211_local *local = hw_to_local(mp->hw);
696 u16 sta_cap = sta->ht_cap.cap; 695 u16 sta_cap = sta->ht_cap.cap;
697 int n_supported = 0; 696 int n_supported = 0;
698 int ack_dur; 697 int ack_dur;
@@ -711,8 +710,8 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
711 memset(mi, 0, sizeof(*mi)); 710 memset(mi, 0, sizeof(*mi));
712 mi->stats_update = jiffies; 711 mi->stats_update = jiffies;
713 712
714 ack_dur = ieee80211_frame_duration(local, 10, 60, 1, 1); 713 ack_dur = ieee80211_frame_duration(sband->band, 10, 60, 1, 1);
715 mi->overhead = ieee80211_frame_duration(local, 0, 60, 1, 1) + ack_dur; 714 mi->overhead = ieee80211_frame_duration(sband->band, 0, 60, 1, 1) + ack_dur;
716 mi->overhead_rtscts = mi->overhead + 2 * ack_dur; 715 mi->overhead_rtscts = mi->overhead + 2 * ack_dur;
717 716
718 mi->avg_ampdu_len = MINSTREL_FRAC(1, 1); 717 mi->avg_ampdu_len = MINSTREL_FRAC(1, 1);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 4f6aac16ac3a..0abbef952c14 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -159,7 +159,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
159 /* Time needed to transmit ACK 159 /* Time needed to transmit ACK
160 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up 160 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up
161 * to closest integer */ 161 * to closest integer */
162 dur = ieee80211_frame_duration(local, 10, rate, erp, 162 dur = ieee80211_frame_duration(sband->band, 10, rate, erp,
163 tx->sdata->vif.bss_conf.use_short_preamble); 163 tx->sdata->vif.bss_conf.use_short_preamble);
164 164
165 if (next_frag_len) { 165 if (next_frag_len) {
@@ -167,7 +167,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
167 * transmit next fragment plus ACK and 2 x SIFS. */ 167 * transmit next fragment plus ACK and 2 x SIFS. */
168 dur *= 2; /* ACK + SIFS */ 168 dur *= 2; /* ACK + SIFS */
169 /* next fragment */ 169 /* next fragment */
170 dur += ieee80211_frame_duration(local, next_frag_len, 170 dur += ieee80211_frame_duration(sband->band, next_frag_len,
171 txrate->bitrate, erp, 171 txrate->bitrate, erp,
172 tx->sdata->vif.bss_conf.use_short_preamble); 172 tx->sdata->vif.bss_conf.use_short_preamble);
173 } 173 }
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
109int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, 109int 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;