aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-16 08:18:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-24 16:18:00 -0400
commit133b822638ff01eb1e32e1917b197c40ed095ddd (patch)
tree8b96f00426728f3c05ba05f387240f0279512a75 /net/mac80211
parent9e5e6c327defcef19dabad64335ee68bb55b2355 (diff)
mac80211: make master iface not wireless
There's no need to register the master netdev with cfg80211, in fact, this is quite dangerous and lead to having to add checks for the master interface all over the config handlers. This patch removes the "ieee80211_ptr" from the master iface in favour of having a small netdev_priv() associated with the master interface that stores the ieee80211_local pointer. Because of this, a lot of code in the configuration handlers can go away. To make this patch easier to verify I have also removed a number of wiphy_priv() calls in favour of getting the sdata first and then the local pointer from that. 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/cfg.c59
-rw-r--r--net/mac80211/debugfs_sta.c3
-rw-r--r--net/mac80211/ieee80211_i.h4
-rw-r--r--net/mac80211/main.c19
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/mac80211/rx.c25
-rw-r--r--net/mac80211/tx.c26
7 files changed, 39 insertions, 99 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e2574885db4a..a8501f14b167 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -82,7 +82,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
82 enum nl80211_iftype type, u32 *flags, 82 enum nl80211_iftype type, u32 *flags,
83 struct vif_params *params) 83 struct vif_params *params)
84{ 84{
85 struct ieee80211_local *local = wiphy_priv(wiphy);
86 struct net_device *dev; 85 struct net_device *dev;
87 struct ieee80211_sub_if_data *sdata; 86 struct ieee80211_sub_if_data *sdata;
88 int ret; 87 int ret;
@@ -95,9 +94,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
95 if (!nl80211_type_check(type)) 94 if (!nl80211_type_check(type))
96 return -EINVAL; 95 return -EINVAL;
97 96
98 if (dev == local->mdev)
99 return -EOPNOTSUPP;
100
101 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 97 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
102 98
103 ret = ieee80211_if_change_type(sdata, type); 99 ret = ieee80211_if_change_type(sdata, type);
@@ -120,16 +116,12 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
120 u8 key_idx, u8 *mac_addr, 116 u8 key_idx, u8 *mac_addr,
121 struct key_params *params) 117 struct key_params *params)
122{ 118{
123 struct ieee80211_local *local = wiphy_priv(wiphy);
124 struct ieee80211_sub_if_data *sdata; 119 struct ieee80211_sub_if_data *sdata;
125 struct sta_info *sta = NULL; 120 struct sta_info *sta = NULL;
126 enum ieee80211_key_alg alg; 121 enum ieee80211_key_alg alg;
127 struct ieee80211_key *key; 122 struct ieee80211_key *key;
128 int err; 123 int err;
129 124
130 if (dev == local->mdev)
131 return -EOPNOTSUPP;
132
133 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 125 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
134 126
135 switch (params->cipher) { 127 switch (params->cipher) {
@@ -174,14 +166,10 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
174static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, 166static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
175 u8 key_idx, u8 *mac_addr) 167 u8 key_idx, u8 *mac_addr)
176{ 168{
177 struct ieee80211_local *local = wiphy_priv(wiphy);
178 struct ieee80211_sub_if_data *sdata; 169 struct ieee80211_sub_if_data *sdata;
179 struct sta_info *sta; 170 struct sta_info *sta;
180 int ret; 171 int ret;
181 172
182 if (dev == local->mdev)
183 return -EOPNOTSUPP;
184
185 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 173 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
186 174
187 rcu_read_lock(); 175 rcu_read_lock();
@@ -222,7 +210,6 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
222 void (*callback)(void *cookie, 210 void (*callback)(void *cookie,
223 struct key_params *params)) 211 struct key_params *params))
224{ 212{
225 struct ieee80211_local *local = wiphy_priv(wiphy);
226 struct ieee80211_sub_if_data *sdata; 213 struct ieee80211_sub_if_data *sdata;
227 struct sta_info *sta = NULL; 214 struct sta_info *sta = NULL;
228 u8 seq[6] = {0}; 215 u8 seq[6] = {0};
@@ -232,9 +219,6 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
232 u16 iv16; 219 u16 iv16;
233 int err = -ENOENT; 220 int err = -ENOENT;
234 221
235 if (dev == local->mdev)
236 return -EOPNOTSUPP;
237
238 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 222 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
239 223
240 rcu_read_lock(); 224 rcu_read_lock();
@@ -310,12 +294,8 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
310 struct net_device *dev, 294 struct net_device *dev,
311 u8 key_idx) 295 u8 key_idx)
312{ 296{
313 struct ieee80211_local *local = wiphy_priv(wiphy);
314 struct ieee80211_sub_if_data *sdata; 297 struct ieee80211_sub_if_data *sdata;
315 298
316 if (dev == local->mdev)
317 return -EOPNOTSUPP;
318
319 rcu_read_lock(); 299 rcu_read_lock();
320 300
321 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 301 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -496,13 +476,9 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
496static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, 476static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
497 struct beacon_parameters *params) 477 struct beacon_parameters *params)
498{ 478{
499 struct ieee80211_local *local = wiphy_priv(wiphy);
500 struct ieee80211_sub_if_data *sdata; 479 struct ieee80211_sub_if_data *sdata;
501 struct beacon_data *old; 480 struct beacon_data *old;
502 481
503 if (dev == local->mdev)
504 return -EOPNOTSUPP;
505
506 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 482 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
507 483
508 if (sdata->vif.type != NL80211_IFTYPE_AP) 484 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -519,13 +495,9 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
519static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, 495static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
520 struct beacon_parameters *params) 496 struct beacon_parameters *params)
521{ 497{
522 struct ieee80211_local *local = wiphy_priv(wiphy);
523 struct ieee80211_sub_if_data *sdata; 498 struct ieee80211_sub_if_data *sdata;
524 struct beacon_data *old; 499 struct beacon_data *old;
525 500
526 if (dev == local->mdev)
527 return -EOPNOTSUPP;
528
529 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 501 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
530 502
531 if (sdata->vif.type != NL80211_IFTYPE_AP) 503 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -541,13 +513,9 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
541 513
542static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) 514static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
543{ 515{
544 struct ieee80211_local *local = wiphy_priv(wiphy);
545 struct ieee80211_sub_if_data *sdata; 516 struct ieee80211_sub_if_data *sdata;
546 struct beacon_data *old; 517 struct beacon_data *old;
547 518
548 if (dev == local->mdev)
549 return -EOPNOTSUPP;
550
551 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 519 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
552 520
553 if (sdata->vif.type != NL80211_IFTYPE_AP) 521 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -695,9 +663,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
695 struct ieee80211_sub_if_data *sdata; 663 struct ieee80211_sub_if_data *sdata;
696 int err; 664 int err;
697 665
698 if (dev == local->mdev || params->vlan == local->mdev)
699 return -EOPNOTSUPP;
700
701 /* Prevent a race with changing the rate control algorithm */ 666 /* Prevent a race with changing the rate control algorithm */
702 if (!netif_running(dev)) 667 if (!netif_running(dev))
703 return -ENETDOWN; 668 return -ENETDOWN;
@@ -752,9 +717,6 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
752 struct ieee80211_sub_if_data *sdata; 717 struct ieee80211_sub_if_data *sdata;
753 struct sta_info *sta; 718 struct sta_info *sta;
754 719
755 if (dev == local->mdev)
756 return -EOPNOTSUPP;
757
758 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 720 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
759 721
760 if (mac) { 722 if (mac) {
@@ -786,9 +748,6 @@ static int ieee80211_change_station(struct wiphy *wiphy,
786 struct sta_info *sta; 748 struct sta_info *sta;
787 struct ieee80211_sub_if_data *vlansdata; 749 struct ieee80211_sub_if_data *vlansdata;
788 750
789 if (dev == local->mdev || params->vlan == local->mdev)
790 return -EOPNOTSUPP;
791
792 rcu_read_lock(); 751 rcu_read_lock();
793 752
794 /* XXX: get sta belonging to dev */ 753 /* XXX: get sta belonging to dev */
@@ -828,9 +787,6 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
828 struct sta_info *sta; 787 struct sta_info *sta;
829 int err; 788 int err;
830 789
831 if (dev == local->mdev)
832 return -EOPNOTSUPP;
833
834 if (!netif_running(dev)) 790 if (!netif_running(dev))
835 return -ENETDOWN; 791 return -ENETDOWN;
836 792
@@ -884,9 +840,6 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
884 struct mesh_path *mpath; 840 struct mesh_path *mpath;
885 struct sta_info *sta; 841 struct sta_info *sta;
886 842
887 if (dev == local->mdev)
888 return -EOPNOTSUPP;
889
890 if (!netif_running(dev)) 843 if (!netif_running(dev))
891 return -ENETDOWN; 844 return -ENETDOWN;
892 845
@@ -958,13 +911,9 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
958 u8 *dst, u8 *next_hop, struct mpath_info *pinfo) 911 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
959 912
960{ 913{
961 struct ieee80211_local *local = wiphy_priv(wiphy);
962 struct ieee80211_sub_if_data *sdata; 914 struct ieee80211_sub_if_data *sdata;
963 struct mesh_path *mpath; 915 struct mesh_path *mpath;
964 916
965 if (dev == local->mdev)
966 return -EOPNOTSUPP;
967
968 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 917 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
969 918
970 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) 919 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
@@ -986,13 +935,9 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
986 int idx, u8 *dst, u8 *next_hop, 935 int idx, u8 *dst, u8 *next_hop,
987 struct mpath_info *pinfo) 936 struct mpath_info *pinfo)
988{ 937{
989 struct ieee80211_local *local = wiphy_priv(wiphy);
990 struct ieee80211_sub_if_data *sdata; 938 struct ieee80211_sub_if_data *sdata;
991 struct mesh_path *mpath; 939 struct mesh_path *mpath;
992 940
993 if (dev == local->mdev)
994 return -EOPNOTSUPP;
995
996 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 941 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
997 942
998 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) 943 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
@@ -1015,13 +960,9 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
1015 struct net_device *dev, 960 struct net_device *dev,
1016 struct bss_parameters *params) 961 struct bss_parameters *params)
1017{ 962{
1018 struct ieee80211_local *local = wiphy_priv(wiphy);
1019 struct ieee80211_sub_if_data *sdata; 963 struct ieee80211_sub_if_data *sdata;
1020 u32 changed = 0; 964 u32 changed = 0;
1021 965
1022 if (dev == local->mdev)
1023 return -EOPNOTSUPP;
1024
1025 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 966 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1026 967
1027 if (sdata->vif.type != NL80211_IFTYPE_AP) 968 if (sdata->vif.type != NL80211_IFTYPE_AP)
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 81f350eaf8a3..b9902e425f09 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -173,8 +173,7 @@ static ssize_t sta_agg_status_write(struct file *file,
173 const char __user *user_buf, size_t count, loff_t *ppos) 173 const char __user *user_buf, size_t count, loff_t *ppos)
174{ 174{
175 struct sta_info *sta = file->private_data; 175 struct sta_info *sta = file->private_data;
176 struct net_device *dev = sta->sdata->dev; 176 struct ieee80211_local *local = sta->sdata->local;
177 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
178 struct ieee80211_hw *hw = &local->hw; 177 struct ieee80211_hw *hw = &local->hw;
179 u8 *da = sta->sta.addr; 178 u8 *da = sta->sta.addr;
180 static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0, 179 static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 3912fba6d3d0..0b25b0f46b1a 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -573,6 +573,10 @@ enum {
573/* maximum number of hardware queues we support. */ 573/* maximum number of hardware queues we support. */
574#define QD_MAX_QUEUES (IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_QUEUES) 574#define QD_MAX_QUEUES (IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_QUEUES)
575 575
576struct ieee80211_master_priv {
577 struct ieee80211_local *local;
578};
579
576struct ieee80211_local { 580struct ieee80211_local {
577 /* embed the driver visible part. 581 /* embed the driver visible part.
578 * don't cast (use the static inlines below), but we keep 582 * don't cast (use the static inlines below), but we keep
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index c307dba7ec03..7d2d5a041e26 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -106,7 +106,8 @@ static const struct header_ops ieee80211_header_ops = {
106 106
107static int ieee80211_master_open(struct net_device *dev) 107static int ieee80211_master_open(struct net_device *dev)
108{ 108{
109 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 109 struct ieee80211_master_priv *mpriv = netdev_priv(dev);
110 struct ieee80211_local *local = mpriv->local;
110 struct ieee80211_sub_if_data *sdata; 111 struct ieee80211_sub_if_data *sdata;
111 int res = -EOPNOTSUPP; 112 int res = -EOPNOTSUPP;
112 113
@@ -128,7 +129,8 @@ static int ieee80211_master_open(struct net_device *dev)
128 129
129static int ieee80211_master_stop(struct net_device *dev) 130static int ieee80211_master_stop(struct net_device *dev)
130{ 131{
131 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 132 struct ieee80211_master_priv *mpriv = netdev_priv(dev);
133 struct ieee80211_local *local = mpriv->local;
132 struct ieee80211_sub_if_data *sdata; 134 struct ieee80211_sub_if_data *sdata;
133 135
134 /* we hold the RTNL here so can safely walk the list */ 136 /* we hold the RTNL here so can safely walk the list */
@@ -141,7 +143,8 @@ static int ieee80211_master_stop(struct net_device *dev)
141 143
142static void ieee80211_master_set_multicast_list(struct net_device *dev) 144static void ieee80211_master_set_multicast_list(struct net_device *dev)
143{ 145{
144 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 146 struct ieee80211_master_priv *mpriv = netdev_priv(dev);
147 struct ieee80211_local *local = mpriv->local;
145 148
146 ieee80211_configure_filter(local); 149 ieee80211_configure_filter(local);
147} 150}
@@ -787,7 +790,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
787 int result; 790 int result;
788 enum ieee80211_band band; 791 enum ieee80211_band band;
789 struct net_device *mdev; 792 struct net_device *mdev;
790 struct wireless_dev *mwdev; 793 struct ieee80211_master_priv *mpriv;
791 794
792 /* 795 /*
793 * generic code guarantees at least one band, 796 * generic code guarantees at least one band,
@@ -829,16 +832,14 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
829 if (hw->queues < 4) 832 if (hw->queues < 4)
830 hw->ampdu_queues = 0; 833 hw->ampdu_queues = 0;
831 834
832 mdev = alloc_netdev_mq(sizeof(struct wireless_dev), 835 mdev = alloc_netdev_mq(sizeof(struct ieee80211_master_priv),
833 "wmaster%d", ether_setup, 836 "wmaster%d", ether_setup,
834 ieee80211_num_queues(hw)); 837 ieee80211_num_queues(hw));
835 if (!mdev) 838 if (!mdev)
836 goto fail_mdev_alloc; 839 goto fail_mdev_alloc;
837 840
838 mwdev = netdev_priv(mdev); 841 mpriv = netdev_priv(mdev);
839 mdev->ieee80211_ptr = mwdev; 842 mpriv->local = local;
840 mwdev->wiphy = local->hw.wiphy;
841
842 local->mdev = mdev; 843 local->mdev = mdev;
843 844
844 ieee80211_rx_bss_list_init(local); 845 ieee80211_rx_bss_list_init(local);
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 30cf891fd3a8..8013277924f2 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -351,7 +351,7 @@ static void ieee80211_mesh_path_timer(unsigned long data)
351 struct ieee80211_sub_if_data *sdata = 351 struct ieee80211_sub_if_data *sdata =
352 (struct ieee80211_sub_if_data *) data; 352 (struct ieee80211_sub_if_data *) data;
353 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 353 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
354 struct ieee80211_local *local = wdev_priv(&sdata->wdev); 354 struct ieee80211_local *local = sdata->local;
355 355
356 queue_work(local->hw.workqueue, &ifmsh->work); 356 queue_work(local->hw.workqueue, &ifmsh->work);
357} 357}
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 92d898b901e9..3ab9670f1809 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -650,32 +650,28 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
650 return result; 650 return result;
651} 651}
652 652
653static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta) 653static void ap_sta_ps_start(struct sta_info *sta)
654{ 654{
655 struct ieee80211_sub_if_data *sdata; 655 struct ieee80211_sub_if_data *sdata = sta->sdata;
656 DECLARE_MAC_BUF(mac); 656 DECLARE_MAC_BUF(mac);
657 657
658 sdata = sta->sdata;
659
660 atomic_inc(&sdata->bss->num_sta_ps); 658 atomic_inc(&sdata->bss->num_sta_ps);
661 set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL); 659 set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL);
662#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 660#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
663 printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n", 661 printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n",
664 dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid); 662 sdata->dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid);
665#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 663#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
666} 664}
667 665
668static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) 666static int ap_sta_ps_end(struct sta_info *sta)
669{ 667{
670 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 668 struct ieee80211_sub_if_data *sdata = sta->sdata;
669 struct ieee80211_local *local = sdata->local;
671 struct sk_buff *skb; 670 struct sk_buff *skb;
672 int sent = 0; 671 int sent = 0;
673 struct ieee80211_sub_if_data *sdata;
674 struct ieee80211_tx_info *info; 672 struct ieee80211_tx_info *info;
675 DECLARE_MAC_BUF(mac); 673 DECLARE_MAC_BUF(mac);
676 674
677 sdata = sta->sdata;
678
679 atomic_dec(&sdata->bss->num_sta_ps); 675 atomic_dec(&sdata->bss->num_sta_ps);
680 676
681 clear_sta_flags(sta, WLAN_STA_PS | WLAN_STA_PSPOLL); 677 clear_sta_flags(sta, WLAN_STA_PS | WLAN_STA_PSPOLL);
@@ -685,7 +681,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
685 681
686#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 682#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
687 printk(KERN_DEBUG "%s: STA %s aid %d exits power save mode\n", 683 printk(KERN_DEBUG "%s: STA %s aid %d exits power save mode\n",
688 dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid); 684 sdata->dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid);
689#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 685#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
690 686
691 /* Send all buffered frames to the station */ 687 /* Send all buffered frames to the station */
@@ -701,7 +697,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
701 sent++; 697 sent++;
702#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 698#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
703 printk(KERN_DEBUG "%s: STA %s aid %d send PS frame " 699 printk(KERN_DEBUG "%s: STA %s aid %d send PS frame "
704 "since STA not sleeping anymore\n", dev->name, 700 "since STA not sleeping anymore\n", sdata->dev->name,
705 print_mac(mac, sta->sta.addr), sta->sta.aid); 701 print_mac(mac, sta->sta.addr), sta->sta.aid);
706#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 702#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
707 info->flags |= IEEE80211_TX_CTL_REQUEUE; 703 info->flags |= IEEE80211_TX_CTL_REQUEUE;
@@ -715,7 +711,6 @@ static ieee80211_rx_result debug_noinline
715ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) 711ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
716{ 712{
717 struct sta_info *sta = rx->sta; 713 struct sta_info *sta = rx->sta;
718 struct net_device *dev = rx->dev;
719 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; 714 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
720 715
721 if (!sta) 716 if (!sta)
@@ -757,10 +752,10 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
757 * exchange sequence */ 752 * exchange sequence */
758 if (test_sta_flags(sta, WLAN_STA_PS) && 753 if (test_sta_flags(sta, WLAN_STA_PS) &&
759 !ieee80211_has_pm(hdr->frame_control)) 754 !ieee80211_has_pm(hdr->frame_control))
760 rx->sent_ps_buffered += ap_sta_ps_end(dev, sta); 755 rx->sent_ps_buffered += ap_sta_ps_end(sta);
761 else if (!test_sta_flags(sta, WLAN_STA_PS) && 756 else if (!test_sta_flags(sta, WLAN_STA_PS) &&
762 ieee80211_has_pm(hdr->frame_control)) 757 ieee80211_has_pm(hdr->frame_control))
763 ap_sta_ps_start(dev, sta); 758 ap_sta_ps_start(sta);
764 } 759 }
765 760
766 /* Drop data::nullfunc frames silently, since they are used only to 761 /* Drop data::nullfunc frames silently, since they are used only to
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 20d683641b42..00d798cc9e04 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -165,11 +165,10 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
165 return cpu_to_le16(dur); 165 return cpu_to_le16(dur);
166} 166}
167 167
168static int inline is_ieee80211_device(struct net_device *dev, 168static int inline is_ieee80211_device(struct ieee80211_local *local,
169 struct net_device *master) 169 struct net_device *dev)
170{ 170{
171 return (wdev_priv(dev->ieee80211_ptr) == 171 return local == wdev_priv(dev->ieee80211_ptr);
172 wdev_priv(master->ieee80211_ptr));
173} 172}
174 173
175/* tx handlers */ 174/* tx handlers */
@@ -1001,14 +1000,14 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1001/* 1000/*
1002 * NB: @tx is uninitialised when passed in here 1001 * NB: @tx is uninitialised when passed in here
1003 */ 1002 */
1004static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, 1003static int ieee80211_tx_prepare(struct ieee80211_local *local,
1005 struct sk_buff *skb, 1004 struct ieee80211_tx_data *tx,
1006 struct net_device *mdev) 1005 struct sk_buff *skb)
1007{ 1006{
1008 struct net_device *dev; 1007 struct net_device *dev;
1009 1008
1010 dev = dev_get_by_index(&init_net, skb->iif); 1009 dev = dev_get_by_index(&init_net, skb->iif);
1011 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) { 1010 if (unlikely(dev && !is_ieee80211_device(local, dev))) {
1012 dev_put(dev); 1011 dev_put(dev);
1013 dev = NULL; 1012 dev = NULL;
1014 } 1013 }
@@ -1258,6 +1257,8 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
1258int ieee80211_master_start_xmit(struct sk_buff *skb, 1257int ieee80211_master_start_xmit(struct sk_buff *skb,
1259 struct net_device *dev) 1258 struct net_device *dev)
1260{ 1259{
1260 struct ieee80211_master_priv *mpriv = netdev_priv(dev);
1261 struct ieee80211_local *local = mpriv->local;
1261 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1262 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1262 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1263 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1263 struct net_device *odev = NULL; 1264 struct net_device *odev = NULL;
@@ -1273,7 +1274,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1273 1274
1274 if (skb->iif) 1275 if (skb->iif)
1275 odev = dev_get_by_index(&init_net, skb->iif); 1276 odev = dev_get_by_index(&init_net, skb->iif);
1276 if (unlikely(odev && !is_ieee80211_device(odev, dev))) { 1277 if (unlikely(odev && !is_ieee80211_device(local, odev))) {
1277 dev_put(odev); 1278 dev_put(odev);
1278 odev = NULL; 1279 odev = NULL;
1279 } 1280 }
@@ -1449,8 +1450,8 @@ fail:
1449int ieee80211_subif_start_xmit(struct sk_buff *skb, 1450int ieee80211_subif_start_xmit(struct sk_buff *skb,
1450 struct net_device *dev) 1451 struct net_device *dev)
1451{ 1452{
1452 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1453 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1453 struct ieee80211_sub_if_data *sdata; 1454 struct ieee80211_local *local = sdata->local;
1454 int ret = 1, head_need; 1455 int ret = 1, head_need;
1455 u16 ethertype, hdrlen, meshhdrlen = 0; 1456 u16 ethertype, hdrlen, meshhdrlen = 0;
1456 __le16 fc; 1457 __le16 fc;
@@ -1462,7 +1463,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1462 struct sta_info *sta; 1463 struct sta_info *sta;
1463 u32 sta_flags = 0; 1464 u32 sta_flags = 0;
1464 1465
1465 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1466 if (unlikely(skb->len < ETH_HLEN)) { 1466 if (unlikely(skb->len < ETH_HLEN)) {
1467 ret = 0; 1467 ret = 0;
1468 goto fail; 1468 goto fail;
@@ -2032,7 +2032,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
2032 cpu_to_le16(IEEE80211_FCTL_MOREDATA); 2032 cpu_to_le16(IEEE80211_FCTL_MOREDATA);
2033 } 2033 }
2034 2034
2035 if (!ieee80211_tx_prepare(&tx, skb, local->mdev)) 2035 if (!ieee80211_tx_prepare(local, &tx, skb))
2036 break; 2036 break;
2037 dev_kfree_skb_any(skb); 2037 dev_kfree_skb_any(skb);
2038 } 2038 }