aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath5k/base.c10
-rw-r--r--drivers/net/wireless/ath5k/debug.c48
-rw-r--r--drivers/net/wireless/ath5k/debug.h1
-rw-r--r--drivers/net/wireless/ath9k/core.h1
-rw-r--r--drivers/net/wireless/ath9k/debug.c48
-rw-r--r--drivers/net/wireless/ath9k/main.c9
-rw-r--r--include/net/mac80211.h7
-rw-r--r--net/mac80211/debugfs.c55
8 files changed, 77 insertions, 102 deletions
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index fa39f21c36c3..b3f41acb9065 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -239,6 +239,7 @@ static int ath5k_get_stats(struct ieee80211_hw *hw,
239static int ath5k_get_tx_stats(struct ieee80211_hw *hw, 239static int ath5k_get_tx_stats(struct ieee80211_hw *hw,
240 struct ieee80211_tx_queue_stats *stats); 240 struct ieee80211_tx_queue_stats *stats);
241static u64 ath5k_get_tsf(struct ieee80211_hw *hw); 241static u64 ath5k_get_tsf(struct ieee80211_hw *hw);
242static void ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf);
242static void ath5k_reset_tsf(struct ieee80211_hw *hw); 243static void ath5k_reset_tsf(struct ieee80211_hw *hw);
243static int ath5k_beacon_update(struct ath5k_softc *sc, 244static int ath5k_beacon_update(struct ath5k_softc *sc,
244 struct sk_buff *skb); 245 struct sk_buff *skb);
@@ -261,6 +262,7 @@ static struct ieee80211_ops ath5k_hw_ops = {
261 .conf_tx = NULL, 262 .conf_tx = NULL,
262 .get_tx_stats = ath5k_get_tx_stats, 263 .get_tx_stats = ath5k_get_tx_stats,
263 .get_tsf = ath5k_get_tsf, 264 .get_tsf = ath5k_get_tsf,
265 .set_tsf = ath5k_set_tsf,
264 .reset_tsf = ath5k_reset_tsf, 266 .reset_tsf = ath5k_reset_tsf,
265 .bss_info_changed = ath5k_bss_info_changed, 267 .bss_info_changed = ath5k_bss_info_changed,
266}; 268};
@@ -3111,6 +3113,14 @@ ath5k_get_tsf(struct ieee80211_hw *hw)
3111} 3113}
3112 3114
3113static void 3115static void
3116ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
3117{
3118 struct ath5k_softc *sc = hw->priv;
3119
3120 ath5k_hw_set_tsf64(sc->ah, tsf);
3121}
3122
3123static void
3114ath5k_reset_tsf(struct ieee80211_hw *hw) 3124ath5k_reset_tsf(struct ieee80211_hw *hw)
3115{ 3125{
3116 struct ath5k_softc *sc = hw->priv; 3126 struct ath5k_softc *sc = hw->priv;
diff --git a/drivers/net/wireless/ath5k/debug.c b/drivers/net/wireless/ath5k/debug.c
index 129b72684daf..413ed689cd5f 100644
--- a/drivers/net/wireless/ath5k/debug.c
+++ b/drivers/net/wireless/ath5k/debug.c
@@ -193,50 +193,6 @@ static const struct file_operations fops_registers = {
193}; 193};
194 194
195 195
196/* debugfs: TSF */
197
198static ssize_t read_file_tsf(struct file *file, char __user *user_buf,
199 size_t count, loff_t *ppos)
200{
201 struct ath5k_softc *sc = file->private_data;
202 char buf[100];
203 snprintf(buf, sizeof(buf), "0x%016llx\n",
204 (unsigned long long)ath5k_hw_get_tsf64(sc->ah));
205 return simple_read_from_buffer(user_buf, count, ppos, buf, 19);
206}
207
208static ssize_t write_file_tsf(struct file *file,
209 const char __user *userbuf,
210 size_t count, loff_t *ppos)
211{
212 struct ath5k_softc *sc = file->private_data;
213 char buf[21];
214 unsigned long long tsf;
215
216 if (copy_from_user(buf, userbuf, min(count, sizeof(buf) - 1)))
217 return -EFAULT;
218 buf[sizeof(buf) - 1] = '\0';
219
220 if (strncmp(buf, "reset", 5) == 0) {
221 ath5k_hw_reset_tsf(sc->ah);
222 printk(KERN_INFO "debugfs reset TSF\n");
223 } else {
224 tsf = simple_strtoul(buf, NULL, 0);
225 ath5k_hw_set_tsf64(sc->ah, tsf);
226 printk(KERN_INFO "debugfs set TSF to %#018llx\n", tsf);
227 }
228
229 return count;
230}
231
232static const struct file_operations fops_tsf = {
233 .read = read_file_tsf,
234 .write = write_file_tsf,
235 .open = ath5k_debugfs_open,
236 .owner = THIS_MODULE,
237};
238
239
240/* debugfs: beacons */ 196/* debugfs: beacons */
241 197
242static ssize_t read_file_beacon(struct file *file, char __user *user_buf, 198static ssize_t read_file_beacon(struct file *file, char __user *user_buf,
@@ -430,9 +386,6 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
430 sc->debug.debugfs_registers = debugfs_create_file("registers", S_IRUGO, 386 sc->debug.debugfs_registers = debugfs_create_file("registers", S_IRUGO,
431 sc->debug.debugfs_phydir, sc, &fops_registers); 387 sc->debug.debugfs_phydir, sc, &fops_registers);
432 388
433 sc->debug.debugfs_tsf = debugfs_create_file("tsf", S_IWUSR | S_IRUGO,
434 sc->debug.debugfs_phydir, sc, &fops_tsf);
435
436 sc->debug.debugfs_beacon = debugfs_create_file("beacon", S_IWUSR | S_IRUGO, 389 sc->debug.debugfs_beacon = debugfs_create_file("beacon", S_IWUSR | S_IRUGO,
437 sc->debug.debugfs_phydir, sc, &fops_beacon); 390 sc->debug.debugfs_phydir, sc, &fops_beacon);
438 391
@@ -451,7 +404,6 @@ ath5k_debug_finish_device(struct ath5k_softc *sc)
451{ 404{
452 debugfs_remove(sc->debug.debugfs_debug); 405 debugfs_remove(sc->debug.debugfs_debug);
453 debugfs_remove(sc->debug.debugfs_registers); 406 debugfs_remove(sc->debug.debugfs_registers);
454 debugfs_remove(sc->debug.debugfs_tsf);
455 debugfs_remove(sc->debug.debugfs_beacon); 407 debugfs_remove(sc->debug.debugfs_beacon);
456 debugfs_remove(sc->debug.debugfs_reset); 408 debugfs_remove(sc->debug.debugfs_reset);
457 debugfs_remove(sc->debug.debugfs_phydir); 409 debugfs_remove(sc->debug.debugfs_phydir);
diff --git a/drivers/net/wireless/ath5k/debug.h b/drivers/net/wireless/ath5k/debug.h
index ffc529393306..66f69f04e55e 100644
--- a/drivers/net/wireless/ath5k/debug.h
+++ b/drivers/net/wireless/ath5k/debug.h
@@ -72,7 +72,6 @@ struct ath5k_dbg_info {
72 struct dentry *debugfs_phydir; 72 struct dentry *debugfs_phydir;
73 struct dentry *debugfs_debug; 73 struct dentry *debugfs_debug;
74 struct dentry *debugfs_registers; 74 struct dentry *debugfs_registers;
75 struct dentry *debugfs_tsf;
76 struct dentry *debugfs_beacon; 75 struct dentry *debugfs_beacon;
77 struct dentry *debugfs_reset; 76 struct dentry *debugfs_reset;
78}; 77};
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index acbd8881ef83..29251f8dabb0 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -141,7 +141,6 @@ struct ath9k_debug {
141 struct dentry *debugfs_phy; 141 struct dentry *debugfs_phy;
142 struct dentry *debugfs_dma; 142 struct dentry *debugfs_dma;
143 struct dentry *debugfs_interrupt; 143 struct dentry *debugfs_interrupt;
144 struct dentry *debugfs_tsf;
145 struct ath_stats stats; 144 struct ath_stats stats;
146}; 145};
147 146
diff --git a/drivers/net/wireless/ath9k/debug.c b/drivers/net/wireless/ath9k/debug.c
index 05e1f82cc7a1..1680164b4adb 100644
--- a/drivers/net/wireless/ath9k/debug.c
+++ b/drivers/net/wireless/ath9k/debug.c
@@ -223,48 +223,6 @@ static const struct file_operations fops_interrupt = {
223}; 223};
224 224
225 225
226static ssize_t read_file_tsf(struct file *file, char __user *user_buf,
227 size_t count, loff_t *ppos)
228{
229 struct ath_softc *sc = file->private_data;
230 char buf[100];
231 snprintf(buf, sizeof(buf), "0x%016llx\n",
232 (unsigned long long)ath9k_hw_gettsf64(sc->sc_ah));
233 return simple_read_from_buffer(user_buf, count, ppos, buf, 19);
234}
235
236static ssize_t write_file_tsf(struct file *file,
237 const char __user *user_buf,
238 size_t count, loff_t *ppos)
239{
240 struct ath_softc *sc = file->private_data;
241 char buf[21];
242 unsigned long long tsf;
243
244 if (copy_from_user(buf, user_buf, min(count, sizeof(buf) - 1)))
245 return -EFAULT;
246 buf[sizeof(buf) - 1] = '\0';
247
248 if (strncmp(buf, "reset", 5) == 0) {
249 ath9k_hw_reset_tsf(sc->sc_ah);
250 printk(KERN_INFO "debugfs reset TSF\n");
251 } else {
252 tsf = simple_strtoul(buf, NULL, 0);
253 ath9k_hw_settsf64(sc->sc_ah, tsf);
254 printk(KERN_INFO "debugfs set TSF to %#018llx\n", tsf);
255 }
256
257 return count;
258}
259
260static const struct file_operations fops_tsf = {
261 .read = read_file_tsf,
262 .write = write_file_tsf,
263 .open = ath9k_debugfs_open,
264 .owner = THIS_MODULE
265};
266
267
268int ath9k_init_debug(struct ath_softc *sc) 226int ath9k_init_debug(struct ath_softc *sc)
269{ 227{
270 sc->sc_debug.debug_mask = ath9k_debug; 228 sc->sc_debug.debug_mask = ath9k_debug;
@@ -290,11 +248,6 @@ int ath9k_init_debug(struct ath_softc *sc)
290 if (!sc->sc_debug.debugfs_interrupt) 248 if (!sc->sc_debug.debugfs_interrupt)
291 goto err; 249 goto err;
292 250
293 sc->sc_debug.debugfs_tsf = debugfs_create_file("tsf", S_IRUGO,
294 sc->sc_debug.debugfs_phy, sc, &fops_tsf);
295 if (!sc->sc_debug.debugfs_tsf)
296 goto err;
297
298 return 0; 251 return 0;
299err: 252err:
300 ath9k_exit_debug(sc); 253 ath9k_exit_debug(sc);
@@ -303,7 +256,6 @@ err:
303 256
304void ath9k_exit_debug(struct ath_softc *sc) 257void ath9k_exit_debug(struct ath_softc *sc)
305{ 258{
306 debugfs_remove(sc->sc_debug.debugfs_tsf);
307 debugfs_remove(sc->sc_debug.debugfs_interrupt); 259 debugfs_remove(sc->sc_debug.debugfs_interrupt);
308 debugfs_remove(sc->sc_debug.debugfs_dma); 260 debugfs_remove(sc->sc_debug.debugfs_dma);
309 debugfs_remove(sc->sc_debug.debugfs_phy); 261 debugfs_remove(sc->sc_debug.debugfs_phy);
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 15a7f90bc84b..90e687b5a8b7 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -2451,6 +2451,14 @@ static u64 ath9k_get_tsf(struct ieee80211_hw *hw)
2451 return tsf; 2451 return tsf;
2452} 2452}
2453 2453
2454static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
2455{
2456 struct ath_softc *sc = hw->priv;
2457 struct ath_hal *ah = sc->sc_ah;
2458
2459 ath9k_hw_settsf64(ah, tsf);
2460}
2461
2454static void ath9k_reset_tsf(struct ieee80211_hw *hw) 2462static void ath9k_reset_tsf(struct ieee80211_hw *hw)
2455{ 2463{
2456 struct ath_softc *sc = hw->priv; 2464 struct ath_softc *sc = hw->priv;
@@ -2514,6 +2522,7 @@ struct ieee80211_ops ath9k_ops = {
2514 .bss_info_changed = ath9k_bss_info_changed, 2522 .bss_info_changed = ath9k_bss_info_changed,
2515 .set_key = ath9k_set_key, 2523 .set_key = ath9k_set_key,
2516 .get_tsf = ath9k_get_tsf, 2524 .get_tsf = ath9k_get_tsf,
2525 .set_tsf = ath9k_set_tsf,
2517 .reset_tsf = ath9k_reset_tsf, 2526 .reset_tsf = ath9k_reset_tsf,
2518 .ampdu_action = ath9k_ampdu_action, 2527 .ampdu_action = ath9k_ampdu_action,
2519}; 2528};
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 8e65adf0a64c..e2144f0e8728 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1359,7 +1359,11 @@ enum ieee80211_ampdu_mlme_action {
1359 * hw->ampdu_queues items. 1359 * hw->ampdu_queues items.
1360 * 1360 *
1361 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1361 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1362 * this is only used for IBSS mode debugging and, as such, is not a 1362 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1363 * required function. Must be atomic.
1364 *
1365 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1366 * Currently, this is only used for IBSS mode debugging. Is not a
1363 * required function. Must be atomic. 1367 * required function. Must be atomic.
1364 * 1368 *
1365 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1369 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
@@ -1421,6 +1425,7 @@ struct ieee80211_ops {
1421 int (*get_tx_stats)(struct ieee80211_hw *hw, 1425 int (*get_tx_stats)(struct ieee80211_hw *hw,
1422 struct ieee80211_tx_queue_stats *stats); 1426 struct ieee80211_tx_queue_stats *stats);
1423 u64 (*get_tsf)(struct ieee80211_hw *hw); 1427 u64 (*get_tsf)(struct ieee80211_hw *hw);
1428 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1424 void (*reset_tsf)(struct ieee80211_hw *hw); 1429 void (*reset_tsf)(struct ieee80211_hw *hw);
1425 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1430 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1426 int (*ampdu_action)(struct ieee80211_hw *hw, 1431 int (*ampdu_action)(struct ieee80211_hw *hw,
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);
58DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", 58DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d",
59 local->total_ps_buffered); 59 local->total_ps_buffered);
60DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x", 60DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x",
61 local->wep_iv & 0xffffff); 61 local->wep_iv & 0xffffff);
62DEBUGFS_READONLY_FILE(rate_ctrl_alg, 100, "%s", 62DEBUGFS_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>");
64DEBUGFS_READONLY_FILE(tsf, 20, "%#018llx", 64
65 (unsigned long long) (local->ops->get_tsf ? local->ops->get_tsf(local_to_hw(local)) : 0)); 65static 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
80static 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
110static 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