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 <linux/slab.h>
13 #include <net/net_namespace.h>
14 #include <linux/rcupdate.h>
15 #include <linux/if_ether.h>
16 #include <net/cfg80211.h>
17 #include "ieee80211_i.h"
18 #include "driver-ops.h"
23 static struct net_device
*ieee80211_add_iface(struct wiphy
*wiphy
, char *name
,
24 enum nl80211_iftype type
,
26 struct vif_params
*params
)
28 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
29 struct net_device
*dev
;
30 struct ieee80211_sub_if_data
*sdata
;
33 err
= ieee80211_if_add(local
, name
, &dev
, type
, params
);
37 if (type
== NL80211_IFTYPE_MONITOR
&& flags
) {
38 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
39 sdata
->u
.mntr_flags
= *flags
;
45 static int ieee80211_del_iface(struct wiphy
*wiphy
, struct net_device
*dev
)
47 ieee80211_if_remove(IEEE80211_DEV_TO_SUB_IF(dev
));
52 static int ieee80211_change_iface(struct wiphy
*wiphy
,
53 struct net_device
*dev
,
54 enum nl80211_iftype type
, u32
*flags
,
55 struct vif_params
*params
)
57 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
60 ret
= ieee80211_if_change_type(sdata
, type
);
64 if (type
== NL80211_IFTYPE_AP_VLAN
&&
65 params
&& params
->use_4addr
== 0)
66 RCU_INIT_POINTER(sdata
->u
.vlan
.sta
, NULL
);
67 else if (type
== NL80211_IFTYPE_STATION
&&
68 params
&& params
->use_4addr
>= 0)
69 sdata
->u
.mgd
.use_4addr
= params
->use_4addr
;
71 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&& flags
) {
72 struct ieee80211_local
*local
= sdata
->local
;
74 if (ieee80211_sdata_running(sdata
)) {
76 * Prohibit MONITOR_FLAG_COOK_FRAMES to be
77 * changed while the interface is up.
78 * Else we would need to add a lot of cruft
79 * to update everything:
80 * cooked_mntrs, monitor and all fif_* counters
81 * reconfigure hardware
83 if ((*flags
& MONITOR_FLAG_COOK_FRAMES
) !=
84 (sdata
->u
.mntr_flags
& MONITOR_FLAG_COOK_FRAMES
))
87 ieee80211_adjust_monitor_flags(sdata
, -1);
88 sdata
->u
.mntr_flags
= *flags
;
89 ieee80211_adjust_monitor_flags(sdata
, 1);
91 ieee80211_configure_filter(local
);
94 * Because the interface is down, ieee80211_do_stop
95 * and ieee80211_do_open take care of "everything"
96 * mentioned in the comment above.
98 sdata
->u
.mntr_flags
= *flags
;
105 static int ieee80211_set_noack_map(struct wiphy
*wiphy
,
106 struct net_device
*dev
,
109 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
111 sdata
->noack_map
= noack_map
;
115 static int ieee80211_add_key(struct wiphy
*wiphy
, struct net_device
*dev
,
116 u8 key_idx
, bool pairwise
, const u8
*mac_addr
,
117 struct key_params
*params
)
119 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
120 struct sta_info
*sta
= NULL
;
121 struct ieee80211_key
*key
;
124 if (!ieee80211_sdata_running(sdata
))
127 /* reject WEP and TKIP keys if WEP failed to initialize */
128 switch (params
->cipher
) {
129 case WLAN_CIPHER_SUITE_WEP40
:
130 case WLAN_CIPHER_SUITE_TKIP
:
131 case WLAN_CIPHER_SUITE_WEP104
:
132 if (IS_ERR(sdata
->local
->wep_tx_tfm
))
139 key
= ieee80211_key_alloc(params
->cipher
, key_idx
, params
->key_len
,
140 params
->key
, params
->seq_len
, params
->seq
);
145 key
->conf
.flags
|= IEEE80211_KEY_FLAG_PAIRWISE
;
147 mutex_lock(&sdata
->local
->sta_mtx
);
150 if (ieee80211_vif_is_mesh(&sdata
->vif
))
151 sta
= sta_info_get(sdata
, mac_addr
);
153 sta
= sta_info_get_bss(sdata
, mac_addr
);
155 ieee80211_key_free(sdata
->local
, key
);
161 err
= ieee80211_key_link(key
, sdata
, sta
);
163 ieee80211_key_free(sdata
->local
, key
);
166 mutex_unlock(&sdata
->local
->sta_mtx
);
171 static int ieee80211_del_key(struct wiphy
*wiphy
, struct net_device
*dev
,
172 u8 key_idx
, bool pairwise
, const u8
*mac_addr
)
174 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
175 struct ieee80211_local
*local
= sdata
->local
;
176 struct sta_info
*sta
;
177 struct ieee80211_key
*key
= NULL
;
180 mutex_lock(&local
->sta_mtx
);
181 mutex_lock(&local
->key_mtx
);
186 sta
= sta_info_get_bss(sdata
, mac_addr
);
191 key
= key_mtx_dereference(local
, sta
->ptk
);
193 key
= key_mtx_dereference(local
, sta
->gtk
[key_idx
]);
195 key
= key_mtx_dereference(local
, sdata
->keys
[key_idx
]);
202 __ieee80211_key_free(key
);
206 mutex_unlock(&local
->key_mtx
);
207 mutex_unlock(&local
->sta_mtx
);
212 static int ieee80211_get_key(struct wiphy
*wiphy
, struct net_device
*dev
,
213 u8 key_idx
, bool pairwise
, const u8
*mac_addr
,
215 void (*callback
)(void *cookie
,
216 struct key_params
*params
))
218 struct ieee80211_sub_if_data
*sdata
;
219 struct sta_info
*sta
= NULL
;
221 struct key_params params
;
222 struct ieee80211_key
*key
= NULL
;
228 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
233 sta
= sta_info_get_bss(sdata
, mac_addr
);
238 key
= rcu_dereference(sta
->ptk
);
239 else if (key_idx
< NUM_DEFAULT_KEYS
)
240 key
= rcu_dereference(sta
->gtk
[key_idx
]);
242 key
= rcu_dereference(sdata
->keys
[key_idx
]);
247 memset(¶ms
, 0, sizeof(params
));
249 params
.cipher
= key
->conf
.cipher
;
251 switch (key
->conf
.cipher
) {
252 case WLAN_CIPHER_SUITE_TKIP
:
253 iv32
= key
->u
.tkip
.tx
.iv32
;
254 iv16
= key
->u
.tkip
.tx
.iv16
;
256 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
)
257 drv_get_tkip_seq(sdata
->local
,
258 key
->conf
.hw_key_idx
,
261 seq
[0] = iv16
& 0xff;
262 seq
[1] = (iv16
>> 8) & 0xff;
263 seq
[2] = iv32
& 0xff;
264 seq
[3] = (iv32
>> 8) & 0xff;
265 seq
[4] = (iv32
>> 16) & 0xff;
266 seq
[5] = (iv32
>> 24) & 0xff;
270 case WLAN_CIPHER_SUITE_CCMP
:
271 pn64
= atomic64_read(&key
->u
.ccmp
.tx_pn
);
281 case WLAN_CIPHER_SUITE_AES_CMAC
:
282 pn64
= atomic64_read(&key
->u
.aes_cmac
.tx_pn
);
294 params
.key
= key
->conf
.key
;
295 params
.key_len
= key
->conf
.keylen
;
297 callback(cookie
, ¶ms
);
305 static int ieee80211_config_default_key(struct wiphy
*wiphy
,
306 struct net_device
*dev
,
307 u8 key_idx
, bool uni
,
310 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
312 ieee80211_set_default_key(sdata
, key_idx
, uni
, multi
);
317 static int ieee80211_config_default_mgmt_key(struct wiphy
*wiphy
,
318 struct net_device
*dev
,
321 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
323 ieee80211_set_default_mgmt_key(sdata
, key_idx
);
328 static void rate_idx_to_bitrate(struct rate_info
*rate
, struct sta_info
*sta
, int idx
)
330 if (!(rate
->flags
& RATE_INFO_FLAGS_MCS
)) {
331 struct ieee80211_supported_band
*sband
;
332 sband
= sta
->local
->hw
.wiphy
->bands
[
333 sta
->local
->hw
.conf
.channel
->band
];
334 rate
->legacy
= sband
->bitrates
[idx
].bitrate
;
339 void sta_set_rate_info_tx(struct sta_info
*sta
,
340 const struct ieee80211_tx_rate
*rate
,
341 struct rate_info
*rinfo
)
344 if (rate
->flags
& IEEE80211_TX_RC_MCS
)
345 rinfo
->flags
|= RATE_INFO_FLAGS_MCS
;
346 if (rate
->flags
& IEEE80211_TX_RC_40_MHZ_WIDTH
)
347 rinfo
->flags
|= RATE_INFO_FLAGS_40_MHZ_WIDTH
;
348 if (rate
->flags
& IEEE80211_TX_RC_SHORT_GI
)
349 rinfo
->flags
|= RATE_INFO_FLAGS_SHORT_GI
;
350 rate_idx_to_bitrate(rinfo
, sta
, rate
->idx
);
353 static void sta_set_sinfo(struct sta_info
*sta
, struct station_info
*sinfo
)
355 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
356 struct timespec uptime
;
358 sinfo
->generation
= sdata
->local
->sta_generation
;
360 sinfo
->filled
= STATION_INFO_INACTIVE_TIME
|
361 STATION_INFO_RX_BYTES
|
362 STATION_INFO_TX_BYTES
|
363 STATION_INFO_RX_PACKETS
|
364 STATION_INFO_TX_PACKETS
|
365 STATION_INFO_TX_RETRIES
|
366 STATION_INFO_TX_FAILED
|
367 STATION_INFO_TX_BITRATE
|
368 STATION_INFO_RX_BITRATE
|
369 STATION_INFO_RX_DROP_MISC
|
370 STATION_INFO_BSS_PARAM
|
371 STATION_INFO_CONNECTED_TIME
|
372 STATION_INFO_STA_FLAGS
|
373 STATION_INFO_BEACON_LOSS_COUNT
;
375 do_posix_clock_monotonic_gettime(&uptime
);
376 sinfo
->connected_time
= uptime
.tv_sec
- sta
->last_connected
;
378 sinfo
->inactive_time
= jiffies_to_msecs(jiffies
- sta
->last_rx
);
379 sinfo
->rx_bytes
= sta
->rx_bytes
;
380 sinfo
->tx_bytes
= sta
->tx_bytes
;
381 sinfo
->rx_packets
= sta
->rx_packets
;
382 sinfo
->tx_packets
= sta
->tx_packets
;
383 sinfo
->tx_retries
= sta
->tx_retry_count
;
384 sinfo
->tx_failed
= sta
->tx_retry_failed
;
385 sinfo
->rx_dropped_misc
= sta
->rx_dropped
;
386 sinfo
->beacon_loss_count
= sta
->beacon_loss_count
;
388 if ((sta
->local
->hw
.flags
& IEEE80211_HW_SIGNAL_DBM
) ||
389 (sta
->local
->hw
.flags
& IEEE80211_HW_SIGNAL_UNSPEC
)) {
390 sinfo
->filled
|= STATION_INFO_SIGNAL
| STATION_INFO_SIGNAL_AVG
;
391 sinfo
->signal
= (s8
)sta
->last_signal
;
392 sinfo
->signal_avg
= (s8
) -ewma_read(&sta
->avg_signal
);
395 sta_set_rate_info_tx(sta
, &sta
->last_tx_rate
, &sinfo
->txrate
);
397 sinfo
->rxrate
.flags
= 0;
398 if (sta
->last_rx_rate_flag
& RX_FLAG_HT
)
399 sinfo
->rxrate
.flags
|= RATE_INFO_FLAGS_MCS
;
400 if (sta
->last_rx_rate_flag
& RX_FLAG_40MHZ
)
401 sinfo
->rxrate
.flags
|= RATE_INFO_FLAGS_40_MHZ_WIDTH
;
402 if (sta
->last_rx_rate_flag
& RX_FLAG_SHORT_GI
)
403 sinfo
->rxrate
.flags
|= RATE_INFO_FLAGS_SHORT_GI
;
404 rate_idx_to_bitrate(&sinfo
->rxrate
, sta
, sta
->last_rx_rate_idx
);
406 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
407 #ifdef CONFIG_MAC80211_MESH
408 sinfo
->filled
|= STATION_INFO_LLID
|
410 STATION_INFO_PLINK_STATE
;
412 sinfo
->llid
= le16_to_cpu(sta
->llid
);
413 sinfo
->plid
= le16_to_cpu(sta
->plid
);
414 sinfo
->plink_state
= sta
->plink_state
;
418 sinfo
->bss_param
.flags
= 0;
419 if (sdata
->vif
.bss_conf
.use_cts_prot
)
420 sinfo
->bss_param
.flags
|= BSS_PARAM_FLAGS_CTS_PROT
;
421 if (sdata
->vif
.bss_conf
.use_short_preamble
)
422 sinfo
->bss_param
.flags
|= BSS_PARAM_FLAGS_SHORT_PREAMBLE
;
423 if (sdata
->vif
.bss_conf
.use_short_slot
)
424 sinfo
->bss_param
.flags
|= BSS_PARAM_FLAGS_SHORT_SLOT_TIME
;
425 sinfo
->bss_param
.dtim_period
= sdata
->local
->hw
.conf
.ps_dtim_period
;
426 sinfo
->bss_param
.beacon_interval
= sdata
->vif
.bss_conf
.beacon_int
;
428 sinfo
->sta_flags
.set
= 0;
429 sinfo
->sta_flags
.mask
= BIT(NL80211_STA_FLAG_AUTHORIZED
) |
430 BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
) |
431 BIT(NL80211_STA_FLAG_WME
) |
432 BIT(NL80211_STA_FLAG_MFP
) |
433 BIT(NL80211_STA_FLAG_AUTHENTICATED
) |
434 BIT(NL80211_STA_FLAG_TDLS_PEER
);
435 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
436 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_AUTHORIZED
);
437 if (test_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
))
438 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
);
439 if (test_sta_flag(sta
, WLAN_STA_WME
))
440 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_WME
);
441 if (test_sta_flag(sta
, WLAN_STA_MFP
))
442 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_MFP
);
443 if (test_sta_flag(sta
, WLAN_STA_AUTH
))
444 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_AUTHENTICATED
);
445 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
))
446 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_TDLS_PEER
);
450 static int ieee80211_dump_station(struct wiphy
*wiphy
, struct net_device
*dev
,
451 int idx
, u8
*mac
, struct station_info
*sinfo
)
453 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
454 struct sta_info
*sta
;
459 sta
= sta_info_get_by_idx(sdata
, idx
);
462 memcpy(mac
, sta
->sta
.addr
, ETH_ALEN
);
463 sta_set_sinfo(sta
, sinfo
);
471 static int ieee80211_dump_survey(struct wiphy
*wiphy
, struct net_device
*dev
,
472 int idx
, struct survey_info
*survey
)
474 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
476 return drv_get_survey(local
, idx
, survey
);
479 static int ieee80211_get_station(struct wiphy
*wiphy
, struct net_device
*dev
,
480 u8
*mac
, struct station_info
*sinfo
)
482 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
483 struct sta_info
*sta
;
488 sta
= sta_info_get_bss(sdata
, mac
);
491 sta_set_sinfo(sta
, sinfo
);
499 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data
*sdata
,
500 const u8
*resp
, size_t resp_len
)
502 struct sk_buff
*new, *old
;
504 if (!resp
|| !resp_len
)
507 old
= rtnl_dereference(sdata
->u
.ap
.probe_resp
);
509 new = dev_alloc_skb(resp_len
);
513 memcpy(skb_put(new, resp_len
), resp
, resp_len
);
515 rcu_assign_pointer(sdata
->u
.ap
.probe_resp
, new);
517 /* TODO: use call_rcu() */
525 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data
*sdata
,
526 struct cfg80211_beacon_data
*params
)
528 struct beacon_data
*new, *old
;
529 int new_head_len
, new_tail_len
;
531 u32 changed
= BSS_CHANGED_BEACON
;
533 old
= rtnl_dereference(sdata
->u
.ap
.beacon
);
535 /* Need to have a beacon head if we don't have one yet */
536 if (!params
->head
&& !old
)
539 /* new or old head? */
541 new_head_len
= params
->head_len
;
543 new_head_len
= old
->head_len
;
545 /* new or old tail? */
546 if (params
->tail
|| !old
)
547 /* params->tail_len will be zero for !params->tail */
548 new_tail_len
= params
->tail_len
;
550 new_tail_len
= old
->tail_len
;
552 size
= sizeof(*new) + new_head_len
+ new_tail_len
;
554 new = kzalloc(size
, GFP_KERNEL
);
558 /* start filling the new info now */
561 * pointers go into the block we allocated,
562 * memory is | beacon_data | head | tail |
564 new->head
= ((u8
*) new) + sizeof(*new);
565 new->tail
= new->head
+ new_head_len
;
566 new->head_len
= new_head_len
;
567 new->tail_len
= new_tail_len
;
571 memcpy(new->head
, params
->head
, new_head_len
);
573 memcpy(new->head
, old
->head
, new_head_len
);
575 /* copy in optional tail */
577 memcpy(new->tail
, params
->tail
, new_tail_len
);
580 memcpy(new->tail
, old
->tail
, new_tail_len
);
582 err
= ieee80211_set_probe_resp(sdata
, params
->probe_resp
,
583 params
->probe_resp_len
);
587 changed
|= BSS_CHANGED_AP_PROBE_RESP
;
589 rcu_assign_pointer(sdata
->u
.ap
.beacon
, new);
592 kfree_rcu(old
, rcu_head
);
597 static int ieee80211_start_ap(struct wiphy
*wiphy
, struct net_device
*dev
,
598 struct cfg80211_ap_settings
*params
)
600 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
601 struct beacon_data
*old
;
602 struct ieee80211_sub_if_data
*vlan
;
603 u32 changed
= BSS_CHANGED_BEACON_INT
|
604 BSS_CHANGED_BEACON_ENABLED
|
609 old
= rtnl_dereference(sdata
->u
.ap
.beacon
);
614 * Apply control port protocol, this allows us to
615 * not encrypt dynamic WEP control frames.
617 sdata
->control_port_protocol
= params
->crypto
.control_port_ethertype
;
618 sdata
->control_port_no_encrypt
= params
->crypto
.control_port_no_encrypt
;
619 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
) {
620 vlan
->control_port_protocol
=
621 params
->crypto
.control_port_ethertype
;
622 vlan
->control_port_no_encrypt
=
623 params
->crypto
.control_port_no_encrypt
;
626 sdata
->vif
.bss_conf
.beacon_int
= params
->beacon_interval
;
627 sdata
->vif
.bss_conf
.dtim_period
= params
->dtim_period
;
629 sdata
->vif
.bss_conf
.ssid_len
= params
->ssid_len
;
630 if (params
->ssid_len
)
631 memcpy(sdata
->vif
.bss_conf
.ssid
, params
->ssid
,
633 sdata
->vif
.bss_conf
.hidden_ssid
=
634 (params
->hidden_ssid
!= NL80211_HIDDEN_SSID_NOT_IN_USE
);
636 err
= ieee80211_assign_beacon(sdata
, ¶ms
->beacon
);
641 ieee80211_bss_info_change_notify(sdata
, changed
);
646 static int ieee80211_change_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
647 struct cfg80211_beacon_data
*params
)
649 struct ieee80211_sub_if_data
*sdata
;
650 struct beacon_data
*old
;
653 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
655 old
= rtnl_dereference(sdata
->u
.ap
.beacon
);
659 err
= ieee80211_assign_beacon(sdata
, params
);
662 ieee80211_bss_info_change_notify(sdata
, err
);
666 static int ieee80211_stop_ap(struct wiphy
*wiphy
, struct net_device
*dev
)
668 struct ieee80211_sub_if_data
*sdata
;
669 struct beacon_data
*old
;
671 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
673 old
= rtnl_dereference(sdata
->u
.ap
.beacon
);
677 RCU_INIT_POINTER(sdata
->u
.ap
.beacon
, NULL
);
679 kfree_rcu(old
, rcu_head
);
681 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON_ENABLED
);
686 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
687 struct iapp_layer2_update
{
688 u8 da
[ETH_ALEN
]; /* broadcast */
689 u8 sa
[ETH_ALEN
]; /* STA addr */
697 static void ieee80211_send_layer2_update(struct sta_info
*sta
)
699 struct iapp_layer2_update
*msg
;
702 /* Send Level 2 Update Frame to update forwarding tables in layer 2
705 skb
= dev_alloc_skb(sizeof(*msg
));
708 msg
= (struct iapp_layer2_update
*)skb_put(skb
, sizeof(*msg
));
710 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
711 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
713 memset(msg
->da
, 0xff, ETH_ALEN
);
714 memcpy(msg
->sa
, sta
->sta
.addr
, ETH_ALEN
);
717 msg
->ssap
= 0x01; /* NULL LSAP, CR Bit: Response */
718 msg
->control
= 0xaf; /* XID response lsb.1111F101.
719 * F=0 (no poll command; unsolicited frame) */
720 msg
->xid_info
[0] = 0x81; /* XID format identifier */
721 msg
->xid_info
[1] = 1; /* LLC types/classes: Type 1 LLC */
722 msg
->xid_info
[2] = 0; /* XID sender's receive window size (RW) */
724 skb
->dev
= sta
->sdata
->dev
;
725 skb
->protocol
= eth_type_trans(skb
, sta
->sdata
->dev
);
726 memset(skb
->cb
, 0, sizeof(skb
->cb
));
730 static int sta_apply_parameters(struct ieee80211_local
*local
,
731 struct sta_info
*sta
,
732 struct station_parameters
*params
)
737 struct ieee80211_supported_band
*sband
;
738 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
741 sband
= local
->hw
.wiphy
->bands
[local
->oper_channel
->band
];
743 mask
= params
->sta_flags_mask
;
744 set
= params
->sta_flags_set
;
747 * In mesh mode, we can clear AUTHENTICATED flag but must
748 * also make ASSOCIATED follow appropriately for the driver
749 * API. See also below, after AUTHORIZED changes.
751 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
)) {
752 /* cfg80211 should not allow this in non-mesh modes */
753 if (WARN_ON(!ieee80211_vif_is_mesh(&sdata
->vif
)))
756 if (set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
757 !test_sta_flag(sta
, WLAN_STA_AUTH
)) {
758 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTH
);
761 ret
= sta_info_move_state(sta
, IEEE80211_STA_ASSOC
);
767 if (mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
768 if (set
& BIT(NL80211_STA_FLAG_AUTHORIZED
))
769 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTHORIZED
);
770 else if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
771 ret
= sta_info_move_state(sta
, IEEE80211_STA_ASSOC
);
776 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
)) {
777 /* cfg80211 should not allow this in non-mesh modes */
778 if (WARN_ON(!ieee80211_vif_is_mesh(&sdata
->vif
)))
781 if (!(set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
)) &&
782 test_sta_flag(sta
, WLAN_STA_AUTH
)) {
783 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTH
);
786 ret
= sta_info_move_state(sta
, IEEE80211_STA_NONE
);
793 if (mask
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
)) {
794 if (set
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
))
795 set_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
);
797 clear_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
);
800 if (mask
& BIT(NL80211_STA_FLAG_WME
)) {
801 if (set
& BIT(NL80211_STA_FLAG_WME
)) {
802 set_sta_flag(sta
, WLAN_STA_WME
);
805 clear_sta_flag(sta
, WLAN_STA_WME
);
806 sta
->sta
.wme
= false;
810 if (mask
& BIT(NL80211_STA_FLAG_MFP
)) {
811 if (set
& BIT(NL80211_STA_FLAG_MFP
))
812 set_sta_flag(sta
, WLAN_STA_MFP
);
814 clear_sta_flag(sta
, WLAN_STA_MFP
);
817 if (mask
& BIT(NL80211_STA_FLAG_TDLS_PEER
)) {
818 if (set
& BIT(NL80211_STA_FLAG_TDLS_PEER
))
819 set_sta_flag(sta
, WLAN_STA_TDLS_PEER
);
821 clear_sta_flag(sta
, WLAN_STA_TDLS_PEER
);
824 if (params
->sta_modify_mask
& STATION_PARAM_APPLY_UAPSD
) {
825 sta
->sta
.uapsd_queues
= params
->uapsd_queues
;
826 sta
->sta
.max_sp
= params
->max_sp
;
830 * cfg80211 validates this (1-2007) and allows setting the AID
831 * only when creating a new station entry
834 sta
->sta
.aid
= params
->aid
;
837 * FIXME: updating the following information is racy when this
838 * function is called from ieee80211_change_station().
839 * However, all this information should be static so
840 * maybe we should just reject attemps to change it.
843 if (params
->listen_interval
>= 0)
844 sta
->listen_interval
= params
->listen_interval
;
846 if (params
->supported_rates
) {
849 for (i
= 0; i
< params
->supported_rates_len
; i
++) {
850 int rate
= (params
->supported_rates
[i
] & 0x7f) * 5;
851 for (j
= 0; j
< sband
->n_bitrates
; j
++) {
852 if (sband
->bitrates
[j
].bitrate
== rate
)
856 sta
->sta
.supp_rates
[local
->oper_channel
->band
] = rates
;
860 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata
, sband
,
864 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
865 #ifdef CONFIG_MAC80211_MESH
866 if (sdata
->u
.mesh
.security
& IEEE80211_MESH_SEC_SECURED
)
867 switch (params
->plink_state
) {
868 case NL80211_PLINK_LISTEN
:
869 case NL80211_PLINK_ESTAB
:
870 case NL80211_PLINK_BLOCKED
:
871 sta
->plink_state
= params
->plink_state
;
878 switch (params
->plink_action
) {
879 case PLINK_ACTION_OPEN
:
880 mesh_plink_open(sta
);
882 case PLINK_ACTION_BLOCK
:
883 mesh_plink_block(sta
);
892 static int ieee80211_add_station(struct wiphy
*wiphy
, struct net_device
*dev
,
893 u8
*mac
, struct station_parameters
*params
)
895 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
896 struct sta_info
*sta
;
897 struct ieee80211_sub_if_data
*sdata
;
902 sdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
904 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
905 sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
908 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
910 if (compare_ether_addr(mac
, sdata
->vif
.addr
) == 0)
913 if (is_multicast_ether_addr(mac
))
916 sta
= sta_info_alloc(sdata
, mac
, GFP_KERNEL
);
920 sta_info_pre_move_state(sta
, IEEE80211_STA_AUTH
);
921 sta_info_pre_move_state(sta
, IEEE80211_STA_ASSOC
);
923 err
= sta_apply_parameters(local
, sta
, params
);
925 sta_info_free(local
, sta
);
930 * for TDLS, rate control should be initialized only when supported
933 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
))
934 rate_control_rate_init(sta
);
936 layer2_update
= sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
||
937 sdata
->vif
.type
== NL80211_IFTYPE_AP
;
939 err
= sta_info_insert_rcu(sta
);
946 ieee80211_send_layer2_update(sta
);
953 static int ieee80211_del_station(struct wiphy
*wiphy
, struct net_device
*dev
,
956 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
957 struct ieee80211_sub_if_data
*sdata
;
959 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
962 return sta_info_destroy_addr_bss(sdata
, mac
);
964 sta_info_flush(local
, sdata
);
968 static int ieee80211_change_station(struct wiphy
*wiphy
,
969 struct net_device
*dev
,
971 struct station_parameters
*params
)
973 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
974 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
975 struct sta_info
*sta
;
976 struct ieee80211_sub_if_data
*vlansdata
;
979 mutex_lock(&local
->sta_mtx
);
981 sta
= sta_info_get_bss(sdata
, mac
);
983 mutex_unlock(&local
->sta_mtx
);
987 /* in station mode, supported rates are only valid with TDLS */
988 if (sdata
->vif
.type
== NL80211_IFTYPE_STATION
&&
989 params
->supported_rates
&&
990 !test_sta_flag(sta
, WLAN_STA_TDLS_PEER
)) {
991 mutex_unlock(&local
->sta_mtx
);
995 if (params
->vlan
&& params
->vlan
!= sta
->sdata
->dev
) {
996 vlansdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
998 if (vlansdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
999 vlansdata
->vif
.type
!= NL80211_IFTYPE_AP
) {
1000 mutex_unlock(&local
->sta_mtx
);
1004 if (params
->vlan
->ieee80211_ptr
->use_4addr
) {
1005 if (vlansdata
->u
.vlan
.sta
) {
1006 mutex_unlock(&local
->sta_mtx
);
1010 rcu_assign_pointer(vlansdata
->u
.vlan
.sta
, sta
);
1013 sta
->sdata
= vlansdata
;
1014 ieee80211_send_layer2_update(sta
);
1017 err
= sta_apply_parameters(local
, sta
, params
);
1019 mutex_unlock(&local
->sta_mtx
);
1023 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) && params
->supported_rates
)
1024 rate_control_rate_init(sta
);
1026 mutex_unlock(&local
->sta_mtx
);
1028 if (sdata
->vif
.type
== NL80211_IFTYPE_STATION
&&
1029 params
->sta_flags_mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
))
1030 ieee80211_recalc_ps(local
, -1);
1035 #ifdef CONFIG_MAC80211_MESH
1036 static int ieee80211_add_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
1037 u8
*dst
, u8
*next_hop
)
1039 struct ieee80211_sub_if_data
*sdata
;
1040 struct mesh_path
*mpath
;
1041 struct sta_info
*sta
;
1044 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1047 sta
= sta_info_get(sdata
, next_hop
);
1053 err
= mesh_path_add(dst
, sdata
);
1059 mpath
= mesh_path_lookup(dst
, sdata
);
1064 mesh_path_fix_nexthop(mpath
, sta
);
1070 static int ieee80211_del_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
1073 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1076 return mesh_path_del(dst
, sdata
);
1078 mesh_path_flush_by_iface(sdata
);
1082 static int ieee80211_change_mpath(struct wiphy
*wiphy
,
1083 struct net_device
*dev
,
1084 u8
*dst
, u8
*next_hop
)
1086 struct ieee80211_sub_if_data
*sdata
;
1087 struct mesh_path
*mpath
;
1088 struct sta_info
*sta
;
1090 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1094 sta
= sta_info_get(sdata
, next_hop
);
1100 mpath
= mesh_path_lookup(dst
, sdata
);
1106 mesh_path_fix_nexthop(mpath
, sta
);
1112 static void mpath_set_pinfo(struct mesh_path
*mpath
, u8
*next_hop
,
1113 struct mpath_info
*pinfo
)
1115 struct sta_info
*next_hop_sta
= rcu_dereference(mpath
->next_hop
);
1118 memcpy(next_hop
, next_hop_sta
->sta
.addr
, ETH_ALEN
);
1120 memset(next_hop
, 0, ETH_ALEN
);
1122 pinfo
->generation
= mesh_paths_generation
;
1124 pinfo
->filled
= MPATH_INFO_FRAME_QLEN
|
1127 MPATH_INFO_EXPTIME
|
1128 MPATH_INFO_DISCOVERY_TIMEOUT
|
1129 MPATH_INFO_DISCOVERY_RETRIES
|
1132 pinfo
->frame_qlen
= mpath
->frame_queue
.qlen
;
1133 pinfo
->sn
= mpath
->sn
;
1134 pinfo
->metric
= mpath
->metric
;
1135 if (time_before(jiffies
, mpath
->exp_time
))
1136 pinfo
->exptime
= jiffies_to_msecs(mpath
->exp_time
- jiffies
);
1137 pinfo
->discovery_timeout
=
1138 jiffies_to_msecs(mpath
->discovery_timeout
);
1139 pinfo
->discovery_retries
= mpath
->discovery_retries
;
1141 if (mpath
->flags
& MESH_PATH_ACTIVE
)
1142 pinfo
->flags
|= NL80211_MPATH_FLAG_ACTIVE
;
1143 if (mpath
->flags
& MESH_PATH_RESOLVING
)
1144 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
1145 if (mpath
->flags
& MESH_PATH_SN_VALID
)
1146 pinfo
->flags
|= NL80211_MPATH_FLAG_SN_VALID
;
1147 if (mpath
->flags
& MESH_PATH_FIXED
)
1148 pinfo
->flags
|= NL80211_MPATH_FLAG_FIXED
;
1149 if (mpath
->flags
& MESH_PATH_RESOLVING
)
1150 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
1152 pinfo
->flags
= mpath
->flags
;
1155 static int ieee80211_get_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
1156 u8
*dst
, u8
*next_hop
, struct mpath_info
*pinfo
)
1159 struct ieee80211_sub_if_data
*sdata
;
1160 struct mesh_path
*mpath
;
1162 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1165 mpath
= mesh_path_lookup(dst
, sdata
);
1170 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
1171 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
1176 static int ieee80211_dump_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
1177 int idx
, u8
*dst
, u8
*next_hop
,
1178 struct mpath_info
*pinfo
)
1180 struct ieee80211_sub_if_data
*sdata
;
1181 struct mesh_path
*mpath
;
1183 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1186 mpath
= mesh_path_lookup_by_idx(idx
, sdata
);
1191 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
1192 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
1197 static int ieee80211_get_mesh_config(struct wiphy
*wiphy
,
1198 struct net_device
*dev
,
1199 struct mesh_config
*conf
)
1201 struct ieee80211_sub_if_data
*sdata
;
1202 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1204 memcpy(conf
, &(sdata
->u
.mesh
.mshcfg
), sizeof(struct mesh_config
));
1208 static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm
, u32 mask
)
1210 return (mask
>> (parm
-1)) & 0x1;
1213 static int copy_mesh_setup(struct ieee80211_if_mesh
*ifmsh
,
1214 const struct mesh_setup
*setup
)
1218 struct ieee80211_sub_if_data
*sdata
= container_of(ifmsh
,
1219 struct ieee80211_sub_if_data
, u
.mesh
);
1221 /* allocate information elements */
1225 if (setup
->ie_len
) {
1226 new_ie
= kmemdup(setup
->ie
, setup
->ie_len
,
1231 ifmsh
->ie_len
= setup
->ie_len
;
1235 /* now copy the rest of the setup parameters */
1236 ifmsh
->mesh_id_len
= setup
->mesh_id_len
;
1237 memcpy(ifmsh
->mesh_id
, setup
->mesh_id
, ifmsh
->mesh_id_len
);
1238 ifmsh
->mesh_pp_id
= setup
->path_sel_proto
;
1239 ifmsh
->mesh_pm_id
= setup
->path_metric
;
1240 ifmsh
->security
= IEEE80211_MESH_SEC_NONE
;
1241 if (setup
->is_authenticated
)
1242 ifmsh
->security
|= IEEE80211_MESH_SEC_AUTHED
;
1243 if (setup
->is_secure
)
1244 ifmsh
->security
|= IEEE80211_MESH_SEC_SECURED
;
1246 /* mcast rate setting in Mesh Node */
1247 memcpy(sdata
->vif
.bss_conf
.mcast_rate
, setup
->mcast_rate
,
1248 sizeof(setup
->mcast_rate
));
1253 static int ieee80211_update_mesh_config(struct wiphy
*wiphy
,
1254 struct net_device
*dev
, u32 mask
,
1255 const struct mesh_config
*nconf
)
1257 struct mesh_config
*conf
;
1258 struct ieee80211_sub_if_data
*sdata
;
1259 struct ieee80211_if_mesh
*ifmsh
;
1261 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1262 ifmsh
= &sdata
->u
.mesh
;
1264 /* Set the config options which we are interested in setting */
1265 conf
= &(sdata
->u
.mesh
.mshcfg
);
1266 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT
, mask
))
1267 conf
->dot11MeshRetryTimeout
= nconf
->dot11MeshRetryTimeout
;
1268 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT
, mask
))
1269 conf
->dot11MeshConfirmTimeout
= nconf
->dot11MeshConfirmTimeout
;
1270 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT
, mask
))
1271 conf
->dot11MeshHoldingTimeout
= nconf
->dot11MeshHoldingTimeout
;
1272 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS
, mask
))
1273 conf
->dot11MeshMaxPeerLinks
= nconf
->dot11MeshMaxPeerLinks
;
1274 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES
, mask
))
1275 conf
->dot11MeshMaxRetries
= nconf
->dot11MeshMaxRetries
;
1276 if (_chg_mesh_attr(NL80211_MESHCONF_TTL
, mask
))
1277 conf
->dot11MeshTTL
= nconf
->dot11MeshTTL
;
1278 if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL
, mask
))
1279 conf
->dot11MeshTTL
= nconf
->element_ttl
;
1280 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS
, mask
))
1281 conf
->auto_open_plinks
= nconf
->auto_open_plinks
;
1282 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES
, mask
))
1283 conf
->dot11MeshHWMPmaxPREQretries
=
1284 nconf
->dot11MeshHWMPmaxPREQretries
;
1285 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME
, mask
))
1286 conf
->path_refresh_time
= nconf
->path_refresh_time
;
1287 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT
, mask
))
1288 conf
->min_discovery_timeout
= nconf
->min_discovery_timeout
;
1289 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT
, mask
))
1290 conf
->dot11MeshHWMPactivePathTimeout
=
1291 nconf
->dot11MeshHWMPactivePathTimeout
;
1292 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL
, mask
))
1293 conf
->dot11MeshHWMPpreqMinInterval
=
1294 nconf
->dot11MeshHWMPpreqMinInterval
;
1295 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL
, mask
))
1296 conf
->dot11MeshHWMPperrMinInterval
=
1297 nconf
->dot11MeshHWMPperrMinInterval
;
1298 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME
,
1300 conf
->dot11MeshHWMPnetDiameterTraversalTime
=
1301 nconf
->dot11MeshHWMPnetDiameterTraversalTime
;
1302 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOTMODE
, mask
)) {
1303 conf
->dot11MeshHWMPRootMode
= nconf
->dot11MeshHWMPRootMode
;
1304 ieee80211_mesh_root_setup(ifmsh
);
1306 if (_chg_mesh_attr(NL80211_MESHCONF_GATE_ANNOUNCEMENTS
, mask
)) {
1307 /* our current gate announcement implementation rides on root
1308 * announcements, so require this ifmsh to also be a root node
1310 if (nconf
->dot11MeshGateAnnouncementProtocol
&&
1311 !conf
->dot11MeshHWMPRootMode
) {
1312 conf
->dot11MeshHWMPRootMode
= 1;
1313 ieee80211_mesh_root_setup(ifmsh
);
1315 conf
->dot11MeshGateAnnouncementProtocol
=
1316 nconf
->dot11MeshGateAnnouncementProtocol
;
1318 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL
, mask
)) {
1319 conf
->dot11MeshHWMPRannInterval
=
1320 nconf
->dot11MeshHWMPRannInterval
;
1322 if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING
, mask
))
1323 conf
->dot11MeshForwarding
= nconf
->dot11MeshForwarding
;
1324 if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD
, mask
)) {
1325 /* our RSSI threshold implementation is supported only for
1326 * devices that report signal in dBm.
1328 if (!(sdata
->local
->hw
.flags
& IEEE80211_HW_SIGNAL_DBM
))
1330 conf
->rssi_threshold
= nconf
->rssi_threshold
;
1335 static int ieee80211_join_mesh(struct wiphy
*wiphy
, struct net_device
*dev
,
1336 const struct mesh_config
*conf
,
1337 const struct mesh_setup
*setup
)
1339 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1340 struct ieee80211_if_mesh
*ifmsh
= &sdata
->u
.mesh
;
1343 memcpy(&ifmsh
->mshcfg
, conf
, sizeof(struct mesh_config
));
1344 err
= copy_mesh_setup(ifmsh
, setup
);
1347 ieee80211_start_mesh(sdata
);
1352 static int ieee80211_leave_mesh(struct wiphy
*wiphy
, struct net_device
*dev
)
1354 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1356 ieee80211_stop_mesh(sdata
);
1362 static int ieee80211_change_bss(struct wiphy
*wiphy
,
1363 struct net_device
*dev
,
1364 struct bss_parameters
*params
)
1366 struct ieee80211_sub_if_data
*sdata
;
1369 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1371 if (params
->use_cts_prot
>= 0) {
1372 sdata
->vif
.bss_conf
.use_cts_prot
= params
->use_cts_prot
;
1373 changed
|= BSS_CHANGED_ERP_CTS_PROT
;
1375 if (params
->use_short_preamble
>= 0) {
1376 sdata
->vif
.bss_conf
.use_short_preamble
=
1377 params
->use_short_preamble
;
1378 changed
|= BSS_CHANGED_ERP_PREAMBLE
;
1381 if (!sdata
->vif
.bss_conf
.use_short_slot
&&
1382 sdata
->local
->hw
.conf
.channel
->band
== IEEE80211_BAND_5GHZ
) {
1383 sdata
->vif
.bss_conf
.use_short_slot
= true;
1384 changed
|= BSS_CHANGED_ERP_SLOT
;
1387 if (params
->use_short_slot_time
>= 0) {
1388 sdata
->vif
.bss_conf
.use_short_slot
=
1389 params
->use_short_slot_time
;
1390 changed
|= BSS_CHANGED_ERP_SLOT
;
1393 if (params
->basic_rates
) {
1396 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1397 struct ieee80211_supported_band
*sband
=
1398 wiphy
->bands
[local
->oper_channel
->band
];
1400 for (i
= 0; i
< params
->basic_rates_len
; i
++) {
1401 int rate
= (params
->basic_rates
[i
] & 0x7f) * 5;
1402 for (j
= 0; j
< sband
->n_bitrates
; j
++) {
1403 if (sband
->bitrates
[j
].bitrate
== rate
)
1407 sdata
->vif
.bss_conf
.basic_rates
= rates
;
1408 changed
|= BSS_CHANGED_BASIC_RATES
;
1411 if (params
->ap_isolate
>= 0) {
1412 if (params
->ap_isolate
)
1413 sdata
->flags
|= IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
1415 sdata
->flags
&= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
1418 if (params
->ht_opmode
>= 0) {
1419 sdata
->vif
.bss_conf
.ht_operation_mode
=
1420 (u16
) params
->ht_opmode
;
1421 changed
|= BSS_CHANGED_HT
;
1424 ieee80211_bss_info_change_notify(sdata
, changed
);
1429 static int ieee80211_set_txq_params(struct wiphy
*wiphy
,
1430 struct net_device
*dev
,
1431 struct ieee80211_txq_params
*params
)
1433 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1434 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1435 struct ieee80211_tx_queue_params p
;
1437 if (!local
->ops
->conf_tx
)
1440 memset(&p
, 0, sizeof(p
));
1441 p
.aifs
= params
->aifs
;
1442 p
.cw_max
= params
->cwmax
;
1443 p
.cw_min
= params
->cwmin
;
1444 p
.txop
= params
->txop
;
1447 * Setting tx queue params disables u-apsd because it's only
1448 * called in master mode.
1452 if (params
->queue
>= local
->hw
.queues
)
1455 sdata
->tx_conf
[params
->queue
] = p
;
1456 if (drv_conf_tx(local
, sdata
, params
->queue
, &p
)) {
1457 wiphy_debug(local
->hw
.wiphy
,
1458 "failed to set TX queue parameters for queue %d\n",
1466 static int ieee80211_set_channel(struct wiphy
*wiphy
,
1467 struct net_device
*netdev
,
1468 struct ieee80211_channel
*chan
,
1469 enum nl80211_channel_type channel_type
)
1471 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1472 struct ieee80211_sub_if_data
*sdata
= NULL
;
1473 struct ieee80211_channel
*old_oper
;
1474 enum nl80211_channel_type old_oper_type
;
1475 enum nl80211_channel_type old_vif_oper_type
= NL80211_CHAN_NO_HT
;
1478 sdata
= IEEE80211_DEV_TO_SUB_IF(netdev
);
1480 switch (ieee80211_get_channel_mode(local
, NULL
)) {
1481 case CHAN_MODE_HOPPING
:
1483 case CHAN_MODE_FIXED
:
1484 if (local
->oper_channel
!= chan
)
1486 if (!sdata
&& local
->_oper_channel_type
== channel_type
)
1489 case CHAN_MODE_UNDEFINED
:
1494 old_vif_oper_type
= sdata
->vif
.bss_conf
.channel_type
;
1495 old_oper_type
= local
->_oper_channel_type
;
1497 if (!ieee80211_set_channel_type(local
, sdata
, channel_type
))
1500 old_oper
= local
->oper_channel
;
1501 local
->oper_channel
= chan
;
1503 /* Update driver if changes were actually made. */
1504 if ((old_oper
!= local
->oper_channel
) ||
1505 (old_oper_type
!= local
->_oper_channel_type
))
1506 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_CHANNEL
);
1508 if (sdata
&& sdata
->vif
.type
!= NL80211_IFTYPE_MONITOR
&&
1509 old_vif_oper_type
!= sdata
->vif
.bss_conf
.channel_type
)
1510 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_HT
);
1516 static int ieee80211_suspend(struct wiphy
*wiphy
,
1517 struct cfg80211_wowlan
*wowlan
)
1519 return __ieee80211_suspend(wiphy_priv(wiphy
), wowlan
);
1522 static int ieee80211_resume(struct wiphy
*wiphy
)
1524 return __ieee80211_resume(wiphy_priv(wiphy
));
1527 #define ieee80211_suspend NULL
1528 #define ieee80211_resume NULL
1531 static int ieee80211_scan(struct wiphy
*wiphy
,
1532 struct net_device
*dev
,
1533 struct cfg80211_scan_request
*req
)
1535 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1537 switch (ieee80211_vif_type_p2p(&sdata
->vif
)) {
1538 case NL80211_IFTYPE_STATION
:
1539 case NL80211_IFTYPE_ADHOC
:
1540 case NL80211_IFTYPE_MESH_POINT
:
1541 case NL80211_IFTYPE_P2P_CLIENT
:
1543 case NL80211_IFTYPE_P2P_GO
:
1544 if (sdata
->local
->ops
->hw_scan
)
1547 * FIXME: implement NoA while scanning in software,
1548 * for now fall through to allow scanning only when
1549 * beaconing hasn't been configured yet
1551 case NL80211_IFTYPE_AP
:
1552 if (sdata
->u
.ap
.beacon
)
1559 return ieee80211_request_scan(sdata
, req
);
1563 ieee80211_sched_scan_start(struct wiphy
*wiphy
,
1564 struct net_device
*dev
,
1565 struct cfg80211_sched_scan_request
*req
)
1567 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1569 if (!sdata
->local
->ops
->sched_scan_start
)
1572 return ieee80211_request_sched_scan_start(sdata
, req
);
1576 ieee80211_sched_scan_stop(struct wiphy
*wiphy
, struct net_device
*dev
)
1578 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1580 if (!sdata
->local
->ops
->sched_scan_stop
)
1583 return ieee80211_request_sched_scan_stop(sdata
);
1586 static int ieee80211_auth(struct wiphy
*wiphy
, struct net_device
*dev
,
1587 struct cfg80211_auth_request
*req
)
1589 return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
1592 static int ieee80211_assoc(struct wiphy
*wiphy
, struct net_device
*dev
,
1593 struct cfg80211_assoc_request
*req
)
1595 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1596 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1598 switch (ieee80211_get_channel_mode(local
, sdata
)) {
1599 case CHAN_MODE_HOPPING
:
1601 case CHAN_MODE_FIXED
:
1602 if (local
->oper_channel
== req
->bss
->channel
)
1605 case CHAN_MODE_UNDEFINED
:
1609 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
1612 static int ieee80211_deauth(struct wiphy
*wiphy
, struct net_device
*dev
,
1613 struct cfg80211_deauth_request
*req
)
1615 return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
1618 static int ieee80211_disassoc(struct wiphy
*wiphy
, struct net_device
*dev
,
1619 struct cfg80211_disassoc_request
*req
)
1621 return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
1624 static int ieee80211_join_ibss(struct wiphy
*wiphy
, struct net_device
*dev
,
1625 struct cfg80211_ibss_params
*params
)
1627 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1628 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1630 switch (ieee80211_get_channel_mode(local
, sdata
)) {
1631 case CHAN_MODE_HOPPING
:
1633 case CHAN_MODE_FIXED
:
1634 if (!params
->channel_fixed
)
1636 if (local
->oper_channel
== params
->channel
)
1639 case CHAN_MODE_UNDEFINED
:
1643 return ieee80211_ibss_join(sdata
, params
);
1646 static int ieee80211_leave_ibss(struct wiphy
*wiphy
, struct net_device
*dev
)
1648 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1650 return ieee80211_ibss_leave(sdata
);
1653 static int ieee80211_set_wiphy_params(struct wiphy
*wiphy
, u32 changed
)
1655 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1658 if (changed
& WIPHY_PARAM_FRAG_THRESHOLD
) {
1659 err
= drv_set_frag_threshold(local
, wiphy
->frag_threshold
);
1665 if (changed
& WIPHY_PARAM_COVERAGE_CLASS
) {
1666 err
= drv_set_coverage_class(local
, wiphy
->coverage_class
);
1672 if (changed
& WIPHY_PARAM_RTS_THRESHOLD
) {
1673 err
= drv_set_rts_threshold(local
, wiphy
->rts_threshold
);
1679 if (changed
& WIPHY_PARAM_RETRY_SHORT
)
1680 local
->hw
.conf
.short_frame_max_tx_count
= wiphy
->retry_short
;
1681 if (changed
& WIPHY_PARAM_RETRY_LONG
)
1682 local
->hw
.conf
.long_frame_max_tx_count
= wiphy
->retry_long
;
1684 (WIPHY_PARAM_RETRY_SHORT
| WIPHY_PARAM_RETRY_LONG
))
1685 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_RETRY_LIMITS
);
1690 static int ieee80211_set_tx_power(struct wiphy
*wiphy
,
1691 enum nl80211_tx_power_setting type
, int mbm
)
1693 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1694 struct ieee80211_channel
*chan
= local
->hw
.conf
.channel
;
1698 case NL80211_TX_POWER_AUTOMATIC
:
1699 local
->user_power_level
= -1;
1701 case NL80211_TX_POWER_LIMITED
:
1702 if (mbm
< 0 || (mbm
% 100))
1704 local
->user_power_level
= MBM_TO_DBM(mbm
);
1706 case NL80211_TX_POWER_FIXED
:
1707 if (mbm
< 0 || (mbm
% 100))
1709 /* TODO: move to cfg80211 when it knows the channel */
1710 if (MBM_TO_DBM(mbm
) > chan
->max_power
)
1712 local
->user_power_level
= MBM_TO_DBM(mbm
);
1716 ieee80211_hw_config(local
, changes
);
1721 static int ieee80211_get_tx_power(struct wiphy
*wiphy
, int *dbm
)
1723 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1725 *dbm
= local
->hw
.conf
.power_level
;
1730 static int ieee80211_set_wds_peer(struct wiphy
*wiphy
, struct net_device
*dev
,
1733 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1735 memcpy(&sdata
->u
.wds
.remote_addr
, addr
, ETH_ALEN
);
1740 static void ieee80211_rfkill_poll(struct wiphy
*wiphy
)
1742 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1744 drv_rfkill_poll(local
);
1747 #ifdef CONFIG_NL80211_TESTMODE
1748 static int ieee80211_testmode_cmd(struct wiphy
*wiphy
, void *data
, int len
)
1750 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1752 if (!local
->ops
->testmode_cmd
)
1755 return local
->ops
->testmode_cmd(&local
->hw
, data
, len
);
1758 static int ieee80211_testmode_dump(struct wiphy
*wiphy
,
1759 struct sk_buff
*skb
,
1760 struct netlink_callback
*cb
,
1761 void *data
, int len
)
1763 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1765 if (!local
->ops
->testmode_dump
)
1768 return local
->ops
->testmode_dump(&local
->hw
, skb
, cb
, data
, len
);
1772 int __ieee80211_request_smps(struct ieee80211_sub_if_data
*sdata
,
1773 enum ieee80211_smps_mode smps_mode
)
1776 enum ieee80211_smps_mode old_req
;
1779 lockdep_assert_held(&sdata
->u
.mgd
.mtx
);
1781 old_req
= sdata
->u
.mgd
.req_smps
;
1782 sdata
->u
.mgd
.req_smps
= smps_mode
;
1784 if (old_req
== smps_mode
&&
1785 smps_mode
!= IEEE80211_SMPS_AUTOMATIC
)
1789 * If not associated, or current association is not an HT
1790 * association, there's no need to send an action frame.
1792 if (!sdata
->u
.mgd
.associated
||
1793 sdata
->vif
.bss_conf
.channel_type
== NL80211_CHAN_NO_HT
) {
1794 mutex_lock(&sdata
->local
->iflist_mtx
);
1795 ieee80211_recalc_smps(sdata
->local
);
1796 mutex_unlock(&sdata
->local
->iflist_mtx
);
1800 ap
= sdata
->u
.mgd
.associated
->bssid
;
1802 if (smps_mode
== IEEE80211_SMPS_AUTOMATIC
) {
1803 if (sdata
->u
.mgd
.powersave
)
1804 smps_mode
= IEEE80211_SMPS_DYNAMIC
;
1806 smps_mode
= IEEE80211_SMPS_OFF
;
1809 /* send SM PS frame to AP */
1810 err
= ieee80211_send_smps_action(sdata
, smps_mode
,
1813 sdata
->u
.mgd
.req_smps
= old_req
;
1818 static int ieee80211_set_power_mgmt(struct wiphy
*wiphy
, struct net_device
*dev
,
1819 bool enabled
, int timeout
)
1821 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1822 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
1824 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
1827 if (!(local
->hw
.flags
& IEEE80211_HW_SUPPORTS_PS
))
1830 if (enabled
== sdata
->u
.mgd
.powersave
&&
1831 timeout
== local
->dynamic_ps_forced_timeout
)
1834 sdata
->u
.mgd
.powersave
= enabled
;
1835 local
->dynamic_ps_forced_timeout
= timeout
;
1837 /* no change, but if automatic follow powersave */
1838 mutex_lock(&sdata
->u
.mgd
.mtx
);
1839 __ieee80211_request_smps(sdata
, sdata
->u
.mgd
.req_smps
);
1840 mutex_unlock(&sdata
->u
.mgd
.mtx
);
1842 if (local
->hw
.flags
& IEEE80211_HW_SUPPORTS_DYNAMIC_PS
)
1843 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_PS
);
1845 ieee80211_recalc_ps(local
, -1);
1850 static int ieee80211_set_cqm_rssi_config(struct wiphy
*wiphy
,
1851 struct net_device
*dev
,
1852 s32 rssi_thold
, u32 rssi_hyst
)
1854 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1855 struct ieee80211_vif
*vif
= &sdata
->vif
;
1856 struct ieee80211_bss_conf
*bss_conf
= &vif
->bss_conf
;
1858 if (rssi_thold
== bss_conf
->cqm_rssi_thold
&&
1859 rssi_hyst
== bss_conf
->cqm_rssi_hyst
)
1862 bss_conf
->cqm_rssi_thold
= rssi_thold
;
1863 bss_conf
->cqm_rssi_hyst
= rssi_hyst
;
1865 /* tell the driver upon association, unless already associated */
1866 if (sdata
->u
.mgd
.associated
&&
1867 sdata
->vif
.driver_flags
& IEEE80211_VIF_SUPPORTS_CQM_RSSI
)
1868 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_CQM
);
1873 static int ieee80211_set_bitrate_mask(struct wiphy
*wiphy
,
1874 struct net_device
*dev
,
1876 const struct cfg80211_bitrate_mask
*mask
)
1878 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1879 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
1882 if (local
->hw
.flags
& IEEE80211_HW_HAS_RATE_CONTROL
) {
1883 ret
= drv_set_bitrate_mask(local
, sdata
, mask
);
1888 for (i
= 0; i
< IEEE80211_NUM_BANDS
; i
++) {
1889 sdata
->rc_rateidx_mask
[i
] = mask
->control
[i
].legacy
;
1890 memcpy(sdata
->rc_rateidx_mcs_mask
[i
], mask
->control
[i
].mcs
,
1891 sizeof(mask
->control
[i
].mcs
));
1897 static int ieee80211_remain_on_channel_hw(struct ieee80211_local
*local
,
1898 struct net_device
*dev
,
1899 struct ieee80211_channel
*chan
,
1900 enum nl80211_channel_type chantype
,
1901 unsigned int duration
, u64
*cookie
)
1906 lockdep_assert_held(&local
->mtx
);
1908 if (local
->hw_roc_cookie
)
1910 /* must be nonzero */
1911 random_cookie
= random32() | 1;
1913 *cookie
= random_cookie
;
1914 local
->hw_roc_dev
= dev
;
1915 local
->hw_roc_cookie
= random_cookie
;
1916 local
->hw_roc_channel
= chan
;
1917 local
->hw_roc_channel_type
= chantype
;
1918 local
->hw_roc_duration
= duration
;
1919 ret
= drv_remain_on_channel(local
, chan
, chantype
, duration
);
1921 local
->hw_roc_channel
= NULL
;
1922 local
->hw_roc_cookie
= 0;
1928 static int ieee80211_remain_on_channel(struct wiphy
*wiphy
,
1929 struct net_device
*dev
,
1930 struct ieee80211_channel
*chan
,
1931 enum nl80211_channel_type channel_type
,
1932 unsigned int duration
,
1935 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1936 struct ieee80211_local
*local
= sdata
->local
;
1938 if (local
->ops
->remain_on_channel
) {
1941 mutex_lock(&local
->mtx
);
1942 ret
= ieee80211_remain_on_channel_hw(local
, dev
,
1945 local
->hw_roc_for_tx
= false;
1946 mutex_unlock(&local
->mtx
);
1951 return ieee80211_wk_remain_on_channel(sdata
, chan
, channel_type
,
1955 static int ieee80211_cancel_remain_on_channel_hw(struct ieee80211_local
*local
,
1960 lockdep_assert_held(&local
->mtx
);
1962 if (local
->hw_roc_cookie
!= cookie
)
1965 ret
= drv_cancel_remain_on_channel(local
);
1969 local
->hw_roc_cookie
= 0;
1970 local
->hw_roc_channel
= NULL
;
1972 ieee80211_recalc_idle(local
);
1977 static int ieee80211_cancel_remain_on_channel(struct wiphy
*wiphy
,
1978 struct net_device
*dev
,
1981 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1982 struct ieee80211_local
*local
= sdata
->local
;
1984 if (local
->ops
->cancel_remain_on_channel
) {
1987 mutex_lock(&local
->mtx
);
1988 ret
= ieee80211_cancel_remain_on_channel_hw(local
, cookie
);
1989 mutex_unlock(&local
->mtx
);
1994 return ieee80211_wk_cancel_remain_on_channel(sdata
, cookie
);
1997 static enum work_done_result
1998 ieee80211_offchan_tx_done(struct ieee80211_work
*wk
, struct sk_buff
*skb
)
2001 * Use the data embedded in the work struct for reporting
2002 * here so if the driver mangled the SKB before dropping
2003 * it (which is the only way we really should get here)
2004 * then we don't report mangled data.
2006 * If there was no wait time, then by the time we get here
2007 * the driver will likely not have reported the status yet,
2008 * so in that case userspace will have to deal with it.
2011 if (wk
->offchan_tx
.wait
&& !wk
->offchan_tx
.status
)
2012 cfg80211_mgmt_tx_status(wk
->sdata
->dev
,
2013 (unsigned long) wk
->offchan_tx
.frame
,
2014 wk
->data
, wk
->data_len
, false, GFP_KERNEL
);
2016 return WORK_DONE_DESTROY
;
2019 static int ieee80211_mgmt_tx(struct wiphy
*wiphy
, struct net_device
*dev
,
2020 struct ieee80211_channel
*chan
, bool offchan
,
2021 enum nl80211_channel_type channel_type
,
2022 bool channel_type_valid
, unsigned int wait
,
2023 const u8
*buf
, size_t len
, bool no_cck
,
2024 bool dont_wait_for_ack
, u64
*cookie
)
2026 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2027 struct ieee80211_local
*local
= sdata
->local
;
2028 struct sk_buff
*skb
;
2029 struct sta_info
*sta
;
2030 struct ieee80211_work
*wk
;
2031 const struct ieee80211_mgmt
*mgmt
= (void *)buf
;
2033 bool is_offchan
= false;
2035 if (dont_wait_for_ack
)
2036 flags
= IEEE80211_TX_CTL_NO_ACK
;
2038 flags
= IEEE80211_TX_INTFL_NL80211_FRAME_TX
|
2039 IEEE80211_TX_CTL_REQ_TX_STATUS
;
2041 /* Check that we are on the requested channel for transmission */
2042 if (chan
!= local
->tmp_channel
&&
2043 chan
!= local
->oper_channel
)
2045 if (channel_type_valid
&&
2046 (channel_type
!= local
->tmp_channel_type
&&
2047 channel_type
!= local
->_oper_channel_type
))
2050 if (chan
== local
->hw_roc_channel
) {
2051 /* TODO: check channel type? */
2053 flags
|= IEEE80211_TX_CTL_TX_OFFCHAN
;
2057 flags
|= IEEE80211_TX_CTL_NO_CCK_RATE
;
2059 if (is_offchan
&& !offchan
)
2062 switch (sdata
->vif
.type
) {
2063 case NL80211_IFTYPE_ADHOC
:
2064 case NL80211_IFTYPE_AP
:
2065 case NL80211_IFTYPE_AP_VLAN
:
2066 case NL80211_IFTYPE_P2P_GO
:
2067 case NL80211_IFTYPE_MESH_POINT
:
2068 if (!ieee80211_is_action(mgmt
->frame_control
) ||
2069 mgmt
->u
.action
.category
== WLAN_CATEGORY_PUBLIC
)
2072 sta
= sta_info_get(sdata
, mgmt
->da
);
2077 case NL80211_IFTYPE_STATION
:
2078 case NL80211_IFTYPE_P2P_CLIENT
:
2084 skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+ len
);
2087 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
2089 memcpy(skb_put(skb
, len
), buf
, len
);
2091 IEEE80211_SKB_CB(skb
)->flags
= flags
;
2093 skb
->dev
= sdata
->dev
;
2095 *cookie
= (unsigned long) skb
;
2097 if (is_offchan
&& local
->ops
->remain_on_channel
) {
2098 unsigned int duration
;
2101 mutex_lock(&local
->mtx
);
2103 * If the duration is zero, then the driver
2104 * wouldn't actually do anything. Set it to
2107 * TODO: cancel the off-channel operation
2108 * when we get the SKB's TX status and
2109 * the wait time was zero before.
2114 ret
= ieee80211_remain_on_channel_hw(local
, dev
, chan
,
2119 mutex_unlock(&local
->mtx
);
2123 local
->hw_roc_for_tx
= true;
2124 local
->hw_roc_duration
= wait
;
2127 * queue up frame for transmission after
2128 * ieee80211_ready_on_channel call
2131 /* modify cookie to prevent API mismatches */
2133 IEEE80211_SKB_CB(skb
)->flags
|= IEEE80211_TX_CTL_TX_OFFCHAN
;
2134 local
->hw_roc_skb
= skb
;
2135 local
->hw_roc_skb_for_status
= skb
;
2136 mutex_unlock(&local
->mtx
);
2142 * Can transmit right away if the channel was the
2143 * right one and there's no wait involved... If a
2144 * wait is involved, we might otherwise not be on
2145 * the right channel for long enough!
2147 if (!is_offchan
&& !wait
&& !sdata
->vif
.bss_conf
.idle
) {
2148 ieee80211_tx_skb(sdata
, skb
);
2152 wk
= kzalloc(sizeof(*wk
) + len
, GFP_KERNEL
);
2158 wk
->type
= IEEE80211_WORK_OFFCHANNEL_TX
;
2160 wk
->chan_type
= channel_type
;
2162 wk
->done
= ieee80211_offchan_tx_done
;
2163 wk
->offchan_tx
.frame
= skb
;
2164 wk
->offchan_tx
.wait
= wait
;
2166 memcpy(wk
->data
, buf
, len
);
2168 ieee80211_add_work(wk
);
2172 static int ieee80211_mgmt_tx_cancel_wait(struct wiphy
*wiphy
,
2173 struct net_device
*dev
,
2176 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2177 struct ieee80211_local
*local
= sdata
->local
;
2178 struct ieee80211_work
*wk
;
2181 mutex_lock(&local
->mtx
);
2183 if (local
->ops
->cancel_remain_on_channel
) {
2185 ret
= ieee80211_cancel_remain_on_channel_hw(local
, cookie
);
2188 kfree_skb(local
->hw_roc_skb
);
2189 local
->hw_roc_skb
= NULL
;
2190 local
->hw_roc_skb_for_status
= NULL
;
2193 mutex_unlock(&local
->mtx
);
2198 list_for_each_entry(wk
, &local
->work_list
, list
) {
2199 if (wk
->sdata
!= sdata
)
2202 if (wk
->type
!= IEEE80211_WORK_OFFCHANNEL_TX
)
2205 if (cookie
!= (unsigned long) wk
->offchan_tx
.frame
)
2208 wk
->timeout
= jiffies
;
2210 ieee80211_queue_work(&local
->hw
, &local
->work_work
);
2214 mutex_unlock(&local
->mtx
);
2219 static void ieee80211_mgmt_frame_register(struct wiphy
*wiphy
,
2220 struct net_device
*dev
,
2221 u16 frame_type
, bool reg
)
2223 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2225 if (frame_type
!= (IEEE80211_FTYPE_MGMT
| IEEE80211_STYPE_PROBE_REQ
))
2229 local
->probe_req_reg
++;
2231 local
->probe_req_reg
--;
2233 ieee80211_queue_work(&local
->hw
, &local
->reconfig_filter
);
2236 static int ieee80211_set_antenna(struct wiphy
*wiphy
, u32 tx_ant
, u32 rx_ant
)
2238 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2243 return drv_set_antenna(local
, tx_ant
, rx_ant
);
2246 static int ieee80211_get_antenna(struct wiphy
*wiphy
, u32
*tx_ant
, u32
*rx_ant
)
2248 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2250 return drv_get_antenna(local
, tx_ant
, rx_ant
);
2253 static int ieee80211_set_ringparam(struct wiphy
*wiphy
, u32 tx
, u32 rx
)
2255 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2257 return drv_set_ringparam(local
, tx
, rx
);
2260 static void ieee80211_get_ringparam(struct wiphy
*wiphy
,
2261 u32
*tx
, u32
*tx_max
, u32
*rx
, u32
*rx_max
)
2263 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2265 drv_get_ringparam(local
, tx
, tx_max
, rx
, rx_max
);
2268 static int ieee80211_set_rekey_data(struct wiphy
*wiphy
,
2269 struct net_device
*dev
,
2270 struct cfg80211_gtk_rekey_data
*data
)
2272 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2273 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2275 if (!local
->ops
->set_rekey_data
)
2278 drv_set_rekey_data(local
, sdata
, data
);
2283 static void ieee80211_tdls_add_ext_capab(struct sk_buff
*skb
)
2285 u8
*pos
= (void *)skb_put(skb
, 7);
2287 *pos
++ = WLAN_EID_EXT_CAPABILITY
;
2288 *pos
++ = 5; /* len */
2293 *pos
++ = WLAN_EXT_CAPA5_TDLS_ENABLED
;
2296 static u16
ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data
*sdata
)
2298 struct ieee80211_local
*local
= sdata
->local
;
2302 if (local
->oper_channel
->band
!= IEEE80211_BAND_2GHZ
)
2305 if (!(local
->hw
.flags
& IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE
))
2306 capab
|= WLAN_CAPABILITY_SHORT_SLOT_TIME
;
2307 if (!(local
->hw
.flags
& IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE
))
2308 capab
|= WLAN_CAPABILITY_SHORT_PREAMBLE
;
2313 static void ieee80211_tdls_add_link_ie(struct sk_buff
*skb
, u8
*src_addr
,
2314 u8
*peer
, u8
*bssid
)
2316 struct ieee80211_tdls_lnkie
*lnkid
;
2318 lnkid
= (void *)skb_put(skb
, sizeof(struct ieee80211_tdls_lnkie
));
2320 lnkid
->ie_type
= WLAN_EID_LINK_ID
;
2321 lnkid
->ie_len
= sizeof(struct ieee80211_tdls_lnkie
) - 2;
2323 memcpy(lnkid
->bssid
, bssid
, ETH_ALEN
);
2324 memcpy(lnkid
->init_sta
, src_addr
, ETH_ALEN
);
2325 memcpy(lnkid
->resp_sta
, peer
, ETH_ALEN
);
2329 ieee80211_prep_tdls_encap_data(struct wiphy
*wiphy
, struct net_device
*dev
,
2330 u8
*peer
, u8 action_code
, u8 dialog_token
,
2331 u16 status_code
, struct sk_buff
*skb
)
2333 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2334 struct ieee80211_tdls_data
*tf
;
2336 tf
= (void *)skb_put(skb
, offsetof(struct ieee80211_tdls_data
, u
));
2338 memcpy(tf
->da
, peer
, ETH_ALEN
);
2339 memcpy(tf
->sa
, sdata
->vif
.addr
, ETH_ALEN
);
2340 tf
->ether_type
= cpu_to_be16(ETH_P_TDLS
);
2341 tf
->payload_type
= WLAN_TDLS_SNAP_RFTYPE
;
2343 switch (action_code
) {
2344 case WLAN_TDLS_SETUP_REQUEST
:
2345 tf
->category
= WLAN_CATEGORY_TDLS
;
2346 tf
->action_code
= WLAN_TDLS_SETUP_REQUEST
;
2348 skb_put(skb
, sizeof(tf
->u
.setup_req
));
2349 tf
->u
.setup_req
.dialog_token
= dialog_token
;
2350 tf
->u
.setup_req
.capability
=
2351 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata
));
2353 ieee80211_add_srates_ie(&sdata
->vif
, skb
);
2354 ieee80211_add_ext_srates_ie(&sdata
->vif
, skb
);
2355 ieee80211_tdls_add_ext_capab(skb
);
2357 case WLAN_TDLS_SETUP_RESPONSE
:
2358 tf
->category
= WLAN_CATEGORY_TDLS
;
2359 tf
->action_code
= WLAN_TDLS_SETUP_RESPONSE
;
2361 skb_put(skb
, sizeof(tf
->u
.setup_resp
));
2362 tf
->u
.setup_resp
.status_code
= cpu_to_le16(status_code
);
2363 tf
->u
.setup_resp
.dialog_token
= dialog_token
;
2364 tf
->u
.setup_resp
.capability
=
2365 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata
));
2367 ieee80211_add_srates_ie(&sdata
->vif
, skb
);
2368 ieee80211_add_ext_srates_ie(&sdata
->vif
, skb
);
2369 ieee80211_tdls_add_ext_capab(skb
);
2371 case WLAN_TDLS_SETUP_CONFIRM
:
2372 tf
->category
= WLAN_CATEGORY_TDLS
;
2373 tf
->action_code
= WLAN_TDLS_SETUP_CONFIRM
;
2375 skb_put(skb
, sizeof(tf
->u
.setup_cfm
));
2376 tf
->u
.setup_cfm
.status_code
= cpu_to_le16(status_code
);
2377 tf
->u
.setup_cfm
.dialog_token
= dialog_token
;
2379 case WLAN_TDLS_TEARDOWN
:
2380 tf
->category
= WLAN_CATEGORY_TDLS
;
2381 tf
->action_code
= WLAN_TDLS_TEARDOWN
;
2383 skb_put(skb
, sizeof(tf
->u
.teardown
));
2384 tf
->u
.teardown
.reason_code
= cpu_to_le16(status_code
);
2386 case WLAN_TDLS_DISCOVERY_REQUEST
:
2387 tf
->category
= WLAN_CATEGORY_TDLS
;
2388 tf
->action_code
= WLAN_TDLS_DISCOVERY_REQUEST
;
2390 skb_put(skb
, sizeof(tf
->u
.discover_req
));
2391 tf
->u
.discover_req
.dialog_token
= dialog_token
;
2401 ieee80211_prep_tdls_direct(struct wiphy
*wiphy
, struct net_device
*dev
,
2402 u8
*peer
, u8 action_code
, u8 dialog_token
,
2403 u16 status_code
, struct sk_buff
*skb
)
2405 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2406 struct ieee80211_mgmt
*mgmt
;
2408 mgmt
= (void *)skb_put(skb
, 24);
2409 memset(mgmt
, 0, 24);
2410 memcpy(mgmt
->da
, peer
, ETH_ALEN
);
2411 memcpy(mgmt
->sa
, sdata
->vif
.addr
, ETH_ALEN
);
2412 memcpy(mgmt
->bssid
, sdata
->u
.mgd
.bssid
, ETH_ALEN
);
2414 mgmt
->frame_control
= cpu_to_le16(IEEE80211_FTYPE_MGMT
|
2415 IEEE80211_STYPE_ACTION
);
2417 switch (action_code
) {
2418 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES
:
2419 skb_put(skb
, 1 + sizeof(mgmt
->u
.action
.u
.tdls_discover_resp
));
2420 mgmt
->u
.action
.category
= WLAN_CATEGORY_PUBLIC
;
2421 mgmt
->u
.action
.u
.tdls_discover_resp
.action_code
=
2422 WLAN_PUB_ACTION_TDLS_DISCOVER_RES
;
2423 mgmt
->u
.action
.u
.tdls_discover_resp
.dialog_token
=
2425 mgmt
->u
.action
.u
.tdls_discover_resp
.capability
=
2426 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata
));
2428 ieee80211_add_srates_ie(&sdata
->vif
, skb
);
2429 ieee80211_add_ext_srates_ie(&sdata
->vif
, skb
);
2430 ieee80211_tdls_add_ext_capab(skb
);
2439 static int ieee80211_tdls_mgmt(struct wiphy
*wiphy
, struct net_device
*dev
,
2440 u8
*peer
, u8 action_code
, u8 dialog_token
,
2441 u16 status_code
, const u8
*extra_ies
,
2442 size_t extra_ies_len
)
2444 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2445 struct ieee80211_local
*local
= sdata
->local
;
2446 struct ieee80211_tx_info
*info
;
2447 struct sk_buff
*skb
= NULL
;
2451 if (!(wiphy
->flags
& WIPHY_FLAG_SUPPORTS_TDLS
))
2454 /* make sure we are in managed mode, and associated */
2455 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
||
2456 !sdata
->u
.mgd
.associated
)
2459 #ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG
2460 printk(KERN_DEBUG
"TDLS mgmt action %d peer %pM\n", action_code
, peer
);
2463 skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+
2464 max(sizeof(struct ieee80211_mgmt
),
2465 sizeof(struct ieee80211_tdls_data
)) +
2466 50 + /* supported rates */
2469 sizeof(struct ieee80211_tdls_lnkie
));
2473 info
= IEEE80211_SKB_CB(skb
);
2474 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
2476 switch (action_code
) {
2477 case WLAN_TDLS_SETUP_REQUEST
:
2478 case WLAN_TDLS_SETUP_RESPONSE
:
2479 case WLAN_TDLS_SETUP_CONFIRM
:
2480 case WLAN_TDLS_TEARDOWN
:
2481 case WLAN_TDLS_DISCOVERY_REQUEST
:
2482 ret
= ieee80211_prep_tdls_encap_data(wiphy
, dev
, peer
,
2483 action_code
, dialog_token
,
2485 send_direct
= false;
2487 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES
:
2488 ret
= ieee80211_prep_tdls_direct(wiphy
, dev
, peer
, action_code
,
2489 dialog_token
, status_code
,
2502 memcpy(skb_put(skb
, extra_ies_len
), extra_ies
, extra_ies_len
);
2504 /* the TDLS link IE is always added last */
2505 switch (action_code
) {
2506 case WLAN_TDLS_SETUP_REQUEST
:
2507 case WLAN_TDLS_SETUP_CONFIRM
:
2508 case WLAN_TDLS_TEARDOWN
:
2509 case WLAN_TDLS_DISCOVERY_REQUEST
:
2510 /* we are the initiator */
2511 ieee80211_tdls_add_link_ie(skb
, sdata
->vif
.addr
, peer
,
2512 sdata
->u
.mgd
.bssid
);
2514 case WLAN_TDLS_SETUP_RESPONSE
:
2515 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES
:
2516 /* we are the responder */
2517 ieee80211_tdls_add_link_ie(skb
, peer
, sdata
->vif
.addr
,
2518 sdata
->u
.mgd
.bssid
);
2526 ieee80211_tx_skb(sdata
, skb
);
2531 * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise
2532 * we should default to AC_VI.
2534 switch (action_code
) {
2535 case WLAN_TDLS_SETUP_REQUEST
:
2536 case WLAN_TDLS_SETUP_RESPONSE
:
2537 skb_set_queue_mapping(skb
, IEEE80211_AC_BK
);
2541 skb_set_queue_mapping(skb
, IEEE80211_AC_VI
);
2546 /* disable bottom halves when entering the Tx path */
2548 ret
= ieee80211_subif_start_xmit(skb
, dev
);
2558 static int ieee80211_tdls_oper(struct wiphy
*wiphy
, struct net_device
*dev
,
2559 u8
*peer
, enum nl80211_tdls_operation oper
)
2561 struct sta_info
*sta
;
2562 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2564 if (!(wiphy
->flags
& WIPHY_FLAG_SUPPORTS_TDLS
))
2567 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
2570 #ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG
2571 printk(KERN_DEBUG
"TDLS oper %d peer %pM\n", oper
, peer
);
2575 case NL80211_TDLS_ENABLE_LINK
:
2577 sta
= sta_info_get(sdata
, peer
);
2583 set_sta_flag(sta
, WLAN_STA_TDLS_PEER_AUTH
);
2586 case NL80211_TDLS_DISABLE_LINK
:
2587 return sta_info_destroy_addr(sdata
, peer
);
2588 case NL80211_TDLS_TEARDOWN
:
2589 case NL80211_TDLS_SETUP
:
2590 case NL80211_TDLS_DISCOVERY_REQ
:
2591 /* We don't support in-driver setup/teardown/discovery */
2600 static int ieee80211_probe_client(struct wiphy
*wiphy
, struct net_device
*dev
,
2601 const u8
*peer
, u64
*cookie
)
2603 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2604 struct ieee80211_local
*local
= sdata
->local
;
2605 struct ieee80211_qos_hdr
*nullfunc
;
2606 struct sk_buff
*skb
;
2607 int size
= sizeof(*nullfunc
);
2610 struct ieee80211_tx_info
*info
;
2611 struct sta_info
*sta
;
2614 sta
= sta_info_get(sdata
, peer
);
2616 qos
= test_sta_flag(sta
, WLAN_STA_WME
);
2624 fc
= cpu_to_le16(IEEE80211_FTYPE_DATA
|
2625 IEEE80211_STYPE_QOS_NULLFUNC
|
2626 IEEE80211_FCTL_FROMDS
);
2629 fc
= cpu_to_le16(IEEE80211_FTYPE_DATA
|
2630 IEEE80211_STYPE_NULLFUNC
|
2631 IEEE80211_FCTL_FROMDS
);
2634 skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+ size
);
2640 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
2642 nullfunc
= (void *) skb_put(skb
, size
);
2643 nullfunc
->frame_control
= fc
;
2644 nullfunc
->duration_id
= 0;
2645 memcpy(nullfunc
->addr1
, sta
->sta
.addr
, ETH_ALEN
);
2646 memcpy(nullfunc
->addr2
, sdata
->vif
.addr
, ETH_ALEN
);
2647 memcpy(nullfunc
->addr3
, sdata
->vif
.addr
, ETH_ALEN
);
2648 nullfunc
->seq_ctrl
= 0;
2650 info
= IEEE80211_SKB_CB(skb
);
2652 info
->flags
|= IEEE80211_TX_CTL_REQ_TX_STATUS
|
2653 IEEE80211_TX_INTFL_NL80211_FRAME_TX
;
2655 skb_set_queue_mapping(skb
, IEEE80211_AC_VO
);
2658 nullfunc
->qos_ctrl
= cpu_to_le16(7);
2661 ieee80211_xmit(sdata
, skb
);
2664 *cookie
= (unsigned long) skb
;
2668 static struct ieee80211_channel
*
2669 ieee80211_wiphy_get_channel(struct wiphy
*wiphy
)
2671 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2673 return local
->oper_channel
;
2676 struct cfg80211_ops mac80211_config_ops
= {
2677 .add_virtual_intf
= ieee80211_add_iface
,
2678 .del_virtual_intf
= ieee80211_del_iface
,
2679 .change_virtual_intf
= ieee80211_change_iface
,
2680 .add_key
= ieee80211_add_key
,
2681 .del_key
= ieee80211_del_key
,
2682 .get_key
= ieee80211_get_key
,
2683 .set_default_key
= ieee80211_config_default_key
,
2684 .set_default_mgmt_key
= ieee80211_config_default_mgmt_key
,
2685 .start_ap
= ieee80211_start_ap
,
2686 .change_beacon
= ieee80211_change_beacon
,
2687 .stop_ap
= ieee80211_stop_ap
,
2688 .add_station
= ieee80211_add_station
,
2689 .del_station
= ieee80211_del_station
,
2690 .change_station
= ieee80211_change_station
,
2691 .get_station
= ieee80211_get_station
,
2692 .dump_station
= ieee80211_dump_station
,
2693 .dump_survey
= ieee80211_dump_survey
,
2694 #ifdef CONFIG_MAC80211_MESH
2695 .add_mpath
= ieee80211_add_mpath
,
2696 .del_mpath
= ieee80211_del_mpath
,
2697 .change_mpath
= ieee80211_change_mpath
,
2698 .get_mpath
= ieee80211_get_mpath
,
2699 .dump_mpath
= ieee80211_dump_mpath
,
2700 .update_mesh_config
= ieee80211_update_mesh_config
,
2701 .get_mesh_config
= ieee80211_get_mesh_config
,
2702 .join_mesh
= ieee80211_join_mesh
,
2703 .leave_mesh
= ieee80211_leave_mesh
,
2705 .change_bss
= ieee80211_change_bss
,
2706 .set_txq_params
= ieee80211_set_txq_params
,
2707 .set_channel
= ieee80211_set_channel
,
2708 .suspend
= ieee80211_suspend
,
2709 .resume
= ieee80211_resume
,
2710 .scan
= ieee80211_scan
,
2711 .sched_scan_start
= ieee80211_sched_scan_start
,
2712 .sched_scan_stop
= ieee80211_sched_scan_stop
,
2713 .auth
= ieee80211_auth
,
2714 .assoc
= ieee80211_assoc
,
2715 .deauth
= ieee80211_deauth
,
2716 .disassoc
= ieee80211_disassoc
,
2717 .join_ibss
= ieee80211_join_ibss
,
2718 .leave_ibss
= ieee80211_leave_ibss
,
2719 .set_wiphy_params
= ieee80211_set_wiphy_params
,
2720 .set_tx_power
= ieee80211_set_tx_power
,
2721 .get_tx_power
= ieee80211_get_tx_power
,
2722 .set_wds_peer
= ieee80211_set_wds_peer
,
2723 .rfkill_poll
= ieee80211_rfkill_poll
,
2724 CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd
)
2725 CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump
)
2726 .set_power_mgmt
= ieee80211_set_power_mgmt
,
2727 .set_bitrate_mask
= ieee80211_set_bitrate_mask
,
2728 .remain_on_channel
= ieee80211_remain_on_channel
,
2729 .cancel_remain_on_channel
= ieee80211_cancel_remain_on_channel
,
2730 .mgmt_tx
= ieee80211_mgmt_tx
,
2731 .mgmt_tx_cancel_wait
= ieee80211_mgmt_tx_cancel_wait
,
2732 .set_cqm_rssi_config
= ieee80211_set_cqm_rssi_config
,
2733 .mgmt_frame_register
= ieee80211_mgmt_frame_register
,
2734 .set_antenna
= ieee80211_set_antenna
,
2735 .get_antenna
= ieee80211_get_antenna
,
2736 .set_ringparam
= ieee80211_set_ringparam
,
2737 .get_ringparam
= ieee80211_get_ringparam
,
2738 .set_rekey_data
= ieee80211_set_rekey_data
,
2739 .tdls_oper
= ieee80211_tdls_oper
,
2740 .tdls_mgmt
= ieee80211_tdls_mgmt
,
2741 .probe_client
= ieee80211_probe_client
,
2742 .get_channel
= ieee80211_wiphy_get_channel
,
2743 .set_noack_map
= ieee80211_set_noack_map
,