summaryrefslogtreecommitdiff
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index adb85dd5098d..15503ca3e945 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -302,44 +302,34 @@ 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, int if_id,
+__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
size_t frame_len, int rate)
{
struct ieee80211_local *local = hw_to_local(hw);
- struct net_device *bdev = dev_get_by_index(&init_net, if_id);
- struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
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, sdata->flags & IEEE80211_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, int if_id,
- size_t frame_len,
+__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif, size_t frame_len,
const struct ieee80211_tx_control *frame_txctl)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_rate *rate;
- struct net_device *bdev = dev_get_by_index(&init_net, if_id);
- struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
int short_preamble;
int erp;
u16 dur;
- if (unlikely(!bdev))
- return 0;
-
- sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE;
rate = frame_txctl->rts_rate;
@@ -355,27 +345,22 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id,
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, int if_id,
+__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
size_t frame_len,
const struct ieee80211_tx_control *frame_txctl)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_rate *rate;
- struct net_device *bdev = dev_get_by_index(&init_net, if_id);
- struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
int short_preamble;
int erp;
u16 dur;
- if (unlikely(!bdev))
- return 0;
-
- sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE;
rate = frame_txctl->rts_rate;
@@ -390,7 +375,6 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id,
erp, short_preamble);
}
- dev_put(bdev);
return cpu_to_le16(dur);
}
EXPORT_SYMBOL(ieee80211_ctstoself_duration);
@@ -475,10 +459,11 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw)
}
EXPORT_SYMBOL(ieee80211_wake_queues);
-void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
- void (*iterator)(void *data, u8 *mac,
- int if_id),
- void *data)
+void ieee80211_iterate_active_interfaces(
+ struct ieee80211_hw *hw,
+ void (*iterator)(void *data, u8 *mac,
+ struct ieee80211_vif *vif),
+ void *data)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
@@ -501,7 +486,7 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
continue;
if (netif_running(sdata->dev))
iterator(data, sdata->dev->dev_addr,
- sdata->dev->ifindex);
+ &sdata->vif);
}
rcu_read_unlock();