diff options
author | Eliad Peller <eliad@wizery.com> | 2011-09-21 07:06:11 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-27 14:27:48 -0400 |
commit | 37a41b4affa33bb237d3692bf51f1b5ebcaf29d8 (patch) | |
tree | 0201e166912d12bd8270b2117b11717756cfd5db /net/mac80211/debugfs_netdev.c | |
parent | 129321804e36721e71fadcab5b475bd37bf53044 (diff) |
mac80211: add ieee80211_vif param to tsf functions
TSF can be kept per vif.
Add ieee80211_vif param to set/get/reset_tsf, and move
the debugfs entries to the per-vif directory.
Update all the drivers that implement these callbacks.
Signed-off-by: Eliad Peller <eliad@wizery.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.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index dd0462917518..9352819a986b 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "rate.h" | 21 | #include "rate.h" |
22 | #include "debugfs.h" | 22 | #include "debugfs.h" |
23 | #include "debugfs_netdev.h" | 23 | #include "debugfs_netdev.h" |
24 | #include "driver-ops.h" | ||
24 | 25 | ||
25 | static ssize_t ieee80211_if_read( | 26 | static ssize_t ieee80211_if_read( |
26 | struct ieee80211_sub_if_data *sdata, | 27 | struct ieee80211_sub_if_data *sdata, |
@@ -331,6 +332,46 @@ static ssize_t ieee80211_if_fmt_num_buffered_multicast( | |||
331 | } | 332 | } |
332 | __IEEE80211_IF_FILE(num_buffered_multicast, NULL); | 333 | __IEEE80211_IF_FILE(num_buffered_multicast, NULL); |
333 | 334 | ||
335 | /* IBSS attributes */ | ||
336 | static ssize_t ieee80211_if_fmt_tsf( | ||
337 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) | ||
338 | { | ||
339 | struct ieee80211_local *local = sdata->local; | ||
340 | u64 tsf; | ||
341 | |||
342 | tsf = drv_get_tsf(local, (struct ieee80211_sub_if_data *)sdata); | ||
343 | |||
344 | return scnprintf(buf, buflen, "0x%016llx\n", (unsigned long long) tsf); | ||
345 | } | ||
346 | |||
347 | static ssize_t ieee80211_if_parse_tsf( | ||
348 | struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) | ||
349 | { | ||
350 | struct ieee80211_local *local = sdata->local; | ||
351 | unsigned long long tsf; | ||
352 | int ret; | ||
353 | |||
354 | if (strncmp(buf, "reset", 5) == 0) { | ||
355 | if (local->ops->reset_tsf) { | ||
356 | drv_reset_tsf(local, sdata); | ||
357 | wiphy_info(local->hw.wiphy, "debugfs reset TSF\n"); | ||
358 | } | ||
359 | } else { | ||
360 | ret = kstrtoull(buf, 10, &tsf); | ||
361 | if (ret < 0) | ||
362 | return -EINVAL; | ||
363 | if (local->ops->set_tsf) { | ||
364 | drv_set_tsf(local, sdata, tsf); | ||
365 | wiphy_info(local->hw.wiphy, | ||
366 | "debugfs set TSF to %#018llx\n", tsf); | ||
367 | } | ||
368 | } | ||
369 | |||
370 | return buflen; | ||
371 | } | ||
372 | __IEEE80211_IF_FILE_W(tsf); | ||
373 | |||
374 | |||
334 | /* WDS attributes */ | 375 | /* WDS attributes */ |
335 | IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); | 376 | IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); |
336 | 377 | ||
@@ -421,6 +462,11 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata) | |||
421 | DEBUGFS_ADD_MODE(tkip_mic_test, 0200); | 462 | DEBUGFS_ADD_MODE(tkip_mic_test, 0200); |
422 | } | 463 | } |
423 | 464 | ||
465 | static void add_ibss_files(struct ieee80211_sub_if_data *sdata) | ||
466 | { | ||
467 | DEBUGFS_ADD_MODE(tsf, 0600); | ||
468 | } | ||
469 | |||
424 | static void add_wds_files(struct ieee80211_sub_if_data *sdata) | 470 | static void add_wds_files(struct ieee80211_sub_if_data *sdata) |
425 | { | 471 | { |
426 | DEBUGFS_ADD(drop_unencrypted); | 472 | DEBUGFS_ADD(drop_unencrypted); |
@@ -515,7 +561,7 @@ static void add_files(struct ieee80211_sub_if_data *sdata) | |||
515 | add_sta_files(sdata); | 561 | add_sta_files(sdata); |
516 | break; | 562 | break; |
517 | case NL80211_IFTYPE_ADHOC: | 563 | case NL80211_IFTYPE_ADHOC: |
518 | /* XXX */ | 564 | add_ibss_files(sdata); |
519 | break; | 565 | break; |
520 | case NL80211_IFTYPE_AP: | 566 | case NL80211_IFTYPE_AP: |
521 | add_ap_files(sdata); | 567 | add_ap_files(sdata); |