2 * mac80211 configuration hooks for cfg80211
4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
6 * This file is GPLv2 as found in COPYING.
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 "driver-ops.h"
21 static bool nl80211_type_check(enum nl80211_iftype type
)
24 case NL80211_IFTYPE_ADHOC
:
25 case NL80211_IFTYPE_STATION
:
26 case NL80211_IFTYPE_MONITOR
:
27 #ifdef CONFIG_MAC80211_MESH
28 case NL80211_IFTYPE_MESH_POINT
:
30 case NL80211_IFTYPE_AP
:
31 case NL80211_IFTYPE_AP_VLAN
:
32 case NL80211_IFTYPE_WDS
:
39 static bool nl80211_params_check(enum nl80211_iftype type
,
40 struct vif_params
*params
)
42 if (!nl80211_type_check(type
))
48 static int ieee80211_add_iface(struct wiphy
*wiphy
, char *name
,
49 enum nl80211_iftype type
, u32
*flags
,
50 struct vif_params
*params
)
52 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
53 struct net_device
*dev
;
54 struct ieee80211_sub_if_data
*sdata
;
57 if (!nl80211_params_check(type
, params
))
60 err
= ieee80211_if_add(local
, name
, &dev
, type
, params
);
61 if (err
|| type
!= NL80211_IFTYPE_MONITOR
|| !flags
)
64 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
65 sdata
->u
.mntr_flags
= *flags
;
69 static int ieee80211_del_iface(struct wiphy
*wiphy
, struct net_device
*dev
)
71 ieee80211_if_remove(IEEE80211_DEV_TO_SUB_IF(dev
));
76 static int ieee80211_change_iface(struct wiphy
*wiphy
,
77 struct net_device
*dev
,
78 enum nl80211_iftype type
, u32
*flags
,
79 struct vif_params
*params
)
81 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
84 if (ieee80211_sdata_running(sdata
))
87 if (!nl80211_params_check(type
, params
))
90 ret
= ieee80211_if_change_type(sdata
, type
);
94 if (ieee80211_vif_is_mesh(&sdata
->vif
) && params
->mesh_id_len
)
95 ieee80211_sdata_set_mesh_id(sdata
,
99 if (type
== NL80211_IFTYPE_AP_VLAN
&&
100 params
&& params
->use_4addr
== 0)
101 rcu_assign_pointer(sdata
->u
.vlan
.sta
, NULL
);
102 else if (type
== NL80211_IFTYPE_STATION
&&
103 params
&& params
->use_4addr
>= 0)
104 sdata
->u
.mgd
.use_4addr
= params
->use_4addr
;
106 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&& flags
)
107 sdata
->u
.mntr_flags
= *flags
;
112 static int ieee80211_add_key(struct wiphy
*wiphy
, struct net_device
*dev
,
113 u8 key_idx
, const u8
*mac_addr
,
114 struct key_params
*params
)
116 struct ieee80211_sub_if_data
*sdata
;
117 struct sta_info
*sta
= NULL
;
118 enum ieee80211_key_alg alg
;
119 struct ieee80211_key
*key
;
122 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
124 switch (params
->cipher
) {
125 case WLAN_CIPHER_SUITE_WEP40
:
126 case WLAN_CIPHER_SUITE_WEP104
:
129 case WLAN_CIPHER_SUITE_TKIP
:
132 case WLAN_CIPHER_SUITE_CCMP
:
135 case WLAN_CIPHER_SUITE_AES_CMAC
:
142 key
= ieee80211_key_alloc(alg
, key_idx
, params
->key_len
, params
->key
,
143 params
->seq_len
, params
->seq
);
150 sta
= sta_info_get_bss(sdata
, mac_addr
);
152 ieee80211_key_free(key
);
158 ieee80211_key_link(key
, sdata
, sta
);
167 static int ieee80211_del_key(struct wiphy
*wiphy
, struct net_device
*dev
,
168 u8 key_idx
, const u8
*mac_addr
)
170 struct ieee80211_sub_if_data
*sdata
;
171 struct sta_info
*sta
;
174 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
181 sta
= sta_info_get_bss(sdata
, mac_addr
);
186 ieee80211_key_free(sta
->key
);
194 if (!sdata
->keys
[key_idx
]) {
199 ieee80211_key_free(sdata
->keys
[key_idx
]);
200 WARN_ON(sdata
->keys
[key_idx
]);
209 static int ieee80211_get_key(struct wiphy
*wiphy
, struct net_device
*dev
,
210 u8 key_idx
, const u8
*mac_addr
, void *cookie
,
211 void (*callback
)(void *cookie
,
212 struct key_params
*params
))
214 struct ieee80211_sub_if_data
*sdata
;
215 struct sta_info
*sta
= NULL
;
217 struct key_params params
;
218 struct ieee80211_key
*key
;
223 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
228 sta
= sta_info_get_bss(sdata
, mac_addr
);
234 key
= sdata
->keys
[key_idx
];
239 memset(¶ms
, 0, sizeof(params
));
241 switch (key
->conf
.alg
) {
243 params
.cipher
= WLAN_CIPHER_SUITE_TKIP
;
245 iv32
= key
->u
.tkip
.tx
.iv32
;
246 iv16
= key
->u
.tkip
.tx
.iv16
;
248 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
)
249 drv_get_tkip_seq(sdata
->local
,
250 key
->conf
.hw_key_idx
,
253 seq
[0] = iv16
& 0xff;
254 seq
[1] = (iv16
>> 8) & 0xff;
255 seq
[2] = iv32
& 0xff;
256 seq
[3] = (iv32
>> 8) & 0xff;
257 seq
[4] = (iv32
>> 16) & 0xff;
258 seq
[5] = (iv32
>> 24) & 0xff;
263 params
.cipher
= WLAN_CIPHER_SUITE_CCMP
;
264 seq
[0] = key
->u
.ccmp
.tx_pn
[5];
265 seq
[1] = key
->u
.ccmp
.tx_pn
[4];
266 seq
[2] = key
->u
.ccmp
.tx_pn
[3];
267 seq
[3] = key
->u
.ccmp
.tx_pn
[2];
268 seq
[4] = key
->u
.ccmp
.tx_pn
[1];
269 seq
[5] = key
->u
.ccmp
.tx_pn
[0];
274 if (key
->conf
.keylen
== 5)
275 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
277 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
280 params
.cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
281 seq
[0] = key
->u
.aes_cmac
.tx_pn
[5];
282 seq
[1] = key
->u
.aes_cmac
.tx_pn
[4];
283 seq
[2] = key
->u
.aes_cmac
.tx_pn
[3];
284 seq
[3] = key
->u
.aes_cmac
.tx_pn
[2];
285 seq
[4] = key
->u
.aes_cmac
.tx_pn
[1];
286 seq
[5] = key
->u
.aes_cmac
.tx_pn
[0];
292 params
.key
= key
->conf
.key
;
293 params
.key_len
= key
->conf
.keylen
;
295 callback(cookie
, ¶ms
);
303 static int ieee80211_config_default_key(struct wiphy
*wiphy
,
304 struct net_device
*dev
,
307 struct ieee80211_sub_if_data
*sdata
;
311 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
312 ieee80211_set_default_key(sdata
, key_idx
);
319 static int ieee80211_config_default_mgmt_key(struct wiphy
*wiphy
,
320 struct net_device
*dev
,
323 struct ieee80211_sub_if_data
*sdata
;
327 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
328 ieee80211_set_default_mgmt_key(sdata
, key_idx
);
335 static void sta_set_sinfo(struct sta_info
*sta
, struct station_info
*sinfo
)
337 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
339 sinfo
->generation
= sdata
->local
->sta_generation
;
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
;
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
;
354 if ((sta
->local
->hw
.flags
& IEEE80211_HW_SIGNAL_DBM
) ||
355 (sta
->local
->hw
.flags
& IEEE80211_HW_SIGNAL_UNSPEC
)) {
356 sinfo
->filled
|= STATION_INFO_SIGNAL
;
357 sinfo
->signal
= (s8
)sta
->last_signal
;
360 sinfo
->txrate
.flags
= 0;
361 if (sta
->last_tx_rate
.flags
& IEEE80211_TX_RC_MCS
)
362 sinfo
->txrate
.flags
|= RATE_INFO_FLAGS_MCS
;
363 if (sta
->last_tx_rate
.flags
& IEEE80211_TX_RC_40_MHZ_WIDTH
)
364 sinfo
->txrate
.flags
|= RATE_INFO_FLAGS_40_MHZ_WIDTH
;
365 if (sta
->last_tx_rate
.flags
& IEEE80211_TX_RC_SHORT_GI
)
366 sinfo
->txrate
.flags
|= RATE_INFO_FLAGS_SHORT_GI
;
368 if (!(sta
->last_tx_rate
.flags
& IEEE80211_TX_RC_MCS
)) {
369 struct ieee80211_supported_band
*sband
;
370 sband
= sta
->local
->hw
.wiphy
->bands
[
371 sta
->local
->hw
.conf
.channel
->band
];
372 sinfo
->txrate
.legacy
=
373 sband
->bitrates
[sta
->last_tx_rate
.idx
].bitrate
;
375 sinfo
->txrate
.mcs
= sta
->last_tx_rate
.idx
;
377 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
378 #ifdef CONFIG_MAC80211_MESH
379 sinfo
->filled
|= STATION_INFO_LLID
|
381 STATION_INFO_PLINK_STATE
;
383 sinfo
->llid
= le16_to_cpu(sta
->llid
);
384 sinfo
->plid
= le16_to_cpu(sta
->plid
);
385 sinfo
->plink_state
= sta
->plink_state
;
391 static int ieee80211_dump_station(struct wiphy
*wiphy
, struct net_device
*dev
,
392 int idx
, u8
*mac
, struct station_info
*sinfo
)
394 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
395 struct sta_info
*sta
;
400 sta
= sta_info_get_by_idx(sdata
, idx
);
403 memcpy(mac
, sta
->sta
.addr
, ETH_ALEN
);
404 sta_set_sinfo(sta
, sinfo
);
412 static int ieee80211_dump_survey(struct wiphy
*wiphy
, struct net_device
*dev
,
413 int idx
, struct survey_info
*survey
)
415 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
417 if (!local
->ops
->get_survey
)
420 return drv_get_survey(local
, idx
, survey
);
423 static int ieee80211_get_station(struct wiphy
*wiphy
, struct net_device
*dev
,
424 u8
*mac
, struct station_info
*sinfo
)
426 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
427 struct sta_info
*sta
;
432 sta
= sta_info_get_bss(sdata
, mac
);
435 sta_set_sinfo(sta
, sinfo
);
444 * This handles both adding a beacon and setting new beacon info
446 static int ieee80211_config_beacon(struct ieee80211_sub_if_data
*sdata
,
447 struct beacon_parameters
*params
)
449 struct beacon_data
*new, *old
;
450 int new_head_len
, new_tail_len
;
454 old
= sdata
->u
.ap
.beacon
;
456 /* head must not be zero-length */
457 if (params
->head
&& !params
->head_len
)
461 * This is a kludge. beacon interval should really be part
462 * of the beacon information.
464 if (params
->interval
&&
465 (sdata
->vif
.bss_conf
.beacon_int
!= params
->interval
)) {
466 sdata
->vif
.bss_conf
.beacon_int
= params
->interval
;
467 ieee80211_bss_info_change_notify(sdata
,
468 BSS_CHANGED_BEACON_INT
);
471 /* Need to have a beacon head if we don't have one yet */
472 if (!params
->head
&& !old
)
475 /* sorry, no way to start beaconing without dtim period */
476 if (!params
->dtim_period
&& !old
)
479 /* new or old head? */
481 new_head_len
= params
->head_len
;
483 new_head_len
= old
->head_len
;
485 /* new or old tail? */
486 if (params
->tail
|| !old
)
487 /* params->tail_len will be zero for !params->tail */
488 new_tail_len
= params
->tail_len
;
490 new_tail_len
= old
->tail_len
;
492 size
= sizeof(*new) + new_head_len
+ new_tail_len
;
494 new = kzalloc(size
, GFP_KERNEL
);
498 /* start filling the new info now */
500 /* new or old dtim period? */
501 if (params
->dtim_period
)
502 new->dtim_period
= params
->dtim_period
;
504 new->dtim_period
= old
->dtim_period
;
507 * pointers go into the block we allocated,
508 * memory is | beacon_data | head | tail |
510 new->head
= ((u8
*) new) + sizeof(*new);
511 new->tail
= new->head
+ new_head_len
;
512 new->head_len
= new_head_len
;
513 new->tail_len
= new_tail_len
;
517 memcpy(new->head
, params
->head
, new_head_len
);
519 memcpy(new->head
, old
->head
, new_head_len
);
521 /* copy in optional tail */
523 memcpy(new->tail
, params
->tail
, new_tail_len
);
526 memcpy(new->tail
, old
->tail
, new_tail_len
);
528 sdata
->vif
.bss_conf
.dtim_period
= new->dtim_period
;
530 rcu_assign_pointer(sdata
->u
.ap
.beacon
, new);
536 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON_ENABLED
|
541 static int ieee80211_add_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
542 struct beacon_parameters
*params
)
544 struct ieee80211_sub_if_data
*sdata
;
545 struct beacon_data
*old
;
547 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
549 old
= sdata
->u
.ap
.beacon
;
554 return ieee80211_config_beacon(sdata
, params
);
557 static int ieee80211_set_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
558 struct beacon_parameters
*params
)
560 struct ieee80211_sub_if_data
*sdata
;
561 struct beacon_data
*old
;
563 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
565 old
= sdata
->u
.ap
.beacon
;
570 return ieee80211_config_beacon(sdata
, params
);
573 static int ieee80211_del_beacon(struct wiphy
*wiphy
, struct net_device
*dev
)
575 struct ieee80211_sub_if_data
*sdata
;
576 struct beacon_data
*old
;
578 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
580 old
= sdata
->u
.ap
.beacon
;
585 rcu_assign_pointer(sdata
->u
.ap
.beacon
, NULL
);
589 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON_ENABLED
);
593 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
594 struct iapp_layer2_update
{
595 u8 da
[ETH_ALEN
]; /* broadcast */
596 u8 sa
[ETH_ALEN
]; /* STA addr */
602 } __attribute__ ((packed
));
604 static void ieee80211_send_layer2_update(struct sta_info
*sta
)
606 struct iapp_layer2_update
*msg
;
609 /* Send Level 2 Update Frame to update forwarding tables in layer 2
612 skb
= dev_alloc_skb(sizeof(*msg
));
615 msg
= (struct iapp_layer2_update
*)skb_put(skb
, sizeof(*msg
));
617 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
618 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
620 memset(msg
->da
, 0xff, ETH_ALEN
);
621 memcpy(msg
->sa
, sta
->sta
.addr
, ETH_ALEN
);
624 msg
->ssap
= 0x01; /* NULL LSAP, CR Bit: Response */
625 msg
->control
= 0xaf; /* XID response lsb.1111F101.
626 * F=0 (no poll command; unsolicited frame) */
627 msg
->xid_info
[0] = 0x81; /* XID format identifier */
628 msg
->xid_info
[1] = 1; /* LLC types/classes: Type 1 LLC */
629 msg
->xid_info
[2] = 0; /* XID sender's receive window size (RW) */
631 skb
->dev
= sta
->sdata
->dev
;
632 skb
->protocol
= eth_type_trans(skb
, sta
->sdata
->dev
);
633 memset(skb
->cb
, 0, sizeof(skb
->cb
));
637 static void sta_apply_parameters(struct ieee80211_local
*local
,
638 struct sta_info
*sta
,
639 struct station_parameters
*params
)
643 struct ieee80211_supported_band
*sband
;
644 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
647 sband
= local
->hw
.wiphy
->bands
[local
->oper_channel
->band
];
649 spin_lock_bh(&sta
->lock
);
650 mask
= params
->sta_flags_mask
;
651 set
= params
->sta_flags_set
;
653 if (mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
654 sta
->flags
&= ~WLAN_STA_AUTHORIZED
;
655 if (set
& BIT(NL80211_STA_FLAG_AUTHORIZED
))
656 sta
->flags
|= WLAN_STA_AUTHORIZED
;
659 if (mask
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
)) {
660 sta
->flags
&= ~WLAN_STA_SHORT_PREAMBLE
;
661 if (set
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
))
662 sta
->flags
|= WLAN_STA_SHORT_PREAMBLE
;
665 if (mask
& BIT(NL80211_STA_FLAG_WME
)) {
666 sta
->flags
&= ~WLAN_STA_WME
;
667 if (set
& BIT(NL80211_STA_FLAG_WME
))
668 sta
->flags
|= WLAN_STA_WME
;
671 if (mask
& BIT(NL80211_STA_FLAG_MFP
)) {
672 sta
->flags
&= ~WLAN_STA_MFP
;
673 if (set
& BIT(NL80211_STA_FLAG_MFP
))
674 sta
->flags
|= WLAN_STA_MFP
;
676 spin_unlock_bh(&sta
->lock
);
679 * cfg80211 validates this (1-2007) and allows setting the AID
680 * only when creating a new station entry
683 sta
->sta
.aid
= params
->aid
;
686 * FIXME: updating the following information is racy when this
687 * function is called from ieee80211_change_station().
688 * However, all this information should be static so
689 * maybe we should just reject attemps to change it.
692 if (params
->listen_interval
>= 0)
693 sta
->listen_interval
= params
->listen_interval
;
695 if (params
->supported_rates
) {
698 for (i
= 0; i
< params
->supported_rates_len
; i
++) {
699 int rate
= (params
->supported_rates
[i
] & 0x7f) * 5;
700 for (j
= 0; j
< sband
->n_bitrates
; j
++) {
701 if (sband
->bitrates
[j
].bitrate
== rate
)
705 sta
->sta
.supp_rates
[local
->oper_channel
->band
] = rates
;
709 ieee80211_ht_cap_ie_to_sta_ht_cap(sband
,
713 if (ieee80211_vif_is_mesh(&sdata
->vif
) && params
->plink_action
) {
714 switch (params
->plink_action
) {
715 case PLINK_ACTION_OPEN
:
716 mesh_plink_open(sta
);
718 case PLINK_ACTION_BLOCK
:
719 mesh_plink_block(sta
);
725 static int ieee80211_add_station(struct wiphy
*wiphy
, struct net_device
*dev
,
726 u8
*mac
, struct station_parameters
*params
)
728 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
729 struct sta_info
*sta
;
730 struct ieee80211_sub_if_data
*sdata
;
735 sdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
737 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
738 sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
741 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
743 if (compare_ether_addr(mac
, sdata
->vif
.addr
) == 0)
746 if (is_multicast_ether_addr(mac
))
749 sta
= sta_info_alloc(sdata
, mac
, GFP_KERNEL
);
753 sta
->flags
= WLAN_STA_AUTH
| WLAN_STA_ASSOC
;
755 sta_apply_parameters(local
, sta
, params
);
757 rate_control_rate_init(sta
);
759 layer2_update
= sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
||
760 sdata
->vif
.type
== NL80211_IFTYPE_AP
;
762 err
= sta_info_insert_rcu(sta
);
769 ieee80211_send_layer2_update(sta
);
776 static int ieee80211_del_station(struct wiphy
*wiphy
, struct net_device
*dev
,
779 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
780 struct ieee80211_sub_if_data
*sdata
;
782 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
785 return sta_info_destroy_addr_bss(sdata
, mac
);
787 sta_info_flush(local
, sdata
);
791 static int ieee80211_change_station(struct wiphy
*wiphy
,
792 struct net_device
*dev
,
794 struct station_parameters
*params
)
796 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
797 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
798 struct sta_info
*sta
;
799 struct ieee80211_sub_if_data
*vlansdata
;
803 sta
= sta_info_get_bss(sdata
, mac
);
809 if (params
->vlan
&& params
->vlan
!= sta
->sdata
->dev
) {
810 vlansdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
812 if (vlansdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
813 vlansdata
->vif
.type
!= NL80211_IFTYPE_AP
) {
818 if (params
->vlan
->ieee80211_ptr
->use_4addr
) {
819 if (vlansdata
->u
.vlan
.sta
) {
824 rcu_assign_pointer(vlansdata
->u
.vlan
.sta
, sta
);
827 sta
->sdata
= vlansdata
;
828 ieee80211_send_layer2_update(sta
);
831 sta_apply_parameters(local
, sta
, params
);
838 #ifdef CONFIG_MAC80211_MESH
839 static int ieee80211_add_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
840 u8
*dst
, u8
*next_hop
)
842 struct ieee80211_sub_if_data
*sdata
;
843 struct mesh_path
*mpath
;
844 struct sta_info
*sta
;
847 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
850 sta
= sta_info_get(sdata
, next_hop
);
856 err
= mesh_path_add(dst
, sdata
);
862 mpath
= mesh_path_lookup(dst
, sdata
);
867 mesh_path_fix_nexthop(mpath
, sta
);
873 static int ieee80211_del_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
876 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
879 return mesh_path_del(dst
, sdata
);
881 mesh_path_flush(sdata
);
885 static int ieee80211_change_mpath(struct wiphy
*wiphy
,
886 struct net_device
*dev
,
887 u8
*dst
, u8
*next_hop
)
889 struct ieee80211_sub_if_data
*sdata
;
890 struct mesh_path
*mpath
;
891 struct sta_info
*sta
;
893 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
897 sta
= sta_info_get(sdata
, next_hop
);
903 mpath
= mesh_path_lookup(dst
, sdata
);
909 mesh_path_fix_nexthop(mpath
, sta
);
915 static void mpath_set_pinfo(struct mesh_path
*mpath
, u8
*next_hop
,
916 struct mpath_info
*pinfo
)
919 memcpy(next_hop
, mpath
->next_hop
->sta
.addr
, ETH_ALEN
);
921 memset(next_hop
, 0, ETH_ALEN
);
923 pinfo
->generation
= mesh_paths_generation
;
925 pinfo
->filled
= MPATH_INFO_FRAME_QLEN
|
929 MPATH_INFO_DISCOVERY_TIMEOUT
|
930 MPATH_INFO_DISCOVERY_RETRIES
|
933 pinfo
->frame_qlen
= mpath
->frame_queue
.qlen
;
934 pinfo
->sn
= mpath
->sn
;
935 pinfo
->metric
= mpath
->metric
;
936 if (time_before(jiffies
, mpath
->exp_time
))
937 pinfo
->exptime
= jiffies_to_msecs(mpath
->exp_time
- jiffies
);
938 pinfo
->discovery_timeout
=
939 jiffies_to_msecs(mpath
->discovery_timeout
);
940 pinfo
->discovery_retries
= mpath
->discovery_retries
;
942 if (mpath
->flags
& MESH_PATH_ACTIVE
)
943 pinfo
->flags
|= NL80211_MPATH_FLAG_ACTIVE
;
944 if (mpath
->flags
& MESH_PATH_RESOLVING
)
945 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
946 if (mpath
->flags
& MESH_PATH_SN_VALID
)
947 pinfo
->flags
|= NL80211_MPATH_FLAG_SN_VALID
;
948 if (mpath
->flags
& MESH_PATH_FIXED
)
949 pinfo
->flags
|= NL80211_MPATH_FLAG_FIXED
;
950 if (mpath
->flags
& MESH_PATH_RESOLVING
)
951 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
953 pinfo
->flags
= mpath
->flags
;
956 static int ieee80211_get_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
957 u8
*dst
, u8
*next_hop
, struct mpath_info
*pinfo
)
960 struct ieee80211_sub_if_data
*sdata
;
961 struct mesh_path
*mpath
;
963 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
966 mpath
= mesh_path_lookup(dst
, sdata
);
971 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
972 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
977 static int ieee80211_dump_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
978 int idx
, u8
*dst
, u8
*next_hop
,
979 struct mpath_info
*pinfo
)
981 struct ieee80211_sub_if_data
*sdata
;
982 struct mesh_path
*mpath
;
984 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
987 mpath
= mesh_path_lookup_by_idx(idx
, sdata
);
992 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
993 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
998 static int ieee80211_get_mesh_params(struct wiphy
*wiphy
,
999 struct net_device
*dev
,
1000 struct mesh_config
*conf
)
1002 struct ieee80211_sub_if_data
*sdata
;
1003 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1005 memcpy(conf
, &(sdata
->u
.mesh
.mshcfg
), sizeof(struct mesh_config
));
1009 static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm
, u32 mask
)
1011 return (mask
>> (parm
-1)) & 0x1;
1014 static int ieee80211_set_mesh_params(struct wiphy
*wiphy
,
1015 struct net_device
*dev
,
1016 const struct mesh_config
*nconf
, u32 mask
)
1018 struct mesh_config
*conf
;
1019 struct ieee80211_sub_if_data
*sdata
;
1020 struct ieee80211_if_mesh
*ifmsh
;
1022 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1023 ifmsh
= &sdata
->u
.mesh
;
1025 /* Set the config options which we are interested in setting */
1026 conf
= &(sdata
->u
.mesh
.mshcfg
);
1027 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT
, mask
))
1028 conf
->dot11MeshRetryTimeout
= nconf
->dot11MeshRetryTimeout
;
1029 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT
, mask
))
1030 conf
->dot11MeshConfirmTimeout
= nconf
->dot11MeshConfirmTimeout
;
1031 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT
, mask
))
1032 conf
->dot11MeshHoldingTimeout
= nconf
->dot11MeshHoldingTimeout
;
1033 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS
, mask
))
1034 conf
->dot11MeshMaxPeerLinks
= nconf
->dot11MeshMaxPeerLinks
;
1035 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES
, mask
))
1036 conf
->dot11MeshMaxRetries
= nconf
->dot11MeshMaxRetries
;
1037 if (_chg_mesh_attr(NL80211_MESHCONF_TTL
, mask
))
1038 conf
->dot11MeshTTL
= nconf
->dot11MeshTTL
;
1039 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS
, mask
))
1040 conf
->auto_open_plinks
= nconf
->auto_open_plinks
;
1041 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES
, mask
))
1042 conf
->dot11MeshHWMPmaxPREQretries
=
1043 nconf
->dot11MeshHWMPmaxPREQretries
;
1044 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME
, mask
))
1045 conf
->path_refresh_time
= nconf
->path_refresh_time
;
1046 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT
, mask
))
1047 conf
->min_discovery_timeout
= nconf
->min_discovery_timeout
;
1048 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT
, mask
))
1049 conf
->dot11MeshHWMPactivePathTimeout
=
1050 nconf
->dot11MeshHWMPactivePathTimeout
;
1051 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL
, mask
))
1052 conf
->dot11MeshHWMPpreqMinInterval
=
1053 nconf
->dot11MeshHWMPpreqMinInterval
;
1054 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME
,
1056 conf
->dot11MeshHWMPnetDiameterTraversalTime
=
1057 nconf
->dot11MeshHWMPnetDiameterTraversalTime
;
1058 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOTMODE
, mask
)) {
1059 conf
->dot11MeshHWMPRootMode
= nconf
->dot11MeshHWMPRootMode
;
1060 ieee80211_mesh_root_setup(ifmsh
);
1067 static int ieee80211_change_bss(struct wiphy
*wiphy
,
1068 struct net_device
*dev
,
1069 struct bss_parameters
*params
)
1071 struct ieee80211_sub_if_data
*sdata
;
1074 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1076 if (params
->use_cts_prot
>= 0) {
1077 sdata
->vif
.bss_conf
.use_cts_prot
= params
->use_cts_prot
;
1078 changed
|= BSS_CHANGED_ERP_CTS_PROT
;
1080 if (params
->use_short_preamble
>= 0) {
1081 sdata
->vif
.bss_conf
.use_short_preamble
=
1082 params
->use_short_preamble
;
1083 changed
|= BSS_CHANGED_ERP_PREAMBLE
;
1086 if (!sdata
->vif
.bss_conf
.use_short_slot
&&
1087 sdata
->local
->hw
.conf
.channel
->band
== IEEE80211_BAND_5GHZ
) {
1088 sdata
->vif
.bss_conf
.use_short_slot
= true;
1089 changed
|= BSS_CHANGED_ERP_SLOT
;
1092 if (params
->use_short_slot_time
>= 0) {
1093 sdata
->vif
.bss_conf
.use_short_slot
=
1094 params
->use_short_slot_time
;
1095 changed
|= BSS_CHANGED_ERP_SLOT
;
1098 if (params
->basic_rates
) {
1101 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1102 struct ieee80211_supported_band
*sband
=
1103 wiphy
->bands
[local
->oper_channel
->band
];
1105 for (i
= 0; i
< params
->basic_rates_len
; i
++) {
1106 int rate
= (params
->basic_rates
[i
] & 0x7f) * 5;
1107 for (j
= 0; j
< sband
->n_bitrates
; j
++) {
1108 if (sband
->bitrates
[j
].bitrate
== rate
)
1112 sdata
->vif
.bss_conf
.basic_rates
= rates
;
1113 changed
|= BSS_CHANGED_BASIC_RATES
;
1116 if (params
->ap_isolate
>= 0) {
1117 if (params
->ap_isolate
)
1118 sdata
->flags
|= IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
1120 sdata
->flags
&= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
1123 ieee80211_bss_info_change_notify(sdata
, changed
);
1128 static int ieee80211_set_txq_params(struct wiphy
*wiphy
,
1129 struct ieee80211_txq_params
*params
)
1131 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1132 struct ieee80211_tx_queue_params p
;
1134 if (!local
->ops
->conf_tx
)
1137 memset(&p
, 0, sizeof(p
));
1138 p
.aifs
= params
->aifs
;
1139 p
.cw_max
= params
->cwmax
;
1140 p
.cw_min
= params
->cwmin
;
1141 p
.txop
= params
->txop
;
1144 * Setting tx queue params disables u-apsd because it's only
1145 * called in master mode.
1149 if (drv_conf_tx(local
, params
->queue
, &p
)) {
1150 printk(KERN_DEBUG
"%s: failed to set TX queue "
1151 "parameters for queue %d\n",
1152 wiphy_name(local
->hw
.wiphy
), params
->queue
);
1156 /* enable WMM or activate new settings */
1157 local
->hw
.conf
.flags
|= IEEE80211_CONF_QOS
;
1158 drv_config(local
, IEEE80211_CONF_CHANGE_QOS
);
1163 static int ieee80211_set_channel(struct wiphy
*wiphy
,
1164 struct net_device
*netdev
,
1165 struct ieee80211_channel
*chan
,
1166 enum nl80211_channel_type channel_type
)
1168 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1170 switch (ieee80211_get_channel_mode(local
, NULL
)) {
1171 case CHAN_MODE_HOPPING
:
1173 case CHAN_MODE_FIXED
:
1174 if (local
->oper_channel
== chan
&&
1175 local
->oper_channel_type
== channel_type
)
1178 case CHAN_MODE_UNDEFINED
:
1182 local
->oper_channel
= chan
;
1183 local
->oper_channel_type
= channel_type
;
1185 return ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_CHANNEL
);
1189 static int ieee80211_suspend(struct wiphy
*wiphy
)
1191 return __ieee80211_suspend(wiphy_priv(wiphy
));
1194 static int ieee80211_resume(struct wiphy
*wiphy
)
1196 return __ieee80211_resume(wiphy_priv(wiphy
));
1199 #define ieee80211_suspend NULL
1200 #define ieee80211_resume NULL
1203 static int ieee80211_scan(struct wiphy
*wiphy
,
1204 struct net_device
*dev
,
1205 struct cfg80211_scan_request
*req
)
1207 struct ieee80211_sub_if_data
*sdata
;
1209 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1211 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
&&
1212 sdata
->vif
.type
!= NL80211_IFTYPE_ADHOC
&&
1213 sdata
->vif
.type
!= NL80211_IFTYPE_MESH_POINT
&&
1214 (sdata
->vif
.type
!= NL80211_IFTYPE_AP
|| sdata
->u
.ap
.beacon
))
1217 return ieee80211_request_scan(sdata
, req
);
1220 static int ieee80211_auth(struct wiphy
*wiphy
, struct net_device
*dev
,
1221 struct cfg80211_auth_request
*req
)
1223 return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
1226 static int ieee80211_assoc(struct wiphy
*wiphy
, struct net_device
*dev
,
1227 struct cfg80211_assoc_request
*req
)
1229 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1230 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1232 switch (ieee80211_get_channel_mode(local
, sdata
)) {
1233 case CHAN_MODE_HOPPING
:
1235 case CHAN_MODE_FIXED
:
1236 if (local
->oper_channel
== req
->bss
->channel
)
1239 case CHAN_MODE_UNDEFINED
:
1243 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
1246 static int ieee80211_deauth(struct wiphy
*wiphy
, struct net_device
*dev
,
1247 struct cfg80211_deauth_request
*req
,
1250 return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev
),
1254 static int ieee80211_disassoc(struct wiphy
*wiphy
, struct net_device
*dev
,
1255 struct cfg80211_disassoc_request
*req
,
1258 return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev
),
1262 static int ieee80211_join_ibss(struct wiphy
*wiphy
, struct net_device
*dev
,
1263 struct cfg80211_ibss_params
*params
)
1265 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1266 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1268 switch (ieee80211_get_channel_mode(local
, sdata
)) {
1269 case CHAN_MODE_HOPPING
:
1271 case CHAN_MODE_FIXED
:
1272 if (!params
->channel_fixed
)
1274 if (local
->oper_channel
== params
->channel
)
1277 case CHAN_MODE_UNDEFINED
:
1281 return ieee80211_ibss_join(sdata
, params
);
1284 static int ieee80211_leave_ibss(struct wiphy
*wiphy
, struct net_device
*dev
)
1286 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1288 return ieee80211_ibss_leave(sdata
);
1291 static int ieee80211_set_wiphy_params(struct wiphy
*wiphy
, u32 changed
)
1293 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1296 if (changed
& WIPHY_PARAM_COVERAGE_CLASS
) {
1297 err
= drv_set_coverage_class(local
, wiphy
->coverage_class
);
1303 if (changed
& WIPHY_PARAM_RTS_THRESHOLD
) {
1304 err
= drv_set_rts_threshold(local
, wiphy
->rts_threshold
);
1310 if (changed
& WIPHY_PARAM_RETRY_SHORT
)
1311 local
->hw
.conf
.short_frame_max_tx_count
= wiphy
->retry_short
;
1312 if (changed
& WIPHY_PARAM_RETRY_LONG
)
1313 local
->hw
.conf
.long_frame_max_tx_count
= wiphy
->retry_long
;
1315 (WIPHY_PARAM_RETRY_SHORT
| WIPHY_PARAM_RETRY_LONG
))
1316 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_RETRY_LIMITS
);
1321 static int ieee80211_set_tx_power(struct wiphy
*wiphy
,
1322 enum tx_power_setting type
, int dbm
)
1324 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1325 struct ieee80211_channel
*chan
= local
->hw
.conf
.channel
;
1329 case TX_POWER_AUTOMATIC
:
1330 local
->user_power_level
= -1;
1332 case TX_POWER_LIMITED
:
1335 local
->user_power_level
= dbm
;
1337 case TX_POWER_FIXED
:
1340 /* TODO: move to cfg80211 when it knows the channel */
1341 if (dbm
> chan
->max_power
)
1343 local
->user_power_level
= dbm
;
1347 ieee80211_hw_config(local
, changes
);
1352 static int ieee80211_get_tx_power(struct wiphy
*wiphy
, int *dbm
)
1354 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1356 *dbm
= local
->hw
.conf
.power_level
;
1361 static int ieee80211_set_wds_peer(struct wiphy
*wiphy
, struct net_device
*dev
,
1364 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1366 memcpy(&sdata
->u
.wds
.remote_addr
, addr
, ETH_ALEN
);
1371 static void ieee80211_rfkill_poll(struct wiphy
*wiphy
)
1373 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1375 drv_rfkill_poll(local
);
1378 #ifdef CONFIG_NL80211_TESTMODE
1379 static int ieee80211_testmode_cmd(struct wiphy
*wiphy
, void *data
, int len
)
1381 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1383 if (!local
->ops
->testmode_cmd
)
1386 return local
->ops
->testmode_cmd(&local
->hw
, data
, len
);
1390 int __ieee80211_request_smps(struct ieee80211_sub_if_data
*sdata
,
1391 enum ieee80211_smps_mode smps_mode
)
1394 enum ieee80211_smps_mode old_req
;
1397 old_req
= sdata
->u
.mgd
.req_smps
;
1398 sdata
->u
.mgd
.req_smps
= smps_mode
;
1400 if (old_req
== smps_mode
&&
1401 smps_mode
!= IEEE80211_SMPS_AUTOMATIC
)
1405 * If not associated, or current association is not an HT
1406 * association, there's no need to send an action frame.
1408 if (!sdata
->u
.mgd
.associated
||
1409 sdata
->local
->oper_channel_type
== NL80211_CHAN_NO_HT
) {
1410 mutex_lock(&sdata
->local
->iflist_mtx
);
1411 ieee80211_recalc_smps(sdata
->local
, sdata
);
1412 mutex_unlock(&sdata
->local
->iflist_mtx
);
1416 ap
= sdata
->u
.mgd
.associated
->bssid
;
1418 if (smps_mode
== IEEE80211_SMPS_AUTOMATIC
) {
1419 if (sdata
->u
.mgd
.powersave
)
1420 smps_mode
= IEEE80211_SMPS_DYNAMIC
;
1422 smps_mode
= IEEE80211_SMPS_OFF
;
1425 /* send SM PS frame to AP */
1426 err
= ieee80211_send_smps_action(sdata
, smps_mode
,
1429 sdata
->u
.mgd
.req_smps
= old_req
;
1434 static int ieee80211_set_power_mgmt(struct wiphy
*wiphy
, struct net_device
*dev
,
1435 bool enabled
, int timeout
)
1437 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1438 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
1439 struct ieee80211_conf
*conf
= &local
->hw
.conf
;
1441 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
1444 if (!(local
->hw
.flags
& IEEE80211_HW_SUPPORTS_PS
))
1447 if (enabled
== sdata
->u
.mgd
.powersave
&&
1448 timeout
== conf
->dynamic_ps_forced_timeout
)
1451 sdata
->u
.mgd
.powersave
= enabled
;
1452 conf
->dynamic_ps_forced_timeout
= timeout
;
1454 /* no change, but if automatic follow powersave */
1455 mutex_lock(&sdata
->u
.mgd
.mtx
);
1456 __ieee80211_request_smps(sdata
, sdata
->u
.mgd
.req_smps
);
1457 mutex_unlock(&sdata
->u
.mgd
.mtx
);
1459 if (local
->hw
.flags
& IEEE80211_HW_SUPPORTS_DYNAMIC_PS
)
1460 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_PS
);
1462 ieee80211_recalc_ps(local
, -1);
1467 static int ieee80211_set_cqm_rssi_config(struct wiphy
*wiphy
,
1468 struct net_device
*dev
,
1469 s32 rssi_thold
, u32 rssi_hyst
)
1471 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1472 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
1473 struct ieee80211_vif
*vif
= &sdata
->vif
;
1474 struct ieee80211_bss_conf
*bss_conf
= &vif
->bss_conf
;
1476 if (rssi_thold
== bss_conf
->cqm_rssi_thold
&&
1477 rssi_hyst
== bss_conf
->cqm_rssi_hyst
)
1480 bss_conf
->cqm_rssi_thold
= rssi_thold
;
1481 bss_conf
->cqm_rssi_hyst
= rssi_hyst
;
1483 if (!(local
->hw
.flags
& IEEE80211_HW_SUPPORTS_CQM_RSSI
)) {
1484 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
1489 /* tell the driver upon association, unless already associated */
1490 if (sdata
->u
.mgd
.associated
)
1491 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_CQM
);
1496 static int ieee80211_set_bitrate_mask(struct wiphy
*wiphy
,
1497 struct net_device
*dev
,
1499 const struct cfg80211_bitrate_mask
*mask
)
1501 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1502 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
1506 * This _could_ be supported by providing a hook for
1507 * drivers for this function, but at this point it
1508 * doesn't seem worth bothering.
1510 if (local
->hw
.flags
& IEEE80211_HW_HAS_RATE_CONTROL
)
1514 for (i
= 0; i
< IEEE80211_NUM_BANDS
; i
++)
1515 sdata
->rc_rateidx_mask
[i
] = mask
->control
[i
].legacy
;
1520 static int ieee80211_remain_on_channel(struct wiphy
*wiphy
,
1521 struct net_device
*dev
,
1522 struct ieee80211_channel
*chan
,
1523 enum nl80211_channel_type channel_type
,
1524 unsigned int duration
,
1527 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1529 return ieee80211_wk_remain_on_channel(sdata
, chan
, channel_type
,
1533 static int ieee80211_cancel_remain_on_channel(struct wiphy
*wiphy
,
1534 struct net_device
*dev
,
1537 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1539 return ieee80211_wk_cancel_remain_on_channel(sdata
, cookie
);
1542 static int ieee80211_action(struct wiphy
*wiphy
, struct net_device
*dev
,
1543 struct ieee80211_channel
*chan
,
1544 enum nl80211_channel_type channel_type
,
1545 const u8
*buf
, size_t len
, u64
*cookie
)
1547 return ieee80211_mgd_action(IEEE80211_DEV_TO_SUB_IF(dev
), chan
,
1548 channel_type
, buf
, len
, cookie
);
1551 struct cfg80211_ops mac80211_config_ops
= {
1552 .add_virtual_intf
= ieee80211_add_iface
,
1553 .del_virtual_intf
= ieee80211_del_iface
,
1554 .change_virtual_intf
= ieee80211_change_iface
,
1555 .add_key
= ieee80211_add_key
,
1556 .del_key
= ieee80211_del_key
,
1557 .get_key
= ieee80211_get_key
,
1558 .set_default_key
= ieee80211_config_default_key
,
1559 .set_default_mgmt_key
= ieee80211_config_default_mgmt_key
,
1560 .add_beacon
= ieee80211_add_beacon
,
1561 .set_beacon
= ieee80211_set_beacon
,
1562 .del_beacon
= ieee80211_del_beacon
,
1563 .add_station
= ieee80211_add_station
,
1564 .del_station
= ieee80211_del_station
,
1565 .change_station
= ieee80211_change_station
,
1566 .get_station
= ieee80211_get_station
,
1567 .dump_station
= ieee80211_dump_station
,
1568 .dump_survey
= ieee80211_dump_survey
,
1569 #ifdef CONFIG_MAC80211_MESH
1570 .add_mpath
= ieee80211_add_mpath
,
1571 .del_mpath
= ieee80211_del_mpath
,
1572 .change_mpath
= ieee80211_change_mpath
,
1573 .get_mpath
= ieee80211_get_mpath
,
1574 .dump_mpath
= ieee80211_dump_mpath
,
1575 .set_mesh_params
= ieee80211_set_mesh_params
,
1576 .get_mesh_params
= ieee80211_get_mesh_params
,
1578 .change_bss
= ieee80211_change_bss
,
1579 .set_txq_params
= ieee80211_set_txq_params
,
1580 .set_channel
= ieee80211_set_channel
,
1581 .suspend
= ieee80211_suspend
,
1582 .resume
= ieee80211_resume
,
1583 .scan
= ieee80211_scan
,
1584 .auth
= ieee80211_auth
,
1585 .assoc
= ieee80211_assoc
,
1586 .deauth
= ieee80211_deauth
,
1587 .disassoc
= ieee80211_disassoc
,
1588 .join_ibss
= ieee80211_join_ibss
,
1589 .leave_ibss
= ieee80211_leave_ibss
,
1590 .set_wiphy_params
= ieee80211_set_wiphy_params
,
1591 .set_tx_power
= ieee80211_set_tx_power
,
1592 .get_tx_power
= ieee80211_get_tx_power
,
1593 .set_wds_peer
= ieee80211_set_wds_peer
,
1594 .rfkill_poll
= ieee80211_rfkill_poll
,
1595 CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd
)
1596 .set_power_mgmt
= ieee80211_set_power_mgmt
,
1597 .set_bitrate_mask
= ieee80211_set_bitrate_mask
,
1598 .remain_on_channel
= ieee80211_remain_on_channel
,
1599 .cancel_remain_on_channel
= ieee80211_cancel_remain_on_channel
,
1600 .action
= ieee80211_action
,
1601 .set_cqm_rssi_config
= ieee80211_set_cqm_rssi_config
,