diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-08-07 18:41:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:13:47 -0400 |
commit | 22fdf3c9e19dce6d66bcfdbed547a5aa52b89933 (patch) | |
tree | d2f0cf8e6f4f133ad08036d6ee01978fc0d51803 /drivers/net/wireless/iwlwifi/iwl-debugfs.c | |
parent | 20594eb0daa67f7a0cc19d74a1bafceb1bb09f4a (diff) |
iwlwifi: Traffic type and counter for debugFs
Break down the traffic type and counter for both Tx and Rx.
Enhance the tx_statistics and rx_statistics debugfs function and move
to /sys/kernel/debug/ieee80211/phy0/iwlagn/debug directory to help
better debugging both driver and uCode related problems.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 129 |
1 files changed, 105 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 031538c42063..a0e5063cd8c9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -126,18 +126,58 @@ static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, | |||
126 | size_t count, loff_t *ppos) { | 126 | size_t count, loff_t *ppos) { |
127 | 127 | ||
128 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | 128 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
129 | char buf[256]; | 129 | char *buf; |
130 | int pos = 0; | 130 | int pos = 0; |
131 | const size_t bufsz = sizeof(buf); | ||
132 | 131 | ||
133 | pos += scnprintf(buf + pos, bufsz - pos, "mgmt: %u\n", | 132 | int cnt; |
134 | priv->tx_stats[0].cnt); | 133 | ssize_t ret; |
135 | pos += scnprintf(buf + pos, bufsz - pos, "ctrl: %u\n", | 134 | const size_t bufsz = 100 + sizeof(char) * 24 * (MANAGEMENT_MAX + CONTROL_MAX); |
136 | priv->tx_stats[1].cnt); | 135 | buf = kzalloc(bufsz, GFP_KERNEL); |
137 | pos += scnprintf(buf + pos, bufsz - pos, "data: %u\n", | 136 | if (!buf) |
138 | priv->tx_stats[2].cnt); | 137 | return -ENOMEM; |
138 | pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); | ||
139 | for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { | ||
140 | pos += scnprintf(buf + pos, bufsz - pos, | ||
141 | "\t%s\t\t: %u\n", | ||
142 | get_mgmt_string(cnt), | ||
143 | priv->tx_stats.mgmt[cnt]); | ||
144 | } | ||
145 | pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); | ||
146 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { | ||
147 | pos += scnprintf(buf + pos, bufsz - pos, | ||
148 | "\t%s\t\t: %u\n", | ||
149 | get_ctrl_string(cnt), | ||
150 | priv->tx_stats.ctrl[cnt]); | ||
151 | } | ||
152 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); | ||
153 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", | ||
154 | priv->tx_stats.data_cnt); | ||
155 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", | ||
156 | priv->tx_stats.data_bytes); | ||
157 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
158 | kfree(buf); | ||
159 | return ret; | ||
160 | } | ||
161 | |||
162 | static ssize_t iwl_dbgfs_tx_statistics_write(struct file *file, | ||
163 | const char __user *user_buf, | ||
164 | size_t count, loff_t *ppos) | ||
165 | { | ||
166 | struct iwl_priv *priv = file->private_data; | ||
167 | u32 clear_flag; | ||
168 | char buf[8]; | ||
169 | int buf_size; | ||
139 | 170 | ||
140 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 171 | memset(buf, 0, sizeof(buf)); |
172 | buf_size = min(count, sizeof(buf) - 1); | ||
173 | if (copy_from_user(buf, user_buf, buf_size)) | ||
174 | return -EFAULT; | ||
175 | if (sscanf(buf, "%x", &clear_flag) != 1) | ||
176 | return -EFAULT; | ||
177 | if (clear_flag == 1) | ||
178 | iwl_clear_tx_stats(priv); | ||
179 | |||
180 | return count; | ||
141 | } | 181 | } |
142 | 182 | ||
143 | static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file, | 183 | static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file, |
@@ -145,18 +185,59 @@ static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file, | |||
145 | size_t count, loff_t *ppos) { | 185 | size_t count, loff_t *ppos) { |
146 | 186 | ||
147 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | 187 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
148 | char buf[256]; | 188 | char *buf; |
149 | int pos = 0; | 189 | int pos = 0; |
150 | const size_t bufsz = sizeof(buf); | 190 | int cnt; |
191 | ssize_t ret; | ||
192 | const size_t bufsz = 100 + | ||
193 | sizeof(char) * 24 * (MANAGEMENT_MAX + CONTROL_MAX); | ||
194 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
195 | if (!buf) | ||
196 | return -ENOMEM; | ||
151 | 197 | ||
152 | pos += scnprintf(buf + pos, bufsz - pos, "mgmt: %u\n", | 198 | pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); |
153 | priv->rx_stats[0].cnt); | 199 | for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { |
154 | pos += scnprintf(buf + pos, bufsz - pos, "ctrl: %u\n", | 200 | pos += scnprintf(buf + pos, bufsz - pos, |
155 | priv->rx_stats[1].cnt); | 201 | "\t%s\t\t: %u\n", |
156 | pos += scnprintf(buf + pos, bufsz - pos, "data: %u\n", | 202 | get_mgmt_string(cnt), |
157 | priv->rx_stats[2].cnt); | 203 | priv->rx_stats.mgmt[cnt]); |
204 | } | ||
205 | pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); | ||
206 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { | ||
207 | pos += scnprintf(buf + pos, bufsz - pos, | ||
208 | "\t%s\t\t: %u\n", | ||
209 | get_ctrl_string(cnt), | ||
210 | priv->rx_stats.ctrl[cnt]); | ||
211 | } | ||
212 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); | ||
213 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", | ||
214 | priv->rx_stats.data_cnt); | ||
215 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", | ||
216 | priv->rx_stats.data_bytes); | ||
158 | 217 | ||
159 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 218 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
219 | kfree(buf); | ||
220 | return ret; | ||
221 | } | ||
222 | |||
223 | static ssize_t iwl_dbgfs_rx_statistics_write(struct file *file, | ||
224 | const char __user *user_buf, | ||
225 | size_t count, loff_t *ppos) | ||
226 | { | ||
227 | struct iwl_priv *priv = file->private_data; | ||
228 | u32 clear_flag; | ||
229 | char buf[8]; | ||
230 | int buf_size; | ||
231 | |||
232 | memset(buf, 0, sizeof(buf)); | ||
233 | buf_size = min(count, sizeof(buf) - 1); | ||
234 | if (copy_from_user(buf, user_buf, buf_size)) | ||
235 | return -EFAULT; | ||
236 | if (sscanf(buf, "%x", &clear_flag) != 1) | ||
237 | return -EFAULT; | ||
238 | if (clear_flag == 1) | ||
239 | iwl_clear_rx_stats(priv); | ||
240 | return count; | ||
160 | } | 241 | } |
161 | 242 | ||
162 | #define BYTE1_MASK 0x000000ff; | 243 | #define BYTE1_MASK 0x000000ff; |
@@ -700,8 +781,6 @@ DEBUGFS_READ_WRITE_FILE_OPS(sram); | |||
700 | DEBUGFS_WRITE_FILE_OPS(log_event); | 781 | DEBUGFS_WRITE_FILE_OPS(log_event); |
701 | DEBUGFS_READ_FILE_OPS(nvm); | 782 | DEBUGFS_READ_FILE_OPS(nvm); |
702 | DEBUGFS_READ_FILE_OPS(stations); | 783 | DEBUGFS_READ_FILE_OPS(stations); |
703 | DEBUGFS_READ_FILE_OPS(rx_statistics); | ||
704 | DEBUGFS_READ_FILE_OPS(tx_statistics); | ||
705 | DEBUGFS_READ_FILE_OPS(channels); | 784 | DEBUGFS_READ_FILE_OPS(channels); |
706 | DEBUGFS_READ_FILE_OPS(status); | 785 | DEBUGFS_READ_FILE_OPS(status); |
707 | DEBUGFS_READ_WRITE_FILE_OPS(interrupt); | 786 | DEBUGFS_READ_WRITE_FILE_OPS(interrupt); |
@@ -808,6 +887,8 @@ static ssize_t iwl_dbgfs_traffic_log_write(struct file *file, | |||
808 | return count; | 887 | return count; |
809 | } | 888 | } |
810 | 889 | ||
890 | DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); | ||
891 | DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); | ||
811 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 892 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
812 | 893 | ||
813 | /* | 894 | /* |
@@ -841,8 +922,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
841 | DEBUGFS_ADD_FILE(sram, data); | 922 | DEBUGFS_ADD_FILE(sram, data); |
842 | DEBUGFS_ADD_FILE(log_event, data); | 923 | DEBUGFS_ADD_FILE(log_event, data); |
843 | DEBUGFS_ADD_FILE(stations, data); | 924 | DEBUGFS_ADD_FILE(stations, data); |
844 | DEBUGFS_ADD_FILE(rx_statistics, data); | ||
845 | DEBUGFS_ADD_FILE(tx_statistics, data); | ||
846 | DEBUGFS_ADD_FILE(channels, data); | 925 | DEBUGFS_ADD_FILE(channels, data); |
847 | DEBUGFS_ADD_FILE(status, data); | 926 | DEBUGFS_ADD_FILE(status, data); |
848 | DEBUGFS_ADD_FILE(interrupt, data); | 927 | DEBUGFS_ADD_FILE(interrupt, data); |
@@ -852,6 +931,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
852 | #endif | 931 | #endif |
853 | DEBUGFS_ADD_FILE(thermal_throttling, data); | 932 | DEBUGFS_ADD_FILE(thermal_throttling, data); |
854 | DEBUGFS_ADD_FILE(disable_ht40, data); | 933 | DEBUGFS_ADD_FILE(disable_ht40, data); |
934 | DEBUGFS_ADD_FILE(rx_statistics, debug); | ||
935 | DEBUGFS_ADD_FILE(tx_statistics, debug); | ||
855 | DEBUGFS_ADD_FILE(traffic_log, debug); | 936 | DEBUGFS_ADD_FILE(traffic_log, debug); |
856 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); | 937 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); |
857 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, | 938 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, |
@@ -879,8 +960,6 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
879 | return; | 960 | return; |
880 | 961 | ||
881 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_nvm); | 962 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_nvm); |
882 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_rx_statistics); | ||
883 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_tx_statistics); | ||
884 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); | 963 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); |
885 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event); | 964 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event); |
886 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); | 965 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); |
@@ -894,6 +973,8 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
894 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_thermal_throttling); | 973 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_thermal_throttling); |
895 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_disable_ht40); | 974 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_disable_ht40); |
896 | DEBUGFS_REMOVE(priv->dbgfs->dir_data); | 975 | DEBUGFS_REMOVE(priv->dbgfs->dir_data); |
976 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_statistics); | ||
977 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_statistics); | ||
897 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log); | 978 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log); |
898 | DEBUGFS_REMOVE(priv->dbgfs->dir_debug); | 979 | DEBUGFS_REMOVE(priv->dbgfs->dir_debug); |
899 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); | 980 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); |