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 ieee80211_local *local = sdata->local;
357 struct timespec uptime;
359 sinfo->generation = sdata->local->sta_generation;
361 sinfo->filled = STATION_INFO_INACTIVE_TIME |
362 STATION_INFO_RX_BYTES |
363 STATION_INFO_TX_BYTES |
364 STATION_INFO_RX_PACKETS |
365 STATION_INFO_TX_PACKETS |
366 STATION_INFO_TX_RETRIES |
367 STATION_INFO_TX_FAILED |
368 STATION_INFO_TX_BITRATE |
369 STATION_INFO_RX_BITRATE |
370 STATION_INFO_RX_DROP_MISC |
371 STATION_INFO_BSS_PARAM |
372 STATION_INFO_CONNECTED_TIME |
373 STATION_INFO_STA_FLAGS |
374 STATION_INFO_BEACON_LOSS_COUNT;
376 do_posix_clock_monotonic_gettime(&uptime);
377 sinfo->connected_time = uptime.tv_sec - sta->last_connected;
379 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
380 sinfo->rx_bytes = sta->rx_bytes;
381 sinfo->tx_bytes = sta->tx_bytes;
382 sinfo->rx_packets = sta->rx_packets;
383 sinfo->tx_packets = sta->tx_packets;
384 sinfo->tx_retries = sta->tx_retry_count;
385 sinfo->tx_failed = sta->tx_retry_failed;
386 sinfo->rx_dropped_misc = sta->rx_dropped;
387 sinfo->beacon_loss_count = sta->beacon_loss_count;
389 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
390 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
391 sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
392 if (!local->ops->get_rssi ||
393 drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
394 sinfo->signal = (s8)sta->last_signal;
395 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
398 sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
400 sinfo->rxrate.flags = 0;
401 if (sta->last_rx_rate_flag & RX_FLAG_HT)
402 sinfo->rxrate.flags |= RATE_INFO_FLAGS_MCS;
403 if (sta->last_rx_rate_flag & RX_FLAG_40MHZ)
404 sinfo->rxrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
405 if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI)
406 sinfo->rxrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
407 rate_idx_to_bitrate(&sinfo->rxrate, sta, sta->last_rx_rate_idx);
409 if (ieee80211_vif_is_mesh(&sdata->vif)) {
410 #ifdef CONFIG_MAC80211_MESH
411 sinfo->filled |= STATION_INFO_LLID |
413 STATION_INFO_PLINK_STATE;
415 sinfo->llid = le16_to_cpu(sta->llid);
416 sinfo->plid = le16_to_cpu(sta->plid);
417 sinfo->plink_state = sta->plink_state;
418 if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
419 sinfo->filled |= STATION_INFO_T_OFFSET;
420 sinfo->t_offset = sta->t_offset;
425 sinfo->bss_param.flags = 0;
426 if (sdata->vif.bss_conf.use_cts_prot)
427 sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
428 if (sdata->vif.bss_conf.use_short_preamble)
429 sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
430 if (sdata->vif.bss_conf.use_short_slot)
431 sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
432 sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
433 sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
435 sinfo->sta_flags.set = 0;
436 sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
437 BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
438 BIT(NL80211_STA_FLAG_WME) |
439 BIT(NL80211_STA_FLAG_MFP) |
440 BIT(NL80211_STA_FLAG_AUTHENTICATED) |
441 BIT(NL80211_STA_FLAG_TDLS_PEER);
442 if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
443 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
444 if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
445 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
446 if (test_sta_flag(sta, WLAN_STA_WME))
447 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
448 if (test_sta_flag(sta, WLAN_STA_MFP))
449 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
450 if (test_sta_flag(sta, WLAN_STA_AUTH))
451 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
452 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
453 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
456 static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
457 "rx_packets", "rx_bytes", "wep_weak_iv_count",
458 "rx_duplicates", "rx_fragments", "rx_dropped",
459 "tx_packets", "tx_bytes", "tx_fragments",
460 "tx_filtered", "tx_retry_failed", "tx_retries",
461 "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
462 "channel", "noise", "ch_time", "ch_time_busy",
463 "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
465 #define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
467 static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
468 struct net_device *dev,
471 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
474 if (sset == ETH_SS_STATS)
477 rv += drv_get_et_sset_count(sdata, sset);
484 static void ieee80211_get_et_stats(struct wiphy *wiphy,
485 struct net_device *dev,
486 struct ethtool_stats *stats,
489 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
490 struct sta_info *sta;
491 struct ieee80211_local *local = sdata->local;
492 struct station_info sinfo;
493 struct survey_info survey;
495 #define STA_STATS_SURVEY_LEN 7
497 memset(data, 0, sizeof(u64) * STA_STATS_LEN);
499 #define ADD_STA_STATS(sta) \
501 data[i++] += sta->rx_packets; \
502 data[i++] += sta->rx_bytes; \
503 data[i++] += sta->wep_weak_iv_count; \
504 data[i++] += sta->num_duplicates; \
505 data[i++] += sta->rx_fragments; \
506 data[i++] += sta->rx_dropped; \
508 data[i++] += sta->tx_packets; \
509 data[i++] += sta->tx_bytes; \
510 data[i++] += sta->tx_fragments; \
511 data[i++] += sta->tx_filtered_count; \
512 data[i++] += sta->tx_retry_failed; \
513 data[i++] += sta->tx_retry_count; \
514 data[i++] += sta->beacon_loss_count; \
517 /* For Managed stations, find the single station based on BSSID
518 * and use that. For interface types, iterate through all available
519 * stations and add stats for any station that is assigned to this
523 mutex_lock(&local->sta_mtx);
525 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
526 sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
528 if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
534 data[i++] = sta->sta_state;
537 sta_set_sinfo(sta, &sinfo);
539 if (sinfo.filled & STATION_INFO_TX_BITRATE)
541 cfg80211_calculate_bitrate(&sinfo.txrate);
543 if (sinfo.filled & STATION_INFO_RX_BITRATE)
545 cfg80211_calculate_bitrate(&sinfo.rxrate);
548 if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
549 data[i] = (u8)sinfo.signal_avg;
552 list_for_each_entry(sta, &local->sta_list, list) {
553 /* Make sure this station belongs to the proper dev */
554 if (sta->sdata->dev != dev)
563 i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
564 /* Get survey stats for current channel */
568 if (drv_get_survey(local, q, &survey) != 0) {
573 if (survey.channel &&
574 (local->oper_channel->center_freq ==
575 survey.channel->center_freq))
581 data[i++] = survey.channel->center_freq;
584 if (survey.filled & SURVEY_INFO_NOISE_DBM)
585 data[i++] = (u8)survey.noise;
588 if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
589 data[i++] = survey.channel_time;
592 if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
593 data[i++] = survey.channel_time_busy;
596 if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
597 data[i++] = survey.channel_time_ext_busy;
600 if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
601 data[i++] = survey.channel_time_rx;
604 if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
605 data[i++] = survey.channel_time_tx;
609 mutex_unlock(&local->sta_mtx);
611 if (WARN_ON(i != STA_STATS_LEN))
614 drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
617 static void ieee80211_get_et_strings(struct wiphy *wiphy,
618 struct net_device *dev,
621 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
622 int sz_sta_stats = 0;
624 if (sset == ETH_SS_STATS) {
625 sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
626 memcpy(data, *ieee80211_gstrings_sta_stats, sz_sta_stats);
628 drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
631 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
632 int idx, u8 *mac, struct station_info *sinfo)
634 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
635 struct ieee80211_local *local = sdata->local;
636 struct sta_info *sta;
639 mutex_lock(&local->sta_mtx);
641 sta = sta_info_get_by_idx(sdata, idx);
644 memcpy(mac, sta->sta.addr, ETH_ALEN);
645 sta_set_sinfo(sta, sinfo);
648 mutex_unlock(&local->sta_mtx);
653 static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
654 int idx, struct survey_info *survey)
656 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
658 return drv_get_survey(local, idx, survey);
661 static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
662 u8 *mac, struct station_info *sinfo)
664 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
665 struct ieee80211_local *local = sdata->local;
666 struct sta_info *sta;
669 mutex_lock(&local->sta_mtx);
671 sta = sta_info_get_bss(sdata, mac);
674 sta_set_sinfo(sta, sinfo);
677 mutex_unlock(&local->sta_mtx);
682 static int ieee80211_set_channel(struct wiphy *wiphy,
683 struct net_device *netdev,
684 struct ieee80211_channel *chan,
685 enum nl80211_channel_type channel_type)
687 struct ieee80211_local *local = wiphy_priv(wiphy);
688 struct ieee80211_sub_if_data *sdata = NULL;
691 sdata = IEEE80211_DEV_TO_SUB_IF(netdev);
693 switch (ieee80211_get_channel_mode(local, NULL)) {
694 case CHAN_MODE_HOPPING:
696 case CHAN_MODE_FIXED:
697 if (local->oper_channel != chan ||
698 (!sdata && local->_oper_channel_type != channel_type))
700 if (!sdata && local->_oper_channel_type == channel_type)
703 case CHAN_MODE_UNDEFINED:
707 if (!ieee80211_set_channel_type(local, sdata, channel_type))
710 local->oper_channel = chan;
712 /* auto-detects changes */
713 ieee80211_hw_config(local, 0);
718 static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
719 struct ieee80211_channel *chan,
720 enum nl80211_channel_type channel_type)
722 return ieee80211_set_channel(wiphy, NULL, chan, channel_type);
725 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
726 const u8 *resp, size_t resp_len)
728 struct sk_buff *new, *old;
730 if (!resp || !resp_len)
733 old = rtnl_dereference(sdata->u.ap.probe_resp);
735 new = dev_alloc_skb(resp_len);
739 memcpy(skb_put(new, resp_len), resp, resp_len);
741 rcu_assign_pointer(sdata->u.ap.probe_resp, new);
743 /* TODO: use call_rcu() */
751 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
752 struct cfg80211_beacon_data *params)
754 struct beacon_data *new, *old;
755 int new_head_len, new_tail_len;
757 u32 changed = BSS_CHANGED_BEACON;
759 old = rtnl_dereference(sdata->u.ap.beacon);
761 /* Need to have a beacon head if we don't have one yet */
762 if (!params->head && !old)
765 /* new or old head? */
767 new_head_len = params->head_len;
769 new_head_len = old->head_len;
771 /* new or old tail? */
772 if (params->tail || !old)
773 /* params->tail_len will be zero for !params->tail */
774 new_tail_len = params->tail_len;
776 new_tail_len = old->tail_len;
778 size = sizeof(*new) + new_head_len + new_tail_len;
780 new = kzalloc(size, GFP_KERNEL);
784 /* start filling the new info now */
787 * pointers go into the block we allocated,
788 * memory is | beacon_data | head | tail |
790 new->head = ((u8 *) new) + sizeof(*new);
791 new->tail = new->head + new_head_len;
792 new->head_len = new_head_len;
793 new->tail_len = new_tail_len;
797 memcpy(new->head, params->head, new_head_len);
799 memcpy(new->head, old->head, new_head_len);
801 /* copy in optional tail */
803 memcpy(new->tail, params->tail, new_tail_len);
806 memcpy(new->tail, old->tail, new_tail_len);
808 err = ieee80211_set_probe_resp(sdata, params->probe_resp,
809 params->probe_resp_len);
813 changed |= BSS_CHANGED_AP_PROBE_RESP;
815 rcu_assign_pointer(sdata->u.ap.beacon, new);
818 kfree_rcu(old, rcu_head);
823 static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
824 struct cfg80211_ap_settings *params)
826 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
827 struct beacon_data *old;
828 struct ieee80211_sub_if_data *vlan;
829 u32 changed = BSS_CHANGED_BEACON_INT |
830 BSS_CHANGED_BEACON_ENABLED |
835 old = rtnl_dereference(sdata->u.ap.beacon);
839 err = ieee80211_set_channel(wiphy, dev, params->channel,
840 params->channel_type);
845 * Apply control port protocol, this allows us to
846 * not encrypt dynamic WEP control frames.
848 sdata->control_port_protocol = params->crypto.control_port_ethertype;
849 sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt;
850 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
851 vlan->control_port_protocol =
852 params->crypto.control_port_ethertype;
853 vlan->control_port_no_encrypt =
854 params->crypto.control_port_no_encrypt;
857 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
858 sdata->vif.bss_conf.dtim_period = params->dtim_period;
860 sdata->vif.bss_conf.ssid_len = params->ssid_len;
861 if (params->ssid_len)
862 memcpy(sdata->vif.bss_conf.ssid, params->ssid,
864 sdata->vif.bss_conf.hidden_ssid =
865 (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE);
867 err = ieee80211_assign_beacon(sdata, ¶ms->beacon);
872 ieee80211_bss_info_change_notify(sdata, changed);
874 netif_carrier_on(dev);
875 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
876 netif_carrier_on(vlan->dev);
881 static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
882 struct cfg80211_beacon_data *params)
884 struct ieee80211_sub_if_data *sdata;
885 struct beacon_data *old;
888 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
890 old = rtnl_dereference(sdata->u.ap.beacon);
894 err = ieee80211_assign_beacon(sdata, params);
897 ieee80211_bss_info_change_notify(sdata, err);
901 static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
903 struct ieee80211_sub_if_data *sdata, *vlan;
904 struct beacon_data *old;
906 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
908 old = rtnl_dereference(sdata->u.ap.beacon);
912 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
913 netif_carrier_off(vlan->dev);
914 netif_carrier_off(dev);
916 RCU_INIT_POINTER(sdata->u.ap.beacon, NULL);
918 kfree_rcu(old, rcu_head);
920 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
925 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
926 struct iapp_layer2_update {
927 u8 da[ETH_ALEN]; /* broadcast */
928 u8 sa[ETH_ALEN]; /* STA addr */
936 static void ieee80211_send_layer2_update(struct sta_info *sta)
938 struct iapp_layer2_update *msg;
941 /* Send Level 2 Update Frame to update forwarding tables in layer 2
944 skb = dev_alloc_skb(sizeof(*msg));
947 msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg));
949 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
950 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
952 memset(msg->da, 0xff, ETH_ALEN);
953 memcpy(msg->sa, sta->sta.addr, ETH_ALEN);
956 msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */
957 msg->control = 0xaf; /* XID response lsb.1111F101.
958 * F=0 (no poll command; unsolicited frame) */
959 msg->xid_info[0] = 0x81; /* XID format identifier */
960 msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */
961 msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */
963 skb->dev = sta->sdata->dev;
964 skb->protocol = eth_type_trans(skb, sta->sdata->dev);
965 memset(skb->cb, 0, sizeof(skb->cb));
969 static int sta_apply_parameters(struct ieee80211_local *local,
970 struct sta_info *sta,
971 struct station_parameters *params)
976 struct ieee80211_supported_band *sband;
977 struct ieee80211_sub_if_data *sdata = sta->sdata;
980 sband = local->hw.wiphy->bands[local->oper_channel->band];
982 mask = params->sta_flags_mask;
983 set = params->sta_flags_set;
986 * In mesh mode, we can clear AUTHENTICATED flag but must
987 * also make ASSOCIATED follow appropriately for the driver
988 * API. See also below, after AUTHORIZED changes.
990 if (mask & BIT(NL80211_STA_FLAG_AUTHENTICATED)) {
991 /* cfg80211 should not allow this in non-mesh modes */
992 if (WARN_ON(!ieee80211_vif_is_mesh(&sdata->vif)))
995 if (set & BIT(NL80211_STA_FLAG_AUTHENTICATED) &&
996 !test_sta_flag(sta, WLAN_STA_AUTH)) {
997 ret = sta_info_move_state(sta, IEEE80211_STA_AUTH);
1000 ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
1006 if (mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
1007 if (set & BIT(NL80211_STA_FLAG_AUTHORIZED))
1008 ret = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
1009 else if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1010 ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
1015 if (mask & BIT(NL80211_STA_FLAG_AUTHENTICATED)) {
1016 /* cfg80211 should not allow this in non-mesh modes */
1017 if (WARN_ON(!ieee80211_vif_is_mesh(&sdata->vif)))
1020 if (!(set & BIT(NL80211_STA_FLAG_AUTHENTICATED)) &&
1021 test_sta_flag(sta, WLAN_STA_AUTH)) {
1022 ret = sta_info_move_state(sta, IEEE80211_STA_AUTH);
1025 ret = sta_info_move_state(sta, IEEE80211_STA_NONE);
1032 if (mask & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) {
1033 if (set & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE))
1034 set_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE);
1036 clear_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE);
1039 if (mask & BIT(NL80211_STA_FLAG_WME)) {
1040 if (set & BIT(NL80211_STA_FLAG_WME)) {
1041 set_sta_flag(sta, WLAN_STA_WME);
1042 sta->sta.wme = true;
1044 clear_sta_flag(sta, WLAN_STA_WME);
1045 sta->sta.wme = false;
1049 if (mask & BIT(NL80211_STA_FLAG_MFP)) {
1050 if (set & BIT(NL80211_STA_FLAG_MFP))
1051 set_sta_flag(sta, WLAN_STA_MFP);
1053 clear_sta_flag(sta, WLAN_STA_MFP);
1056 if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) {
1057 if (set & BIT(NL80211_STA_FLAG_TDLS_PEER))
1058 set_sta_flag(sta, WLAN_STA_TDLS_PEER);
1060 clear_sta_flag(sta, WLAN_STA_TDLS_PEER);
1063 if (params->sta_modify_mask & STATION_PARAM_APPLY_UAPSD) {
1064 sta->sta.uapsd_queues = params->uapsd_queues;
1065 sta->sta.max_sp = params->max_sp;
1069 * cfg80211 validates this (1-2007) and allows setting the AID
1070 * only when creating a new station entry
1073 sta->sta.aid = params->aid;
1076 * FIXME: updating the following information is racy when this
1077 * function is called from ieee80211_change_station().
1078 * However, all this information should be static so
1079 * maybe we should just reject attemps to change it.
1082 if (params->listen_interval >= 0)
1083 sta->listen_interval = params->listen_interval;
1085 if (params->supported_rates) {
1088 for (i = 0; i < params->supported_rates_len; i++) {
1089 int rate = (params->supported_rates[i] & 0x7f) * 5;
1090 for (j = 0; j < sband->n_bitrates; j++) {
1091 if (sband->bitrates[j].bitrate == rate)
1095 sta->sta.supp_rates[local->oper_channel->band] = rates;
1098 if (params->ht_capa)
1099 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
1103 if (ieee80211_vif_is_mesh(&sdata->vif)) {
1104 #ifdef CONFIG_MAC80211_MESH
1105 if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED)
1106 switch (params->plink_state) {
1107 case NL80211_PLINK_LISTEN:
1108 case NL80211_PLINK_ESTAB:
1109 case NL80211_PLINK_BLOCKED:
1110 sta->plink_state = params->plink_state;
1117 switch (params->plink_action) {
1118 case PLINK_ACTION_OPEN:
1119 mesh_plink_open(sta);
1121 case PLINK_ACTION_BLOCK:
1122 mesh_plink_block(sta);
1131 static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
1132 u8 *mac, struct station_parameters *params)
1134 struct ieee80211_local *local = wiphy_priv(wiphy);
1135 struct sta_info *sta;
1136 struct ieee80211_sub_if_data *sdata;
1141 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
1143 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
1144 sdata->vif.type != NL80211_IFTYPE_AP)
1147 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1149 if (ether_addr_equal(mac, sdata->vif.addr))
1152 if (is_multicast_ether_addr(mac))
1155 sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
1159 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
1160 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
1162 err = sta_apply_parameters(local, sta, params);
1164 sta_info_free(local, sta);
1169 * for TDLS, rate control should be initialized only when supported
1172 if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER))
1173 rate_control_rate_init(sta);
1175 layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
1176 sdata->vif.type == NL80211_IFTYPE_AP;
1178 err = sta_info_insert_rcu(sta);
1185 ieee80211_send_layer2_update(sta);
1192 static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
1195 struct ieee80211_local *local = wiphy_priv(wiphy);
1196 struct ieee80211_sub_if_data *sdata;
1198 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1201 return sta_info_destroy_addr_bss(sdata, mac);
1203 sta_info_flush(local, sdata);
1207 static int ieee80211_change_station(struct wiphy *wiphy,
1208 struct net_device *dev,
1210 struct station_parameters *params)
1212 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1213 struct ieee80211_local *local = wiphy_priv(wiphy);
1214 struct sta_info *sta;
1215 struct ieee80211_sub_if_data *vlansdata;
1218 mutex_lock(&local->sta_mtx);
1220 sta = sta_info_get_bss(sdata, mac);
1222 mutex_unlock(&local->sta_mtx);
1226 /* in station mode, supported rates are only valid with TDLS */
1227 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
1228 params->supported_rates &&
1229 !test_sta_flag(sta, WLAN_STA_TDLS_PEER)) {
1230 mutex_unlock(&local->sta_mtx);
1234 if (params->vlan && params->vlan != sta->sdata->dev) {
1235 bool prev_4addr = false;
1236 bool new_4addr = false;
1238 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
1240 if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
1241 vlansdata->vif.type != NL80211_IFTYPE_AP) {
1242 mutex_unlock(&local->sta_mtx);
1246 if (params->vlan->ieee80211_ptr->use_4addr) {
1247 if (vlansdata->u.vlan.sta) {
1248 mutex_unlock(&local->sta_mtx);
1252 rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
1256 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
1257 sta->sdata->u.vlan.sta) {
1258 rcu_assign_pointer(sta->sdata->u.vlan.sta, NULL);
1262 sta->sdata = vlansdata;
1264 if (sta->sta_state == IEEE80211_STA_AUTHORIZED &&
1265 prev_4addr != new_4addr) {
1267 atomic_dec(&sta->sdata->bss->num_mcast_sta);
1269 atomic_inc(&sta->sdata->bss->num_mcast_sta);
1272 ieee80211_send_layer2_update(sta);
1275 err = sta_apply_parameters(local, sta, params);
1277 mutex_unlock(&local->sta_mtx);
1281 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && params->supported_rates)
1282 rate_control_rate_init(sta);
1284 mutex_unlock(&local->sta_mtx);
1286 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
1287 params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED))
1288 ieee80211_recalc_ps(local, -1);
1293 #ifdef CONFIG_MAC80211_MESH
1294 static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
1295 u8 *dst, u8 *next_hop)
1297 struct ieee80211_sub_if_data *sdata;
1298 struct mesh_path *mpath;
1299 struct sta_info *sta;
1302 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1305 sta = sta_info_get(sdata, next_hop);
1311 err = mesh_path_add(dst, sdata);
1317 mpath = mesh_path_lookup(dst, sdata);
1322 mesh_path_fix_nexthop(mpath, sta);
1328 static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev,
1331 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1334 return mesh_path_del(dst, sdata);
1336 mesh_path_flush_by_iface(sdata);
1340 static int ieee80211_change_mpath(struct wiphy *wiphy,
1341 struct net_device *dev,
1342 u8 *dst, u8 *next_hop)
1344 struct ieee80211_sub_if_data *sdata;
1345 struct mesh_path *mpath;
1346 struct sta_info *sta;
1348 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1352 sta = sta_info_get(sdata, next_hop);
1358 mpath = mesh_path_lookup(dst, sdata);
1364 mesh_path_fix_nexthop(mpath, sta);
1370 static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
1371 struct mpath_info *pinfo)
1373 struct sta_info *next_hop_sta = rcu_dereference(mpath->next_hop);
1376 memcpy(next_hop, next_hop_sta->sta.addr, ETH_ALEN);
1378 memset(next_hop, 0, ETH_ALEN);
1380 pinfo->generation = mesh_paths_generation;
1382 pinfo->filled = MPATH_INFO_FRAME_QLEN |
1385 MPATH_INFO_EXPTIME |
1386 MPATH_INFO_DISCOVERY_TIMEOUT |
1387 MPATH_INFO_DISCOVERY_RETRIES |
1390 pinfo->frame_qlen = mpath->frame_queue.qlen;
1391 pinfo->sn = mpath->sn;
1392 pinfo->metric = mpath->metric;
1393 if (time_before(jiffies, mpath->exp_time))
1394 pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies);
1395 pinfo->discovery_timeout =
1396 jiffies_to_msecs(mpath->discovery_timeout);
1397 pinfo->discovery_retries = mpath->discovery_retries;
1399 if (mpath->flags & MESH_PATH_ACTIVE)
1400 pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE;
1401 if (mpath->flags & MESH_PATH_RESOLVING)
1402 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
1403 if (mpath->flags & MESH_PATH_SN_VALID)
1404 pinfo->flags |= NL80211_MPATH_FLAG_SN_VALID;
1405 if (mpath->flags & MESH_PATH_FIXED)
1406 pinfo->flags |= NL80211_MPATH_FLAG_FIXED;
1407 if (mpath->flags & MESH_PATH_RESOLVING)
1408 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
1410 pinfo->flags = mpath->flags;
1413 static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
1414 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
1417 struct ieee80211_sub_if_data *sdata;
1418 struct mesh_path *mpath;
1420 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1423 mpath = mesh_path_lookup(dst, sdata);
1428 memcpy(dst, mpath->dst, ETH_ALEN);
1429 mpath_set_pinfo(mpath, next_hop, pinfo);
1434 static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
1435 int idx, u8 *dst, u8 *next_hop,
1436 struct mpath_info *pinfo)
1438 struct ieee80211_sub_if_data *sdata;
1439 struct mesh_path *mpath;
1441 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1444 mpath = mesh_path_lookup_by_idx(idx, sdata);
1449 memcpy(dst, mpath->dst, ETH_ALEN);
1450 mpath_set_pinfo(mpath, next_hop, pinfo);
1455 static int ieee80211_get_mesh_config(struct wiphy *wiphy,
1456 struct net_device *dev,
1457 struct mesh_config *conf)
1459 struct ieee80211_sub_if_data *sdata;
1460 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1462 memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config));
1466 static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask)
1468 return (mask >> (parm-1)) & 0x1;
1471 static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
1472 const struct mesh_setup *setup)
1476 struct ieee80211_sub_if_data *sdata = container_of(ifmsh,
1477 struct ieee80211_sub_if_data, u.mesh);
1479 /* allocate information elements */
1483 if (setup->ie_len) {
1484 new_ie = kmemdup(setup->ie, setup->ie_len,
1489 ifmsh->ie_len = setup->ie_len;
1493 /* now copy the rest of the setup parameters */
1494 ifmsh->mesh_id_len = setup->mesh_id_len;
1495 memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len);
1496 ifmsh->mesh_sp_id = setup->sync_method;
1497 ifmsh->mesh_pp_id = setup->path_sel_proto;
1498 ifmsh->mesh_pm_id = setup->path_metric;
1499 ifmsh->security = IEEE80211_MESH_SEC_NONE;
1500 if (setup->is_authenticated)
1501 ifmsh->security |= IEEE80211_MESH_SEC_AUTHED;
1502 if (setup->is_secure)
1503 ifmsh->security |= IEEE80211_MESH_SEC_SECURED;
1505 /* mcast rate setting in Mesh Node */
1506 memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate,
1507 sizeof(setup->mcast_rate));
1512 static int ieee80211_update_mesh_config(struct wiphy *wiphy,
1513 struct net_device *dev, u32 mask,
1514 const struct mesh_config *nconf)
1516 struct mesh_config *conf;
1517 struct ieee80211_sub_if_data *sdata;
1518 struct ieee80211_if_mesh *ifmsh;
1520 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1521 ifmsh = &sdata->u.mesh;
1523 /* Set the config options which we are interested in setting */
1524 conf = &(sdata->u.mesh.mshcfg);
1525 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT, mask))
1526 conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout;
1527 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT, mask))
1528 conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout;
1529 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT, mask))
1530 conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout;
1531 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS, mask))
1532 conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks;
1533 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask))
1534 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries;
1535 if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask))
1536 conf->dot11MeshTTL = nconf->dot11MeshTTL;
1537 if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask))
1538 conf->element_ttl = nconf->element_ttl;
1539 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask))
1540 conf->auto_open_plinks = nconf->auto_open_plinks;
1541 if (_chg_mesh_attr(NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, mask))
1542 conf->dot11MeshNbrOffsetMaxNeighbor =
1543 nconf->dot11MeshNbrOffsetMaxNeighbor;
1544 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask))
1545 conf->dot11MeshHWMPmaxPREQretries =
1546 nconf->dot11MeshHWMPmaxPREQretries;
1547 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME, mask))
1548 conf->path_refresh_time = nconf->path_refresh_time;
1549 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask))
1550 conf->min_discovery_timeout = nconf->min_discovery_timeout;
1551 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask))
1552 conf->dot11MeshHWMPactivePathTimeout =
1553 nconf->dot11MeshHWMPactivePathTimeout;
1554 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask))
1555 conf->dot11MeshHWMPpreqMinInterval =
1556 nconf->dot11MeshHWMPpreqMinInterval;
1557 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, mask))
1558 conf->dot11MeshHWMPperrMinInterval =
1559 nconf->dot11MeshHWMPperrMinInterval;
1560 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1562 conf->dot11MeshHWMPnetDiameterTraversalTime =
1563 nconf->dot11MeshHWMPnetDiameterTraversalTime;
1564 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOTMODE, mask)) {
1565 conf->dot11MeshHWMPRootMode = nconf->dot11MeshHWMPRootMode;
1566 ieee80211_mesh_root_setup(ifmsh);
1568 if (_chg_mesh_attr(NL80211_MESHCONF_GATE_ANNOUNCEMENTS, mask)) {
1569 /* our current gate announcement implementation rides on root
1570 * announcements, so require this ifmsh to also be a root node
1572 if (nconf->dot11MeshGateAnnouncementProtocol &&
1573 !(conf->dot11MeshHWMPRootMode > IEEE80211_ROOTMODE_ROOT)) {
1574 conf->dot11MeshHWMPRootMode = IEEE80211_PROACTIVE_RANN;
1575 ieee80211_mesh_root_setup(ifmsh);
1577 conf->dot11MeshGateAnnouncementProtocol =
1578 nconf->dot11MeshGateAnnouncementProtocol;
1580 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL, mask))
1581 conf->dot11MeshHWMPRannInterval =
1582 nconf->dot11MeshHWMPRannInterval;
1583 if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING, mask))
1584 conf->dot11MeshForwarding = nconf->dot11MeshForwarding;
1585 if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD, mask)) {
1586 /* our RSSI threshold implementation is supported only for
1587 * devices that report signal in dBm.
1589 if (!(sdata->local->hw.flags & IEEE80211_HW_SIGNAL_DBM))
1591 conf->rssi_threshold = nconf->rssi_threshold;
1593 if (_chg_mesh_attr(NL80211_MESHCONF_HT_OPMODE, mask)) {
1594 conf->ht_opmode = nconf->ht_opmode;
1595 sdata->vif.bss_conf.ht_operation_mode = nconf->ht_opmode;
1596 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT);
1598 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, mask))
1599 conf->dot11MeshHWMPactivePathToRootTimeout =
1600 nconf->dot11MeshHWMPactivePathToRootTimeout;
1601 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOT_INTERVAL, mask))
1602 conf->dot11MeshHWMProotInterval =
1603 nconf->dot11MeshHWMProotInterval;
1604 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, mask))
1605 conf->dot11MeshHWMPconfirmationInterval =
1606 nconf->dot11MeshHWMPconfirmationInterval;
1610 static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
1611 const struct mesh_config *conf,
1612 const struct mesh_setup *setup)
1614 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1615 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1618 memcpy(&ifmsh->mshcfg, conf, sizeof(struct mesh_config));
1619 err = copy_mesh_setup(ifmsh, setup);
1623 err = ieee80211_set_channel(wiphy, dev, setup->channel,
1624 setup->channel_type);
1628 ieee80211_start_mesh(sdata);
1633 static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
1635 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1637 ieee80211_stop_mesh(sdata);
1643 static int ieee80211_change_bss(struct wiphy *wiphy,
1644 struct net_device *dev,
1645 struct bss_parameters *params)
1647 struct ieee80211_sub_if_data *sdata;
1650 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1652 if (params->use_cts_prot >= 0) {
1653 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot;
1654 changed |= BSS_CHANGED_ERP_CTS_PROT;
1656 if (params->use_short_preamble >= 0) {
1657 sdata->vif.bss_conf.use_short_preamble =
1658 params->use_short_preamble;
1659 changed |= BSS_CHANGED_ERP_PREAMBLE;
1662 if (!sdata->vif.bss_conf.use_short_slot &&
1663 sdata->local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) {
1664 sdata->vif.bss_conf.use_short_slot = true;
1665 changed |= BSS_CHANGED_ERP_SLOT;
1668 if (params->use_short_slot_time >= 0) {
1669 sdata->vif.bss_conf.use_short_slot =
1670 params->use_short_slot_time;
1671 changed |= BSS_CHANGED_ERP_SLOT;
1674 if (params->basic_rates) {
1677 struct ieee80211_local *local = wiphy_priv(wiphy);
1678 struct ieee80211_supported_band *sband =
1679 wiphy->bands[local->oper_channel->band];
1681 for (i = 0; i < params->basic_rates_len; i++) {
1682 int rate = (params->basic_rates[i] & 0x7f) * 5;
1683 for (j = 0; j < sband->n_bitrates; j++) {
1684 if (sband->bitrates[j].bitrate == rate)
1688 sdata->vif.bss_conf.basic_rates = rates;
1689 changed |= BSS_CHANGED_BASIC_RATES;
1692 if (params->ap_isolate >= 0) {
1693 if (params->ap_isolate)
1694 sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
1696 sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
1699 if (params->ht_opmode >= 0) {
1700 sdata->vif.bss_conf.ht_operation_mode =
1701 (u16) params->ht_opmode;
1702 changed |= BSS_CHANGED_HT;
1705 ieee80211_bss_info_change_notify(sdata, changed);
1710 static int ieee80211_set_txq_params(struct wiphy *wiphy,
1711 struct net_device *dev,
1712 struct ieee80211_txq_params *params)
1714 struct ieee80211_local *local = wiphy_priv(wiphy);
1715 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1716 struct ieee80211_tx_queue_params p;
1718 if (!local->ops->conf_tx)
1721 if (local->hw.queues < IEEE80211_NUM_ACS)
1724 memset(&p, 0, sizeof(p));
1725 p.aifs = params->aifs;
1726 p.cw_max = params->cwmax;
1727 p.cw_min = params->cwmin;
1728 p.txop = params->txop;
1731 * Setting tx queue params disables u-apsd because it's only
1732 * called in master mode.
1736 sdata->tx_conf[params->ac] = p;
1737 if (drv_conf_tx(local, sdata, params->ac, &p)) {
1738 wiphy_debug(local->hw.wiphy,
1739 "failed to set TX queue parameters for AC %d\n",
1748 static int ieee80211_suspend(struct wiphy *wiphy,
1749 struct cfg80211_wowlan *wowlan)
1751 return __ieee80211_suspend(wiphy_priv(wiphy), wowlan);
1754 static int ieee80211_resume(struct wiphy *wiphy)
1756 return __ieee80211_resume(wiphy_priv(wiphy));
1759 #define ieee80211_suspend NULL
1760 #define ieee80211_resume NULL
1763 static int ieee80211_scan(struct wiphy *wiphy,
1764 struct net_device *dev,
1765 struct cfg80211_scan_request *req)
1767 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1769 switch (ieee80211_vif_type_p2p(&sdata->vif)) {
1770 case NL80211_IFTYPE_STATION:
1771 case NL80211_IFTYPE_ADHOC:
1772 case NL80211_IFTYPE_MESH_POINT:
1773 case NL80211_IFTYPE_P2P_CLIENT:
1775 case NL80211_IFTYPE_P2P_GO:
1776 if (sdata->local->ops->hw_scan)
1779 * FIXME: implement NoA while scanning in software,
1780 * for now fall through to allow scanning only when
1781 * beaconing hasn't been configured yet
1783 case NL80211_IFTYPE_AP:
1784 if (sdata->u.ap.beacon)
1791 return ieee80211_request_scan(sdata, req);
1795 ieee80211_sched_scan_start(struct wiphy *wiphy,
1796 struct net_device *dev,
1797 struct cfg80211_sched_scan_request *req)
1799 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1801 if (!sdata->local->ops->sched_scan_start)
1804 return ieee80211_request_sched_scan_start(sdata, req);
1808 ieee80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev)
1810 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1812 if (!sdata->local->ops->sched_scan_stop)
1815 return ieee80211_request_sched_scan_stop(sdata);
1818 static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
1819 struct cfg80211_auth_request *req)
1821 return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev), req);
1824 static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1825 struct cfg80211_assoc_request *req)
1827 struct ieee80211_local *local = wiphy_priv(wiphy);
1828 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1830 switch (ieee80211_get_channel_mode(local, sdata)) {
1831 case CHAN_MODE_HOPPING:
1833 case CHAN_MODE_FIXED:
1834 if (local->oper_channel == req->bss->channel)
1837 case CHAN_MODE_UNDEFINED:
1841 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req);
1844 static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev,
1845 struct cfg80211_deauth_request *req)
1847 return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev), req);
1850 static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev,
1851 struct cfg80211_disassoc_request *req)
1853 return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev), req);
1856 static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1857 struct cfg80211_ibss_params *params)
1859 struct ieee80211_local *local = wiphy_priv(wiphy);
1860 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1862 switch (ieee80211_get_channel_mode(local, sdata)) {
1863 case CHAN_MODE_HOPPING:
1865 case CHAN_MODE_FIXED:
1866 if (!params->channel_fixed)
1868 if (local->oper_channel == params->channel)
1871 case CHAN_MODE_UNDEFINED:
1875 return ieee80211_ibss_join(sdata, params);
1878 static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1880 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1882 return ieee80211_ibss_leave(sdata);
1885 static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
1887 struct ieee80211_local *local = wiphy_priv(wiphy);
1890 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
1891 err = drv_set_frag_threshold(local, wiphy->frag_threshold);
1897 if (changed & WIPHY_PARAM_COVERAGE_CLASS) {
1898 err = drv_set_coverage_class(local, wiphy->coverage_class);
1904 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
1905 err = drv_set_rts_threshold(local, wiphy->rts_threshold);
1911 if (changed & WIPHY_PARAM_RETRY_SHORT)
1912 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
1913 if (changed & WIPHY_PARAM_RETRY_LONG)
1914 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
1916 (WIPHY_PARAM_RETRY_SHORT | WIPHY_PARAM_RETRY_LONG))
1917 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
1922 static int ieee80211_set_tx_power(struct wiphy *wiphy,
1923 enum nl80211_tx_power_setting type, int mbm)
1925 struct ieee80211_local *local = wiphy_priv(wiphy);
1926 struct ieee80211_channel *chan = local->hw.conf.channel;
1930 case NL80211_TX_POWER_AUTOMATIC:
1931 local->user_power_level = -1;
1933 case NL80211_TX_POWER_LIMITED:
1934 if (mbm < 0 || (mbm % 100))
1936 local->user_power_level = MBM_TO_DBM(mbm);
1938 case NL80211_TX_POWER_FIXED:
1939 if (mbm < 0 || (mbm % 100))
1941 /* TODO: move to cfg80211 when it knows the channel */
1942 if (MBM_TO_DBM(mbm) > chan->max_power)
1944 local->user_power_level = MBM_TO_DBM(mbm);
1948 ieee80211_hw_config(local, changes);
1953 static int ieee80211_get_tx_power(struct wiphy *wiphy, int *dbm)
1955 struct ieee80211_local *local = wiphy_priv(wiphy);
1957 *dbm = local->hw.conf.power_level;
1962 static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
1965 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1967 memcpy(&sdata->u.wds.remote_addr, addr, ETH_ALEN);
1972 static void ieee80211_rfkill_poll(struct wiphy *wiphy)
1974 struct ieee80211_local *local = wiphy_priv(wiphy);
1976 drv_rfkill_poll(local);
1979 #ifdef CONFIG_NL80211_TESTMODE
1980 static int ieee80211_testmode_cmd(struct wiphy *wiphy, void *data, int len)
1982 struct ieee80211_local *local = wiphy_priv(wiphy);
1984 if (!local->ops->testmode_cmd)
1987 return local->ops->testmode_cmd(&local->hw, data, len);
1990 static int ieee80211_testmode_dump(struct wiphy *wiphy,
1991 struct sk_buff *skb,
1992 struct netlink_callback *cb,
1993 void *data, int len)
1995 struct ieee80211_local *local = wiphy_priv(wiphy);
1997 if (!local->ops->testmode_dump)
2000 return local->ops->testmode_dump(&local->hw, skb, cb, data, len);
2004 int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
2005 enum ieee80211_smps_mode smps_mode)
2008 enum ieee80211_smps_mode old_req;
2011 lockdep_assert_held(&sdata->u.mgd.mtx);
2013 old_req = sdata->u.mgd.req_smps;
2014 sdata->u.mgd.req_smps = smps_mode;
2016 if (old_req == smps_mode &&
2017 smps_mode != IEEE80211_SMPS_AUTOMATIC)
2021 * If not associated, or current association is not an HT
2022 * association, there's no need to send an action frame.
2024 if (!sdata->u.mgd.associated ||
2025 sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) {
2026 mutex_lock(&sdata->local->iflist_mtx);
2027 ieee80211_recalc_smps(sdata->local);
2028 mutex_unlock(&sdata->local->iflist_mtx);
2032 ap = sdata->u.mgd.associated->bssid;
2034 if (smps_mode == IEEE80211_SMPS_AUTOMATIC) {
2035 if (sdata->u.mgd.powersave)
2036 smps_mode = IEEE80211_SMPS_DYNAMIC;
2038 smps_mode = IEEE80211_SMPS_OFF;
2041 /* send SM PS frame to AP */
2042 err = ieee80211_send_smps_action(sdata, smps_mode,
2045 sdata->u.mgd.req_smps = old_req;
2050 static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
2051 bool enabled, int timeout)
2053 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2054 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2056 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2059 if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
2062 if (enabled == sdata->u.mgd.powersave &&
2063 timeout == local->dynamic_ps_forced_timeout)
2066 sdata->u.mgd.powersave = enabled;
2067 local->dynamic_ps_forced_timeout = timeout;
2069 /* no change, but if automatic follow powersave */
2070 mutex_lock(&sdata->u.mgd.mtx);
2071 __ieee80211_request_smps(sdata, sdata->u.mgd.req_smps);
2072 mutex_unlock(&sdata->u.mgd.mtx);
2074 if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)
2075 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
2077 ieee80211_recalc_ps(local, -1);
2082 static int ieee80211_set_cqm_rssi_config(struct wiphy *wiphy,
2083 struct net_device *dev,
2084 s32 rssi_thold, u32 rssi_hyst)
2086 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2087 struct ieee80211_vif *vif = &sdata->vif;
2088 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
2090 if (rssi_thold == bss_conf->cqm_rssi_thold &&
2091 rssi_hyst == bss_conf->cqm_rssi_hyst)
2094 bss_conf->cqm_rssi_thold = rssi_thold;
2095 bss_conf->cqm_rssi_hyst = rssi_hyst;
2097 /* tell the driver upon association, unless already associated */
2098 if (sdata->u.mgd.associated &&
2099 sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)
2100 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_CQM);
2105 static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
2106 struct net_device *dev,
2108 const struct cfg80211_bitrate_mask *mask)
2110 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2111 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2114 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
2115 ret = drv_set_bitrate_mask(local, sdata, mask);
2120 for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
2121 sdata->rc_rateidx_mask[i] = mask->control[i].legacy;
2122 memcpy(sdata->rc_rateidx_mcs_mask[i], mask->control[i].mcs,
2123 sizeof(mask->control[i].mcs));
2129 static int ieee80211_start_roc_work(struct ieee80211_local *local,
2130 struct ieee80211_sub_if_data *sdata,
2131 struct ieee80211_channel *channel,
2132 enum nl80211_channel_type channel_type,
2133 unsigned int duration, u64 *cookie,
2134 struct sk_buff *txskb)
2136 struct ieee80211_roc_work *roc, *tmp;
2137 bool queued = false;
2140 lockdep_assert_held(&local->mtx);
2142 roc = kzalloc(sizeof(*roc), GFP_KERNEL);
2146 roc->chan = channel;
2147 roc->chan_type = channel_type;
2148 roc->duration = duration;
2149 roc->req_duration = duration;
2151 roc->mgmt_tx_cookie = (unsigned long)txskb;
2153 INIT_DELAYED_WORK(&roc->work, ieee80211_sw_roc_work);
2154 INIT_LIST_HEAD(&roc->dependents);
2156 /* if there's one pending or we're scanning, queue this one */
2157 if (!list_empty(&local->roc_list) || local->scanning)
2158 goto out_check_combine;
2160 /* if not HW assist, just queue & schedule work */
2161 if (!local->ops->remain_on_channel) {
2162 ieee80211_queue_delayed_work(&local->hw, &roc->work, 0);
2166 /* otherwise actually kick it off here (for error handling) */
2169 * If the duration is zero, then the driver
2170 * wouldn't actually do anything. Set it to
2173 * TODO: cancel the off-channel operation
2174 * when we get the SKB's TX status and
2175 * the wait time was zero before.
2180 ret = drv_remain_on_channel(local, channel, channel_type, duration);
2186 roc->started = true;
2190 list_for_each_entry(tmp, &local->roc_list, list) {
2191 if (tmp->chan != channel || tmp->chan_type != channel_type)
2195 * Extend this ROC if possible:
2197 * If it hasn't started yet, just increase the duration
2198 * and add the new one to the list of dependents.
2200 if (!tmp->started) {
2201 list_add_tail(&roc->list, &tmp->dependents);
2202 tmp->duration = max(tmp->duration, roc->duration);
2207 /* If it has already started, it's more difficult ... */
2208 if (local->ops->remain_on_channel) {
2209 unsigned long j = jiffies;
2212 * In the offloaded ROC case, if it hasn't begun, add
2213 * this new one to the dependent list to be handled
2214 * when the the master one begins. If it has begun,
2215 * check that there's still a minimum time left and
2216 * if so, start this one, transmitting the frame, but
2217 * add it to the list directly after this one with a
2218 * a reduced time so we'll ask the driver to execute
2219 * it right after finishing the previous one, in the
2220 * hope that it'll also be executed right afterwards,
2221 * effectively extending the old one.
2222 * If there's no minimum time left, just add it to the
2225 if (!tmp->hw_begun) {
2226 list_add_tail(&roc->list, &tmp->dependents);
2231 if (time_before(j + IEEE80211_ROC_MIN_LEFT,
2232 tmp->hw_start_time +
2233 msecs_to_jiffies(tmp->duration))) {
2236 ieee80211_handle_roc_started(roc);
2238 new_dur = roc->duration -
2239 jiffies_to_msecs(tmp->hw_start_time +
2245 /* add right after tmp */
2246 list_add(&roc->list, &tmp->list);
2248 list_add_tail(&roc->list,
2253 } else if (del_timer_sync(&tmp->work.timer)) {
2254 unsigned long new_end;
2257 * In the software ROC case, cancel the timer, if
2258 * that fails then the finish work is already
2259 * queued/pending and thus we queue the new ROC
2260 * normally, if that succeeds then we can extend
2261 * the timer duration and TX the frame (if any.)
2264 list_add_tail(&roc->list, &tmp->dependents);
2267 new_end = jiffies + msecs_to_jiffies(roc->duration);
2269 /* ok, it was started & we canceled timer */
2270 if (time_after(new_end, tmp->work.timer.expires))
2271 mod_timer(&tmp->work.timer, new_end);
2273 add_timer(&tmp->work.timer);
2275 ieee80211_handle_roc_started(roc);
2282 list_add_tail(&roc->list, &local->roc_list);
2285 * cookie is either the roc (for normal roc)
2286 * or the SKB (for mgmt TX)
2289 *cookie = (unsigned long)txskb;
2291 *cookie = (unsigned long)roc;
2296 static int ieee80211_remain_on_channel(struct wiphy *wiphy,
2297 struct net_device *dev,
2298 struct ieee80211_channel *chan,
2299 enum nl80211_channel_type channel_type,
2300 unsigned int duration,
2303 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2304 struct ieee80211_local *local = sdata->local;
2307 mutex_lock(&local->mtx);
2308 ret = ieee80211_start_roc_work(local, sdata, chan, channel_type,
2309 duration, cookie, NULL);
2310 mutex_unlock(&local->mtx);
2315 static int ieee80211_cancel_roc(struct ieee80211_local *local,
2316 u64 cookie, bool mgmt_tx)
2318 struct ieee80211_roc_work *roc, *tmp, *found = NULL;
2321 mutex_lock(&local->mtx);
2322 list_for_each_entry_safe(roc, tmp, &local->roc_list, list) {
2323 struct ieee80211_roc_work *dep, *tmp2;
2325 list_for_each_entry_safe(dep, tmp2, &roc->dependents, list) {
2326 if (!mgmt_tx && (unsigned long)dep != cookie)
2328 else if (mgmt_tx && dep->mgmt_tx_cookie != cookie)
2330 /* found dependent item -- just remove it */
2331 list_del(&dep->list);
2332 mutex_unlock(&local->mtx);
2334 ieee80211_roc_notify_destroy(dep);
2338 if (!mgmt_tx && (unsigned long)roc != cookie)
2340 else if (mgmt_tx && roc->mgmt_tx_cookie != cookie)
2348 mutex_unlock(&local->mtx);
2353 * We found the item to cancel, so do that. Note that it
2354 * may have dependents, which we also cancel (and send
2355 * the expired signal for.) Not doing so would be quite
2356 * tricky here, but we may need to fix it later.
2359 if (local->ops->remain_on_channel) {
2360 if (found->started) {
2361 ret = drv_cancel_remain_on_channel(local);
2362 if (WARN_ON_ONCE(ret)) {
2363 mutex_unlock(&local->mtx);
2368 list_del(&found->list);
2371 ieee80211_start_next_roc(local);
2372 mutex_unlock(&local->mtx);
2374 ieee80211_roc_notify_destroy(found);
2376 /* work may be pending so use it all the time */
2377 found->abort = true;
2378 ieee80211_queue_delayed_work(&local->hw, &found->work, 0);
2380 mutex_unlock(&local->mtx);
2382 /* work will clean up etc */
2383 flush_delayed_work(&found->work);
2389 static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
2390 struct net_device *dev,
2393 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2394 struct ieee80211_local *local = sdata->local;
2396 return ieee80211_cancel_roc(local, cookie, false);
2399 static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
2400 struct ieee80211_channel *chan, bool offchan,
2401 enum nl80211_channel_type channel_type,
2402 bool channel_type_valid, unsigned int wait,
2403 const u8 *buf, size_t len, bool no_cck,
2404 bool dont_wait_for_ack, u64 *cookie)
2406 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2407 struct ieee80211_local *local = sdata->local;
2408 struct sk_buff *skb;
2409 struct sta_info *sta;
2410 const struct ieee80211_mgmt *mgmt = (void *)buf;
2411 bool need_offchan = false;
2415 if (dont_wait_for_ack)
2416 flags = IEEE80211_TX_CTL_NO_ACK;
2418 flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX |
2419 IEEE80211_TX_CTL_REQ_TX_STATUS;
2422 flags |= IEEE80211_TX_CTL_NO_CCK_RATE;
2424 switch (sdata->vif.type) {
2425 case NL80211_IFTYPE_ADHOC:
2426 if (!sdata->vif.bss_conf.ibss_joined)
2427 need_offchan = true;
2429 #ifdef CONFIG_MAC80211_MESH
2430 case NL80211_IFTYPE_MESH_POINT:
2431 if (ieee80211_vif_is_mesh(&sdata->vif) &&
2432 !sdata->u.mesh.mesh_id_len)
2433 need_offchan = true;
2436 case NL80211_IFTYPE_AP:
2437 case NL80211_IFTYPE_AP_VLAN:
2438 case NL80211_IFTYPE_P2P_GO:
2439 if (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
2440 !ieee80211_vif_is_mesh(&sdata->vif) &&
2441 !rcu_access_pointer(sdata->bss->beacon))
2442 need_offchan = true;
2443 if (!ieee80211_is_action(mgmt->frame_control) ||
2444 mgmt->u.action.category == WLAN_CATEGORY_PUBLIC)
2447 sta = sta_info_get(sdata, mgmt->da);
2452 case NL80211_IFTYPE_STATION:
2453 case NL80211_IFTYPE_P2P_CLIENT:
2454 if (!sdata->u.mgd.associated)
2455 need_offchan = true;
2461 mutex_lock(&local->mtx);
2463 /* Check if the operating channel is the requested channel */
2464 if (!need_offchan) {
2465 need_offchan = chan != local->oper_channel;
2466 if (channel_type_valid &&
2467 channel_type != local->_oper_channel_type)
2468 need_offchan = true;
2471 if (need_offchan && !offchan) {
2476 skb = dev_alloc_skb(local->hw.extra_tx_headroom + len);
2481 skb_reserve(skb, local->hw.extra_tx_headroom);
2483 memcpy(skb_put(skb, len), buf, len);
2485 IEEE80211_SKB_CB(skb)->flags = flags;
2487 skb->dev = sdata->dev;
2489 if (!need_offchan) {
2490 ieee80211_tx_skb(sdata, skb);
2495 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_TX_OFFCHAN;
2496 if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)
2497 IEEE80211_SKB_CB(skb)->hw_queue =
2498 local->hw.offchannel_tx_hw_queue;
2500 /* This will handle all kinds of coalescing and immediate TX */
2501 ret = ieee80211_start_roc_work(local, sdata, chan, channel_type,
2506 mutex_unlock(&local->mtx);
2510 static int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
2511 struct net_device *dev,
2514 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2515 struct ieee80211_local *local = sdata->local;
2517 return ieee80211_cancel_roc(local, cookie, true);
2520 static void ieee80211_mgmt_frame_register(struct wiphy *wiphy,
2521 struct net_device *dev,
2522 u16 frame_type, bool reg)
2524 struct ieee80211_local *local = wiphy_priv(wiphy);
2525 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2527 switch (frame_type) {
2528 case IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH:
2529 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
2530 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
2533 ifibss->auth_frame_registrations++;
2535 ifibss->auth_frame_registrations--;
2538 case IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ:
2540 local->probe_req_reg++;
2542 local->probe_req_reg--;
2544 ieee80211_queue_work(&local->hw, &local->reconfig_filter);
2551 static int ieee80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
2553 struct ieee80211_local *local = wiphy_priv(wiphy);
2558 return drv_set_antenna(local, tx_ant, rx_ant);
2561 static int ieee80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant)
2563 struct ieee80211_local *local = wiphy_priv(wiphy);
2565 return drv_get_antenna(local, tx_ant, rx_ant);
2568 static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx)
2570 struct ieee80211_local *local = wiphy_priv(wiphy);
2572 return drv_set_ringparam(local, tx, rx);
2575 static void ieee80211_get_ringparam(struct wiphy *wiphy,
2576 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
2578 struct ieee80211_local *local = wiphy_priv(wiphy);
2580 drv_get_ringparam(local, tx, tx_max, rx, rx_max);
2583 static int ieee80211_set_rekey_data(struct wiphy *wiphy,
2584 struct net_device *dev,
2585 struct cfg80211_gtk_rekey_data *data)
2587 struct ieee80211_local *local = wiphy_priv(wiphy);
2588 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2590 if (!local->ops->set_rekey_data)
2593 drv_set_rekey_data(local, sdata, data);
2598 static void ieee80211_tdls_add_ext_capab(struct sk_buff *skb)
2600 u8 *pos = (void *)skb_put(skb, 7);
2602 *pos++ = WLAN_EID_EXT_CAPABILITY;
2603 *pos++ = 5; /* len */
2608 *pos++ = WLAN_EXT_CAPA5_TDLS_ENABLED;
2611 static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata)
2613 struct ieee80211_local *local = sdata->local;
2617 if (local->oper_channel->band != IEEE80211_BAND_2GHZ)
2620 if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE))
2621 capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME;
2622 if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE))
2623 capab |= WLAN_CAPABILITY_SHORT_PREAMBLE;
2628 static void ieee80211_tdls_add_link_ie(struct sk_buff *skb, u8 *src_addr,
2629 u8 *peer, u8 *bssid)
2631 struct ieee80211_tdls_lnkie *lnkid;
2633 lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie));
2635 lnkid->ie_type = WLAN_EID_LINK_ID;
2636 lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2;
2638 memcpy(lnkid->bssid, bssid, ETH_ALEN);
2639 memcpy(lnkid->init_sta, src_addr, ETH_ALEN);
2640 memcpy(lnkid->resp_sta, peer, ETH_ALEN);
2644 ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev,
2645 u8 *peer, u8 action_code, u8 dialog_token,
2646 u16 status_code, struct sk_buff *skb)
2648 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2649 struct ieee80211_tdls_data *tf;
2651 tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u));
2653 memcpy(tf->da, peer, ETH_ALEN);
2654 memcpy(tf->sa, sdata->vif.addr, ETH_ALEN);
2655 tf->ether_type = cpu_to_be16(ETH_P_TDLS);
2656 tf->payload_type = WLAN_TDLS_SNAP_RFTYPE;
2658 switch (action_code) {
2659 case WLAN_TDLS_SETUP_REQUEST:
2660 tf->category = WLAN_CATEGORY_TDLS;
2661 tf->action_code = WLAN_TDLS_SETUP_REQUEST;
2663 skb_put(skb, sizeof(tf->u.setup_req));
2664 tf->u.setup_req.dialog_token = dialog_token;
2665 tf->u.setup_req.capability =
2666 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2668 ieee80211_add_srates_ie(sdata, skb, false);
2669 ieee80211_add_ext_srates_ie(sdata, skb, false);
2670 ieee80211_tdls_add_ext_capab(skb);
2672 case WLAN_TDLS_SETUP_RESPONSE:
2673 tf->category = WLAN_CATEGORY_TDLS;
2674 tf->action_code = WLAN_TDLS_SETUP_RESPONSE;
2676 skb_put(skb, sizeof(tf->u.setup_resp));
2677 tf->u.setup_resp.status_code = cpu_to_le16(status_code);
2678 tf->u.setup_resp.dialog_token = dialog_token;
2679 tf->u.setup_resp.capability =
2680 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2682 ieee80211_add_srates_ie(sdata, skb, false);
2683 ieee80211_add_ext_srates_ie(sdata, skb, false);
2684 ieee80211_tdls_add_ext_capab(skb);
2686 case WLAN_TDLS_SETUP_CONFIRM:
2687 tf->category = WLAN_CATEGORY_TDLS;
2688 tf->action_code = WLAN_TDLS_SETUP_CONFIRM;
2690 skb_put(skb, sizeof(tf->u.setup_cfm));
2691 tf->u.setup_cfm.status_code = cpu_to_le16(status_code);
2692 tf->u.setup_cfm.dialog_token = dialog_token;
2694 case WLAN_TDLS_TEARDOWN:
2695 tf->category = WLAN_CATEGORY_TDLS;
2696 tf->action_code = WLAN_TDLS_TEARDOWN;
2698 skb_put(skb, sizeof(tf->u.teardown));
2699 tf->u.teardown.reason_code = cpu_to_le16(status_code);
2701 case WLAN_TDLS_DISCOVERY_REQUEST:
2702 tf->category = WLAN_CATEGORY_TDLS;
2703 tf->action_code = WLAN_TDLS_DISCOVERY_REQUEST;
2705 skb_put(skb, sizeof(tf->u.discover_req));
2706 tf->u.discover_req.dialog_token = dialog_token;
2716 ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev,
2717 u8 *peer, u8 action_code, u8 dialog_token,
2718 u16 status_code, struct sk_buff *skb)
2720 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2721 struct ieee80211_mgmt *mgmt;
2723 mgmt = (void *)skb_put(skb, 24);
2724 memset(mgmt, 0, 24);
2725 memcpy(mgmt->da, peer, ETH_ALEN);
2726 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
2727 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
2729 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
2730 IEEE80211_STYPE_ACTION);
2732 switch (action_code) {
2733 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
2734 skb_put(skb, 1 + sizeof(mgmt->u.action.u.tdls_discover_resp));
2735 mgmt->u.action.category = WLAN_CATEGORY_PUBLIC;
2736 mgmt->u.action.u.tdls_discover_resp.action_code =
2737 WLAN_PUB_ACTION_TDLS_DISCOVER_RES;
2738 mgmt->u.action.u.tdls_discover_resp.dialog_token =
2740 mgmt->u.action.u.tdls_discover_resp.capability =
2741 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2743 ieee80211_add_srates_ie(sdata, skb, false);
2744 ieee80211_add_ext_srates_ie(sdata, skb, false);
2745 ieee80211_tdls_add_ext_capab(skb);
2754 static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
2755 u8 *peer, u8 action_code, u8 dialog_token,
2756 u16 status_code, const u8 *extra_ies,
2757 size_t extra_ies_len)
2759 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2760 struct ieee80211_local *local = sdata->local;
2761 struct ieee80211_tx_info *info;
2762 struct sk_buff *skb = NULL;
2766 if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS))
2769 /* make sure we are in managed mode, and associated */
2770 if (sdata->vif.type != NL80211_IFTYPE_STATION ||
2771 !sdata->u.mgd.associated)
2774 tdls_dbg(sdata, "TDLS mgmt action %d peer %pM\n",
2777 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
2778 max(sizeof(struct ieee80211_mgmt),
2779 sizeof(struct ieee80211_tdls_data)) +
2780 50 + /* supported rates */
2783 sizeof(struct ieee80211_tdls_lnkie));
2787 info = IEEE80211_SKB_CB(skb);
2788 skb_reserve(skb, local->hw.extra_tx_headroom);
2790 switch (action_code) {
2791 case WLAN_TDLS_SETUP_REQUEST:
2792 case WLAN_TDLS_SETUP_RESPONSE:
2793 case WLAN_TDLS_SETUP_CONFIRM:
2794 case WLAN_TDLS_TEARDOWN:
2795 case WLAN_TDLS_DISCOVERY_REQUEST:
2796 ret = ieee80211_prep_tdls_encap_data(wiphy, dev, peer,
2797 action_code, dialog_token,
2799 send_direct = false;
2801 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
2802 ret = ieee80211_prep_tdls_direct(wiphy, dev, peer, action_code,
2803 dialog_token, status_code,
2816 memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len);
2818 /* the TDLS link IE is always added last */
2819 switch (action_code) {
2820 case WLAN_TDLS_SETUP_REQUEST:
2821 case WLAN_TDLS_SETUP_CONFIRM:
2822 case WLAN_TDLS_TEARDOWN:
2823 case WLAN_TDLS_DISCOVERY_REQUEST:
2824 /* we are the initiator */
2825 ieee80211_tdls_add_link_ie(skb, sdata->vif.addr, peer,
2826 sdata->u.mgd.bssid);
2828 case WLAN_TDLS_SETUP_RESPONSE:
2829 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
2830 /* we are the responder */
2831 ieee80211_tdls_add_link_ie(skb, peer, sdata->vif.addr,
2832 sdata->u.mgd.bssid);
2840 ieee80211_tx_skb(sdata, skb);
2845 * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise
2846 * we should default to AC_VI.
2848 switch (action_code) {
2849 case WLAN_TDLS_SETUP_REQUEST:
2850 case WLAN_TDLS_SETUP_RESPONSE:
2851 skb_set_queue_mapping(skb, IEEE80211_AC_BK);
2855 skb_set_queue_mapping(skb, IEEE80211_AC_VI);
2860 /* disable bottom halves when entering the Tx path */
2862 ret = ieee80211_subif_start_xmit(skb, dev);
2872 static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
2873 u8 *peer, enum nl80211_tdls_operation oper)
2875 struct sta_info *sta;
2876 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2878 if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS))
2881 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2884 tdls_dbg(sdata, "TDLS oper %d peer %pM\n", oper, peer);
2887 case NL80211_TDLS_ENABLE_LINK:
2889 sta = sta_info_get(sdata, peer);
2895 set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH);
2898 case NL80211_TDLS_DISABLE_LINK:
2899 return sta_info_destroy_addr(sdata, peer);
2900 case NL80211_TDLS_TEARDOWN:
2901 case NL80211_TDLS_SETUP:
2902 case NL80211_TDLS_DISCOVERY_REQ:
2903 /* We don't support in-driver setup/teardown/discovery */
2912 static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
2913 const u8 *peer, u64 *cookie)
2915 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2916 struct ieee80211_local *local = sdata->local;
2917 struct ieee80211_qos_hdr *nullfunc;
2918 struct sk_buff *skb;
2919 int size = sizeof(*nullfunc);
2922 struct ieee80211_tx_info *info;
2923 struct sta_info *sta;
2926 sta = sta_info_get(sdata, peer);
2928 qos = test_sta_flag(sta, WLAN_STA_WME);
2936 fc = cpu_to_le16(IEEE80211_FTYPE_DATA |
2937 IEEE80211_STYPE_QOS_NULLFUNC |
2938 IEEE80211_FCTL_FROMDS);
2941 fc = cpu_to_le16(IEEE80211_FTYPE_DATA |
2942 IEEE80211_STYPE_NULLFUNC |
2943 IEEE80211_FCTL_FROMDS);
2946 skb = dev_alloc_skb(local->hw.extra_tx_headroom + size);
2952 skb_reserve(skb, local->hw.extra_tx_headroom);
2954 nullfunc = (void *) skb_put(skb, size);
2955 nullfunc->frame_control = fc;
2956 nullfunc->duration_id = 0;
2957 memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN);
2958 memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN);
2959 memcpy(nullfunc->addr3, sdata->vif.addr, ETH_ALEN);
2960 nullfunc->seq_ctrl = 0;
2962 info = IEEE80211_SKB_CB(skb);
2964 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS |
2965 IEEE80211_TX_INTFL_NL80211_FRAME_TX;
2967 skb_set_queue_mapping(skb, IEEE80211_AC_VO);
2970 nullfunc->qos_ctrl = cpu_to_le16(7);
2973 ieee80211_xmit(sdata, skb);
2976 *cookie = (unsigned long) skb;
2980 static struct ieee80211_channel *
2981 ieee80211_wiphy_get_channel(struct wiphy *wiphy,
2982 enum nl80211_channel_type *type)
2984 struct ieee80211_local *local = wiphy_priv(wiphy);
2986 *type = local->_oper_channel_type;
2987 return local->oper_channel;
2991 static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled)
2993 drv_set_wakeup(wiphy_priv(wiphy), enabled);
2997 struct cfg80211_ops mac80211_config_ops = {
2998 .add_virtual_intf = ieee80211_add_iface,
2999 .del_virtual_intf = ieee80211_del_iface,
3000 .change_virtual_intf = ieee80211_change_iface,
3001 .add_key = ieee80211_add_key,
3002 .del_key = ieee80211_del_key,
3003 .get_key = ieee80211_get_key,
3004 .set_default_key = ieee80211_config_default_key,
3005 .set_default_mgmt_key = ieee80211_config_default_mgmt_key,
3006 .start_ap = ieee80211_start_ap,
3007 .change_beacon = ieee80211_change_beacon,
3008 .stop_ap = ieee80211_stop_ap,
3009 .add_station = ieee80211_add_station,
3010 .del_station = ieee80211_del_station,
3011 .change_station = ieee80211_change_station,
3012 .get_station = ieee80211_get_station,
3013 .dump_station = ieee80211_dump_station,
3014 .dump_survey = ieee80211_dump_survey,
3015 #ifdef CONFIG_MAC80211_MESH
3016 .add_mpath = ieee80211_add_mpath,
3017 .del_mpath = ieee80211_del_mpath,
3018 .change_mpath = ieee80211_change_mpath,
3019 .get_mpath = ieee80211_get_mpath,
3020 .dump_mpath = ieee80211_dump_mpath,
3021 .update_mesh_config = ieee80211_update_mesh_config,
3022 .get_mesh_config = ieee80211_get_mesh_config,
3023 .join_mesh = ieee80211_join_mesh,
3024 .leave_mesh = ieee80211_leave_mesh,
3026 .change_bss = ieee80211_change_bss,
3027 .set_txq_params = ieee80211_set_txq_params,
3028 .set_monitor_channel = ieee80211_set_monitor_channel,
3029 .suspend = ieee80211_suspend,
3030 .resume = ieee80211_resume,
3031 .scan = ieee80211_scan,
3032 .sched_scan_start = ieee80211_sched_scan_start,
3033 .sched_scan_stop = ieee80211_sched_scan_stop,
3034 .auth = ieee80211_auth,
3035 .assoc = ieee80211_assoc,
3036 .deauth = ieee80211_deauth,
3037 .disassoc = ieee80211_disassoc,
3038 .join_ibss = ieee80211_join_ibss,
3039 .leave_ibss = ieee80211_leave_ibss,
3040 .set_wiphy_params = ieee80211_set_wiphy_params,
3041 .set_tx_power = ieee80211_set_tx_power,
3042 .get_tx_power = ieee80211_get_tx_power,
3043 .set_wds_peer = ieee80211_set_wds_peer,
3044 .rfkill_poll = ieee80211_rfkill_poll,
3045 CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
3046 CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump)
3047 .set_power_mgmt = ieee80211_set_power_mgmt,
3048 .set_bitrate_mask = ieee80211_set_bitrate_mask,
3049 .remain_on_channel = ieee80211_remain_on_channel,
3050 .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel,
3051 .mgmt_tx = ieee80211_mgmt_tx,
3052 .mgmt_tx_cancel_wait = ieee80211_mgmt_tx_cancel_wait,
3053 .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config,
3054 .mgmt_frame_register = ieee80211_mgmt_frame_register,
3055 .set_antenna = ieee80211_set_antenna,
3056 .get_antenna = ieee80211_get_antenna,
3057 .set_ringparam = ieee80211_set_ringparam,
3058 .get_ringparam = ieee80211_get_ringparam,
3059 .set_rekey_data = ieee80211_set_rekey_data,
3060 .tdls_oper = ieee80211_tdls_oper,
3061 .tdls_mgmt = ieee80211_tdls_mgmt,
3062 .probe_client = ieee80211_probe_client,
3063 .get_channel = ieee80211_wiphy_get_channel,
3064 .set_noack_map = ieee80211_set_noack_map,
3066 .set_wakeup = ieee80211_set_wakeup,
3068 .get_et_sset_count = ieee80211_get_et_sset_count,
3069 .get_et_stats = ieee80211_get_et_stats,
3070 .get_et_strings = ieee80211_get_et_strings,