Skip to content

Commit 2d4caa1

Browse files
ggreenmajmberg-intel
authored andcommitted
iwlwifi: mvm: handle PS changes in vif_cfg_changed
Handling of BSS_CHANGED_PS was missing in vif_cfg_changed callback. Fix it. Fixes: 22c5883 ("wifi: iwlwifi: mvm: replace bss_info_changed() with vif_cfg/link_info_changed()") Reported-by: Sultan Alsawaf <[email protected]> Signed-off-by: Gregory Greenman <[email protected]> Link: https://lore.kernel.org/r/20230905162939.5ef0c8230de6.Ieed265014988c50ec68fbff6d33821e4215f987f@changeid [note: patch looks bigger than it is due to reindentation] Signed-off-by: Johannes Berg <[email protected]>
1 parent 5112fa5 commit 2d4caa1

File tree

1 file changed

+63
-58
lines changed

1 file changed

+63
-58
lines changed

drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -731,73 +731,78 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm,
731731

732732
mvmvif->associated = vif->cfg.assoc;
733733

734-
if (!(changes & BSS_CHANGED_ASSOC))
735-
return;
736-
737-
if (vif->cfg.assoc) {
738-
/* clear statistics to get clean beacon counter */
739-
iwl_mvm_request_statistics(mvm, true);
740-
iwl_mvm_sf_update(mvm, vif, false);
741-
iwl_mvm_power_vif_assoc(mvm, vif);
742-
743-
for_each_mvm_vif_valid_link(mvmvif, i) {
744-
memset(&mvmvif->link[i]->beacon_stats, 0,
745-
sizeof(mvmvif->link[i]->beacon_stats));
734+
if (changes & BSS_CHANGED_ASSOC) {
735+
if (vif->cfg.assoc) {
736+
/* clear statistics to get clean beacon counter */
737+
iwl_mvm_request_statistics(mvm, true);
738+
iwl_mvm_sf_update(mvm, vif, false);
739+
iwl_mvm_power_vif_assoc(mvm, vif);
740+
741+
for_each_mvm_vif_valid_link(mvmvif, i) {
742+
memset(&mvmvif->link[i]->beacon_stats, 0,
743+
sizeof(mvmvif->link[i]->beacon_stats));
744+
745+
if (vif->p2p) {
746+
iwl_mvm_update_smps(mvm, vif,
747+
IWL_MVM_SMPS_REQ_PROT,
748+
IEEE80211_SMPS_DYNAMIC, i);
749+
}
750+
751+
rcu_read_lock();
752+
link_conf = rcu_dereference(vif->link_conf[i]);
753+
if (link_conf && !link_conf->dtim_period)
754+
protect = true;
755+
rcu_read_unlock();
756+
}
746757

747-
if (vif->p2p) {
748-
iwl_mvm_update_smps(mvm, vif,
749-
IWL_MVM_SMPS_REQ_PROT,
750-
IEEE80211_SMPS_DYNAMIC, i);
758+
if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
759+
protect) {
760+
/* If we're not restarting and still haven't
761+
* heard a beacon (dtim period unknown) then
762+
* make sure we still have enough minimum time
763+
* remaining in the time event, since the auth
764+
* might actually have taken quite a while
765+
* (especially for SAE) and so the remaining
766+
* time could be small without us having heard
767+
* a beacon yet.
768+
*/
769+
iwl_mvm_protect_assoc(mvm, vif, 0);
751770
}
752771

753-
rcu_read_lock();
754-
link_conf = rcu_dereference(vif->link_conf[i]);
755-
if (link_conf && !link_conf->dtim_period)
756-
protect = true;
757-
rcu_read_unlock();
758-
}
772+
iwl_mvm_sf_update(mvm, vif, false);
773+
774+
/* FIXME: need to decide about misbehaving AP handling */
775+
iwl_mvm_power_vif_assoc(mvm, vif);
776+
} else if (iwl_mvm_mld_vif_have_valid_ap_sta(mvmvif)) {
777+
iwl_mvm_mei_host_disassociated(mvm);
759778

760-
if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
761-
protect) {
762-
/* If we're not restarting and still haven't
763-
* heard a beacon (dtim period unknown) then
764-
* make sure we still have enough minimum time
765-
* remaining in the time event, since the auth
766-
* might actually have taken quite a while
767-
* (especially for SAE) and so the remaining
768-
* time could be small without us having heard
769-
* a beacon yet.
779+
/* If update fails - SF might be running in associated
780+
* mode while disassociated - which is forbidden.
770781
*/
771-
iwl_mvm_protect_assoc(mvm, vif, 0);
782+
ret = iwl_mvm_sf_update(mvm, vif, false);
783+
WARN_ONCE(ret &&
784+
!test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
785+
&mvm->status),
786+
"Failed to update SF upon disassociation\n");
787+
788+
/* If we get an assert during the connection (after the
789+
* station has been added, but before the vif is set
790+
* to associated), mac80211 will re-add the station and
791+
* then configure the vif. Since the vif is not
792+
* associated, we would remove the station here and
793+
* this would fail the recovery.
794+
*/
795+
iwl_mvm_mld_vif_delete_all_stas(mvm, vif);
772796
}
773797

774-
iwl_mvm_sf_update(mvm, vif, false);
775-
776-
/* FIXME: need to decide about misbehaving AP handling */
777-
iwl_mvm_power_vif_assoc(mvm, vif);
778-
} else if (iwl_mvm_mld_vif_have_valid_ap_sta(mvmvif)) {
779-
iwl_mvm_mei_host_disassociated(mvm);
780-
781-
/* If update fails - SF might be running in associated
782-
* mode while disassociated - which is forbidden.
783-
*/
784-
ret = iwl_mvm_sf_update(mvm, vif, false);
785-
WARN_ONCE(ret &&
786-
!test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
787-
&mvm->status),
788-
"Failed to update SF upon disassociation\n");
789-
790-
/* If we get an assert during the connection (after the
791-
* station has been added, but before the vif is set
792-
* to associated), mac80211 will re-add the station and
793-
* then configure the vif. Since the vif is not
794-
* associated, we would remove the station here and
795-
* this would fail the recovery.
796-
*/
797-
iwl_mvm_mld_vif_delete_all_stas(mvm, vif);
798+
iwl_mvm_bss_info_changed_station_assoc(mvm, vif, changes);
798799
}
799800

800-
iwl_mvm_bss_info_changed_station_assoc(mvm, vif, changes);
801+
if (changes & BSS_CHANGED_PS) {
802+
ret = iwl_mvm_power_update_mac(mvm);
803+
if (ret)
804+
IWL_ERR(mvm, "failed to update power mode\n");
805+
}
801806
}
802807

803808
static void

0 commit comments

Comments
 (0)