2 * Copyright (c) 2004-2011 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #include <linux/circ_buf.h>
21 #include <linux/vmalloc.h>
26 struct ath6kl_fwlog_slot {
30 /* max ATH6KL_FWLOG_PAYLOAD_SIZE bytes */
34 #define ATH6KL_FWLOG_SIZE 32768
35 #define ATH6KL_FWLOG_SLOT_SIZE (sizeof(struct ath6kl_fwlog_slot) + \
36 ATH6KL_FWLOG_PAYLOAD_SIZE)
37 #define ATH6KL_FWLOG_VALID_MASK 0x1ffff
39 int ath6kl_printk(const char *level, const char *fmt, ...)
50 rtn = printk("%sath6kl: %pV", level, &vaf);
57 #ifdef CONFIG_ATH6KL_DEBUG
59 #define REG_OUTPUT_LEN_PER_LINE 25
60 #define REGTYPE_STR_LEN 100
62 struct ath6kl_diag_reg_info {
68 static const struct ath6kl_diag_reg_info diag_reg[] = {
69 { 0x20000, 0x200fc, "General DMA and Rx registers" },
70 { 0x28000, 0x28900, "MAC PCU register & keycache" },
71 { 0x20800, 0x20a40, "QCU" },
72 { 0x21000, 0x212f0, "DCU" },
73 { 0x4000, 0x42e4, "RTC" },
74 { 0x540000, 0x540000 + (256 * 1024), "RAM" },
75 { 0x29800, 0x2B210, "Base Band" },
76 { 0x1C000, 0x1C748, "Analog" },
79 void ath6kl_dump_registers(struct ath6kl_device *dev,
80 struct ath6kl_irq_proc_registers *irq_proc_reg,
81 struct ath6kl_irq_enable_reg *irq_enable_reg)
84 ath6kl_dbg(ATH6KL_DBG_ANY, ("<------- Register Table -------->\n"));
86 if (irq_proc_reg != NULL) {
87 ath6kl_dbg(ATH6KL_DBG_ANY,
88 "Host Int status: 0x%x\n",
89 irq_proc_reg->host_int_status);
90 ath6kl_dbg(ATH6KL_DBG_ANY,
91 "CPU Int status: 0x%x\n",
92 irq_proc_reg->cpu_int_status);
93 ath6kl_dbg(ATH6KL_DBG_ANY,
94 "Error Int status: 0x%x\n",
95 irq_proc_reg->error_int_status);
96 ath6kl_dbg(ATH6KL_DBG_ANY,
97 "Counter Int status: 0x%x\n",
98 irq_proc_reg->counter_int_status);
99 ath6kl_dbg(ATH6KL_DBG_ANY,
100 "Mbox Frame: 0x%x\n",
101 irq_proc_reg->mbox_frame);
102 ath6kl_dbg(ATH6KL_DBG_ANY,
103 "Rx Lookahead Valid: 0x%x\n",
104 irq_proc_reg->rx_lkahd_valid);
105 ath6kl_dbg(ATH6KL_DBG_ANY,
106 "Rx Lookahead 0: 0x%x\n",
107 irq_proc_reg->rx_lkahd[0]);
108 ath6kl_dbg(ATH6KL_DBG_ANY,
109 "Rx Lookahead 1: 0x%x\n",
110 irq_proc_reg->rx_lkahd[1]);
112 if (dev->ar->mbox_info.gmbox_addr != 0) {
114 * If the target supports GMBOX hardware, dump some
117 ath6kl_dbg(ATH6KL_DBG_ANY,
118 "GMBOX Host Int status 2: 0x%x\n",
119 irq_proc_reg->host_int_status2);
120 ath6kl_dbg(ATH6KL_DBG_ANY,
121 "GMBOX RX Avail: 0x%x\n",
122 irq_proc_reg->gmbox_rx_avail);
123 ath6kl_dbg(ATH6KL_DBG_ANY,
124 "GMBOX lookahead alias 0: 0x%x\n",
125 irq_proc_reg->rx_gmbox_lkahd_alias[0]);
126 ath6kl_dbg(ATH6KL_DBG_ANY,
127 "GMBOX lookahead alias 1: 0x%x\n",
128 irq_proc_reg->rx_gmbox_lkahd_alias[1]);
133 if (irq_enable_reg != NULL) {
134 ath6kl_dbg(ATH6KL_DBG_ANY,
135 "Int status Enable: 0x%x\n",
136 irq_enable_reg->int_status_en);
137 ath6kl_dbg(ATH6KL_DBG_ANY, "Counter Int status Enable: 0x%x\n",
138 irq_enable_reg->cntr_int_status_en);
140 ath6kl_dbg(ATH6KL_DBG_ANY, "<------------------------------->\n");
143 static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist)
145 ath6kl_dbg(ATH6KL_DBG_CREDIT,
146 "--- endpoint: %d svc_id: 0x%X ---\n",
147 ep_dist->endpoint, ep_dist->svc_id);
148 ath6kl_dbg(ATH6KL_DBG_CREDIT, " dist_flags : 0x%X\n",
149 ep_dist->dist_flags);
150 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_norm : %d\n",
152 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_min : %d\n",
154 ath6kl_dbg(ATH6KL_DBG_CREDIT, " credits : %d\n",
156 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_assngd : %d\n",
157 ep_dist->cred_assngd);
158 ath6kl_dbg(ATH6KL_DBG_CREDIT, " seek_cred : %d\n",
160 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_sz : %d\n",
162 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_per_msg : %d\n",
163 ep_dist->cred_per_msg);
164 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_to_dist : %d\n",
165 ep_dist->cred_to_dist);
166 ath6kl_dbg(ATH6KL_DBG_CREDIT, " txq_depth : %d\n",
167 get_queue_depth(&ep_dist->htc_ep->txq));
168 ath6kl_dbg(ATH6KL_DBG_CREDIT,
169 "----------------------------------\n");
172 /* FIXME: move to htc.c */
173 void dump_cred_dist_stats(struct htc_target *target)
175 struct htc_endpoint_credit_dist *ep_list;
177 if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_CREDIT))
180 list_for_each_entry(ep_list, &target->cred_dist_list, list)
181 dump_cred_dist(ep_list);
183 ath6kl_dbg(ATH6KL_DBG_CREDIT,
184 "credit distribution total %d free %d\n",
185 target->credit_info->total_avail_credits,
186 target->credit_info->cur_free_credits);
189 static int ath6kl_debugfs_open(struct inode *inode, struct file *file)
191 file->private_data = inode->i_private;
195 void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war)
198 case ATH6KL_WAR_INVALID_RATE:
199 ar->debug.war_stats.invalid_rate++;
204 static ssize_t read_file_war_stats(struct file *file, char __user *user_buf,
205 size_t count, loff_t *ppos)
207 struct ath6kl *ar = file->private_data;
209 unsigned int len = 0, buf_len = 1500;
212 buf = kzalloc(buf_len, GFP_KERNEL);
216 len += scnprintf(buf + len, buf_len - len, "\n");
217 len += scnprintf(buf + len, buf_len - len, "%25s\n",
219 len += scnprintf(buf + len, buf_len - len, "%25s\n\n",
220 "=================");
221 len += scnprintf(buf + len, buf_len - len, "%20s %10u\n",
222 "Invalid rates", ar->debug.war_stats.invalid_rate);
224 if (WARN_ON(len > buf_len))
227 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
233 static const struct file_operations fops_war_stats = {
234 .read = read_file_war_stats,
235 .open = ath6kl_debugfs_open,
236 .owner = THIS_MODULE,
237 .llseek = default_llseek,
240 static void ath6kl_debug_fwlog_add(struct ath6kl *ar, const void *buf,
243 struct circ_buf *fwlog = &ar->debug.fwlog_buf;
247 /* entries must all be equal size */
248 if (WARN_ON(buf_len != ATH6KL_FWLOG_SLOT_SIZE))
251 space = CIRC_SPACE(fwlog->head, fwlog->tail, ATH6KL_FWLOG_SIZE);
253 /* discard oldest slot */
254 fwlog->tail = (fwlog->tail + ATH6KL_FWLOG_SLOT_SIZE) &
255 (ATH6KL_FWLOG_SIZE - 1);
257 for (i = 0; i < buf_len; i += space) {
258 space = CIRC_SPACE_TO_END(fwlog->head, fwlog->tail,
261 if ((size_t) space > buf_len - i)
264 memcpy(&fwlog->buf[fwlog->head], buf, space);
265 fwlog->head = (fwlog->head + space) & (ATH6KL_FWLOG_SIZE - 1);
270 void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len)
272 struct ath6kl_fwlog_slot *slot = ar->debug.fwlog_tmp;
275 if (WARN_ON(len > ATH6KL_FWLOG_PAYLOAD_SIZE))
278 spin_lock_bh(&ar->debug.fwlog_lock);
280 slot->timestamp = cpu_to_le32(jiffies);
281 slot->length = cpu_to_le32(len);
282 memcpy(slot->payload, buf, len);
284 slot_len = sizeof(*slot) + len;
286 if (slot_len < ATH6KL_FWLOG_SLOT_SIZE)
287 memset(slot->payload + len, 0,
288 ATH6KL_FWLOG_SLOT_SIZE - slot_len);
290 ath6kl_debug_fwlog_add(ar, slot, ATH6KL_FWLOG_SLOT_SIZE);
292 spin_unlock_bh(&ar->debug.fwlog_lock);
295 static bool ath6kl_debug_fwlog_empty(struct ath6kl *ar)
297 return CIRC_CNT(ar->debug.fwlog_buf.head,
298 ar->debug.fwlog_buf.tail,
299 ATH6KL_FWLOG_SLOT_SIZE) == 0;
302 static ssize_t ath6kl_fwlog_read(struct file *file, char __user *user_buf,
303 size_t count, loff_t *ppos)
305 struct ath6kl *ar = file->private_data;
306 struct circ_buf *fwlog = &ar->debug.fwlog_buf;
307 size_t len = 0, buf_len = count;
312 buf = vmalloc(buf_len);
316 /* read undelivered logs from firmware */
317 ath6kl_read_fwlogs(ar);
319 spin_lock_bh(&ar->debug.fwlog_lock);
321 while (len < buf_len && !ath6kl_debug_fwlog_empty(ar)) {
322 ccnt = CIRC_CNT_TO_END(fwlog->head, fwlog->tail,
325 if ((size_t) ccnt > buf_len - len)
326 ccnt = buf_len - len;
328 memcpy(buf + len, &fwlog->buf[fwlog->tail], ccnt);
331 fwlog->tail = (fwlog->tail + ccnt) &
332 (ATH6KL_FWLOG_SIZE - 1);
335 spin_unlock_bh(&ar->debug.fwlog_lock);
337 if (WARN_ON(len > buf_len))
340 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
347 static const struct file_operations fops_fwlog = {
348 .open = ath6kl_debugfs_open,
349 .read = ath6kl_fwlog_read,
350 .owner = THIS_MODULE,
351 .llseek = default_llseek,
354 static ssize_t ath6kl_fwlog_mask_read(struct file *file, char __user *user_buf,
355 size_t count, loff_t *ppos)
357 struct ath6kl *ar = file->private_data;
361 len = snprintf(buf, sizeof(buf), "0x%x\n", ar->debug.fwlog_mask);
363 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
366 static ssize_t ath6kl_fwlog_mask_write(struct file *file,
367 const char __user *user_buf,
368 size_t count, loff_t *ppos)
370 struct ath6kl *ar = file->private_data;
373 ret = kstrtou32_from_user(user_buf, count, 0, &ar->debug.fwlog_mask);
377 ret = ath6kl_wmi_config_debug_module_cmd(ar->wmi,
378 ATH6KL_FWLOG_VALID_MASK,
379 ar->debug.fwlog_mask);
386 static const struct file_operations fops_fwlog_mask = {
387 .open = ath6kl_debugfs_open,
388 .read = ath6kl_fwlog_mask_read,
389 .write = ath6kl_fwlog_mask_write,
390 .owner = THIS_MODULE,
391 .llseek = default_llseek,
394 static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
395 size_t count, loff_t *ppos)
397 struct ath6kl *ar = file->private_data;
398 struct ath6kl_vif *vif;
399 struct target_stats *tgt_stats;
401 unsigned int len = 0, buf_len = 1500;
406 vif = ath6kl_vif_first(ar);
410 tgt_stats = &vif->target_stats;
412 buf = kzalloc(buf_len, GFP_KERNEL);
416 if (down_interruptible(&ar->sem)) {
421 set_bit(STATS_UPDATE_PEND, &vif->flags);
423 if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) {
429 left = wait_event_interruptible_timeout(ar->event_wq,
430 !test_bit(STATS_UPDATE_PEND,
431 &vif->flags), WMI_TIMEOUT);
440 len += scnprintf(buf + len, buf_len - len, "\n");
441 len += scnprintf(buf + len, buf_len - len, "%25s\n",
443 len += scnprintf(buf + len, buf_len - len, "%25s\n\n",
444 "=================");
445 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
446 "Ucast packets", tgt_stats->tx_ucast_pkt);
447 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
448 "Bcast packets", tgt_stats->tx_bcast_pkt);
449 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
450 "Ucast byte", tgt_stats->tx_ucast_byte);
451 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
452 "Bcast byte", tgt_stats->tx_bcast_byte);
453 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
454 "Rts success cnt", tgt_stats->tx_rts_success_cnt);
455 for (i = 0; i < 4; i++)
456 len += scnprintf(buf + len, buf_len - len,
457 "%18s %d %10llu\n", "PER on ac",
458 i, tgt_stats->tx_pkt_per_ac[i]);
459 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
460 "Error", tgt_stats->tx_err);
461 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
462 "Fail count", tgt_stats->tx_fail_cnt);
463 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
464 "Retry count", tgt_stats->tx_retry_cnt);
465 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
466 "Multi retry cnt", tgt_stats->tx_mult_retry_cnt);
467 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
468 "Rts fail cnt", tgt_stats->tx_rts_fail_cnt);
469 len += scnprintf(buf + len, buf_len - len, "%25s %10llu\n\n",
470 "TKIP counter measure used",
471 tgt_stats->tkip_cnter_measures_invoked);
473 len += scnprintf(buf + len, buf_len - len, "%25s\n",
475 len += scnprintf(buf + len, buf_len - len, "%25s\n",
476 "=================");
478 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
479 "Ucast packets", tgt_stats->rx_ucast_pkt);
480 len += scnprintf(buf + len, buf_len - len, "%20s %10d\n",
481 "Ucast Rate", tgt_stats->rx_ucast_rate);
482 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
483 "Bcast packets", tgt_stats->rx_bcast_pkt);
484 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
485 "Ucast byte", tgt_stats->rx_ucast_byte);
486 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
487 "Bcast byte", tgt_stats->rx_bcast_byte);
488 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
489 "Fragmented pkt", tgt_stats->rx_frgment_pkt);
490 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
491 "Error", tgt_stats->rx_err);
492 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
493 "CRC Err", tgt_stats->rx_crc_err);
494 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
495 "Key chache miss", tgt_stats->rx_key_cache_miss);
496 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
497 "Decrypt Err", tgt_stats->rx_decrypt_err);
498 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
499 "Duplicate frame", tgt_stats->rx_dupl_frame);
500 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
501 "Tkip Mic failure", tgt_stats->tkip_local_mic_fail);
502 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
503 "TKIP format err", tgt_stats->tkip_fmt_err);
504 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
505 "CCMP format Err", tgt_stats->ccmp_fmt_err);
506 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n\n",
507 "CCMP Replay Err", tgt_stats->ccmp_replays);
509 len += scnprintf(buf + len, buf_len - len, "%25s\n",
510 "Misc Target stats");
511 len += scnprintf(buf + len, buf_len - len, "%25s\n",
512 "=================");
513 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
514 "Beacon Miss count", tgt_stats->cs_bmiss_cnt);
515 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
516 "Num Connects", tgt_stats->cs_connect_cnt);
517 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
518 "Num disconnects", tgt_stats->cs_discon_cnt);
519 len += scnprintf(buf + len, buf_len - len, "%20s %10d\n",
520 "Beacon avg rssi", tgt_stats->cs_ave_beacon_rssi);
525 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
531 static const struct file_operations fops_tgt_stats = {
532 .read = read_file_tgt_stats,
533 .open = ath6kl_debugfs_open,
534 .owner = THIS_MODULE,
535 .llseek = default_llseek,
538 #define print_credit_info(fmt_str, ep_list_field) \
539 (len += scnprintf(buf + len, buf_len - len, fmt_str, \
540 ep_list->ep_list_field))
541 #define CREDIT_INFO_DISPLAY_STRING_LEN 200
542 #define CREDIT_INFO_LEN 128
544 static ssize_t read_file_credit_dist_stats(struct file *file,
545 char __user *user_buf,
546 size_t count, loff_t *ppos)
548 struct ath6kl *ar = file->private_data;
549 struct htc_target *target = ar->htc_target;
550 struct htc_endpoint_credit_dist *ep_list;
552 unsigned int buf_len, len = 0;
555 buf_len = CREDIT_INFO_DISPLAY_STRING_LEN +
556 get_queue_depth(&target->cred_dist_list) * CREDIT_INFO_LEN;
557 buf = kzalloc(buf_len, GFP_KERNEL);
561 len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
562 "Total Avail Credits: ",
563 target->credit_info->total_avail_credits);
564 len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
566 target->credit_info->cur_free_credits);
568 len += scnprintf(buf + len, buf_len - len,
569 " Epid Flags Cred_norm Cred_min Credits Cred_assngd"
570 " Seek_cred Cred_sz Cred_per_msg Cred_to_dist"
573 list_for_each_entry(ep_list, &target->cred_dist_list, list) {
574 print_credit_info(" %2d", endpoint);
575 print_credit_info("%10x", dist_flags);
576 print_credit_info("%8d", cred_norm);
577 print_credit_info("%9d", cred_min);
578 print_credit_info("%9d", credits);
579 print_credit_info("%10d", cred_assngd);
580 print_credit_info("%13d", seek_cred);
581 print_credit_info("%12d", cred_sz);
582 print_credit_info("%9d", cred_per_msg);
583 print_credit_info("%14d", cred_to_dist);
584 len += scnprintf(buf + len, buf_len - len, "%12d\n",
585 get_queue_depth(&ep_list->htc_ep->txq));
591 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
596 static const struct file_operations fops_credit_dist_stats = {
597 .read = read_file_credit_dist_stats,
598 .open = ath6kl_debugfs_open,
599 .owner = THIS_MODULE,
600 .llseek = default_llseek,
603 static unsigned int print_endpoint_stat(struct htc_target *target, char *buf,
604 unsigned int buf_len, unsigned int len,
605 int offset, const char *name)
608 struct htc_endpoint_stats *ep_st;
611 len += scnprintf(buf + len, buf_len - len, "%s:", name);
612 for (i = 0; i < ENDPOINT_MAX; i++) {
613 ep_st = &target->endpoint[i].ep_st;
614 counter = ((u32 *) ep_st) + (offset / 4);
615 len += scnprintf(buf + len, buf_len - len, " %u", *counter);
617 len += scnprintf(buf + len, buf_len - len, "\n");
622 static ssize_t ath6kl_endpoint_stats_read(struct file *file,
623 char __user *user_buf,
624 size_t count, loff_t *ppos)
626 struct ath6kl *ar = file->private_data;
627 struct htc_target *target = ar->htc_target;
629 unsigned int buf_len, len = 0;
632 buf_len = sizeof(struct htc_endpoint_stats) / sizeof(u32) *
633 (25 + ENDPOINT_MAX * 11);
634 buf = kmalloc(buf_len, GFP_KERNEL);
638 #define EPSTAT(name) \
639 len = print_endpoint_stat(target, buf, buf_len, len, \
640 offsetof(struct htc_endpoint_stats, name), \
642 EPSTAT(cred_low_indicate);
644 EPSTAT(tx_pkt_bundled);
648 EPSTAT(cred_rpt_from_rx);
649 EPSTAT(cred_rpt_from_other);
650 EPSTAT(cred_rpt_ep0);
651 EPSTAT(cred_from_rx);
652 EPSTAT(cred_from_other);
653 EPSTAT(cred_from_ep0);
659 EPSTAT(rx_bundle_lkahd);
660 EPSTAT(rx_bundle_from_hdr);
661 EPSTAT(rx_alloc_thresh_hit);
662 EPSTAT(rxalloc_thresh_byte);
668 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
673 static ssize_t ath6kl_endpoint_stats_write(struct file *file,
674 const char __user *user_buf,
675 size_t count, loff_t *ppos)
677 struct ath6kl *ar = file->private_data;
678 struct htc_target *target = ar->htc_target;
681 struct htc_endpoint_stats *ep_st;
683 ret = kstrtou32_from_user(user_buf, count, 0, &val);
687 for (i = 0; i < ENDPOINT_MAX; i++) {
688 ep_st = &target->endpoint[i].ep_st;
689 memset(ep_st, 0, sizeof(*ep_st));
696 static const struct file_operations fops_endpoint_stats = {
697 .open = ath6kl_debugfs_open,
698 .read = ath6kl_endpoint_stats_read,
699 .write = ath6kl_endpoint_stats_write,
700 .owner = THIS_MODULE,
701 .llseek = default_llseek,
704 static unsigned long ath6kl_get_num_reg(void)
707 unsigned long n_reg = 0;
709 for (i = 0; i < ARRAY_SIZE(diag_reg); i++)
711 (diag_reg[i].reg_end - diag_reg[i].reg_start) / 4 + 1;
716 static bool ath6kl_dbg_is_diag_reg_valid(u32 reg_addr)
720 for (i = 0; i < ARRAY_SIZE(diag_reg); i++) {
721 if (reg_addr >= diag_reg[i].reg_start &&
722 reg_addr <= diag_reg[i].reg_end)
729 static ssize_t ath6kl_regread_read(struct file *file, char __user *user_buf,
730 size_t count, loff_t *ppos)
732 struct ath6kl *ar = file->private_data;
734 unsigned int len = 0;
736 if (ar->debug.dbgfs_diag_reg)
737 len += scnprintf(buf + len, sizeof(buf) - len, "0x%x\n",
738 ar->debug.dbgfs_diag_reg);
740 len += scnprintf(buf + len, sizeof(buf) - len,
741 "All diag registers\n");
743 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
746 static ssize_t ath6kl_regread_write(struct file *file,
747 const char __user *user_buf,
748 size_t count, loff_t *ppos)
750 struct ath6kl *ar = file->private_data;
753 unsigned long reg_addr;
755 len = min(count, sizeof(buf) - 1);
756 if (copy_from_user(buf, user_buf, len))
761 if (strict_strtoul(buf, 0, ®_addr))
764 if ((reg_addr % 4) != 0)
767 if (reg_addr && !ath6kl_dbg_is_diag_reg_valid(reg_addr))
770 ar->debug.dbgfs_diag_reg = reg_addr;
775 static const struct file_operations fops_diag_reg_read = {
776 .read = ath6kl_regread_read,
777 .write = ath6kl_regread_write,
778 .open = ath6kl_debugfs_open,
779 .owner = THIS_MODULE,
780 .llseek = default_llseek,
783 static int ath6kl_regdump_open(struct inode *inode, struct file *file)
785 struct ath6kl *ar = inode->i_private;
787 unsigned long int reg_len;
788 unsigned int len = 0, n_reg;
793 /* Dump all the registers if no register is specified */
794 if (!ar->debug.dbgfs_diag_reg)
795 n_reg = ath6kl_get_num_reg();
799 reg_len = n_reg * REG_OUTPUT_LEN_PER_LINE;
801 reg_len += REGTYPE_STR_LEN;
803 buf = vmalloc(reg_len);
808 addr = ar->debug.dbgfs_diag_reg;
810 status = ath6kl_diag_read32(ar,
811 TARG_VTOP(ar->target_type, addr),
816 len += scnprintf(buf + len, reg_len - len,
817 "0x%06x 0x%08x\n", addr, le32_to_cpu(reg_val));
821 for (i = 0; i < ARRAY_SIZE(diag_reg); i++) {
822 len += scnprintf(buf + len, reg_len - len,
823 "%s\n", diag_reg[i].reg_info);
824 for (addr = diag_reg[i].reg_start;
825 addr <= diag_reg[i].reg_end; addr += 4) {
826 status = ath6kl_diag_read32(ar,
827 TARG_VTOP(ar->target_type, addr),
832 len += scnprintf(buf + len, reg_len - len,
834 addr, le32_to_cpu(reg_val));
839 file->private_data = buf;
843 ath6kl_warn("Unable to read memory:%u\n", addr);
848 static ssize_t ath6kl_regdump_read(struct file *file, char __user *user_buf,
849 size_t count, loff_t *ppos)
851 u8 *buf = file->private_data;
852 return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
855 static int ath6kl_regdump_release(struct inode *inode, struct file *file)
857 vfree(file->private_data);
861 static const struct file_operations fops_reg_dump = {
862 .open = ath6kl_regdump_open,
863 .read = ath6kl_regdump_read,
864 .release = ath6kl_regdump_release,
865 .owner = THIS_MODULE,
866 .llseek = default_llseek,
869 static ssize_t ath6kl_lrssi_roam_write(struct file *file,
870 const char __user *user_buf,
871 size_t count, loff_t *ppos)
873 struct ath6kl *ar = file->private_data;
874 unsigned long lrssi_roam_threshold;
878 len = min(count, sizeof(buf) - 1);
879 if (copy_from_user(buf, user_buf, len))
883 if (strict_strtoul(buf, 0, &lrssi_roam_threshold))
886 ar->lrssi_roam_threshold = lrssi_roam_threshold;
888 ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold);
893 static ssize_t ath6kl_lrssi_roam_read(struct file *file,
894 char __user *user_buf,
895 size_t count, loff_t *ppos)
897 struct ath6kl *ar = file->private_data;
901 len = snprintf(buf, sizeof(buf), "%u\n", ar->lrssi_roam_threshold);
903 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
906 static const struct file_operations fops_lrssi_roam_threshold = {
907 .read = ath6kl_lrssi_roam_read,
908 .write = ath6kl_lrssi_roam_write,
909 .open = ath6kl_debugfs_open,
910 .owner = THIS_MODULE,
911 .llseek = default_llseek,
914 static ssize_t ath6kl_regwrite_read(struct file *file,
915 char __user *user_buf,
916 size_t count, loff_t *ppos)
918 struct ath6kl *ar = file->private_data;
920 unsigned int len = 0;
922 len = scnprintf(buf, sizeof(buf), "Addr: 0x%x Val: 0x%x\n",
923 ar->debug.diag_reg_addr_wr, ar->debug.diag_reg_val_wr);
925 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
928 static ssize_t ath6kl_regwrite_write(struct file *file,
929 const char __user *user_buf,
930 size_t count, loff_t *ppos)
932 struct ath6kl *ar = file->private_data;
935 unsigned int len = 0;
936 u32 reg_addr, reg_val;
938 len = min(count, sizeof(buf) - 1);
939 if (copy_from_user(buf, user_buf, len))
945 token = strsep(&sptr, "=");
949 if (kstrtou32(token, 0, ®_addr))
952 if (!ath6kl_dbg_is_diag_reg_valid(reg_addr))
955 if (kstrtou32(sptr, 0, ®_val))
958 ar->debug.diag_reg_addr_wr = reg_addr;
959 ar->debug.diag_reg_val_wr = reg_val;
961 if (ath6kl_diag_write32(ar, ar->debug.diag_reg_addr_wr,
962 cpu_to_le32(ar->debug.diag_reg_val_wr)))
968 static const struct file_operations fops_diag_reg_write = {
969 .read = ath6kl_regwrite_read,
970 .write = ath6kl_regwrite_write,
971 .open = ath6kl_debugfs_open,
972 .owner = THIS_MODULE,
973 .llseek = default_llseek,
976 int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf,
979 const struct wmi_target_roam_tbl *tbl;
982 if (len < sizeof(*tbl))
985 tbl = (const struct wmi_target_roam_tbl *) buf;
986 num_entries = le16_to_cpu(tbl->num_entries);
987 if (sizeof(*tbl) + num_entries * sizeof(struct wmi_bss_roam_info) >
991 if (ar->debug.roam_tbl == NULL ||
992 ar->debug.roam_tbl_len < (unsigned int) len) {
993 kfree(ar->debug.roam_tbl);
994 ar->debug.roam_tbl = kmalloc(len, GFP_ATOMIC);
995 if (ar->debug.roam_tbl == NULL)
999 memcpy(ar->debug.roam_tbl, buf, len);
1000 ar->debug.roam_tbl_len = len;
1002 if (test_bit(ROAM_TBL_PEND, &ar->flag)) {
1003 clear_bit(ROAM_TBL_PEND, &ar->flag);
1004 wake_up(&ar->event_wq);
1010 static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf,
1011 size_t count, loff_t *ppos)
1013 struct ath6kl *ar = file->private_data;
1016 struct wmi_target_roam_tbl *tbl;
1019 unsigned int len, buf_len;
1022 if (down_interruptible(&ar->sem))
1025 set_bit(ROAM_TBL_PEND, &ar->flag);
1027 ret = ath6kl_wmi_get_roam_tbl_cmd(ar->wmi);
1033 left = wait_event_interruptible_timeout(
1034 ar->event_wq, !test_bit(ROAM_TBL_PEND, &ar->flag), WMI_TIMEOUT);
1040 if (ar->debug.roam_tbl == NULL)
1043 tbl = (struct wmi_target_roam_tbl *) ar->debug.roam_tbl;
1044 num_entries = le16_to_cpu(tbl->num_entries);
1046 buf_len = 100 + num_entries * 100;
1047 buf = kzalloc(buf_len, GFP_KERNEL);
1051 len += scnprintf(buf + len, buf_len - len,
1053 "# roam_util bssid rssi rssidt last_rssi util bias\n",
1054 le16_to_cpu(tbl->roam_mode));
1056 for (i = 0; i < num_entries; i++) {
1057 struct wmi_bss_roam_info *info = &tbl->info[i];
1058 len += scnprintf(buf + len, buf_len - len,
1059 "%d %pM %d %d %d %d %d\n",
1060 a_sle32_to_cpu(info->roam_util), info->bssid,
1061 info->rssi, info->rssidt, info->last_rssi,
1062 info->util, info->bias);
1068 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
1074 static const struct file_operations fops_roam_table = {
1075 .read = ath6kl_roam_table_read,
1076 .open = ath6kl_debugfs_open,
1077 .owner = THIS_MODULE,
1078 .llseek = default_llseek,
1081 static ssize_t ath6kl_force_roam_write(struct file *file,
1082 const char __user *user_buf,
1083 size_t count, loff_t *ppos)
1085 struct ath6kl *ar = file->private_data;
1093 len = min(count, sizeof(buf) - 1);
1094 if (copy_from_user(buf, user_buf, len))
1098 if (sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
1099 &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
1102 for (i = 0; i < ETH_ALEN; i++)
1105 ret = ath6kl_wmi_force_roam_cmd(ar->wmi, bssid);
1112 static const struct file_operations fops_force_roam = {
1113 .write = ath6kl_force_roam_write,
1114 .open = ath6kl_debugfs_open,
1115 .owner = THIS_MODULE,
1116 .llseek = default_llseek,
1119 static ssize_t ath6kl_roam_mode_write(struct file *file,
1120 const char __user *user_buf,
1121 size_t count, loff_t *ppos)
1123 struct ath6kl *ar = file->private_data;
1127 enum wmi_roam_mode mode;
1129 len = min(count, sizeof(buf) - 1);
1130 if (copy_from_user(buf, user_buf, len))
1133 if (len > 0 && buf[len - 1] == '\n')
1134 buf[len - 1] = '\0';
1136 if (strcasecmp(buf, "default") == 0)
1137 mode = WMI_DEFAULT_ROAM_MODE;
1138 else if (strcasecmp(buf, "bssbias") == 0)
1139 mode = WMI_HOST_BIAS_ROAM_MODE;
1140 else if (strcasecmp(buf, "lock") == 0)
1141 mode = WMI_LOCK_BSS_MODE;
1145 ret = ath6kl_wmi_set_roam_mode_cmd(ar->wmi, mode);
1152 static const struct file_operations fops_roam_mode = {
1153 .write = ath6kl_roam_mode_write,
1154 .open = ath6kl_debugfs_open,
1155 .owner = THIS_MODULE,
1156 .llseek = default_llseek,
1159 void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive)
1161 ar->debug.keepalive = keepalive;
1164 static ssize_t ath6kl_keepalive_read(struct file *file, char __user *user_buf,
1165 size_t count, loff_t *ppos)
1167 struct ath6kl *ar = file->private_data;
1171 len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.keepalive);
1173 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1176 static ssize_t ath6kl_keepalive_write(struct file *file,
1177 const char __user *user_buf,
1178 size_t count, loff_t *ppos)
1180 struct ath6kl *ar = file->private_data;
1184 ret = kstrtou8_from_user(user_buf, count, 0, &val);
1188 ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, 0, val);
1195 static const struct file_operations fops_keepalive = {
1196 .open = ath6kl_debugfs_open,
1197 .read = ath6kl_keepalive_read,
1198 .write = ath6kl_keepalive_write,
1199 .owner = THIS_MODULE,
1200 .llseek = default_llseek,
1203 void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout)
1205 ar->debug.disc_timeout = timeout;
1208 static ssize_t ath6kl_disconnect_timeout_read(struct file *file,
1209 char __user *user_buf,
1210 size_t count, loff_t *ppos)
1212 struct ath6kl *ar = file->private_data;
1216 len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.disc_timeout);
1218 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1221 static ssize_t ath6kl_disconnect_timeout_write(struct file *file,
1222 const char __user *user_buf,
1223 size_t count, loff_t *ppos)
1225 struct ath6kl *ar = file->private_data;
1229 ret = kstrtou8_from_user(user_buf, count, 0, &val);
1233 ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, 0, val);
1240 static const struct file_operations fops_disconnect_timeout = {
1241 .open = ath6kl_debugfs_open,
1242 .read = ath6kl_disconnect_timeout_read,
1243 .write = ath6kl_disconnect_timeout_write,
1244 .owner = THIS_MODULE,
1245 .llseek = default_llseek,
1248 static ssize_t ath6kl_create_qos_write(struct file *file,
1249 const char __user *user_buf,
1250 size_t count, loff_t *ppos)
1253 struct ath6kl *ar = file->private_data;
1254 struct ath6kl_vif *vif;
1258 struct wmi_create_pstream_cmd pstream;
1262 vif = ath6kl_vif_first(ar);
1266 len = min(count, sizeof(buf) - 1);
1267 if (copy_from_user(buf, user_buf, len))
1272 token = strsep(&sptr, " ");
1275 if (kstrtou8(token, 0, &pstream.user_pri))
1278 token = strsep(&sptr, " ");
1281 if (kstrtou8(token, 0, &pstream.traffic_direc))
1284 token = strsep(&sptr, " ");
1287 if (kstrtou8(token, 0, &pstream.traffic_class))
1290 token = strsep(&sptr, " ");
1293 if (kstrtou8(token, 0, &pstream.traffic_type))
1296 token = strsep(&sptr, " ");
1299 if (kstrtou8(token, 0, &pstream.voice_psc_cap))
1302 token = strsep(&sptr, " ");
1305 if (kstrtou32(token, 0, &val32))
1307 pstream.min_service_int = cpu_to_le32(val32);
1309 token = strsep(&sptr, " ");
1312 if (kstrtou32(token, 0, &val32))
1314 pstream.max_service_int = cpu_to_le32(val32);
1316 token = strsep(&sptr, " ");
1319 if (kstrtou32(token, 0, &val32))
1321 pstream.inactivity_int = cpu_to_le32(val32);
1323 token = strsep(&sptr, " ");
1326 if (kstrtou32(token, 0, &val32))
1328 pstream.suspension_int = cpu_to_le32(val32);
1330 token = strsep(&sptr, " ");
1333 if (kstrtou32(token, 0, &val32))
1335 pstream.service_start_time = cpu_to_le32(val32);
1337 token = strsep(&sptr, " ");
1340 if (kstrtou8(token, 0, &pstream.tsid))
1343 token = strsep(&sptr, " ");
1346 if (kstrtou16(token, 0, &val16))
1348 pstream.nominal_msdu = cpu_to_le16(val16);
1350 token = strsep(&sptr, " ");
1353 if (kstrtou16(token, 0, &val16))
1355 pstream.max_msdu = cpu_to_le16(val16);
1357 token = strsep(&sptr, " ");
1360 if (kstrtou32(token, 0, &val32))
1362 pstream.min_data_rate = cpu_to_le32(val32);
1364 token = strsep(&sptr, " ");
1367 if (kstrtou32(token, 0, &val32))
1369 pstream.mean_data_rate = cpu_to_le32(val32);
1371 token = strsep(&sptr, " ");
1374 if (kstrtou32(token, 0, &val32))
1376 pstream.peak_data_rate = cpu_to_le32(val32);
1378 token = strsep(&sptr, " ");
1381 if (kstrtou32(token, 0, &val32))
1383 pstream.max_burst_size = cpu_to_le32(val32);
1385 token = strsep(&sptr, " ");
1388 if (kstrtou32(token, 0, &val32))
1390 pstream.delay_bound = cpu_to_le32(val32);
1392 token = strsep(&sptr, " ");
1395 if (kstrtou32(token, 0, &val32))
1397 pstream.min_phy_rate = cpu_to_le32(val32);
1399 token = strsep(&sptr, " ");
1402 if (kstrtou32(token, 0, &val32))
1404 pstream.sba = cpu_to_le32(val32);
1406 token = strsep(&sptr, " ");
1409 if (kstrtou32(token, 0, &val32))
1411 pstream.medium_time = cpu_to_le32(val32);
1413 ath6kl_wmi_create_pstream_cmd(ar->wmi, vif->fw_vif_idx, &pstream);
1418 static const struct file_operations fops_create_qos = {
1419 .write = ath6kl_create_qos_write,
1420 .open = ath6kl_debugfs_open,
1421 .owner = THIS_MODULE,
1422 .llseek = default_llseek,
1425 static ssize_t ath6kl_delete_qos_write(struct file *file,
1426 const char __user *user_buf,
1427 size_t count, loff_t *ppos)
1430 struct ath6kl *ar = file->private_data;
1431 struct ath6kl_vif *vif;
1438 vif = ath6kl_vif_first(ar);
1442 len = min(count, sizeof(buf) - 1);
1443 if (copy_from_user(buf, user_buf, len))
1448 token = strsep(&sptr, " ");
1451 if (kstrtou8(token, 0, &traffic_class))
1454 token = strsep(&sptr, " ");
1457 if (kstrtou8(token, 0, &tsid))
1460 ath6kl_wmi_delete_pstream_cmd(ar->wmi, vif->fw_vif_idx,
1461 traffic_class, tsid);
1466 static const struct file_operations fops_delete_qos = {
1467 .write = ath6kl_delete_qos_write,
1468 .open = ath6kl_debugfs_open,
1469 .owner = THIS_MODULE,
1470 .llseek = default_llseek,
1473 static ssize_t ath6kl_bgscan_int_write(struct file *file,
1474 const char __user *user_buf,
1475 size_t count, loff_t *ppos)
1477 struct ath6kl *ar = file->private_data;
1482 len = min(count, sizeof(buf) - 1);
1483 if (copy_from_user(buf, user_buf, len))
1487 if (kstrtou16(buf, 0, &bgscan_int))
1490 if (bgscan_int == 0)
1491 bgscan_int = 0xffff;
1493 ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, 0, bgscan_int, 0, 0, 0, 3,
1499 static const struct file_operations fops_bgscan_int = {
1500 .write = ath6kl_bgscan_int_write,
1501 .open = ath6kl_debugfs_open,
1502 .owner = THIS_MODULE,
1503 .llseek = default_llseek,
1506 static ssize_t ath6kl_listen_int_write(struct file *file,
1507 const char __user *user_buf,
1508 size_t count, loff_t *ppos)
1510 struct ath6kl *ar = file->private_data;
1511 u16 listen_int_t, listen_int_b;
1516 len = min(count, sizeof(buf) - 1);
1517 if (copy_from_user(buf, user_buf, len))
1523 token = strsep(&sptr, " ");
1527 if (kstrtou16(token, 0, &listen_int_t))
1530 if (kstrtou16(sptr, 0, &listen_int_b))
1533 if ((listen_int_t < 15) || (listen_int_t > 5000))
1536 if ((listen_int_b < 1) || (listen_int_b > 50))
1539 ar->listen_intvl_t = listen_int_t;
1540 ar->listen_intvl_b = listen_int_b;
1542 ath6kl_wmi_listeninterval_cmd(ar->wmi, 0, ar->listen_intvl_t,
1543 ar->listen_intvl_b);
1548 static ssize_t ath6kl_listen_int_read(struct file *file,
1549 char __user *user_buf,
1550 size_t count, loff_t *ppos)
1552 struct ath6kl *ar = file->private_data;
1556 len = snprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t,
1557 ar->listen_intvl_b);
1559 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1562 static const struct file_operations fops_listen_int = {
1563 .read = ath6kl_listen_int_read,
1564 .write = ath6kl_listen_int_write,
1565 .open = ath6kl_debugfs_open,
1566 .owner = THIS_MODULE,
1567 .llseek = default_llseek,
1570 static ssize_t ath6kl_power_params_write(struct file *file,
1571 const char __user *user_buf,
1572 size_t count, loff_t *ppos)
1574 struct ath6kl *ar = file->private_data;
1576 unsigned int len = 0;
1578 u16 idle_period, ps_poll_num, dtim,
1581 len = min(count, sizeof(buf) - 1);
1582 if (copy_from_user(buf, user_buf, len))
1587 token = strsep(&sptr, " ");
1590 if (kstrtou16(token, 0, &idle_period))
1593 token = strsep(&sptr, " ");
1596 if (kstrtou16(token, 0, &ps_poll_num))
1599 token = strsep(&sptr, " ");
1602 if (kstrtou16(token, 0, &dtim))
1605 token = strsep(&sptr, " ");
1608 if (kstrtou16(token, 0, &tx_wakeup))
1611 token = strsep(&sptr, " ");
1614 if (kstrtou16(token, 0, &num_tx))
1617 ath6kl_wmi_pmparams_cmd(ar->wmi, 0, idle_period, ps_poll_num,
1618 dtim, tx_wakeup, num_tx, 0);
1623 static const struct file_operations fops_power_params = {
1624 .write = ath6kl_power_params_write,
1625 .open = ath6kl_debugfs_open,
1626 .owner = THIS_MODULE,
1627 .llseek = default_llseek,
1630 int ath6kl_debug_init(struct ath6kl *ar)
1632 ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
1633 if (ar->debug.fwlog_buf.buf == NULL)
1636 ar->debug.fwlog_tmp = kmalloc(ATH6KL_FWLOG_SLOT_SIZE, GFP_KERNEL);
1637 if (ar->debug.fwlog_tmp == NULL) {
1638 vfree(ar->debug.fwlog_buf.buf);
1642 spin_lock_init(&ar->debug.fwlog_lock);
1645 * Actually we are lying here but don't know how to read the mask
1646 * value from the firmware.
1648 ar->debug.fwlog_mask = 0;
1650 ar->debugfs_phy = debugfs_create_dir("ath6kl",
1651 ar->wiphy->debugfsdir);
1652 if (!ar->debugfs_phy) {
1653 vfree(ar->debug.fwlog_buf.buf);
1654 kfree(ar->debug.fwlog_tmp);
1658 debugfs_create_file("tgt_stats", S_IRUSR, ar->debugfs_phy, ar,
1661 debugfs_create_file("credit_dist_stats", S_IRUSR, ar->debugfs_phy, ar,
1662 &fops_credit_dist_stats);
1664 debugfs_create_file("endpoint_stats", S_IRUSR | S_IWUSR,
1665 ar->debugfs_phy, ar, &fops_endpoint_stats);
1667 debugfs_create_file("fwlog", S_IRUSR, ar->debugfs_phy, ar,
1670 debugfs_create_file("fwlog_mask", S_IRUSR | S_IWUSR, ar->debugfs_phy,
1671 ar, &fops_fwlog_mask);
1673 debugfs_create_file("reg_addr", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar,
1674 &fops_diag_reg_read);
1676 debugfs_create_file("reg_dump", S_IRUSR, ar->debugfs_phy, ar,
1679 debugfs_create_file("lrssi_roam_threshold", S_IRUSR | S_IWUSR,
1680 ar->debugfs_phy, ar, &fops_lrssi_roam_threshold);
1682 debugfs_create_file("reg_write", S_IRUSR | S_IWUSR,
1683 ar->debugfs_phy, ar, &fops_diag_reg_write);
1685 debugfs_create_file("war_stats", S_IRUSR, ar->debugfs_phy, ar,
1688 debugfs_create_file("roam_table", S_IRUSR, ar->debugfs_phy, ar,
1691 debugfs_create_file("force_roam", S_IWUSR, ar->debugfs_phy, ar,
1694 debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar,
1697 debugfs_create_file("keepalive", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar,
1700 debugfs_create_file("disconnect_timeout", S_IRUSR | S_IWUSR,
1701 ar->debugfs_phy, ar, &fops_disconnect_timeout);
1703 debugfs_create_file("create_qos", S_IWUSR, ar->debugfs_phy, ar,
1706 debugfs_create_file("delete_qos", S_IWUSR, ar->debugfs_phy, ar,
1709 debugfs_create_file("bgscan_interval", S_IWUSR,
1710 ar->debugfs_phy, ar, &fops_bgscan_int);
1712 debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
1713 &fops_power_params);
1718 void ath6kl_debug_cleanup(struct ath6kl *ar)
1720 vfree(ar->debug.fwlog_buf.buf);
1721 kfree(ar->debug.fwlog_tmp);
1722 kfree(ar->debug.roam_tbl);