wifi: mac80211: defer link switch work in reconfig
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Mon, 15 Apr 2024 08:27:13 +0000 (11:27 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 19 Apr 2024 08:14:29 +0000 (10:14 +0200)
If a link switch work was queued, and then a restart happened, the
worker might be executed before the reconfig, and obviously it will fail
(the HW might not respond to updates etc.)
So, don't perform the switch if we are in reconfig, instead - do it
at the end of the reconfig.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240415112355.1ef1008e3a0a.I19add3f2152dcfd55a759de97b1d09265c1cde98@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/iface.c
net/mac80211/util.c

index ef6b0fc82d022769d839c822ef108f130f0ccc4e..dc42902e269359a1a7d95ee85b2f4817df47a0d4 100644 (file)
@@ -1699,8 +1699,13 @@ static void ieee80211_activate_links_work(struct wiphy *wiphy,
        struct ieee80211_sub_if_data *sdata =
                container_of(work, struct ieee80211_sub_if_data,
                             activate_links_work);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+
+       if (local->in_reconfig)
+               return;
 
        ieee80211_set_active_links(&sdata->vif, sdata->desired_active_links);
+       sdata->desired_active_links = 0;
 }
 
 /*
index cda398d8f60da9e8703a543cf285d762a4823370..0b893e958959440e4b918e284533933a5c6145da 100644 (file)
@@ -2106,6 +2106,13 @@ int ieee80211_reconfig(struct ieee80211_local *local)
                if (sdata->restart_active_links)
                        ieee80211_set_active_links(&sdata->vif,
                                                   sdata->restart_active_links);
+               /*
+                * If a link switch was scheduled before the restart, and ran
+                * before reconfig, it will do nothing, so re-schedule.
+                */
+               if (sdata->desired_active_links)
+                       wiphy_work_queue(sdata->local->hw.wiphy,
+                                        &sdata->activate_links_work);
        }
 
        /* Reconfigure sched scan if it was interrupted by FW restart */