Commit 8939a18c authored by Johannes Berg's avatar Johannes Berg

wifi: iwlwifi: mvm: add MLO support to SF - use sta pointer

For MLO support, use the pointer to the peer MLD instead of the default
link station id, since the default link is only used for non-MLO cases.
Using the default link sta id is meaningless for MLO. Also remove the
rcu protected section since we now avoid the lookup based on sta id.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230417113648.40cef48c0592.I8dd666d603d6e1854033e5369c70e78d9303d236@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent d2d0468f
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
/* For counting bound interfaces */ /* For counting bound interfaces */
struct iwl_mvm_active_iface_iterator_data { struct iwl_mvm_active_iface_iterator_data {
struct ieee80211_vif *ignore_vif; struct ieee80211_vif *ignore_vif;
u8 sta_vif_ap_sta_id; struct ieee80211_sta *sta_vif_ap_sta;
enum iwl_sf_state sta_vif_state; enum iwl_sf_state sta_vif_state;
u32 num_active_macs; u32 num_active_macs;
}; };
...@@ -30,7 +30,7 @@ static void iwl_mvm_bound_iface_iterator(void *_data, u8 *mac, ...@@ -30,7 +30,7 @@ static void iwl_mvm_bound_iface_iterator(void *_data, u8 *mac,
data->num_active_macs++; data->num_active_macs++;
if (vif->type == NL80211_IFTYPE_STATION) { if (vif->type == NL80211_IFTYPE_STATION) {
data->sta_vif_ap_sta_id = mvmvif->deflink.ap_sta_id; data->sta_vif_ap_sta = mvmvif->ap_sta;
if (vif->cfg.assoc) if (vif->cfg.assoc)
data->sta_vif_state = SF_FULL_ON; data->sta_vif_state = SF_FULL_ON;
else else
...@@ -172,13 +172,12 @@ static void iwl_mvm_fill_sf_command(struct iwl_mvm *mvm, ...@@ -172,13 +172,12 @@ static void iwl_mvm_fill_sf_command(struct iwl_mvm *mvm,
} }
} }
static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, static int iwl_mvm_sf_config(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
enum iwl_sf_state new_state) enum iwl_sf_state new_state)
{ {
struct iwl_sf_cfg_cmd sf_cmd = { struct iwl_sf_cfg_cmd sf_cmd = {
.state = cpu_to_le32(new_state), .state = cpu_to_le32(new_state),
}; };
struct ieee80211_sta *sta;
int ret = 0; int ret = 0;
if (mvm->cfg->disable_dummy_notification) if (mvm->cfg->disable_dummy_notification)
...@@ -196,20 +195,12 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, ...@@ -196,20 +195,12 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id,
iwl_mvm_fill_sf_command(mvm, &sf_cmd, NULL); iwl_mvm_fill_sf_command(mvm, &sf_cmd, NULL);
break; break;
case SF_FULL_ON: case SF_FULL_ON:
if (sta_id == IWL_MVM_INVALID_STA) { if (!sta) {
IWL_ERR(mvm, IWL_ERR(mvm,
"No station: Cannot switch SF to FULL_ON\n"); "No station: Cannot switch SF to FULL_ON\n");
return -EINVAL; return -EINVAL;
} }
rcu_read_lock();
sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
if (IS_ERR_OR_NULL(sta)) {
IWL_ERR(mvm, "Invalid station id\n");
rcu_read_unlock();
return -EINVAL;
}
iwl_mvm_fill_sf_command(mvm, &sf_cmd, sta); iwl_mvm_fill_sf_command(mvm, &sf_cmd, sta);
rcu_read_unlock();
break; break;
case SF_INIT_OFF: case SF_INIT_OFF:
iwl_mvm_fill_sf_command(mvm, &sf_cmd, NULL); iwl_mvm_fill_sf_command(mvm, &sf_cmd, NULL);
...@@ -237,13 +228,12 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif, ...@@ -237,13 +228,12 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif,
bool remove_vif) bool remove_vif)
{ {
enum iwl_sf_state new_state; enum iwl_sf_state new_state;
u8 sta_id = IWL_MVM_INVALID_STA;
struct iwl_mvm_vif *mvmvif = NULL; struct iwl_mvm_vif *mvmvif = NULL;
struct iwl_mvm_active_iface_iterator_data data = { struct iwl_mvm_active_iface_iterator_data data = {
.ignore_vif = changed_vif, .ignore_vif = changed_vif,
.sta_vif_state = SF_UNINIT, .sta_vif_state = SF_UNINIT,
.sta_vif_ap_sta_id = IWL_MVM_INVALID_STA,
}; };
struct ieee80211_sta *sta = NULL;
/* /*
* Ignore the call if we are in HW Restart flow, or if the handled * Ignore the call if we are in HW Restart flow, or if the handled
...@@ -273,7 +263,7 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif, ...@@ -273,7 +263,7 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif,
* and we filled the relevant data during iteration * and we filled the relevant data during iteration
*/ */
new_state = data.sta_vif_state; new_state = data.sta_vif_state;
sta_id = data.sta_vif_ap_sta_id; sta = data.sta_vif_ap_sta;
} else { } else {
if (WARN_ON(!changed_vif)) if (WARN_ON(!changed_vif))
return -EINVAL; return -EINVAL;
...@@ -282,7 +272,7 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif, ...@@ -282,7 +272,7 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif,
} else if (changed_vif->cfg.assoc && } else if (changed_vif->cfg.assoc &&
changed_vif->bss_conf.dtim_period) { changed_vif->bss_conf.dtim_period) {
mvmvif = iwl_mvm_vif_from_mac80211(changed_vif); mvmvif = iwl_mvm_vif_from_mac80211(changed_vif);
sta_id = mvmvif->deflink.ap_sta_id; sta = mvmvif->ap_sta;
new_state = SF_FULL_ON; new_state = SF_FULL_ON;
} else { } else {
new_state = SF_INIT_OFF; new_state = SF_INIT_OFF;
...@@ -294,8 +284,5 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif, ...@@ -294,8 +284,5 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif,
new_state = SF_UNINIT; new_state = SF_UNINIT;
} }
/* For MLO it's ok to use deflink->sta_id as it's needed only to get return iwl_mvm_sf_config(mvm, sta, new_state);
* a pointer to mac80211 sta
*/
return iwl_mvm_sf_config(mvm, sta_id, new_state);
} }
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