diff options
Diffstat (limited to 'net/mac80211/debugfs.c')
-rw-r--r-- | net/mac80211/debugfs.c | 71 |
1 files changed, 8 insertions, 63 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index 186e02f7cc32..883996b2f99f 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -78,57 +78,6 @@ DEBUGFS_READONLY_FILE(wep_iv, "%#08x", | |||
78 | DEBUGFS_READONLY_FILE(rate_ctrl_alg, "%s", | 78 | DEBUGFS_READONLY_FILE(rate_ctrl_alg, "%s", |
79 | local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver"); | 79 | local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver"); |
80 | 80 | ||
81 | static ssize_t tsf_read(struct file *file, char __user *user_buf, | ||
82 | size_t count, loff_t *ppos) | ||
83 | { | ||
84 | struct ieee80211_local *local = file->private_data; | ||
85 | u64 tsf; | ||
86 | |||
87 | tsf = drv_get_tsf(local); | ||
88 | |||
89 | return mac80211_format_buffer(user_buf, count, ppos, "0x%016llx\n", | ||
90 | (unsigned long long) tsf); | ||
91 | } | ||
92 | |||
93 | static ssize_t tsf_write(struct file *file, | ||
94 | const char __user *user_buf, | ||
95 | size_t count, loff_t *ppos) | ||
96 | { | ||
97 | struct ieee80211_local *local = file->private_data; | ||
98 | unsigned long long tsf; | ||
99 | char buf[100]; | ||
100 | size_t len; | ||
101 | |||
102 | len = min(count, sizeof(buf) - 1); | ||
103 | if (copy_from_user(buf, user_buf, len)) | ||
104 | return -EFAULT; | ||
105 | buf[len] = '\0'; | ||
106 | |||
107 | if (strncmp(buf, "reset", 5) == 0) { | ||
108 | if (local->ops->reset_tsf) { | ||
109 | drv_reset_tsf(local); | ||
110 | wiphy_info(local->hw.wiphy, "debugfs reset TSF\n"); | ||
111 | } | ||
112 | } else { | ||
113 | tsf = simple_strtoul(buf, NULL, 0); | ||
114 | if (local->ops->set_tsf) { | ||
115 | drv_set_tsf(local, tsf); | ||
116 | wiphy_info(local->hw.wiphy, | ||
117 | "debugfs set TSF to %#018llx\n", tsf); | ||
118 | |||
119 | } | ||
120 | } | ||
121 | |||
122 | return count; | ||
123 | } | ||
124 | |||
125 | static const struct file_operations tsf_ops = { | ||
126 | .read = tsf_read, | ||
127 | .write = tsf_write, | ||
128 | .open = mac80211_open_file_generic, | ||
129 | .llseek = default_llseek, | ||
130 | }; | ||
131 | |||
132 | static ssize_t reset_write(struct file *file, const char __user *user_buf, | 81 | static ssize_t reset_write(struct file *file, const char __user *user_buf, |
133 | size_t count, loff_t *ppos) | 82 | size_t count, loff_t *ppos) |
134 | { | 83 | { |
@@ -195,20 +144,12 @@ static ssize_t uapsd_queues_write(struct file *file, | |||
195 | size_t count, loff_t *ppos) | 144 | size_t count, loff_t *ppos) |
196 | { | 145 | { |
197 | struct ieee80211_local *local = file->private_data; | 146 | struct ieee80211_local *local = file->private_data; |
198 | unsigned long val; | 147 | u8 val; |
199 | char buf[10]; | ||
200 | size_t len; | ||
201 | int ret; | 148 | int ret; |
202 | 149 | ||
203 | len = min(count, sizeof(buf) - 1); | 150 | ret = kstrtou8_from_user(user_buf, count, 0, &val); |
204 | if (copy_from_user(buf, user_buf, len)) | ||
205 | return -EFAULT; | ||
206 | buf[len] = '\0'; | ||
207 | |||
208 | ret = strict_strtoul(buf, 0, &val); | ||
209 | |||
210 | if (ret) | 151 | if (ret) |
211 | return -EINVAL; | 152 | return ret; |
212 | 153 | ||
213 | if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) | 154 | if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) |
214 | return -ERANGE; | 155 | return -ERANGE; |
@@ -305,6 +246,9 @@ static ssize_t hwflags_read(struct file *file, char __user *user_buf, | |||
305 | char *buf = kzalloc(mxln, GFP_KERNEL); | 246 | char *buf = kzalloc(mxln, GFP_KERNEL); |
306 | int sf = 0; /* how many written so far */ | 247 | int sf = 0; /* how many written so far */ |
307 | 248 | ||
249 | if (!buf) | ||
250 | return 0; | ||
251 | |||
308 | sf += snprintf(buf, mxln - sf, "0x%x\n", local->hw.flags); | 252 | sf += snprintf(buf, mxln - sf, "0x%x\n", local->hw.flags); |
309 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) | 253 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) |
310 | sf += snprintf(buf + sf, mxln - sf, "HAS_RATE_CONTROL\n"); | 254 | sf += snprintf(buf + sf, mxln - sf, "HAS_RATE_CONTROL\n"); |
@@ -355,6 +299,8 @@ static ssize_t hwflags_read(struct file *file, char __user *user_buf, | |||
355 | sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_PER_STA_GTK\n"); | 299 | sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_PER_STA_GTK\n"); |
356 | if (local->hw.flags & IEEE80211_HW_AP_LINK_PS) | 300 | if (local->hw.flags & IEEE80211_HW_AP_LINK_PS) |
357 | sf += snprintf(buf + sf, mxln - sf, "AP_LINK_PS\n"); | 301 | sf += snprintf(buf + sf, mxln - sf, "AP_LINK_PS\n"); |
302 | if (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW) | ||
303 | sf += snprintf(buf + sf, mxln - sf, "TX_AMPDU_SETUP_IN_HW\n"); | ||
358 | 304 | ||
359 | rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); | 305 | rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); |
360 | kfree(buf); | 306 | kfree(buf); |
@@ -450,7 +396,6 @@ void debugfs_hw_add(struct ieee80211_local *local) | |||
450 | DEBUGFS_ADD(frequency); | 396 | DEBUGFS_ADD(frequency); |
451 | DEBUGFS_ADD(total_ps_buffered); | 397 | DEBUGFS_ADD(total_ps_buffered); |
452 | DEBUGFS_ADD(wep_iv); | 398 | DEBUGFS_ADD(wep_iv); |
453 | DEBUGFS_ADD(tsf); | ||
454 | DEBUGFS_ADD(queues); | 399 | DEBUGFS_ADD(queues); |
455 | DEBUGFS_ADD_MODE(reset, 0200); | 400 | DEBUGFS_ADD_MODE(reset, 0200); |
456 | DEBUGFS_ADD(noack); | 401 | DEBUGFS_ADD(noack); |