diff options
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel.c | 13 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht.c | 5 | ||||
-rw-r--r-- | net/mac80211/tx.c | 4 | ||||
-rw-r--r-- | net/mac80211/util.c | 34 |
5 files changed, 27 insertions, 31 deletions
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) | |||
1404 | extern void *mac80211_wiphy_privid; /* for wiphy privid */ | 1404 | extern void *mac80211_wiphy_privid; /* for wiphy privid */ |
1405 | u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, | 1405 | u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, |
1406 | enum nl80211_iftype type); | 1406 | enum nl80211_iftype type); |
1407 | int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, | 1407 | int 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); |
1409 | void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, | 1409 | void 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 | ||
336 | static void | 336 | static void |
337 | calc_rate_durations(struct ieee80211_local *local, struct minstrel_rate *d, | 337 | calc_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 | ||
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; |