Skip to content

Commit dfa865d

Browse files
benzeajmberg-intel
authored andcommitted
wifi: mac80211: use wiphy_hrtimer_work for ttlm_work
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: 702e804 ("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>
1 parent 7ceba45 commit dfa865d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

net/mac80211/ieee80211_i.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ struct ieee80211_if_managed {
616616
u16 removed_links;
617617

618618
/* TID-to-link mapping support */
619-
struct wiphy_delayed_work ttlm_work;
619+
struct wiphy_hrtimer_work ttlm_work;
620620
struct ieee80211_adv_ttlm_info ttlm_info;
621621
struct wiphy_work teardown_ttlm_work;
622622

net/mac80211/mlme.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#define IEEE80211_ASSOC_TIMEOUT_SHORT (HZ / 10)
4646
#define IEEE80211_ASSOC_MAX_TRIES 3
4747

48-
#define IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS msecs_to_jiffies(100)
48+
#define IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS (100 * USEC_PER_MSEC)
4949
#define IEEE80211_ADV_TTLM_ST_UNDERFLOW 0xff00
5050

5151
#define IEEE80211_NEG_TTLM_REQ_TIMEOUT (HZ / 5)
@@ -4242,7 +4242,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
42424242

42434243
memset(&sdata->u.mgd.ttlm_info, 0,
42444244
sizeof(sdata->u.mgd.ttlm_info));
4245-
wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);
4245+
wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);
42464246

42474247
memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm));
42484248
wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
@@ -7095,7 +7095,7 @@ static void ieee80211_process_adv_ttlm(struct ieee80211_sub_if_data *sdata,
70957095
/* if a planned TID-to-link mapping was cancelled -
70967096
* abort it
70977097
*/
7098-
wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
7098+
wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy,
70997099
&sdata->u.mgd.ttlm_work);
71007100
} else if (sdata->u.mgd.ttlm_info.active) {
71017101
/* 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,
71307130

71317131
if (ttlm_info.switch_time) {
71327132
u16 beacon_ts_tu, st_tu, delay;
7133-
u32 delay_jiffies;
7133+
u64 delay_usec;
71347134
u64 mask;
71357135

71367136
/* 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,
71527152
if (delay > IEEE80211_ADV_TTLM_ST_UNDERFLOW)
71537153
return;
71547154

7155-
delay_jiffies = TU_TO_JIFFIES(delay);
7155+
delay_usec = ieee80211_tu_to_usec(delay);
71567156

71577157
/* Link switching can take time, so schedule it
71587158
* 100ms before to be ready on time
71597159
*/
7160-
if (delay_jiffies > IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS)
7161-
delay_jiffies -=
7160+
if (delay_usec > IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS)
7161+
delay_usec -=
71627162
IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS;
71637163
else
7164-
delay_jiffies = 0;
7164+
delay_usec = 0;
71657165

71667166
sdata->u.mgd.ttlm_info = ttlm_info;
7167-
wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
7167+
wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy,
71687168
&sdata->u.mgd.ttlm_work);
7169-
wiphy_delayed_work_queue(sdata->local->hw.wiphy,
7169+
wiphy_hrtimer_work_queue(sdata->local->hw.wiphy,
71707170
&sdata->u.mgd.ttlm_work,
7171-
delay_jiffies);
7171+
us_to_ktime(delay_usec));
71727172
return;
71737173
}
71747174
}
@@ -8802,7 +8802,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
88028802
timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0);
88038803
wiphy_delayed_work_init(&ifmgd->tx_tspec_wk,
88048804
ieee80211_sta_handle_tspec_ac_params_wk);
8805-
wiphy_delayed_work_init(&ifmgd->ttlm_work,
8805+
wiphy_hrtimer_work_init(&ifmgd->ttlm_work,
88068806
ieee80211_tid_to_link_map_work);
88078807
wiphy_delayed_work_init(&ifmgd->neg_ttlm_timeout_work,
88088808
ieee80211_neg_ttlm_timeout_work);

0 commit comments

Comments
 (0)