aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAbbas, Mohamed <mohamed.abbas@intel.com>2008-12-02 15:14:02 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-05 09:35:55 -0500
commitc30e30e17dad86d5e161cf9774eb4d549cc13191 (patch)
tree49ad5b7ac5649dfbbf01cc3af39f92638ca02eab /drivers
parentd366df5abb8d5ce7e2c36d3b678177787ccd9749 (diff)
iwl3945: add debugfs support
Add debugfs support to 3945 driver to display rs info. Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index bfeef701b1fd..76100d5786fb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -63,6 +63,9 @@ struct iwl3945_rs_sta {
63 u8 ibss_sta_added; 63 u8 ibss_sta_added;
64 struct timer_list rate_scale_flush; 64 struct timer_list rate_scale_flush;
65 struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; 65 struct iwl3945_rate_scale_data win[IWL_RATE_COUNT];
66#ifdef CONFIG_MAC80211_DEBUGFS
67 struct dentry *rs_sta_dbgfs_stats_table_file;
68#endif
66 69
67 /* used to be in sta_info */ 70 /* used to be in sta_info */
68 int last_txrate_idx; 71 int last_txrate_idx;
@@ -772,6 +775,60 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
772 IWL_DEBUG_RATE("leave: %d\n", index); 775 IWL_DEBUG_RATE("leave: %d\n", index);
773} 776}
774 777
778#ifdef CONFIG_MAC80211_DEBUGFS
779static int iwl3945_open_file_generic(struct inode *inode, struct file *file)
780{
781 file->private_data = inode->i_private;
782 return 0;
783}
784
785static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file,
786 char __user *user_buf,
787 size_t count, loff_t *ppos)
788{
789 char buff[1024];
790 int desc = 0;
791 int j;
792 struct iwl3945_rs_sta *lq_sta = file->private_data;
793
794 desc += sprintf(buff + desc, "tx packets=%d last rate index=%d\n"
795 "rate=0x%X flush time %d\n",
796 lq_sta->tx_packets,
797 lq_sta->last_txrate_idx,
798 lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time));
799 for (j = 0; j < IWL_RATE_COUNT; j++) {
800 desc += sprintf(buff+desc,
801 "counter=%d success=%d %%=%d\n",
802 lq_sta->win[j].counter,
803 lq_sta->win[j].success_counter,
804 lq_sta->win[j].success_ratio);
805 }
806 return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
807}
808
809static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
810 .read = iwl3945_sta_dbgfs_stats_table_read,
811 .open = iwl3945_open_file_generic,
812};
813
814static void iwl3945_add_debugfs(void *priv, void *priv_sta,
815 struct dentry *dir)
816{
817 struct iwl3945_rs_sta *lq_sta = priv_sta;
818
819 lq_sta->rs_sta_dbgfs_stats_table_file =
820 debugfs_create_file("rate_stats_table", 0600, dir,
821 lq_sta, &rs_sta_dbgfs_stats_table_ops);
822
823}
824
825static void iwl3945_remove_debugfs(void *priv, void *priv_sta)
826{
827 struct iwl3945_rs_sta *lq_sta = priv_sta;
828 debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
829}
830#endif
831
775static struct rate_control_ops rs_ops = { 832static struct rate_control_ops rs_ops = {
776 .module = NULL, 833 .module = NULL,
777 .name = RS_NAME, 834 .name = RS_NAME,
@@ -782,6 +839,11 @@ static struct rate_control_ops rs_ops = {
782 .free = rs_free, 839 .free = rs_free,
783 .alloc_sta = rs_alloc_sta, 840 .alloc_sta = rs_alloc_sta,
784 .free_sta = rs_free_sta, 841 .free_sta = rs_free_sta,
842#ifdef CONFIG_MAC80211_DEBUGFS
843 .add_sta_debugfs = iwl3945_add_debugfs,
844 .remove_sta_debugfs = iwl3945_remove_debugfs,
845#endif
846
785}; 847};
786 848
787void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) 849void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)