aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2013-07-08 10:55:51 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-07-16 02:58:04 -0400
commit438b61b77082e70d2a408cc77b8c5faac312e940 (patch)
tree2a4575f29605a16fc051a6b81c71d0f3b31d7d77 /net/mac80211/tx.c
parent3de805cf965d69c8d3d7d69368d5fd2c925a2d5a (diff)
mac80211: fix timing for 5 MHz and 10 MHz channels
according to IEEE 802.11-2012 section 18, various timings change when using 5 MHz and 10 MHz. Reflect this by using a "shift" when calculating durations. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 4105d0ca963e..3523daa0b15c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -40,7 +40,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
40 struct sk_buff *skb, int group_addr, 40 struct sk_buff *skb, int group_addr,
41 int next_frag_len) 41 int next_frag_len)
42{ 42{
43 int rate, mrate, erp, dur, i; 43 int rate, mrate, erp, dur, i, shift;
44 struct ieee80211_rate *txrate; 44 struct ieee80211_rate *txrate;
45 struct ieee80211_local *local = tx->local; 45 struct ieee80211_local *local = tx->local;
46 struct ieee80211_supported_band *sband; 46 struct ieee80211_supported_band *sband;
@@ -153,6 +153,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
153 rate = mrate; 153 rate = mrate;
154 } 154 }
155 155
156 shift = ieee80211_vif_get_shift(&tx->sdata->vif);
157
156 /* Don't calculate ACKs for QoS Frames with NoAck Policy set */ 158 /* Don't calculate ACKs for QoS Frames with NoAck Policy set */
157 if (ieee80211_is_data_qos(hdr->frame_control) && 159 if (ieee80211_is_data_qos(hdr->frame_control) &&
158 *(ieee80211_get_qos_ctl(hdr)) & IEEE80211_QOS_CTL_ACK_POLICY_NOACK) 160 *(ieee80211_get_qos_ctl(hdr)) & IEEE80211_QOS_CTL_ACK_POLICY_NOACK)
@@ -162,7 +164,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
162 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up 164 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up
163 * to closest integer */ 165 * to closest integer */
164 dur = ieee80211_frame_duration(sband->band, 10, rate, erp, 166 dur = ieee80211_frame_duration(sband->band, 10, rate, erp,
165 tx->sdata->vif.bss_conf.use_short_preamble); 167 tx->sdata->vif.bss_conf.use_short_preamble,
168 shift);
166 169
167 if (next_frag_len) { 170 if (next_frag_len) {
168 /* Frame is fragmented: duration increases with time needed to 171 /* Frame is fragmented: duration increases with time needed to
@@ -171,7 +174,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
171 /* next fragment */ 174 /* next fragment */
172 dur += ieee80211_frame_duration(sband->band, next_frag_len, 175 dur += ieee80211_frame_duration(sband->band, next_frag_len,
173 txrate->bitrate, erp, 176 txrate->bitrate, erp,
174 tx->sdata->vif.bss_conf.use_short_preamble); 177 tx->sdata->vif.bss_conf.use_short_preamble,
178 shift);
175 } 179 }
176 180
177 return cpu_to_le16(dur); 181 return cpu_to_le16(dur);