Path: blob/main/sys/contrib/dev/iwlwifi/mld/link.h
48287 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2024-2025 Intel Corporation3*/4#ifndef __iwl_mld_link_h__5#define __iwl_mld_link_h__67#include <net/mac80211.h>89#include "mld.h"10#include "sta.h"1112/**13* struct iwl_probe_resp_data - data for NoA/CSA updates14* @rcu_head: used for freeing the data on update15* @notif: notification data16* @noa_len: length of NoA attribute, calculated from the notification17*/18struct iwl_probe_resp_data {19struct rcu_head rcu_head;20struct iwl_probe_resp_data_notif notif;21int noa_len;22};2324/**25* struct iwl_mld_link - link configuration parameters26*27* @rcu_head: RCU head for freeing this data.28* @fw_id: the fw id of the link.29* @active: if the link is active or not.30* @queue_params: QoS data from mac80211. This is updated with a call to31* drv_conf_tx per each AC, and then notified once with BSS_CHANGED_QOS.32* So we store it here and then send one link cmd for all the ACs.33* @chan_ctx: pointer to the channel context assigned to the link. If a link34* has an assigned channel context it means that it is active.35* @he_ru_2mhz_block: 26-tone RU OFDMA transmissions should be blocked.36* @igtk: fw can only have one IGTK at a time, whereas mac80211 can have two.37* This tracks the one IGTK that currently exists in FW.38* @bcast_sta: station used for broadcast packets. Used in AP, GO and IBSS.39* @mcast_sta: station used for multicast packets. Used in AP, GO and IBSS.40* @mon_sta: station used for TX injection in monitor interface.41* @average_beacon_energy: average beacon energy for beacons received during42* client connections43* @ap_early_keys: The firmware cannot install keys before bcast/mcast STAs,44* but higher layers work differently, so we store the keys here for45* later installation.46* @silent_deactivation: next deactivation needs to be silent.47* @probe_resp_data: data from FW notification to store NOA related data to be48* inserted into probe response.49*/50struct iwl_mld_link {51struct rcu_head rcu_head;5253/* Add here fields that need clean up on restart */54struct_group(zeroed_on_hw_restart,55u8 fw_id;56bool active;57struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];58struct ieee80211_chanctx_conf __rcu *chan_ctx;59bool he_ru_2mhz_block;60struct ieee80211_key_conf *igtk;61);62/* And here fields that survive a fw restart */63struct iwl_mld_int_sta bcast_sta;64struct iwl_mld_int_sta mcast_sta;65struct iwl_mld_int_sta mon_sta;6667/* we can only have 2 GTK + 2 IGTK + 2 BIGTK active at a time */68struct ieee80211_key_conf *ap_early_keys[6];69u32 average_beacon_energy;70bool silent_deactivation;71struct iwl_probe_resp_data __rcu *probe_resp_data;72};7374/* Cleanup function for struct iwl_mld_link, will be called in restart */75static inline void76iwl_mld_cleanup_link(struct iwl_mld *mld, struct iwl_mld_link *link)77{78struct iwl_probe_resp_data *probe_data;7980probe_data = wiphy_dereference(mld->wiphy, link->probe_resp_data);81RCU_INIT_POINTER(link->probe_resp_data, NULL);82if (probe_data)83kfree_rcu(probe_data, rcu_head);8485CLEANUP_STRUCT(link);86if (link->bcast_sta.sta_id != IWL_INVALID_STA)87iwl_mld_free_internal_sta(mld, &link->bcast_sta);88if (link->mcast_sta.sta_id != IWL_INVALID_STA)89iwl_mld_free_internal_sta(mld, &link->mcast_sta);90if (link->mon_sta.sta_id != IWL_INVALID_STA)91iwl_mld_free_internal_sta(mld, &link->mon_sta);92}9394/* Convert a percentage from [0,100] to [0,255] */95#define NORMALIZE_PERCENT_TO_255(percentage) ((percentage) * 256 / 100)9697int iwl_mld_add_link(struct iwl_mld *mld,98struct ieee80211_bss_conf *bss_conf);99void iwl_mld_remove_link(struct iwl_mld *mld,100struct ieee80211_bss_conf *bss_conf);101int iwl_mld_activate_link(struct iwl_mld *mld,102struct ieee80211_bss_conf *link);103void iwl_mld_deactivate_link(struct iwl_mld *mld,104struct ieee80211_bss_conf *link);105int iwl_mld_change_link_in_fw(struct iwl_mld *mld,106struct ieee80211_bss_conf *link, u32 changes);107void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld,108struct iwl_rx_packet *pkt);109bool iwl_mld_cancel_missed_beacon_notif(struct iwl_mld *mld,110struct iwl_rx_packet *pkt,111u32 removed_link_id);112int iwl_mld_link_set_associated(struct iwl_mld *mld, struct ieee80211_vif *vif,113struct ieee80211_bss_conf *link);114115unsigned int iwl_mld_get_link_grade(struct iwl_mld *mld,116struct ieee80211_bss_conf *link_conf);117118unsigned int iwl_mld_get_chan_load(struct iwl_mld *mld,119struct ieee80211_bss_conf *link_conf);120121int iwl_mld_get_chan_load_by_others(struct iwl_mld *mld,122struct ieee80211_bss_conf *link_conf,123bool expect_active_link);124125void iwl_mld_handle_beacon_filter_notif(struct iwl_mld *mld,126struct iwl_rx_packet *pkt);127128#endif /* __iwl_mld_link_h__ */129130131