aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2007-07-27 15:43:24 +0200
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 16:47:38 -0700
commit7e9ed18874f0df84b6651f0636e1cfdac43bc610 (patch)
tree7bac6083031a48e488c0de5bf71e7f9398e0e011 /net/mac80211/util.c
parent[MAC80211]: Add LONG_RETRY flag to ieee80211_tx_control (diff)
downloadlinux-dev-7e9ed18874f0df84b6651f0636e1cfdac43bc610.tar.xz
linux-dev-7e9ed18874f0df84b6651f0636e1cfdac43bc610.zip
[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 '')
-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,
}
/* Exported duration function for driver use */
-__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
+__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id,
size_t frame_len, int rate)
{
struct ieee80211_local *local = hw_to_local(hw);
+ struct net_device *bdev = dev_get_by_index(if_id);
+ struct ieee80211_sub_if_data *sdata;
u16 dur;
int erp;
+ if (unlikely(!bdev))
+ return 0;
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
erp = ieee80211_is_erp_rate(hw->conf.phymode, rate);
dur = ieee80211_frame_duration(local, frame_len, rate,
- erp, local->short_preamble);
+ erp, sdata->short_preamble);
+ dev_put(bdev);
return cpu_to_le16(dur);
}
EXPORT_SYMBOL(ieee80211_generic_frame_duration);
-__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
+__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id,
size_t frame_len,
const struct ieee80211_tx_control *frame_txctl)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_rate *rate;
- int short_preamble = local->short_preamble;
+ struct net_device *bdev = dev_get_by_index(if_id);
+ struct ieee80211_sub_if_data *sdata;
+ int short_preamble;
int erp;
u16 dur;
+ if (unlikely(!bdev))
+ return 0;
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
+ short_preamble = sdata->short_preamble;
+
rate = frame_txctl->rts_rate;
erp = !!(rate->flags & IEEE80211_RATE_ERP);
@@ -352,20 +367,29 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
dur += ieee80211_frame_duration(local, 10, rate->rate,
erp, short_preamble);
+ dev_put(bdev);
return cpu_to_le16(dur);
}
EXPORT_SYMBOL(ieee80211_rts_duration);
-__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
+__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id,
size_t frame_len,
const struct ieee80211_tx_control *frame_txctl)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_rate *rate;
- int short_preamble = local->short_preamble;
+ struct net_device *bdev = dev_get_by_index(if_id);
+ struct ieee80211_sub_if_data *sdata;
+ int short_preamble;
int erp;
u16 dur;
+ if (unlikely(!bdev))
+ return 0;
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
+ short_preamble = sdata->short_preamble;
+
rate = frame_txctl->rts_rate;
erp = !!(rate->flags & IEEE80211_RATE_ERP);
@@ -378,6 +402,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
erp, short_preamble);
}
+ dev_put(bdev);
return cpu_to_le16(dur);
}
EXPORT_SYMBOL(ieee80211_ctstoself_duration);