aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/debugfs_netdev.c
diff options
context:
space:
mode:
authorJavier Cardona <javier@cozybit.com>2012-03-31 14:31:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-10 15:20:30 -0400
commit9bdd3a6bf8513a0a9eda031d15b36e4677854243 (patch)
treee3692a379d0382ba761c1ef27c2a0cd254620acd /net/mac80211/debugfs_netdev.c
parentf483ad25c397bc2b33542fe245ea99c22c8a750c (diff)
mac80211: Allow tsf increments via debugfs
Reading and writing back the tsf value via tsf is too slow if one wants to make small increments to this timer. With this change you can use the syntax "+=<some value>" or "-=<some value>" to add or substract a value from the tsf counter. Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/debugfs_netdev.c')
-rw-r--r--net/mac80211/debugfs_netdev.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 6ed0455902c6..b0fc205411c1 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -424,6 +424,7 @@ static ssize_t ieee80211_if_parse_tsf(
424 struct ieee80211_local *local = sdata->local; 424 struct ieee80211_local *local = sdata->local;
425 unsigned long long tsf; 425 unsigned long long tsf;
426 int ret; 426 int ret;
427 int tsf_is_delta = 0;
427 428
428 if (strncmp(buf, "reset", 5) == 0) { 429 if (strncmp(buf, "reset", 5) == 0) {
429 if (local->ops->reset_tsf) { 430 if (local->ops->reset_tsf) {
@@ -431,9 +432,20 @@ static ssize_t ieee80211_if_parse_tsf(
431 wiphy_info(local->hw.wiphy, "debugfs reset TSF\n"); 432 wiphy_info(local->hw.wiphy, "debugfs reset TSF\n");
432 } 433 }
433 } else { 434 } else {
435 if (buflen > 10 && buf[1] == '=') {
436 if (buf[0] == '+')
437 tsf_is_delta = 1;
438 else if (buf[0] == '-')
439 tsf_is_delta = -1;
440 else
441 return -EINVAL;
442 buf += 2;
443 }
434 ret = kstrtoull(buf, 10, &tsf); 444 ret = kstrtoull(buf, 10, &tsf);
435 if (ret < 0) 445 if (ret < 0)
436 return -EINVAL; 446 return -EINVAL;
447 if (tsf_is_delta)
448 tsf = drv_get_tsf(local, sdata) + tsf_is_delta * tsf;
437 if (local->ops->set_tsf) { 449 if (local->ops->set_tsf) {
438 drv_set_tsf(local, sdata, tsf); 450 drv_set_tsf(local, sdata, tsf);
439 wiphy_info(local->hw.wiphy, 451 wiphy_info(local->hw.wiphy,