|
@@ -106,7 +106,7 @@ void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
|
|
|
+int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
|
|
|
int rate, int erp, int short_preamble)
|
|
|
{
|
|
|
int dur;
|
|
@@ -120,7 +120,7 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
|
|
|
* DIV_ROUND_UP() operations.
|
|
|
*/
|
|
|
|
|
|
- if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ || erp) {
|
|
|
+ if (band == IEEE80211_BAND_5GHZ || erp) {
|
|
|
/*
|
|
|
* OFDM:
|
|
|
*
|
|
@@ -162,10 +162,10 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
|
|
|
/* Exported duration function for driver use */
|
|
|
__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
|
|
|
struct ieee80211_vif *vif,
|
|
|
+ enum ieee80211_band band,
|
|
|
size_t frame_len,
|
|
|
struct ieee80211_rate *rate)
|
|
|
{
|
|
|
- struct ieee80211_local *local = hw_to_local(hw);
|
|
|
struct ieee80211_sub_if_data *sdata;
|
|
|
u16 dur;
|
|
|
int erp;
|
|
@@ -179,7 +179,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
|
|
|
erp = rate->flags & IEEE80211_RATE_ERP_G;
|
|
|
}
|
|
|
|
|
|
- dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, erp,
|
|
|
+ dur = ieee80211_frame_duration(band, frame_len, rate->bitrate, erp,
|
|
|
short_preamble);
|
|
|
|
|
|
return cpu_to_le16(dur);
|
|
@@ -198,7 +198,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
|
|
|
u16 dur;
|
|
|
struct ieee80211_supported_band *sband;
|
|
|
|
|
|
- sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
|
|
|
+ sband = local->hw.wiphy->bands[frame_txctl->band];
|
|
|
|
|
|
short_preamble = false;
|
|
|
|
|
@@ -213,13 +213,13 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
|
|
|
}
|
|
|
|
|
|
/* CTS duration */
|
|
|
- dur = ieee80211_frame_duration(local, 10, rate->bitrate,
|
|
|
+ dur = ieee80211_frame_duration(sband->band, 10, rate->bitrate,
|
|
|
erp, short_preamble);
|
|
|
/* Data frame duration */
|
|
|
- dur += ieee80211_frame_duration(local, frame_len, rate->bitrate,
|
|
|
+ dur += ieee80211_frame_duration(sband->band, frame_len, rate->bitrate,
|
|
|
erp, short_preamble);
|
|
|
/* ACK duration */
|
|
|
- dur += ieee80211_frame_duration(local, 10, rate->bitrate,
|
|
|
+ dur += ieee80211_frame_duration(sband->band, 10, rate->bitrate,
|
|
|
erp, short_preamble);
|
|
|
|
|
|
return cpu_to_le16(dur);
|
|
@@ -239,7 +239,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
|
|
|
u16 dur;
|
|
|
struct ieee80211_supported_band *sband;
|
|
|
|
|
|
- sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
|
|
|
+ sband = local->hw.wiphy->bands[frame_txctl->band];
|
|
|
|
|
|
short_preamble = false;
|
|
|
|
|
@@ -253,11 +253,11 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
|
|
|
}
|
|
|
|
|
|
/* Data frame duration */
|
|
|
- dur = ieee80211_frame_duration(local, frame_len, rate->bitrate,
|
|
|
+ dur = ieee80211_frame_duration(sband->band, frame_len, rate->bitrate,
|
|
|
erp, short_preamble);
|
|
|
if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) {
|
|
|
/* ACK duration */
|
|
|
- dur += ieee80211_frame_duration(local, 10, rate->bitrate,
|
|
|
+ dur += ieee80211_frame_duration(sband->band, 10, rate->bitrate,
|
|
|
erp, short_preamble);
|
|
|
}
|
|
|
|
|
@@ -909,10 +909,8 @@ u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
|
|
|
int i;
|
|
|
|
|
|
sband = local->hw.wiphy->bands[band];
|
|
|
- if (!sband) {
|
|
|
- WARN_ON(1);
|
|
|
- sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
|
|
|
- }
|
|
|
+ if (WARN_ON(!sband))
|
|
|
+ return 1;
|
|
|
|
|
|
if (band == IEEE80211_BAND_2GHZ)
|
|
|
mandatory_flag = IEEE80211_RATE_MANDATORY_B;
|
|
@@ -1146,10 +1144,8 @@ u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
|
|
|
int i, j;
|
|
|
sband = local->hw.wiphy->bands[band];
|
|
|
|
|
|
- if (!sband) {
|
|
|
- WARN_ON(1);
|
|
|
- sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
|
|
|
- }
|
|
|
+ if (WARN_ON(!sband))
|
|
|
+ return 1;
|
|
|
|
|
|
bitrates = sband->bitrates;
|
|
|
num_rates = sband->n_bitrates;
|