aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2007-07-27 09:43:24 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:47:38 -0400
commit7e9ed18874f0df84b6651f0636e1cfdac43bc610 (patch)
tree7bac6083031a48e488c0de5bf71e7f9398e0e011 /net/mac80211/util.c
parentd5d08def9216c445339c5a24a2cdc9cc2c8c13f7 (diff)
[MAC80211]: improved short preamble handling
Similarly to CTS protection, whether short preambles are used for 802.11b transmissions should be a per-subif setting, not device global. For STAs, this patch makes short preamble handling automatic based on the ERP IE. For APs, hostapd still uses the prism ioctls, but the write ioctl has been restricted to AP-only subifs. ieee80211_txrx_data.short_preamble (an unused field) was removed. Unfortunately, some API changes were required for the following functions: - ieee80211_generic_frame_duration - ieee80211_rts_duration - ieee80211_ctstoself_duration - ieee80211_rts_get - ieee80211_ctstoself_get Affected drivers were updated accordingly. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: Jiri Benc <jbenc@suse.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index c45658309472..091ac0d634a5 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -314,31 +314,46 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
314} 314}
315 315
316/* Exported duration function for driver use */ 316/* Exported duration function for driver use */
317__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, 317__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id,
318 size_t frame_len, int rate) 318 size_t frame_len, int rate)
319{ 319{
320 struct ieee80211_local *local = hw_to_local(hw); 320 struct ieee80211_local *local = hw_to_local(hw);
321 struct net_device *bdev = dev_get_by_index(if_id);
322 struct ieee80211_sub_if_data *sdata;
321 u16 dur; 323 u16 dur;
322 int erp; 324 int erp;
323 325
326 if (unlikely(!bdev))
327 return 0;
328
329 sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
324 erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); 330 erp = ieee80211_is_erp_rate(hw->conf.phymode, rate);
325 dur = ieee80211_frame_duration(local, frame_len, rate, 331 dur = ieee80211_frame_duration(local, frame_len, rate,
326 erp, local->short_preamble); 332 erp, sdata->short_preamble);
327 333
334 dev_put(bdev);
328 return cpu_to_le16(dur); 335 return cpu_to_le16(dur);
329} 336}
330EXPORT_SYMBOL(ieee80211_generic_frame_duration); 337EXPORT_SYMBOL(ieee80211_generic_frame_duration);
331 338
332__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, 339__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id,
333 size_t frame_len, 340 size_t frame_len,
334 const struct ieee80211_tx_control *frame_txctl) 341 const struct ieee80211_tx_control *frame_txctl)
335{ 342{
336 struct ieee80211_local *local = hw_to_local(hw); 343 struct ieee80211_local *local = hw_to_local(hw);
337 struct ieee80211_rate *rate; 344 struct ieee80211_rate *rate;
338 int short_preamble = local->short_preamble; 345 struct net_device *bdev = dev_get_by_index(if_id);
346 struct ieee80211_sub_if_data *sdata;
347 int short_preamble;
339 int erp; 348 int erp;
340 u16 dur; 349 u16 dur;
341 350
351 if (unlikely(!bdev))
352 return 0;
353
354 sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
355 short_preamble = sdata->short_preamble;
356
342 rate = frame_txctl->rts_rate; 357 rate = frame_txctl->rts_rate;
343 erp = !!(rate->flags & IEEE80211_RATE_ERP); 358 erp = !!(rate->flags & IEEE80211_RATE_ERP);
344 359
@@ -352,20 +367,29 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
352 dur += ieee80211_frame_duration(local, 10, rate->rate, 367 dur += ieee80211_frame_duration(local, 10, rate->rate,
353 erp, short_preamble); 368 erp, short_preamble);
354 369
370 dev_put(bdev);
355 return cpu_to_le16(dur); 371 return cpu_to_le16(dur);
356} 372}
357EXPORT_SYMBOL(ieee80211_rts_duration); 373EXPORT_SYMBOL(ieee80211_rts_duration);
358 374
359__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, 375__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id,
360 size_t frame_len, 376 size_t frame_len,
361 const struct ieee80211_tx_control *frame_txctl) 377 const struct ieee80211_tx_control *frame_txctl)
362{ 378{
363 struct ieee80211_local *local = hw_to_local(hw); 379 struct ieee80211_local *local = hw_to_local(hw);
364 struct ieee80211_rate *rate; 380 struct ieee80211_rate *rate;
365 int short_preamble = local->short_preamble; 381 struct net_device *bdev = dev_get_by_index(if_id);
382 struct ieee80211_sub_if_data *sdata;
383 int short_preamble;
366 int erp; 384 int erp;
367 u16 dur; 385 u16 dur;
368 386
387 if (unlikely(!bdev))
388 return 0;
389
390 sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
391 short_preamble = sdata->short_preamble;
392
369 rate = frame_txctl->rts_rate; 393 rate = frame_txctl->rts_rate;
370 erp = !!(rate->flags & IEEE80211_RATE_ERP); 394 erp = !!(rate->flags & IEEE80211_RATE_ERP);
371 395
@@ -378,6 +402,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
378 erp, short_preamble); 402 erp, short_preamble);
379 } 403 }
380 404
405 dev_put(bdev);
381 return cpu_to_le16(dur); 406 return cpu_to_le16(dur);
382} 407}
383EXPORT_SYMBOL(ieee80211_ctstoself_duration); 408EXPORT_SYMBOL(ieee80211_ctstoself_duration);