aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-06-17 11:43:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:30 -0400
commit3b8d81e020f77c9da8b85b0685c8cd2ca7c7b150 (patch)
treea19fcddbf28fecdbd13ad009fe07b8afc5e95c90 /net
parentc4029083e2acb82229c43b791c07afb089d972ff (diff)
mac80211: remove master netdev
With the internal 'pending' queue system in place, we can simply put packets there instead of pushing them off to the master dev, getting rid of the master interface completely. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/agg-tx.c3
-rw-r--r--net/mac80211/debugfs.c2
-rw-r--r--net/mac80211/ieee80211_i.h19
-rw-r--r--net/mac80211/iface.c43
-rw-r--r--net/mac80211/main.c120
-rw-r--r--net/mac80211/rate.c2
-rw-r--r--net/mac80211/rx.c16
-rw-r--r--net/mac80211/scan.c19
-rw-r--r--net/mac80211/tx.c299
-rw-r--r--net/mac80211/util.c52
-rw-r--r--net/mac80211/wme.c6
-rw-r--r--net/mac80211/wme.h3
12 files changed, 192 insertions, 392 deletions
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 9e5762ad307d..1958c7c42cd9 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -383,9 +383,6 @@ static void ieee80211_agg_splice_packets(struct ieee80211_local *local,
383 383
384 if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) { 384 if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) {
385 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 385 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
386 /* mark queue as pending, it is stopped already */
387 __set_bit(IEEE80211_QUEUE_STOP_REASON_PENDING,
388 &local->queue_stop_reasons[queue]);
389 /* copy over remaining packets */ 386 /* copy over remaining packets */
390 skb_queue_splice_tail_init( 387 skb_queue_splice_tail_init(
391 &sta->ampdu_mlme.tid_tx[tid]->pending, 388 &sta->ampdu_mlme.tid_tx[tid]->pending,
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 6c439cd5ccea..96991b68f048 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -175,7 +175,7 @@ static ssize_t queues_read(struct file *file, char __user *user_buf,
175 for (q = 0; q < local->hw.queues; q++) 175 for (q = 0; q < local->hw.queues; q++)
176 res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q, 176 res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q,
177 local->queue_stop_reasons[q], 177 local->queue_stop_reasons[q],
178 __netif_subqueue_stopped(local->mdev, q)); 178 skb_queue_len(&local->pending[q]));
179 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 179 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
180 180
181 return simple_read_from_buffer(user_buf, count, ppos, buf, res); 181 return simple_read_from_buffer(user_buf, count, ppos, buf, res);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a34bca2dc52f..6a0177137dd5 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -567,14 +567,9 @@ enum queue_stop_reason {
567 IEEE80211_QUEUE_STOP_REASON_CSA, 567 IEEE80211_QUEUE_STOP_REASON_CSA,
568 IEEE80211_QUEUE_STOP_REASON_AGGREGATION, 568 IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
569 IEEE80211_QUEUE_STOP_REASON_SUSPEND, 569 IEEE80211_QUEUE_STOP_REASON_SUSPEND,
570 IEEE80211_QUEUE_STOP_REASON_PENDING,
571 IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 570 IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
572}; 571};
573 572
574struct ieee80211_master_priv {
575 struct ieee80211_local *local;
576};
577
578struct ieee80211_local { 573struct ieee80211_local {
579 /* embed the driver visible part. 574 /* embed the driver visible part.
580 * don't cast (use the static inlines below), but we keep 575 * don't cast (use the static inlines below), but we keep
@@ -587,13 +582,20 @@ struct ieee80211_local {
587 /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ 582 /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
588 spinlock_t queue_stop_reason_lock; 583 spinlock_t queue_stop_reason_lock;
589 584
590 struct net_device *mdev; /* wmaster# - "master" 802.11 device */
591 int open_count; 585 int open_count;
592 int monitors, cooked_mntrs; 586 int monitors, cooked_mntrs;
593 /* number of interfaces with corresponding FIF_ flags */ 587 /* number of interfaces with corresponding FIF_ flags */
594 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss; 588 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss;
595 unsigned int filter_flags; /* FIF_* */ 589 unsigned int filter_flags; /* FIF_* */
596 struct iw_statistics wstats; 590 struct iw_statistics wstats;
591
592 /* protects the aggregated multicast list and filter calls */
593 spinlock_t filter_lock;
594
595 /* aggregated multicast list */
596 struct dev_addr_list *mc_list;
597 int mc_count;
598
597 bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 599 bool tim_in_locked_section; /* see ieee80211_beacon_get() */
598 600
599 /* 601 /*
@@ -813,10 +815,6 @@ struct ieee80211_local {
813static inline struct ieee80211_sub_if_data * 815static inline struct ieee80211_sub_if_data *
814IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) 816IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
815{ 817{
816 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
817
818 BUG_ON(!local || local->mdev == dev);
819
820 return netdev_priv(dev); 818 return netdev_priv(dev);
821} 819}
822 820
@@ -996,7 +994,6 @@ void ieee80211_recalc_idle(struct ieee80211_local *local);
996/* tx handling */ 994/* tx handling */
997void ieee80211_clear_tx_pending(struct ieee80211_local *local); 995void ieee80211_clear_tx_pending(struct ieee80211_local *local);
998void ieee80211_tx_pending(unsigned long data); 996void ieee80211_tx_pending(unsigned long data);
999int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
1000int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev); 997int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
1001int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); 998int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
1002 999
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 090aa5a47182..2f797a86ced5 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -190,10 +190,6 @@ static int ieee80211_open(struct net_device *dev)
190 ETH_ALEN); 190 ETH_ALEN);
191 } 191 }
192 192
193 if (compare_ether_addr(null_addr, local->mdev->dev_addr) == 0)
194 memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr,
195 ETH_ALEN);
196
197 /* 193 /*
198 * Validate the MAC address for this device. 194 * Validate the MAC address for this device.
199 */ 195 */
@@ -229,9 +225,9 @@ static int ieee80211_open(struct net_device *dev)
229 if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) 225 if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS)
230 local->fif_other_bss++; 226 local->fif_other_bss++;
231 227
232 netif_addr_lock_bh(local->mdev); 228 spin_lock_bh(&local->filter_lock);
233 ieee80211_configure_filter(local); 229 ieee80211_configure_filter(local);
234 netif_addr_unlock_bh(local->mdev); 230 spin_unlock_bh(&local->filter_lock);
235 break; 231 break;
236 default: 232 default:
237 conf.vif = &sdata->vif; 233 conf.vif = &sdata->vif;
@@ -243,9 +239,9 @@ static int ieee80211_open(struct net_device *dev)
243 239
244 if (ieee80211_vif_is_mesh(&sdata->vif)) { 240 if (ieee80211_vif_is_mesh(&sdata->vif)) {
245 local->fif_other_bss++; 241 local->fif_other_bss++;
246 netif_addr_lock_bh(local->mdev); 242 spin_lock_bh(&local->filter_lock);
247 ieee80211_configure_filter(local); 243 ieee80211_configure_filter(local);
248 netif_addr_unlock_bh(local->mdev); 244 spin_unlock_bh(&local->filter_lock);
249 245
250 ieee80211_start_mesh(sdata); 246 ieee80211_start_mesh(sdata);
251 } 247 }
@@ -279,10 +275,6 @@ static int ieee80211_open(struct net_device *dev)
279 } 275 }
280 276
281 if (local->open_count == 0) { 277 if (local->open_count == 0) {
282 res = dev_open(local->mdev);
283 WARN_ON(res);
284 if (res)
285 goto err_del_interface;
286 tasklet_enable(&local->tx_pending_tasklet); 278 tasklet_enable(&local->tx_pending_tasklet);
287 tasklet_enable(&local->tasklet); 279 tasklet_enable(&local->tasklet);
288 } 280 }
@@ -393,7 +385,14 @@ static int ieee80211_stop(struct net_device *dev)
393 if (sdata->flags & IEEE80211_SDATA_PROMISC) 385 if (sdata->flags & IEEE80211_SDATA_PROMISC)
394 atomic_dec(&local->iff_promiscs); 386 atomic_dec(&local->iff_promiscs);
395 387
396 dev_mc_unsync(local->mdev, dev); 388 netif_addr_lock_bh(dev);
389 spin_lock_bh(&local->filter_lock);
390 __dev_addr_unsync(&local->mc_list, &local->mc_count,
391 &dev->mc_list, &dev->mc_count);
392 ieee80211_configure_filter(local);
393 spin_unlock_bh(&local->filter_lock);
394 netif_addr_unlock_bh(dev);
395
397 del_timer_sync(&local->dynamic_ps_timer); 396 del_timer_sync(&local->dynamic_ps_timer);
398 cancel_work_sync(&local->dynamic_ps_enable_work); 397 cancel_work_sync(&local->dynamic_ps_enable_work);
399 398
@@ -442,9 +441,9 @@ static int ieee80211_stop(struct net_device *dev)
442 if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) 441 if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS)
443 local->fif_other_bss--; 442 local->fif_other_bss--;
444 443
445 netif_addr_lock_bh(local->mdev); 444 spin_lock_bh(&local->filter_lock);
446 ieee80211_configure_filter(local); 445 ieee80211_configure_filter(local);
447 netif_addr_unlock_bh(local->mdev); 446 spin_unlock_bh(&local->filter_lock);
448 break; 447 break;
449 case NL80211_IFTYPE_STATION: 448 case NL80211_IFTYPE_STATION:
450 del_timer_sync(&sdata->u.mgd.chswitch_timer); 449 del_timer_sync(&sdata->u.mgd.chswitch_timer);
@@ -487,9 +486,9 @@ static int ieee80211_stop(struct net_device *dev)
487 local->fif_other_bss--; 486 local->fif_other_bss--;
488 atomic_dec(&local->iff_allmultis); 487 atomic_dec(&local->iff_allmultis);
489 488
490 netif_addr_lock_bh(local->mdev); 489 spin_lock_bh(&local->filter_lock);
491 ieee80211_configure_filter(local); 490 ieee80211_configure_filter(local);
492 netif_addr_unlock_bh(local->mdev); 491 spin_unlock_bh(&local->filter_lock);
493 492
494 ieee80211_stop_mesh(sdata); 493 ieee80211_stop_mesh(sdata);
495 } 494 }
@@ -535,9 +534,6 @@ static int ieee80211_stop(struct net_device *dev)
535 ieee80211_recalc_ps(local, -1); 534 ieee80211_recalc_ps(local, -1);
536 535
537 if (local->open_count == 0) { 536 if (local->open_count == 0) {
538 if (netif_running(local->mdev))
539 dev_close(local->mdev);
540
541 drv_stop(local); 537 drv_stop(local);
542 538
543 ieee80211_led_radio(local, false); 539 ieee80211_led_radio(local, false);
@@ -584,8 +580,11 @@ static void ieee80211_set_multicast_list(struct net_device *dev)
584 atomic_dec(&local->iff_promiscs); 580 atomic_dec(&local->iff_promiscs);
585 sdata->flags ^= IEEE80211_SDATA_PROMISC; 581 sdata->flags ^= IEEE80211_SDATA_PROMISC;
586 } 582 }
587 583 spin_lock_bh(&local->filter_lock);
588 dev_mc_sync(local->mdev, dev); 584 __dev_addr_sync(&local->mc_list, &local->mc_count,
585 &dev->mc_list, &dev->mc_count);
586 ieee80211_configure_filter(local);
587 spin_unlock_bh(&local->filter_lock);
589} 588}
590 589
591/* 590/*
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 5b69f5f07299..3234f3751d22 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -83,75 +83,14 @@ void ieee80211_configure_filter(struct ieee80211_local *local)
83 new_flags |= (1<<31); 83 new_flags |= (1<<31);
84 84
85 drv_configure_filter(local, changed_flags, &new_flags, 85 drv_configure_filter(local, changed_flags, &new_flags,
86 local->mdev->mc_count, 86 local->mc_count,
87 local->mdev->mc_list); 87 local->mc_list);
88 88
89 WARN_ON(new_flags & (1<<31)); 89 WARN_ON(new_flags & (1<<31));
90 90
91 local->filter_flags = new_flags & ~(1<<31); 91 local->filter_flags = new_flags & ~(1<<31);
92} 92}
93 93
94/* master interface */
95
96static int header_parse_80211(const struct sk_buff *skb, unsigned char *haddr)
97{
98 memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */
99 return ETH_ALEN;
100}
101
102static const struct header_ops ieee80211_header_ops = {
103 .create = eth_header,
104 .parse = header_parse_80211,
105 .rebuild = eth_rebuild_header,
106 .cache = eth_header_cache,
107 .cache_update = eth_header_cache_update,
108};
109
110static int ieee80211_master_open(struct net_device *dev)
111{
112 struct ieee80211_master_priv *mpriv = netdev_priv(dev);
113 struct ieee80211_local *local = mpriv->local;
114 struct ieee80211_sub_if_data *sdata;
115 int res = -EOPNOTSUPP;
116
117 /* we hold the RTNL here so can safely walk the list */
118 list_for_each_entry(sdata, &local->interfaces, list) {
119 if (netif_running(sdata->dev)) {
120 res = 0;
121 break;
122 }
123 }
124
125 if (res)
126 return res;
127
128 netif_tx_start_all_queues(local->mdev);
129
130 return 0;
131}
132
133static int ieee80211_master_stop(struct net_device *dev)
134{
135 struct ieee80211_master_priv *mpriv = netdev_priv(dev);
136 struct ieee80211_local *local = mpriv->local;
137 struct ieee80211_sub_if_data *sdata;
138
139 /* we hold the RTNL here so can safely walk the list */
140 list_for_each_entry(sdata, &local->interfaces, list)
141 if (netif_running(sdata->dev))
142 dev_close(sdata->dev);
143
144 return 0;
145}
146
147static void ieee80211_master_set_multicast_list(struct net_device *dev)
148{
149 struct ieee80211_master_priv *mpriv = netdev_priv(dev);
150 struct ieee80211_local *local = mpriv->local;
151
152 ieee80211_configure_filter(local);
153}
154
155int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) 94int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
156{ 95{
157 struct ieee80211_channel *chan, *scan_chan; 96 struct ieee80211_channel *chan, *scan_chan;
@@ -310,7 +249,6 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
310 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 249 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
311 int tmp; 250 int tmp;
312 251
313 skb->dev = local->mdev;
314 skb->pkt_type = IEEE80211_TX_STATUS_MSG; 252 skb->pkt_type = IEEE80211_TX_STATUS_MSG;
315 skb_queue_tail(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS ? 253 skb_queue_tail(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS ?
316 &local->skb_queue : &local->skb_queue_unreliable, skb); 254 &local->skb_queue : &local->skb_queue_unreliable, skb);
@@ -716,7 +654,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
716 mutex_init(&local->scan_mtx); 654 mutex_init(&local->scan_mtx);
717 655
718 spin_lock_init(&local->key_lock); 656 spin_lock_init(&local->key_lock);
719 657 spin_lock_init(&local->filter_lock);
720 spin_lock_init(&local->queue_stop_reason_lock); 658 spin_lock_init(&local->queue_stop_reason_lock);
721 659
722 INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work); 660 INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
@@ -752,30 +690,11 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
752} 690}
753EXPORT_SYMBOL(ieee80211_alloc_hw); 691EXPORT_SYMBOL(ieee80211_alloc_hw);
754 692
755static const struct net_device_ops ieee80211_master_ops = {
756 .ndo_start_xmit = ieee80211_master_start_xmit,
757 .ndo_open = ieee80211_master_open,
758 .ndo_stop = ieee80211_master_stop,
759 .ndo_set_multicast_list = ieee80211_master_set_multicast_list,
760 .ndo_select_queue = ieee80211_select_queue,
761};
762
763static void ieee80211_master_setup(struct net_device *mdev)
764{
765 mdev->type = ARPHRD_IEEE80211;
766 mdev->netdev_ops = &ieee80211_master_ops;
767 mdev->header_ops = &ieee80211_header_ops;
768 mdev->tx_queue_len = 1000;
769 mdev->addr_len = ETH_ALEN;
770}
771
772int ieee80211_register_hw(struct ieee80211_hw *hw) 693int ieee80211_register_hw(struct ieee80211_hw *hw)
773{ 694{
774 struct ieee80211_local *local = hw_to_local(hw); 695 struct ieee80211_local *local = hw_to_local(hw);
775 int result; 696 int result;
776 enum ieee80211_band band; 697 enum ieee80211_band band;
777 struct net_device *mdev;
778 struct ieee80211_master_priv *mpriv;
779 int channels, i, j, max_bitrates; 698 int channels, i, j, max_bitrates;
780 bool supp_ht; 699 bool supp_ht;
781 static const u32 cipher_suites[] = { 700 static const u32 cipher_suites[] = {
@@ -874,16 +793,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
874 if (hw->queues > IEEE80211_MAX_QUEUES) 793 if (hw->queues > IEEE80211_MAX_QUEUES)
875 hw->queues = IEEE80211_MAX_QUEUES; 794 hw->queues = IEEE80211_MAX_QUEUES;
876 795
877 mdev = alloc_netdev_mq(sizeof(struct ieee80211_master_priv),
878 "wmaster%d", ieee80211_master_setup,
879 hw->queues);
880 if (!mdev)
881 goto fail_mdev_alloc;
882
883 mpriv = netdev_priv(mdev);
884 mpriv->local = local;
885 local->mdev = mdev;
886
887 local->hw.workqueue = 796 local->hw.workqueue =
888 create_singlethread_workqueue(wiphy_name(local->hw.wiphy)); 797 create_singlethread_workqueue(wiphy_name(local->hw.wiphy));
889 if (!local->hw.workqueue) { 798 if (!local->hw.workqueue) {
@@ -918,17 +827,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
918 } 827 }
919 828
920 rtnl_lock(); 829 rtnl_lock();
921 result = dev_alloc_name(local->mdev, local->mdev->name);
922 if (result < 0)
923 goto fail_dev;
924
925 memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
926 SET_NETDEV_DEV(local->mdev, wiphy_dev(local->hw.wiphy));
927 local->mdev->features |= NETIF_F_NETNS_LOCAL;
928
929 result = register_netdevice(local->mdev);
930 if (result < 0)
931 goto fail_dev;
932 830
933 result = ieee80211_init_rate_ctrl_alg(local, 831 result = ieee80211_init_rate_ctrl_alg(local,
934 hw->rate_control_algorithm); 832 hw->rate_control_algorithm);
@@ -981,9 +879,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
981 ieee80211_led_exit(local); 879 ieee80211_led_exit(local);
982 ieee80211_remove_interfaces(local); 880 ieee80211_remove_interfaces(local);
983 fail_rate: 881 fail_rate:
984 unregister_netdevice(local->mdev);
985 local->mdev = NULL;
986 fail_dev:
987 rtnl_unlock(); 882 rtnl_unlock();
988 ieee80211_wep_free(local); 883 ieee80211_wep_free(local);
989 fail_wep: 884 fail_wep:
@@ -992,9 +887,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
992 debugfs_hw_del(local); 887 debugfs_hw_del(local);
993 destroy_workqueue(local->hw.workqueue); 888 destroy_workqueue(local->hw.workqueue);
994 fail_workqueue: 889 fail_workqueue:
995 if (local->mdev)
996 free_netdev(local->mdev);
997 fail_mdev_alloc:
998 wiphy_unregister(local->hw.wiphy); 890 wiphy_unregister(local->hw.wiphy);
999 fail_wiphy_register: 891 fail_wiphy_register:
1000 kfree(local->int_scan_req.channels); 892 kfree(local->int_scan_req.channels);
@@ -1019,13 +911,8 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
1019 * because the driver cannot be handing us frames any 911 * because the driver cannot be handing us frames any
1020 * more and the tasklet is killed. 912 * more and the tasklet is killed.
1021 */ 913 */
1022
1023 /* First, we remove all virtual interfaces. */
1024 ieee80211_remove_interfaces(local); 914 ieee80211_remove_interfaces(local);
1025 915
1026 /* then, finally, remove the master interface */
1027 unregister_netdevice(local->mdev);
1028
1029 rtnl_unlock(); 916 rtnl_unlock();
1030 917
1031 ieee80211_clear_tx_pending(local); 918 ieee80211_clear_tx_pending(local);
@@ -1044,7 +931,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
1044 wiphy_unregister(local->hw.wiphy); 931 wiphy_unregister(local->hw.wiphy);
1045 ieee80211_wep_free(local); 932 ieee80211_wep_free(local);
1046 ieee80211_led_exit(local); 933 ieee80211_led_exit(local);
1047 free_netdev(local->mdev);
1048 kfree(local->int_scan_req.channels); 934 kfree(local->int_scan_req.channels);
1049} 935}
1050EXPORT_SYMBOL(ieee80211_unregister_hw); 936EXPORT_SYMBOL(ieee80211_unregister_hw);
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 8ac7a984d886..b33efc4fc267 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -287,7 +287,7 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
287 struct rate_control_ref *ref, *old; 287 struct rate_control_ref *ref, *old;
288 288
289 ASSERT_RTNL(); 289 ASSERT_RTNL();
290 if (local->open_count || netif_running(local->mdev)) 290 if (local->open_count)
291 return -EBUSY; 291 return -EBUSY;
292 292
293 ref = rate_control_alloc(name, local); 293 ref = rate_control_alloc(name, local);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index b513fb791153..7f33f775c5df 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1478,6 +1478,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1478 struct ieee80211s_hdr *mesh_hdr; 1478 struct ieee80211s_hdr *mesh_hdr;
1479 unsigned int hdrlen; 1479 unsigned int hdrlen;
1480 struct sk_buff *skb = rx->skb, *fwd_skb; 1480 struct sk_buff *skb = rx->skb, *fwd_skb;
1481 struct ieee80211_local *local = rx->local;
1481 1482
1482 hdr = (struct ieee80211_hdr *) skb->data; 1483 hdr = (struct ieee80211_hdr *) skb->data;
1483 hdrlen = ieee80211_hdrlen(hdr->frame_control); 1484 hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -1520,6 +1521,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1520 dropped_frames_ttl); 1521 dropped_frames_ttl);
1521 else { 1522 else {
1522 struct ieee80211_hdr *fwd_hdr; 1523 struct ieee80211_hdr *fwd_hdr;
1524 struct ieee80211_tx_info *info;
1525
1523 fwd_skb = skb_copy(skb, GFP_ATOMIC); 1526 fwd_skb = skb_copy(skb, GFP_ATOMIC);
1524 1527
1525 if (!fwd_skb && net_ratelimit()) 1528 if (!fwd_skb && net_ratelimit())
@@ -1533,9 +1536,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1533 */ 1536 */
1534 memcpy(fwd_hdr->addr1, fwd_hdr->addr2, ETH_ALEN); 1537 memcpy(fwd_hdr->addr1, fwd_hdr->addr2, ETH_ALEN);
1535 memcpy(fwd_hdr->addr2, rx->dev->dev_addr, ETH_ALEN); 1538 memcpy(fwd_hdr->addr2, rx->dev->dev_addr, ETH_ALEN);
1536 fwd_skb->dev = rx->local->mdev; 1539 info = IEEE80211_SKB_CB(fwd_skb);
1540 memset(info, 0, sizeof(*info));
1541 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
1537 fwd_skb->iif = rx->dev->ifindex; 1542 fwd_skb->iif = rx->dev->ifindex;
1538 dev_queue_xmit(fwd_skb); 1543 ieee80211_select_queue(local, fwd_skb);
1544 ieee80211_add_pending_skb(local, fwd_skb);
1539 } 1545 }
1540 } 1546 }
1541 1547
@@ -1803,8 +1809,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
1803 return RX_DROP_MONITOR; 1809 return RX_DROP_MONITOR;
1804} 1810}
1805 1811
1806static void ieee80211_rx_michael_mic_report(struct net_device *dev, 1812static void ieee80211_rx_michael_mic_report(struct ieee80211_hdr *hdr,
1807 struct ieee80211_hdr *hdr,
1808 struct ieee80211_rx_data *rx) 1813 struct ieee80211_rx_data *rx)
1809{ 1814{
1810 int keyidx; 1815 int keyidx;
@@ -2114,7 +2119,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
2114 } 2119 }
2115 2120
2116 if ((status->flag & RX_FLAG_MMIC_ERROR)) { 2121 if ((status->flag & RX_FLAG_MMIC_ERROR)) {
2117 ieee80211_rx_michael_mic_report(local->mdev, hdr, &rx); 2122 ieee80211_rx_michael_mic_report(hdr, &rx);
2118 return; 2123 return;
2119 } 2124 }
2120 2125
@@ -2483,7 +2488,6 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
2483 2488
2484 BUILD_BUG_ON(sizeof(struct ieee80211_rx_status) > sizeof(skb->cb)); 2489 BUILD_BUG_ON(sizeof(struct ieee80211_rx_status) > sizeof(skb->cb));
2485 2490
2486 skb->dev = local->mdev;
2487 skb->pkt_type = IEEE80211_RX_MSG; 2491 skb->pkt_type = IEEE80211_RX_MSG;
2488 skb_queue_tail(&local->skb_queue, skb); 2492 skb_queue_tail(&local->skb_queue, skb);
2489 tasklet_schedule(&local->tasklet); 2493 tasklet_schedule(&local->tasklet);
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 5f4f7869d050..74820656dc89 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -294,16 +294,13 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
294 if (was_hw_scan) 294 if (was_hw_scan)
295 goto done; 295 goto done;
296 296
297 netif_tx_lock_bh(local->mdev); 297 spin_lock_bh(&local->filter_lock);
298 netif_addr_lock(local->mdev);
299 local->filter_flags &= ~FIF_BCN_PRBRESP_PROMISC; 298 local->filter_flags &= ~FIF_BCN_PRBRESP_PROMISC;
300 drv_configure_filter(local, FIF_BCN_PRBRESP_PROMISC, 299 drv_configure_filter(local, FIF_BCN_PRBRESP_PROMISC,
301 &local->filter_flags, 300 &local->filter_flags,
302 local->mdev->mc_count, 301 local->mc_count,
303 local->mdev->mc_list); 302 local->mc_list);
304 303 spin_unlock_bh(&local->filter_lock);
305 netif_addr_unlock(local->mdev);
306 netif_tx_unlock_bh(local->mdev);
307 304
308 drv_sw_scan_complete(local); 305 drv_sw_scan_complete(local);
309 306
@@ -382,13 +379,13 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
382 local->scan_state = SCAN_SET_CHANNEL; 379 local->scan_state = SCAN_SET_CHANNEL;
383 local->scan_channel_idx = 0; 380 local->scan_channel_idx = 0;
384 381
385 netif_addr_lock_bh(local->mdev); 382 spin_lock_bh(&local->filter_lock);
386 local->filter_flags |= FIF_BCN_PRBRESP_PROMISC; 383 local->filter_flags |= FIF_BCN_PRBRESP_PROMISC;
387 drv_configure_filter(local, FIF_BCN_PRBRESP_PROMISC, 384 drv_configure_filter(local, FIF_BCN_PRBRESP_PROMISC,
388 &local->filter_flags, 385 &local->filter_flags,
389 local->mdev->mc_count, 386 local->mc_count,
390 local->mdev->mc_list); 387 local->mc_list);
391 netif_addr_unlock_bh(local->mdev); 388 spin_unlock_bh(&local->filter_lock);
392 389
393 /* TODO: start scan as soon as all nullfunc frames are ACKed */ 390 /* TODO: start scan as soon as all nullfunc frames are ACKed */
394 queue_delayed_work(local->hw.workqueue, &local->scan_work, 391 queue_delayed_work(local->hw.workqueue, &local->scan_work,
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index f3efd4f16e91..7adaeb2c53e8 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -451,7 +451,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
451 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 451 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
452 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 452 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
453 453
454 if (unlikely(tx->skb->do_not_encrypt)) 454 if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT))
455 tx->key = NULL; 455 tx->key = NULL;
456 else if (tx->sta && (key = rcu_dereference(tx->sta->key))) 456 else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
457 tx->key = key; 457 tx->key = key;
@@ -497,7 +497,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
497 } 497 }
498 498
499 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) 499 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
500 tx->skb->do_not_encrypt = 1; 500 info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
501 501
502 return TX_CONTINUE; 502 return TX_CONTINUE;
503} 503}
@@ -774,9 +774,7 @@ static int ieee80211_fragment(struct ieee80211_local *local,
774 memcpy(tmp->cb, skb->cb, sizeof(tmp->cb)); 774 memcpy(tmp->cb, skb->cb, sizeof(tmp->cb));
775 skb_copy_queue_mapping(tmp, skb); 775 skb_copy_queue_mapping(tmp, skb);
776 tmp->priority = skb->priority; 776 tmp->priority = skb->priority;
777 tmp->do_not_encrypt = skb->do_not_encrypt;
778 tmp->dev = skb->dev; 777 tmp->dev = skb->dev;
779 tmp->iif = skb->iif;
780 778
781 /* copy header and data */ 779 /* copy header and data */
782 memcpy(skb_put(tmp, hdrlen), skb->data, hdrlen); 780 memcpy(skb_put(tmp, hdrlen), skb->data, hdrlen);
@@ -804,7 +802,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
804 802
805 /* 803 /*
806 * Warn when submitting a fragmented A-MPDU frame and drop it. 804 * Warn when submitting a fragmented A-MPDU frame and drop it.
807 * This scenario is handled in __ieee80211_tx_prepare but extra 805 * This scenario is handled in ieee80211_tx_prepare but extra
808 * caution taken here as fragmented ampdu may cause Tx stop. 806 * caution taken here as fragmented ampdu may cause Tx stop.
809 */ 807 */
810 if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) 808 if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
@@ -943,11 +941,12 @@ static bool __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
943 struct ieee80211_radiotap_header *rthdr = 941 struct ieee80211_radiotap_header *rthdr =
944 (struct ieee80211_radiotap_header *) skb->data; 942 (struct ieee80211_radiotap_header *) skb->data;
945 struct ieee80211_supported_band *sband; 943 struct ieee80211_supported_band *sband;
944 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
946 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); 945 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len);
947 946
948 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 947 sband = tx->local->hw.wiphy->bands[tx->channel->band];
949 948
950 skb->do_not_encrypt = 1; 949 info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
951 tx->flags &= ~IEEE80211_TX_FRAGMENTED; 950 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
952 951
953 /* 952 /*
@@ -985,7 +984,7 @@ static bool __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
985 skb_trim(skb, skb->len - FCS_LEN); 984 skb_trim(skb, skb->len - FCS_LEN);
986 } 985 }
987 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) 986 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
988 tx->skb->do_not_encrypt = 0; 987 info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
989 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) 988 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
990 tx->flags |= IEEE80211_TX_FRAGMENTED; 989 tx->flags |= IEEE80211_TX_FRAGMENTED;
991 break; 990 break;
@@ -1018,13 +1017,12 @@ static bool __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
1018 * initialises @tx 1017 * initialises @tx
1019 */ 1018 */
1020static ieee80211_tx_result 1019static ieee80211_tx_result
1021__ieee80211_tx_prepare(struct ieee80211_tx_data *tx, 1020ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
1022 struct sk_buff *skb, 1021 struct ieee80211_tx_data *tx,
1023 struct net_device *dev) 1022 struct sk_buff *skb)
1024{ 1023{
1025 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1024 struct ieee80211_local *local = sdata->local;
1026 struct ieee80211_hdr *hdr; 1025 struct ieee80211_hdr *hdr;
1027 struct ieee80211_sub_if_data *sdata;
1028 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1026 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1029 int hdrlen, tid; 1027 int hdrlen, tid;
1030 u8 *qc, *state; 1028 u8 *qc, *state;
@@ -1032,9 +1030,9 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1032 1030
1033 memset(tx, 0, sizeof(*tx)); 1031 memset(tx, 0, sizeof(*tx));
1034 tx->skb = skb; 1032 tx->skb = skb;
1035 tx->dev = dev; /* use original interface */ 1033 tx->dev = sdata->dev; /* use original interface */
1036 tx->local = local; 1034 tx->local = local;
1037 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1035 tx->sdata = sdata;
1038 tx->channel = local->hw.conf.channel; 1036 tx->channel = local->hw.conf.channel;
1039 /* 1037 /*
1040 * Set this flag (used below to indicate "automatic fragmentation"), 1038 * Set this flag (used below to indicate "automatic fragmentation"),
@@ -1043,7 +1041,6 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1043 tx->flags |= IEEE80211_TX_FRAGMENTED; 1041 tx->flags |= IEEE80211_TX_FRAGMENTED;
1044 1042
1045 /* process and remove the injection radiotap header */ 1043 /* process and remove the injection radiotap header */
1046 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1047 if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) { 1044 if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) {
1048 if (!__ieee80211_parse_tx_radiotap(tx, skb)) 1045 if (!__ieee80211_parse_tx_radiotap(tx, skb))
1049 return TX_DROP; 1046 return TX_DROP;
@@ -1139,50 +1136,28 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1139 return TX_CONTINUE; 1136 return TX_CONTINUE;
1140} 1137}
1141 1138
1142/*
1143 * NB: @tx is uninitialised when passed in here
1144 */
1145static int ieee80211_tx_prepare(struct ieee80211_local *local,
1146 struct ieee80211_tx_data *tx,
1147 struct sk_buff *skb)
1148{
1149 struct net_device *dev;
1150
1151 dev = dev_get_by_index(&init_net, skb->iif);
1152 if (unlikely(dev && !is_ieee80211_device(local, dev))) {
1153 dev_put(dev);
1154 dev = NULL;
1155 }
1156 if (unlikely(!dev))
1157 return -ENODEV;
1158 /*
1159 * initialises tx with control
1160 *
1161 * return value is safe to ignore here because this function
1162 * can only be invoked for multicast frames
1163 *
1164 * XXX: clean up
1165 */
1166 __ieee80211_tx_prepare(tx, skb, dev);
1167 dev_put(dev);
1168 return 0;
1169}
1170
1171static int __ieee80211_tx(struct ieee80211_local *local, 1139static int __ieee80211_tx(struct ieee80211_local *local,
1172 struct sk_buff **skbp, 1140 struct sk_buff **skbp,
1173 struct sta_info *sta) 1141 struct sta_info *sta,
1142 bool txpending)
1174{ 1143{
1175 struct sk_buff *skb = *skbp, *next; 1144 struct sk_buff *skb = *skbp, *next;
1176 struct ieee80211_tx_info *info; 1145 struct ieee80211_tx_info *info;
1146 unsigned long flags;
1177 int ret, len; 1147 int ret, len;
1178 bool fragm = false; 1148 bool fragm = false;
1179 1149
1180 local->mdev->trans_start = jiffies;
1181
1182 while (skb) { 1150 while (skb) {
1183 if (ieee80211_queue_stopped(&local->hw, 1151 int q = skb_get_queue_mapping(skb);
1184 skb_get_queue_mapping(skb))) 1152
1185 return IEEE80211_TX_PENDING; 1153 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
1154 ret = IEEE80211_TX_OK;
1155 if (local->queue_stop_reasons[q] ||
1156 (!txpending && !skb_queue_empty(&local->pending[q])))
1157 ret = IEEE80211_TX_PENDING;
1158 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
1159 if (ret != IEEE80211_TX_OK)
1160 return ret;
1186 1161
1187 info = IEEE80211_SKB_CB(skb); 1162 info = IEEE80211_SKB_CB(skb);
1188 1163
@@ -1254,10 +1229,10 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
1254 return 0; 1229 return 0;
1255} 1230}
1256 1231
1257static void ieee80211_tx(struct net_device *dev, struct sk_buff *skb, 1232static void ieee80211_tx(struct ieee80211_sub_if_data *sdata,
1258 bool txpending) 1233 struct sk_buff *skb, bool txpending)
1259{ 1234{
1260 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1235 struct ieee80211_local *local = sdata->local;
1261 struct ieee80211_tx_data tx; 1236 struct ieee80211_tx_data tx;
1262 ieee80211_tx_result res_prepare; 1237 ieee80211_tx_result res_prepare;
1263 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1238 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -1268,8 +1243,6 @@ static void ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1268 1243
1269 queue = skb_get_queue_mapping(skb); 1244 queue = skb_get_queue_mapping(skb);
1270 1245
1271 WARN_ON(!txpending && !skb_queue_empty(&local->pending[queue]));
1272
1273 if (unlikely(skb->len < 10)) { 1246 if (unlikely(skb->len < 10)) {
1274 dev_kfree_skb(skb); 1247 dev_kfree_skb(skb);
1275 return; 1248 return;
@@ -1278,7 +1251,7 @@ static void ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1278 rcu_read_lock(); 1251 rcu_read_lock();
1279 1252
1280 /* initialises tx */ 1253 /* initialises tx */
1281 res_prepare = __ieee80211_tx_prepare(&tx, skb, dev); 1254 res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
1282 1255
1283 if (unlikely(res_prepare == TX_DROP)) { 1256 if (unlikely(res_prepare == TX_DROP)) {
1284 dev_kfree_skb(skb); 1257 dev_kfree_skb(skb);
@@ -1297,7 +1270,7 @@ static void ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1297 1270
1298 retries = 0; 1271 retries = 0;
1299 retry: 1272 retry:
1300 ret = __ieee80211_tx(local, &tx.skb, tx.sta); 1273 ret = __ieee80211_tx(local, &tx.skb, tx.sta, txpending);
1301 switch (ret) { 1274 switch (ret) {
1302 case IEEE80211_TX_OK: 1275 case IEEE80211_TX_OK:
1303 break; 1276 break;
@@ -1315,34 +1288,35 @@ static void ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1315 1288
1316 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 1289 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
1317 1290
1318 if (__netif_subqueue_stopped(local->mdev, queue)) { 1291 if (local->queue_stop_reasons[queue] ||
1292 !skb_queue_empty(&local->pending[queue])) {
1293 /*
1294 * if queue is stopped, queue up frames for later
1295 * transmission from the tasklet
1296 */
1319 do { 1297 do {
1320 next = skb->next; 1298 next = skb->next;
1321 skb->next = NULL; 1299 skb->next = NULL;
1322 if (unlikely(txpending)) 1300 if (unlikely(txpending))
1323 skb_queue_head(&local->pending[queue], 1301 __skb_queue_head(&local->pending[queue],
1324 skb); 1302 skb);
1325 else 1303 else
1326 skb_queue_tail(&local->pending[queue], 1304 __skb_queue_tail(&local->pending[queue],
1327 skb); 1305 skb);
1328 } while ((skb = next)); 1306 } while ((skb = next));
1329 1307
1330 /*
1331 * Make sure nobody will enable the queue on us
1332 * (without going through the tasklet) nor disable the
1333 * netdev queue underneath the pending handling code.
1334 */
1335 __set_bit(IEEE80211_QUEUE_STOP_REASON_PENDING,
1336 &local->queue_stop_reasons[queue]);
1337
1338 spin_unlock_irqrestore(&local->queue_stop_reason_lock, 1308 spin_unlock_irqrestore(&local->queue_stop_reason_lock,
1339 flags); 1309 flags);
1340 } else { 1310 } else {
1311 /*
1312 * otherwise retry, but this is a race condition or
1313 * a driver bug (which we warn about if it persists)
1314 */
1341 spin_unlock_irqrestore(&local->queue_stop_reason_lock, 1315 spin_unlock_irqrestore(&local->queue_stop_reason_lock,
1342 flags); 1316 flags);
1343 1317
1344 retries++; 1318 retries++;
1345 if (WARN(retries > 10, "tx refused but queue active")) 1319 if (WARN(retries > 10, "tx refused but queue active\n"))
1346 goto drop; 1320 goto drop;
1347 goto retry; 1321 goto retry;
1348 } 1322 }
@@ -1403,14 +1377,13 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
1403 return 0; 1377 return 0;
1404} 1378}
1405 1379
1406int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev) 1380static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1381 struct sk_buff *skb)
1407{ 1382{
1408 struct ieee80211_master_priv *mpriv = netdev_priv(dev); 1383 struct ieee80211_local *local = sdata->local;
1409 struct ieee80211_local *local = mpriv->local;
1410 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1384 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1411 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1385 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1412 struct net_device *odev = NULL; 1386 struct ieee80211_sub_if_data *tmp_sdata;
1413 struct ieee80211_sub_if_data *osdata;
1414 int headroom; 1387 int headroom;
1415 bool may_encrypt; 1388 bool may_encrypt;
1416 enum { 1389 enum {
@@ -1419,20 +1392,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
1419 UNKNOWN_ADDRESS, 1392 UNKNOWN_ADDRESS,
1420 } monitor_iface = NOT_MONITOR; 1393 } monitor_iface = NOT_MONITOR;
1421 1394
1422 if (skb->iif) 1395 dev_hold(sdata->dev);
1423 odev = dev_get_by_index(&init_net, skb->iif);
1424 if (unlikely(odev && !is_ieee80211_device(local, odev))) {
1425 dev_put(odev);
1426 odev = NULL;
1427 }
1428 if (unlikely(!odev)) {
1429#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1430 printk(KERN_DEBUG "%s: Discarded packet with nonexistent "
1431 "originating device\n", dev->name);
1432#endif
1433 dev_kfree_skb(skb);
1434 return NETDEV_TX_OK;
1435 }
1436 1396
1437 if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && 1397 if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) &&
1438 local->hw.conf.dynamic_ps_timeout > 0 && 1398 local->hw.conf.dynamic_ps_timeout > 0 &&
@@ -1448,26 +1408,21 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
1448 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); 1408 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));
1449 } 1409 }
1450 1410
1451 memset(info, 0, sizeof(*info));
1452
1453 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; 1411 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1454 1412
1455 osdata = IEEE80211_DEV_TO_SUB_IF(odev); 1413 if (ieee80211_vif_is_mesh(&sdata->vif) &&
1456
1457 if (ieee80211_vif_is_mesh(&osdata->vif) &&
1458 ieee80211_is_data(hdr->frame_control)) { 1414 ieee80211_is_data(hdr->frame_control)) {
1459 if (is_multicast_ether_addr(hdr->addr3)) 1415 if (is_multicast_ether_addr(hdr->addr3))
1460 memcpy(hdr->addr1, hdr->addr3, ETH_ALEN); 1416 memcpy(hdr->addr1, hdr->addr3, ETH_ALEN);
1461 else 1417 else
1462 if (mesh_nexthop_lookup(skb, osdata)) { 1418 if (mesh_nexthop_lookup(skb, sdata)) {
1463 dev_put(odev); 1419 dev_put(sdata->dev);
1464 return NETDEV_TX_OK; 1420 return;
1465 } 1421 }
1466 if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) 1422 if (memcmp(sdata->dev->dev_addr, hdr->addr4, ETH_ALEN) != 0)
1467 IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.mesh, 1423 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,
1468 fwded_frames); 1424 fwded_frames);
1469 } else if (unlikely(osdata->vif.type == NL80211_IFTYPE_MONITOR)) { 1425 } else if (unlikely(sdata->vif.type == NL80211_IFTYPE_MONITOR)) {
1470 struct ieee80211_sub_if_data *sdata;
1471 int hdrlen; 1426 int hdrlen;
1472 u16 len_rthdr; 1427 u16 len_rthdr;
1473 1428
@@ -1491,19 +1446,17 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
1491 */ 1446 */
1492 1447
1493 rcu_read_lock(); 1448 rcu_read_lock();
1494 list_for_each_entry_rcu(sdata, &local->interfaces, 1449 list_for_each_entry_rcu(tmp_sdata, &local->interfaces,
1495 list) { 1450 list) {
1496 if (!netif_running(sdata->dev)) 1451 if (!netif_running(tmp_sdata->dev))
1497 continue; 1452 continue;
1498 if (sdata->vif.type != NL80211_IFTYPE_AP) 1453 if (tmp_sdata->vif.type != NL80211_IFTYPE_AP)
1499 continue; 1454 continue;
1500 if (compare_ether_addr(sdata->dev->dev_addr, 1455 if (compare_ether_addr(tmp_sdata->dev->dev_addr,
1501 hdr->addr2)) { 1456 hdr->addr2)) {
1502 dev_hold(sdata->dev); 1457 dev_hold(tmp_sdata->dev);
1503 dev_put(odev); 1458 dev_put(sdata->dev);
1504 osdata = sdata; 1459 sdata = tmp_sdata;
1505 odev = osdata->dev;
1506 skb->iif = sdata->dev->ifindex;
1507 monitor_iface = FOUND_SDATA; 1460 monitor_iface = FOUND_SDATA;
1508 break; 1461 break;
1509 } 1462 }
@@ -1512,31 +1465,31 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
1512 } 1465 }
1513 } 1466 }
1514 1467
1515 may_encrypt = !skb->do_not_encrypt; 1468 may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT);
1516 1469
1517 headroom = osdata->local->tx_headroom; 1470 headroom = local->tx_headroom;
1518 if (may_encrypt) 1471 if (may_encrypt)
1519 headroom += IEEE80211_ENCRYPT_HEADROOM; 1472 headroom += IEEE80211_ENCRYPT_HEADROOM;
1520 headroom -= skb_headroom(skb); 1473 headroom -= skb_headroom(skb);
1521 headroom = max_t(int, 0, headroom); 1474 headroom = max_t(int, 0, headroom);
1522 1475
1523 if (ieee80211_skb_resize(osdata->local, skb, headroom, may_encrypt)) { 1476 if (ieee80211_skb_resize(local, skb, headroom, may_encrypt)) {
1524 dev_kfree_skb(skb); 1477 dev_kfree_skb(skb);
1525 dev_put(odev); 1478 dev_put(sdata->dev);
1526 return NETDEV_TX_OK; 1479 return;
1527 } 1480 }
1528 1481
1529 if (osdata->vif.type == NL80211_IFTYPE_AP_VLAN) 1482 tmp_sdata = sdata;
1530 osdata = container_of(osdata->bss, 1483 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
1531 struct ieee80211_sub_if_data, 1484 tmp_sdata = container_of(sdata->bss,
1532 u.ap); 1485 struct ieee80211_sub_if_data,
1486 u.ap);
1533 if (likely(monitor_iface != UNKNOWN_ADDRESS)) 1487 if (likely(monitor_iface != UNKNOWN_ADDRESS))
1534 info->control.vif = &osdata->vif; 1488 info->control.vif = &tmp_sdata->vif;
1535
1536 ieee80211_tx(odev, skb, false);
1537 dev_put(odev);
1538 1489
1539 return NETDEV_TX_OK; 1490 ieee80211_select_queue(local, skb);
1491 ieee80211_tx(sdata, skb, false);
1492 dev_put(sdata->dev);
1540} 1493}
1541 1494
1542int ieee80211_monitor_start_xmit(struct sk_buff *skb, 1495int ieee80211_monitor_start_xmit(struct sk_buff *skb,
@@ -1546,6 +1499,7 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1546 struct ieee80211_channel *chan = local->hw.conf.channel; 1499 struct ieee80211_channel *chan = local->hw.conf.channel;
1547 struct ieee80211_radiotap_header *prthdr = 1500 struct ieee80211_radiotap_header *prthdr =
1548 (struct ieee80211_radiotap_header *)skb->data; 1501 (struct ieee80211_radiotap_header *)skb->data;
1502 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1549 u16 len_rthdr; 1503 u16 len_rthdr;
1550 1504
1551 /* 1505 /*
@@ -1583,15 +1537,9 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1583 if (unlikely(skb->len < len_rthdr)) 1537 if (unlikely(skb->len < len_rthdr))
1584 goto fail; /* skb too short for claimed rt header extent */ 1538 goto fail; /* skb too short for claimed rt header extent */
1585 1539
1586 skb->dev = local->mdev;
1587
1588 /* needed because we set skb device to master */ 1540 /* needed because we set skb device to master */
1589 skb->iif = dev->ifindex; 1541 skb->iif = dev->ifindex;
1590 1542
1591 /* sometimes we do encrypt injected frames, will be fixed
1592 * up in radiotap parser if not wanted */
1593 skb->do_not_encrypt = 0;
1594
1595 /* 1543 /*
1596 * fix up the pointers accounting for the radiotap 1544 * fix up the pointers accounting for the radiotap
1597 * header still being in there. We are being given 1545 * header still being in there. We are being given
@@ -1606,8 +1554,10 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1606 skb_set_network_header(skb, len_rthdr); 1554 skb_set_network_header(skb, len_rthdr);
1607 skb_set_transport_header(skb, len_rthdr); 1555 skb_set_transport_header(skb, len_rthdr);
1608 1556
1609 /* pass the radiotap header up to the next stage intact */ 1557 memset(info, 0, sizeof(*info));
1610 dev_queue_xmit(skb); 1558
1559 /* pass the radiotap header up to xmit */
1560 ieee80211_xmit(IEEE80211_DEV_TO_SUB_IF(dev), skb);
1611 return NETDEV_TX_OK; 1561 return NETDEV_TX_OK;
1612 1562
1613fail: 1563fail:
@@ -1635,6 +1585,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1635{ 1585{
1636 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1586 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1637 struct ieee80211_local *local = sdata->local; 1587 struct ieee80211_local *local = sdata->local;
1588 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1638 int ret = NETDEV_TX_BUSY, head_need; 1589 int ret = NETDEV_TX_BUSY, head_need;
1639 u16 ethertype, hdrlen, meshhdrlen = 0; 1590 u16 ethertype, hdrlen, meshhdrlen = 0;
1640 __le16 fc; 1591 __le16 fc;
@@ -1864,7 +1815,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1864 1815
1865 skb->iif = dev->ifindex; 1816 skb->iif = dev->ifindex;
1866 1817
1867 skb->dev = local->mdev;
1868 dev->stats.tx_packets++; 1818 dev->stats.tx_packets++;
1869 dev->stats.tx_bytes += skb->len; 1819 dev->stats.tx_bytes += skb->len;
1870 1820
@@ -1875,8 +1825,10 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1875 skb_set_network_header(skb, nh_pos); 1825 skb_set_network_header(skb, nh_pos);
1876 skb_set_transport_header(skb, h_pos); 1826 skb_set_transport_header(skb, h_pos);
1877 1827
1828 memset(info, 0, sizeof(*info));
1829
1878 dev->trans_start = jiffies; 1830 dev->trans_start = jiffies;
1879 dev_queue_xmit(skb); 1831 ieee80211_xmit(sdata, skb);
1880 1832
1881 return NETDEV_TX_OK; 1833 return NETDEV_TX_OK;
1882 1834
@@ -1918,7 +1870,6 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local,
1918 return true; 1870 return true;
1919 } 1871 }
1920 1872
1921 /* validate info->control.vif against skb->iif */
1922 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1873 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1923 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 1874 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
1924 sdata = container_of(sdata->bss, 1875 sdata = container_of(sdata->bss,
@@ -1932,12 +1883,13 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local,
1932 } 1883 }
1933 1884
1934 if (info->flags & IEEE80211_TX_INTFL_NEED_TXPROCESSING) { 1885 if (info->flags & IEEE80211_TX_INTFL_NEED_TXPROCESSING) {
1935 ieee80211_tx(dev, skb, true); 1886 /* do not use sdata, it may have been changed above */
1887 ieee80211_tx(IEEE80211_DEV_TO_SUB_IF(dev), skb, true);
1936 } else { 1888 } else {
1937 hdr = (struct ieee80211_hdr *)skb->data; 1889 hdr = (struct ieee80211_hdr *)skb->data;
1938 sta = sta_info_get(local, hdr->addr1); 1890 sta = sta_info_get(local, hdr->addr1);
1939 1891
1940 ret = __ieee80211_tx(local, &skb, sta); 1892 ret = __ieee80211_tx(local, &skb, sta, true);
1941 if (ret != IEEE80211_TX_OK) 1893 if (ret != IEEE80211_TX_OK)
1942 result = false; 1894 result = false;
1943 } 1895 }
@@ -1949,59 +1901,43 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local,
1949} 1901}
1950 1902
1951/* 1903/*
1952 * Transmit all pending packets. Called from tasklet, locks master device 1904 * Transmit all pending packets. Called from tasklet.
1953 * TX lock so that no new packets can come in.
1954 */ 1905 */
1955void ieee80211_tx_pending(unsigned long data) 1906void ieee80211_tx_pending(unsigned long data)
1956{ 1907{
1957 struct ieee80211_local *local = (struct ieee80211_local *)data; 1908 struct ieee80211_local *local = (struct ieee80211_local *)data;
1958 struct net_device *dev = local->mdev;
1959 unsigned long flags; 1909 unsigned long flags;
1960 int i; 1910 int i;
1961 bool next; 1911 bool txok;
1962 1912
1963 rcu_read_lock(); 1913 rcu_read_lock();
1964 netif_tx_lock_bh(dev);
1965 1914
1915 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
1966 for (i = 0; i < local->hw.queues; i++) { 1916 for (i = 0; i < local->hw.queues; i++) {
1967 /* 1917 /*
1968 * If queue is stopped by something other than due to pending 1918 * If queue is stopped by something other than due to pending
1969 * frames, or we have no pending frames, proceed to next queue. 1919 * frames, or we have no pending frames, proceed to next queue.
1970 */ 1920 */
1971 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 1921 if (local->queue_stop_reasons[i] ||
1972 next = false;
1973 if (local->queue_stop_reasons[i] !=
1974 BIT(IEEE80211_QUEUE_STOP_REASON_PENDING) ||
1975 skb_queue_empty(&local->pending[i])) 1922 skb_queue_empty(&local->pending[i]))
1976 next = true;
1977 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
1978
1979 if (next)
1980 continue; 1923 continue;
1981 1924
1982 /*
1983 * start the queue now to allow processing our packets,
1984 * we're under the tx lock here anyway so nothing will
1985 * happen as a result of this
1986 */
1987 netif_start_subqueue(local->mdev, i);
1988
1989 while (!skb_queue_empty(&local->pending[i])) { 1925 while (!skb_queue_empty(&local->pending[i])) {
1990 struct sk_buff *skb = skb_dequeue(&local->pending[i]); 1926 struct sk_buff *skb = __skb_dequeue(&local->pending[i]);
1991 1927 spin_unlock_irqrestore(&local->queue_stop_reason_lock,
1992 if (!ieee80211_tx_pending_skb(local, skb)) { 1928 flags);
1993 skb_queue_head(&local->pending[i], skb); 1929
1930 txok = ieee80211_tx_pending_skb(local, skb);
1931 if (!txok)
1932 __skb_queue_head(&local->pending[i], skb);
1933 spin_lock_irqsave(&local->queue_stop_reason_lock,
1934 flags);
1935 if (!txok)
1994 break; 1936 break;
1995 }
1996 } 1937 }
1997
1998 /* Start regular packet processing again. */
1999 if (skb_queue_empty(&local->pending[i]))
2000 ieee80211_wake_queue_by_reason(&local->hw, i,
2001 IEEE80211_QUEUE_STOP_REASON_PENDING);
2002 } 1938 }
1939 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
2003 1940
2004 netif_tx_unlock_bh(dev);
2005 rcu_read_unlock(); 1941 rcu_read_unlock();
2006} 1942}
2007 1943
@@ -2176,8 +2112,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
2176 2112
2177 info = IEEE80211_SKB_CB(skb); 2113 info = IEEE80211_SKB_CB(skb);
2178 2114
2179 skb->do_not_encrypt = 1; 2115 info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
2180
2181 info->band = band; 2116 info->band = band;
2182 /* 2117 /*
2183 * XXX: For now, always use the lowest rate 2118 * XXX: For now, always use the lowest rate
@@ -2248,9 +2183,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
2248 sdata = vif_to_sdata(vif); 2183 sdata = vif_to_sdata(vif);
2249 bss = &sdata->u.ap; 2184 bss = &sdata->u.ap;
2250 2185
2251 if (!bss)
2252 return NULL;
2253
2254 rcu_read_lock(); 2186 rcu_read_lock();
2255 beacon = rcu_dereference(bss->beacon); 2187 beacon = rcu_dereference(bss->beacon);
2256 2188
@@ -2276,7 +2208,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
2276 cpu_to_le16(IEEE80211_FCTL_MOREDATA); 2208 cpu_to_le16(IEEE80211_FCTL_MOREDATA);
2277 } 2209 }
2278 2210
2279 if (!ieee80211_tx_prepare(local, &tx, skb)) 2211 if (!ieee80211_tx_prepare(sdata, &tx, skb))
2280 break; 2212 break;
2281 dev_kfree_skb_any(skb); 2213 dev_kfree_skb_any(skb);
2282 } 2214 }
@@ -2296,3 +2228,18 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
2296 return skb; 2228 return skb;
2297} 2229}
2298EXPORT_SYMBOL(ieee80211_get_buffered_bc); 2230EXPORT_SYMBOL(ieee80211_get_buffered_bc);
2231
2232void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
2233 int encrypt)
2234{
2235 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2236 skb_set_mac_header(skb, 0);
2237 skb_set_network_header(skb, 0);
2238 skb_set_transport_header(skb, 0);
2239
2240 skb->iif = sdata->dev->ifindex;
2241 if (!encrypt)
2242 info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
2243
2244 ieee80211_xmit(sdata, skb);
2245}
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index dbf66b52d38c..7fc55846d601 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -275,16 +275,12 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
275 275
276 __clear_bit(reason, &local->queue_stop_reasons[queue]); 276 __clear_bit(reason, &local->queue_stop_reasons[queue]);
277 277
278 if (!skb_queue_empty(&local->pending[queue]) &&
279 local->queue_stop_reasons[queue] ==
280 BIT(IEEE80211_QUEUE_STOP_REASON_PENDING))
281 tasklet_schedule(&local->tx_pending_tasklet);
282
283 if (local->queue_stop_reasons[queue] != 0) 278 if (local->queue_stop_reasons[queue] != 0)
284 /* someone still has this queue stopped */ 279 /* someone still has this queue stopped */
285 return; 280 return;
286 281
287 netif_wake_subqueue(local->mdev, queue); 282 if (!skb_queue_empty(&local->pending[queue]))
283 tasklet_schedule(&local->tx_pending_tasklet);
288} 284}
289 285
290void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 286void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
@@ -313,14 +309,6 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue,
313 if (WARN_ON(queue >= hw->queues)) 309 if (WARN_ON(queue >= hw->queues))
314 return; 310 return;
315 311
316 /*
317 * Only stop if it was previously running, this is necessary
318 * for correct pending packets handling because there we may
319 * start (but not wake) the queue and rely on that.
320 */
321 if (!local->queue_stop_reasons[queue])
322 netif_stop_subqueue(local->mdev, queue);
323
324 __set_bit(reason, &local->queue_stop_reasons[queue]); 312 __set_bit(reason, &local->queue_stop_reasons[queue]);
325} 313}
326 314
@@ -351,8 +339,7 @@ void ieee80211_add_pending_skb(struct ieee80211_local *local,
351 339
352 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 340 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
353 __ieee80211_stop_queue(hw, queue, IEEE80211_QUEUE_STOP_REASON_SKB_ADD); 341 __ieee80211_stop_queue(hw, queue, IEEE80211_QUEUE_STOP_REASON_SKB_ADD);
354 __ieee80211_stop_queue(hw, queue, IEEE80211_QUEUE_STOP_REASON_PENDING); 342 __skb_queue_tail(&local->pending[queue], skb);
355 skb_queue_tail(&local->pending[queue], skb);
356 __ieee80211_wake_queue(hw, queue, IEEE80211_QUEUE_STOP_REASON_SKB_ADD); 343 __ieee80211_wake_queue(hw, queue, IEEE80211_QUEUE_STOP_REASON_SKB_ADD);
357 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 344 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
358} 345}
@@ -373,16 +360,12 @@ int ieee80211_add_pending_skbs(struct ieee80211_local *local,
373 while ((skb = skb_dequeue(skbs))) { 360 while ((skb = skb_dequeue(skbs))) {
374 ret++; 361 ret++;
375 queue = skb_get_queue_mapping(skb); 362 queue = skb_get_queue_mapping(skb);
376 skb_queue_tail(&local->pending[queue], skb); 363 __skb_queue_tail(&local->pending[queue], skb);
377 } 364 }
378 365
379 for (i = 0; i < hw->queues; i++) { 366 for (i = 0; i < hw->queues; i++)
380 if (ret)
381 __ieee80211_stop_queue(hw, i,
382 IEEE80211_QUEUE_STOP_REASON_PENDING);
383 __ieee80211_wake_queue(hw, i, 367 __ieee80211_wake_queue(hw, i,
384 IEEE80211_QUEUE_STOP_REASON_SKB_ADD); 368 IEEE80211_QUEUE_STOP_REASON_SKB_ADD);
385 }
386 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 369 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
387 370
388 return ret; 371 return ret;
@@ -413,11 +396,16 @@ EXPORT_SYMBOL(ieee80211_stop_queues);
413int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue) 396int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue)
414{ 397{
415 struct ieee80211_local *local = hw_to_local(hw); 398 struct ieee80211_local *local = hw_to_local(hw);
399 unsigned long flags;
400 int ret;
416 401
417 if (WARN_ON(queue >= hw->queues)) 402 if (WARN_ON(queue >= hw->queues))
418 return true; 403 return true;
419 404
420 return __netif_subqueue_stopped(local->mdev, queue); 405 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
406 ret = !!local->queue_stop_reasons[queue];
407 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
408 return ret;
421} 409}
422EXPORT_SYMBOL(ieee80211_queue_stopped); 410EXPORT_SYMBOL(ieee80211_queue_stopped);
423 411
@@ -761,20 +749,6 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
761 ieee80211_set_wmm_default(sdata); 749 ieee80211_set_wmm_default(sdata);
762} 750}
763 751
764void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
765 int encrypt)
766{
767 skb->dev = sdata->local->mdev;
768 skb_set_mac_header(skb, 0);
769 skb_set_network_header(skb, 0);
770 skb_set_transport_header(skb, 0);
771
772 skb->iif = sdata->dev->ifindex;
773 skb->do_not_encrypt = !encrypt;
774
775 dev_queue_xmit(skb);
776}
777
778u32 ieee80211_mandatory_rates(struct ieee80211_local *local, 752u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
779 enum ieee80211_band band) 753 enum ieee80211_band band)
780{ 754{
@@ -1049,9 +1023,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1049 /* reconfigure hardware */ 1023 /* reconfigure hardware */
1050 ieee80211_hw_config(local, ~0); 1024 ieee80211_hw_config(local, ~0);
1051 1025
1052 netif_addr_lock_bh(local->mdev); 1026 spin_lock_bh(&local->filter_lock);
1053 ieee80211_configure_filter(local); 1027 ieee80211_configure_filter(local);
1054 netif_addr_unlock_bh(local->mdev); 1028 spin_unlock_bh(&local->filter_lock);
1055 1029
1056 /* Finally also reconfigure all the BSS information */ 1030 /* Finally also reconfigure all the BSS information */
1057 list_for_each_entry(sdata, &local->interfaces, list) { 1031 list_for_each_entry(sdata, &local->interfaces, list) {
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 116a923b14d6..b19b7696f3a2 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -85,10 +85,8 @@ static u16 classify80211(struct ieee80211_local *local, struct sk_buff *skb)
85 return ieee802_1d_to_ac[skb->priority]; 85 return ieee802_1d_to_ac[skb->priority];
86} 86}
87 87
88u16 ieee80211_select_queue(struct net_device *dev, struct sk_buff *skb) 88void ieee80211_select_queue(struct ieee80211_local *local, struct sk_buff *skb)
89{ 89{
90 struct ieee80211_master_priv *mpriv = netdev_priv(dev);
91 struct ieee80211_local *local = mpriv->local;
92 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 90 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
93 u16 queue; 91 u16 queue;
94 u8 tid; 92 u8 tid;
@@ -113,5 +111,5 @@ u16 ieee80211_select_queue(struct net_device *dev, struct sk_buff *skb)
113 *p = 0; 111 *p = 0;
114 } 112 }
115 113
116 return queue; 114 skb_set_queue_mapping(skb, queue);
117} 115}
diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h
index 7520d2e014dc..d4fd87ca5118 100644
--- a/net/mac80211/wme.h
+++ b/net/mac80211/wme.h
@@ -20,6 +20,7 @@
20 20
21extern const int ieee802_1d_to_ac[8]; 21extern const int ieee802_1d_to_ac[8];
22 22
23u16 ieee80211_select_queue(struct net_device *dev, struct sk_buff *skb); 23void ieee80211_select_queue(struct ieee80211_local *local,
24 struct sk_buff *skb);
24 25
25#endif /* _WME_H */ 26#endif /* _WME_H */