aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/bt-coex.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c54
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c64
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h6
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/quota.c9
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c6
7 files changed, 102 insertions, 41 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
index f3180cf63843..cfff8edefcff 100644
--- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
@@ -594,7 +594,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
594 594
595 /* SoftAP / GO will always be primary */ 595 /* SoftAP / GO will always be primary */
596 if (vif->type == NL80211_IFTYPE_AP) { 596 if (vif->type == NL80211_IFTYPE_AP) {
597 if (!mvmvif->ap_active) 597 if (!mvmvif->ap_ibss_active)
598 return; 598 return;
599 599
600 /* the Ack / Cts kill mask must be default if AP / GO */ 600 /* the Ack / Cts kill mask must be default if AP / GO */
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h
index 44a4959f69c0..39c3148bdfa8 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h
+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h
@@ -170,12 +170,14 @@ struct iwl_mac_data_ap {
170 * @beacon_tsf: beacon transmit time in TSF 170 * @beacon_tsf: beacon transmit time in TSF
171 * @bi: beacon interval in TU 171 * @bi: beacon interval in TU
172 * @bi_reciprocal: 2^32 / bi 172 * @bi_reciprocal: 2^32 / bi
173 * @beacon_template: beacon template ID
173 */ 174 */
174struct iwl_mac_data_ibss { 175struct iwl_mac_data_ibss {
175 __le32 beacon_time; 176 __le32 beacon_time;
176 __le64 beacon_tsf; 177 __le64 beacon_tsf;
177 __le32 bi; 178 __le32 bi;
178 __le32 bi_reciprocal; 179 __le32 bi_reciprocal;
180 __le32 beacon_template;
179} __packed; /* IBSS_MAC_DATA_API_S_VER_1 */ 181} __packed; /* IBSS_MAC_DATA_API_S_VER_1 */
180 182
181/** 183/**
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index 4d1c82271d55..ab5a7ac90dcd 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -242,9 +242,17 @@ static int iwl_mvm_mac_ctxt_allocate_resources(struct iwl_mvm *mvm,
242 * that we should share it with another interface. 242 * that we should share it with another interface.
243 */ 243 */
244 244
245 /* Currently, MAC ID 0 should be used only for the managed vif */ 245 /* Currently, MAC ID 0 should be used only for the managed/IBSS vif */
246 if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) 246 switch (vif->type) {
247 case NL80211_IFTYPE_ADHOC:
248 break;
249 case NL80211_IFTYPE_STATION:
250 if (!vif->p2p)
251 break;
252 /* fall through */
253 default:
247 __clear_bit(0, data.available_mac_ids); 254 __clear_bit(0, data.available_mac_ids);
255 }
248 256
249 ieee80211_iterate_active_interfaces_atomic( 257 ieee80211_iterate_active_interfaces_atomic(
250 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, 258 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
@@ -716,6 +724,31 @@ static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm,
716 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 724 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
717} 725}
718 726
727static int iwl_mvm_mac_ctxt_cmd_ibss(struct iwl_mvm *mvm,
728 struct ieee80211_vif *vif,
729 u32 action)
730{
731 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
732 struct iwl_mac_ctx_cmd cmd = {};
733
734 WARN_ON(vif->type != NL80211_IFTYPE_ADHOC);
735
736 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
737
738 cmd.filter_flags = cpu_to_le32(MAC_FILTER_IN_BEACON |
739 MAC_FILTER_IN_PROBE_REQUEST);
740
741 /* cmd.ibss.beacon_time/cmd.ibss.beacon_tsf are curently ignored */
742 cmd.ibss.bi = cpu_to_le32(vif->bss_conf.beacon_int);
743 cmd.ibss.bi_reciprocal =
744 cpu_to_le32(iwl_mvm_reciprocal(vif->bss_conf.beacon_int));
745
746 /* TODO: Assumes that the beacon id == mac context id */
747 cmd.ibss.beacon_template = cpu_to_le32(mvmvif->id);
748
749 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
750}
751
719struct iwl_mvm_go_iterator_data { 752struct iwl_mvm_go_iterator_data {
720 bool go_active; 753 bool go_active;
721}; 754};
@@ -725,7 +758,8 @@ static void iwl_mvm_go_iterator(void *_data, u8 *mac, struct ieee80211_vif *vif)
725 struct iwl_mvm_go_iterator_data *data = _data; 758 struct iwl_mvm_go_iterator_data *data = _data;
726 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 759 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
727 760
728 if (vif->type == NL80211_IFTYPE_AP && vif->p2p && mvmvif->ap_active) 761 if (vif->type == NL80211_IFTYPE_AP && vif->p2p &&
762 mvmvif->ap_ibss_active)
729 data->go_active = true; 763 data->go_active = true;
730} 764}
731 765
@@ -837,9 +871,10 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
837 cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(rate)); 871 cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(rate));
838 872
839 /* Set up TX beacon command fields */ 873 /* Set up TX beacon command fields */
840 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd, 874 if (vif->type == NL80211_IFTYPE_AP)
841 beacon->data, 875 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd,
842 beacon_skb_len); 876 beacon->data,
877 beacon_skb_len);
843 878
844 /* Submit command */ 879 /* Submit command */
845 cmd.len[0] = sizeof(beacon_cmd); 880 cmd.len[0] = sizeof(beacon_cmd);
@@ -852,14 +887,15 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
852 return iwl_mvm_send_cmd(mvm, &cmd); 887 return iwl_mvm_send_cmd(mvm, &cmd);
853} 888}
854 889
855/* The beacon template for the AP/GO context has changed and needs update */ 890/* The beacon template for the AP/GO/IBSS has changed and needs update */
856int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, 891int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
857 struct ieee80211_vif *vif) 892 struct ieee80211_vif *vif)
858{ 893{
859 struct sk_buff *beacon; 894 struct sk_buff *beacon;
860 int ret; 895 int ret;
861 896
862 WARN_ON(vif->type != NL80211_IFTYPE_AP); 897 WARN_ON(vif->type != NL80211_IFTYPE_AP &&
898 vif->type != NL80211_IFTYPE_ADHOC);
863 899
864 beacon = ieee80211_beacon_get(mvm->hw, vif); 900 beacon = ieee80211_beacon_get(mvm->hw, vif);
865 if (!beacon) 901 if (!beacon)
@@ -1022,6 +1058,8 @@ static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1022 return iwl_mvm_mac_ctxt_cmd_listener(mvm, vif, action); 1058 return iwl_mvm_mac_ctxt_cmd_listener(mvm, vif, action);
1023 case NL80211_IFTYPE_P2P_DEVICE: 1059 case NL80211_IFTYPE_P2P_DEVICE:
1024 return iwl_mvm_mac_ctxt_cmd_p2p_device(mvm, vif, action); 1060 return iwl_mvm_mac_ctxt_cmd_p2p_device(mvm, vif, action);
1061 case NL80211_IFTYPE_ADHOC:
1062 return iwl_mvm_mac_ctxt_cmd_ibss(mvm, vif, action);
1025 default: 1063 default:
1026 break; 1064 break;
1027 } 1065 }
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 65de7960cba0..f40685c3764e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -190,6 +190,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
190 BIT(NL80211_IFTYPE_P2P_GO) | 190 BIT(NL80211_IFTYPE_P2P_GO) |
191 BIT(NL80211_IFTYPE_P2P_DEVICE); 191 BIT(NL80211_IFTYPE_P2P_DEVICE);
192 192
193 /* IBSS has bugs in older versions */
194 if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8)
195 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
196
193 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | 197 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
194 WIPHY_FLAG_DISABLE_BEACON_HINTS | 198 WIPHY_FLAG_DISABLE_BEACON_HINTS |
195 WIPHY_FLAG_IBSS_RSN; 199 WIPHY_FLAG_IBSS_RSN;
@@ -565,7 +569,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
565 * In short: there's not much we can do at this point, other than 569 * In short: there's not much we can do at this point, other than
566 * allocating resources :) 570 * allocating resources :)
567 */ 571 */
568 if (vif->type == NL80211_IFTYPE_AP) { 572 if (vif->type == NL80211_IFTYPE_AP ||
573 vif->type == NL80211_IFTYPE_ADHOC) {
569 u32 qmask = iwl_mvm_mac_get_queues_mask(mvm, vif); 574 u32 qmask = iwl_mvm_mac_get_queues_mask(mvm, vif);
570 ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta, 575 ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta,
571 qmask); 576 qmask);
@@ -715,7 +720,8 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
715 * For AP/GO interface, the tear down of the resources allocated to the 720 * For AP/GO interface, the tear down of the resources allocated to the
716 * interface is be handled as part of the stop_ap flow. 721 * interface is be handled as part of the stop_ap flow.
717 */ 722 */
718 if (vif->type == NL80211_IFTYPE_AP) { 723 if (vif->type == NL80211_IFTYPE_AP ||
724 vif->type == NL80211_IFTYPE_ADHOC) {
719#ifdef CONFIG_NL80211_TESTMODE 725#ifdef CONFIG_NL80211_TESTMODE
720 if (vif == mvm->noa_vif) { 726 if (vif == mvm->noa_vif) {
721 mvm->noa_vif = NULL; 727 mvm->noa_vif = NULL;
@@ -892,7 +898,8 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
892 } 898 }
893} 899}
894 900
895static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 901static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
902 struct ieee80211_vif *vif)
896{ 903{
897 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 904 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
898 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 905 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
@@ -915,7 +922,7 @@ static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
915 if (ret) 922 if (ret)
916 goto out_remove; 923 goto out_remove;
917 924
918 mvmvif->ap_active = true; 925 mvmvif->ap_ibss_active = true;
919 926
920 /* Send the bcast station. At this stage the TBTT and DTIM time events 927 /* Send the bcast station. At this stage the TBTT and DTIM time events
921 * are added and applied to the scheduler */ 928 * are added and applied to the scheduler */
@@ -927,7 +934,7 @@ static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
927 if (ret) 934 if (ret)
928 goto out_rm_bcast; 935 goto out_rm_bcast;
929 936
930 /* Need to update the P2P Device MAC */ 937 /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
931 if (vif->p2p && mvm->p2p_device_vif) 938 if (vif->p2p && mvm->p2p_device_vif)
932 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); 939 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
933 940
@@ -947,7 +954,8 @@ out_unlock:
947 return ret; 954 return ret;
948} 955}
949 956
950static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 957static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
958 struct ieee80211_vif *vif)
951{ 959{
952 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 960 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
953 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 961 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
@@ -956,11 +964,11 @@ static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
956 964
957 mutex_lock(&mvm->mutex); 965 mutex_lock(&mvm->mutex);
958 966
959 mvmvif->ap_active = false; 967 mvmvif->ap_ibss_active = false;
960 968
961 iwl_mvm_bt_coex_vif_change(mvm); 969 iwl_mvm_bt_coex_vif_change(mvm);
962 970
963 /* Need to update the P2P Device MAC */ 971 /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
964 if (vif->p2p && mvm->p2p_device_vif) 972 if (vif->p2p && mvm->p2p_device_vif)
965 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); 973 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
966 974
@@ -972,10 +980,11 @@ static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
972 mutex_unlock(&mvm->mutex); 980 mutex_unlock(&mvm->mutex);
973} 981}
974 982
975static void iwl_mvm_bss_info_changed_ap(struct iwl_mvm *mvm, 983static void
976 struct ieee80211_vif *vif, 984iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm,
977 struct ieee80211_bss_conf *bss_conf, 985 struct ieee80211_vif *vif,
978 u32 changes) 986 struct ieee80211_bss_conf *bss_conf,
987 u32 changes)
979{ 988{
980 /* Need to send a new beacon template to the FW */ 989 /* Need to send a new beacon template to the FW */
981 if (changes & BSS_CHANGED_BEACON) { 990 if (changes & BSS_CHANGED_BEACON) {
@@ -998,7 +1007,8 @@ static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
998 iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes); 1007 iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes);
999 break; 1008 break;
1000 case NL80211_IFTYPE_AP: 1009 case NL80211_IFTYPE_AP:
1001 iwl_mvm_bss_info_changed_ap(mvm, vif, bss_conf, changes); 1010 case NL80211_IFTYPE_ADHOC:
1011 iwl_mvm_bss_info_changed_ap_ibss(mvm, vif, bss_conf, changes);
1002 break; 1012 break;
1003 default: 1013 default:
1004 /* shouldn't happen */ 1014 /* shouldn't happen */
@@ -1302,8 +1312,13 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
1302 1312
1303 switch (cmd) { 1313 switch (cmd) {
1304 case SET_KEY: 1314 case SET_KEY:
1305 if (vif->type == NL80211_IFTYPE_AP && !sta) { 1315 if ((vif->type == NL80211_IFTYPE_ADHOC ||
1306 /* GTK on AP interface is a TX-only key, return 0 */ 1316 vif->type == NL80211_IFTYPE_AP) && !sta) {
1317 /*
1318 * GTK on AP interface is a TX-only key, return 0;
1319 * on IBSS they're per-station and because we're lazy
1320 * we don't support them for RX, so do the same.
1321 */
1307 ret = 0; 1322 ret = 0;
1308 key->hw_key_idx = STA_KEY_IDX_INVALID; 1323 key->hw_key_idx = STA_KEY_IDX_INVALID;
1309 break; 1324 break;
@@ -1347,6 +1362,9 @@ static void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw,
1347{ 1362{
1348 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 1363 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1349 1364
1365 if (keyconf->hw_key_idx == STA_KEY_IDX_INVALID)
1366 return;
1367
1350 iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key); 1368 iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key);
1351} 1369}
1352 1370
@@ -1560,14 +1578,14 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
1560 1578
1561 switch (vif->type) { 1579 switch (vif->type) {
1562 case NL80211_IFTYPE_AP: 1580 case NL80211_IFTYPE_AP:
1581 case NL80211_IFTYPE_ADHOC:
1563 /* 1582 /*
1564 * The AP binding flow is handled as part of the start_ap flow 1583 * The AP binding flow is handled as part of the start_ap flow
1565 * (in bss_info_changed). 1584 * (in bss_info_changed), similarly for IBSS.
1566 */ 1585 */
1567 ret = 0; 1586 ret = 0;
1568 goto out_unlock; 1587 goto out_unlock;
1569 case NL80211_IFTYPE_STATION: 1588 case NL80211_IFTYPE_STATION:
1570 case NL80211_IFTYPE_ADHOC:
1571 case NL80211_IFTYPE_MONITOR: 1589 case NL80211_IFTYPE_MONITOR:
1572 break; 1590 break;
1573 default: 1591 default:
@@ -1613,10 +1631,10 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
1613 1631
1614 iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); 1632 iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data);
1615 1633
1616 if (vif->type == NL80211_IFTYPE_AP)
1617 goto out_unlock;
1618
1619 switch (vif->type) { 1634 switch (vif->type) {
1635 case NL80211_IFTYPE_AP:
1636 case NL80211_IFTYPE_ADHOC:
1637 goto out_unlock;
1620 case NL80211_IFTYPE_MONITOR: 1638 case NL80211_IFTYPE_MONITOR:
1621 mvmvif->monitor_active = false; 1639 mvmvif->monitor_active = false;
1622 iwl_mvm_update_quotas(mvm, NULL); 1640 iwl_mvm_update_quotas(mvm, NULL);
@@ -1744,8 +1762,10 @@ struct ieee80211_ops iwl_mvm_hw_ops = {
1744 .assign_vif_chanctx = iwl_mvm_assign_vif_chanctx, 1762 .assign_vif_chanctx = iwl_mvm_assign_vif_chanctx,
1745 .unassign_vif_chanctx = iwl_mvm_unassign_vif_chanctx, 1763 .unassign_vif_chanctx = iwl_mvm_unassign_vif_chanctx,
1746 1764
1747 .start_ap = iwl_mvm_start_ap, 1765 .start_ap = iwl_mvm_start_ap_ibss,
1748 .stop_ap = iwl_mvm_stop_ap, 1766 .stop_ap = iwl_mvm_stop_ap_ibss,
1767 .join_ibss = iwl_mvm_start_ap_ibss,
1768 .leave_ibss = iwl_mvm_stop_ap_ibss,
1749 1769
1750 .set_tim = iwl_mvm_set_tim, 1770 .set_tim = iwl_mvm_set_tim,
1751 1771
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 28d93051af2c..6235cb729f5c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -262,8 +262,8 @@ struct iwl_mvm_vif_bf_data {
262 * @color: to solve races upon MAC addition and removal 262 * @color: to solve races upon MAC addition and removal
263 * @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA 263 * @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA
264 * @uploaded: indicates the MAC context has been added to the device 264 * @uploaded: indicates the MAC context has been added to the device
265 * @ap_active: indicates that ap context is configured, and that the interface 265 * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface
266 * should get quota etc. 266 * should get quota etc.
267 * @monitor_active: indicates that monitor context is configured, and that the 267 * @monitor_active: indicates that monitor context is configured, and that the
268 * interface should get quota etc. 268 * interface should get quota etc.
269 * @queue_params: QoS params for this MAC 269 * @queue_params: QoS params for this MAC
@@ -279,7 +279,7 @@ struct iwl_mvm_vif {
279 u8 ap_sta_id; 279 u8 ap_sta_id;
280 280
281 bool uploaded; 281 bool uploaded;
282 bool ap_active; 282 bool ap_ibss_active;
283 bool monitor_active; 283 bool monitor_active;
284 struct iwl_mvm_vif_bf_data bf_data; 284 struct iwl_mvm_vif_bf_data bf_data;
285 285
diff --git a/drivers/net/wireless/iwlwifi/mvm/quota.c b/drivers/net/wireless/iwlwifi/mvm/quota.c
index 6c724a076427..3fc986eb0d6c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/quota.c
+++ b/drivers/net/wireless/iwlwifi/mvm/quota.c
@@ -110,7 +110,8 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
110 data->n_interfaces[id]++; 110 data->n_interfaces[id]++;
111 break; 111 break;
112 case NL80211_IFTYPE_AP: 112 case NL80211_IFTYPE_AP:
113 if (mvmvif->ap_active) 113 case NL80211_IFTYPE_ADHOC:
114 if (mvmvif->ap_ibss_active)
114 data->n_interfaces[id]++; 115 data->n_interfaces[id]++;
115 break; 116 break;
116 case NL80211_IFTYPE_MONITOR: 117 case NL80211_IFTYPE_MONITOR:
@@ -119,10 +120,6 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
119 break; 120 break;
120 case NL80211_IFTYPE_P2P_DEVICE: 121 case NL80211_IFTYPE_P2P_DEVICE:
121 break; 122 break;
122 case NL80211_IFTYPE_ADHOC:
123 if (vif->bss_conf.ibss_joined)
124 data->n_interfaces[id]++;
125 break;
126 default: 123 default:
127 WARN_ON_ONCE(1); 124 WARN_ON_ONCE(1);
128 break; 125 break;
@@ -140,7 +137,7 @@ static void iwl_mvm_adjust_quota_for_noa(struct iwl_mvm *mvm,
140 return; 137 return;
141 138
142 mvmvif = iwl_mvm_vif_from_mac80211(mvm->noa_vif); 139 mvmvif = iwl_mvm_vif_from_mac80211(mvm->noa_vif);
143 if (!mvmvif->ap_active) 140 if (!mvmvif->ap_ibss_active)
144 return; 141 return;
145 142
146 phy_id = mvmvif->phy_ctxt->id; 143 phy_id = mvmvif->phy_ctxt->id;
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index fd826c9076f8..329952363a54 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -644,10 +644,14 @@ int iwl_mvm_send_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
644 struct iwl_mvm_int_sta *bsta) 644 struct iwl_mvm_int_sta *bsta)
645{ 645{
646 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 646 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
647 static const u8 baddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; 647 static const u8 _baddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
648 static const u8 *baddr = _baddr;
648 649
649 lockdep_assert_held(&mvm->mutex); 650 lockdep_assert_held(&mvm->mutex);
650 651
652 if (vif->type == NL80211_IFTYPE_ADHOC)
653 baddr = vif->bss_conf.bssid;
654
651 if (WARN_ON_ONCE(bsta->sta_id == IWL_MVM_STATION_COUNT)) 655 if (WARN_ON_ONCE(bsta->sta_id == IWL_MVM_STATION_COUNT))
652 return -ENOSPC; 656 return -ENOSPC;
653 657