diff options
author | Javier Cardona <javier@cozybit.com> | 2012-03-05 20:20:38 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-06 15:16:17 -0500 |
commit | 12ce8ba3eb09bb83509a459835917a3100ad8db1 (patch) | |
tree | c93d67241456469078092fd6127ec5649ed7c4cd | |
parent | 2f40b9404903dba89d70d706ee71263f9babd109 (diff) |
mac80211: Modify tsf via debugfs in mesh interfaces
Signed-off-by: Javier Cardona <javier@cozybit.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 18 | ||||
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 7 |
2 files changed, 24 insertions, 1 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 14a3cac19a30..b4f6cb3298a4 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -379,6 +379,22 @@ static __le64 __mac80211_hwsim_get_tsf(struct mac80211_hwsim_data *data) | |||
379 | return cpu_to_le64(now + data->tsf_offset); | 379 | return cpu_to_le64(now + data->tsf_offset); |
380 | } | 380 | } |
381 | 381 | ||
382 | static u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw, | ||
383 | struct ieee80211_vif *vif) | ||
384 | { | ||
385 | struct mac80211_hwsim_data *data = hw->priv; | ||
386 | return le64_to_cpu(__mac80211_hwsim_get_tsf(data)); | ||
387 | } | ||
388 | |||
389 | static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw, | ||
390 | struct ieee80211_vif *vif, u64 tsf) | ||
391 | { | ||
392 | struct mac80211_hwsim_data *data = hw->priv; | ||
393 | struct timeval tv = ktime_to_timeval(ktime_get_real()); | ||
394 | u64 now = tv.tv_sec * USEC_PER_SEC + tv.tv_usec; | ||
395 | data->tsf_offset = tsf - now; | ||
396 | } | ||
397 | |||
382 | static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, | 398 | static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, |
383 | struct sk_buff *tx_skb) | 399 | struct sk_buff *tx_skb) |
384 | { | 400 | { |
@@ -1224,6 +1240,8 @@ static struct ieee80211_ops mac80211_hwsim_ops = | |||
1224 | .sw_scan_start = mac80211_hwsim_sw_scan, | 1240 | .sw_scan_start = mac80211_hwsim_sw_scan, |
1225 | .sw_scan_complete = mac80211_hwsim_sw_scan_complete, | 1241 | .sw_scan_complete = mac80211_hwsim_sw_scan_complete, |
1226 | .flush = mac80211_hwsim_flush, | 1242 | .flush = mac80211_hwsim_flush, |
1243 | .get_tsf = mac80211_hwsim_get_tsf, | ||
1244 | .set_tsf = mac80211_hwsim_set_tsf, | ||
1227 | }; | 1245 | }; |
1228 | 1246 | ||
1229 | 1247 | ||
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 9f484d8905fd..f6de8a65f402 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -538,11 +538,15 @@ static void add_monitor_files(struct ieee80211_sub_if_data *sdata) | |||
538 | 538 | ||
539 | #ifdef CONFIG_MAC80211_MESH | 539 | #ifdef CONFIG_MAC80211_MESH |
540 | 540 | ||
541 | static void add_mesh_files(struct ieee80211_sub_if_data *sdata) | ||
542 | { | ||
543 | DEBUGFS_ADD_MODE(tsf, 0600); | ||
544 | } | ||
545 | |||
541 | static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) | 546 | static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) |
542 | { | 547 | { |
543 | struct dentry *dir = debugfs_create_dir("mesh_stats", | 548 | struct dentry *dir = debugfs_create_dir("mesh_stats", |
544 | sdata->debugfs.dir); | 549 | sdata->debugfs.dir); |
545 | |||
546 | #define MESHSTATS_ADD(name)\ | 550 | #define MESHSTATS_ADD(name)\ |
547 | debugfs_create_file(#name, 0400, dir, sdata, &name##_ops); | 551 | debugfs_create_file(#name, 0400, dir, sdata, &name##_ops); |
548 | 552 | ||
@@ -595,6 +599,7 @@ static void add_files(struct ieee80211_sub_if_data *sdata) | |||
595 | switch (sdata->vif.type) { | 599 | switch (sdata->vif.type) { |
596 | case NL80211_IFTYPE_MESH_POINT: | 600 | case NL80211_IFTYPE_MESH_POINT: |
597 | #ifdef CONFIG_MAC80211_MESH | 601 | #ifdef CONFIG_MAC80211_MESH |
602 | add_mesh_files(sdata); | ||
598 | add_mesh_stats(sdata); | 603 | add_mesh_stats(sdata); |
599 | add_mesh_config(sdata); | 604 | add_mesh_config(sdata); |
600 | #endif | 605 | #endif |