diff options
Diffstat (limited to 'net/mac80211/debugfs.c')
-rw-r--r-- | net/mac80211/debugfs.c | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index 717d5484e1e5..e37f557de3f3 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -57,12 +57,61 @@ DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d", | |||
57 | local->hw.conf.long_frame_max_tx_count); | 57 | local->hw.conf.long_frame_max_tx_count); |
58 | DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", | 58 | DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", |
59 | local->total_ps_buffered); | 59 | local->total_ps_buffered); |
60 | DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x", | 60 | DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x", |
61 | local->wep_iv & 0xffffff); | 61 | local->wep_iv & 0xffffff); |
62 | DEBUGFS_READONLY_FILE(rate_ctrl_alg, 100, "%s", | 62 | DEBUGFS_READONLY_FILE(rate_ctrl_alg, 100, "%s", |
63 | local->rate_ctrl ? local->rate_ctrl->ops->name : "<unset>"); | 63 | local->rate_ctrl ? local->rate_ctrl->ops->name : "<unset>"); |
64 | DEBUGFS_READONLY_FILE(tsf, 20, "%#018llx", | 64 | |
65 | (unsigned long long) (local->ops->get_tsf ? local->ops->get_tsf(local_to_hw(local)) : 0)); | 65 | static ssize_t tsf_read(struct file *file, char __user *user_buf, |
66 | size_t count, loff_t *ppos) | ||
67 | { | ||
68 | struct ieee80211_local *local = file->private_data; | ||
69 | u64 tsf = 0; | ||
70 | char buf[100]; | ||
71 | |||
72 | if (local->ops->get_tsf) | ||
73 | tsf = local->ops->get_tsf(local_to_hw(local)); | ||
74 | |||
75 | snprintf(buf, sizeof(buf), "0x%016llx\n", (unsigned long long) tsf); | ||
76 | |||
77 | return simple_read_from_buffer(user_buf, count, ppos, buf, 19); | ||
78 | } | ||
79 | |||
80 | static ssize_t tsf_write(struct file *file, | ||
81 | const char __user *user_buf, | ||
82 | size_t count, loff_t *ppos) | ||
83 | { | ||
84 | struct ieee80211_local *local = file->private_data; | ||
85 | unsigned long long tsf; | ||
86 | char buf[100]; | ||
87 | size_t len; | ||
88 | |||
89 | len = min(count, sizeof(buf) - 1); | ||
90 | if (copy_from_user(buf, user_buf, len)) | ||
91 | return -EFAULT; | ||
92 | buf[len] = '\0'; | ||
93 | |||
94 | if (strncmp(buf, "reset", 5) == 0) { | ||
95 | if (local->ops->reset_tsf) { | ||
96 | local->ops->reset_tsf(local_to_hw(local)); | ||
97 | printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy)); | ||
98 | } | ||
99 | } else { | ||
100 | tsf = simple_strtoul(buf, NULL, 0); | ||
101 | if (local->ops->set_tsf) { | ||
102 | local->ops->set_tsf(local_to_hw(local), tsf); | ||
103 | printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | return count; | ||
108 | } | ||
109 | |||
110 | static const struct file_operations tsf_ops = { | ||
111 | .read = tsf_read, | ||
112 | .write = tsf_write, | ||
113 | .open = mac80211_open_file_generic | ||
114 | }; | ||
66 | 115 | ||
67 | /* statistics stuff */ | 116 | /* statistics stuff */ |
68 | 117 | ||