Lines Matching +full:link +full:-
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
15 #include "iwl-utils.h"
26 * variable-length part of the beacon. in iwl_mld_set_tim_idx()
28 tim_idx = mgmt->u.beacon.variable - beacon; in iwl_mld_set_tim_idx()
30 /* Parse variable-length elements of beacon to find WLAN_EID_TIM */ in iwl_mld_set_tim_idx()
31 while ((tim_idx < (frame_size - 2)) && in iwl_mld_set_tim_idx()
36 if ((tim_idx < (frame_size - 1)) && beacon[tim_idx] == WLAN_EID_TIM) in iwl_mld_set_tim_idx()
45 struct ieee80211_bss_conf *link, in iwl_mld_get_rate_flags() argument
48 u32 legacy = link->beacon_tx_rate.control[band].legacy; in iwl_mld_get_rate_flags()
53 u32 rate = ffs(legacy) - 1; in iwl_mld_get_rate_flags()
55 mld->hw->wiphy->bands[band]; in iwl_mld_get_rate_flags()
57 rate_idx = sband->bitrates[rate].hw_value; in iwl_mld_get_rate_flags()
66 * 0 - 3 for CCK and 0 - 7 for OFDM. in iwl_mld_get_rate_flags()
69 rate_idx - IWL_FIRST_OFDM_RATE : rate_idx); in iwl_mld_get_rate_flags()
85 hcmd.len[1] = beacon->len; in iwl_mld_send_beacon_template_cmd()
86 hcmd.data[1] = beacon->data; in iwl_mld_send_beacon_template_cmd()
96 struct ieee80211_bss_conf *link) in iwl_mld_fill_beacon_template_cmd() argument
98 struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link); in iwl_mld_fill_beacon_template_cmd()
104 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_fill_beacon_template_cmd()
107 return -EINVAL; in iwl_mld_fill_beacon_template_cmd()
109 cmd->link_id = cpu_to_le32(mld_link->fw_id); in iwl_mld_fill_beacon_template_cmd()
111 ctx = wiphy_dereference(mld->wiphy, link->chanctx_conf); in iwl_mld_fill_beacon_template_cmd()
112 if (WARN_ON(!ctx || !ctx->def.chan)) in iwl_mld_fill_beacon_template_cmd()
113 return -EINVAL; in iwl_mld_fill_beacon_template_cmd()
115 enable_fils = cfg80211_channel_is_psc(ctx->def.chan) || in iwl_mld_fill_beacon_template_cmd()
116 (ctx->def.chan->band == NL80211_BAND_6GHZ && in iwl_mld_fill_beacon_template_cmd()
117 ctx->def.width >= NL80211_CHAN_WIDTH_80); in iwl_mld_fill_beacon_template_cmd()
121 cmd->short_ssid = cpu_to_le32(~crc32_le(~0, vif->cfg.ssid, in iwl_mld_fill_beacon_template_cmd()
122 vif->cfg.ssid_len)); in iwl_mld_fill_beacon_template_cmd()
125 cmd->byte_cnt = cpu_to_le16((u16)beacon->len); in iwl_mld_fill_beacon_template_cmd()
127 flags |= iwl_mld_get_rate_flags(mld, info, vif, link, in iwl_mld_fill_beacon_template_cmd()
128 ctx->def.chan->band); in iwl_mld_fill_beacon_template_cmd()
130 cmd->flags = cpu_to_le16(flags); in iwl_mld_fill_beacon_template_cmd()
132 if (vif->type == NL80211_IFTYPE_AP) { in iwl_mld_fill_beacon_template_cmd()
133 iwl_mld_set_tim_idx(mld, &cmd->tim_idx, in iwl_mld_fill_beacon_template_cmd()
134 beacon->data, beacon->len); in iwl_mld_fill_beacon_template_cmd()
136 cmd->btwt_offset = in iwl_mld_fill_beacon_template_cmd()
137 cpu_to_le32(iwl_find_ie_offset(beacon->data, in iwl_mld_fill_beacon_template_cmd()
139 beacon->len)); in iwl_mld_fill_beacon_template_cmd()
142 cmd->csa_offset = in iwl_mld_fill_beacon_template_cmd()
143 cpu_to_le32(iwl_find_ie_offset(beacon->data, in iwl_mld_fill_beacon_template_cmd()
145 beacon->len)); in iwl_mld_fill_beacon_template_cmd()
146 cmd->ecsa_offset = in iwl_mld_fill_beacon_template_cmd()
147 cpu_to_le32(iwl_find_ie_offset(beacon->data, in iwl_mld_fill_beacon_template_cmd()
149 beacon->len)); in iwl_mld_fill_beacon_template_cmd()
166 WARN_ON(vif->type != NL80211_IFTYPE_AP && in iwl_mld_update_beacon_template()
167 vif->type != NL80211_IFTYPE_ADHOC); in iwl_mld_update_beacon_template()
173 if (mld_vif->beacon_inject_active) { in iwl_mld_update_beacon_template()
176 return -EBUSY; in iwl_mld_update_beacon_template()
180 beacon = ieee80211_beacon_get_template(mld->hw, vif, NULL, in iwl_mld_update_beacon_template()
181 link_conf->link_id); in iwl_mld_update_beacon_template()
183 return -ENOMEM; in iwl_mld_update_beacon_template()
200 struct iwl_mld_link *link; in iwl_mld_free_ap_early_key() local
202 if (WARN_ON(key->link_id < 0)) in iwl_mld_free_ap_early_key()
205 link = iwl_mld_link_dereference_check(mld_vif, key->link_id); in iwl_mld_free_ap_early_key()
206 if (WARN_ON(!link)) in iwl_mld_free_ap_early_key()
209 for (int i = 0; i < ARRAY_SIZE(link->ap_early_keys); i++) { in iwl_mld_free_ap_early_key()
210 if (link->ap_early_keys[i] != key) in iwl_mld_free_ap_early_key()
213 if (WARN_ON(key->hw_key_idx != STA_KEY_IDX_INVALID)) in iwl_mld_free_ap_early_key()
214 key->hw_key_idx = STA_KEY_IDX_INVALID; in iwl_mld_free_ap_early_key()
215 link->ap_early_keys[i] = NULL; in iwl_mld_free_ap_early_key()
223 struct iwl_mld_link *link; in iwl_mld_store_ap_early_key() local
225 if (WARN_ON(key->link_id < 0)) in iwl_mld_store_ap_early_key()
226 return -EINVAL; in iwl_mld_store_ap_early_key()
228 link = iwl_mld_link_dereference_check(mld_vif, key->link_id); in iwl_mld_store_ap_early_key()
229 if (WARN_ON(!link)) in iwl_mld_store_ap_early_key()
230 return -EINVAL; in iwl_mld_store_ap_early_key()
232 for (int i = 0; i < ARRAY_SIZE(link->ap_early_keys); i++) { in iwl_mld_store_ap_early_key()
233 if (!link->ap_early_keys[i]) { in iwl_mld_store_ap_early_key()
234 link->ap_early_keys[i] = key; in iwl_mld_store_ap_early_key()
239 return -ENOSPC; in iwl_mld_store_ap_early_key()
244 struct ieee80211_bss_conf *link) in iwl_mld_send_ap_early_keys() argument
246 struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link); in iwl_mld_send_ap_early_keys()
249 if (WARN_ON(!link)) in iwl_mld_send_ap_early_keys()
250 return -EINVAL; in iwl_mld_send_ap_early_keys()
252 for (int i = 0; i < ARRAY_SIZE(mld_link->ap_early_keys); i++) { in iwl_mld_send_ap_early_keys()
253 struct ieee80211_key_conf *key = mld_link->ap_early_keys[i]; in iwl_mld_send_ap_early_keys()
258 mld_link->ap_early_keys[i] = NULL; in iwl_mld_send_ap_early_keys()
269 struct ieee80211_bss_conf *link) in iwl_mld_start_ap_ibss() argument
276 if (vif->type == NL80211_IFTYPE_AP) in iwl_mld_start_ap_ibss()
277 iwl_mld_send_ap_tx_power_constraint_cmd(mld, vif, link); in iwl_mld_start_ap_ibss()
279 ret = iwl_mld_update_beacon_template(mld, vif, link); in iwl_mld_start_ap_ibss()
283 /* the link should be already activated when assigning chan context, in iwl_mld_start_ap_ibss()
286 ret = iwl_mld_change_link_in_fw(mld, link, in iwl_mld_start_ap_ibss()
293 ret = iwl_mld_add_mcast_sta(mld, vif, link); in iwl_mld_start_ap_ibss()
297 mld_vif->ap_ibss_active = true; in iwl_mld_start_ap_ibss()
299 if (vif->p2p && mld->p2p_device_vif) { in iwl_mld_start_ap_ibss()
300 ret = iwl_mld_mac_fw_action(mld, mld->p2p_device_vif, in iwl_mld_start_ap_ibss()
303 mld_vif->ap_ibss_active = false; in iwl_mld_start_ap_ibss()
308 ret = iwl_mld_add_bcast_sta(mld, vif, link); in iwl_mld_start_ap_ibss()
316 ret = iwl_mld_send_ap_early_keys(mld, vif, link); in iwl_mld_start_ap_ibss()
324 /* When the channel context was added, the link is not yet active, so in iwl_mld_start_ap_ibss()
328 ctx = wiphy_dereference(mld->wiphy, link->chanctx_conf); in iwl_mld_start_ap_ibss()
333 iwl_mld_remove_bcast_sta(mld, vif, link); in iwl_mld_start_ap_ibss()
335 mld_vif->ap_ibss_active = false; in iwl_mld_start_ap_ibss()
336 if (vif->p2p && mld->p2p_device_vif) in iwl_mld_start_ap_ibss()
337 iwl_mld_mac_fw_action(mld, mld->p2p_device_vif, in iwl_mld_start_ap_ibss()
340 iwl_mld_remove_mcast_sta(mld, vif, link); in iwl_mld_start_ap_ibss()
345 struct ieee80211_bss_conf *link) in iwl_mld_stop_ap_ibss() argument
350 mld_vif->ap_ibss_active = false; in iwl_mld_stop_ap_ibss()
352 if (vif->p2p && mld->p2p_device_vif) in iwl_mld_stop_ap_ibss()
353 iwl_mld_mac_fw_action(mld, mld->p2p_device_vif, in iwl_mld_stop_ap_ibss()
360 iwl_mld_remove_bcast_sta(mld, vif, link); in iwl_mld_stop_ap_ibss()
362 iwl_mld_remove_mcast_sta(mld, vif, link); in iwl_mld_stop_ap_ibss()