File tree Expand file tree Collapse file tree 6 files changed +68
-6
lines changed Expand file tree Collapse file tree 6 files changed +68
-6
lines changed Original file line number Diff line number Diff line change @@ -3169,6 +3169,12 @@ enum ieee80211_reconfig_type {
3169
3169
* required function.
3170
3170
* The callback can sleep.
3171
3171
*
3172
+ * @offset_tsf: Offset the TSF timer by the specified value in the
3173
+ * firmware/hardware. Preferred to set_tsf as it avoids delay between
3174
+ * calling set_tsf() and hardware getting programmed, which will show up
3175
+ * as TSF delay. Is not a required function.
3176
+ * The callback can sleep.
3177
+ *
3172
3178
* @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
3173
3179
* with other STAs in the IBSS. This is only used in IBSS mode. This
3174
3180
* function is optional if the firmware/hardware takes full care of
@@ -3549,6 +3555,8 @@ struct ieee80211_ops {
3549
3555
u64 (* get_tsf )(struct ieee80211_hw * hw , struct ieee80211_vif * vif );
3550
3556
void (* set_tsf )(struct ieee80211_hw * hw , struct ieee80211_vif * vif ,
3551
3557
u64 tsf );
3558
+ void (* offset_tsf )(struct ieee80211_hw * hw , struct ieee80211_vif * vif ,
3559
+ s64 offset );
3552
3560
void (* reset_tsf )(struct ieee80211_hw * hw , struct ieee80211_vif * vif );
3553
3561
int (* tx_last_beacon )(struct ieee80211_hw * hw );
3554
3562
int (* ampdu_action )(struct ieee80211_hw * hw ,
Original file line number Diff line number Diff line change @@ -556,9 +556,15 @@ static ssize_t ieee80211_if_parse_tsf(
556
556
ret = kstrtoull (buf , 10 , & tsf );
557
557
if (ret < 0 )
558
558
return ret ;
559
- if (tsf_is_delta )
560
- tsf = drv_get_tsf (local , sdata ) + tsf_is_delta * tsf ;
561
- if (local -> ops -> set_tsf ) {
559
+ if (tsf_is_delta && local -> ops -> offset_tsf ) {
560
+ drv_offset_tsf (local , sdata , tsf_is_delta * tsf );
561
+ wiphy_info (local -> hw .wiphy ,
562
+ "debugfs offset TSF by %018lld\n" ,
563
+ tsf_is_delta * tsf );
564
+ } else if (local -> ops -> set_tsf ) {
565
+ if (tsf_is_delta )
566
+ tsf = drv_get_tsf (local , sdata ) +
567
+ tsf_is_delta * tsf ;
562
568
drv_set_tsf (local , sdata , tsf );
563
569
wiphy_info (local -> hw .wiphy ,
564
570
"debugfs set TSF to %#018llx\n" , tsf );
Original file line number Diff line number Diff line change @@ -215,6 +215,21 @@ void drv_set_tsf(struct ieee80211_local *local,
215
215
trace_drv_return_void (local );
216
216
}
217
217
218
+ void drv_offset_tsf (struct ieee80211_local * local ,
219
+ struct ieee80211_sub_if_data * sdata ,
220
+ s64 offset )
221
+ {
222
+ might_sleep ();
223
+
224
+ if (!check_sdata_in_driver (sdata ))
225
+ return ;
226
+
227
+ trace_drv_offset_tsf (local , sdata , offset );
228
+ if (local -> ops -> offset_tsf )
229
+ local -> ops -> offset_tsf (& local -> hw , & sdata -> vif , offset );
230
+ trace_drv_return_void (local );
231
+ }
232
+
218
233
void drv_reset_tsf (struct ieee80211_local * local ,
219
234
struct ieee80211_sub_if_data * sdata )
220
235
{
Original file line number Diff line number Diff line change @@ -569,6 +569,9 @@ u64 drv_get_tsf(struct ieee80211_local *local,
569
569
void drv_set_tsf (struct ieee80211_local * local ,
570
570
struct ieee80211_sub_if_data * sdata ,
571
571
u64 tsf );
572
+ void drv_offset_tsf (struct ieee80211_local * local ,
573
+ struct ieee80211_sub_if_data * sdata ,
574
+ s64 offset );
572
575
void drv_reset_tsf (struct ieee80211_local * local ,
573
576
struct ieee80211_sub_if_data * sdata );
574
577
Original file line number Diff line number Diff line change @@ -70,9 +70,13 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
70
70
}
71
71
spin_unlock_bh (& ifmsh -> sync_offset_lock );
72
72
73
- tsf = drv_get_tsf (local , sdata );
74
- if (tsf != -1ULL )
75
- drv_set_tsf (local , sdata , tsf + tsfdelta );
73
+ if (local -> ops -> offset_tsf ) {
74
+ drv_offset_tsf (local , sdata , tsfdelta );
75
+ } else {
76
+ tsf = drv_get_tsf (local , sdata );
77
+ if (tsf != -1ULL )
78
+ drv_set_tsf (local , sdata , tsf + tsfdelta );
79
+ }
76
80
}
77
81
78
82
static void mesh_sync_offset_rx_bcn_presp (struct ieee80211_sub_if_data * sdata ,
Original file line number Diff line number Diff line change @@ -984,6 +984,32 @@ TRACE_EVENT(drv_set_tsf,
984
984
)
985
985
);
986
986
987
+ TRACE_EVENT (drv_offset_tsf ,
988
+ TP_PROTO (struct ieee80211_local * local ,
989
+ struct ieee80211_sub_if_data * sdata ,
990
+ s64 offset ),
991
+
992
+ TP_ARGS (local , sdata , offset ),
993
+
994
+ TP_STRUCT__entry (
995
+ LOCAL_ENTRY
996
+ VIF_ENTRY
997
+ __field (s64 , tsf_offset )
998
+ ),
999
+
1000
+ TP_fast_assign (
1001
+ LOCAL_ASSIGN ;
1002
+ VIF_ASSIGN ;
1003
+ __entry -> tsf_offset = offset ;
1004
+ ),
1005
+
1006
+ TP_printk (
1007
+ LOCAL_PR_FMT VIF_PR_FMT " tsf offset:%lld" ,
1008
+ LOCAL_PR_ARG , VIF_PR_ARG ,
1009
+ (unsigned long long )__entry -> tsf_offset
1010
+ )
1011
+ );
1012
+
987
1013
DEFINE_EVENT (local_sdata_evt , drv_reset_tsf ,
988
1014
TP_PROTO (struct ieee80211_local * local ,
989
1015
struct ieee80211_sub_if_data * sdata ),
You can’t perform that action at this time.
0 commit comments