diff options
author | Jiri Benc <jbenc@suse.cz> | 2007-05-05 14:46:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-05-05 14:46:38 -0400 |
commit | e9f207f0ff90bf60b825800d7450e6f2ff2eab88 (patch) | |
tree | 22bd39116f2cae8d4ce6169eb91e4b9a7204770f /net/mac80211/rc80211_simple.c | |
parent | f0706e828e96d0fa4e80c0d25aa98523f6d589a0 (diff) |
[MAC80211]: Add debugfs attributes.
Export various mac80211 internal variables through debugfs.
Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/rc80211_simple.c')
-rw-r--r-- | net/mac80211/rc80211_simple.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c index 68bddaeee005..2048cfd1ca70 100644 --- a/net/mac80211/rc80211_simple.c +++ b/net/mac80211/rc80211_simple.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <net/mac80211.h> | 18 | #include <net/mac80211.h> |
19 | #include "ieee80211_i.h" | 19 | #include "ieee80211_i.h" |
20 | #include "ieee80211_rate.h" | 20 | #include "ieee80211_rate.h" |
21 | #include "debugfs.h" | ||
21 | 22 | ||
22 | 23 | ||
23 | /* This is a minimal implementation of TX rate controlling that can be used | 24 | /* This is a minimal implementation of TX rate controlling that can be used |
@@ -121,6 +122,11 @@ struct sta_rate_control { | |||
121 | unsigned long avg_rate_update; | 122 | unsigned long avg_rate_update; |
122 | u32 tx_avg_rate_sum; | 123 | u32 tx_avg_rate_sum; |
123 | u32 tx_avg_rate_num; | 124 | u32 tx_avg_rate_num; |
125 | |||
126 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
127 | struct dentry *tx_avg_rate_sum_dentry; | ||
128 | struct dentry *tx_avg_rate_num_dentry; | ||
129 | #endif | ||
124 | }; | 130 | }; |
125 | 131 | ||
126 | 132 | ||
@@ -327,6 +333,67 @@ static void rate_control_simple_free_sta(void *priv, void *priv_sta) | |||
327 | kfree(rctrl); | 333 | kfree(rctrl); |
328 | } | 334 | } |
329 | 335 | ||
336 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
337 | |||
338 | static int open_file_generic(struct inode *inode, struct file *file) | ||
339 | { | ||
340 | file->private_data = inode->i_private; | ||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static ssize_t sta_tx_avg_rate_sum_read(struct file *file, | ||
345 | char __user *userbuf, | ||
346 | size_t count, loff_t *ppos) | ||
347 | { | ||
348 | struct sta_rate_control *srctrl = file->private_data; | ||
349 | char buf[20]; | ||
350 | |||
351 | sprintf(buf, "%d\n", srctrl->tx_avg_rate_sum); | ||
352 | return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); | ||
353 | } | ||
354 | |||
355 | static const struct file_operations sta_tx_avg_rate_sum_ops = { | ||
356 | .read = sta_tx_avg_rate_sum_read, | ||
357 | .open = open_file_generic, | ||
358 | }; | ||
359 | |||
360 | static ssize_t sta_tx_avg_rate_num_read(struct file *file, | ||
361 | char __user *userbuf, | ||
362 | size_t count, loff_t *ppos) | ||
363 | { | ||
364 | struct sta_rate_control *srctrl = file->private_data; | ||
365 | char buf[20]; | ||
366 | |||
367 | sprintf(buf, "%d\n", srctrl->tx_avg_rate_num); | ||
368 | return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); | ||
369 | } | ||
370 | |||
371 | static const struct file_operations sta_tx_avg_rate_num_ops = { | ||
372 | .read = sta_tx_avg_rate_num_read, | ||
373 | .open = open_file_generic, | ||
374 | }; | ||
375 | |||
376 | static void rate_control_simple_add_sta_debugfs(void *priv, void *priv_sta, | ||
377 | struct dentry *dir) | ||
378 | { | ||
379 | struct sta_rate_control *srctrl = priv_sta; | ||
380 | |||
381 | srctrl->tx_avg_rate_num_dentry = | ||
382 | debugfs_create_file("rc_simple_sta_tx_avg_rate_num", 0400, | ||
383 | dir, srctrl, &sta_tx_avg_rate_num_ops); | ||
384 | srctrl->tx_avg_rate_sum_dentry = | ||
385 | debugfs_create_file("rc_simple_sta_tx_avg_rate_sum", 0400, | ||
386 | dir, srctrl, &sta_tx_avg_rate_sum_ops); | ||
387 | } | ||
388 | |||
389 | static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta) | ||
390 | { | ||
391 | struct sta_rate_control *srctrl = priv_sta; | ||
392 | |||
393 | debugfs_remove(srctrl->tx_avg_rate_sum_dentry); | ||
394 | debugfs_remove(srctrl->tx_avg_rate_num_dentry); | ||
395 | } | ||
396 | #endif | ||
330 | 397 | ||
331 | static struct rate_control_ops rate_control_simple = { | 398 | static struct rate_control_ops rate_control_simple = { |
332 | .module = THIS_MODULE, | 399 | .module = THIS_MODULE, |
@@ -339,6 +406,10 @@ static struct rate_control_ops rate_control_simple = { | |||
339 | .free = rate_control_simple_free, | 406 | .free = rate_control_simple_free, |
340 | .alloc_sta = rate_control_simple_alloc_sta, | 407 | .alloc_sta = rate_control_simple_alloc_sta, |
341 | .free_sta = rate_control_simple_free_sta, | 408 | .free_sta = rate_control_simple_free_sta, |
409 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
410 | .add_sta_debugfs = rate_control_simple_add_sta_debugfs, | ||
411 | .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, | ||
412 | #endif | ||
342 | }; | 413 | }; |
343 | 414 | ||
344 | 415 | ||