diff options
author | Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> | 2011-08-26 03:36:32 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-08-31 03:10:55 -0400 |
commit | 03f68a95e5763faf7b95993b3407fb816c200893 (patch) | |
tree | 15badfc6f534ce957702f4d7013c382601eb9e7a /drivers/net/wireless/ath/ath6kl/debug.c | |
parent | d999ba3e21dc1c84cac9caf68db78fd6dbde7817 (diff) |
ath6kl: Add debugfs entry to dump target stats
It would be at <debugfs_root>/ieee80211/phyX/ath6kl/tgt_stats.
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/debug.c | 147 |
1 files changed, 146 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index 12775e80a0f4..5a082c0f34cd 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c | |||
@@ -147,6 +147,149 @@ void dump_cred_dist_stats(struct htc_target *target) | |||
147 | target->cred_dist_cntxt->cur_free_credits); | 147 | target->cred_dist_cntxt->cur_free_credits); |
148 | } | 148 | } |
149 | 149 | ||
150 | static int ath6kl_debugfs_open(struct inode *inode, struct file *file) | ||
151 | { | ||
152 | file->private_data = inode->i_private; | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, | ||
157 | size_t count, loff_t *ppos) | ||
158 | { | ||
159 | struct ath6kl *ar = file->private_data; | ||
160 | struct target_stats *tgt_stats = &ar->target_stats; | ||
161 | char *buf; | ||
162 | unsigned int len = 0, buf_len = 1500; | ||
163 | int i; | ||
164 | long left; | ||
165 | ssize_t ret_cnt; | ||
166 | |||
167 | buf = kzalloc(buf_len, GFP_KERNEL); | ||
168 | if (!buf) | ||
169 | return -ENOMEM; | ||
170 | |||
171 | if (down_interruptible(&ar->sem)) { | ||
172 | kfree(buf); | ||
173 | return -EBUSY; | ||
174 | } | ||
175 | |||
176 | set_bit(STATS_UPDATE_PEND, &ar->flag); | ||
177 | |||
178 | if (ath6kl_wmi_get_stats_cmd(ar->wmi)) { | ||
179 | up(&ar->sem); | ||
180 | kfree(buf); | ||
181 | return -EIO; | ||
182 | } | ||
183 | |||
184 | left = wait_event_interruptible_timeout(ar->event_wq, | ||
185 | !test_bit(STATS_UPDATE_PEND, | ||
186 | &ar->flag), WMI_TIMEOUT); | ||
187 | |||
188 | up(&ar->sem); | ||
189 | |||
190 | if (left <= 0) { | ||
191 | kfree(buf); | ||
192 | return -ETIMEDOUT; | ||
193 | } | ||
194 | |||
195 | len += scnprintf(buf + len, buf_len - len, "\n"); | ||
196 | len += scnprintf(buf + len, buf_len - len, "%25s\n", | ||
197 | "Target Tx stats"); | ||
198 | len += scnprintf(buf + len, buf_len - len, "%25s\n\n", | ||
199 | "================="); | ||
200 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
201 | "Ucast packets", tgt_stats->tx_ucast_pkt); | ||
202 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
203 | "Bcast packets", tgt_stats->tx_bcast_pkt); | ||
204 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
205 | "Ucast byte", tgt_stats->tx_ucast_byte); | ||
206 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
207 | "Bcast byte", tgt_stats->tx_bcast_byte); | ||
208 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
209 | "Rts success cnt", tgt_stats->tx_rts_success_cnt); | ||
210 | for (i = 0; i < 4; i++) | ||
211 | len += scnprintf(buf + len, buf_len - len, | ||
212 | "%18s %d %10llu\n", "PER on ac", | ||
213 | i, tgt_stats->tx_pkt_per_ac[i]); | ||
214 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
215 | "Error", tgt_stats->tx_err); | ||
216 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
217 | "Fail count", tgt_stats->tx_fail_cnt); | ||
218 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
219 | "Retry count", tgt_stats->tx_retry_cnt); | ||
220 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
221 | "Multi retry cnt", tgt_stats->tx_mult_retry_cnt); | ||
222 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
223 | "Rts fail cnt", tgt_stats->tx_rts_fail_cnt); | ||
224 | len += scnprintf(buf + len, buf_len - len, "%25s %10llu\n\n", | ||
225 | "TKIP counter measure used", | ||
226 | tgt_stats->tkip_cnter_measures_invoked); | ||
227 | |||
228 | len += scnprintf(buf + len, buf_len - len, "%25s\n", | ||
229 | "Target Rx stats"); | ||
230 | len += scnprintf(buf + len, buf_len - len, "%25s\n", | ||
231 | "================="); | ||
232 | |||
233 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
234 | "Ucast packets", tgt_stats->rx_ucast_pkt); | ||
235 | len += scnprintf(buf + len, buf_len - len, "%20s %10d\n", | ||
236 | "Ucast Rate", tgt_stats->rx_ucast_rate); | ||
237 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
238 | "Bcast packets", tgt_stats->rx_bcast_pkt); | ||
239 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
240 | "Ucast byte", tgt_stats->rx_ucast_byte); | ||
241 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
242 | "Bcast byte", tgt_stats->rx_bcast_byte); | ||
243 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
244 | "Fragmented pkt", tgt_stats->rx_frgment_pkt); | ||
245 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
246 | "Error", tgt_stats->rx_err); | ||
247 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
248 | "CRC Err", tgt_stats->rx_crc_err); | ||
249 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
250 | "Key chache miss", tgt_stats->rx_key_cache_miss); | ||
251 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
252 | "Decrypt Err", tgt_stats->rx_decrypt_err); | ||
253 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
254 | "Duplicate frame", tgt_stats->rx_dupl_frame); | ||
255 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
256 | "Tkip Mic failure", tgt_stats->tkip_local_mic_fail); | ||
257 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
258 | "TKIP format err", tgt_stats->tkip_fmt_err); | ||
259 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
260 | "CCMP format Err", tgt_stats->ccmp_fmt_err); | ||
261 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n\n", | ||
262 | "CCMP Replay Err", tgt_stats->ccmp_replays); | ||
263 | |||
264 | len += scnprintf(buf + len, buf_len - len, "%25s\n", | ||
265 | "Misc Target stats"); | ||
266 | len += scnprintf(buf + len, buf_len - len, "%25s\n", | ||
267 | "================="); | ||
268 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
269 | "Beacon Miss count", tgt_stats->cs_bmiss_cnt); | ||
270 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
271 | "Num Connects", tgt_stats->cs_connect_cnt); | ||
272 | len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", | ||
273 | "Num disconnects", tgt_stats->cs_discon_cnt); | ||
274 | len += scnprintf(buf + len, buf_len - len, "%20s %10d\n", | ||
275 | "Beacon avg rssi", tgt_stats->cs_ave_beacon_rssi); | ||
276 | |||
277 | if (len > buf_len) | ||
278 | len = buf_len; | ||
279 | |||
280 | ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
281 | |||
282 | kfree(buf); | ||
283 | return ret_cnt; | ||
284 | } | ||
285 | |||
286 | static const struct file_operations fops_tgt_stats = { | ||
287 | .read = read_file_tgt_stats, | ||
288 | .open = ath6kl_debugfs_open, | ||
289 | .owner = THIS_MODULE, | ||
290 | .llseek = default_llseek, | ||
291 | }; | ||
292 | |||
150 | int ath6kl_debug_init(struct ath6kl *ar) | 293 | int ath6kl_debug_init(struct ath6kl *ar) |
151 | { | 294 | { |
152 | ar->debugfs_phy = debugfs_create_dir("ath6kl", | 295 | ar->debugfs_phy = debugfs_create_dir("ath6kl", |
@@ -154,7 +297,9 @@ int ath6kl_debug_init(struct ath6kl *ar) | |||
154 | if (!ar->debugfs_phy) | 297 | if (!ar->debugfs_phy) |
155 | return -ENOMEM; | 298 | return -ENOMEM; |
156 | 299 | ||
157 | /* TODO: Create debugfs file entries for various target/host stats */ | 300 | debugfs_create_file("tgt_stats", S_IRUSR, ar->debugfs_phy, ar, |
301 | &fops_tgt_stats); | ||
302 | |||
158 | return 0; | 303 | return 0; |
159 | } | 304 | } |
160 | #endif | 305 | #endif |