Lines Matching +full:sar +full:- +full:threshold +full:- +full:num

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
6 * Copyright 2013-2015 Intel Mobile Communications GmbH
7 * Copyright (C) 2015-2017 Intel Deutschland GmbH
8 * Copyright (C) 2018-2024 Intel Corporation
21 #include "driver-ops.h"
38 if (require_valid && ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_link_or_deflink()
39 return ERR_PTR(-EINVAL); in ieee80211_link_or_deflink()
41 return &sdata->deflink; in ieee80211_link_or_deflink()
44 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_link_or_deflink()
46 return ERR_PTR(-ENOLINK); in ieee80211_link_or_deflink()
56 if (params->vht_mumimo_groups) { in ieee80211_set_mu_mimo_follow()
61 memcpy(sdata->vif.bss_conf.mu_group.membership, in ieee80211_set_mu_mimo_follow()
62 params->vht_mumimo_groups, WLAN_MEMBERSHIP_LEN); in ieee80211_set_mu_mimo_follow()
63 memcpy(sdata->vif.bss_conf.mu_group.position, in ieee80211_set_mu_mimo_follow()
64 params->vht_mumimo_groups + WLAN_MEMBERSHIP_LEN, in ieee80211_set_mu_mimo_follow()
66 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_set_mu_mimo_follow()
68 /* don't care about endianness - just check for 0 */ in ieee80211_set_mu_mimo_follow()
69 memcpy(&membership, params->vht_mumimo_groups, in ieee80211_set_mu_mimo_follow()
74 if (params->vht_mumimo_follow_addr) { in ieee80211_set_mu_mimo_follow()
76 is_valid_ether_addr(params->vht_mumimo_follow_addr); in ieee80211_set_mu_mimo_follow()
77 ether_addr_copy(sdata->u.mntr.mu_follow_addr, in ieee80211_set_mu_mimo_follow()
78 params->vht_mumimo_follow_addr); in ieee80211_set_mu_mimo_follow()
81 sdata->vif.bss_conf.mu_mimo_owner = mu_mimo_groups || mu_mimo_follow; in ieee80211_set_mu_mimo_follow()
87 struct ieee80211_local *local = sdata->local; in ieee80211_set_mon_options()
91 if (params->flags && ieee80211_sdata_running(sdata)) { in ieee80211_set_mon_options()
103 if ((params->flags & mask) != (sdata->u.mntr.flags & mask)) in ieee80211_set_mon_options()
104 return -EBUSY; in ieee80211_set_mon_options()
107 /* also validate MU-MIMO change */ in ieee80211_set_mon_options()
108 monitor_sdata = wiphy_dereference(local->hw.wiphy, in ieee80211_set_mon_options()
109 local->monitor_sdata); in ieee80211_set_mon_options()
112 (params->vht_mumimo_groups || params->vht_mumimo_follow_addr)) in ieee80211_set_mon_options()
113 return -EOPNOTSUPP; in ieee80211_set_mon_options()
115 /* apply all changes now - no failures allowed */ in ieee80211_set_mon_options()
117 if (monitor_sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) in ieee80211_set_mon_options()
120 if (params->flags) { in ieee80211_set_mon_options()
122 ieee80211_adjust_monitor_flags(sdata, -1); in ieee80211_set_mon_options()
123 sdata->u.mntr.flags = params->flags; in ieee80211_set_mon_options()
133 sdata->u.mntr.flags = params->flags; in ieee80211_set_mon_options()
146 sdata->vif.mbssid_tx_vif = NULL; in ieee80211_set_ap_mbssid_options()
147 link_conf->bssid_index = 0; in ieee80211_set_ap_mbssid_options()
148 link_conf->nontransmitted = false; in ieee80211_set_ap_mbssid_options()
149 link_conf->ema_ap = false; in ieee80211_set_ap_mbssid_options()
150 link_conf->bssid_indicator = 0; in ieee80211_set_ap_mbssid_options()
152 if (sdata->vif.type != NL80211_IFTYPE_AP || !params.tx_wdev) in ieee80211_set_ap_mbssid_options()
153 return -EINVAL; in ieee80211_set_ap_mbssid_options()
157 return -EINVAL; in ieee80211_set_ap_mbssid_options()
160 sdata->vif.mbssid_tx_vif = &sdata->vif; in ieee80211_set_ap_mbssid_options()
162 sdata->vif.mbssid_tx_vif = &tx_sdata->vif; in ieee80211_set_ap_mbssid_options()
163 link_conf->nontransmitted = true; in ieee80211_set_ap_mbssid_options()
164 link_conf->bssid_index = params.index; in ieee80211_set_ap_mbssid_options()
167 link_conf->ema_ap = true; in ieee80211_set_ap_mbssid_options()
213 struct ieee80211_local *local = sdata->local; in ieee80211_change_iface()
217 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_change_iface()
223 if (type == NL80211_IFTYPE_AP_VLAN && params->use_4addr == 0) { in ieee80211_change_iface()
224 RCU_INIT_POINTER(sdata->u.vlan.sta, NULL); in ieee80211_change_iface()
226 } else if (type == NL80211_IFTYPE_STATION && params->use_4addr >= 0) { in ieee80211_change_iface()
227 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_change_iface()
229 if (params->use_4addr == ifmgd->use_4addr) in ieee80211_change_iface()
232 /* FIXME: no support for 4-addr MLO yet */ in ieee80211_change_iface()
233 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_change_iface()
234 return -EOPNOTSUPP; in ieee80211_change_iface()
236 sdata->u.mgd.use_4addr = params->use_4addr; in ieee80211_change_iface()
237 if (!ifmgd->associated) in ieee80211_change_iface()
240 sta = sta_info_get(sdata, sdata->deflink.u.mgd.bssid); in ieee80211_change_iface()
242 drv_sta_set_4addr(local, sdata, &sta->sta, in ieee80211_change_iface()
243 params->use_4addr); in ieee80211_change_iface()
245 if (params->use_4addr) in ieee80211_change_iface()
249 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { in ieee80211_change_iface()
264 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_start_p2p_device()
266 ret = ieee80211_check_combinations(sdata, NULL, 0, 0, -1); in ieee80211_start_p2p_device()
286 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_start_nan()
288 ret = ieee80211_check_combinations(sdata, NULL, 0, 0, -1); in ieee80211_start_nan()
296 ret = drv_start_nan(sdata->local, sdata, conf); in ieee80211_start_nan()
300 sdata->u.nan.conf = *conf; in ieee80211_start_nan()
310 drv_stop_nan(sdata->local, sdata); in ieee80211_stop_nan()
323 if (sdata->vif.type != NL80211_IFTYPE_NAN) in ieee80211_nan_change_conf()
324 return -EOPNOTSUPP; in ieee80211_nan_change_conf()
327 return -ENETDOWN; in ieee80211_nan_change_conf()
329 new_conf = sdata->u.nan.conf; in ieee80211_nan_change_conf()
332 new_conf.master_pref = conf->master_pref; in ieee80211_nan_change_conf()
335 new_conf.bands = conf->bands; in ieee80211_nan_change_conf()
337 ret = drv_nan_change_conf(sdata->local, sdata, &new_conf, changes); in ieee80211_nan_change_conf()
339 sdata->u.nan.conf = new_conf; in ieee80211_nan_change_conf()
351 if (sdata->vif.type != NL80211_IFTYPE_NAN) in ieee80211_add_nan_func()
352 return -EOPNOTSUPP; in ieee80211_add_nan_func()
355 return -ENETDOWN; in ieee80211_add_nan_func()
357 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_add_nan_func()
359 ret = idr_alloc(&sdata->u.nan.function_inst_ids, in ieee80211_add_nan_func()
360 nan_func, 1, sdata->local->hw.max_nan_de_entries + 1, in ieee80211_add_nan_func()
362 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_add_nan_func()
367 nan_func->instance_id = ret; in ieee80211_add_nan_func()
369 WARN_ON(nan_func->instance_id == 0); in ieee80211_add_nan_func()
371 ret = drv_add_nan_func(sdata->local, sdata, nan_func); in ieee80211_add_nan_func()
373 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_add_nan_func()
374 idr_remove(&sdata->u.nan.function_inst_ids, in ieee80211_add_nan_func()
375 nan_func->instance_id); in ieee80211_add_nan_func()
376 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_add_nan_func()
389 lockdep_assert_held(&sdata->u.nan.func_lock); in ieee80211_find_nan_func_by_cookie()
391 idr_for_each_entry(&sdata->u.nan.function_inst_ids, func, id) { in ieee80211_find_nan_func_by_cookie()
392 if (func->cookie == cookie) in ieee80211_find_nan_func_by_cookie()
406 if (sdata->vif.type != NL80211_IFTYPE_NAN || in ieee80211_del_nan_func()
410 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_del_nan_func()
414 instance_id = func->instance_id; in ieee80211_del_nan_func()
416 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_del_nan_func()
419 drv_del_nan_func(sdata->local, sdata, instance_id); in ieee80211_del_nan_func()
428 sdata->noack_map = noack_map; in ieee80211_set_noack_map()
438 struct ieee80211_local *local = sdata->local; in ieee80211_set_tx()
441 int ret = -EINVAL; in ieee80211_set_tx()
443 if (!wiphy_ext_feature_isset(local->hw.wiphy, in ieee80211_set_tx()
445 return -EINVAL; in ieee80211_set_tx()
450 return -EINVAL; in ieee80211_set_tx()
452 if (sta->ptk_idx == key_idx) in ieee80211_set_tx()
455 key = wiphy_dereference(local->hw.wiphy, sta->ptk[key_idx]); in ieee80211_set_tx()
457 if (key && key->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) in ieee80211_set_tx()
470 struct ieee80211_local *local = sdata->local; in ieee80211_add_key()
475 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_add_key()
478 return -ENETDOWN; in ieee80211_add_key()
483 if (pairwise && params->mode == NL80211_KEY_SET_TX) in ieee80211_add_key()
487 switch (params->cipher) { in ieee80211_add_key()
492 return -EINVAL; in ieee80211_add_key()
494 return -EINVAL; in ieee80211_add_key()
500 key = ieee80211_key_alloc(params->cipher, key_idx, params->key_len, in ieee80211_add_key()
501 params->key, params->seq_len, params->seq); in ieee80211_add_key()
505 key->conf.link_id = link_id; in ieee80211_add_key()
508 key->conf.flags |= IEEE80211_KEY_FLAG_PAIRWISE; in ieee80211_add_key()
510 if (params->mode == NL80211_KEY_NO_TX) in ieee80211_add_key()
511 key->conf.flags |= IEEE80211_KEY_FLAG_NO_AUTO_TX; in ieee80211_add_key()
527 return -ENOENT; in ieee80211_add_key()
531 switch (sdata->vif.type) { in ieee80211_add_key()
533 if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED) in ieee80211_add_key()
534 key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; in ieee80211_add_key()
540 key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; in ieee80211_add_key()
547 if (sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE) in ieee80211_add_key()
548 key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; in ieee80211_add_key()
567 if (err == -EALREADY) in ieee80211_add_key()
577 struct ieee80211_local *local __maybe_unused = sdata->local; in ieee80211_lookup_key()
578 struct ieee80211_link_data *link = &sdata->deflink; in ieee80211_lookup_key()
582 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_lookup_key()
596 link_sta = rcu_dereference_check(sta->link[link_id], in ieee80211_lookup_key()
597 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_lookup_key()
601 link_sta = &sta->deflink; in ieee80211_lookup_key()
605 return wiphy_dereference(local->hw.wiphy, in ieee80211_lookup_key()
606 sta->ptk[key_idx]); in ieee80211_lookup_key()
612 return wiphy_dereference(local->hw.wiphy, in ieee80211_lookup_key()
613 link_sta->gtk[key_idx]); in ieee80211_lookup_key()
619 return wiphy_dereference(local->hw.wiphy, sdata->keys[key_idx]); in ieee80211_lookup_key()
621 key = wiphy_dereference(local->hw.wiphy, link->gtk[key_idx]); in ieee80211_lookup_key()
627 return wiphy_dereference(local->hw.wiphy, sdata->keys[key_idx]); in ieee80211_lookup_key()
637 struct ieee80211_local *local = sdata->local; in ieee80211_del_key()
640 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_del_key()
644 return -ENOENT; in ieee80211_del_key()
646 ieee80211_key_free(key, sdata->vif.type == NL80211_IFTYPE_STATION); in ieee80211_del_key()
664 int err = -ENOENT; in ieee80211_get_key()
677 params.cipher = key->conf.cipher; in ieee80211_get_key()
679 switch (key->conf.cipher) { in ieee80211_get_key()
681 pn64 = atomic64_read(&key->conf.tx_pn); in ieee80211_get_key()
685 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && in ieee80211_get_key()
686 !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { in ieee80211_get_key()
687 drv_get_key_seq(sdata->local, key, &kseq); in ieee80211_get_key()
718 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && in ieee80211_get_key()
719 !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { in ieee80211_get_key()
720 drv_get_key_seq(sdata->local, key, &kseq); in ieee80211_get_key()
723 pn64 = atomic64_read(&key->conf.tx_pn); in ieee80211_get_key()
735 if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) in ieee80211_get_key()
737 if (WARN_ON(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) in ieee80211_get_key()
739 drv_get_key_seq(sdata->local, key, &kseq); in ieee80211_get_key()
806 rinfo->flags = 0; in sta_set_rate_info_tx()
807 if (rate->flags & IEEE80211_TX_RC_MCS) { in sta_set_rate_info_tx()
808 rinfo->flags |= RATE_INFO_FLAGS_MCS; in sta_set_rate_info_tx()
809 rinfo->mcs = rate->idx; in sta_set_rate_info_tx()
810 } else if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { in sta_set_rate_info_tx()
811 rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; in sta_set_rate_info_tx()
812 rinfo->mcs = ieee80211_rate_get_vht_mcs(rate); in sta_set_rate_info_tx()
813 rinfo->nss = ieee80211_rate_get_vht_nss(rate); in sta_set_rate_info_tx()
817 sband = ieee80211_get_sband(sta->sdata); in sta_set_rate_info_tx()
818 WARN_ON_ONCE(sband && !sband->bitrates); in sta_set_rate_info_tx()
819 if (sband && sband->bitrates) in sta_set_rate_info_tx()
820 rinfo->legacy = sband->bitrates[rate->idx].bitrate; in sta_set_rate_info_tx()
822 if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) in sta_set_rate_info_tx()
823 rinfo->bw = RATE_INFO_BW_40; in sta_set_rate_info_tx()
824 else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) in sta_set_rate_info_tx()
825 rinfo->bw = RATE_INFO_BW_80; in sta_set_rate_info_tx()
826 else if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) in sta_set_rate_info_tx()
827 rinfo->bw = RATE_INFO_BW_160; in sta_set_rate_info_tx()
829 rinfo->bw = RATE_INFO_BW_20; in sta_set_rate_info_tx()
830 if (rate->flags & IEEE80211_TX_RC_SHORT_GI) in sta_set_rate_info_tx()
831 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; in sta_set_rate_info_tx()
838 struct ieee80211_local *local = sdata->local; in ieee80211_dump_station()
840 int ret = -ENOENT; in ieee80211_dump_station()
842 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dump_station()
847 memcpy(mac, sta->sta.addr, ETH_ALEN); in ieee80211_dump_station()
857 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); in ieee80211_dump_survey()
866 struct ieee80211_local *local = sdata->local; in ieee80211_get_station()
868 int ret = -ENOENT; in ieee80211_get_station()
870 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_get_station()
889 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_set_monitor_channel()
891 if (cfg80211_chandef_identical(&local->monitor_chanreq.oper, in ieee80211_set_monitor_channel()
895 sdata = wiphy_dereference(local->hw.wiphy, in ieee80211_set_monitor_channel()
896 local->monitor_sdata); in ieee80211_set_monitor_channel()
900 if (cfg80211_chandef_identical(&sdata->vif.bss_conf.chanreq.oper, in ieee80211_set_monitor_channel()
904 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_set_monitor_channel()
905 ret = ieee80211_link_use_channel(&sdata->deflink, &chanreq, in ieee80211_set_monitor_channel()
910 local->monitor_chanreq = chanreq; in ieee80211_set_monitor_channel()
926 old = sdata_dereference(link->u.ap.probe_resp, sdata); in ieee80211_set_probe_resp()
930 return -ENOMEM; in ieee80211_set_probe_resp()
932 new->len = resp_len; in ieee80211_set_probe_resp()
933 memcpy(new->data, resp, resp_len); in ieee80211_set_probe_resp()
936 memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_presp, in ieee80211_set_probe_resp()
937 csa->n_counter_offsets_presp * in ieee80211_set_probe_resp()
938 sizeof(new->cntdwn_counter_offsets[0])); in ieee80211_set_probe_resp()
940 new->cntdwn_counter_offsets[0] = cca->counter_offset_presp; in ieee80211_set_probe_resp()
942 rcu_assign_pointer(link->u.ap.probe_resp, new); in ieee80211_set_probe_resp()
958 if (!params->update) in ieee80211_set_fils_discovery()
961 fd = &link_conf->fils_discovery; in ieee80211_set_fils_discovery()
962 fd->min_interval = params->min_interval; in ieee80211_set_fils_discovery()
963 fd->max_interval = params->max_interval; in ieee80211_set_fils_discovery()
965 old = sdata_dereference(link->u.ap.fils_discovery, sdata); in ieee80211_set_fils_discovery()
969 if (params->tmpl && params->tmpl_len) { in ieee80211_set_fils_discovery()
970 new = kzalloc(sizeof(*new) + params->tmpl_len, GFP_KERNEL); in ieee80211_set_fils_discovery()
972 return -ENOMEM; in ieee80211_set_fils_discovery()
973 new->len = params->tmpl_len; in ieee80211_set_fils_discovery()
974 memcpy(new->data, params->tmpl, params->tmpl_len); in ieee80211_set_fils_discovery()
975 rcu_assign_pointer(link->u.ap.fils_discovery, new); in ieee80211_set_fils_discovery()
977 RCU_INIT_POINTER(link->u.ap.fils_discovery, NULL); in ieee80211_set_fils_discovery()
993 if (!params->update) in ieee80211_set_unsol_bcast_probe_resp()
996 link_conf->unsol_bcast_probe_resp_interval = params->interval; in ieee80211_set_unsol_bcast_probe_resp()
998 old = sdata_dereference(link->u.ap.unsol_bcast_probe_resp, sdata); in ieee80211_set_unsol_bcast_probe_resp()
1002 if (params->tmpl && params->tmpl_len) { in ieee80211_set_unsol_bcast_probe_resp()
1003 new = kzalloc(sizeof(*new) + params->tmpl_len, GFP_KERNEL); in ieee80211_set_unsol_bcast_probe_resp()
1005 return -ENOMEM; in ieee80211_set_unsol_bcast_probe_resp()
1006 new->len = params->tmpl_len; in ieee80211_set_unsol_bcast_probe_resp()
1007 memcpy(new->data, params->tmpl, params->tmpl_len); in ieee80211_set_unsol_bcast_probe_resp()
1008 rcu_assign_pointer(link->u.ap.unsol_bcast_probe_resp, new); in ieee80211_set_unsol_bcast_probe_resp()
1010 RCU_INIT_POINTER(link->u.ap.unsol_bcast_probe_resp, NULL); in ieee80211_set_unsol_bcast_probe_resp()
1030 old = link_conf->ftmr_params; in ieee80211_set_ftm_responder_params()
1035 return -ENOMEM; in ieee80211_set_ftm_responder_params()
1039 new->lci_len = lci_len; in ieee80211_set_ftm_responder_params()
1040 new->lci = pos; in ieee80211_set_ftm_responder_params()
1046 new->civicloc_len = civicloc_len; in ieee80211_set_ftm_responder_params()
1047 new->civicloc = pos; in ieee80211_set_ftm_responder_params()
1052 link_conf->ftmr_params = new; in ieee80211_set_ftm_responder_params()
1064 for (i = 0; i < src->cnt; i++) { in ieee80211_copy_mbssid_beacon()
1065 memcpy(pos + offset, src->elem[i].data, src->elem[i].len); in ieee80211_copy_mbssid_beacon()
1066 dst->elem[i].len = src->elem[i].len; in ieee80211_copy_mbssid_beacon()
1067 dst->elem[i].data = pos + offset; in ieee80211_copy_mbssid_beacon()
1068 offset += dst->elem[i].len; in ieee80211_copy_mbssid_beacon()
1070 dst->cnt = src->cnt; in ieee80211_copy_mbssid_beacon()
1081 for (i = 0; i < src->cnt; i++) { in ieee80211_copy_rnr_beacon()
1082 memcpy(pos + offset, src->elem[i].data, src->elem[i].len); in ieee80211_copy_rnr_beacon()
1083 dst->elem[i].len = src->elem[i].len; in ieee80211_copy_rnr_beacon()
1084 dst->elem[i].data = pos + offset; in ieee80211_copy_rnr_beacon()
1085 offset += dst->elem[i].len; in ieee80211_copy_rnr_beacon()
1087 dst->cnt = src->cnt; in ieee80211_copy_rnr_beacon()
1106 struct ieee80211_bss_conf *link_conf = link->conf; in ieee80211_assign_beacon()
1108 old = sdata_dereference(link->u.ap.beacon, sdata); in ieee80211_assign_beacon()
1111 if (!params->head && !old) in ieee80211_assign_beacon()
1112 return -EINVAL; in ieee80211_assign_beacon()
1115 if (params->head) in ieee80211_assign_beacon()
1116 new_head_len = params->head_len; in ieee80211_assign_beacon()
1118 new_head_len = old->head_len; in ieee80211_assign_beacon()
1121 if (params->tail || !old) in ieee80211_assign_beacon()
1122 /* params->tail_len will be zero for !params->tail */ in ieee80211_assign_beacon()
1123 new_tail_len = params->tail_len; in ieee80211_assign_beacon()
1125 new_tail_len = old->tail_len; in ieee80211_assign_beacon()
1130 if (params->mbssid_ies) { in ieee80211_assign_beacon()
1131 mbssid = params->mbssid_ies; in ieee80211_assign_beacon()
1132 size += struct_size(new->mbssid_ies, elem, mbssid->cnt); in ieee80211_assign_beacon()
1133 if (params->rnr_ies) { in ieee80211_assign_beacon()
1134 rnr = params->rnr_ies; in ieee80211_assign_beacon()
1135 size += struct_size(new->rnr_ies, elem, rnr->cnt); in ieee80211_assign_beacon()
1138 mbssid->cnt); in ieee80211_assign_beacon()
1139 } else if (old && old->mbssid_ies) { in ieee80211_assign_beacon()
1140 mbssid = old->mbssid_ies; in ieee80211_assign_beacon()
1141 size += struct_size(new->mbssid_ies, elem, mbssid->cnt); in ieee80211_assign_beacon()
1142 if (old && old->rnr_ies) { in ieee80211_assign_beacon()
1143 rnr = old->rnr_ies; in ieee80211_assign_beacon()
1144 size += struct_size(new->rnr_ies, elem, rnr->cnt); in ieee80211_assign_beacon()
1147 mbssid->cnt); in ieee80211_assign_beacon()
1152 return -ENOMEM; in ieee80211_assign_beacon()
1160 new->head = ((u8 *) new) + sizeof(*new); in ieee80211_assign_beacon()
1161 new->tail = new->head + new_head_len; in ieee80211_assign_beacon()
1162 new->head_len = new_head_len; in ieee80211_assign_beacon()
1163 new->tail_len = new_tail_len; in ieee80211_assign_beacon()
1166 u8 *pos = new->tail + new->tail_len; in ieee80211_assign_beacon()
1168 new->mbssid_ies = (void *)pos; in ieee80211_assign_beacon()
1169 pos += struct_size(new->mbssid_ies, elem, mbssid->cnt); in ieee80211_assign_beacon()
1170 pos += ieee80211_copy_mbssid_beacon(pos, new->mbssid_ies, in ieee80211_assign_beacon()
1173 new->rnr_ies = (void *)pos; in ieee80211_assign_beacon()
1174 pos += struct_size(new->rnr_ies, elem, rnr->cnt); in ieee80211_assign_beacon()
1175 ieee80211_copy_rnr_beacon(pos, new->rnr_ies, rnr); in ieee80211_assign_beacon()
1178 link_conf->bssid_indicator = in ieee80211_assign_beacon()
1179 ilog2(__roundup_pow_of_two(mbssid->cnt + 1)); in ieee80211_assign_beacon()
1183 new->cntdwn_current_counter = csa->count; in ieee80211_assign_beacon()
1184 memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_beacon, in ieee80211_assign_beacon()
1185 csa->n_counter_offsets_beacon * in ieee80211_assign_beacon()
1186 sizeof(new->cntdwn_counter_offsets[0])); in ieee80211_assign_beacon()
1188 new->cntdwn_current_counter = cca->count; in ieee80211_assign_beacon()
1189 new->cntdwn_counter_offsets[0] = cca->counter_offset_beacon; in ieee80211_assign_beacon()
1193 if (params->head) in ieee80211_assign_beacon()
1194 memcpy(new->head, params->head, new_head_len); in ieee80211_assign_beacon()
1196 memcpy(new->head, old->head, new_head_len); in ieee80211_assign_beacon()
1199 if (params->tail) in ieee80211_assign_beacon()
1200 memcpy(new->tail, params->tail, new_tail_len); in ieee80211_assign_beacon()
1203 memcpy(new->tail, old->tail, new_tail_len); in ieee80211_assign_beacon()
1205 err = ieee80211_set_probe_resp(sdata, params->probe_resp, in ieee80211_assign_beacon()
1206 params->probe_resp_len, csa, cca, link); in ieee80211_assign_beacon()
1214 if (params->ftm_responder != -1) { in ieee80211_assign_beacon()
1215 link_conf->ftm_responder = params->ftm_responder; in ieee80211_assign_beacon()
1217 params->lci, in ieee80211_assign_beacon()
1218 params->lci_len, in ieee80211_assign_beacon()
1219 params->civicloc, in ieee80211_assign_beacon()
1220 params->civicloc_len, in ieee80211_assign_beacon()
1231 rcu_assign_pointer(link->u.ap.beacon, new); in ieee80211_assign_beacon()
1232 sdata->u.ap.active = true; in ieee80211_assign_beacon()
1244 u8 link_id, num = 0; in ieee80211_num_beaconing_links() local
1246 if (sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_num_beaconing_links()
1247 sdata->vif.type != NL80211_IFTYPE_P2P_GO) in ieee80211_num_beaconing_links()
1248 return num; in ieee80211_num_beaconing_links()
1250 if (!sdata->vif.valid_links) in ieee80211_num_beaconing_links()
1251 return num; in ieee80211_num_beaconing_links()
1254 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_num_beaconing_links()
1258 if (sdata_dereference(link->u.ap.beacon, sdata)) in ieee80211_num_beaconing_links()
1259 num++; in ieee80211_num_beaconing_links()
1262 return num; in ieee80211_num_beaconing_links()
1269 struct ieee80211_local *local = sdata->local; in ieee80211_start_ap()
1280 unsigned int link_id = params->beacon.link_id; in ieee80211_start_ap()
1283 struct ieee80211_chan_req chanreq = { .oper = params->chandef }; in ieee80211_start_ap()
1285 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_start_ap()
1287 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_start_ap()
1289 return -ENOLINK; in ieee80211_start_ap()
1291 link_conf = link->conf; in ieee80211_start_ap()
1293 old = sdata_dereference(link->u.ap.beacon, sdata); in ieee80211_start_ap()
1295 return -EALREADY; in ieee80211_start_ap()
1297 if (params->smps_mode != NL80211_SMPS_OFF) in ieee80211_start_ap()
1298 return -EOPNOTSUPP; in ieee80211_start_ap()
1300 link->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_start_ap()
1302 link->needed_rx_chains = sdata->local->rx_chains; in ieee80211_start_ap()
1304 prev_beacon_int = link_conf->beacon_int; in ieee80211_start_ap()
1305 link_conf->beacon_int = params->beacon_interval; in ieee80211_start_ap()
1307 if (params->ht_cap) in ieee80211_start_ap()
1308 link_conf->ht_ldpc = in ieee80211_start_ap()
1309 params->ht_cap->cap_info & in ieee80211_start_ap()
1312 if (params->vht_cap) { in ieee80211_start_ap()
1313 link_conf->vht_ldpc = in ieee80211_start_ap()
1314 params->vht_cap->vht_cap_info & in ieee80211_start_ap()
1316 link_conf->vht_su_beamformer = in ieee80211_start_ap()
1317 params->vht_cap->vht_cap_info & in ieee80211_start_ap()
1319 link_conf->vht_su_beamformee = in ieee80211_start_ap()
1320 params->vht_cap->vht_cap_info & in ieee80211_start_ap()
1322 link_conf->vht_mu_beamformer = in ieee80211_start_ap()
1323 params->vht_cap->vht_cap_info & in ieee80211_start_ap()
1325 link_conf->vht_mu_beamformee = in ieee80211_start_ap()
1326 params->vht_cap->vht_cap_info & in ieee80211_start_ap()
1330 if (params->he_cap && params->he_oper) { in ieee80211_start_ap()
1331 link_conf->he_support = true; in ieee80211_start_ap()
1332 link_conf->htc_trig_based_pkt_ext = in ieee80211_start_ap()
1333 le32_get_bits(params->he_oper->he_oper_params, in ieee80211_start_ap()
1335 link_conf->frame_time_rts_th = in ieee80211_start_ap()
1336 le32_get_bits(params->he_oper->he_oper_params, in ieee80211_start_ap()
1340 if (params->beacon.he_bss_color.enabled) in ieee80211_start_ap()
1344 if (params->he_cap) { in ieee80211_start_ap()
1345 link_conf->he_ldpc = in ieee80211_start_ap()
1346 params->he_cap->phy_cap_info[1] & in ieee80211_start_ap()
1348 link_conf->he_su_beamformer = in ieee80211_start_ap()
1349 params->he_cap->phy_cap_info[3] & in ieee80211_start_ap()
1351 link_conf->he_su_beamformee = in ieee80211_start_ap()
1352 params->he_cap->phy_cap_info[4] & in ieee80211_start_ap()
1354 link_conf->he_mu_beamformer = in ieee80211_start_ap()
1355 params->he_cap->phy_cap_info[4] & in ieee80211_start_ap()
1357 link_conf->he_full_ul_mumimo = in ieee80211_start_ap()
1358 params->he_cap->phy_cap_info[2] & in ieee80211_start_ap()
1362 if (params->eht_cap) { in ieee80211_start_ap()
1363 if (!link_conf->he_support) in ieee80211_start_ap()
1364 return -EOPNOTSUPP; in ieee80211_start_ap()
1366 link_conf->eht_support = true; in ieee80211_start_ap()
1368 link_conf->eht_su_beamformer = in ieee80211_start_ap()
1369 params->eht_cap->fixed.phy_cap_info[0] & in ieee80211_start_ap()
1371 link_conf->eht_su_beamformee = in ieee80211_start_ap()
1372 params->eht_cap->fixed.phy_cap_info[0] & in ieee80211_start_ap()
1374 link_conf->eht_mu_beamformer = in ieee80211_start_ap()
1375 params->eht_cap->fixed.phy_cap_info[7] & in ieee80211_start_ap()
1379 link_conf->eht_80mhz_full_bw_ul_mumimo = in ieee80211_start_ap()
1380 params->eht_cap->fixed.phy_cap_info[7] & in ieee80211_start_ap()
1385 link_conf->eht_su_beamformer = false; in ieee80211_start_ap()
1386 link_conf->eht_su_beamformee = false; in ieee80211_start_ap()
1387 link_conf->eht_mu_beamformer = false; in ieee80211_start_ap()
1390 if (sdata->vif.type == NL80211_IFTYPE_AP && in ieee80211_start_ap()
1391 params->mbssid_config.tx_wdev) { in ieee80211_start_ap()
1393 params->mbssid_config, in ieee80211_start_ap()
1404 link_conf->beacon_int = prev_beacon_int; in ieee80211_start_ap()
1412 sdata->control_port_protocol = params->crypto.control_port_ethertype; in ieee80211_start_ap()
1413 sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt; in ieee80211_start_ap()
1414 sdata->control_port_over_nl80211 = in ieee80211_start_ap()
1415 params->crypto.control_port_over_nl80211; in ieee80211_start_ap()
1416 sdata->control_port_no_preauth = in ieee80211_start_ap()
1417 params->crypto.control_port_no_preauth; in ieee80211_start_ap()
1419 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) { in ieee80211_start_ap()
1420 vlan->control_port_protocol = in ieee80211_start_ap()
1421 params->crypto.control_port_ethertype; in ieee80211_start_ap()
1422 vlan->control_port_no_encrypt = in ieee80211_start_ap()
1423 params->crypto.control_port_no_encrypt; in ieee80211_start_ap()
1424 vlan->control_port_over_nl80211 = in ieee80211_start_ap()
1425 params->crypto.control_port_over_nl80211; in ieee80211_start_ap()
1426 vlan->control_port_no_preauth = in ieee80211_start_ap()
1427 params->crypto.control_port_no_preauth; in ieee80211_start_ap()
1430 link_conf->dtim_period = params->dtim_period; in ieee80211_start_ap()
1431 link_conf->enable_beacon = true; in ieee80211_start_ap()
1432 link_conf->allow_p2p_go_ps = sdata->vif.p2p; in ieee80211_start_ap()
1433 link_conf->twt_responder = params->twt_responder; in ieee80211_start_ap()
1434 link_conf->he_obss_pd = params->he_obss_pd; in ieee80211_start_ap()
1435 link_conf->he_bss_color = params->beacon.he_bss_color; in ieee80211_start_ap()
1436 sdata->vif.cfg.s1g = params->chandef.chan->band == in ieee80211_start_ap()
1439 sdata->vif.cfg.ssid_len = params->ssid_len; in ieee80211_start_ap()
1440 if (params->ssid_len) in ieee80211_start_ap()
1441 memcpy(sdata->vif.cfg.ssid, params->ssid, in ieee80211_start_ap()
1442 params->ssid_len); in ieee80211_start_ap()
1443 link_conf->hidden_ssid = in ieee80211_start_ap()
1444 (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE); in ieee80211_start_ap()
1446 memset(&link_conf->p2p_noa_attr, 0, in ieee80211_start_ap()
1447 sizeof(link_conf->p2p_noa_attr)); in ieee80211_start_ap()
1448 link_conf->p2p_noa_attr.oppps_ctwindow = in ieee80211_start_ap()
1449 params->p2p_ctwindow & IEEE80211_P2P_OPPPS_CTWINDOW_MASK; in ieee80211_start_ap()
1450 if (params->p2p_opp_ps) in ieee80211_start_ap()
1451 link_conf->p2p_noa_attr.oppps_ctwindow |= in ieee80211_start_ap()
1454 sdata->beacon_rate_set = false; in ieee80211_start_ap()
1455 if (wiphy_ext_feature_isset(local->hw.wiphy, in ieee80211_start_ap()
1458 sdata->beacon_rateidx_mask[i] = in ieee80211_start_ap()
1459 params->beacon_rate.control[i].legacy; in ieee80211_start_ap()
1460 if (sdata->beacon_rateidx_mask[i]) in ieee80211_start_ap()
1461 sdata->beacon_rate_set = true; in ieee80211_start_ap()
1465 if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) in ieee80211_start_ap()
1466 link_conf->beacon_tx_rate = params->beacon_rate; in ieee80211_start_ap()
1468 err = ieee80211_assign_beacon(sdata, link, &params->beacon, NULL, NULL, in ieee80211_start_ap()
1473 err = ieee80211_set_fils_discovery(sdata, &params->fils_discovery, in ieee80211_start_ap()
1479 &params->unsol_bcast_probe_resp, in ieee80211_start_ap()
1484 err = drv_start_ap(sdata->local, sdata, link_conf); in ieee80211_start_ap()
1486 old = sdata_dereference(link->u.ap.beacon, sdata); in ieee80211_start_ap()
1490 RCU_INIT_POINTER(link->u.ap.beacon, NULL); in ieee80211_start_ap()
1493 sdata->u.ap.active = false; in ieee80211_start_ap()
1505 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) in ieee80211_start_ap()
1506 netif_carrier_on(vlan->dev); in ieee80211_start_ap()
1522 struct cfg80211_beacon_data *beacon = &params->beacon; in ieee80211_change_beacon()
1530 link = sdata_dereference(sdata->link[beacon->link_id], sdata); in ieee80211_change_beacon()
1532 return -ENOLINK; in ieee80211_change_beacon()
1534 link_conf = link->conf; in ieee80211_change_beacon()
1536 /* don't allow changing the beacon while a countdown is in place - offset in ieee80211_change_beacon()
1539 if (link_conf->csa_active || link_conf->color_change_active) in ieee80211_change_beacon()
1540 return -EBUSY; in ieee80211_change_beacon()
1542 old = sdata_dereference(link->u.ap.beacon, sdata); in ieee80211_change_beacon()
1544 return -ENOENT; in ieee80211_change_beacon()
1551 err = ieee80211_set_fils_discovery(sdata, &params->fils_discovery, in ieee80211_change_beacon()
1557 &params->unsol_bcast_probe_resp, in ieee80211_change_beacon()
1562 if (beacon->he_bss_color_valid && in ieee80211_change_beacon()
1563 beacon->he_bss_color.enabled != link_conf->he_bss_color.enabled) { in ieee80211_change_beacon()
1564 link_conf->he_bss_color.enabled = beacon->he_bss_color.enabled; in ieee80211_change_beacon()
1574 if (!link->u.ap.next_beacon) in ieee80211_free_next_beacon()
1577 kfree(link->u.ap.next_beacon->mbssid_ies); in ieee80211_free_next_beacon()
1578 kfree(link->u.ap.next_beacon->rnr_ies); in ieee80211_free_next_beacon()
1579 kfree(link->u.ap.next_beacon); in ieee80211_free_next_beacon()
1580 link->u.ap.next_beacon = NULL; in ieee80211_free_next_beacon()
1588 struct ieee80211_local *local = sdata->local; in ieee80211_stop_ap()
1595 sdata_dereference(sdata->link[link_id], sdata); in ieee80211_stop_ap()
1596 struct ieee80211_bss_conf *link_conf = link->conf; in ieee80211_stop_ap()
1599 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_stop_ap()
1601 old_beacon = sdata_dereference(link->u.ap.beacon, sdata); in ieee80211_stop_ap()
1603 return -ENOENT; in ieee80211_stop_ap()
1604 old_probe_resp = sdata_dereference(link->u.ap.probe_resp, in ieee80211_stop_ap()
1606 old_fils_discovery = sdata_dereference(link->u.ap.fils_discovery, in ieee80211_stop_ap()
1609 sdata_dereference(link->u.ap.unsol_bcast_probe_resp, in ieee80211_stop_ap()
1613 link_conf->csa_active = false; in ieee80211_stop_ap()
1614 link_conf->color_change_active = false; in ieee80211_stop_ap()
1620 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) in ieee80211_stop_ap()
1621 netif_carrier_off(vlan->dev); in ieee80211_stop_ap()
1625 sdata->u.ap.active = false; in ieee80211_stop_ap()
1629 RCU_INIT_POINTER(link->u.ap.beacon, NULL); in ieee80211_stop_ap()
1630 RCU_INIT_POINTER(link->u.ap.probe_resp, NULL); in ieee80211_stop_ap()
1631 RCU_INIT_POINTER(link->u.ap.fils_discovery, NULL); in ieee80211_stop_ap()
1632 RCU_INIT_POINTER(link->u.ap.unsol_bcast_probe_resp, NULL); in ieee80211_stop_ap()
1641 kfree(link_conf->ftmr_params); in ieee80211_stop_ap()
1642 link_conf->ftmr_params = NULL; in ieee80211_stop_ap()
1644 sdata->vif.mbssid_tx_vif = NULL; in ieee80211_stop_ap()
1645 link_conf->bssid_index = 0; in ieee80211_stop_ap()
1646 link_conf->nontransmitted = false; in ieee80211_stop_ap()
1647 link_conf->ema_ap = false; in ieee80211_stop_ap()
1648 link_conf->bssid_indicator = 0; in ieee80211_stop_ap()
1658 link_conf->enable_beacon = false; in ieee80211_stop_ap()
1659 sdata->beacon_rate_set = false; in ieee80211_stop_ap()
1660 sdata->vif.cfg.ssid_len = 0; in ieee80211_stop_ap()
1661 clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, &sdata->state); in ieee80211_stop_ap()
1665 if (sdata->wdev.links[link_id].cac_started) { in ieee80211_stop_ap()
1666 chandef = link_conf->chanreq.oper; in ieee80211_stop_ap()
1667 wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); in ieee80211_stop_ap()
1668 cfg80211_cac_event(sdata->dev, &chandef, in ieee80211_stop_ap()
1673 drv_stop_ap(sdata->local, sdata, link_conf); in ieee80211_stop_ap()
1676 local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf); in ieee80211_stop_ap()
1677 ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf); in ieee80211_stop_ap()
1750 struct ieee80211_sub_if_data *sdata = sta->sdata; in sta_apply_mesh_params()
1753 if (params->sta_modify_mask & STATION_PARAM_APPLY_PLINK_STATE) { in sta_apply_mesh_params()
1754 switch (params->plink_state) { in sta_apply_mesh_params()
1756 if (sta->mesh->plink_state != NL80211_PLINK_ESTAB) in sta_apply_mesh_params()
1758 sta->mesh->plink_state = params->plink_state; in sta_apply_mesh_params()
1759 sta->mesh->aid = params->peer_aid; in sta_apply_mesh_params()
1763 sdata->u.mesh.mshcfg.power_mode); in sta_apply_mesh_params()
1765 ewma_mesh_tx_rate_avg_init(&sta->mesh->tx_rate_avg); in sta_apply_mesh_params()
1767 ewma_mesh_tx_rate_avg_add(&sta->mesh->tx_rate_avg, 10); in sta_apply_mesh_params()
1776 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in sta_apply_mesh_params()
1778 sta->mesh->plink_state = params->plink_state; in sta_apply_mesh_params()
1790 switch (params->plink_action) { in sta_apply_mesh_params()
1802 if (params->local_pm) in sta_apply_mesh_params()
1804 params->local_pm); in sta_apply_mesh_params()
1822 struct ieee80211_sub_if_data *sdata = sta->sdata; in sta_link_apply_parameters()
1823 u32 link_id = params->link_id < 0 ? 0 : params->link_id; in sta_link_apply_parameters()
1825 sdata_dereference(sdata->link[link_id], sdata); in sta_link_apply_parameters()
1827 rcu_dereference_protected(sta->link[link_id], in sta_link_apply_parameters()
1828 lockdep_is_held(&local->hw.wiphy->mtx)); in sta_link_apply_parameters()
1829 bool changes = params->link_mac || in sta_link_apply_parameters()
1830 params->txpwr_set || in sta_link_apply_parameters()
1831 params->supported_rates_len || in sta_link_apply_parameters()
1832 params->ht_capa || in sta_link_apply_parameters()
1833 params->vht_capa || in sta_link_apply_parameters()
1834 params->he_capa || in sta_link_apply_parameters()
1835 params->eht_capa || in sta_link_apply_parameters()
1836 params->opmode_notif_used; in sta_link_apply_parameters()
1840 if (!params->link_mac) in sta_link_apply_parameters()
1841 return -EINVAL; in sta_link_apply_parameters()
1846 if (params->link_id >= 0) in sta_link_apply_parameters()
1854 return -EINVAL; in sta_link_apply_parameters()
1858 return -EINVAL; in sta_link_apply_parameters()
1860 if (params->link_mac) { in sta_link_apply_parameters()
1862 memcpy(link_sta->addr, params->link_mac, ETH_ALEN); in sta_link_apply_parameters()
1863 memcpy(link_sta->pub->addr, params->link_mac, ETH_ALEN); in sta_link_apply_parameters()
1864 } else if (!ether_addr_equal(link_sta->addr, in sta_link_apply_parameters()
1865 params->link_mac)) { in sta_link_apply_parameters()
1866 return -EINVAL; in sta_link_apply_parameters()
1870 if (params->txpwr_set) { in sta_link_apply_parameters()
1873 link_sta->pub->txpwr.type = params->txpwr.type; in sta_link_apply_parameters()
1874 if (params->txpwr.type == NL80211_TX_POWER_LIMITED) in sta_link_apply_parameters()
1875 link_sta->pub->txpwr.power = params->txpwr.power; in sta_link_apply_parameters()
1881 if (params->supported_rates && in sta_link_apply_parameters()
1882 params->supported_rates_len) { in sta_link_apply_parameters()
1883 ieee80211_parse_bitrates(link->conf->chanreq.oper.width, in sta_link_apply_parameters()
1884 sband, params->supported_rates, in sta_link_apply_parameters()
1885 params->supported_rates_len, in sta_link_apply_parameters()
1886 &link_sta->pub->supp_rates[sband->band]); in sta_link_apply_parameters()
1889 if (params->ht_capa) in sta_link_apply_parameters()
1891 params->ht_capa, link_sta); in sta_link_apply_parameters()
1893 /* VHT can override some HT caps such as the A-MSDU max length */ in sta_link_apply_parameters()
1894 if (params->vht_capa) in sta_link_apply_parameters()
1896 params->vht_capa, NULL, in sta_link_apply_parameters()
1899 if (params->he_capa) in sta_link_apply_parameters()
1901 (void *)params->he_capa, in sta_link_apply_parameters()
1902 params->he_capa_len, in sta_link_apply_parameters()
1903 (void *)params->he_6ghz_capa, in sta_link_apply_parameters()
1906 if (params->he_capa && params->eht_capa) in sta_link_apply_parameters()
1908 (u8 *)params->he_capa, in sta_link_apply_parameters()
1909 params->he_capa_len, in sta_link_apply_parameters()
1910 params->eht_capa, in sta_link_apply_parameters()
1911 params->eht_capa_len, in sta_link_apply_parameters()
1914 if (params->opmode_notif_used) { in sta_link_apply_parameters()
1919 params->opmode_notif, in sta_link_apply_parameters()
1920 sband->band); in sta_link_apply_parameters()
1932 struct ieee80211_sub_if_data *sdata = sta->sdata; in sta_apply_parameters()
1936 mask = params->sta_flags_mask; in sta_apply_parameters()
1937 set = params->sta_flags_set; in sta_apply_parameters()
1939 if (ieee80211_vif_is_mesh(&sdata->vif)) { in sta_apply_parameters()
1950 * TDLS -- everything follows authorized, but in sta_apply_parameters()
1963 local->hw.queues >= IEEE80211_NUM_ACS) in sta_apply_parameters()
1964 sta->sta.wme = set & BIT(NL80211_STA_FLAG_WME); in sta_apply_parameters()
1984 sta->sta.mfp = !!(set & BIT(NL80211_STA_FLAG_MFP)); in sta_apply_parameters()
1999 sta->sta.spp_amsdu = set & BIT(NL80211_STA_FLAG_SPP_AMSDU); in sta_apply_parameters()
2003 !sdata->deflink.u.mgd.tdls_chan_switch_prohibited && in sta_apply_parameters()
2004 params->ext_capab_len >= 4 && in sta_apply_parameters()
2005 params->ext_capab[3] & WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH) in sta_apply_parameters()
2009 !sdata->u.mgd.tdls_wider_bw_prohibited && in sta_apply_parameters()
2010 ieee80211_hw_check(&local->hw, TDLS_WIDER_BW) && in sta_apply_parameters()
2011 params->ext_capab_len >= 8 && in sta_apply_parameters()
2012 params->ext_capab[7] & WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED) in sta_apply_parameters()
2015 if (params->sta_modify_mask & STATION_PARAM_APPLY_UAPSD) { in sta_apply_parameters()
2016 sta->sta.uapsd_queues = params->uapsd_queues; in sta_apply_parameters()
2017 sta->sta.max_sp = params->max_sp; in sta_apply_parameters()
2020 ieee80211_sta_set_max_amsdu_subframes(sta, params->ext_capab, in sta_apply_parameters()
2021 params->ext_capab_len); in sta_apply_parameters()
2024 * cfg80211 validates this (1-2007) and allows setting the AID in sta_apply_parameters()
2027 if (params->aid) in sta_apply_parameters()
2028 sta->sta.aid = params->aid; in sta_apply_parameters()
2038 if (params->listen_interval >= 0) in sta_apply_parameters()
2039 sta->listen_interval = params->listen_interval; in sta_apply_parameters()
2042 &params->link_sta_params); in sta_apply_parameters()
2046 if (params->support_p2p_ps >= 0) in sta_apply_parameters()
2047 sta->sta.support_p2p_ps = params->support_p2p_ps; in sta_apply_parameters()
2049 if (ieee80211_vif_is_mesh(&sdata->vif)) in sta_apply_parameters()
2052 if (params->airtime_weight) in sta_apply_parameters()
2053 sta->airtime_weight = params->airtime_weight; in sta_apply_parameters()
2064 if (params->link_sta_params.mld_mac) in sta_apply_parameters()
2065 sta->sta.mlo = true; in sta_apply_parameters()
2079 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_add_station()
2081 if (params->vlan) { in ieee80211_add_station()
2082 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); in ieee80211_add_station()
2084 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_add_station()
2085 sdata->vif.type != NL80211_IFTYPE_AP) in ieee80211_add_station()
2086 return -EINVAL; in ieee80211_add_station()
2090 if (ether_addr_equal(mac, sdata->vif.addr)) in ieee80211_add_station()
2091 return -EINVAL; in ieee80211_add_station()
2094 return -EINVAL; in ieee80211_add_station()
2096 if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER) && in ieee80211_add_station()
2097 sdata->vif.type == NL80211_IFTYPE_STATION && in ieee80211_add_station()
2098 !sdata->u.mgd.associated) in ieee80211_add_station()
2099 return -EINVAL; in ieee80211_add_station()
2102 * If we have a link ID, it can be a non-MLO station on an AP MLD, in ieee80211_add_station()
2106 if (params->link_sta_params.link_id >= 0) in ieee80211_add_station()
2108 params->link_sta_params.link_id, in ieee80211_add_station()
2109 params->link_sta_params.link_mac ?: mac, in ieee80211_add_station()
2115 return -ENOMEM; in ieee80211_add_station()
2117 if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) in ieee80211_add_station()
2118 sta->sta.tdls = true; in ieee80211_add_station()
2149 if (params->mac) in ieee80211_del_station()
2150 return sta_info_destroy_addr_bss(sdata, params->mac); in ieee80211_del_station()
2152 sta_info_flush(sdata, params->link_id); in ieee80211_del_station()
2167 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_change_station()
2171 return -ENOENT; in ieee80211_change_station()
2173 switch (sdata->vif.type) { in ieee80211_change_station()
2175 if (sdata->u.mesh.user_mpm) in ieee80211_change_station()
2201 return -EOPNOTSUPP; in ieee80211_change_station()
2208 if (params->vlan && params->vlan != sta->sdata->dev) { in ieee80211_change_station()
2209 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); in ieee80211_change_station()
2211 if (params->vlan->ieee80211_ptr->use_4addr) { in ieee80211_change_station()
2212 if (vlansdata->u.vlan.sta) in ieee80211_change_station()
2213 return -EBUSY; in ieee80211_change_station()
2215 rcu_assign_pointer(vlansdata->u.vlan.sta, sta); in ieee80211_change_station()
2217 drv_sta_set_4addr(local, sta->sdata, &sta->sta, true); in ieee80211_change_station()
2220 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && in ieee80211_change_station()
2221 sta->sdata->u.vlan.sta) in ieee80211_change_station()
2222 RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL); in ieee80211_change_station()
2225 ieee80211_vif_dec_num_mcast(sta->sdata); in ieee80211_change_station()
2227 sta->sdata = vlansdata; in ieee80211_change_station()
2232 ieee80211_vif_inc_num_mcast(sta->sdata); in ieee80211_change_station()
2233 cfg80211_send_layer2_update(sta->sdata->dev, in ieee80211_change_station()
2234 sta->sta.addr); in ieee80211_change_station()
2242 if (sdata->vif.type == NL80211_IFTYPE_STATION && in ieee80211_change_station()
2243 params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) { in ieee80211_change_station()
2265 return -ENOENT; in ieee80211_add_mpath()
2306 return -ENOENT; in ieee80211_change_mpath()
2312 return -ENOENT; in ieee80211_change_mpath()
2324 struct sta_info *next_hop_sta = rcu_dereference(mpath->next_hop); in mpath_set_pinfo()
2327 memcpy(next_hop, next_hop_sta->sta.addr, ETH_ALEN); in mpath_set_pinfo()
2333 pinfo->generation = mpath->sdata->u.mesh.mesh_paths_generation; in mpath_set_pinfo()
2335 pinfo->filled = MPATH_INFO_FRAME_QLEN | in mpath_set_pinfo()
2345 pinfo->frame_qlen = mpath->frame_queue.qlen; in mpath_set_pinfo()
2346 pinfo->sn = mpath->sn; in mpath_set_pinfo()
2347 pinfo->metric = mpath->metric; in mpath_set_pinfo()
2348 if (time_before(jiffies, mpath->exp_time)) in mpath_set_pinfo()
2349 pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies); in mpath_set_pinfo()
2350 pinfo->discovery_timeout = in mpath_set_pinfo()
2351 jiffies_to_msecs(mpath->discovery_timeout); in mpath_set_pinfo()
2352 pinfo->discovery_retries = mpath->discovery_retries; in mpath_set_pinfo()
2353 if (mpath->flags & MESH_PATH_ACTIVE) in mpath_set_pinfo()
2354 pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE; in mpath_set_pinfo()
2355 if (mpath->flags & MESH_PATH_RESOLVING) in mpath_set_pinfo()
2356 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING; in mpath_set_pinfo()
2357 if (mpath->flags & MESH_PATH_SN_VALID) in mpath_set_pinfo()
2358 pinfo->flags |= NL80211_MPATH_FLAG_SN_VALID; in mpath_set_pinfo()
2359 if (mpath->flags & MESH_PATH_FIXED) in mpath_set_pinfo()
2360 pinfo->flags |= NL80211_MPATH_FLAG_FIXED; in mpath_set_pinfo()
2361 if (mpath->flags & MESH_PATH_RESOLVED) in mpath_set_pinfo()
2362 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVED; in mpath_set_pinfo()
2363 pinfo->hop_count = mpath->hop_count; in mpath_set_pinfo()
2364 pinfo->path_change_count = mpath->path_change_count; in mpath_set_pinfo()
2380 return -ENOENT; in ieee80211_get_mpath()
2382 memcpy(dst, mpath->dst, ETH_ALEN); in ieee80211_get_mpath()
2401 return -ENOENT; in ieee80211_dump_mpath()
2403 memcpy(dst, mpath->dst, ETH_ALEN); in ieee80211_dump_mpath()
2413 memcpy(mpp, mpath->mpp, ETH_ALEN); in mpp_set_pinfo()
2415 pinfo->generation = mpath->sdata->u.mesh.mpp_paths_generation; in mpp_set_pinfo()
2431 return -ENOENT; in ieee80211_get_mpp()
2433 memcpy(dst, mpath->dst, ETH_ALEN); in ieee80211_get_mpp()
2452 return -ENOENT; in ieee80211_dump_mpp()
2454 memcpy(dst, mpath->dst, ETH_ALEN); in ieee80211_dump_mpp()
2467 memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config)); in ieee80211_get_mesh_config()
2473 return (mask >> (parm-1)) & 0x1; in _chg_mesh_attr()
2487 if (setup->ie_len) { in copy_mesh_setup()
2488 new_ie = kmemdup(setup->ie, setup->ie_len, in copy_mesh_setup()
2491 return -ENOMEM; in copy_mesh_setup()
2493 ifmsh->ie_len = setup->ie_len; in copy_mesh_setup()
2494 ifmsh->ie = new_ie; in copy_mesh_setup()
2497 ifmsh->mesh_id_len = setup->mesh_id_len; in copy_mesh_setup()
2498 memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len); in copy_mesh_setup()
2499 ifmsh->mesh_sp_id = setup->sync_method; in copy_mesh_setup()
2500 ifmsh->mesh_pp_id = setup->path_sel_proto; in copy_mesh_setup()
2501 ifmsh->mesh_pm_id = setup->path_metric; in copy_mesh_setup()
2502 ifmsh->user_mpm = setup->user_mpm; in copy_mesh_setup()
2503 ifmsh->mesh_auth_id = setup->auth_id; in copy_mesh_setup()
2504 ifmsh->security = IEEE80211_MESH_SEC_NONE; in copy_mesh_setup()
2505 ifmsh->userspace_handles_dfs = setup->userspace_handles_dfs; in copy_mesh_setup()
2506 if (setup->is_authenticated) in copy_mesh_setup()
2507 ifmsh->security |= IEEE80211_MESH_SEC_AUTHED; in copy_mesh_setup()
2508 if (setup->is_secure) in copy_mesh_setup()
2509 ifmsh->security |= IEEE80211_MESH_SEC_SECURED; in copy_mesh_setup()
2512 memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate, in copy_mesh_setup()
2513 sizeof(setup->mcast_rate)); in copy_mesh_setup()
2514 sdata->vif.bss_conf.basic_rates = setup->basic_rates; in copy_mesh_setup()
2516 sdata->vif.bss_conf.beacon_int = setup->beacon_interval; in copy_mesh_setup()
2517 sdata->vif.bss_conf.dtim_period = setup->dtim_period; in copy_mesh_setup()
2519 sdata->beacon_rate_set = false; in copy_mesh_setup()
2520 if (wiphy_ext_feature_isset(sdata->local->hw.wiphy, in copy_mesh_setup()
2523 sdata->beacon_rateidx_mask[i] = in copy_mesh_setup()
2524 setup->beacon_rate.control[i].legacy; in copy_mesh_setup()
2525 if (sdata->beacon_rateidx_mask[i]) in copy_mesh_setup()
2526 sdata->beacon_rate_set = true; in copy_mesh_setup()
2542 ifmsh = &sdata->u.mesh; in ieee80211_update_mesh_config()
2545 conf = &(sdata->u.mesh.mshcfg); in ieee80211_update_mesh_config()
2547 conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout; in ieee80211_update_mesh_config()
2549 conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout; in ieee80211_update_mesh_config()
2551 conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout; in ieee80211_update_mesh_config()
2553 conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks; in ieee80211_update_mesh_config()
2555 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries; in ieee80211_update_mesh_config()
2557 conf->dot11MeshTTL = nconf->dot11MeshTTL; in ieee80211_update_mesh_config()
2559 conf->element_ttl = nconf->element_ttl; in ieee80211_update_mesh_config()
2561 if (ifmsh->user_mpm) in ieee80211_update_mesh_config()
2562 return -EBUSY; in ieee80211_update_mesh_config()
2563 conf->auto_open_plinks = nconf->auto_open_plinks; in ieee80211_update_mesh_config()
2566 conf->dot11MeshNbrOffsetMaxNeighbor = in ieee80211_update_mesh_config()
2567 nconf->dot11MeshNbrOffsetMaxNeighbor; in ieee80211_update_mesh_config()
2569 conf->dot11MeshHWMPmaxPREQretries = in ieee80211_update_mesh_config()
2570 nconf->dot11MeshHWMPmaxPREQretries; in ieee80211_update_mesh_config()
2572 conf->path_refresh_time = nconf->path_refresh_time; in ieee80211_update_mesh_config()
2574 conf->min_discovery_timeout = nconf->min_discovery_timeout; in ieee80211_update_mesh_config()
2576 conf->dot11MeshHWMPactivePathTimeout = in ieee80211_update_mesh_config()
2577 nconf->dot11MeshHWMPactivePathTimeout; in ieee80211_update_mesh_config()
2579 conf->dot11MeshHWMPpreqMinInterval = in ieee80211_update_mesh_config()
2580 nconf->dot11MeshHWMPpreqMinInterval; in ieee80211_update_mesh_config()
2582 conf->dot11MeshHWMPperrMinInterval = in ieee80211_update_mesh_config()
2583 nconf->dot11MeshHWMPperrMinInterval; in ieee80211_update_mesh_config()
2586 conf->dot11MeshHWMPnetDiameterTraversalTime = in ieee80211_update_mesh_config()
2587 nconf->dot11MeshHWMPnetDiameterTraversalTime; in ieee80211_update_mesh_config()
2589 conf->dot11MeshHWMPRootMode = nconf->dot11MeshHWMPRootMode; in ieee80211_update_mesh_config()
2596 if (nconf->dot11MeshGateAnnouncementProtocol && in ieee80211_update_mesh_config()
2597 !(conf->dot11MeshHWMPRootMode > IEEE80211_ROOTMODE_ROOT)) { in ieee80211_update_mesh_config()
2598 conf->dot11MeshHWMPRootMode = IEEE80211_PROACTIVE_RANN; in ieee80211_update_mesh_config()
2601 conf->dot11MeshGateAnnouncementProtocol = in ieee80211_update_mesh_config()
2602 nconf->dot11MeshGateAnnouncementProtocol; in ieee80211_update_mesh_config()
2605 conf->dot11MeshHWMPRannInterval = in ieee80211_update_mesh_config()
2606 nconf->dot11MeshHWMPRannInterval; in ieee80211_update_mesh_config()
2608 conf->dot11MeshForwarding = nconf->dot11MeshForwarding; in ieee80211_update_mesh_config()
2610 /* our RSSI threshold implementation is supported only for in ieee80211_update_mesh_config()
2613 if (!ieee80211_hw_check(&sdata->local->hw, SIGNAL_DBM)) in ieee80211_update_mesh_config()
2614 return -EOPNOTSUPP; in ieee80211_update_mesh_config()
2615 conf->rssi_threshold = nconf->rssi_threshold; in ieee80211_update_mesh_config()
2618 conf->ht_opmode = nconf->ht_opmode; in ieee80211_update_mesh_config()
2619 sdata->vif.bss_conf.ht_operation_mode = nconf->ht_opmode; in ieee80211_update_mesh_config()
2620 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_update_mesh_config()
2624 conf->dot11MeshHWMPactivePathToRootTimeout = in ieee80211_update_mesh_config()
2625 nconf->dot11MeshHWMPactivePathToRootTimeout; in ieee80211_update_mesh_config()
2627 conf->dot11MeshHWMProotInterval = in ieee80211_update_mesh_config()
2628 nconf->dot11MeshHWMProotInterval; in ieee80211_update_mesh_config()
2630 conf->dot11MeshHWMPconfirmationInterval = in ieee80211_update_mesh_config()
2631 nconf->dot11MeshHWMPconfirmationInterval; in ieee80211_update_mesh_config()
2633 conf->power_mode = nconf->power_mode; in ieee80211_update_mesh_config()
2637 conf->dot11MeshAwakeWindowDuration = in ieee80211_update_mesh_config()
2638 nconf->dot11MeshAwakeWindowDuration; in ieee80211_update_mesh_config()
2640 conf->plink_timeout = nconf->plink_timeout; in ieee80211_update_mesh_config()
2642 conf->dot11MeshConnectedToMeshGate = in ieee80211_update_mesh_config()
2643 nconf->dot11MeshConnectedToMeshGate; in ieee80211_update_mesh_config()
2645 conf->dot11MeshNolearn = nconf->dot11MeshNolearn; in ieee80211_update_mesh_config()
2647 conf->dot11MeshConnectedToAuthServer = in ieee80211_update_mesh_config()
2648 nconf->dot11MeshConnectedToAuthServer; in ieee80211_update_mesh_config()
2658 struct ieee80211_chan_req chanreq = { .oper = setup->chandef }; in ieee80211_join_mesh()
2659 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_join_mesh()
2662 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_join_mesh()
2664 memcpy(&ifmsh->mshcfg, conf, sizeof(struct mesh_config)); in ieee80211_join_mesh()
2669 sdata->control_port_over_nl80211 = setup->control_port_over_nl80211; in ieee80211_join_mesh()
2672 sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; in ieee80211_join_mesh()
2673 sdata->deflink.needed_rx_chains = sdata->local->rx_chains; in ieee80211_join_mesh()
2675 err = ieee80211_link_use_channel(&sdata->deflink, &chanreq, in ieee80211_join_mesh()
2687 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_leave_mesh()
2690 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_leave_mesh()
2691 kfree(sdata->u.mesh.ie); in ieee80211_leave_mesh()
2706 link = ieee80211_link_or_deflink(sdata, params->link_id, true); in ieee80211_change_bss()
2710 if (!sdata_dereference(link->u.ap.beacon, sdata)) in ieee80211_change_bss()
2711 return -ENOENT; in ieee80211_change_bss()
2715 return -EINVAL; in ieee80211_change_bss()
2717 if (params->basic_rates) { in ieee80211_change_bss()
2718 if (!ieee80211_parse_bitrates(link->conf->chanreq.oper.width, in ieee80211_change_bss()
2719 wiphy->bands[sband->band], in ieee80211_change_bss()
2720 params->basic_rates, in ieee80211_change_bss()
2721 params->basic_rates_len, in ieee80211_change_bss()
2722 &link->conf->basic_rates)) in ieee80211_change_bss()
2723 return -EINVAL; in ieee80211_change_bss()
2728 if (params->use_cts_prot >= 0) { in ieee80211_change_bss()
2729 link->conf->use_cts_prot = params->use_cts_prot; in ieee80211_change_bss()
2732 if (params->use_short_preamble >= 0) { in ieee80211_change_bss()
2733 link->conf->use_short_preamble = params->use_short_preamble; in ieee80211_change_bss()
2737 if (!link->conf->use_short_slot && in ieee80211_change_bss()
2738 (sband->band == NL80211_BAND_5GHZ || in ieee80211_change_bss()
2739 sband->band == NL80211_BAND_6GHZ)) { in ieee80211_change_bss()
2740 link->conf->use_short_slot = true; in ieee80211_change_bss()
2744 if (params->use_short_slot_time >= 0) { in ieee80211_change_bss()
2745 link->conf->use_short_slot = params->use_short_slot_time; in ieee80211_change_bss()
2749 if (params->ap_isolate >= 0) { in ieee80211_change_bss()
2750 if (params->ap_isolate) in ieee80211_change_bss()
2751 sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS; in ieee80211_change_bss()
2753 sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS; in ieee80211_change_bss()
2757 if (params->ht_opmode >= 0) { in ieee80211_change_bss()
2758 link->conf->ht_operation_mode = (u16)params->ht_opmode; in ieee80211_change_bss()
2762 if (params->p2p_ctwindow >= 0) { in ieee80211_change_bss()
2763 link->conf->p2p_noa_attr.oppps_ctwindow &= in ieee80211_change_bss()
2765 link->conf->p2p_noa_attr.oppps_ctwindow |= in ieee80211_change_bss()
2766 params->p2p_ctwindow & IEEE80211_P2P_OPPPS_CTWINDOW_MASK; in ieee80211_change_bss()
2770 if (params->p2p_opp_ps > 0) { in ieee80211_change_bss()
2771 link->conf->p2p_noa_attr.oppps_ctwindow |= in ieee80211_change_bss()
2774 } else if (params->p2p_opp_ps == 0) { in ieee80211_change_bss()
2775 link->conf->p2p_noa_attr.oppps_ctwindow &= in ieee80211_change_bss()
2792 ieee80211_link_or_deflink(sdata, params->link_id, true); in ieee80211_set_txq_params()
2795 if (!local->ops->conf_tx) in ieee80211_set_txq_params()
2796 return -EOPNOTSUPP; in ieee80211_set_txq_params()
2798 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_set_txq_params()
2799 return -EOPNOTSUPP; in ieee80211_set_txq_params()
2805 p.aifs = params->aifs; in ieee80211_set_txq_params()
2806 p.cw_max = params->cwmax; in ieee80211_set_txq_params()
2807 p.cw_min = params->cwmin; in ieee80211_set_txq_params()
2808 p.txop = params->txop; in ieee80211_set_txq_params()
2811 * Setting tx queue params disables u-apsd because it's only in ieee80211_set_txq_params()
2816 ieee80211_regulatory_limit_wmm_params(sdata, &p, params->ac); in ieee80211_set_txq_params()
2818 link->tx_conf[params->ac] = p; in ieee80211_set_txq_params()
2819 if (drv_conf_tx(local, link, params->ac, &p)) { in ieee80211_set_txq_params()
2820 wiphy_debug(local->hw.wiphy, in ieee80211_set_txq_params()
2822 params->ac); in ieee80211_set_txq_params()
2823 return -EINVAL; in ieee80211_set_txq_params()
2853 sdata = IEEE80211_WDEV_TO_SUB_IF(req->wdev); in ieee80211_scan()
2855 switch (ieee80211_vif_type_p2p(&sdata->vif)) { in ieee80211_scan()
2863 if (sdata->local->ops->hw_scan) in ieee80211_scan()
2879 if (sdata->deflink.u.ap.beacon && in ieee80211_scan()
2880 (!(wiphy->features & NL80211_FEATURE_AP_SCAN) || in ieee80211_scan()
2881 !(req->flags & NL80211_SCAN_FLAG_AP))) in ieee80211_scan()
2882 return -EOPNOTSUPP; in ieee80211_scan()
2886 return -EOPNOTSUPP; in ieee80211_scan()
2904 if (!sdata->local->ops->sched_scan_start) in ieee80211_sched_scan_start()
2905 return -EOPNOTSUPP; in ieee80211_sched_scan_start()
2916 if (!local->ops->sched_scan_stop) in ieee80211_sched_scan_stop()
2917 return -EOPNOTSUPP; in ieee80211_sched_scan_stop()
2973 memcpy(sdata->vif.bss_conf.mcast_rate, rate, in ieee80211_set_mcast_rate()
2977 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_set_mcast_rate()
2991 err = drv_set_frag_threshold(local, wiphy->frag_threshold); in ieee80211_set_wiphy_params()
3004 wiphy->coverage_class : -1; in ieee80211_set_wiphy_params()
3012 err = drv_set_rts_threshold(local, wiphy->rts_threshold); in ieee80211_set_wiphy_params()
3019 if (wiphy->retry_short > IEEE80211_MAX_TX_RETRY) in ieee80211_set_wiphy_params()
3020 return -EINVAL; in ieee80211_set_wiphy_params()
3021 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short; in ieee80211_set_wiphy_params()
3024 if (wiphy->retry_long > IEEE80211_MAX_TX_RETRY) in ieee80211_set_wiphy_params()
3025 return -EINVAL; in ieee80211_set_wiphy_params()
3026 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long; in ieee80211_set_wiphy_params()
3049 int old_power = local->user_power_level; in ieee80211_set_tx_power()
3051 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_set_tx_power()
3056 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { in ieee80211_set_tx_power()
3057 if (!ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) in ieee80211_set_tx_power()
3058 return -EOPNOTSUPP; in ieee80211_set_tx_power()
3060 sdata = wiphy_dereference(local->hw.wiphy, in ieee80211_set_tx_power()
3061 local->monitor_sdata); in ieee80211_set_tx_power()
3063 return -EOPNOTSUPP; in ieee80211_set_tx_power()
3068 sdata->deflink.user_power_level = in ieee80211_set_tx_power()
3075 return -EOPNOTSUPP; in ieee80211_set_tx_power()
3076 sdata->deflink.user_power_level = MBM_TO_DBM(mbm); in ieee80211_set_tx_power()
3080 if (txp_type != sdata->vif.bss_conf.txpower_type) { in ieee80211_set_tx_power()
3082 sdata->vif.bss_conf.txpower_type = txp_type; in ieee80211_set_tx_power()
3092 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; in ieee80211_set_tx_power()
3098 return -EOPNOTSUPP; in ieee80211_set_tx_power()
3099 local->user_power_level = MBM_TO_DBM(mbm); in ieee80211_set_tx_power()
3103 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_set_tx_power()
3104 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { in ieee80211_set_tx_power()
3108 sdata->deflink.user_power_level = local->user_power_level; in ieee80211_set_tx_power()
3109 if (txp_type != sdata->vif.bss_conf.txpower_type) in ieee80211_set_tx_power()
3111 sdata->vif.bss_conf.txpower_type = txp_type; in ieee80211_set_tx_power()
3113 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_set_tx_power()
3114 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) in ieee80211_set_tx_power()
3120 sdata = wiphy_dereference(local->hw.wiphy, in ieee80211_set_tx_power()
3121 local->monitor_sdata); in ieee80211_set_tx_power()
3122 if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) { in ieee80211_set_tx_power()
3123 sdata->deflink.user_power_level = local->user_power_level; in ieee80211_set_tx_power()
3124 if (txp_type != sdata->vif.bss_conf.txpower_type) in ieee80211_set_tx_power()
3126 sdata->vif.bss_conf.txpower_type = txp_type; in ieee80211_set_tx_power()
3132 if (local->emulate_chanctx && in ieee80211_set_tx_power()
3133 (old_power != local->user_power_level)) in ieee80211_set_tx_power()
3146 if (local->ops->get_txpower && in ieee80211_get_tx_power()
3147 (sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in ieee80211_get_tx_power()
3150 if (local->emulate_chanctx) in ieee80211_get_tx_power()
3151 *dbm = local->hw.conf.power_level; in ieee80211_get_tx_power()
3153 *dbm = sdata->vif.bss_conf.txpower; in ieee80211_get_tx_power()
3157 return -EINVAL; in ieee80211_get_tx_power()
3177 if (!local->ops->testmode_cmd) in ieee80211_testmode_cmd()
3178 return -EOPNOTSUPP; in ieee80211_testmode_cmd()
3184 if (sdata->flags & IEEE80211_SDATA_IN_DRIVER) in ieee80211_testmode_cmd()
3185 vif = &sdata->vif; in ieee80211_testmode_cmd()
3188 return local->ops->testmode_cmd(&local->hw, vif, data, len); in ieee80211_testmode_cmd()
3198 if (!local->ops->testmode_dump) in ieee80211_testmode_dump()
3199 return -EOPNOTSUPP; in ieee80211_testmode_dump()
3201 return local->ops->testmode_dump(&local->hw, skb, cb, data, len); in ieee80211_testmode_dump()
3215 lockdep_assert_wiphy(sdata->local->hw.wiphy); in __ieee80211_request_smps_mgd()
3217 if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) in __ieee80211_request_smps_mgd()
3218 return -EINVAL; in __ieee80211_request_smps_mgd()
3220 if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) in __ieee80211_request_smps_mgd()
3223 old_req = link->u.mgd.req_smps; in __ieee80211_request_smps_mgd()
3224 link->u.mgd.req_smps = smps_mode; in __ieee80211_request_smps_mgd()
3229 if (sdata->vif.driver_flags & IEEE80211_VIF_EML_ACTIVE) in __ieee80211_request_smps_mgd()
3241 if (!sdata->u.mgd.associated || in __ieee80211_request_smps_mgd()
3242 link->conf->chanreq.oper.width == NL80211_CHAN_WIDTH_20_NOHT) in __ieee80211_request_smps_mgd()
3245 ap = sdata->vif.cfg.ap_addr; in __ieee80211_request_smps_mgd()
3248 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) { in __ieee80211_request_smps_mgd()
3249 if (!sta->sta.tdls || sta->sdata != sdata || !sta->uploaded || in __ieee80211_request_smps_mgd()
3259 if (tdls_peer_found || !sdata->u.mgd.powersave) in __ieee80211_request_smps_mgd()
3268 ieee80211_vif_is_mld(&sdata->vif) ? in __ieee80211_request_smps_mgd()
3269 link->link_id : -1); in __ieee80211_request_smps_mgd()
3271 link->u.mgd.req_smps = old_req; in __ieee80211_request_smps_mgd()
3282 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); in ieee80211_set_power_mgmt()
3285 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_set_power_mgmt()
3286 return -EOPNOTSUPP; in ieee80211_set_power_mgmt()
3288 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS)) in ieee80211_set_power_mgmt()
3289 return -EOPNOTSUPP; in ieee80211_set_power_mgmt()
3291 if (enabled == sdata->u.mgd.powersave && in ieee80211_set_power_mgmt()
3292 timeout == local->dynamic_ps_forced_timeout) in ieee80211_set_power_mgmt()
3295 sdata->u.mgd.powersave = enabled; in ieee80211_set_power_mgmt()
3296 local->dynamic_ps_forced_timeout = timeout; in ieee80211_set_power_mgmt()
3299 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_set_power_mgmt()
3302 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_power_mgmt()
3307 link->u.mgd.req_smps); in ieee80211_set_power_mgmt()
3310 if (ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) in ieee80211_set_power_mgmt()
3327 if (!link || !link->conf) in ieee80211_set_cqm_rssi_link()
3330 conf = link->conf; in ieee80211_set_cqm_rssi_link()
3333 rssi_thold == conf->cqm_rssi_thold && in ieee80211_set_cqm_rssi_link()
3334 rssi_hyst == conf->cqm_rssi_hyst) in ieee80211_set_cqm_rssi_link()
3337 conf->cqm_rssi_thold = rssi_thold; in ieee80211_set_cqm_rssi_link()
3338 conf->cqm_rssi_hyst = rssi_hyst; in ieee80211_set_cqm_rssi_link()
3339 conf->cqm_rssi_low = rssi_low; in ieee80211_set_cqm_rssi_link()
3340 conf->cqm_rssi_high = rssi_high; in ieee80211_set_cqm_rssi_link()
3341 link->u.mgd.last_cqm_event_signal = 0; in ieee80211_set_cqm_rssi_link()
3343 if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) in ieee80211_set_cqm_rssi_link()
3346 if (sdata->u.mgd.associated && in ieee80211_set_cqm_rssi_link()
3347 (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) in ieee80211_set_cqm_rssi_link()
3356 struct ieee80211_vif *vif = &sdata->vif; in ieee80211_set_cqm_rssi_config()
3359 if (vif->driver_flags & IEEE80211_VIF_BEACON_FILTER && in ieee80211_set_cqm_rssi_config()
3360 !(vif->driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) in ieee80211_set_cqm_rssi_config()
3361 return -EOPNOTSUPP; in ieee80211_set_cqm_rssi_config()
3366 sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_cqm_rssi_config()
3380 struct ieee80211_vif *vif = &sdata->vif; in ieee80211_set_cqm_rssi_range_config()
3383 if (vif->driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_set_cqm_rssi_range_config()
3384 return -EOPNOTSUPP; in ieee80211_set_cqm_rssi_range_config()
3389 sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_cqm_rssi_range_config()
3405 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); in ieee80211_set_bitrate_mask()
3409 return -ENETDOWN; in ieee80211_set_bitrate_mask()
3417 if (rcu_access_pointer(sdata->vif.bss_conf.chanctx_conf) && in ieee80211_set_bitrate_mask()
3418 sdata->vif.bss_conf.chanreq.oper.chan) { in ieee80211_set_bitrate_mask()
3419 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_set_bitrate_mask()
3422 band = sdata->vif.bss_conf.chanreq.oper.chan->band; in ieee80211_set_bitrate_mask()
3424 if (!(mask->control[band].legacy & basic_rates)) in ieee80211_set_bitrate_mask()
3425 return -EINVAL; in ieee80211_set_bitrate_mask()
3428 if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { in ieee80211_set_bitrate_mask()
3435 struct ieee80211_supported_band *sband = wiphy->bands[i]; in ieee80211_set_bitrate_mask()
3438 sdata->rc_rateidx_mask[i] = mask->control[i].legacy; in ieee80211_set_bitrate_mask()
3439 memcpy(sdata->rc_rateidx_mcs_mask[i], mask->control[i].ht_mcs, in ieee80211_set_bitrate_mask()
3440 sizeof(mask->control[i].ht_mcs)); in ieee80211_set_bitrate_mask()
3441 memcpy(sdata->rc_rateidx_vht_mcs_mask[i], in ieee80211_set_bitrate_mask()
3442 mask->control[i].vht_mcs, in ieee80211_set_bitrate_mask()
3443 sizeof(mask->control[i].vht_mcs)); in ieee80211_set_bitrate_mask()
3445 sdata->rc_has_mcs_mask[i] = false; in ieee80211_set_bitrate_mask()
3446 sdata->rc_has_vht_mcs_mask[i] = false; in ieee80211_set_bitrate_mask()
3451 if (sdata->rc_rateidx_mcs_mask[i][j] != 0xff) { in ieee80211_set_bitrate_mask()
3452 sdata->rc_has_mcs_mask[i] = true; in ieee80211_set_bitrate_mask()
3458 if (sdata->rc_rateidx_vht_mcs_mask[i][j] != 0xffff) { in ieee80211_set_bitrate_mask()
3459 sdata->rc_has_vht_mcs_mask[i] = true; in ieee80211_set_bitrate_mask()
3475 struct ieee80211_local *local = sdata->local; in ieee80211_start_radar_detection()
3479 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_start_radar_detection()
3481 if (!list_empty(&local->roc_list) || local->scanning) in ieee80211_start_radar_detection()
3482 return -EBUSY; in ieee80211_start_radar_detection()
3484 link_data = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_start_radar_detection()
3486 return -ENOLINK; in ieee80211_start_radar_detection()
3489 link_data->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_start_radar_detection()
3490 link_data->needed_rx_chains = local->rx_chains; in ieee80211_start_radar_detection()
3497 wiphy_delayed_work_queue(wiphy, &link_data->dfs_cac_timer_work, in ieee80211_start_radar_detection()
3507 struct ieee80211_local *local = sdata->local; in ieee80211_end_cac()
3510 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_end_cac()
3512 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_end_cac()
3513 link_data = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_end_cac()
3518 &link_data->dfs_cac_timer_work); in ieee80211_end_cac()
3520 if (sdata->wdev.links[link_id].cac_started) { in ieee80211_end_cac()
3522 sdata->wdev.links[link_id].cac_started = false; in ieee80211_end_cac()
3534 len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len + in cfg80211_beacon_dup()
3535 beacon->proberesp_ies_len + beacon->assocresp_ies_len + in cfg80211_beacon_dup()
3536 beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len; in cfg80211_beacon_dup()
3538 if (beacon->mbssid_ies) in cfg80211_beacon_dup()
3539 len += ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies, in cfg80211_beacon_dup()
3540 beacon->rnr_ies, in cfg80211_beacon_dup()
3541 beacon->mbssid_ies->cnt); in cfg80211_beacon_dup()
3547 if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) { in cfg80211_beacon_dup()
3548 new_beacon->mbssid_ies = in cfg80211_beacon_dup()
3549 kzalloc(struct_size(new_beacon->mbssid_ies, in cfg80211_beacon_dup()
3550 elem, beacon->mbssid_ies->cnt), in cfg80211_beacon_dup()
3552 if (!new_beacon->mbssid_ies) { in cfg80211_beacon_dup()
3557 if (beacon->rnr_ies && beacon->rnr_ies->cnt) { in cfg80211_beacon_dup()
3558 new_beacon->rnr_ies = in cfg80211_beacon_dup()
3559 kzalloc(struct_size(new_beacon->rnr_ies, in cfg80211_beacon_dup()
3560 elem, beacon->rnr_ies->cnt), in cfg80211_beacon_dup()
3562 if (!new_beacon->rnr_ies) { in cfg80211_beacon_dup()
3563 kfree(new_beacon->mbssid_ies); in cfg80211_beacon_dup()
3571 if (beacon->head_len) { in cfg80211_beacon_dup()
3572 new_beacon->head_len = beacon->head_len; in cfg80211_beacon_dup()
3573 new_beacon->head = pos; in cfg80211_beacon_dup()
3574 memcpy(pos, beacon->head, beacon->head_len); in cfg80211_beacon_dup()
3575 pos += beacon->head_len; in cfg80211_beacon_dup()
3577 if (beacon->tail_len) { in cfg80211_beacon_dup()
3578 new_beacon->tail_len = beacon->tail_len; in cfg80211_beacon_dup()
3579 new_beacon->tail = pos; in cfg80211_beacon_dup()
3580 memcpy(pos, beacon->tail, beacon->tail_len); in cfg80211_beacon_dup()
3581 pos += beacon->tail_len; in cfg80211_beacon_dup()
3583 if (beacon->beacon_ies_len) { in cfg80211_beacon_dup()
3584 new_beacon->beacon_ies_len = beacon->beacon_ies_len; in cfg80211_beacon_dup()
3585 new_beacon->beacon_ies = pos; in cfg80211_beacon_dup()
3586 memcpy(pos, beacon->beacon_ies, beacon->beacon_ies_len); in cfg80211_beacon_dup()
3587 pos += beacon->beacon_ies_len; in cfg80211_beacon_dup()
3589 if (beacon->proberesp_ies_len) { in cfg80211_beacon_dup()
3590 new_beacon->proberesp_ies_len = beacon->proberesp_ies_len; in cfg80211_beacon_dup()
3591 new_beacon->proberesp_ies = pos; in cfg80211_beacon_dup()
3592 memcpy(pos, beacon->proberesp_ies, beacon->proberesp_ies_len); in cfg80211_beacon_dup()
3593 pos += beacon->proberesp_ies_len; in cfg80211_beacon_dup()
3595 if (beacon->assocresp_ies_len) { in cfg80211_beacon_dup()
3596 new_beacon->assocresp_ies_len = beacon->assocresp_ies_len; in cfg80211_beacon_dup()
3597 new_beacon->assocresp_ies = pos; in cfg80211_beacon_dup()
3598 memcpy(pos, beacon->assocresp_ies, beacon->assocresp_ies_len); in cfg80211_beacon_dup()
3599 pos += beacon->assocresp_ies_len; in cfg80211_beacon_dup()
3601 if (beacon->probe_resp_len) { in cfg80211_beacon_dup()
3602 new_beacon->probe_resp_len = beacon->probe_resp_len; in cfg80211_beacon_dup()
3603 new_beacon->probe_resp = pos; in cfg80211_beacon_dup()
3604 memcpy(pos, beacon->probe_resp, beacon->probe_resp_len); in cfg80211_beacon_dup()
3605 pos += beacon->probe_resp_len; in cfg80211_beacon_dup()
3607 if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) { in cfg80211_beacon_dup()
3609 new_beacon->mbssid_ies, in cfg80211_beacon_dup()
3610 beacon->mbssid_ies); in cfg80211_beacon_dup()
3611 if (beacon->rnr_ies && beacon->rnr_ies->cnt) in cfg80211_beacon_dup()
3613 new_beacon->rnr_ies, in cfg80211_beacon_dup()
3614 beacon->rnr_ies); in cfg80211_beacon_dup()
3617 /* might copy -1, meaning no changes requested */ in cfg80211_beacon_dup()
3618 new_beacon->ftm_responder = beacon->ftm_responder; in cfg80211_beacon_dup()
3619 if (beacon->lci) { in cfg80211_beacon_dup()
3620 new_beacon->lci_len = beacon->lci_len; in cfg80211_beacon_dup()
3621 new_beacon->lci = pos; in cfg80211_beacon_dup()
3622 memcpy(pos, beacon->lci, beacon->lci_len); in cfg80211_beacon_dup()
3623 pos += beacon->lci_len; in cfg80211_beacon_dup()
3625 if (beacon->civicloc) { in cfg80211_beacon_dup()
3626 new_beacon->civicloc_len = beacon->civicloc_len; in cfg80211_beacon_dup()
3627 new_beacon->civicloc = pos; in cfg80211_beacon_dup()
3628 memcpy(pos, beacon->civicloc, beacon->civicloc_len); in cfg80211_beacon_dup()
3629 pos += beacon->civicloc_len; in cfg80211_beacon_dup()
3638 struct ieee80211_local *local = sdata->local; in ieee80211_csa_finish()
3646 link_data = rcu_dereference(sdata->link[link_id]); in ieee80211_csa_finish()
3653 if (vif->mbssid_tx_vif == vif) { in ieee80211_csa_finish()
3654 /* Trigger ieee80211_csa_finish() on the non-transmitting in ieee80211_csa_finish()
3660 list_for_each_entry_rcu(iter, &local->interfaces, list) { in ieee80211_csa_finish()
3664 if (iter == sdata || iter->vif.mbssid_tx_vif != vif) in ieee80211_csa_finish()
3667 wiphy_work_queue(iter->local->hw.wiphy, in ieee80211_csa_finish()
3668 &iter->deflink.csa.finalize_work); in ieee80211_csa_finish()
3671 wiphy_work_queue(local->hw.wiphy, &link_data->csa.finalize_work); in ieee80211_csa_finish()
3680 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_channel_switch_disconnect()
3681 struct ieee80211_local *local = sdata->local; in ieee80211_channel_switch_disconnect()
3683 sdata->csa_blocked_queues = block_tx; in ieee80211_channel_switch_disconnect()
3685 wiphy_work_queue(local->hw.wiphy, &ifmgd->csa_connection_drop_work); in ieee80211_channel_switch_disconnect()
3692 struct ieee80211_sub_if_data *sdata = link_data->sdata; in ieee80211_set_after_csa_beacon()
3695 switch (sdata->vif.type) { in ieee80211_set_after_csa_beacon()
3697 if (!link_data->u.ap.next_beacon) in ieee80211_set_after_csa_beacon()
3698 return -EINVAL; in ieee80211_set_after_csa_beacon()
3701 link_data->u.ap.next_beacon, in ieee80211_set_after_csa_beacon()
3722 return -EINVAL; in ieee80211_set_after_csa_beacon()
3730 struct ieee80211_sub_if_data *sdata = link_data->sdata; in __ieee80211_csa_finalize()
3731 struct ieee80211_local *local = sdata->local; in __ieee80211_csa_finalize()
3732 struct ieee80211_bss_conf *link_conf = link_data->conf; in __ieee80211_csa_finalize()
3736 lockdep_assert_wiphy(local->hw.wiphy); in __ieee80211_csa_finalize()
3740 * with multi-vif. once reservation is complete it will re-schedule the in __ieee80211_csa_finalize()
3745 if (link_data->reserved_chanctx) { in __ieee80211_csa_finalize()
3747 * with multi-vif csa driver may call ieee80211_csa_finish() in __ieee80211_csa_finalize()
3751 if (link_data->reserved_ready) in __ieee80211_csa_finalize()
3757 if (!cfg80211_chandef_identical(&link_conf->chanreq.oper, in __ieee80211_csa_finalize()
3758 &link_data->csa.chanreq.oper)) in __ieee80211_csa_finalize()
3759 return -EINVAL; in __ieee80211_csa_finalize()
3761 link_conf->csa_active = false; in __ieee80211_csa_finalize()
3775 cfg80211_ch_switch_notify(sdata->dev, &link_data->csa.chanreq.oper, in __ieee80211_csa_finalize()
3776 link_data->link_id); in __ieee80211_csa_finalize()
3783 struct ieee80211_sub_if_data *sdata = link_data->sdata; in ieee80211_csa_finalize()
3787 link_data->link_id); in ieee80211_csa_finalize()
3788 cfg80211_stop_iface(sdata->local->hw.wiphy, &sdata->wdev, in ieee80211_csa_finalize()
3797 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_csa_finalize_work()
3798 struct ieee80211_local *local = sdata->local; in ieee80211_csa_finalize_work()
3800 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_csa_finalize_work()
3803 if (!link->conf->csa_active) in ieee80211_csa_finalize_work()
3816 struct ieee80211_sub_if_data *sdata = link_data->sdata; in ieee80211_set_csa_beacon()
3820 switch (sdata->vif.type) { in ieee80211_set_csa_beacon()
3822 link_data->u.ap.next_beacon = in ieee80211_set_csa_beacon()
3823 cfg80211_beacon_dup(&params->beacon_after); in ieee80211_set_csa_beacon()
3824 if (!link_data->u.ap.next_beacon) in ieee80211_set_csa_beacon()
3825 return -ENOMEM; in ieee80211_set_csa_beacon()
3843 if (params->count <= 1) in ieee80211_set_csa_beacon()
3846 if ((params->n_counter_offsets_beacon > in ieee80211_set_csa_beacon()
3848 (params->n_counter_offsets_presp > in ieee80211_set_csa_beacon()
3851 return -EINVAL; in ieee80211_set_csa_beacon()
3854 csa.counter_offsets_beacon = params->counter_offsets_beacon; in ieee80211_set_csa_beacon()
3855 csa.counter_offsets_presp = params->counter_offsets_presp; in ieee80211_set_csa_beacon()
3856 csa.n_counter_offsets_beacon = params->n_counter_offsets_beacon; in ieee80211_set_csa_beacon()
3857 csa.n_counter_offsets_presp = params->n_counter_offsets_presp; in ieee80211_set_csa_beacon()
3858 csa.count = params->count; in ieee80211_set_csa_beacon()
3861 &params->beacon_csa, &csa, in ieee80211_set_csa_beacon()
3870 if (!sdata->vif.cfg.ibss_joined) in ieee80211_set_csa_beacon()
3871 return -EINVAL; in ieee80211_set_csa_beacon()
3873 if (params->chandef.width != sdata->u.ibss.chandef.width) in ieee80211_set_csa_beacon()
3874 return -EINVAL; in ieee80211_set_csa_beacon()
3876 switch (params->chandef.width) { in ieee80211_set_csa_beacon()
3878 if (cfg80211_get_chandef_type(&params->chandef) != in ieee80211_set_csa_beacon()
3879 cfg80211_get_chandef_type(&sdata->u.ibss.chandef)) in ieee80211_set_csa_beacon()
3880 return -EINVAL; in ieee80211_set_csa_beacon()
3888 return -EINVAL; in ieee80211_set_csa_beacon()
3892 if (sdata->u.ibss.chandef.chan->band != in ieee80211_set_csa_beacon()
3893 params->chandef.chan->band) in ieee80211_set_csa_beacon()
3894 return -EINVAL; in ieee80211_set_csa_beacon()
3897 if (params->count > 1) { in ieee80211_set_csa_beacon()
3908 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_set_csa_beacon()
3911 if (sdata->vif.bss_conf.chanreq.oper.chan->band != in ieee80211_set_csa_beacon()
3912 params->chandef.chan->band) in ieee80211_set_csa_beacon()
3913 return -EINVAL; in ieee80211_set_csa_beacon()
3915 if (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_NONE) { in ieee80211_set_csa_beacon()
3916 ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_INIT; in ieee80211_set_csa_beacon()
3917 if (!ifmsh->pre_value) in ieee80211_set_csa_beacon()
3918 ifmsh->pre_value = 1; in ieee80211_set_csa_beacon()
3920 ifmsh->pre_value++; in ieee80211_set_csa_beacon()
3924 if (params->count > 1) { in ieee80211_set_csa_beacon()
3927 ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE; in ieee80211_set_csa_beacon()
3932 if (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_INIT) in ieee80211_set_csa_beacon()
3939 return -EOPNOTSUPP; in ieee80211_set_csa_beacon()
3947 link->conf->color_change_active = false; in ieee80211_color_change_abort()
3951 cfg80211_color_change_aborted_notify(link->sdata->dev, link->link_id); in ieee80211_color_change_abort()
3959 struct ieee80211_chan_req chanreq = { .oper = params->chandef }; in __ieee80211_channel_switch()
3960 struct ieee80211_local *local = sdata->local; in __ieee80211_channel_switch()
3962 .link_id = params->link_id, in __ieee80211_channel_switch()
3969 u8 link_id = params->link_id; in __ieee80211_channel_switch()
3972 lockdep_assert_wiphy(local->hw.wiphy); in __ieee80211_channel_switch()
3974 if (!list_empty(&local->roc_list) || local->scanning) in __ieee80211_channel_switch()
3975 return -EBUSY; in __ieee80211_channel_switch()
3977 if (sdata->wdev.links[link_id].cac_started) in __ieee80211_channel_switch()
3978 return -EBUSY; in __ieee80211_channel_switch()
3981 return -EINVAL; in __ieee80211_channel_switch()
3983 link_data = wiphy_dereference(wiphy, sdata->link[link_id]); in __ieee80211_channel_switch()
3985 return -ENOLINK; in __ieee80211_channel_switch()
3987 link_conf = link_data->conf; in __ieee80211_channel_switch()
3989 if (chanreq.oper.punctured && !link_conf->eht_support) in __ieee80211_channel_switch()
3990 return -EINVAL; in __ieee80211_channel_switch()
3993 if (link_conf->csa_active) in __ieee80211_channel_switch()
3994 return -EBUSY; in __ieee80211_channel_switch()
3996 conf = wiphy_dereference(wiphy, link_conf->chanctx_conf); in __ieee80211_channel_switch()
3998 err = -EBUSY; in __ieee80211_channel_switch()
4002 if (params->chandef.chan->freq_offset) { in __ieee80211_channel_switch()
4004 err = -EOPNOTSUPP; in __ieee80211_channel_switch()
4012 ch_switch.block_tx = params->block_tx; in __ieee80211_channel_switch()
4014 ch_switch.count = params->count; in __ieee80211_channel_switch()
4021 chanctx->mode, in __ieee80211_channel_switch()
4022 params->radar_required); in __ieee80211_channel_switch()
4027 err = ieee80211_check_combinations(sdata, NULL, chanctx->mode, 0, -1); in __ieee80211_channel_switch()
4034 if (link_conf->color_change_active) in __ieee80211_channel_switch()
4043 link_data->csa.chanreq = chanreq; in __ieee80211_channel_switch()
4044 link_conf->csa_active = true; in __ieee80211_channel_switch()
4046 if (params->block_tx) in __ieee80211_channel_switch()
4049 cfg80211_ch_switch_started_notify(sdata->dev, in __ieee80211_channel_switch()
4050 &link_data->csa.chanreq.oper, link_id, in __ieee80211_channel_switch()
4051 params->count, params->block_tx); in __ieee80211_channel_switch()
4055 drv_channel_switch_beacon(sdata, &link_data->csa.chanreq.oper); in __ieee80211_channel_switch()
4069 struct ieee80211_local *local = sdata->local; in ieee80211_channel_switch()
4071 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_channel_switch()
4078 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_mgmt_tx_cookie()
4080 local->roc_cookie_counter++; in ieee80211_mgmt_tx_cookie()
4083 if (WARN_ON(local->roc_cookie_counter == 0)) in ieee80211_mgmt_tx_cookie()
4084 local->roc_cookie_counter++; in ieee80211_mgmt_tx_cookie()
4086 return local->roc_cookie_counter; in ieee80211_mgmt_tx_cookie()
4098 return -ENOMEM; in ieee80211_attach_ack_skb()
4100 spin_lock_irqsave(&local->ack_status_lock, spin_flags); in ieee80211_attach_ack_skb()
4101 id = idr_alloc(&local->ack_status_frames, ack_skb, in ieee80211_attach_ack_skb()
4103 spin_unlock_irqrestore(&local->ack_status_lock, spin_flags); in ieee80211_attach_ack_skb()
4107 return -ENOMEM; in ieee80211_attach_ack_skb()
4110 IEEE80211_SKB_CB(skb)->status_data_idr = 1; in ieee80211_attach_ack_skb()
4111 IEEE80211_SKB_CB(skb)->status_data = id; in ieee80211_attach_ack_skb()
4114 IEEE80211_SKB_CB(ack_skb)->ack.cookie = *cookie; in ieee80211_attach_ack_skb()
4131 (local->probe_req_reg != !!(upd->global_stypes & preq_mask)) || in ieee80211_update_mgmt_frame_registrations()
4132 (local->rx_mcast_action_reg != in ieee80211_update_mgmt_frame_registrations()
4133 !!(upd->global_mcast_stypes & action_mask)); in ieee80211_update_mgmt_frame_registrations()
4134 local->probe_req_reg = upd->global_stypes & preq_mask; in ieee80211_update_mgmt_frame_registrations()
4135 local->rx_mcast_action_reg = upd->global_mcast_stypes & action_mask; in ieee80211_update_mgmt_frame_registrations()
4137 intf_change = (sdata->vif.probe_req_reg != in ieee80211_update_mgmt_frame_registrations()
4138 !!(upd->interface_stypes & preq_mask)) || in ieee80211_update_mgmt_frame_registrations()
4139 (sdata->vif.rx_mcast_action_reg != in ieee80211_update_mgmt_frame_registrations()
4140 !!(upd->interface_mcast_stypes & action_mask)); in ieee80211_update_mgmt_frame_registrations()
4141 sdata->vif.probe_req_reg = upd->interface_stypes & preq_mask; in ieee80211_update_mgmt_frame_registrations()
4142 sdata->vif.rx_mcast_action_reg = in ieee80211_update_mgmt_frame_registrations()
4143 upd->interface_mcast_stypes & action_mask; in ieee80211_update_mgmt_frame_registrations()
4145 if (!local->open_count) in ieee80211_update_mgmt_frame_registrations()
4150 sdata->vif.probe_req_reg ? in ieee80211_update_mgmt_frame_registrations()
4163 if (local->started) in ieee80211_set_antenna()
4164 return -EOPNOTSUPP; in ieee80211_set_antenna()
4170 local->rx_chains = hweight8(rx_ant); in ieee80211_set_antenna()
4188 if (!local->ops->set_rekey_data) in ieee80211_set_rekey_data()
4189 return -EOPNOTSUPP; in ieee80211_set_rekey_data()
4200 struct ieee80211_local *local = sdata->local; in ieee80211_probe_client()
4213 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_probe_client()
4218 ret = -ENOLINK; in ieee80211_probe_client()
4222 qos = sta->sta.wme; in ieee80211_probe_client()
4224 chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); in ieee80211_probe_client()
4226 ret = -EINVAL; in ieee80211_probe_client()
4229 band = chanctx_conf->def.chan->band; in ieee80211_probe_client()
4236 size -= 2; in ieee80211_probe_client()
4242 skb = dev_alloc_skb(local->hw.extra_tx_headroom + size); in ieee80211_probe_client()
4244 ret = -ENOMEM; in ieee80211_probe_client()
4248 skb->dev = dev; in ieee80211_probe_client()
4250 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_probe_client()
4253 nullfunc->frame_control = fc; in ieee80211_probe_client()
4254 nullfunc->duration_id = 0; in ieee80211_probe_client()
4255 memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); in ieee80211_probe_client()
4256 memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); in ieee80211_probe_client()
4257 memcpy(nullfunc->addr3, sdata->vif.addr, ETH_ALEN); in ieee80211_probe_client()
4258 nullfunc->seq_ctrl = 0; in ieee80211_probe_client()
4262 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | in ieee80211_probe_client()
4264 info->band = band; in ieee80211_probe_client()
4267 skb->priority = 7; in ieee80211_probe_client()
4269 nullfunc->qos_ctrl = cpu_to_le16(7); in ieee80211_probe_client()
4297 int ret = -ENODATA; in ieee80211_cfg_get_channel()
4300 link = rcu_dereference(sdata->link[link_id]); in ieee80211_cfg_get_channel()
4302 ret = -ENOLINK; in ieee80211_cfg_get_channel()
4306 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_cfg_get_channel()
4308 *chandef = link->conf->chanreq.oper; in ieee80211_cfg_get_channel()
4310 } else if (local->open_count > 0 && in ieee80211_cfg_get_channel()
4311 local->open_count == local->monitors && in ieee80211_cfg_get_channel()
4312 sdata->vif.type == NL80211_IFTYPE_MONITOR) { in ieee80211_cfg_get_channel()
4313 *chandef = local->monitor_chanreq.oper; in ieee80211_cfg_get_channel()
4339 return -ENOMEM; in ieee80211_set_qos_map()
4340 memcpy(&new_qos_map->qos_map, qos_map, sizeof(*qos_map)); in ieee80211_set_qos_map()
4346 old_qos_map = sdata_dereference(sdata->qos_map, sdata); in ieee80211_set_qos_map()
4347 rcu_assign_pointer(sdata->qos_map, new_qos_map); in ieee80211_set_qos_map()
4365 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_ap_chanwidth()
4379 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_add_tx_ts()
4382 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_add_tx_ts()
4383 return -EOPNOTSUPP; in ieee80211_add_tx_ts()
4385 if (!(sdata->wmm_acm & BIT(up))) in ieee80211_add_tx_ts()
4386 return -EINVAL; in ieee80211_add_tx_ts()
4388 if (ifmgd->tx_tspec[ac].admitted_time) in ieee80211_add_tx_ts()
4389 return -EBUSY; in ieee80211_add_tx_ts()
4392 ifmgd->tx_tspec[ac].admitted_time = 32 * admitted_time; in ieee80211_add_tx_ts()
4393 ifmgd->tx_tspec[ac].tsid = tsid; in ieee80211_add_tx_ts()
4394 ifmgd->tx_tspec[ac].up = up; in ieee80211_add_tx_ts()
4404 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_del_tx_ts()
4409 struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; in ieee80211_del_tx_ts()
4412 if (!tx_tspec->admitted_time) in ieee80211_del_tx_ts()
4415 if (tx_tspec->tsid != tsid) in ieee80211_del_tx_ts()
4418 /* due to this new packets will be reassigned to non-ACM ACs */ in ieee80211_del_tx_ts()
4419 tx_tspec->up = -1; in ieee80211_del_tx_ts()
4431 tx_tspec->action = TX_TSPEC_ACTION_STOP_DOWNGRADE; in ieee80211_del_tx_ts()
4432 tx_tspec->downgraded = false; in ieee80211_del_tx_ts()
4441 return -ENOENT; in ieee80211_del_tx_ts()
4453 if (WARN_ON(vif->type != NL80211_IFTYPE_NAN)) in ieee80211_nan_func_terminated()
4456 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_nan_func_terminated()
4458 func = idr_find(&sdata->u.nan.function_inst_ids, inst_id); in ieee80211_nan_func_terminated()
4460 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_nan_func_terminated()
4464 cookie = func->cookie; in ieee80211_nan_func_terminated()
4465 idr_remove(&sdata->u.nan.function_inst_ids, inst_id); in ieee80211_nan_func_terminated()
4467 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_nan_func_terminated()
4483 if (WARN_ON(vif->type != NL80211_IFTYPE_NAN)) in ieee80211_nan_func_match()
4486 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_nan_func_match()
4488 func = idr_find(&sdata->u.nan.function_inst_ids, match->inst_id); in ieee80211_nan_func_match()
4490 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_nan_func_match()
4493 match->cookie = func->cookie; in ieee80211_nan_func_match()
4495 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_nan_func_match()
4507 sdata->u.ap.multicast_to_unicast = enabled; in ieee80211_set_multicast_to_unicast()
4515 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_BACKLOG_BYTES))) { in ieee80211_fill_txq_stats()
4516 txqstats->filled |= BIT(NL80211_TXQ_STATS_BACKLOG_BYTES); in ieee80211_fill_txq_stats()
4517 txqstats->backlog_bytes = txqi->tin.backlog_bytes; in ieee80211_fill_txq_stats()
4520 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS))) { in ieee80211_fill_txq_stats()
4521 txqstats->filled |= BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS); in ieee80211_fill_txq_stats()
4522 txqstats->backlog_packets = txqi->tin.backlog_packets; in ieee80211_fill_txq_stats()
4525 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_FLOWS))) { in ieee80211_fill_txq_stats()
4526 txqstats->filled |= BIT(NL80211_TXQ_STATS_FLOWS); in ieee80211_fill_txq_stats()
4527 txqstats->flows = txqi->tin.flows; in ieee80211_fill_txq_stats()
4530 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_DROPS))) { in ieee80211_fill_txq_stats()
4531 txqstats->filled |= BIT(NL80211_TXQ_STATS_DROPS); in ieee80211_fill_txq_stats()
4532 txqstats->drops = txqi->cstats.drop_count; in ieee80211_fill_txq_stats()
4535 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_ECN_MARKS))) { in ieee80211_fill_txq_stats()
4536 txqstats->filled |= BIT(NL80211_TXQ_STATS_ECN_MARKS); in ieee80211_fill_txq_stats()
4537 txqstats->ecn_marks = txqi->cstats.ecn_mark; in ieee80211_fill_txq_stats()
4540 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_OVERLIMIT))) { in ieee80211_fill_txq_stats()
4541 txqstats->filled |= BIT(NL80211_TXQ_STATS_OVERLIMIT); in ieee80211_fill_txq_stats()
4542 txqstats->overlimit = txqi->tin.overlimit; in ieee80211_fill_txq_stats()
4545 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_COLLISIONS))) { in ieee80211_fill_txq_stats()
4546 txqstats->filled |= BIT(NL80211_TXQ_STATS_COLLISIONS); in ieee80211_fill_txq_stats()
4547 txqstats->collisions = txqi->tin.collisions; in ieee80211_fill_txq_stats()
4550 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_TX_BYTES))) { in ieee80211_fill_txq_stats()
4551 txqstats->filled |= BIT(NL80211_TXQ_STATS_TX_BYTES); in ieee80211_fill_txq_stats()
4552 txqstats->tx_bytes = txqi->tin.tx_bytes; in ieee80211_fill_txq_stats()
4555 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_TX_PACKETS))) { in ieee80211_fill_txq_stats()
4556 txqstats->filled |= BIT(NL80211_TXQ_STATS_TX_PACKETS); in ieee80211_fill_txq_stats()
4557 txqstats->tx_packets = txqi->tin.tx_packets; in ieee80211_fill_txq_stats()
4569 spin_lock_bh(&local->fq.lock); in ieee80211_get_txq_stats()
4574 if (!sdata->vif.txq) { in ieee80211_get_txq_stats()
4578 ieee80211_fill_txq_stats(txqstats, to_txq_info(sdata->vif.txq)); in ieee80211_get_txq_stats()
4581 txqstats->filled |= BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS) | in ieee80211_get_txq_stats()
4587 txqstats->backlog_packets = local->fq.backlog; in ieee80211_get_txq_stats()
4588 txqstats->backlog_bytes = local->fq.memory_usage; in ieee80211_get_txq_stats()
4589 txqstats->overlimit = local->fq.overlimit; in ieee80211_get_txq_stats()
4590 txqstats->overmemory = local->fq.overmemory; in ieee80211_get_txq_stats()
4591 txqstats->collisions = local->fq.collisions; in ieee80211_get_txq_stats()
4592 txqstats->max_flows = local->fq.flows_cnt; in ieee80211_get_txq_stats()
4597 spin_unlock_bh(&local->fq.lock); in ieee80211_get_txq_stats()
4640 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_set_tid_config()
4642 if (!sdata->local->ops->set_tid_config) in ieee80211_set_tid_config()
4643 return -EOPNOTSUPP; in ieee80211_set_tid_config()
4645 if (!tid_conf->peer) in ieee80211_set_tid_config()
4646 return drv_set_tid_config(sdata->local, sdata, NULL, tid_conf); in ieee80211_set_tid_config()
4648 sta = sta_info_get_bss(sdata, tid_conf->peer); in ieee80211_set_tid_config()
4650 return -ENOENT; in ieee80211_set_tid_config()
4652 return drv_set_tid_config(sdata->local, sdata, &sta->sta, tid_conf); in ieee80211_set_tid_config()
4662 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_reset_tid_config()
4664 if (!sdata->local->ops->reset_tid_config) in ieee80211_reset_tid_config()
4665 return -EOPNOTSUPP; in ieee80211_reset_tid_config()
4668 return drv_reset_tid_config(sdata->local, sdata, NULL, tids); in ieee80211_reset_tid_config()
4672 return -ENOENT; in ieee80211_reset_tid_config()
4674 return drv_reset_tid_config(sdata->local, sdata, &sta->sta, tids); in ieee80211_reset_tid_config()
4678 struct cfg80211_sar_specs *sar) in ieee80211_set_sar_specs() argument
4682 if (!local->ops->set_sar_specs) in ieee80211_set_sar_specs()
4683 return -EOPNOTSUPP; in ieee80211_set_sar_specs()
4685 return local->ops->set_sar_specs(&local->hw, sar); in ieee80211_set_sar_specs()
4692 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_set_after_color_change_beacon()
4694 switch (sdata->vif.type) { in ieee80211_set_after_color_change_beacon()
4698 if (!link->u.ap.next_beacon) in ieee80211_set_after_color_change_beacon()
4699 return -EINVAL; in ieee80211_set_after_color_change_beacon()
4702 link->u.ap.next_beacon, in ieee80211_set_after_color_change_beacon()
4713 return -EINVAL; in ieee80211_set_after_color_change_beacon()
4724 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_set_color_change_beacon()
4728 switch (sdata->vif.type) { in ieee80211_set_color_change_beacon()
4730 link->u.ap.next_beacon = in ieee80211_set_color_change_beacon()
4731 cfg80211_beacon_dup(&params->beacon_next); in ieee80211_set_color_change_beacon()
4732 if (!link->u.ap.next_beacon) in ieee80211_set_color_change_beacon()
4733 return -ENOMEM; in ieee80211_set_color_change_beacon()
4735 if (params->count <= 1) in ieee80211_set_color_change_beacon()
4739 params->counter_offset_beacon; in ieee80211_set_color_change_beacon()
4741 params->counter_offset_presp; in ieee80211_set_color_change_beacon()
4742 color_change.count = params->count; in ieee80211_set_color_change_beacon()
4745 &params->beacon_color_change, in ieee80211_set_color_change_beacon()
4753 return -EOPNOTSUPP; in ieee80211_set_color_change_beacon()
4763 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_color_change_bss_config_notify()
4765 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_color_change_bss_config_notify()
4767 link->conf->he_bss_color.color = color; in ieee80211_color_change_bss_config_notify()
4768 link->conf->he_bss_color.enabled = enable; in ieee80211_color_change_bss_config_notify()
4773 if (!sdata->vif.bss_conf.nontransmitted && sdata->vif.mbssid_tx_vif) { in ieee80211_color_change_bss_config_notify()
4776 list_for_each_entry(child, &sdata->local->interfaces, list) { in ieee80211_color_change_bss_config_notify()
4777 if (child != sdata && child->vif.mbssid_tx_vif == &sdata->vif) { in ieee80211_color_change_bss_config_notify()
4778 child->vif.bss_conf.he_bss_color.color = color; in ieee80211_color_change_bss_config_notify()
4779 child->vif.bss_conf.he_bss_color.enabled = enable; in ieee80211_color_change_bss_config_notify()
4781 &child->deflink, in ieee80211_color_change_bss_config_notify()
4790 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_color_change_finalize()
4791 struct ieee80211_local *local = sdata->local; in ieee80211_color_change_finalize()
4795 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_color_change_finalize()
4797 link->conf->color_change_active = false; in ieee80211_color_change_finalize()
4801 cfg80211_color_change_aborted_notify(sdata->dev, link->link_id); in ieee80211_color_change_finalize()
4806 link->conf->color_change_color, in ieee80211_color_change_finalize()
4808 cfg80211_color_change_notify(sdata->dev, link->link_id); in ieee80211_color_change_finalize()
4819 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_color_change_finalize_work()
4820 struct ieee80211_bss_conf *link_conf = link->conf; in ieee80211_color_change_finalize_work()
4821 struct ieee80211_local *local = sdata->local; in ieee80211_color_change_finalize_work()
4823 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_color_change_finalize_work()
4826 if (!link_conf->color_change_active) in ieee80211_color_change_finalize_work()
4841 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_color_collision_detection_work()
4843 cfg80211_obss_color_collision_notify(sdata->dev, link->color_bitmap, in ieee80211_color_collision_detection_work()
4844 link->link_id); in ieee80211_color_collision_detection_work()
4857 link = rcu_dereference(sdata->link[link_id]); in ieee80211_color_change_finish()
4863 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_color_change_finish()
4864 &link->color_change_finalize_work); in ieee80211_color_change_finish()
4882 link = rcu_dereference(sdata->link[link_id]); in ieee80211_obss_color_collision_notify()
4888 if (link->conf->color_change_active || link->conf->csa_active) { in ieee80211_obss_color_collision_notify()
4893 if (wiphy_delayed_work_pending(sdata->local->hw.wiphy, in ieee80211_obss_color_collision_notify()
4894 &link->color_collision_detect_work)) { in ieee80211_obss_color_collision_notify()
4899 link->color_bitmap = color_bitmap; in ieee80211_obss_color_collision_notify()
4903 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_obss_color_collision_notify()
4904 &link->color_collision_detect_work, in ieee80211_obss_color_collision_notify()
4916 struct ieee80211_local *local = sdata->local; in ieee80211_color_change()
4919 u8 link_id = params->link_id; in ieee80211_color_change()
4923 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_color_change()
4926 return -EINVAL; in ieee80211_color_change()
4928 link = wiphy_dereference(wiphy, sdata->link[link_id]); in ieee80211_color_change()
4930 return -ENOLINK; in ieee80211_color_change()
4932 link_conf = link->conf; in ieee80211_color_change()
4934 if (link_conf->nontransmitted) in ieee80211_color_change()
4935 return -EINVAL; in ieee80211_color_change()
4940 if (link_conf->color_change_active || link_conf->csa_active) { in ieee80211_color_change()
4941 err = -EBUSY; in ieee80211_color_change()
4949 link_conf->color_change_active = true; in ieee80211_color_change()
4950 link_conf->color_change_color = params->color; in ieee80211_color_change()
4952 cfg80211_color_change_started_notify(sdata->dev, params->count, link_id); in ieee80211_color_change()
4971 if (!local->ops->set_radar_background) in ieee80211_set_radar_background()
4972 return -EOPNOTSUPP; in ieee80211_set_radar_background()
4974 return local->ops->set_radar_background(&local->hw, chandef); in ieee80211_set_radar_background()
4983 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_add_intf_link()
4985 if (wdev->use_4addr) in ieee80211_add_intf_link()
4986 return -EOPNOTSUPP; in ieee80211_add_intf_link()
4988 return ieee80211_vif_set_links(sdata, wdev->valid_links, 0); in ieee80211_add_intf_link()
4997 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_del_intf_link()
4999 ieee80211_vif_set_links(sdata, wdev->valid_links, 0); in ieee80211_del_intf_link()
5011 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_add_link_station()
5013 sta = sta_info_get_bss(sdata, params->mld_mac); in ieee80211_add_link_station()
5015 return -ENOENT; in ieee80211_add_link_station()
5017 if (!sta->sta.valid_links) in ieee80211_add_link_station()
5018 return -EINVAL; in ieee80211_add_link_station()
5020 if (sta->sta.valid_links & BIT(params->link_id)) in ieee80211_add_link_station()
5021 return -EALREADY; in ieee80211_add_link_station()
5023 ret = ieee80211_sta_allocate_link(sta, params->link_id); in ieee80211_add_link_station()
5029 ieee80211_sta_free_link(sta, params->link_id); in ieee80211_add_link_station()
5034 return ieee80211_sta_activate_link(sta, params->link_id); in ieee80211_add_link_station()
5045 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_mod_link_station()
5047 sta = sta_info_get_bss(sdata, params->mld_mac); in ieee80211_mod_link_station()
5049 return -ENOENT; in ieee80211_mod_link_station()
5051 if (!(sta->sta.valid_links & BIT(params->link_id))) in ieee80211_mod_link_station()
5052 return -EINVAL; in ieee80211_mod_link_station()
5065 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_del_link_station()
5067 sta = sta_info_get_bss(sdata, params->mld_mac); in ieee80211_del_link_station()
5069 return -ENOENT; in ieee80211_del_link_station()
5071 if (!(sta->sta.valid_links & BIT(params->link_id))) in ieee80211_del_link_station()
5072 return -EINVAL; in ieee80211_del_link_station()
5075 if (sta->sta.valid_links == BIT(params->link_id)) in ieee80211_del_link_station()
5076 return -EINVAL; in ieee80211_del_link_station()
5078 ieee80211_sta_remove_link(sta, params->link_id); in ieee80211_del_link_station()
5088 struct ieee80211_local *local = sdata->local; in ieee80211_set_hw_timestamp()
5090 if (!local->ops->set_hw_timestamp) in ieee80211_set_hw_timestamp()
5091 return -EOPNOTSUPP; in ieee80211_set_hw_timestamp()
5094 return -EIO; in ieee80211_set_hw_timestamp()
5096 return local->ops->set_hw_timestamp(&local->hw, &sdata->vif, hwts); in ieee80211_set_hw_timestamp()
5105 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_set_ttlm()