aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-12-18 19:31:26 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:36 -0500
commit32bfd35d4b63bd63de4bb0d791ef049c3c868726 (patch)
treec1c213a35a00bcbe71a2ecc6521e19dec66cf6eb /net/mac80211
parentf653211197f3841f383fa9757ef8ce182c6cf627 (diff)
mac80211: dont use interface indices in drivers
This patch gets rid of the if_id stuff where possible in favour of a new per-virtual-interface structure "struct ieee80211_vif". This structure is located at the end of the per-interface structure and contains a variable length driver-use data area. This has two advantages: * removes the need to look up interfaces by if_id, this is better for working with network namespaces and performance * allows drivers to store and retrieve per-interface data without having to allocate own lists/hash tables Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/ieee80211.c12
-rw-r--r--net/mac80211/ieee80211_i.h8
-rw-r--r--net/mac80211/ieee80211_iface.c2
-rw-r--r--net/mac80211/sta_info.c27
-rw-r--r--net/mac80211/tx.c46
-rw-r--r--net/mac80211/util.c45
6 files changed, 73 insertions, 67 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 4807e5215a79..42c27089f006 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -243,7 +243,7 @@ static int ieee80211_open(struct net_device *dev)
243 sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; 243 sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET;
244 /* fall through */ 244 /* fall through */
245 default: 245 default:
246 conf.if_id = dev->ifindex; 246 conf.vif = &sdata->vif;
247 conf.type = sdata->type; 247 conf.type = sdata->type;
248 conf.mac_addr = dev->dev_addr; 248 conf.mac_addr = dev->dev_addr;
249 res = local->ops->add_interface(local_to_hw(local), &conf); 249 res = local->ops->add_interface(local_to_hw(local), &conf);
@@ -378,7 +378,7 @@ static int ieee80211_stop(struct net_device *dev)
378 sdata->u.sta.extra_ie_len = 0; 378 sdata->u.sta.extra_ie_len = 0;
379 /* fall through */ 379 /* fall through */
380 default: 380 default:
381 conf.if_id = dev->ifindex; 381 conf.vif = &sdata->vif;
382 conf.type = sdata->type; 382 conf.type = sdata->type;
383 conf.mac_addr = dev->dev_addr; 383 conf.mac_addr = dev->dev_addr;
384 /* disable all keys for as long as this netdev is down */ 384 /* disable all keys for as long as this netdev is down */
@@ -515,7 +515,7 @@ static int __ieee80211_if_config(struct net_device *dev,
515 conf.beacon_control = control; 515 conf.beacon_control = control;
516 } 516 }
517 return local->ops->config_interface(local_to_hw(local), 517 return local->ops->config_interface(local_to_hw(local),
518 dev->ifindex, &conf); 518 &sdata->vif, &conf);
519} 519}
520 520
521int ieee80211_if_config(struct net_device *dev) 521int ieee80211_if_config(struct net_device *dev)
@@ -527,11 +527,13 @@ int ieee80211_if_config_beacon(struct net_device *dev)
527{ 527{
528 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 528 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
529 struct ieee80211_tx_control control; 529 struct ieee80211_tx_control control;
530 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
530 struct sk_buff *skb; 531 struct sk_buff *skb;
531 532
532 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) 533 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
533 return 0; 534 return 0;
534 skb = ieee80211_beacon_get(local_to_hw(local), dev->ifindex, &control); 535 skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif,
536 &control);
535 if (!skb) 537 if (!skb)
536 return -ENOMEM; 538 return -ENOMEM;
537 return __ieee80211_if_config(dev, skb, &control); 539 return __ieee80211_if_config(dev, skb, &control);
@@ -736,7 +738,7 @@ static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
736 struct ieee80211_tx_packet_data *pkt_data; 738 struct ieee80211_tx_packet_data *pkt_data;
737 739
738 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 740 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
739 pkt_data->ifindex = control->ifindex; 741 pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex;
740 pkt_data->flags = 0; 742 pkt_data->flags = 0;
741 if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) 743 if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS)
742 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; 744 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index b898b316bda1..c551a7f379e0 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -387,8 +387,16 @@ struct ieee80211_sub_if_data {
387 struct dentry *default_key; 387 struct dentry *default_key;
388 } debugfs; 388 } debugfs;
389#endif 389#endif
390 /* must be last, dynamically sized area in this! */
391 struct ieee80211_vif vif;
390}; 392};
391 393
394static inline
395struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
396{
397 return container_of(p, struct ieee80211_sub_if_data, vif);
398}
399
392#define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev) 400#define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)
393 401
394enum { 402enum {
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c
index 7cfd8660b231..b72066378805 100644
--- a/net/mac80211/ieee80211_iface.c
+++ b/net/mac80211/ieee80211_iface.c
@@ -47,7 +47,7 @@ int ieee80211_if_add(struct net_device *dev, const char *name,
47 int ret; 47 int ret;
48 48
49 ASSERT_RTNL(); 49 ASSERT_RTNL();
50 ndev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), 50 ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size,
51 name, ieee80211_if_setup); 51 name, ieee80211_if_setup);
52 if (!ndev) 52 if (!ndev)
53 return -ENOMEM; 53 return -ENOMEM;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 1257c7aab2a5..32e241764725 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -177,9 +177,16 @@ struct sta_info * sta_info_add(struct ieee80211_local *local,
177 list_add(&sta->list, &local->sta_list); 177 list_add(&sta->list, &local->sta_list);
178 local->num_sta++; 178 local->num_sta++;
179 sta_info_hash_add(local, sta); 179 sta_info_hash_add(local, sta);
180 if (local->ops->sta_notify) 180 if (local->ops->sta_notify) {
181 local->ops->sta_notify(local_to_hw(local), dev->ifindex, 181 struct ieee80211_sub_if_data *sdata;
182 STA_NOTIFY_ADD, addr); 182
183 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
184 if (sdata->type == IEEE80211_IF_TYPE_VLAN)
185 sdata = sdata->u.vlan.ap;
186
187 local->ops->sta_notify(local_to_hw(local), &sdata->vif,
188 STA_NOTIFY_ADD, addr);
189 }
183 write_unlock_bh(&local->sta_lock); 190 write_unlock_bh(&local->sta_lock);
184 191
185#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 192#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -247,9 +254,17 @@ void sta_info_free(struct sta_info *sta)
247 ieee80211_key_free(sta->key); 254 ieee80211_key_free(sta->key);
248 sta->key = NULL; 255 sta->key = NULL;
249 256
250 if (local->ops->sta_notify) 257 if (local->ops->sta_notify) {
251 local->ops->sta_notify(local_to_hw(local), sta->dev->ifindex, 258 struct ieee80211_sub_if_data *sdata;
252 STA_NOTIFY_REMOVE, sta->addr); 259
260 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
261
262 if (sdata->type == IEEE80211_IF_TYPE_VLAN)
263 sdata = sdata->u.vlan.ap;
264
265 local->ops->sta_notify(local_to_hw(local), &sdata->vif,
266 STA_NOTIFY_REMOVE, sta->addr);
267 }
253 268
254 rate_control_remove_sta_debugfs(sta); 269 rate_control_remove_sta_debugfs(sta);
255 ieee80211_sta_debugfs_remove(sta); 270 ieee80211_sta_debugfs_remove(sta);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index f6194167253d..1b772ee2fe14 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -999,9 +999,7 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
999 return TXRX_CONTINUE; 999 return TXRX_CONTINUE;
1000} 1000}
1001 1001
1002/* Device in tx->dev has a reference added; use dev_put(tx->dev) when 1002/*
1003 * finished with it.
1004 *
1005 * NB: @tx is uninitialised when passed in here 1003 * NB: @tx is uninitialised when passed in here
1006 */ 1004 */
1007static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, 1005static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
@@ -1022,6 +1020,7 @@ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
1022 return -ENODEV; 1020 return -ENODEV;
1023 /* initialises tx with control */ 1021 /* initialises tx with control */
1024 __ieee80211_tx_prepare(tx, skb, dev, control); 1022 __ieee80211_tx_prepare(tx, skb, dev, control);
1023 dev_put(dev);
1025 return 0; 1024 return 0;
1026} 1025}
1027 1026
@@ -1252,7 +1251,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1252 } 1251 }
1253 } 1252 }
1254 1253
1255 control.ifindex = odev->ifindex; 1254 control.vif = &osdata->vif;
1256 control.type = osdata->type; 1255 control.type = osdata->type;
1257 if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS) 1256 if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS)
1258 control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS; 1257 control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS;
@@ -1691,7 +1690,8 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local,
1691 read_unlock_bh(&local->sta_lock); 1690 read_unlock_bh(&local->sta_lock);
1692} 1691}
1693 1692
1694struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, 1693struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1694 struct ieee80211_vif *vif,
1695 struct ieee80211_tx_control *control) 1695 struct ieee80211_tx_control *control)
1696{ 1696{
1697 struct ieee80211_local *local = hw_to_local(hw); 1697 struct ieee80211_local *local = hw_to_local(hw);
@@ -1703,19 +1703,16 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
1703 u8 *b_head, *b_tail; 1703 u8 *b_head, *b_tail;
1704 int bh_len, bt_len; 1704 int bh_len, bt_len;
1705 1705
1706 bdev = dev_get_by_index(&init_net, if_id); 1706 sdata = vif_to_sdata(vif);
1707 if (bdev) { 1707 bdev = sdata->dev;
1708 sdata = IEEE80211_DEV_TO_SUB_IF(bdev); 1708 ap = &sdata->u.ap;
1709 ap = &sdata->u.ap;
1710 dev_put(bdev);
1711 }
1712 1709
1713 if (!ap || sdata->type != IEEE80211_IF_TYPE_AP || 1710 if (!ap || sdata->type != IEEE80211_IF_TYPE_AP ||
1714 !ap->beacon_head) { 1711 !ap->beacon_head) {
1715#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1712#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1716 if (net_ratelimit()) 1713 if (net_ratelimit())
1717 printk(KERN_DEBUG "no beacon data avail for idx=%d " 1714 printk(KERN_DEBUG "no beacon data avail for %s\n",
1718 "(%s)\n", if_id, bdev ? bdev->name : "N/A"); 1715 bdev->name);
1719#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 1716#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
1720 return NULL; 1717 return NULL;
1721 } 1718 }
@@ -1771,7 +1768,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
1771} 1768}
1772EXPORT_SYMBOL(ieee80211_beacon_get); 1769EXPORT_SYMBOL(ieee80211_beacon_get);
1773 1770
1774void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, 1771void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1775 const void *frame, size_t frame_len, 1772 const void *frame, size_t frame_len,
1776 const struct ieee80211_tx_control *frame_txctl, 1773 const struct ieee80211_tx_control *frame_txctl,
1777 struct ieee80211_rts *rts) 1774 struct ieee80211_rts *rts)
@@ -1781,13 +1778,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id,
1781 1778
1782 fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS; 1779 fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS;
1783 rts->frame_control = cpu_to_le16(fctl); 1780 rts->frame_control = cpu_to_le16(fctl);
1784 rts->duration = ieee80211_rts_duration(hw, if_id, frame_len, frame_txctl); 1781 rts->duration = ieee80211_rts_duration(hw, vif, frame_len,
1782 frame_txctl);
1785 memcpy(rts->ra, hdr->addr1, sizeof(rts->ra)); 1783 memcpy(rts->ra, hdr->addr1, sizeof(rts->ra));
1786 memcpy(rts->ta, hdr->addr2, sizeof(rts->ta)); 1784 memcpy(rts->ta, hdr->addr2, sizeof(rts->ta));
1787} 1785}
1788EXPORT_SYMBOL(ieee80211_rts_get); 1786EXPORT_SYMBOL(ieee80211_rts_get);
1789 1787
1790void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, 1788void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1791 const void *frame, size_t frame_len, 1789 const void *frame, size_t frame_len,
1792 const struct ieee80211_tx_control *frame_txctl, 1790 const struct ieee80211_tx_control *frame_txctl,
1793 struct ieee80211_cts *cts) 1791 struct ieee80211_cts *cts)
@@ -1797,13 +1795,15 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id,
1797 1795
1798 fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS; 1796 fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS;
1799 cts->frame_control = cpu_to_le16(fctl); 1797 cts->frame_control = cpu_to_le16(fctl);
1800 cts->duration = ieee80211_ctstoself_duration(hw, if_id, frame_len, frame_txctl); 1798 cts->duration = ieee80211_ctstoself_duration(hw, vif,
1799 frame_len, frame_txctl);
1801 memcpy(cts->ra, hdr->addr1, sizeof(cts->ra)); 1800 memcpy(cts->ra, hdr->addr1, sizeof(cts->ra));
1802} 1801}
1803EXPORT_SYMBOL(ieee80211_ctstoself_get); 1802EXPORT_SYMBOL(ieee80211_ctstoself_get);
1804 1803
1805struct sk_buff * 1804struct sk_buff *
1806ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, 1805ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1806 struct ieee80211_vif *vif,
1807 struct ieee80211_tx_control *control) 1807 struct ieee80211_tx_control *control)
1808{ 1808{
1809 struct ieee80211_local *local = hw_to_local(hw); 1809 struct ieee80211_local *local = hw_to_local(hw);
@@ -1816,12 +1816,9 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id,
1816 struct ieee80211_sub_if_data *sdata; 1816 struct ieee80211_sub_if_data *sdata;
1817 struct ieee80211_if_ap *bss = NULL; 1817 struct ieee80211_if_ap *bss = NULL;
1818 1818
1819 bdev = dev_get_by_index(&init_net, if_id); 1819 sdata = vif_to_sdata(vif);
1820 if (bdev) { 1820 bdev = sdata->dev;
1821 sdata = IEEE80211_DEV_TO_SUB_IF(bdev); 1821
1822 bss = &sdata->u.ap;
1823 dev_put(bdev);
1824 }
1825 if (!bss || sdata->type != IEEE80211_IF_TYPE_AP || !bss->beacon_head) 1822 if (!bss || sdata->type != IEEE80211_IF_TYPE_AP || !bss->beacon_head)
1826 return NULL; 1823 return NULL;
1827 1824
@@ -1857,7 +1854,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id,
1857 if (res == TXRX_DROP || res == TXRX_QUEUED) 1854 if (res == TXRX_DROP || res == TXRX_QUEUED)
1858 break; 1855 break;
1859 } 1856 }
1860 dev_put(tx.dev);
1861 skb = tx.skb; /* handlers are allowed to change skb */ 1857 skb = tx.skb; /* handlers are allowed to change skb */
1862 1858
1863 if (res == TXRX_DROP) { 1859 if (res == TXRX_DROP) {
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,
302} 302}
303 303
304/* Exported duration function for driver use */ 304/* Exported duration function for driver use */
305__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, 305__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
306 struct ieee80211_vif *vif,
306 size_t frame_len, int rate) 307 size_t frame_len, int rate)
307{ 308{
308 struct ieee80211_local *local = hw_to_local(hw); 309 struct ieee80211_local *local = hw_to_local(hw);
309 struct net_device *bdev = dev_get_by_index(&init_net, if_id); 310 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
310 struct ieee80211_sub_if_data *sdata;
311 u16 dur; 311 u16 dur;
312 int erp; 312 int erp;
313 313
314 if (unlikely(!bdev))
315 return 0;
316
317 sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
318 erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); 314 erp = ieee80211_is_erp_rate(hw->conf.phymode, rate);
319 dur = ieee80211_frame_duration(local, frame_len, rate, 315 dur = ieee80211_frame_duration(local, frame_len, rate,
320 erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); 316 erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE);
321 317
322 dev_put(bdev);
323 return cpu_to_le16(dur); 318 return cpu_to_le16(dur);
324} 319}
325EXPORT_SYMBOL(ieee80211_generic_frame_duration); 320EXPORT_SYMBOL(ieee80211_generic_frame_duration);
326 321
327__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, 322__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
328 size_t frame_len, 323 struct ieee80211_vif *vif, size_t frame_len,
329 const struct ieee80211_tx_control *frame_txctl) 324 const struct ieee80211_tx_control *frame_txctl)
330{ 325{
331 struct ieee80211_local *local = hw_to_local(hw); 326 struct ieee80211_local *local = hw_to_local(hw);
332 struct ieee80211_rate *rate; 327 struct ieee80211_rate *rate;
333 struct net_device *bdev = dev_get_by_index(&init_net, if_id); 328 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
334 struct ieee80211_sub_if_data *sdata;
335 int short_preamble; 329 int short_preamble;
336 int erp; 330 int erp;
337 u16 dur; 331 u16 dur;
338 332
339 if (unlikely(!bdev))
340 return 0;
341
342 sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
343 short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; 333 short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE;
344 334
345 rate = frame_txctl->rts_rate; 335 rate = frame_txctl->rts_rate;
@@ -355,27 +345,22 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id,
355 dur += ieee80211_frame_duration(local, 10, rate->rate, 345 dur += ieee80211_frame_duration(local, 10, rate->rate,
356 erp, short_preamble); 346 erp, short_preamble);
357 347
358 dev_put(bdev);
359 return cpu_to_le16(dur); 348 return cpu_to_le16(dur);
360} 349}
361EXPORT_SYMBOL(ieee80211_rts_duration); 350EXPORT_SYMBOL(ieee80211_rts_duration);
362 351
363__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, 352__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
353 struct ieee80211_vif *vif,
364 size_t frame_len, 354 size_t frame_len,
365 const struct ieee80211_tx_control *frame_txctl) 355 const struct ieee80211_tx_control *frame_txctl)
366{ 356{
367 struct ieee80211_local *local = hw_to_local(hw); 357 struct ieee80211_local *local = hw_to_local(hw);
368 struct ieee80211_rate *rate; 358 struct ieee80211_rate *rate;
369 struct net_device *bdev = dev_get_by_index(&init_net, if_id); 359 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
370 struct ieee80211_sub_if_data *sdata;
371 int short_preamble; 360 int short_preamble;
372 int erp; 361 int erp;
373 u16 dur; 362 u16 dur;
374 363
375 if (unlikely(!bdev))
376 return 0;
377
378 sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
379 short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; 364 short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE;
380 365
381 rate = frame_txctl->rts_rate; 366 rate = frame_txctl->rts_rate;
@@ -390,7 +375,6 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id,
390 erp, short_preamble); 375 erp, short_preamble);
391 } 376 }
392 377
393 dev_put(bdev);
394 return cpu_to_le16(dur); 378 return cpu_to_le16(dur);
395} 379}
396EXPORT_SYMBOL(ieee80211_ctstoself_duration); 380EXPORT_SYMBOL(ieee80211_ctstoself_duration);
@@ -475,10 +459,11 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw)
475} 459}
476EXPORT_SYMBOL(ieee80211_wake_queues); 460EXPORT_SYMBOL(ieee80211_wake_queues);
477 461
478void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 462void ieee80211_iterate_active_interfaces(
479 void (*iterator)(void *data, u8 *mac, 463 struct ieee80211_hw *hw,
480 int if_id), 464 void (*iterator)(void *data, u8 *mac,
481 void *data) 465 struct ieee80211_vif *vif),
466 void *data)
482{ 467{
483 struct ieee80211_local *local = hw_to_local(hw); 468 struct ieee80211_local *local = hw_to_local(hw);
484 struct ieee80211_sub_if_data *sdata; 469 struct ieee80211_sub_if_data *sdata;
@@ -501,7 +486,7 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
501 continue; 486 continue;
502 if (netif_running(sdata->dev)) 487 if (netif_running(sdata->dev))
503 iterator(data, sdata->dev->dev_addr, 488 iterator(data, sdata->dev->dev_addr,
504 sdata->dev->ifindex); 489 &sdata->vif);
505 } 490 }
506 491
507 rcu_read_unlock(); 492 rcu_read_unlock();