aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-09-28 08:02:09 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:54:15 -0400
commitf9d540ee5f7e480339911df8d7389ef4c435ab54 (patch)
tree89381e4aa0f8ea31662dc21e890c339d715f8271
parenta28975525016ddcbdaab8225666df1cf2dc9cb2d (diff)
[MAC80211]: remove management interface
Removes the management interface since it is only required for hostapd/userspace MLME, will not be in the final tree at least in this form and hostapd/userspace MLME currently do not work against this tree anyway. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/mac80211.h1
-rw-r--r--net/mac80211/ieee80211.c181
-rw-r--r--net/mac80211/ieee80211_i.h9
-rw-r--r--net/mac80211/ieee80211_iface.c66
-rw-r--r--net/mac80211/ieee80211_rate.c3
-rw-r--r--net/mac80211/ieee80211_rate.h2
-rw-r--r--net/mac80211/ieee80211_sta.c2
-rw-r--r--net/mac80211/rx.c32
-rw-r--r--net/mac80211/tx.c14
-rw-r--r--net/mac80211/wme.c10
10 files changed, 14 insertions, 306 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index bd72f59e98fd..c143ac8965db 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -472,7 +472,6 @@ struct ieee80211_conf {
472enum ieee80211_if_types { 472enum ieee80211_if_types {
473 IEEE80211_IF_TYPE_INVALID, 473 IEEE80211_IF_TYPE_INVALID,
474 IEEE80211_IF_TYPE_AP, 474 IEEE80211_IF_TYPE_AP,
475 IEEE80211_IF_TYPE_MGMT,
476 IEEE80211_IF_TYPE_STA, 475 IEEE80211_IF_TYPE_STA,
477 IEEE80211_IF_TYPE_IBSS, 476 IEEE80211_IF_TYPE_IBSS,
478 IEEE80211_IF_TYPE_MNTR, 477 IEEE80211_IF_TYPE_MNTR,
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 373e8b728782..804da5e89bbf 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -24,7 +24,6 @@
24#include <net/net_namespace.h> 24#include <net/net_namespace.h>
25#include <net/cfg80211.h> 25#include <net/cfg80211.h>
26 26
27#include "ieee80211_common.h"
28#include "ieee80211_i.h" 27#include "ieee80211_i.h"
29#include "ieee80211_rate.h" 28#include "ieee80211_rate.h"
30#include "wep.h" 29#include "wep.h"
@@ -123,151 +122,6 @@ static void ieee80211_master_set_multicast_list(struct net_device *dev)
123 ieee80211_configure_filter(local); 122 ieee80211_configure_filter(local);
124} 123}
125 124
126/* management interface */
127
128static void
129ieee80211_fill_frame_info(struct ieee80211_local *local,
130 struct ieee80211_frame_info *fi,
131 struct ieee80211_rx_status *status)
132{
133 if (status) {
134 struct timespec ts;
135 struct ieee80211_rate *rate;
136
137 jiffies_to_timespec(jiffies, &ts);
138 fi->hosttime = cpu_to_be64((u64) ts.tv_sec * 1000000 +
139 ts.tv_nsec / 1000);
140 fi->mactime = cpu_to_be64(status->mactime);
141 switch (status->phymode) {
142 case MODE_IEEE80211A:
143 fi->phytype = htonl(ieee80211_phytype_ofdm_dot11_a);
144 break;
145 case MODE_IEEE80211B:
146 fi->phytype = htonl(ieee80211_phytype_dsss_dot11_b);
147 break;
148 case MODE_IEEE80211G:
149 fi->phytype = htonl(ieee80211_phytype_pbcc_dot11_g);
150 break;
151 default:
152 fi->phytype = htonl(0xAAAAAAAA);
153 break;
154 }
155 fi->channel = htonl(status->channel);
156 rate = ieee80211_get_rate(local, status->phymode,
157 status->rate);
158 if (rate) {
159 fi->datarate = htonl(rate->rate);
160 if (rate->flags & IEEE80211_RATE_PREAMBLE2) {
161 if (status->rate == rate->val)
162 fi->preamble = htonl(2); /* long */
163 else if (status->rate == rate->val2)
164 fi->preamble = htonl(1); /* short */
165 } else
166 fi->preamble = htonl(0);
167 } else {
168 fi->datarate = htonl(0);
169 fi->preamble = htonl(0);
170 }
171
172 fi->antenna = htonl(status->antenna);
173 fi->priority = htonl(0xffffffff); /* no clue */
174 fi->ssi_type = htonl(ieee80211_ssi_raw);
175 fi->ssi_signal = htonl(status->ssi);
176 fi->ssi_noise = 0x00000000;
177 fi->encoding = 0;
178 } else {
179 /* clear everything because we really don't know.
180 * the msg_type field isn't present on monitor frames
181 * so we don't know whether it will be present or not,
182 * but it's ok to not clear it since it'll be assigned
183 * anyway */
184 memset(fi, 0, sizeof(*fi) - sizeof(fi->msg_type));
185
186 fi->ssi_type = htonl(ieee80211_ssi_none);
187 }
188 fi->version = htonl(IEEE80211_FI_VERSION);
189 fi->length = cpu_to_be32(sizeof(*fi) - sizeof(fi->msg_type));
190}
191
192/* this routine is actually not just for this, but also
193 * for pushing fake 'management' frames into userspace.
194 * it shall be replaced by a netlink-based system. */
195void
196ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
197 struct ieee80211_rx_status *status, u32 msg_type)
198{
199 struct ieee80211_frame_info *fi;
200 const size_t hlen = sizeof(struct ieee80211_frame_info);
201 struct net_device *dev = local->apdev;
202
203 skb->dev = dev;
204
205 if (skb_headroom(skb) < hlen) {
206 I802_DEBUG_INC(local->rx_expand_skb_head);
207 if (pskb_expand_head(skb, hlen, 0, GFP_ATOMIC)) {
208 dev_kfree_skb(skb);
209 return;
210 }
211 }
212
213 fi = (struct ieee80211_frame_info *) skb_push(skb, hlen);
214
215 ieee80211_fill_frame_info(local, fi, status);
216 fi->msg_type = htonl(msg_type);
217
218 dev->stats.rx_packets++;
219 dev->stats.rx_bytes += skb->len;
220
221 skb_set_mac_header(skb, 0);
222 skb->ip_summed = CHECKSUM_UNNECESSARY;
223 skb->pkt_type = PACKET_OTHERHOST;
224 skb->protocol = htons(ETH_P_802_2);
225 memset(skb->cb, 0, sizeof(skb->cb));
226 netif_rx(skb);
227}
228
229static int ieee80211_mgmt_open(struct net_device *dev)
230{
231 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
232
233 if (!netif_running(local->mdev))
234 return -EOPNOTSUPP;
235 return 0;
236}
237
238static int ieee80211_mgmt_stop(struct net_device *dev)
239{
240 return 0;
241}
242
243static int ieee80211_change_mtu_apdev(struct net_device *dev, int new_mtu)
244{
245 /* FIX: what would be proper limits for MTU?
246 * This interface uses 802.11 frames. */
247 if (new_mtu < 256 || new_mtu > IEEE80211_MAX_DATA_LEN) {
248 printk(KERN_WARNING "%s: invalid MTU %d\n",
249 dev->name, new_mtu);
250 return -EINVAL;
251 }
252
253#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
254 printk(KERN_DEBUG "%s: setting MTU %d\n", dev->name, new_mtu);
255#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
256 dev->mtu = new_mtu;
257 return 0;
258}
259
260void ieee80211_if_mgmt_setup(struct net_device *dev)
261{
262 ether_setup(dev);
263 dev->hard_start_xmit = ieee80211_mgmt_start_xmit;
264 dev->change_mtu = ieee80211_change_mtu_apdev;
265 dev->open = ieee80211_mgmt_open;
266 dev->stop = ieee80211_mgmt_stop;
267 dev->type = ARPHRD_IEEE80211_PRISM;
268 dev->destructor = ieee80211_if_free;
269}
270
271/* regular interfaces */ 125/* regular interfaces */
272 126
273static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) 127static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
@@ -345,7 +199,6 @@ static int ieee80211_open(struct net_device *dev)
345 return -ENOLINK; 199 return -ENOLINK;
346 break; 200 break;
347 case IEEE80211_IF_TYPE_AP: 201 case IEEE80211_IF_TYPE_AP:
348 case IEEE80211_IF_TYPE_MGMT:
349 case IEEE80211_IF_TYPE_STA: 202 case IEEE80211_IF_TYPE_STA:
350 case IEEE80211_IF_TYPE_MNTR: 203 case IEEE80211_IF_TYPE_MNTR:
351 case IEEE80211_IF_TYPE_IBSS: 204 case IEEE80211_IF_TYPE_IBSS:
@@ -410,10 +263,6 @@ static int ieee80211_open(struct net_device *dev)
410 if (local->open_count == 0) { 263 if (local->open_count == 0) {
411 res = dev_open(local->mdev); 264 res = dev_open(local->mdev);
412 WARN_ON(res); 265 WARN_ON(res);
413 if (local->apdev) {
414 res = dev_open(local->apdev);
415 WARN_ON(res);
416 }
417 tasklet_enable(&local->tx_pending_tasklet); 266 tasklet_enable(&local->tx_pending_tasklet);
418 tasklet_enable(&local->tasklet); 267 tasklet_enable(&local->tasklet);
419 } 268 }
@@ -499,9 +348,6 @@ static int ieee80211_stop(struct net_device *dev)
499 if (netif_running(local->mdev)) 348 if (netif_running(local->mdev))
500 dev_close(local->mdev); 349 dev_close(local->mdev);
501 350
502 if (local->apdev)
503 dev_close(local->apdev);
504
505 if (local->ops->stop) 351 if (local->ops->stop)
506 local->ops->stop(local_to_hw(local)); 352 local->ops->stop(local_to_hw(local));
507 353
@@ -550,7 +396,7 @@ static const struct header_ops ieee80211_header_ops = {
550 .cache_update = eth_header_cache_update, 396 .cache_update = eth_header_cache_update,
551}; 397};
552 398
553/* Must not be called for mdev and apdev */ 399/* Must not be called for mdev */
554void ieee80211_if_setup(struct net_device *dev) 400void ieee80211_if_setup(struct net_device *dev)
555{ 401{
556 ether_setup(dev); 402 ether_setup(dev);
@@ -806,8 +652,6 @@ static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
806 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; 652 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
807 if (control->flags & IEEE80211_TXCTL_REQUEUE) 653 if (control->flags & IEEE80211_TXCTL_REQUEUE)
808 pkt_data->flags |= IEEE80211_TXPD_REQUEUE; 654 pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
809 if (control->type == IEEE80211_IF_TYPE_MGMT)
810 pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
811 pkt_data->queue = control->queue; 655 pkt_data->queue = control->queue;
812 656
813 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 657 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
@@ -860,7 +704,6 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
860 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 704 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
861 struct ieee80211_local *local = hw_to_local(hw); 705 struct ieee80211_local *local = hw_to_local(hw);
862 u16 frag, type; 706 u16 frag, type;
863 u32 msg_type;
864 struct ieee80211_tx_status_rtap_hdr *rthdr; 707 struct ieee80211_tx_status_rtap_hdr *rthdr;
865 struct ieee80211_sub_if_data *sdata; 708 struct ieee80211_sub_if_data *sdata;
866 int monitors; 709 int monitors;
@@ -975,29 +818,9 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
975 local->dot11FailedCount++; 818 local->dot11FailedCount++;
976 } 819 }
977 820
978 msg_type = (status->flags & IEEE80211_TX_STATUS_ACK) ?
979 ieee80211_msg_tx_callback_ack : ieee80211_msg_tx_callback_fail;
980
981 /* this was a transmitted frame, but now we want to reuse it */ 821 /* this was a transmitted frame, but now we want to reuse it */
982 skb_orphan(skb); 822 skb_orphan(skb);
983 823
984 if ((status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS) &&
985 local->apdev) {
986 if (local->monitors) {
987 skb2 = skb_clone(skb, GFP_ATOMIC);
988 } else {
989 skb2 = skb;
990 skb = NULL;
991 }
992
993 if (skb2)
994 /* Send frame to hostapd */
995 ieee80211_rx_mgmt(local, skb2, NULL, msg_type);
996
997 if (!skb)
998 return;
999 }
1000
1001 if (!local->monitors) { 824 if (!local->monitors) {
1002 dev_kfree_skb(skb); 825 dev_kfree_skb(skb);
1003 return; 826 return;
@@ -1344,8 +1167,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
1344 BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED); 1167 BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED);
1345 1168
1346 local->reg_state = IEEE80211_DEV_UNREGISTERED; 1169 local->reg_state = IEEE80211_DEV_UNREGISTERED;
1347 if (local->apdev)
1348 ieee80211_if_del_mgmt(local);
1349 1170
1350 /* 1171 /*
1351 * At this point, interface list manipulations are fine 1172 * At this point, interface list manipulations are fine
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 9e3c365e3f03..d24b0574c436 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -141,7 +141,6 @@ struct ieee80211_txrx_data {
141 * when using CTS protection with IEEE 802.11g. */ 141 * when using CTS protection with IEEE 802.11g. */
142 struct ieee80211_rate *last_frag_rate; 142 struct ieee80211_rate *last_frag_rate;
143 int last_frag_hwrate; 143 int last_frag_hwrate;
144 int mgmt_interface;
145 144
146 /* Extra fragments (in addition to the first fragment 145 /* Extra fragments (in addition to the first fragment
147 * in skb) */ 146 * in skb) */
@@ -163,7 +162,6 @@ struct ieee80211_txrx_data {
163#define IEEE80211_TXPD_REQ_TX_STATUS BIT(0) 162#define IEEE80211_TXPD_REQ_TX_STATUS BIT(0)
164#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1) 163#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1)
165#define IEEE80211_TXPD_REQUEUE BIT(2) 164#define IEEE80211_TXPD_REQUEUE BIT(2)
166#define IEEE80211_TXPD_MGMT_IFACE BIT(3)
167/* Stored in sk_buff->cb */ 165/* Stored in sk_buff->cb */
168struct ieee80211_tx_packet_data { 166struct ieee80211_tx_packet_data {
169 int ifindex; 167 int ifindex;
@@ -408,7 +406,6 @@ struct ieee80211_local {
408 struct list_head modes_list; 406 struct list_head modes_list;
409 407
410 struct net_device *mdev; /* wmaster# - "master" 802.11 device */ 408 struct net_device *mdev; /* wmaster# - "master" 802.11 device */
411 struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
412 int open_count; 409 int open_count;
413 int monitors; 410 int monitors;
414 unsigned int filter_flags; /* FIF_* */ 411 unsigned int filter_flags; /* FIF_* */
@@ -704,14 +701,11 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
704int ieee80211_hw_config(struct ieee80211_local *local); 701int ieee80211_hw_config(struct ieee80211_local *local);
705int ieee80211_if_config(struct net_device *dev); 702int ieee80211_if_config(struct net_device *dev);
706int ieee80211_if_config_beacon(struct net_device *dev); 703int ieee80211_if_config_beacon(struct net_device *dev);
707void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
708 struct ieee80211_rx_status *status, u32 msg_type);
709void ieee80211_prepare_rates(struct ieee80211_local *local, 704void ieee80211_prepare_rates(struct ieee80211_local *local,
710 struct ieee80211_hw_mode *mode); 705 struct ieee80211_hw_mode *mode);
711void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx); 706void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
712int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr); 707int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
713void ieee80211_if_setup(struct net_device *dev); 708void ieee80211_if_setup(struct net_device *dev);
714void ieee80211_if_mgmt_setup(struct net_device *dev);
715struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local, 709struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local,
716 int phymode, int hwrate); 710 int phymode, int hwrate);
717 711
@@ -778,8 +772,6 @@ void __ieee80211_if_del(struct ieee80211_local *local,
778int ieee80211_if_remove(struct net_device *dev, const char *name, int id); 772int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
779void ieee80211_if_free(struct net_device *dev); 773void ieee80211_if_free(struct net_device *dev);
780void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata); 774void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
781int ieee80211_if_add_mgmt(struct ieee80211_local *local);
782void ieee80211_if_del_mgmt(struct ieee80211_local *local);
783 775
784/* regdomain.c */ 776/* regdomain.c */
785void ieee80211_regdomain_init(void); 777void ieee80211_regdomain_init(void);
@@ -796,7 +788,6 @@ void ieee80211_tx_pending(unsigned long data);
796int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev); 788int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
797int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev); 789int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
798int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); 790int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
799int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev);
800 791
801/* utility functions/constants */ 792/* utility functions/constants */
802extern void *mac80211_wiphy_privid; /* for wiphy privid */ 793extern void *mac80211_wiphy_privid; /* for wiphy privid */
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c
index ef618e947e2b..be7e77f66fee 100644
--- a/net/mac80211/ieee80211_iface.c
+++ b/net/mac80211/ieee80211_iface.c
@@ -96,66 +96,6 @@ fail:
96 return ret; 96 return ret;
97} 97}
98 98
99int ieee80211_if_add_mgmt(struct ieee80211_local *local)
100{
101 struct net_device *ndev;
102 struct ieee80211_sub_if_data *nsdata;
103 int ret;
104
105 ASSERT_RTNL();
106
107 ndev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), "wmgmt%d",
108 ieee80211_if_mgmt_setup);
109 if (!ndev)
110 return -ENOMEM;
111 ret = dev_alloc_name(ndev, ndev->name);
112 if (ret < 0)
113 goto fail;
114
115 memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
116 SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
117
118 nsdata = IEEE80211_DEV_TO_SUB_IF(ndev);
119 ndev->ieee80211_ptr = &nsdata->wdev;
120 nsdata->wdev.wiphy = local->hw.wiphy;
121 nsdata->type = IEEE80211_IF_TYPE_MGMT;
122 nsdata->dev = ndev;
123 nsdata->local = local;
124 ieee80211_if_sdata_init(nsdata);
125
126 ret = register_netdevice(ndev);
127 if (ret)
128 goto fail;
129
130 /*
131 * Called even when register_netdevice fails, it would
132 * oops if assigned before initialising the rest.
133 */
134 ndev->uninit = ieee80211_if_reinit;
135
136 ieee80211_debugfs_add_netdev(nsdata);
137
138 if (local->open_count > 0)
139 dev_open(ndev);
140 local->apdev = ndev;
141 return 0;
142
143fail:
144 free_netdev(ndev);
145 return ret;
146}
147
148void ieee80211_if_del_mgmt(struct ieee80211_local *local)
149{
150 struct net_device *apdev;
151
152 ASSERT_RTNL();
153 apdev = local->apdev;
154 ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(apdev));
155 local->apdev = NULL;
156 unregister_netdevice(apdev);
157}
158
159void ieee80211_if_set_type(struct net_device *dev, int type) 99void ieee80211_if_set_type(struct net_device *dev, int type)
160{ 100{
161 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 101 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -247,9 +187,6 @@ void ieee80211_if_reinit(struct net_device *dev)
247 /* cannot happen */ 187 /* cannot happen */
248 WARN_ON(1); 188 WARN_ON(1);
249 break; 189 break;
250 case IEEE80211_IF_TYPE_MGMT:
251 /* nothing to do */
252 break;
253 case IEEE80211_IF_TYPE_AP: { 190 case IEEE80211_IF_TYPE_AP: {
254 /* Remove all virtual interfaces that use this BSS 191 /* Remove all virtual interfaces that use this BSS
255 * as their sdata->bss */ 192 * as their sdata->bss */
@@ -357,11 +294,8 @@ int ieee80211_if_remove(struct net_device *dev, const char *name, int id)
357 294
358void ieee80211_if_free(struct net_device *dev) 295void ieee80211_if_free(struct net_device *dev)
359{ 296{
360 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
361 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 297 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
362 298
363 /* local->apdev must be NULL when freeing management interface */
364 BUG_ON(dev == local->apdev);
365 ieee80211_if_sdata_deinit(sdata); 299 ieee80211_if_sdata_deinit(sdata);
366 free_netdev(dev); 300 free_netdev(dev);
367} 301}
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index 91a9fe2cbad9..93abb8fff141 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -145,8 +145,7 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
145 struct rate_control_ref *ref, *old; 145 struct rate_control_ref *ref, *old;
146 146
147 ASSERT_RTNL(); 147 ASSERT_RTNL();
148 if (local->open_count || netif_running(local->mdev) || 148 if (local->open_count || netif_running(local->mdev))
149 (local->apdev && netif_running(local->apdev)))
150 return -EBUSY; 149 return -EBUSY;
151 150
152 ref = rate_control_alloc(name, local); 151 ref = rate_control_alloc(name, local);
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h
index cac91a960ff4..7cd1ebab4f83 100644
--- a/net/mac80211/ieee80211_rate.h
+++ b/net/mac80211/ieee80211_rate.h
@@ -30,8 +30,6 @@ struct rate_control_extra {
30 30
31 /* parameters from the caller to rate_control_get_rate(): */ 31 /* parameters from the caller to rate_control_get_rate(): */
32 struct ieee80211_hw_mode *mode; 32 struct ieee80211_hw_mode *mode;
33 int mgmt_data; /* this is data frame that is used for management
34 * (e.g., IEEE 802.1X EAPOL) */
35 u16 ethertype; 33 u16 ethertype;
36}; 34};
37 35
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index cf50a7bfb970..bd9d7aa74083 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -473,8 +473,6 @@ static void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
473 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 473 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
474 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); 474 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
475 pkt_data->ifindex = sdata->dev->ifindex; 475 pkt_data->ifindex = sdata->dev->ifindex;
476 if (sdata->type == IEEE80211_IF_TYPE_MGMT)
477 pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
478 if (!encrypt) 476 if (!encrypt)
479 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; 477 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
480 478
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index b4a62fe3ccbd..7cd185e9dde4 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -19,7 +19,6 @@
19 19
20#include "ieee80211_i.h" 20#include "ieee80211_i.h"
21#include "ieee80211_led.h" 21#include "ieee80211_led.h"
22#include "ieee80211_common.h"
23#include "wep.h" 22#include "wep.h"
24#include "wpa.h" 23#include "wpa.h"
25#include "tkip.h" 24#include "tkip.h"
@@ -412,12 +411,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
412 return TXRX_DROP; 411 return TXRX_DROP;
413 } 412 }
414 413
415 if (!rx->local->apdev) 414 return TXRX_DROP;
416 return TXRX_DROP;
417
418 ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
419 ieee80211_msg_sta_not_assoc);
420 return TXRX_QUEUED;
421 } 415 }
422 416
423 return TXRX_CONTINUE; 417 return TXRX_CONTINUE;
@@ -983,15 +977,8 @@ ieee80211_rx_h_802_1x_pae(struct ieee80211_txrx_data *rx)
983{ 977{
984 if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) && 978 if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) &&
985 rx->sdata->type != IEEE80211_IF_TYPE_STA && 979 rx->sdata->type != IEEE80211_IF_TYPE_STA &&
986 (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) { 980 (rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
987 /* Pass both encrypted and unencrypted EAPOL frames to user 981 return TXRX_CONTINUE;
988 * space for processing. */
989 if (!rx->local->apdev)
990 return TXRX_DROP;
991 ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
992 ieee80211_msg_normal);
993 return TXRX_QUEUED;
994 }
995 982
996 if (unlikely(rx->sdata->ieee802_1x && 983 if (unlikely(rx->sdata->ieee802_1x &&
997 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && 984 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA &&
@@ -1233,15 +1220,11 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
1233 sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); 1220 sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
1234 if ((sdata->type == IEEE80211_IF_TYPE_STA || 1221 if ((sdata->type == IEEE80211_IF_TYPE_STA ||
1235 sdata->type == IEEE80211_IF_TYPE_IBSS) && 1222 sdata->type == IEEE80211_IF_TYPE_IBSS) &&
1236 !rx->local->user_space_mlme) { 1223 !rx->local->user_space_mlme)
1237 ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status); 1224 ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status);
1238 } else { 1225 else
1239 /* Management frames are sent to hostapd for processing */ 1226 return TXRX_DROP;
1240 if (!rx->local->apdev) 1227
1241 return TXRX_DROP;
1242 ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
1243 ieee80211_msg_normal);
1244 }
1245 return TXRX_QUEUED; 1228 return TXRX_QUEUED;
1246} 1229}
1247 1230
@@ -1454,7 +1437,6 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1454 /* take everything */ 1437 /* take everything */
1455 break; 1438 break;
1456 case IEEE80211_IF_TYPE_INVALID: 1439 case IEEE80211_IF_TYPE_INVALID:
1457 case IEEE80211_IF_TYPE_MGMT:
1458 /* should never get here */ 1440 /* should never get here */
1459 WARN_ON(1); 1441 WARN_ON(1);
1460 break; 1442 break;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 54e05392410d..8f0007a925a2 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -258,7 +258,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
258 return TXRX_CONTINUE; 258 return TXRX_CONTINUE;
259 } 259 }
260 260
261 if (unlikely(!tx->u.tx.mgmt_interface && tx->sdata->ieee802_1x && 261 if (unlikely(/* !injected && */ tx->sdata->ieee802_1x &&
262 !(sta_flags & WLAN_STA_AUTHORIZED))) { 262 !(sta_flags & WLAN_STA_AUTHORIZED))) {
263#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 263#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
264 DECLARE_MAC_BUF(mac); 264 DECLARE_MAC_BUF(mac);
@@ -570,8 +570,6 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
570 570
571 memset(&extra, 0, sizeof(extra)); 571 memset(&extra, 0, sizeof(extra));
572 extra.mode = tx->u.tx.mode; 572 extra.mode = tx->u.tx.mode;
573 extra.mgmt_data = tx->sdata &&
574 tx->sdata->type == IEEE80211_IF_TYPE_MGMT;
575 extra.ethertype = tx->ethertype; 573 extra.ethertype = tx->ethertype;
576 574
577 tx->u.tx.rate = rate_control_get_rate(tx->local, tx->dev, tx->skb, 575 tx->u.tx.rate = rate_control_get_rate(tx->local, tx->dev, tx->skb,
@@ -1069,7 +1067,7 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1069} 1067}
1070 1068
1071static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, 1069static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1072 struct ieee80211_tx_control *control, int mgmt) 1070 struct ieee80211_tx_control *control)
1073{ 1071{
1074 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1072 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1075 struct sta_info *sta; 1073 struct sta_info *sta;
@@ -1099,7 +1097,6 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1099 rcu_read_lock(); 1097 rcu_read_lock();
1100 1098
1101 sta = tx.sta; 1099 sta = tx.sta;
1102 tx.u.tx.mgmt_interface = mgmt;
1103 tx.u.tx.mode = local->hw.conf.mode; 1100 tx.u.tx.mode = local->hw.conf.mode;
1104 1101
1105 if (res_prepare == TXRX_QUEUED) { /* if it was an injected packet */ 1102 if (res_prepare == TXRX_QUEUED) { /* if it was an injected packet */
@@ -1250,8 +1247,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1250 control.flags |= IEEE80211_TXCTL_REQUEUE; 1247 control.flags |= IEEE80211_TXCTL_REQUEUE;
1251 control.queue = pkt_data->queue; 1248 control.queue = pkt_data->queue;
1252 1249
1253 ret = ieee80211_tx(odev, skb, &control, 1250 ret = ieee80211_tx(odev, skb, &control);
1254 control.type == IEEE80211_IF_TYPE_MGMT);
1255 dev_put(odev); 1251 dev_put(odev);
1256 1252
1257 return ret; 1253 return ret;
@@ -1496,8 +1492,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1496 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 1492 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
1497 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); 1493 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
1498 pkt_data->ifindex = dev->ifindex; 1494 pkt_data->ifindex = dev->ifindex;
1499 if (sdata->type == IEEE80211_IF_TYPE_MGMT)
1500 pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
1501 1495
1502 skb->dev = local->mdev; 1496 skb->dev = local->mdev;
1503 dev->stats.tx_packets++; 1497 dev->stats.tx_packets++;
@@ -1555,8 +1549,6 @@ int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
1555 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 1549 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
1556 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); 1550 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
1557 pkt_data->ifindex = sdata->dev->ifindex; 1551 pkt_data->ifindex = sdata->dev->ifindex;
1558 if (sdata->type == IEEE80211_IF_TYPE_MGMT)
1559 pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
1560 1552
1561 skb->priority = 20; /* use hardcoded priority for mgmt TX queue */ 1553 skb->priority = 20; /* use hardcoded priority for mgmt TX queue */
1562 skb->dev = sdata->local->mdev; 1554 skb->dev = sdata->local->mdev;
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index fcc8921722f4..5b8a157975a3 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -94,8 +94,6 @@ static inline int wme_downgrade_ac(struct sk_buff *skb)
94static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd) 94static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
95{ 95{
96 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 96 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
97 struct ieee80211_tx_packet_data *pkt_data =
98 (struct ieee80211_tx_packet_data *) skb->cb;
99 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 97 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
100 unsigned short fc = le16_to_cpu(hdr->frame_control); 98 unsigned short fc = le16_to_cpu(hdr->frame_control);
101 int qos; 99 int qos;
@@ -108,12 +106,8 @@ static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
108 return IEEE80211_TX_QUEUE_DATA0; 106 return IEEE80211_TX_QUEUE_DATA0;
109 } 107 }
110 108
111 if (unlikely(pkt_data->flags & IEEE80211_TXPD_MGMT_IFACE)) { 109 if (0 /* injected */) {
112 /* Data frames from hostapd (mainly, EAPOL) use AC_VO 110 /* use AC from radiotap */
113 * and they will include QoS control fields if
114 * the target STA is using WME. */
115 skb->priority = 7;
116 return ieee802_1d_to_ac[skb->priority];
117 } 111 }
118 112
119 /* is this a QoS frame? */ 113 /* is this a QoS frame? */