diff options
author | Johannes Berg <johannes.berg@intel.com> | 2024-03-06 13:41:42 +0100 |
---|---|---|
committer | iwlwifi publisher <> | 2024-04-17 13:07:46 +0000 |
commit | 2d4e642b692e4a0906a0d09f4a88c766ed614ee0 (patch) | |
tree | a4dbbd25af6eb00c333273c9a55abb87de321aec | |
parent | 0ca38632cd09d1dab060ce5ceac6fa4a8dc38196 (diff) | |
download | backport-iwlwifi-2d4e642b692e4a0906a0d09f4a88c766ed614ee0.tar.gz |
[BUGFIX] wifi: mac80211: handle link deactivated before/during CSA
If a link has CSA that isn't active, we cannot ask the driver to
handle the CSA even if it implements that API. Additionally, if
the driver deactivates a link during CSA, schedule the work rather
than expecting it to call ieee80211_chswitch_done().
type=bugfix
fixes=Ie8453979f5805873a8411c99346bcc3810cd6476
ticket=none
Change-Id: I7886f3552865690181ae08d6026fe53530455714
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-on: https://gerritwcs.ir.intel.com/c/iwlwifi-stack-dev/+/97820
automatic-review: iil_jenkins iil_jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
tested: iil_jenkins iil_jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
Tested-by: iil_jenkins iil_jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
x-iwlwifi-stack-dev: 0b2babb15fd11fff51a3d2c38cda859986292486
-rw-r--r-- | net/mac80211/ieee80211_i.h | 1 | ||||
-rw-r--r-- | net/mac80211/link.c | 12 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 22 | ||||
-rw-r--r-- | versions | 2 |
4 files changed, 30 insertions, 7 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 5172a329e9..dd1a023759 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -978,6 +978,7 @@ struct ieee80211_link_data_managed { bool csa_waiting_bcn; bool csa_ignored_same_chan; + unsigned long csa_time; struct wiphy_delayed_work chswitch_work; struct wiphy_work request_smps_work; diff --git a/net/mac80211/link.c b/net/mac80211/link.c index 685ec66b42..4b0b939fb0 100644 --- a/net/mac80211/link.c +++ b/net/mac80211/link.c @@ -359,6 +359,18 @@ static int _ieee80211_set_active_links(struct ieee80211_sub_if_data *sdata, ieee80211_teardown_tdls_peers(link); ieee80211_link_release_channel(link); + + /* + * If CSA is (still) active while the link is deactivated, + * just schedule the channel switch work for the time we + * had previously calculated, and we'll take the process + * from there. + */ + if (link->conf->csa_active) + wiphy_delayed_work_queue(local->hw.wiphy, + &link->u.mgd.chswitch_work, + link->u.mgd.csa_time - + jiffies); } list_for_each_entry(sta, &local->sta_list, list) { diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 26d10c26a8..bb765bba18 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -2143,7 +2143,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, .timestamp = timestamp, .device_timestamp = device_timestamp, }; - unsigned long timeout; + unsigned long now; int res; lockdep_assert_wiphy(local->hw.wiphy); @@ -2333,18 +2333,28 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, link->link_id, csa_ie.count, csa_ie.mode); - if (local->ops->channel_switch) { - /* use driver's channel switch callback */ + /* we may have to handle timeout for deactivated link in software */ + now = jiffies; + link->u.mgd.csa_time = now + + TU_TO_JIFFIES((max_t(int, csa_ie.count, 1) - 1) * + link->conf->beacon_int); + + if (ieee80211_vif_link_active(&sdata->vif, link->link_id) && + local->ops->channel_switch) { + /* + * Use driver's channel switch callback, the driver will + * later call ieee80211_chswitch_done(). It may deactivate + * the link as well, we handle that elsewhere and queue + * the chswitch_work for the calculated time then. + */ drv_channel_switch(local, sdata, &ch_switch); return; } /* channel switch handled in software */ - timeout = TU_TO_JIFFIES((max_t(int, csa_ie.count, 1) - 1) * - link->conf->beacon_int); wiphy_delayed_work_queue(local->hw.wiphy, &link->u.mgd.chswitch_work, - timeout); + link->u.mgd.csa_time - now); return; drop_connection: /* @@ -2,4 +2,4 @@ BACKPORTS_VERSION="(see git)" BACKPORTED_KERNEL_VERSION="(see git)" BACKPORTED_KERNEL_NAME="iwlwifi" BACKPORTS_BUILD_TSTAMP=__DATE__ \" \" __TIME__ -BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:master:11988:0fe9f6a7" +BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:master:11989:0b2babb1" |