]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: use wiphy_hrtimer_work for ttlm_work
authorBenjamin Berg <benjamin.berg@intel.com>
Tue, 28 Oct 2025 10:58:38 +0000 (12:58 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 28 Oct 2025 13:56:33 +0000 (14:56 +0100)
The work item may be scheduled relatively far in the future. As the
event happens at a specific point in time, the normal timer accuracy is
not sufficient in that case.

Switch to use wiphy_hrtimer_work so that the accuracy is sufficient.

CC: stable@vger.kernel.org
Fixes: 702e80470a33 ("wifi: mac80211: support handling of advertised TID-to-link mapping")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20251028125710.83c2c611545e.I35498a6d883ea24b0dc4910cf521aa768d2a0e90@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c

index 73fd86ec1bce40663b70958c1b10c651b6d63828..eb22279c6e01186d287b85b6f54794cd9b7f4221 100644 (file)
@@ -616,7 +616,7 @@ struct ieee80211_if_managed {
        u16 removed_links;
 
        /* TID-to-link mapping support */
-       struct wiphy_delayed_work ttlm_work;
+       struct wiphy_hrtimer_work ttlm_work;
        struct ieee80211_adv_ttlm_info ttlm_info;
        struct wiphy_work teardown_ttlm_work;
 
index 3b5827ea438ee8fe2184c20dffcf84809ec533f2..623a46b3214ebdb4a4c8e9340e457c60558d334c 100644 (file)
@@ -45,7 +45,7 @@
 #define IEEE80211_ASSOC_TIMEOUT_SHORT  (HZ / 10)
 #define IEEE80211_ASSOC_MAX_TRIES      3
 
-#define IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS msecs_to_jiffies(100)
+#define IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS (100 * USEC_PER_MSEC)
 #define IEEE80211_ADV_TTLM_ST_UNDERFLOW 0xff00
 
 #define IEEE80211_NEG_TTLM_REQ_TIMEOUT (HZ / 5)
@@ -4242,7 +4242,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
 
        memset(&sdata->u.mgd.ttlm_info, 0,
               sizeof(sdata->u.mgd.ttlm_info));
-       wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);
+       wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);
 
        memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm));
        wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
@@ -7095,7 +7095,7 @@ static void ieee80211_process_adv_ttlm(struct ieee80211_sub_if_data *sdata,
                        /* if a planned TID-to-link mapping was cancelled -
                         * abort it
                         */
-                       wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
+                       wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy,
                                                  &sdata->u.mgd.ttlm_work);
                } else if (sdata->u.mgd.ttlm_info.active) {
                        /* if no TID-to-link element, set to default mapping in
@@ -7130,7 +7130,7 @@ static void ieee80211_process_adv_ttlm(struct ieee80211_sub_if_data *sdata,
 
                if (ttlm_info.switch_time) {
                        u16 beacon_ts_tu, st_tu, delay;
-                       u32 delay_jiffies;
+                       u64 delay_usec;
                        u64 mask;
 
                        /* The t2l map switch time is indicated with a partial
@@ -7152,23 +7152,23 @@ static void ieee80211_process_adv_ttlm(struct ieee80211_sub_if_data *sdata,
                        if (delay > IEEE80211_ADV_TTLM_ST_UNDERFLOW)
                                return;
 
-                       delay_jiffies = TU_TO_JIFFIES(delay);
+                       delay_usec = ieee80211_tu_to_usec(delay);
 
                        /* Link switching can take time, so schedule it
                         * 100ms before to be ready on time
                         */
-                       if (delay_jiffies > IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS)
-                               delay_jiffies -=
+                       if (delay_usec > IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS)
+                               delay_usec -=
                                        IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS;
                        else
-                               delay_jiffies = 0;
+                               delay_usec = 0;
 
                        sdata->u.mgd.ttlm_info = ttlm_info;
-                       wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
+                       wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy,
                                                  &sdata->u.mgd.ttlm_work);
-                       wiphy_delayed_work_queue(sdata->local->hw.wiphy,
+                       wiphy_hrtimer_work_queue(sdata->local->hw.wiphy,
                                                 &sdata->u.mgd.ttlm_work,
-                                                delay_jiffies);
+                                                us_to_ktime(delay_usec));
                        return;
                }
        }
@@ -8802,7 +8802,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
        timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0);
        wiphy_delayed_work_init(&ifmgd->tx_tspec_wk,
                                ieee80211_sta_handle_tspec_ac_params_wk);
-       wiphy_delayed_work_init(&ifmgd->ttlm_work,
+       wiphy_hrtimer_work_init(&ifmgd->ttlm_work,
                                ieee80211_tid_to_link_map_work);
        wiphy_delayed_work_init(&ifmgd->neg_ttlm_timeout_work,
                                ieee80211_neg_ttlm_timeout_work);