Lines Matching +full:fw +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2024-2025 Intel Corporation
13 #include "fw/api/context.h"
14 #include "fw/api/mac.h"
15 #include "fw/api/time-event.h"
16 #include "fw/api/datapath.h"
22 struct iwl_mld *mld = mld_vif->mld; in iwl_mld_cleanup_vif()
25 mld_vif->emlsr.blocked_reasons &= ~IWL_MLD_EMLSR_BLOCKED_ROC; in iwl_mld_cleanup_vif()
27 if (mld_vif->aux_sta.sta_id != IWL_INVALID_STA) in iwl_mld_cleanup_vif()
28 iwl_mld_free_internal_sta(mld, &mld_vif->aux_sta); in iwl_mld_cleanup_vif()
31 vif->driver_flags &= ~IEEE80211_VIF_EML_ACTIVE; in iwl_mld_cleanup_vif()
33 if (mld_vif->roc_activity != ROC_NUM_ACTIVITIES) in iwl_mld_cleanup_vif()
34 ieee80211_remain_on_channel_expired(mld->hw); in iwl_mld_cleanup_vif()
36 mld_vif->roc_activity = ROC_NUM_ACTIVITIES; in iwl_mld_cleanup_vif()
39 iwl_mld_cleanup_link(mld_vif->mld, link); in iwl_mld_cleanup_vif()
41 /* Correctly allocated primary link in non-MLO mode */ in iwl_mld_cleanup_vif()
43 link_id == 0 && link == &mld_vif->deflink) in iwl_mld_cleanup_vif()
46 if (vif->active_links & BIT(link_id)) in iwl_mld_cleanup_vif()
51 if (link != &mld_vif->deflink) in iwl_mld_cleanup_vif()
53 RCU_INIT_POINTER(mld_vif->link[link_id], NULL); in iwl_mld_cleanup_vif()
56 ieee80211_iter_keys(mld->hw, vif, iwl_mld_cleanup_keys_iter, NULL); in iwl_mld_cleanup_vif()
58 wiphy_delayed_work_cancel(mld->wiphy, &mld_vif->mlo_scan_start_wk); in iwl_mld_cleanup_vif()
68 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_send_mac_cmd()
81 switch (vif->type) { in iwl_mld_mac80211_iftype_to_fw()
83 return vif->p2p ? FW_MAC_TYPE_P2P_STA : FW_MAC_TYPE_BSS_STA; in iwl_mld_mac80211_iftype_to_fw()
104 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_is_nic_ack_enabled()
109 sband = mld->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mld_is_nic_ack_enabled()
112 return own_he_cap && (own_he_cap->he_cap_elem.mac_cap_info[2] & in iwl_mld_is_nic_ack_enabled()
121 if (vif->type == NL80211_IFTYPE_AP) { in iwl_mld_set_he_support()
123 cmd->wifi_gen_v2.he_ap_support = cpu_to_le16(1); in iwl_mld_set_he_support()
125 cmd->wifi_gen.he_ap_support = 1; in iwl_mld_set_he_support()
128 cmd->wifi_gen_v2.he_support = cpu_to_le16(1); in iwl_mld_set_he_support()
130 cmd->wifi_gen.he_support = 1; in iwl_mld_set_he_support()
143 int cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw, in iwl_mld_mac_cmd_fill_common()
147 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_mac_cmd_fill_common()
149 cmd->id_and_color = cpu_to_le32(mld_vif->fw_id); in iwl_mld_mac_cmd_fill_common()
150 cmd->action = cpu_to_le32(action); in iwl_mld_mac_cmd_fill_common()
152 cmd->mac_type = in iwl_mld_mac_cmd_fill_common()
155 memcpy(cmd->local_mld_addr, vif->addr, ETH_ALEN); in iwl_mld_mac_cmd_fill_common()
160 cmd->nic_not_ack_enabled = in iwl_mld_mac_cmd_fill_common()
174 cmd->wifi_gen_v2.eht_support = cpu_to_le32(1); in iwl_mld_mac_cmd_fill_common()
176 cmd->wifi_gen.eht_support = 1; in iwl_mld_mac_cmd_fill_common()
181 if (!link_conf->he_support) in iwl_mld_mac_cmd_fill_common()
199 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_fill_mac_cmd_sta()
201 WARN_ON(vif->type != NL80211_IFTYPE_STATION); in iwl_mld_fill_mac_cmd_sta()
206 cmd->filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_GRP); in iwl_mld_fill_mac_cmd_sta()
208 /* Adding a MAC ctxt with is_assoc set is not allowed in fw in iwl_mld_fill_mac_cmd_sta()
211 if (vif->cfg.assoc && action != FW_CTXT_ACTION_ADD) { in iwl_mld_fill_mac_cmd_sta()
212 cmd->client.is_assoc = 1; in iwl_mld_fill_mac_cmd_sta()
214 if (!iwl_mld_vif_from_mac80211(vif)->authorized) in iwl_mld_fill_mac_cmd_sta()
215 cmd->client.data_policy |= in iwl_mld_fill_mac_cmd_sta()
221 cmd->filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_BEACON); in iwl_mld_fill_mac_cmd_sta()
224 cmd->client.assoc_id = cpu_to_le16(vif->cfg.aid); in iwl_mld_fill_mac_cmd_sta()
228 u16_get_bits(vif->cfg.eml_cap, in iwl_mld_fill_mac_cmd_sta()
231 cmd->client.esr_transition_timeout = in iwl_mld_fill_mac_cmd_sta()
234 cmd->client.medium_sync_delay = in iwl_mld_fill_mac_cmd_sta()
235 cpu_to_le16(vif->cfg.eml_med_sync_delay); in iwl_mld_fill_mac_cmd_sta()
239 if (!link->he_support) in iwl_mld_fill_mac_cmd_sta()
242 if (link->twt_requester) in iwl_mld_fill_mac_cmd_sta()
244 if (link->twt_protected) in iwl_mld_fill_mac_cmd_sta()
246 if (link->twt_broadcast) in iwl_mld_fill_mac_cmd_sta()
251 cmd->client.data_policy |= cpu_to_le16(twt_policy); in iwl_mld_fill_mac_cmd_sta()
253 if (vif->probe_req_reg && vif->cfg.assoc && vif->p2p) in iwl_mld_fill_mac_cmd_sta()
254 cmd->filter_flags |= in iwl_mld_fill_mac_cmd_sta()
264 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_fill_mac_cmd_ap()
266 WARN_ON(vif->type != NL80211_IFTYPE_AP); in iwl_mld_fill_mac_cmd_ap()
268 cmd->filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_PROBE_REQ); in iwl_mld_fill_mac_cmd_ap()
272 * TXing anyway, don't ask FW to pass beacons to prevent unnecessary in iwl_mld_fill_mac_cmd_ap()
273 * wake-ups. in iwl_mld_fill_mac_cmd_ap()
275 if (mld_vif->num_associated_stas) in iwl_mld_fill_mac_cmd_ap()
276 cmd->filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_BEACON); in iwl_mld_fill_mac_cmd_ap()
284 iwl_mld_vif_from_mac80211(vif)->ap_ibss_active) in iwl_mld_go_iterator()
299 ieee80211_iterate_active_interfaces(mld->hw, in iwl_mld_p2p_dev_has_extended_disc()
312 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_fill_mac_cmd_p2p_dev()
318 cmd->filter_flags = cpu_to_le32(MAC_CFG_FILTER_ACCEPT_CONTROL_AND_MGMT); in iwl_mld_fill_mac_cmd_p2p_dev()
321 cmd->p2p_dev.is_disc_extended = cpu_to_le32(1); in iwl_mld_fill_mac_cmd_p2p_dev()
328 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_fill_mac_cmd_ibss()
330 WARN_ON(vif->type != NL80211_IFTYPE_ADHOC); in iwl_mld_fill_mac_cmd_ibss()
332 cmd->filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_BEACON | in iwl_mld_fill_mac_cmd_ibss()
343 .id_and_color = cpu_to_le32(mld_vif->fw_id), in iwl_mld_rm_mac_from_fw()
354 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_mac_fw_action()
361 switch (vif->type) { in iwl_mld_mac_fw_action()
384 return -EOPNOTSUPP; in iwl_mld_mac_fw_action()
410 lockdep_assert_wiphy(mld->wiphy); in IWL_MLD_ALLOC_FN()
412 mld_vif->mld = mld; in IWL_MLD_ALLOC_FN()
413 mld_vif->roc_activity = ROC_NUM_ACTIVITIES; in IWL_MLD_ALLOC_FN()
415 ret = iwl_mld_allocate_vif_fw_id(mld, &mld_vif->fw_id, vif); in IWL_MLD_ALLOC_FN()
419 if (!mld->fw_status.in_hw_restart) { in IWL_MLD_ALLOC_FN()
420 wiphy_work_init(&mld_vif->emlsr.unblock_tpt_wk, in IWL_MLD_ALLOC_FN()
422 wiphy_delayed_work_init(&mld_vif->emlsr.check_tpt_wk, in IWL_MLD_ALLOC_FN()
424 wiphy_delayed_work_init(&mld_vif->emlsr.prevent_done_wk, in IWL_MLD_ALLOC_FN()
426 wiphy_delayed_work_init(&mld_vif->emlsr.tmp_non_bss_done_wk, in IWL_MLD_ALLOC_FN()
428 wiphy_delayed_work_init(&mld_vif->mlo_scan_start_wk, in IWL_MLD_ALLOC_FN()
431 iwl_mld_init_internal_sta(&mld_vif->aux_sta); in IWL_MLD_ALLOC_FN()
441 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_add_vif()
449 RCU_INIT_POINTER(mld->fw_id_to_vif[mld_vif->fw_id], NULL); in iwl_mld_add_vif()
459 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_rm_vif()
463 if (WARN_ON(mld_vif->fw_id >= ARRAY_SIZE(mld->fw_id_to_vif))) in iwl_mld_rm_vif()
464 return -EINVAL; in iwl_mld_rm_vif()
466 RCU_INIT_POINTER(mld->fw_id_to_vif[mld_vif->fw_id], NULL); in iwl_mld_rm_vif()
469 mld_vif->fw_id); in iwl_mld_rm_vif()
497 *fw_id_bitmap |= BIT(mld_vif->fw_id); in iwl_mld_get_fw_id_bss_bitmap_iter()
504 ieee80211_iterate_active_interfaces_mtx(mld->hw, in iwl_mld_get_fw_bss_vifs_ids()
515 const struct iwl_probe_resp_data_notif *notif = (void *)pkt->data; in iwl_mld_handle_probe_resp_data_notif()
521 notif->noa_active, notif->csa_counter); in iwl_mld_handle_probe_resp_data_notif()
523 if (IWL_FW_CHECK(mld, le32_to_cpu(notif->mac_id) >= in iwl_mld_handle_probe_resp_data_notif()
524 ARRAY_SIZE(mld->fw_id_to_vif), in iwl_mld_handle_probe_resp_data_notif()
526 le32_to_cpu(notif->mac_id))) in iwl_mld_handle_probe_resp_data_notif()
529 vif = wiphy_dereference(mld->wiphy, in iwl_mld_handle_probe_resp_data_notif()
530 mld->fw_id_to_vif[le32_to_cpu(notif->mac_id)]); in iwl_mld_handle_probe_resp_data_notif()
539 if (notif->csa_counter != IWL_PROBE_RESP_DATA_NO_CSA && in iwl_mld_handle_probe_resp_data_notif()
540 notif->csa_counter >= 1) in iwl_mld_handle_probe_resp_data_notif()
541 ieee80211_beacon_set_cntdwn(vif, notif->csa_counter); in iwl_mld_handle_probe_resp_data_notif()
543 if (!vif->p2p) in iwl_mld_handle_probe_resp_data_notif()
546 mld_link = &iwl_mld_vif_from_mac80211(vif)->deflink; in iwl_mld_handle_probe_resp_data_notif()
552 memcpy(&new_data->notif, notif, sizeof(new_data->notif)); in iwl_mld_handle_probe_resp_data_notif()
555 new_data->noa_len = sizeof(struct ieee80211_vendor_ie) + in iwl_mld_handle_probe_resp_data_notif()
556 sizeof(new_data->notif.noa_attr) - 1; in iwl_mld_handle_probe_resp_data_notif()
562 if (new_data->notif.noa_attr.len_low == in iwl_mld_handle_probe_resp_data_notif()
564 new_data->noa_len -= sizeof(struct ieee80211_p2p_noa_desc); in iwl_mld_handle_probe_resp_data_notif()
566 old_data = wiphy_dereference(mld->wiphy, mld_link->probe_resp_data); in iwl_mld_handle_probe_resp_data_notif()
567 rcu_assign_pointer(mld_link->probe_resp_data, new_data); in iwl_mld_handle_probe_resp_data_notif()
576 struct iwl_uapsd_misbehaving_ap_notif *notif = (void *)pkt->data; in iwl_mld_handle_uapsd_misbehaving_ap_notif()
579 if (IWL_FW_CHECK(mld, notif->mac_id >= ARRAY_SIZE(mld->fw_id_to_vif), in iwl_mld_handle_uapsd_misbehaving_ap_notif()
580 "mac id is invalid: %d\n", notif->mac_id)) in iwl_mld_handle_uapsd_misbehaving_ap_notif()
583 vif = wiphy_dereference(mld->wiphy, mld->fw_id_to_vif[notif->mac_id]); in iwl_mld_handle_uapsd_misbehaving_ap_notif()
588 IWL_WARN(mld, "uapsd misbehaving AP: %pM\n", vif->bss_conf.bssid); in iwl_mld_handle_uapsd_misbehaving_ap_notif()
594 struct iwl_datapath_monitor_notif *notif = (void *)pkt->data; in iwl_mld_handle_datapath_monitor_notif()
601 if (notif->type != cpu_to_le32(IWL_DP_MON_NOTIF_TYPE_EXT_CCA)) in iwl_mld_handle_datapath_monitor_notif()
604 link = iwl_mld_fw_id_to_link_conf(mld, notif->link_id); in iwl_mld_handle_datapath_monitor_notif()
608 vif = link->vif; in iwl_mld_handle_datapath_monitor_notif()
609 if (WARN_ON(!vif) || vif->type != NL80211_IFTYPE_STATION || in iwl_mld_handle_datapath_monitor_notif()
610 !vif->cfg.assoc) in iwl_mld_handle_datapath_monitor_notif()
613 if (!link->chanreq.oper.chan || in iwl_mld_handle_datapath_monitor_notif()
614 link->chanreq.oper.chan->band != NL80211_BAND_2GHZ || in iwl_mld_handle_datapath_monitor_notif()
615 link->chanreq.oper.width < NL80211_CHAN_WIDTH_40) in iwl_mld_handle_datapath_monitor_notif()
621 if (mld_vif->cca_40mhz_workaround != CCA_40_MHZ_WA_NONE) in iwl_mld_handle_datapath_monitor_notif()
624 mld_vif->cca_40mhz_workaround = CCA_40_MHZ_WA_RECONNECT; in iwl_mld_handle_datapath_monitor_notif()
628 * easiest choice - otherwise we'd have to do some major changes in iwl_mld_handle_datapath_monitor_notif()
633 sband = mld->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mld_handle_datapath_monitor_notif()
635 WARN_ON(!sband->ht_cap.ht_supported); in iwl_mld_handle_datapath_monitor_notif()
636 WARN_ON(!(sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)); in iwl_mld_handle_datapath_monitor_notif()
637 sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; in iwl_mld_handle_datapath_monitor_notif()
645 WARN_ON(!he->has_he); in iwl_mld_handle_datapath_monitor_notif()
646 WARN_ON(!(he->he_cap_elem.phy_cap_info[0] & in iwl_mld_handle_datapath_monitor_notif()
648 he->he_cap_elem.phy_cap_info[0] &= in iwl_mld_handle_datapath_monitor_notif()
662 if (vif->type != NL80211_IFTYPE_STATION) in iwl_mld_reset_cca_40mhz_workaround()
665 if (mld_vif->cca_40mhz_workaround == CCA_40_MHZ_WA_NONE) in iwl_mld_reset_cca_40mhz_workaround()
671 if (mld_vif->cca_40mhz_workaround == CCA_40_MHZ_WA_RECONNECT) { in iwl_mld_reset_cca_40mhz_workaround()
672 mld_vif->cca_40mhz_workaround = CCA_40_MHZ_WA_RESET; in iwl_mld_reset_cca_40mhz_workaround()
678 sband = mld->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mld_reset_cca_40mhz_workaround()
680 sband->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; in iwl_mld_reset_cca_40mhz_workaround()
688 he->he_cap_elem.phy_cap_info[0] |= in iwl_mld_reset_cca_40mhz_workaround()
692 mld_vif->cca_40mhz_workaround = CCA_40_MHZ_WA_NONE; in iwl_mld_reset_cca_40mhz_workaround()
705 return wiphy_dereference(mld->wiphy, in iwl_mld_get_bss_vif()
706 mld->fw_id_to_vif[fw_id]); in iwl_mld_get_bss_vif()