Commit cacc1d42 authored by Gregory Greenman's avatar Gregory Greenman Committed by Johannes Berg

wifi: iwlwifi: mvm: add link_conf parameter for add/remove/change link

Add link_conf parameter and change all the relevant calls accordingly.
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.374015eed2e3.Icbf15a18e2599b53f4fa1c92fe3db64b551b84b1@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent ac251da9
...@@ -20,11 +20,16 @@ static int iwl_mvm_link_cmd_send(struct iwl_mvm *mvm, ...@@ -20,11 +20,16 @@ static int iwl_mvm_link_cmd_send(struct iwl_mvm *mvm,
return ret; return ret;
} }
int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf)
{ {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_mvm_phy_ctxt *phyctxt = mvmvif->deflink.phy_ctxt; unsigned int link_id = link_conf->link_id;
struct iwl_link_config_cmd cmd = {}; struct iwl_link_config_cmd cmd = {};
struct iwl_mvm_phy_ctxt *phyctxt;
if (WARN_ON_ONCE(!mvmvif->link[link_id]))
return -EINVAL;
/* Update SF - Disable if needed. if this fails, SF might still be on /* Update SF - Disable if needed. if this fails, SF might still be on
* while many macs are bound, which is forbidden - so fail the binding. * while many macs are bound, which is forbidden - so fail the binding.
...@@ -32,82 +37,94 @@ int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) ...@@ -32,82 +37,94 @@ int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
if (iwl_mvm_sf_update(mvm, vif, false)) if (iwl_mvm_sf_update(mvm, vif, false))
return -EINVAL; return -EINVAL;
/* FIXME: add proper link id allocation */
cmd.link_id = cpu_to_le32(mvmvif->id); cmd.link_id = cpu_to_le32(mvmvif->id);
cmd.mac_id = cpu_to_le32(mvmvif->id); cmd.mac_id = cpu_to_le32(mvmvif->id);
/* P2P-Device already has a valid PHY context during add */ /* P2P-Device already has a valid PHY context during add */
phyctxt = mvmvif->link[link_id]->phy_ctxt;
if (phyctxt) if (phyctxt)
cmd.phy_id = cpu_to_le32(phyctxt->id); cmd.phy_id = cpu_to_le32(phyctxt->id);
else else
cmd.phy_id = cpu_to_le32(FW_CTXT_INVALID); cmd.phy_id = cpu_to_le32(FW_CTXT_INVALID);
memcpy(cmd.local_link_addr, vif->addr, ETH_ALEN); memcpy(cmd.local_link_addr, link_conf->addr, ETH_ALEN);
if (vif->type == NL80211_IFTYPE_ADHOC && vif->bss_conf.bssid) if (vif->type == NL80211_IFTYPE_ADHOC && link_conf->bssid)
memcpy(cmd.ibss_bssid_addr, vif->bss_conf.bssid, ETH_ALEN); memcpy(cmd.ibss_bssid_addr, link_conf->bssid, ETH_ALEN);
return iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_ADD); return iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_ADD);
} }
int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
u32 changes, bool active) u32 changes, bool active)
{ {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_mvm_phy_ctxt *phyctxt = mvmvif->deflink.phy_ctxt; unsigned int link_id = link_conf->link_id;
struct iwl_mvm_phy_ctxt *phyctxt;
struct iwl_link_config_cmd cmd = {}; struct iwl_link_config_cmd cmd = {};
u32 ht_flag, flags = 0, flags_mask = 0; u32 ht_flag, flags = 0, flags_mask = 0;
if (WARN_ON_ONCE(!mvmvif->link[link_id]))
return -EINVAL;
/* FIXME: add proper link id allocation */
cmd.link_id = cpu_to_le32(mvmvif->id); cmd.link_id = cpu_to_le32(mvmvif->id);
/* The phy_id, link address and listen_lmac can be modified only until /* The phy_id, link address and listen_lmac can be modified only until
* the link becomes active, otherwise they will be ignored. * the link becomes active, otherwise they will be ignored.
*/ */
phyctxt = mvmvif->link[link_id]->phy_ctxt;
if (phyctxt) if (phyctxt)
cmd.phy_id = cpu_to_le32(phyctxt->id); cmd.phy_id = cpu_to_le32(phyctxt->id);
else else
cmd.phy_id = cpu_to_le32(FW_CTXT_INVALID); cmd.phy_id = cpu_to_le32(FW_CTXT_INVALID);
cmd.mac_id = cpu_to_le32(mvmvif->id); cmd.mac_id = cpu_to_le32(mvmvif->id);
memcpy(cmd.local_link_addr, vif->addr, ETH_ALEN); memcpy(cmd.local_link_addr, link_conf->addr, ETH_ALEN);
cmd.active = cpu_to_le32(active); cmd.active = cpu_to_le32(active);
if (vif->type == NL80211_IFTYPE_ADHOC && vif->bss_conf.bssid) if (vif->type == NL80211_IFTYPE_ADHOC && link_conf->bssid)
memcpy(cmd.ibss_bssid_addr, vif->bss_conf.bssid, ETH_ALEN); memcpy(cmd.ibss_bssid_addr, link_conf->bssid, ETH_ALEN);
/* TODO: set a value to cmd.listen_lmac when system requiremens /* TODO: set a value to cmd.listen_lmac when system requiremens
* will define it * will define it
*/ */
iwl_mvm_set_fw_basic_rates(mvm, vif, &cmd.cck_rates, &cmd.ofdm_rates); iwl_mvm_set_fw_basic_rates(mvm, vif, link_conf,
&cmd.cck_rates, &cmd.ofdm_rates);
cmd.cck_short_preamble = cpu_to_le32(vif->bss_conf.use_short_preamble); cmd.cck_short_preamble = cpu_to_le32(link_conf->use_short_preamble);
cmd.short_slot = cpu_to_le32(vif->bss_conf.use_short_slot); cmd.short_slot = cpu_to_le32(link_conf->use_short_slot);
/* The fw does not distinguish between ht and fat */ /* The fw does not distinguish between ht and fat */
ht_flag = LINK_PROT_FLG_HT_PROT | LINK_PROT_FLG_FAT_PROT; ht_flag = LINK_PROT_FLG_HT_PROT | LINK_PROT_FLG_FAT_PROT;
iwl_mvm_set_fw_protection_flags(mvm, vif, &cmd.protection_flags, iwl_mvm_set_fw_protection_flags(mvm, vif, link_conf,
&cmd.protection_flags,
ht_flag, LINK_PROT_FLG_TGG_PROTECT); ht_flag, LINK_PROT_FLG_TGG_PROTECT);
iwl_mvm_set_fw_qos_params(mvm, vif, &cmd.ac[0], &cmd.qos_flags); iwl_mvm_set_fw_qos_params(mvm, vif, link_conf, &cmd.ac[0],
&cmd.qos_flags);
cmd.bi = cpu_to_le32(vif->bss_conf.beacon_int); cmd.bi = cpu_to_le32(link_conf->beacon_int);
cmd.dtim_interval = cpu_to_le32(vif->bss_conf.beacon_int * cmd.dtim_interval = cpu_to_le32(link_conf->beacon_int *
vif->bss_conf.dtim_period); link_conf->dtim_period);
if (!vif->bss_conf.he_support || iwlwifi_mod_params.disable_11ax || if (!link_conf->he_support || iwlwifi_mod_params.disable_11ax ||
!vif->cfg.assoc) { !vif->cfg.assoc) {
changes &= ~LINK_CONTEXT_MODIFY_HE_PARAMS; changes &= ~LINK_CONTEXT_MODIFY_HE_PARAMS;
goto send_cmd; goto send_cmd;
} }
cmd.htc_trig_based_pkt_ext = vif->bss_conf.htc_trig_based_pkt_ext; cmd.htc_trig_based_pkt_ext = link_conf->htc_trig_based_pkt_ext;
if (vif->bss_conf.uora_exists) { if (link_conf->uora_exists) {
cmd.rand_alloc_ecwmin = cmd.rand_alloc_ecwmin =
vif->bss_conf.uora_ocw_range & 0x7; link_conf->uora_ocw_range & 0x7;
cmd.rand_alloc_ecwmax = cmd.rand_alloc_ecwmax =
(vif->bss_conf.uora_ocw_range >> 3) & 0x7; (link_conf->uora_ocw_range >> 3) & 0x7;
} }
/* TODO how to set ndp_fdbk_buff_th_exp? */ /* TODO how to set ndp_fdbk_buff_th_exp? */
...@@ -118,20 +135,20 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -118,20 +135,20 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
flags_mask |= LINK_FLG_MU_EDCA_CW; flags_mask |= LINK_FLG_MU_EDCA_CW;
} }
if (vif->bss_conf.eht_puncturing && !iwlwifi_mod_params.disable_11be) if (link_conf->eht_puncturing && !iwlwifi_mod_params.disable_11be)
cmd.puncture_mask = cpu_to_le16(vif->bss_conf.eht_puncturing); cmd.puncture_mask = cpu_to_le16(link_conf->eht_puncturing);
else else
/* This flag can be set only if the MAC has eht support */ /* This flag can be set only if the MAC has eht support */
changes &= ~LINK_CONTEXT_MODIFY_EHT_PARAMS; changes &= ~LINK_CONTEXT_MODIFY_EHT_PARAMS;
cmd.bss_color = vif->bss_conf.he_bss_color.color; cmd.bss_color = link_conf->he_bss_color.color;
if (!vif->bss_conf.he_bss_color.enabled) { if (!link_conf->he_bss_color.enabled) {
flags |= LINK_FLG_BSS_COLOR_DIS; flags |= LINK_FLG_BSS_COLOR_DIS;
flags_mask |= LINK_FLG_BSS_COLOR_DIS; flags_mask |= LINK_FLG_BSS_COLOR_DIS;
} }
cmd.frame_time_rts_th = cpu_to_le16(vif->bss_conf.frame_time_rts_th); cmd.frame_time_rts_th = cpu_to_le16(link_conf->frame_time_rts_th);
/* Block 26-tone RU OFDMA transmissions */ /* Block 26-tone RU OFDMA transmissions */
if (mvmvif->deflink.he_ru_2mhz_block) { if (mvmvif->deflink.he_ru_2mhz_block) {
...@@ -139,10 +156,10 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -139,10 +156,10 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
flags_mask |= LINK_FLG_RU_2MHZ_BLOCK; flags_mask |= LINK_FLG_RU_2MHZ_BLOCK;
} }
if (vif->bss_conf.nontransmitted) { if (link_conf->nontransmitted) {
ether_addr_copy(cmd.ref_bssid_addr, ether_addr_copy(cmd.ref_bssid_addr,
vif->bss_conf.transmitter_bssid); link_conf->transmitter_bssid);
cmd.bssid_index = vif->bss_conf.bssid_index; cmd.bssid_index = link_conf->bssid_index;
} }
send_cmd: send_cmd:
...@@ -153,12 +170,14 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -153,12 +170,14 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
return iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_MODIFY); return iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_MODIFY);
} }
int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf)
{ {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_link_config_cmd cmd = {}; struct iwl_link_config_cmd cmd = {};
int ret; int ret;
/* FIXME: add proper link id allocation */
cmd.link_id = cpu_to_le32(mvmvif->id); cmd.link_id = cpu_to_le32(mvmvif->id);
ret = iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_REMOVE); ret = iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_REMOVE);
......
...@@ -397,16 +397,18 @@ static void iwl_mvm_ack_rates(struct iwl_mvm *mvm, ...@@ -397,16 +397,18 @@ static void iwl_mvm_ack_rates(struct iwl_mvm *mvm,
} }
void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif, void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
__le32 *cck_rates, __le32 *ofdm_rates) __le32 *cck_rates, __le32 *ofdm_rates)
{ {
struct ieee80211_chanctx_conf *chanctx; struct ieee80211_chanctx_conf *chanctx;
u8 cck_ack_rates, ofdm_ack_rates; u8 cck_ack_rates = 0, ofdm_ack_rates = 0;
rcu_read_lock(); rcu_read_lock();
chanctx = rcu_dereference(vif->bss_conf.chanctx_conf); chanctx = rcu_dereference(link_conf->chanctx_conf);
iwl_mvm_ack_rates(mvm, vif, chanctx ? chanctx->def.chan->band iwl_mvm_ack_rates(mvm, vif, chanctx ? chanctx->def.chan->band
: NL80211_BAND_2GHZ, : NL80211_BAND_2GHZ,
&cck_ack_rates, &ofdm_ack_rates); &cck_ack_rates, &ofdm_ack_rates);
rcu_read_unlock(); rcu_read_unlock();
*cck_rates = cpu_to_le32((u32)cck_ack_rates); *cck_rates = cpu_to_le32((u32)cck_ack_rates);
...@@ -415,21 +417,22 @@ void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -415,21 +417,22 @@ void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm, void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
__le32 *protection_flags, u32 ht_flag, __le32 *protection_flags, u32 ht_flag,
u32 tgg_flag) u32 tgg_flag)
{ {
/* for both sta and ap, ht_operation_mode hold the protection_mode */ /* for both sta and ap, ht_operation_mode hold the protection_mode */
u8 protection_mode = vif->bss_conf.ht_operation_mode & u8 protection_mode = link_conf->ht_operation_mode &
IEEE80211_HT_OP_MODE_PROTECTION; IEEE80211_HT_OP_MODE_PROTECTION;
bool ht_enabled = !!(vif->bss_conf.ht_operation_mode & bool ht_enabled = !!(link_conf->ht_operation_mode &
IEEE80211_HT_OP_MODE_PROTECTION); IEEE80211_HT_OP_MODE_PROTECTION);
if (vif->bss_conf.use_cts_prot) if (link_conf->use_cts_prot)
*protection_flags |= cpu_to_le32(tgg_flag); *protection_flags |= cpu_to_le32(tgg_flag);
IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n",
vif->bss_conf.use_cts_prot, link_conf->use_cts_prot,
vif->bss_conf.ht_operation_mode); link_conf->ht_operation_mode);
if (!ht_enabled) if (!ht_enabled)
return; return;
...@@ -448,7 +451,7 @@ void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm, ...@@ -448,7 +451,7 @@ void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm,
break; break;
case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ:
/* Protect when channel wider than 20MHz */ /* Protect when channel wider than 20MHz */
if (vif->bss_conf.chandef.width > NL80211_CHAN_WIDTH_20) if (link_conf->chandef.width > NL80211_CHAN_WIDTH_20)
*protection_flags |= cpu_to_le32(ht_flag); *protection_flags |= cpu_to_le32(ht_flag);
break; break;
default: default:
...@@ -459,6 +462,7 @@ void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm, ...@@ -459,6 +462,7 @@ void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm,
} }
void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif, void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
struct iwl_ac_qos *ac, __le32 *qos_flags) struct iwl_ac_qos *ac, __le32 *qos_flags)
{ {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
...@@ -478,10 +482,10 @@ void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -478,10 +482,10 @@ void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
ac[ucode_ac].fifos_mask = BIT(txf); ac[ucode_ac].fifos_mask = BIT(txf);
} }
if (vif->bss_conf.qos) if (link_conf->qos)
*qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA); *qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA);
if (vif->bss_conf.chandef.width != NL80211_CHAN_WIDTH_20_NOHT) if (link_conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT)
*qos_flags |= cpu_to_le32(MAC_QOS_FLG_TGN); *qos_flags |= cpu_to_le32(MAC_QOS_FLG_TGN);
} }
...@@ -538,7 +542,7 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, ...@@ -538,7 +542,7 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
else else
eth_broadcast_addr(cmd->bssid_addr); eth_broadcast_addr(cmd->bssid_addr);
iwl_mvm_set_fw_basic_rates(mvm, vif, &cmd->cck_rates, iwl_mvm_set_fw_basic_rates(mvm, vif, &vif->bss_conf, &cmd->cck_rates,
&cmd->ofdm_rates); &cmd->ofdm_rates);
cmd->cck_short_preamble = cmd->cck_short_preamble =
...@@ -550,11 +554,13 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, ...@@ -550,11 +554,13 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
cmd->filter_flags = 0; cmd->filter_flags = 0;
iwl_mvm_set_fw_qos_params(mvm, vif, &cmd->ac[0], &cmd->qos_flags); iwl_mvm_set_fw_qos_params(mvm, vif, &vif->bss_conf, &cmd->ac[0],
&cmd->qos_flags);
/* The fw does not distinguish between ht and fat */ /* The fw does not distinguish between ht and fat */
ht_flag = MAC_PROT_FLG_HT_PROT | MAC_PROT_FLG_FAT_PROT; ht_flag = MAC_PROT_FLG_HT_PROT | MAC_PROT_FLG_FAT_PROT;
iwl_mvm_set_fw_protection_flags(mvm, vif, &cmd->protection_flags, iwl_mvm_set_fw_protection_flags(mvm, vif, &vif->bss_conf,
&cmd->protection_flags,
ht_flag, MAC_PROT_FLG_TGG_PROTECT); ht_flag, MAC_PROT_FLG_TGG_PROTECT);
} }
...@@ -570,6 +576,7 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, ...@@ -570,6 +576,7 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm,
} }
void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif, void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
__le64 *dtim_tsf, __le32 *dtim_time, __le64 *dtim_tsf, __le32 *dtim_time,
__le32 *assoc_beacon_arrive_time) __le32 *assoc_beacon_arrive_time)
{ {
...@@ -590,17 +597,17 @@ void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -590,17 +597,17 @@ void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
* 384us in the longest case), this is currently not relevant * 384us in the longest case), this is currently not relevant
* as the firmware wakes up around 2ms before the TBTT. * as the firmware wakes up around 2ms before the TBTT.
*/ */
dtim_offs = vif->bss_conf.sync_dtim_count * dtim_offs = link_conf->sync_dtim_count *
vif->bss_conf.beacon_int; link_conf->beacon_int;
/* convert TU to usecs */ /* convert TU to usecs */
dtim_offs *= 1024; dtim_offs *= 1024;
*dtim_tsf = *dtim_tsf =
cpu_to_le64(vif->bss_conf.sync_tsf + dtim_offs); cpu_to_le64(link_conf->sync_tsf + dtim_offs);
*dtim_time = *dtim_time =
cpu_to_le32(vif->bss_conf.sync_device_ts + dtim_offs); cpu_to_le32(link_conf->sync_device_ts + dtim_offs);
*assoc_beacon_arrive_time = *assoc_beacon_arrive_time =
cpu_to_le32(vif->bss_conf.sync_device_ts); cpu_to_le32(link_conf->sync_device_ts);
IWL_DEBUG_INFO(mvm, "DTIM TBTT is 0x%llx/0x%x, offset %d\n", IWL_DEBUG_INFO(mvm, "DTIM TBTT is 0x%llx/0x%x, offset %d\n",
le64_to_cpu(*dtim_tsf), le64_to_cpu(*dtim_tsf),
...@@ -666,7 +673,8 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, ...@@ -666,7 +673,8 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
!force_assoc_off) { !force_assoc_off) {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
iwl_mvm_set_fw_dtim_tbtt(mvm, vif, &ctxt_sta->dtim_tsf, iwl_mvm_set_fw_dtim_tbtt(mvm, vif, &vif->bss_conf,
&ctxt_sta->dtim_tsf,
&ctxt_sta->dtim_time, &ctxt_sta->dtim_time,
&ctxt_sta->assoc_beacon_arrive_time); &ctxt_sta->assoc_beacon_arrive_time);
......
...@@ -3619,7 +3619,7 @@ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw, ...@@ -3619,7 +3619,7 @@ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw,
callbacks->mac_ctxt_changed(mvm, vif, false); callbacks->mac_ctxt_changed(mvm, vif, false);
if (mvm->mld_api_is_used) if (mvm->mld_api_is_used)
iwl_mvm_link_changed(mvm, vif, iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
LINK_CONTEXT_MODIFY_ALL & LINK_CONTEXT_MODIFY_ALL &
~LINK_CONTEXT_MODIFY_ACTIVE, ~LINK_CONTEXT_MODIFY_ACTIVE,
true); true);
......
...@@ -67,11 +67,13 @@ static int iwl_mvm_mld_mac_add_interface(struct ieee80211_hw *hw, ...@@ -67,11 +67,13 @@ static int iwl_mvm_mld_mac_add_interface(struct ieee80211_hw *hw,
} }
iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt);
ret = iwl_mvm_add_link(mvm, vif); ret = iwl_mvm_add_link(mvm, vif, &vif->bss_conf);
if (ret) if (ret)
goto out_unref_phy; goto out_unref_phy;
ret = iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE, ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
LINK_CONTEXT_MODIFY_ACTIVE |
LINK_CONTEXT_MODIFY_RATES_INFO,
true); true);
if (ret) if (ret)
goto out_remove_link; goto out_remove_link;
...@@ -85,7 +87,7 @@ static int iwl_mvm_mld_mac_add_interface(struct ieee80211_hw *hw, ...@@ -85,7 +87,7 @@ static int iwl_mvm_mld_mac_add_interface(struct ieee80211_hw *hw,
*/ */
mvm->p2p_device_vif = vif; mvm->p2p_device_vif = vif;
} else { } else {
ret = iwl_mvm_add_link(mvm, vif); ret = iwl_mvm_add_link(mvm, vif, &vif->bss_conf);
if (ret) if (ret)
goto out_free_bf; goto out_free_bf;
} }
...@@ -117,8 +119,9 @@ static int iwl_mvm_mld_mac_add_interface(struct ieee80211_hw *hw, ...@@ -117,8 +119,9 @@ static int iwl_mvm_mld_mac_add_interface(struct ieee80211_hw *hw,
out_remove_link: out_remove_link:
/* Link needs to be deactivated before removal */ /* Link needs to be deactivated before removal */
iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE, false); iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
iwl_mvm_remove_link(mvm, vif); LINK_CONTEXT_MODIFY_ACTIVE, false);
iwl_mvm_remove_link(mvm, vif, &vif->bss_conf);
out_unref_phy: out_unref_phy:
iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt);
out_free_bf: out_free_bf:
...@@ -193,13 +196,13 @@ static void iwl_mvm_mld_mac_remove_interface(struct ieee80211_hw *hw, ...@@ -193,13 +196,13 @@ static void iwl_mvm_mld_mac_remove_interface(struct ieee80211_hw *hw,
mvm->p2p_device_vif = NULL; mvm->p2p_device_vif = NULL;
iwl_mvm_mld_rm_bcast_sta(mvm, vif); iwl_mvm_mld_rm_bcast_sta(mvm, vif);
/* Link needs to be deactivated before removal */ /* Link needs to be deactivated before removal */
iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE, iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
false); LINK_CONTEXT_MODIFY_ACTIVE, false);
iwl_mvm_remove_link(mvm, vif); iwl_mvm_remove_link(mvm, vif, &vif->bss_conf);
iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt);
mvmvif->deflink.phy_ctxt = NULL; mvmvif->deflink.phy_ctxt = NULL;
} else { } else {
iwl_mvm_remove_link(mvm, vif); iwl_mvm_remove_link(mvm, vif, &vif->bss_conf);
} }
iwl_mvm_mld_mac_ctxt_remove(mvm, vif); iwl_mvm_mld_mac_ctxt_remove(mvm, vif);
...@@ -233,12 +236,13 @@ static int __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm, ...@@ -233,12 +236,13 @@ static int __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm,
} }
/* send it first with phy context ID */ /* send it first with phy context ID */
ret = iwl_mvm_link_changed(mvm, vif, 0, false); ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf, 0, false);
if (ret) if (ret)
goto out; goto out;
/* then activate */ /* then activate */
ret = iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE | ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
LINK_CONTEXT_MODIFY_ACTIVE |
LINK_CONTEXT_MODIFY_RATES_INFO, LINK_CONTEXT_MODIFY_RATES_INFO,
true); true);
if (ret) if (ret)
...@@ -259,7 +263,8 @@ static int __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm, ...@@ -259,7 +263,8 @@ static int __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm,
return 0; return 0;
deactivate: deactivate:
iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE, false); iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
LINK_CONTEXT_MODIFY_ACTIVE, false);
out: out:
mvmvif->deflink.phy_ctxt = NULL; mvmvif->deflink.phy_ctxt = NULL;
iwl_mvm_power_update_mac(mvm); iwl_mvm_power_update_mac(mvm);
...@@ -303,7 +308,8 @@ static void __iwl_mvm_mld_unassign_vif_chanctx(struct iwl_mvm *mvm, ...@@ -303,7 +308,8 @@ static void __iwl_mvm_mld_unassign_vif_chanctx(struct iwl_mvm *mvm,
if (vif->type == NL80211_IFTYPE_MONITOR) if (vif->type == NL80211_IFTYPE_MONITOR)
iwl_mvm_mld_rm_snif_sta(mvm, vif); iwl_mvm_mld_rm_snif_sta(mvm, vif);
iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE, false); iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
LINK_CONTEXT_MODIFY_ACTIVE, false);
if (switching_chanctx) if (switching_chanctx)
return; return;
...@@ -337,7 +343,7 @@ static int iwl_mvm_mld_start_ap_ibss(struct ieee80211_hw *hw, ...@@ -337,7 +343,7 @@ static int iwl_mvm_mld_start_ap_ibss(struct ieee80211_hw *hw,
if (ret) if (ret)
goto out_unlock; goto out_unlock;
ret = iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ALL, ret = iwl_mvm_link_changed(mvm, vif, link_conf, LINK_CONTEXT_MODIFY_ALL,
true); true);
if (ret) if (ret)
goto out_unlock; goto out_unlock;
...@@ -477,7 +483,8 @@ iwl_mvm_mld_bss_info_changed_station(struct iwl_mvm *mvm, ...@@ -477,7 +483,8 @@ iwl_mvm_mld_bss_info_changed_station(struct iwl_mvm *mvm,
link_changes |= LINK_CONTEXT_MODIFY_EHT_PARAMS; link_changes |= LINK_CONTEXT_MODIFY_EHT_PARAMS;
if (link_changes) { if (link_changes) {
ret = iwl_mvm_link_changed(mvm, vif, link_changes, true); ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
link_changes, true);
if (ret) if (ret)
IWL_ERR(mvm, "failed to update link\n"); IWL_ERR(mvm, "failed to update link\n");
} }
...@@ -576,7 +583,8 @@ iwl_mvm_mld_bss_info_changed_ap_ibss(struct iwl_mvm *mvm, ...@@ -576,7 +583,8 @@ iwl_mvm_mld_bss_info_changed_ap_ibss(struct iwl_mvm *mvm,
if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_HT | if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_HT |
BSS_CHANGED_BANDWIDTH | BSS_CHANGED_QOS) && BSS_CHANGED_BANDWIDTH | BSS_CHANGED_QOS) &&
iwl_mvm_link_changed(mvm, vif, link_changes, true)) iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
link_changes, true))
IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);
/* Need to send a new beacon template to the FW */ /* Need to send a new beacon template to the FW */
...@@ -661,7 +669,7 @@ iwl_mvm_mld_mac_conf_tx(struct ieee80211_hw *hw, ...@@ -661,7 +669,7 @@ iwl_mvm_mld_mac_conf_tx(struct ieee80211_hw *hw,
int ret; int ret;
mutex_lock(&mvm->mutex); mutex_lock(&mvm->mutex);
ret = iwl_mvm_link_changed(mvm, vif, ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
LINK_CONTEXT_MODIFY_QOS_PARAMS, LINK_CONTEXT_MODIFY_QOS_PARAMS,
true); true);
mutex_unlock(&mvm->mutex); mutex_unlock(&mvm->mutex);
...@@ -683,7 +691,8 @@ static int iwl_mvm_link_switch_phy_ctx(struct iwl_mvm *mvm, ...@@ -683,7 +691,8 @@ static int iwl_mvm_link_switch_phy_ctx(struct iwl_mvm *mvm,
* inactive. Therefore, first deactivate the link, then change its * inactive. Therefore, first deactivate the link, then change its
* phy_ctx, and then activate it again. * phy_ctx, and then activate it again.
*/ */
ret = iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE, false); ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
LINK_CONTEXT_MODIFY_ACTIVE, false);
if (WARN(ret, "Failed to deactivate link\n")) if (WARN(ret, "Failed to deactivate link\n"))
return ret; return ret;
...@@ -691,11 +700,12 @@ static int iwl_mvm_link_switch_phy_ctx(struct iwl_mvm *mvm, ...@@ -691,11 +700,12 @@ static int iwl_mvm_link_switch_phy_ctx(struct iwl_mvm *mvm,
mvmvif->deflink.phy_ctxt = new_phy_ctxt; mvmvif->deflink.phy_ctxt = new_phy_ctxt;
ret = iwl_mvm_link_changed(mvm, vif, 0, false); ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf, 0, false);
if (WARN(ret, "Failed to deactivate link\n")) if (WARN(ret, "Failed to deactivate link\n"))
return ret; return ret;
ret = iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE, true); ret = iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
LINK_CONTEXT_MODIFY_ACTIVE, true);
WARN(ret, "Failed binding P2P_DEVICE\n"); WARN(ret, "Failed binding P2P_DEVICE\n");
return ret; return ret;
} }
......
...@@ -1721,17 +1721,21 @@ u8 iwl_mvm_get_ctrl_pos(struct cfg80211_chan_def *chandef); ...@@ -1721,17 +1721,21 @@ u8 iwl_mvm_get_ctrl_pos(struct cfg80211_chan_def *chandef);
void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm,
struct ieee80211_vif *vif); struct ieee80211_vif *vif);
void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif, void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
__le32 *cck_rates, __le32 *ofdm_rates); __le32 *cck_rates, __le32 *ofdm_rates);
void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm, void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
__le32 *protection_flags, u32 ht_flag, __le32 *protection_flags, u32 ht_flag,
u32 tgg_flag); u32 tgg_flag);
void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif, void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
struct iwl_ac_qos *ac, __le32 *qos_flags); struct iwl_ac_qos *ac, __le32 *qos_flags);
bool iwl_mvm_set_fw_mu_edca_params(struct iwl_mvm *mvm, bool iwl_mvm_set_fw_mu_edca_params(struct iwl_mvm *mvm,
struct iwl_mvm_vif *mvmvif, struct iwl_mvm_vif *mvmvif,
struct iwl_he_backoff_conf *trig_based_txf); struct iwl_he_backoff_conf *trig_based_txf);
void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif, void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
__le64 *dtim_tsf, __le32 *dtim_time, __le64 *dtim_tsf, __le32 *dtim_time,
__le32 *assoc_beacon_arrive_time); __le32 *assoc_beacon_arrive_time);
__le32 iwl_mac_ctxt_p2p_dev_has_extended_disc(struct iwl_mvm *mvm, __le32 iwl_mac_ctxt_p2p_dev_has_extended_disc(struct iwl_mvm *mvm,
...@@ -1799,10 +1803,13 @@ int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); ...@@ -1799,10 +1803,13 @@ int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
/* Links */ /* Links */
int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif); int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf);
int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
u32 changes, bool active); u32 changes, bool active);
int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif); int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf);
/* AP and IBSS */ /* AP and IBSS */
bool iwl_mvm_start_ap_ibss_common(struct ieee80211_hw *hw, bool iwl_mvm_start_ap_ibss_common(struct ieee80211_hw *hw,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment