]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - net/mac80211/cfg.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6-omap-h63xx.git] / net / mac80211 / cfg.c
1 /*
2  * mac80211 configuration hooks for cfg80211
3  *
4  * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
5  *
6  * This file is GPLv2 as found in COPYING.
7  */
8
9 #include <linux/ieee80211.h>
10 #include <linux/nl80211.h>
11 #include <linux/rtnetlink.h>
12 #include <net/net_namespace.h>
13 #include <linux/rcupdate.h>
14 #include <net/cfg80211.h>
15 #include "ieee80211_i.h"
16 #include "cfg.h"
17 #include "rate.h"
18 #include "mesh.h"
19
20 static bool nl80211_type_check(enum nl80211_iftype type)
21 {
22         switch (type) {
23         case NL80211_IFTYPE_ADHOC:
24         case NL80211_IFTYPE_STATION:
25         case NL80211_IFTYPE_MONITOR:
26 #ifdef CONFIG_MAC80211_MESH
27         case NL80211_IFTYPE_MESH_POINT:
28 #endif
29         case NL80211_IFTYPE_AP:
30         case NL80211_IFTYPE_AP_VLAN:
31         case NL80211_IFTYPE_WDS:
32                 return true;
33         default:
34                 return false;
35         }
36 }
37
38 static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
39                                enum nl80211_iftype type, u32 *flags,
40                                struct vif_params *params)
41 {
42         struct ieee80211_local *local = wiphy_priv(wiphy);
43         struct net_device *dev;
44         struct ieee80211_sub_if_data *sdata;
45         int err;
46
47         if (!nl80211_type_check(type))
48                 return -EINVAL;
49
50         err = ieee80211_if_add(local, name, &dev, type, params);
51         if (err || type != NL80211_IFTYPE_MONITOR || !flags)
52                 return err;
53
54         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
55         sdata->u.mntr_flags = *flags;
56         return 0;
57 }
58
59 static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex)
60 {
61         struct net_device *dev;
62         struct ieee80211_sub_if_data *sdata;
63
64         /* we're under RTNL */
65         dev = __dev_get_by_index(&init_net, ifindex);
66         if (!dev)
67                 return -ENODEV;
68
69         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
70
71         ieee80211_if_remove(sdata);
72
73         return 0;
74 }
75
76 static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
77                                   enum nl80211_iftype type, u32 *flags,
78                                   struct vif_params *params)
79 {
80         struct net_device *dev;
81         struct ieee80211_sub_if_data *sdata;
82         int ret;
83
84         /* we're under RTNL */
85         dev = __dev_get_by_index(&init_net, ifindex);
86         if (!dev)
87                 return -ENODEV;
88
89         if (!nl80211_type_check(type))
90                 return -EINVAL;
91
92         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
93
94         ret = ieee80211_if_change_type(sdata, type);
95         if (ret)
96                 return ret;
97
98         if (netif_running(sdata->dev))
99                 return -EBUSY;
100
101         if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
102                 ieee80211_sdata_set_mesh_id(sdata,
103                                             params->mesh_id_len,
104                                             params->mesh_id);
105
106         if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
107                 return 0;
108
109         sdata->u.mntr_flags = *flags;
110         return 0;
111 }
112
113 static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
114                              u8 key_idx, u8 *mac_addr,
115                              struct key_params *params)
116 {
117         struct ieee80211_sub_if_data *sdata;
118         struct sta_info *sta = NULL;
119         enum ieee80211_key_alg alg;
120         struct ieee80211_key *key;
121         int err;
122
123         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
124
125         switch (params->cipher) {
126         case WLAN_CIPHER_SUITE_WEP40:
127         case WLAN_CIPHER_SUITE_WEP104:
128                 alg = ALG_WEP;
129                 break;
130         case WLAN_CIPHER_SUITE_TKIP:
131                 alg = ALG_TKIP;
132                 break;
133         case WLAN_CIPHER_SUITE_CCMP:
134                 alg = ALG_CCMP;
135                 break;
136         case WLAN_CIPHER_SUITE_AES_CMAC:
137                 alg = ALG_AES_CMAC;
138                 break;
139         default:
140                 return -EINVAL;
141         }
142
143         key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key);
144         if (!key)
145                 return -ENOMEM;
146
147         rcu_read_lock();
148
149         if (mac_addr) {
150                 sta = sta_info_get(sdata->local, mac_addr);
151                 if (!sta) {
152                         ieee80211_key_free(key);
153                         err = -ENOENT;
154                         goto out_unlock;
155                 }
156         }
157
158         ieee80211_key_link(key, sdata, sta);
159
160         err = 0;
161  out_unlock:
162         rcu_read_unlock();
163
164         return err;
165 }
166
167 static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
168                              u8 key_idx, u8 *mac_addr)
169 {
170         struct ieee80211_sub_if_data *sdata;
171         struct sta_info *sta;
172         int ret;
173
174         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
175
176         rcu_read_lock();
177
178         if (mac_addr) {
179                 ret = -ENOENT;
180
181                 sta = sta_info_get(sdata->local, mac_addr);
182                 if (!sta)
183                         goto out_unlock;
184
185                 if (sta->key) {
186                         ieee80211_key_free(sta->key);
187                         WARN_ON(sta->key);
188                         ret = 0;
189                 }
190
191                 goto out_unlock;
192         }
193
194         if (!sdata->keys[key_idx]) {
195                 ret = -ENOENT;
196                 goto out_unlock;
197         }
198
199         ieee80211_key_free(sdata->keys[key_idx]);
200         WARN_ON(sdata->keys[key_idx]);
201
202         ret = 0;
203  out_unlock:
204         rcu_read_unlock();
205
206         return ret;
207 }
208
209 static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
210                              u8 key_idx, u8 *mac_addr, void *cookie,
211                              void (*callback)(void *cookie,
212                                               struct key_params *params))
213 {
214         struct ieee80211_sub_if_data *sdata;
215         struct sta_info *sta = NULL;
216         u8 seq[6] = {0};
217         struct key_params params;
218         struct ieee80211_key *key;
219         u32 iv32;
220         u16 iv16;
221         int err = -ENOENT;
222
223         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
224
225         rcu_read_lock();
226
227         if (mac_addr) {
228                 sta = sta_info_get(sdata->local, mac_addr);
229                 if (!sta)
230                         goto out;
231
232                 key = sta->key;
233         } else
234                 key = sdata->keys[key_idx];
235
236         if (!key)
237                 goto out;
238
239         memset(&params, 0, sizeof(params));
240
241         switch (key->conf.alg) {
242         case ALG_TKIP:
243                 params.cipher = WLAN_CIPHER_SUITE_TKIP;
244
245                 iv32 = key->u.tkip.tx.iv32;
246                 iv16 = key->u.tkip.tx.iv16;
247
248                 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
249                     sdata->local->ops->get_tkip_seq)
250                         sdata->local->ops->get_tkip_seq(
251                                 local_to_hw(sdata->local),
252                                 key->conf.hw_key_idx,
253                                 &iv32, &iv16);
254
255                 seq[0] = iv16 & 0xff;
256                 seq[1] = (iv16 >> 8) & 0xff;
257                 seq[2] = iv32 & 0xff;
258                 seq[3] = (iv32 >> 8) & 0xff;
259                 seq[4] = (iv32 >> 16) & 0xff;
260                 seq[5] = (iv32 >> 24) & 0xff;
261                 params.seq = seq;
262                 params.seq_len = 6;
263                 break;
264         case ALG_CCMP:
265                 params.cipher = WLAN_CIPHER_SUITE_CCMP;
266                 seq[0] = key->u.ccmp.tx_pn[5];
267                 seq[1] = key->u.ccmp.tx_pn[4];
268                 seq[2] = key->u.ccmp.tx_pn[3];
269                 seq[3] = key->u.ccmp.tx_pn[2];
270                 seq[4] = key->u.ccmp.tx_pn[1];
271                 seq[5] = key->u.ccmp.tx_pn[0];
272                 params.seq = seq;
273                 params.seq_len = 6;
274                 break;
275         case ALG_WEP:
276                 if (key->conf.keylen == 5)
277                         params.cipher = WLAN_CIPHER_SUITE_WEP40;
278                 else
279                         params.cipher = WLAN_CIPHER_SUITE_WEP104;
280                 break;
281         case ALG_AES_CMAC:
282                 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
283                 seq[0] = key->u.aes_cmac.tx_pn[5];
284                 seq[1] = key->u.aes_cmac.tx_pn[4];
285                 seq[2] = key->u.aes_cmac.tx_pn[3];
286                 seq[3] = key->u.aes_cmac.tx_pn[2];
287                 seq[4] = key->u.aes_cmac.tx_pn[1];
288                 seq[5] = key->u.aes_cmac.tx_pn[0];
289                 params.seq = seq;
290                 params.seq_len = 6;
291                 break;
292         }
293
294         params.key = key->conf.key;
295         params.key_len = key->conf.keylen;
296
297         callback(cookie, &params);
298         err = 0;
299
300  out:
301         rcu_read_unlock();
302         return err;
303 }
304
305 static int ieee80211_config_default_key(struct wiphy *wiphy,
306                                         struct net_device *dev,
307                                         u8 key_idx)
308 {
309         struct ieee80211_sub_if_data *sdata;
310
311         rcu_read_lock();
312
313         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
314         ieee80211_set_default_key(sdata, key_idx);
315
316         rcu_read_unlock();
317
318         return 0;
319 }
320
321 static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy,
322                                              struct net_device *dev,
323                                              u8 key_idx)
324 {
325         struct ieee80211_sub_if_data *sdata;
326
327         rcu_read_lock();
328
329         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
330         ieee80211_set_default_mgmt_key(sdata, key_idx);
331
332         rcu_read_unlock();
333
334         return 0;
335 }
336
337 static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
338 {
339         struct ieee80211_sub_if_data *sdata = sta->sdata;
340
341         sinfo->filled = STATION_INFO_INACTIVE_TIME |
342                         STATION_INFO_RX_BYTES |
343                         STATION_INFO_TX_BYTES |
344                         STATION_INFO_RX_PACKETS |
345                         STATION_INFO_TX_PACKETS |
346                         STATION_INFO_TX_BITRATE;
347
348         sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
349         sinfo->rx_bytes = sta->rx_bytes;
350         sinfo->tx_bytes = sta->tx_bytes;
351         sinfo->rx_packets = sta->rx_packets;
352         sinfo->tx_packets = sta->tx_packets;
353
354         if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
355                 sinfo->filled |= STATION_INFO_SIGNAL;
356                 sinfo->signal = (s8)sta->last_signal;
357         }
358
359         sinfo->txrate.flags = 0;
360         if (sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)
361                 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
362         if (sta->last_tx_rate.flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
363                 sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
364         if (sta->last_tx_rate.flags & IEEE80211_TX_RC_SHORT_GI)
365                 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
366
367         if (!(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) {
368                 struct ieee80211_supported_band *sband;
369                 sband = sta->local->hw.wiphy->bands[
370                                 sta->local->hw.conf.channel->band];
371                 sinfo->txrate.legacy =
372                         sband->bitrates[sta->last_tx_rate.idx].bitrate;
373         } else
374                 sinfo->txrate.mcs = sta->last_tx_rate.idx;
375
376         if (ieee80211_vif_is_mesh(&sdata->vif)) {
377 #ifdef CONFIG_MAC80211_MESH
378                 sinfo->filled |= STATION_INFO_LLID |
379                                  STATION_INFO_PLID |
380                                  STATION_INFO_PLINK_STATE;
381
382                 sinfo->llid = le16_to_cpu(sta->llid);
383                 sinfo->plid = le16_to_cpu(sta->plid);
384                 sinfo->plink_state = sta->plink_state;
385 #endif
386         }
387 }
388
389
390 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
391                                  int idx, u8 *mac, struct station_info *sinfo)
392 {
393         struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
394         struct sta_info *sta;
395         int ret = -ENOENT;
396
397         rcu_read_lock();
398
399         sta = sta_info_get_by_idx(local, idx, dev);
400         if (sta) {
401                 ret = 0;
402                 memcpy(mac, sta->sta.addr, ETH_ALEN);
403                 sta_set_sinfo(sta, sinfo);
404         }
405
406         rcu_read_unlock();
407
408         return ret;
409 }
410
411 static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
412                                  u8 *mac, struct station_info *sinfo)
413 {
414         struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
415         struct sta_info *sta;
416         int ret = -ENOENT;
417
418         rcu_read_lock();
419
420         /* XXX: verify sta->dev == dev */
421
422         sta = sta_info_get(local, mac);
423         if (sta) {
424                 ret = 0;
425                 sta_set_sinfo(sta, sinfo);
426         }
427
428         rcu_read_unlock();
429
430         return ret;
431 }
432
433 /*
434  * This handles both adding a beacon and setting new beacon info
435  */
436 static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
437                                    struct beacon_parameters *params)
438 {
439         struct beacon_data *new, *old;
440         int new_head_len, new_tail_len;
441         int size;
442         int err = -EINVAL;
443
444         old = sdata->u.ap.beacon;
445
446         /* head must not be zero-length */
447         if (params->head && !params->head_len)
448                 return -EINVAL;
449
450         /*
451          * This is a kludge. beacon interval should really be part
452          * of the beacon information.
453          */
454         if (params->interval) {
455                 sdata->local->hw.conf.beacon_int = params->interval;
456                 err = ieee80211_hw_config(sdata->local,
457                                         IEEE80211_CONF_CHANGE_BEACON_INTERVAL);
458                 if (err < 0)
459                         return err;
460                 /*
461                  * We updated some parameter so if below bails out
462                  * it's not an error.
463                  */
464                 err = 0;
465         }
466
467         /* Need to have a beacon head if we don't have one yet */
468         if (!params->head && !old)
469                 return err;
470
471         /* sorry, no way to start beaconing without dtim period */
472         if (!params->dtim_period && !old)
473                 return err;
474
475         /* new or old head? */
476         if (params->head)
477                 new_head_len = params->head_len;
478         else
479                 new_head_len = old->head_len;
480
481         /* new or old tail? */
482         if (params->tail || !old)
483                 /* params->tail_len will be zero for !params->tail */
484                 new_tail_len = params->tail_len;
485         else
486                 new_tail_len = old->tail_len;
487
488         size = sizeof(*new) + new_head_len + new_tail_len;
489
490         new = kzalloc(size, GFP_KERNEL);
491         if (!new)
492                 return -ENOMEM;
493
494         /* start filling the new info now */
495
496         /* new or old dtim period? */
497         if (params->dtim_period)
498                 new->dtim_period = params->dtim_period;
499         else
500                 new->dtim_period = old->dtim_period;
501
502         /*
503          * pointers go into the block we allocated,
504          * memory is | beacon_data | head | tail |
505          */
506         new->head = ((u8 *) new) + sizeof(*new);
507         new->tail = new->head + new_head_len;
508         new->head_len = new_head_len;
509         new->tail_len = new_tail_len;
510
511         /* copy in head */
512         if (params->head)
513                 memcpy(new->head, params->head, new_head_len);
514         else
515                 memcpy(new->head, old->head, new_head_len);
516
517         /* copy in optional tail */
518         if (params->tail)
519                 memcpy(new->tail, params->tail, new_tail_len);
520         else
521                 if (old)
522                         memcpy(new->tail, old->tail, new_tail_len);
523
524         rcu_assign_pointer(sdata->u.ap.beacon, new);
525
526         synchronize_rcu();
527
528         kfree(old);
529
530         return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON |
531                                           IEEE80211_IFCC_BEACON_ENABLED);
532 }
533
534 static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
535                                 struct beacon_parameters *params)
536 {
537         struct ieee80211_sub_if_data *sdata;
538         struct beacon_data *old;
539
540         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
541
542         if (sdata->vif.type != NL80211_IFTYPE_AP)
543                 return -EINVAL;
544
545         old = sdata->u.ap.beacon;
546
547         if (old)
548                 return -EALREADY;
549
550         return ieee80211_config_beacon(sdata, params);
551 }
552
553 static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
554                                 struct beacon_parameters *params)
555 {
556         struct ieee80211_sub_if_data *sdata;
557         struct beacon_data *old;
558
559         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
560
561         if (sdata->vif.type != NL80211_IFTYPE_AP)
562                 return -EINVAL;
563
564         old = sdata->u.ap.beacon;
565
566         if (!old)
567                 return -ENOENT;
568
569         return ieee80211_config_beacon(sdata, params);
570 }
571
572 static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
573 {
574         struct ieee80211_sub_if_data *sdata;
575         struct beacon_data *old;
576
577         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
578
579         if (sdata->vif.type != NL80211_IFTYPE_AP)
580                 return -EINVAL;
581
582         old = sdata->u.ap.beacon;
583
584         if (!old)
585                 return -ENOENT;
586
587         rcu_assign_pointer(sdata->u.ap.beacon, NULL);
588         synchronize_rcu();
589         kfree(old);
590
591         return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON_ENABLED);
592 }
593
594 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
595 struct iapp_layer2_update {
596         u8 da[ETH_ALEN];        /* broadcast */
597         u8 sa[ETH_ALEN];        /* STA addr */
598         __be16 len;             /* 6 */
599         u8 dsap;                /* 0 */
600         u8 ssap;                /* 0 */
601         u8 control;
602         u8 xid_info[3];
603 } __attribute__ ((packed));
604
605 static void ieee80211_send_layer2_update(struct sta_info *sta)
606 {
607         struct iapp_layer2_update *msg;
608         struct sk_buff *skb;
609
610         /* Send Level 2 Update Frame to update forwarding tables in layer 2
611          * bridge devices */
612
613         skb = dev_alloc_skb(sizeof(*msg));
614         if (!skb)
615                 return;
616         msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg));
617
618         /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
619          * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
620
621         memset(msg->da, 0xff, ETH_ALEN);
622         memcpy(msg->sa, sta->sta.addr, ETH_ALEN);
623         msg->len = htons(6);
624         msg->dsap = 0;
625         msg->ssap = 0x01;       /* NULL LSAP, CR Bit: Response */
626         msg->control = 0xaf;    /* XID response lsb.1111F101.
627                                  * F=0 (no poll command; unsolicited frame) */
628         msg->xid_info[0] = 0x81;        /* XID format identifier */
629         msg->xid_info[1] = 1;   /* LLC types/classes: Type 1 LLC */
630         msg->xid_info[2] = 0;   /* XID sender's receive window size (RW) */
631
632         skb->dev = sta->sdata->dev;
633         skb->protocol = eth_type_trans(skb, sta->sdata->dev);
634         memset(skb->cb, 0, sizeof(skb->cb));
635         netif_rx(skb);
636 }
637
638 static void sta_apply_parameters(struct ieee80211_local *local,
639                                  struct sta_info *sta,
640                                  struct station_parameters *params)
641 {
642         u32 rates;
643         int i, j;
644         struct ieee80211_supported_band *sband;
645         struct ieee80211_sub_if_data *sdata = sta->sdata;
646
647         sband = local->hw.wiphy->bands[local->oper_channel->band];
648
649         /*
650          * FIXME: updating the flags is racy when this function is
651          *        called from ieee80211_change_station(), this will
652          *        be resolved in a future patch.
653          */
654
655         if (params->station_flags & STATION_FLAG_CHANGED) {
656                 spin_lock_bh(&sta->lock);
657                 sta->flags &= ~WLAN_STA_AUTHORIZED;
658                 if (params->station_flags & STATION_FLAG_AUTHORIZED)
659                         sta->flags |= WLAN_STA_AUTHORIZED;
660
661                 sta->flags &= ~WLAN_STA_SHORT_PREAMBLE;
662                 if (params->station_flags & STATION_FLAG_SHORT_PREAMBLE)
663                         sta->flags |= WLAN_STA_SHORT_PREAMBLE;
664
665                 sta->flags &= ~WLAN_STA_WME;
666                 if (params->station_flags & STATION_FLAG_WME)
667                         sta->flags |= WLAN_STA_WME;
668
669                 sta->flags &= ~WLAN_STA_MFP;
670                 if (params->station_flags & STATION_FLAG_MFP)
671                         sta->flags |= WLAN_STA_MFP;
672                 spin_unlock_bh(&sta->lock);
673         }
674
675         /*
676          * FIXME: updating the following information is racy when this
677          *        function is called from ieee80211_change_station().
678          *        However, all this information should be static so
679          *        maybe we should just reject attemps to change it.
680          */
681
682         if (params->aid) {
683                 sta->sta.aid = params->aid;
684                 if (sta->sta.aid > IEEE80211_MAX_AID)
685                         sta->sta.aid = 0; /* XXX: should this be an error? */
686         }
687
688         if (params->listen_interval >= 0)
689                 sta->listen_interval = params->listen_interval;
690
691         if (params->supported_rates) {
692                 rates = 0;
693
694                 for (i = 0; i < params->supported_rates_len; i++) {
695                         int rate = (params->supported_rates[i] & 0x7f) * 5;
696                         for (j = 0; j < sband->n_bitrates; j++) {
697                                 if (sband->bitrates[j].bitrate == rate)
698                                         rates |= BIT(j);
699                         }
700                 }
701                 sta->sta.supp_rates[local->oper_channel->band] = rates;
702         }
703
704         if (params->ht_capa)
705                 ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
706                                                   params->ht_capa,
707                                                   &sta->sta.ht_cap);
708
709         if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
710                 switch (params->plink_action) {
711                 case PLINK_ACTION_OPEN:
712                         mesh_plink_open(sta);
713                         break;
714                 case PLINK_ACTION_BLOCK:
715                         mesh_plink_block(sta);
716                         break;
717                 }
718         }
719 }
720
721 static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
722                                  u8 *mac, struct station_parameters *params)
723 {
724         struct ieee80211_local *local = wiphy_priv(wiphy);
725         struct sta_info *sta;
726         struct ieee80211_sub_if_data *sdata;
727         int err;
728         int layer2_update;
729
730         /* Prevent a race with changing the rate control algorithm */
731         if (!netif_running(dev))
732                 return -ENETDOWN;
733
734         if (params->vlan) {
735                 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
736
737                 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
738                     sdata->vif.type != NL80211_IFTYPE_AP)
739                         return -EINVAL;
740         } else
741                 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
742
743         if (compare_ether_addr(mac, dev->dev_addr) == 0)
744                 return -EINVAL;
745
746         if (is_multicast_ether_addr(mac))
747                 return -EINVAL;
748
749         sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
750         if (!sta)
751                 return -ENOMEM;
752
753         sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC;
754
755         sta_apply_parameters(local, sta, params);
756
757         rate_control_rate_init(sta);
758
759         layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
760                 sdata->vif.type == NL80211_IFTYPE_AP;
761
762         rcu_read_lock();
763
764         err = sta_info_insert(sta);
765         if (err) {
766                 /* STA has been freed */
767                 if (err == -EEXIST && layer2_update) {
768                         /* Need to update layer 2 devices on reassociation */
769                         sta = sta_info_get(local, mac);
770                         if (sta)
771                                 ieee80211_send_layer2_update(sta);
772                 }
773                 rcu_read_unlock();
774                 return err;
775         }
776
777         if (layer2_update)
778                 ieee80211_send_layer2_update(sta);
779
780         rcu_read_unlock();
781
782         return 0;
783 }
784
785 static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
786                                  u8 *mac)
787 {
788         struct ieee80211_local *local = wiphy_priv(wiphy);
789         struct ieee80211_sub_if_data *sdata;
790         struct sta_info *sta;
791
792         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
793
794         if (mac) {
795                 rcu_read_lock();
796
797                 /* XXX: get sta belonging to dev */
798                 sta = sta_info_get(local, mac);
799                 if (!sta) {
800                         rcu_read_unlock();
801                         return -ENOENT;
802                 }
803
804                 sta_info_unlink(&sta);
805                 rcu_read_unlock();
806
807                 sta_info_destroy(sta);
808         } else
809                 sta_info_flush(local, sdata);
810
811         return 0;
812 }
813
814 static int ieee80211_change_station(struct wiphy *wiphy,
815                                     struct net_device *dev,
816                                     u8 *mac,
817                                     struct station_parameters *params)
818 {
819         struct ieee80211_local *local = wiphy_priv(wiphy);
820         struct sta_info *sta;
821         struct ieee80211_sub_if_data *vlansdata;
822
823         rcu_read_lock();
824
825         /* XXX: get sta belonging to dev */
826         sta = sta_info_get(local, mac);
827         if (!sta) {
828                 rcu_read_unlock();
829                 return -ENOENT;
830         }
831
832         if (params->vlan && params->vlan != sta->sdata->dev) {
833                 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
834
835                 if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
836                     vlansdata->vif.type != NL80211_IFTYPE_AP) {
837                         rcu_read_unlock();
838                         return -EINVAL;
839                 }
840
841                 sta->sdata = vlansdata;
842                 ieee80211_send_layer2_update(sta);
843         }
844
845         sta_apply_parameters(local, sta, params);
846
847         rcu_read_unlock();
848
849         return 0;
850 }
851
852 #ifdef CONFIG_MAC80211_MESH
853 static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
854                                  u8 *dst, u8 *next_hop)
855 {
856         struct ieee80211_local *local = wiphy_priv(wiphy);
857         struct ieee80211_sub_if_data *sdata;
858         struct mesh_path *mpath;
859         struct sta_info *sta;
860         int err;
861
862         if (!netif_running(dev))
863                 return -ENETDOWN;
864
865         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
866
867         if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
868                 return -ENOTSUPP;
869
870         rcu_read_lock();
871         sta = sta_info_get(local, next_hop);
872         if (!sta) {
873                 rcu_read_unlock();
874                 return -ENOENT;
875         }
876
877         err = mesh_path_add(dst, sdata);
878         if (err) {
879                 rcu_read_unlock();
880                 return err;
881         }
882
883         mpath = mesh_path_lookup(dst, sdata);
884         if (!mpath) {
885                 rcu_read_unlock();
886                 return -ENXIO;
887         }
888         mesh_path_fix_nexthop(mpath, sta);
889
890         rcu_read_unlock();
891         return 0;
892 }
893
894 static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev,
895                                  u8 *dst)
896 {
897         struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
898
899         if (dst)
900                 return mesh_path_del(dst, sdata);
901
902         mesh_path_flush(sdata);
903         return 0;
904 }
905
906 static int ieee80211_change_mpath(struct wiphy *wiphy,
907                                     struct net_device *dev,
908                                     u8 *dst, u8 *next_hop)
909 {
910         struct ieee80211_local *local = wiphy_priv(wiphy);
911         struct ieee80211_sub_if_data *sdata;
912         struct mesh_path *mpath;
913         struct sta_info *sta;
914
915         if (!netif_running(dev))
916                 return -ENETDOWN;
917
918         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
919
920         if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
921                 return -ENOTSUPP;
922
923         rcu_read_lock();
924
925         sta = sta_info_get(local, next_hop);
926         if (!sta) {
927                 rcu_read_unlock();
928                 return -ENOENT;
929         }
930
931         mpath = mesh_path_lookup(dst, sdata);
932         if (!mpath) {
933                 rcu_read_unlock();
934                 return -ENOENT;
935         }
936
937         mesh_path_fix_nexthop(mpath, sta);
938
939         rcu_read_unlock();
940         return 0;
941 }
942
943 static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
944                             struct mpath_info *pinfo)
945 {
946         if (mpath->next_hop)
947                 memcpy(next_hop, mpath->next_hop->sta.addr, ETH_ALEN);
948         else
949                 memset(next_hop, 0, ETH_ALEN);
950
951         pinfo->filled = MPATH_INFO_FRAME_QLEN |
952                         MPATH_INFO_DSN |
953                         MPATH_INFO_METRIC |
954                         MPATH_INFO_EXPTIME |
955                         MPATH_INFO_DISCOVERY_TIMEOUT |
956                         MPATH_INFO_DISCOVERY_RETRIES |
957                         MPATH_INFO_FLAGS;
958
959         pinfo->frame_qlen = mpath->frame_queue.qlen;
960         pinfo->dsn = mpath->dsn;
961         pinfo->metric = mpath->metric;
962         if (time_before(jiffies, mpath->exp_time))
963                 pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies);
964         pinfo->discovery_timeout =
965                         jiffies_to_msecs(mpath->discovery_timeout);
966         pinfo->discovery_retries = mpath->discovery_retries;
967         pinfo->flags = 0;
968         if (mpath->flags & MESH_PATH_ACTIVE)
969                 pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE;
970         if (mpath->flags & MESH_PATH_RESOLVING)
971                 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
972         if (mpath->flags & MESH_PATH_DSN_VALID)
973                 pinfo->flags |= NL80211_MPATH_FLAG_DSN_VALID;
974         if (mpath->flags & MESH_PATH_FIXED)
975                 pinfo->flags |= NL80211_MPATH_FLAG_FIXED;
976         if (mpath->flags & MESH_PATH_RESOLVING)
977                 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
978
979         pinfo->flags = mpath->flags;
980 }
981
982 static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
983                                u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
984
985 {
986         struct ieee80211_sub_if_data *sdata;
987         struct mesh_path *mpath;
988
989         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
990
991         if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
992                 return -ENOTSUPP;
993
994         rcu_read_lock();
995         mpath = mesh_path_lookup(dst, sdata);
996         if (!mpath) {
997                 rcu_read_unlock();
998                 return -ENOENT;
999         }
1000         memcpy(dst, mpath->dst, ETH_ALEN);
1001         mpath_set_pinfo(mpath, next_hop, pinfo);
1002         rcu_read_unlock();
1003         return 0;
1004 }
1005
1006 static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
1007                                  int idx, u8 *dst, u8 *next_hop,
1008                                  struct mpath_info *pinfo)
1009 {
1010         struct ieee80211_sub_if_data *sdata;
1011         struct mesh_path *mpath;
1012
1013         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1014
1015         if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
1016                 return -ENOTSUPP;
1017
1018         rcu_read_lock();
1019         mpath = mesh_path_lookup_by_idx(idx, sdata);
1020         if (!mpath) {
1021                 rcu_read_unlock();
1022                 return -ENOENT;
1023         }
1024         memcpy(dst, mpath->dst, ETH_ALEN);
1025         mpath_set_pinfo(mpath, next_hop, pinfo);
1026         rcu_read_unlock();
1027         return 0;
1028 }
1029
1030 static int ieee80211_get_mesh_params(struct wiphy *wiphy,
1031                                 struct net_device *dev,
1032                                 struct mesh_config *conf)
1033 {
1034         struct ieee80211_sub_if_data *sdata;
1035         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1036
1037         if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
1038                 return -ENOTSUPP;
1039         memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config));
1040         return 0;
1041 }
1042
1043 static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask)
1044 {
1045         return (mask >> (parm-1)) & 0x1;
1046 }
1047
1048 static int ieee80211_set_mesh_params(struct wiphy *wiphy,
1049                                 struct net_device *dev,
1050                                 const struct mesh_config *nconf, u32 mask)
1051 {
1052         struct mesh_config *conf;
1053         struct ieee80211_sub_if_data *sdata;
1054         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1055
1056         if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
1057                 return -ENOTSUPP;
1058
1059         /* Set the config options which we are interested in setting */
1060         conf = &(sdata->u.mesh.mshcfg);
1061         if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT, mask))
1062                 conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout;
1063         if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT, mask))
1064                 conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout;
1065         if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT, mask))
1066                 conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout;
1067         if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS, mask))
1068                 conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks;
1069         if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask))
1070                 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries;
1071         if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask))
1072                 conf->dot11MeshTTL = nconf->dot11MeshTTL;
1073         if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask))
1074                 conf->auto_open_plinks = nconf->auto_open_plinks;
1075         if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask))
1076                 conf->dot11MeshHWMPmaxPREQretries =
1077                         nconf->dot11MeshHWMPmaxPREQretries;
1078         if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME, mask))
1079                 conf->path_refresh_time = nconf->path_refresh_time;
1080         if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask))
1081                 conf->min_discovery_timeout = nconf->min_discovery_timeout;
1082         if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask))
1083                 conf->dot11MeshHWMPactivePathTimeout =
1084                         nconf->dot11MeshHWMPactivePathTimeout;
1085         if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask))
1086                 conf->dot11MeshHWMPpreqMinInterval =
1087                         nconf->dot11MeshHWMPpreqMinInterval;
1088         if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1089                            mask))
1090                 conf->dot11MeshHWMPnetDiameterTraversalTime =
1091                         nconf->dot11MeshHWMPnetDiameterTraversalTime;
1092         return 0;
1093 }
1094
1095 #endif
1096
1097 static int ieee80211_change_bss(struct wiphy *wiphy,
1098                                 struct net_device *dev,
1099                                 struct bss_parameters *params)
1100 {
1101         struct ieee80211_sub_if_data *sdata;
1102         u32 changed = 0;
1103
1104         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1105
1106         if (sdata->vif.type != NL80211_IFTYPE_AP)
1107                 return -EINVAL;
1108
1109         if (params->use_cts_prot >= 0) {
1110                 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot;
1111                 changed |= BSS_CHANGED_ERP_CTS_PROT;
1112         }
1113         if (params->use_short_preamble >= 0) {
1114                 sdata->vif.bss_conf.use_short_preamble =
1115                         params->use_short_preamble;
1116                 changed |= BSS_CHANGED_ERP_PREAMBLE;
1117         }
1118         if (params->use_short_slot_time >= 0) {
1119                 sdata->vif.bss_conf.use_short_slot =
1120                         params->use_short_slot_time;
1121                 changed |= BSS_CHANGED_ERP_SLOT;
1122         }
1123
1124         if (params->basic_rates) {
1125                 int i, j;
1126                 u32 rates = 0;
1127                 struct ieee80211_local *local = wiphy_priv(wiphy);
1128                 struct ieee80211_supported_band *sband =
1129                         wiphy->bands[local->oper_channel->band];
1130
1131                 for (i = 0; i < params->basic_rates_len; i++) {
1132                         int rate = (params->basic_rates[i] & 0x7f) * 5;
1133                         for (j = 0; j < sband->n_bitrates; j++) {
1134                                 if (sband->bitrates[j].bitrate == rate)
1135                                         rates |= BIT(j);
1136                         }
1137                 }
1138                 sdata->vif.bss_conf.basic_rates = rates;
1139                 changed |= BSS_CHANGED_BASIC_RATES;
1140         }
1141
1142         ieee80211_bss_info_change_notify(sdata, changed);
1143
1144         return 0;
1145 }
1146
1147 static int ieee80211_set_txq_params(struct wiphy *wiphy,
1148                                     struct ieee80211_txq_params *params)
1149 {
1150         struct ieee80211_local *local = wiphy_priv(wiphy);
1151         struct ieee80211_tx_queue_params p;
1152
1153         if (!local->ops->conf_tx)
1154                 return -EOPNOTSUPP;
1155
1156         memset(&p, 0, sizeof(p));
1157         p.aifs = params->aifs;
1158         p.cw_max = params->cwmax;
1159         p.cw_min = params->cwmin;
1160         p.txop = params->txop;
1161         if (local->ops->conf_tx(local_to_hw(local), params->queue, &p)) {
1162                 printk(KERN_DEBUG "%s: failed to set TX queue "
1163                        "parameters for queue %d\n", local->mdev->name,
1164                        params->queue);
1165                 return -EINVAL;
1166         }
1167
1168         return 0;
1169 }
1170
1171 static int ieee80211_set_channel(struct wiphy *wiphy,
1172                                  struct ieee80211_channel *chan,
1173                                  enum nl80211_channel_type channel_type)
1174 {
1175         struct ieee80211_local *local = wiphy_priv(wiphy);
1176
1177         local->oper_channel = chan;
1178         local->oper_channel_type = channel_type;
1179
1180         return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
1181 }
1182
1183 static int set_mgmt_extra_ie_sta(struct ieee80211_sub_if_data *sdata,
1184                                  u8 subtype, u8 *ies, size_t ies_len)
1185 {
1186         struct ieee80211_local *local = sdata->local;
1187         struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
1188
1189         switch (subtype) {
1190         case IEEE80211_STYPE_PROBE_REQ >> 4:
1191                 if (local->ops->hw_scan)
1192                         break;
1193                 kfree(ifmgd->ie_probereq);
1194                 ifmgd->ie_probereq = ies;
1195                 ifmgd->ie_probereq_len = ies_len;
1196                 return 0;
1197         case IEEE80211_STYPE_PROBE_RESP >> 4:
1198                 kfree(ifmgd->ie_proberesp);
1199                 ifmgd->ie_proberesp = ies;
1200                 ifmgd->ie_proberesp_len = ies_len;
1201                 return 0;
1202         case IEEE80211_STYPE_AUTH >> 4:
1203                 kfree(ifmgd->ie_auth);
1204                 ifmgd->ie_auth = ies;
1205                 ifmgd->ie_auth_len = ies_len;
1206                 return 0;
1207         case IEEE80211_STYPE_ASSOC_REQ >> 4:
1208                 kfree(ifmgd->ie_assocreq);
1209                 ifmgd->ie_assocreq = ies;
1210                 ifmgd->ie_assocreq_len = ies_len;
1211                 return 0;
1212         case IEEE80211_STYPE_REASSOC_REQ >> 4:
1213                 kfree(ifmgd->ie_reassocreq);
1214                 ifmgd->ie_reassocreq = ies;
1215                 ifmgd->ie_reassocreq_len = ies_len;
1216                 return 0;
1217         case IEEE80211_STYPE_DEAUTH >> 4:
1218                 kfree(ifmgd->ie_deauth);
1219                 ifmgd->ie_deauth = ies;
1220                 ifmgd->ie_deauth_len = ies_len;
1221                 return 0;
1222         case IEEE80211_STYPE_DISASSOC >> 4:
1223                 kfree(ifmgd->ie_disassoc);
1224                 ifmgd->ie_disassoc = ies;
1225                 ifmgd->ie_disassoc_len = ies_len;
1226                 return 0;
1227         }
1228
1229         return -EOPNOTSUPP;
1230 }
1231
1232 static int ieee80211_set_mgmt_extra_ie(struct wiphy *wiphy,
1233                                        struct net_device *dev,
1234                                        struct mgmt_extra_ie_params *params)
1235 {
1236         struct ieee80211_sub_if_data *sdata;
1237         u8 *ies;
1238         size_t ies_len;
1239         int ret = -EOPNOTSUPP;
1240
1241         if (params->ies) {
1242                 ies = kmemdup(params->ies, params->ies_len, GFP_KERNEL);
1243                 if (ies == NULL)
1244                         return -ENOMEM;
1245                 ies_len = params->ies_len;
1246         } else {
1247                 ies = NULL;
1248                 ies_len = 0;
1249         }
1250
1251         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1252
1253         switch (sdata->vif.type) {
1254         case NL80211_IFTYPE_STATION:
1255                 ret = set_mgmt_extra_ie_sta(sdata, params->subtype,
1256                                             ies, ies_len);
1257                 break;
1258         default:
1259                 ret = -EOPNOTSUPP;
1260                 break;
1261         }
1262
1263         if (ret)
1264                 kfree(ies);
1265         return ret;
1266 }
1267
1268 #ifdef CONFIG_PM
1269 static int ieee80211_suspend(struct wiphy *wiphy)
1270 {
1271         return __ieee80211_suspend(wiphy_priv(wiphy));
1272 }
1273
1274 static int ieee80211_resume(struct wiphy *wiphy)
1275 {
1276         return __ieee80211_resume(wiphy_priv(wiphy));
1277 }
1278 #else
1279 #define ieee80211_suspend NULL
1280 #define ieee80211_resume NULL
1281 #endif
1282
1283 static int ieee80211_scan(struct wiphy *wiphy,
1284                           struct net_device *dev,
1285                           struct cfg80211_scan_request *req)
1286 {
1287         struct ieee80211_sub_if_data *sdata;
1288
1289         if (!netif_running(dev))
1290                 return -ENETDOWN;
1291
1292         sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1293
1294         if (sdata->vif.type != NL80211_IFTYPE_STATION &&
1295             sdata->vif.type != NL80211_IFTYPE_ADHOC &&
1296             sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
1297                 return -EOPNOTSUPP;
1298
1299         return ieee80211_request_scan(sdata, req);
1300 }
1301
1302 struct cfg80211_ops mac80211_config_ops = {
1303         .add_virtual_intf = ieee80211_add_iface,
1304         .del_virtual_intf = ieee80211_del_iface,
1305         .change_virtual_intf = ieee80211_change_iface,
1306         .add_key = ieee80211_add_key,
1307         .del_key = ieee80211_del_key,
1308         .get_key = ieee80211_get_key,
1309         .set_default_key = ieee80211_config_default_key,
1310         .set_default_mgmt_key = ieee80211_config_default_mgmt_key,
1311         .add_beacon = ieee80211_add_beacon,
1312         .set_beacon = ieee80211_set_beacon,
1313         .del_beacon = ieee80211_del_beacon,
1314         .add_station = ieee80211_add_station,
1315         .del_station = ieee80211_del_station,
1316         .change_station = ieee80211_change_station,
1317         .get_station = ieee80211_get_station,
1318         .dump_station = ieee80211_dump_station,
1319 #ifdef CONFIG_MAC80211_MESH
1320         .add_mpath = ieee80211_add_mpath,
1321         .del_mpath = ieee80211_del_mpath,
1322         .change_mpath = ieee80211_change_mpath,
1323         .get_mpath = ieee80211_get_mpath,
1324         .dump_mpath = ieee80211_dump_mpath,
1325         .set_mesh_params = ieee80211_set_mesh_params,
1326         .get_mesh_params = ieee80211_get_mesh_params,
1327 #endif
1328         .change_bss = ieee80211_change_bss,
1329         .set_txq_params = ieee80211_set_txq_params,
1330         .set_channel = ieee80211_set_channel,
1331         .set_mgmt_extra_ie = ieee80211_set_mgmt_extra_ie,
1332         .suspend = ieee80211_suspend,
1333         .resume = ieee80211_resume,
1334         .scan = ieee80211_scan,
1335 };