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>
22 #include <linux/export.h>
27 struct ath6kl_fwlog_slot {
31 /* max ATH6KL_FWLOG_PAYLOAD_SIZE bytes */
35 #define ATH6KL_FWLOG_SIZE 32768
36 #define ATH6KL_FWLOG_SLOT_SIZE (sizeof(struct ath6kl_fwlog_slot) + \
37 ATH6KL_FWLOG_PAYLOAD_SIZE)
38 #define ATH6KL_FWLOG_VALID_MASK 0x1ffff
40 int ath6kl_printk(const char *level, const char *fmt, ...)
51 rtn = printk("%sath6kl: %pV", level, &vaf);
58 #ifdef CONFIG_ATH6KL_DEBUG
60 void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...)
65 if (!(debug_mask & mask))
73 ath6kl_printk(KERN_DEBUG, "%pV", &vaf);
78 void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,
79 const char *msg, const char *prefix,
80 const void *buf, size_t len)
82 if (debug_mask & mask) {
84 ath6kl_dbg(mask, "%s\n", msg);
86 print_hex_dump_bytes(prefix, DUMP_PREFIX_OFFSET, buf, len);
90 #define REG_OUTPUT_LEN_PER_LINE 25
91 #define REGTYPE_STR_LEN 100
93 struct ath6kl_diag_reg_info {
99 static const struct ath6kl_diag_reg_info diag_reg[] = {
100 { 0x20000, 0x200fc, "General DMA and Rx registers" },
101 { 0x28000, 0x28900, "MAC PCU register & keycache" },
102 { 0x20800, 0x20a40, "QCU" },
103 { 0x21000, 0x212f0, "DCU" },
104 { 0x4000, 0x42e4, "RTC" },
105 { 0x540000, 0x540000 + (256 * 1024), "RAM" },
106 { 0x29800, 0x2B210, "Base Band" },
107 { 0x1C000, 0x1C748, "Analog" },
110 void ath6kl_dump_registers(struct ath6kl_device *dev,
111 struct ath6kl_irq_proc_registers *irq_proc_reg,
112 struct ath6kl_irq_enable_reg *irq_enable_reg)
115 ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n"));
117 if (irq_proc_reg != NULL) {
118 ath6kl_dbg(ATH6KL_DBG_IRQ,
119 "Host Int status: 0x%x\n",
120 irq_proc_reg->host_int_status);
121 ath6kl_dbg(ATH6KL_DBG_IRQ,
122 "CPU Int status: 0x%x\n",
123 irq_proc_reg->cpu_int_status);
124 ath6kl_dbg(ATH6KL_DBG_IRQ,
125 "Error Int status: 0x%x\n",
126 irq_proc_reg->error_int_status);
127 ath6kl_dbg(ATH6KL_DBG_IRQ,
128 "Counter Int status: 0x%x\n",
129 irq_proc_reg->counter_int_status);
130 ath6kl_dbg(ATH6KL_DBG_IRQ,
131 "Mbox Frame: 0x%x\n",
132 irq_proc_reg->mbox_frame);
133 ath6kl_dbg(ATH6KL_DBG_IRQ,
134 "Rx Lookahead Valid: 0x%x\n",
135 irq_proc_reg->rx_lkahd_valid);
136 ath6kl_dbg(ATH6KL_DBG_IRQ,
137 "Rx Lookahead 0: 0x%x\n",
138 irq_proc_reg->rx_lkahd[0]);
139 ath6kl_dbg(ATH6KL_DBG_IRQ,
140 "Rx Lookahead 1: 0x%x\n",
141 irq_proc_reg->rx_lkahd[1]);
143 if (dev->ar->mbox_info.gmbox_addr != 0) {
145 * If the target supports GMBOX hardware, dump some
148 ath6kl_dbg(ATH6KL_DBG_IRQ,
149 "GMBOX Host Int status 2: 0x%x\n",
150 irq_proc_reg->host_int_status2);
151 ath6kl_dbg(ATH6KL_DBG_IRQ,
152 "GMBOX RX Avail: 0x%x\n",
153 irq_proc_reg->gmbox_rx_avail);
154 ath6kl_dbg(ATH6KL_DBG_IRQ,
155 "GMBOX lookahead alias 0: 0x%x\n",
156 irq_proc_reg->rx_gmbox_lkahd_alias[0]);
157 ath6kl_dbg(ATH6KL_DBG_IRQ,
158 "GMBOX lookahead alias 1: 0x%x\n",
159 irq_proc_reg->rx_gmbox_lkahd_alias[1]);
164 if (irq_enable_reg != NULL) {
165 ath6kl_dbg(ATH6KL_DBG_IRQ,
166 "Int status Enable: 0x%x\n",
167 irq_enable_reg->int_status_en);
168 ath6kl_dbg(ATH6KL_DBG_IRQ, "Counter Int status Enable: 0x%x\n",
169 irq_enable_reg->cntr_int_status_en);
171 ath6kl_dbg(ATH6KL_DBG_IRQ, "<------------------------------->\n");
174 static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist)
176 ath6kl_dbg(ATH6KL_DBG_CREDIT,
177 "--- endpoint: %d svc_id: 0x%X ---\n",
178 ep_dist->endpoint, ep_dist->svc_id);
179 ath6kl_dbg(ATH6KL_DBG_CREDIT, " dist_flags : 0x%X\n",
180 ep_dist->dist_flags);
181 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_norm : %d\n",
183 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_min : %d\n",
185 ath6kl_dbg(ATH6KL_DBG_CREDIT, " credits : %d\n",
187 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_assngd : %d\n",
188 ep_dist->cred_assngd);
189 ath6kl_dbg(ATH6KL_DBG_CREDIT, " seek_cred : %d\n",
191 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_sz : %d\n",
193 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_per_msg : %d\n",
194 ep_dist->cred_per_msg);
195 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_to_dist : %d\n",
196 ep_dist->cred_to_dist);
197 ath6kl_dbg(ATH6KL_DBG_CREDIT, " txq_depth : %d\n",
198 get_queue_depth(&ep_dist->htc_ep->txq));
199 ath6kl_dbg(ATH6KL_DBG_CREDIT,
200 "----------------------------------\n");
203 /* FIXME: move to htc.c */
204 void dump_cred_dist_stats(struct htc_target *target)
206 struct htc_endpoint_credit_dist *ep_list;
208 list_for_each_entry(ep_list, &target->cred_dist_list, list)
209 dump_cred_dist(ep_list);
211 ath6kl_dbg(ATH6KL_DBG_CREDIT,
212 "credit distribution total %d free %d\n",
213 target->credit_info->total_avail_credits,
214 target->credit_info->cur_free_credits);
217 static int ath6kl_debugfs_open(struct inode *inode, struct file *file)
219 file->private_data = inode->i_private;
223 void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war)
226 case ATH6KL_WAR_INVALID_RATE:
227 ar->debug.war_stats.invalid_rate++;
232 static ssize_t read_file_war_stats(struct file *file, char __user *user_buf,
233 size_t count, loff_t *ppos)
235 struct ath6kl *ar = file->private_data;
237 unsigned int len = 0, buf_len = 1500;
240 buf = kzalloc(buf_len, GFP_KERNEL);
244 len += scnprintf(buf + len, buf_len - len, "\n");
245 len += scnprintf(buf + len, buf_len - len, "%25s\n",
247 len += scnprintf(buf + len, buf_len - len, "%25s\n\n",
248 "=================");
249 len += scnprintf(buf + len, buf_len - len, "%20s %10u\n",
250 "Invalid rates", ar->debug.war_stats.invalid_rate);
252 if (WARN_ON(len > buf_len))
255 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
261 static const struct file_operations fops_war_stats = {
262 .read = read_file_war_stats,
263 .open = ath6kl_debugfs_open,
264 .owner = THIS_MODULE,
265 .llseek = default_llseek,
268 static void ath6kl_debug_fwlog_add(struct ath6kl *ar, const void *buf,
271 struct circ_buf *fwlog = &ar->debug.fwlog_buf;
275 /* entries must all be equal size */
276 if (WARN_ON(buf_len != ATH6KL_FWLOG_SLOT_SIZE))
279 space = CIRC_SPACE(fwlog->head, fwlog->tail, ATH6KL_FWLOG_SIZE);
281 /* discard oldest slot */
282 fwlog->tail = (fwlog->tail + ATH6KL_FWLOG_SLOT_SIZE) &
283 (ATH6KL_FWLOG_SIZE - 1);
285 for (i = 0; i < buf_len; i += space) {
286 space = CIRC_SPACE_TO_END(fwlog->head, fwlog->tail,
289 if ((size_t) space > buf_len - i)
292 memcpy(&fwlog->buf[fwlog->head], buf, space);
293 fwlog->head = (fwlog->head + space) & (ATH6KL_FWLOG_SIZE - 1);
298 void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len)
300 struct ath6kl_fwlog_slot *slot = ar->debug.fwlog_tmp;
303 if (WARN_ON(len > ATH6KL_FWLOG_PAYLOAD_SIZE))
306 spin_lock_bh(&ar->debug.fwlog_lock);
308 slot->timestamp = cpu_to_le32(jiffies);
309 slot->length = cpu_to_le32(len);
310 memcpy(slot->payload, buf, len);
312 slot_len = sizeof(*slot) + len;
314 if (slot_len < ATH6KL_FWLOG_SLOT_SIZE)
315 memset(slot->payload + len, 0,
316 ATH6KL_FWLOG_SLOT_SIZE - slot_len);
318 ath6kl_debug_fwlog_add(ar, slot, ATH6KL_FWLOG_SLOT_SIZE);
320 spin_unlock_bh(&ar->debug.fwlog_lock);
323 static bool ath6kl_debug_fwlog_empty(struct ath6kl *ar)
325 return CIRC_CNT(ar->debug.fwlog_buf.head,
326 ar->debug.fwlog_buf.tail,
327 ATH6KL_FWLOG_SLOT_SIZE) == 0;
330 static ssize_t ath6kl_fwlog_read(struct file *file, char __user *user_buf,
331 size_t count, loff_t *ppos)
333 struct ath6kl *ar = file->private_data;
334 struct circ_buf *fwlog = &ar->debug.fwlog_buf;
335 size_t len = 0, buf_len = count;
340 buf = vmalloc(buf_len);
344 /* read undelivered logs from firmware */
345 ath6kl_read_fwlogs(ar);
347 spin_lock_bh(&ar->debug.fwlog_lock);
349 while (len < buf_len && !ath6kl_debug_fwlog_empty(ar)) {
350 ccnt = CIRC_CNT_TO_END(fwlog->head, fwlog->tail,
353 if ((size_t) ccnt > buf_len - len)
354 ccnt = buf_len - len;
356 memcpy(buf + len, &fwlog->buf[fwlog->tail], ccnt);
359 fwlog->tail = (fwlog->tail + ccnt) &
360 (ATH6KL_FWLOG_SIZE - 1);
363 spin_unlock_bh(&ar->debug.fwlog_lock);
365 if (WARN_ON(len > buf_len))
368 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
375 static const struct file_operations fops_fwlog = {
376 .open = ath6kl_debugfs_open,
377 .read = ath6kl_fwlog_read,
378 .owner = THIS_MODULE,
379 .llseek = default_llseek,
382 static ssize_t ath6kl_fwlog_mask_read(struct file *file, char __user *user_buf,
383 size_t count, loff_t *ppos)
385 struct ath6kl *ar = file->private_data;
389 len = snprintf(buf, sizeof(buf), "0x%x\n", ar->debug.fwlog_mask);
391 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
394 static ssize_t ath6kl_fwlog_mask_write(struct file *file,
395 const char __user *user_buf,
396 size_t count, loff_t *ppos)
398 struct ath6kl *ar = file->private_data;
401 ret = kstrtou32_from_user(user_buf, count, 0, &ar->debug.fwlog_mask);
405 ret = ath6kl_wmi_config_debug_module_cmd(ar->wmi,
406 ATH6KL_FWLOG_VALID_MASK,
407 ar->debug.fwlog_mask);
414 static const struct file_operations fops_fwlog_mask = {
415 .open = ath6kl_debugfs_open,
416 .read = ath6kl_fwlog_mask_read,
417 .write = ath6kl_fwlog_mask_write,
418 .owner = THIS_MODULE,
419 .llseek = default_llseek,
422 static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
423 size_t count, loff_t *ppos)
425 struct ath6kl *ar = file->private_data;
426 struct ath6kl_vif *vif;
427 struct target_stats *tgt_stats;
429 unsigned int len = 0, buf_len = 1500;
434 vif = ath6kl_vif_first(ar);
438 tgt_stats = &vif->target_stats;
440 buf = kzalloc(buf_len, GFP_KERNEL);
444 if (down_interruptible(&ar->sem)) {
449 set_bit(STATS_UPDATE_PEND, &vif->flags);
451 if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) {
457 left = wait_event_interruptible_timeout(ar->event_wq,
458 !test_bit(STATS_UPDATE_PEND,
459 &vif->flags), WMI_TIMEOUT);
468 len += scnprintf(buf + len, buf_len - len, "\n");
469 len += scnprintf(buf + len, buf_len - len, "%25s\n",
471 len += scnprintf(buf + len, buf_len - len, "%25s\n\n",
472 "=================");
473 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
474 "Ucast packets", tgt_stats->tx_ucast_pkt);
475 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
476 "Bcast packets", tgt_stats->tx_bcast_pkt);
477 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
478 "Ucast byte", tgt_stats->tx_ucast_byte);
479 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
480 "Bcast byte", tgt_stats->tx_bcast_byte);
481 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
482 "Rts success cnt", tgt_stats->tx_rts_success_cnt);
483 for (i = 0; i < 4; i++)
484 len += scnprintf(buf + len, buf_len - len,
485 "%18s %d %10llu\n", "PER on ac",
486 i, tgt_stats->tx_pkt_per_ac[i]);
487 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
488 "Error", tgt_stats->tx_err);
489 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
490 "Fail count", tgt_stats->tx_fail_cnt);
491 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
492 "Retry count", tgt_stats->tx_retry_cnt);
493 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
494 "Multi retry cnt", tgt_stats->tx_mult_retry_cnt);
495 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
496 "Rts fail cnt", tgt_stats->tx_rts_fail_cnt);
497 len += scnprintf(buf + len, buf_len - len, "%25s %10llu\n\n",
498 "TKIP counter measure used",
499 tgt_stats->tkip_cnter_measures_invoked);
501 len += scnprintf(buf + len, buf_len - len, "%25s\n",
503 len += scnprintf(buf + len, buf_len - len, "%25s\n",
504 "=================");
506 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
507 "Ucast packets", tgt_stats->rx_ucast_pkt);
508 len += scnprintf(buf + len, buf_len - len, "%20s %10d\n",
509 "Ucast Rate", tgt_stats->rx_ucast_rate);
510 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
511 "Bcast packets", tgt_stats->rx_bcast_pkt);
512 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
513 "Ucast byte", tgt_stats->rx_ucast_byte);
514 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
515 "Bcast byte", tgt_stats->rx_bcast_byte);
516 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
517 "Fragmented pkt", tgt_stats->rx_frgment_pkt);
518 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
519 "Error", tgt_stats->rx_err);
520 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
521 "CRC Err", tgt_stats->rx_crc_err);
522 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
523 "Key chache miss", tgt_stats->rx_key_cache_miss);
524 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
525 "Decrypt Err", tgt_stats->rx_decrypt_err);
526 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
527 "Duplicate frame", tgt_stats->rx_dupl_frame);
528 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
529 "Tkip Mic failure", tgt_stats->tkip_local_mic_fail);
530 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
531 "TKIP format err", tgt_stats->tkip_fmt_err);
532 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
533 "CCMP format Err", tgt_stats->ccmp_fmt_err);
534 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n\n",
535 "CCMP Replay Err", tgt_stats->ccmp_replays);
537 len += scnprintf(buf + len, buf_len - len, "%25s\n",
538 "Misc Target stats");
539 len += scnprintf(buf + len, buf_len - len, "%25s\n",
540 "=================");
541 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
542 "Beacon Miss count", tgt_stats->cs_bmiss_cnt);
543 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
544 "Num Connects", tgt_stats->cs_connect_cnt);
545 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
546 "Num disconnects", tgt_stats->cs_discon_cnt);
547 len += scnprintf(buf + len, buf_len - len, "%20s %10d\n",
548 "Beacon avg rssi", tgt_stats->cs_ave_beacon_rssi);
553 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
559 static const struct file_operations fops_tgt_stats = {
560 .read = read_file_tgt_stats,
561 .open = ath6kl_debugfs_open,
562 .owner = THIS_MODULE,
563 .llseek = default_llseek,
566 #define print_credit_info(fmt_str, ep_list_field) \
567 (len += scnprintf(buf + len, buf_len - len, fmt_str, \
568 ep_list->ep_list_field))
569 #define CREDIT_INFO_DISPLAY_STRING_LEN 200
570 #define CREDIT_INFO_LEN 128
572 static ssize_t read_file_credit_dist_stats(struct file *file,
573 char __user *user_buf,
574 size_t count, loff_t *ppos)
576 struct ath6kl *ar = file->private_data;
577 struct htc_target *target = ar->htc_target;
578 struct htc_endpoint_credit_dist *ep_list;
580 unsigned int buf_len, len = 0;
583 buf_len = CREDIT_INFO_DISPLAY_STRING_LEN +
584 get_queue_depth(&target->cred_dist_list) * CREDIT_INFO_LEN;
585 buf = kzalloc(buf_len, GFP_KERNEL);
589 len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
590 "Total Avail Credits: ",
591 target->credit_info->total_avail_credits);
592 len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
594 target->credit_info->cur_free_credits);
596 len += scnprintf(buf + len, buf_len - len,
597 " Epid Flags Cred_norm Cred_min Credits Cred_assngd"
598 " Seek_cred Cred_sz Cred_per_msg Cred_to_dist"
601 list_for_each_entry(ep_list, &target->cred_dist_list, list) {
602 print_credit_info(" %2d", endpoint);
603 print_credit_info("%10x", dist_flags);
604 print_credit_info("%8d", cred_norm);
605 print_credit_info("%9d", cred_min);
606 print_credit_info("%9d", credits);
607 print_credit_info("%10d", cred_assngd);
608 print_credit_info("%13d", seek_cred);
609 print_credit_info("%12d", cred_sz);
610 print_credit_info("%9d", cred_per_msg);
611 print_credit_info("%14d", cred_to_dist);
612 len += scnprintf(buf + len, buf_len - len, "%12d\n",
613 get_queue_depth(&ep_list->htc_ep->txq));
619 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
624 static const struct file_operations fops_credit_dist_stats = {
625 .read = read_file_credit_dist_stats,
626 .open = ath6kl_debugfs_open,
627 .owner = THIS_MODULE,
628 .llseek = default_llseek,
631 static unsigned int print_endpoint_stat(struct htc_target *target, char *buf,
632 unsigned int buf_len, unsigned int len,
633 int offset, const char *name)
636 struct htc_endpoint_stats *ep_st;
639 len += scnprintf(buf + len, buf_len - len, "%s:", name);
640 for (i = 0; i < ENDPOINT_MAX; i++) {
641 ep_st = &target->endpoint[i].ep_st;
642 counter = ((u32 *) ep_st) + (offset / 4);
643 len += scnprintf(buf + len, buf_len - len, " %u", *counter);
645 len += scnprintf(buf + len, buf_len - len, "\n");
650 static ssize_t ath6kl_endpoint_stats_read(struct file *file,
651 char __user *user_buf,
652 size_t count, loff_t *ppos)
654 struct ath6kl *ar = file->private_data;
655 struct htc_target *target = ar->htc_target;
657 unsigned int buf_len, len = 0;
660 buf_len = sizeof(struct htc_endpoint_stats) / sizeof(u32) *
661 (25 + ENDPOINT_MAX * 11);
662 buf = kmalloc(buf_len, GFP_KERNEL);
666 #define EPSTAT(name) \
667 len = print_endpoint_stat(target, buf, buf_len, len, \
668 offsetof(struct htc_endpoint_stats, name), \
670 EPSTAT(cred_low_indicate);
672 EPSTAT(tx_pkt_bundled);
676 EPSTAT(cred_rpt_from_rx);
677 EPSTAT(cred_rpt_from_other);
678 EPSTAT(cred_rpt_ep0);
679 EPSTAT(cred_from_rx);
680 EPSTAT(cred_from_other);
681 EPSTAT(cred_from_ep0);
687 EPSTAT(rx_bundle_lkahd);
688 EPSTAT(rx_bundle_from_hdr);
689 EPSTAT(rx_alloc_thresh_hit);
690 EPSTAT(rxalloc_thresh_byte);
696 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
701 static ssize_t ath6kl_endpoint_stats_write(struct file *file,
702 const char __user *user_buf,
703 size_t count, loff_t *ppos)
705 struct ath6kl *ar = file->private_data;
706 struct htc_target *target = ar->htc_target;
709 struct htc_endpoint_stats *ep_st;
711 ret = kstrtou32_from_user(user_buf, count, 0, &val);
715 for (i = 0; i < ENDPOINT_MAX; i++) {
716 ep_st = &target->endpoint[i].ep_st;
717 memset(ep_st, 0, sizeof(*ep_st));
724 static const struct file_operations fops_endpoint_stats = {
725 .open = ath6kl_debugfs_open,
726 .read = ath6kl_endpoint_stats_read,
727 .write = ath6kl_endpoint_stats_write,
728 .owner = THIS_MODULE,
729 .llseek = default_llseek,
732 static unsigned long ath6kl_get_num_reg(void)
735 unsigned long n_reg = 0;
737 for (i = 0; i < ARRAY_SIZE(diag_reg); i++)
739 (diag_reg[i].reg_end - diag_reg[i].reg_start) / 4 + 1;
744 static bool ath6kl_dbg_is_diag_reg_valid(u32 reg_addr)
748 for (i = 0; i < ARRAY_SIZE(diag_reg); i++) {
749 if (reg_addr >= diag_reg[i].reg_start &&
750 reg_addr <= diag_reg[i].reg_end)
757 static ssize_t ath6kl_regread_read(struct file *file, char __user *user_buf,
758 size_t count, loff_t *ppos)
760 struct ath6kl *ar = file->private_data;
762 unsigned int len = 0;
764 if (ar->debug.dbgfs_diag_reg)
765 len += scnprintf(buf + len, sizeof(buf) - len, "0x%x\n",
766 ar->debug.dbgfs_diag_reg);
768 len += scnprintf(buf + len, sizeof(buf) - len,
769 "All diag registers\n");
771 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
774 static ssize_t ath6kl_regread_write(struct file *file,
775 const char __user *user_buf,
776 size_t count, loff_t *ppos)
778 struct ath6kl *ar = file->private_data;
781 unsigned long reg_addr;
783 len = min(count, sizeof(buf) - 1);
784 if (copy_from_user(buf, user_buf, len))
789 if (strict_strtoul(buf, 0, ®_addr))
792 if ((reg_addr % 4) != 0)
795 if (reg_addr && !ath6kl_dbg_is_diag_reg_valid(reg_addr))
798 ar->debug.dbgfs_diag_reg = reg_addr;
803 static const struct file_operations fops_diag_reg_read = {
804 .read = ath6kl_regread_read,
805 .write = ath6kl_regread_write,
806 .open = ath6kl_debugfs_open,
807 .owner = THIS_MODULE,
808 .llseek = default_llseek,
811 static int ath6kl_regdump_open(struct inode *inode, struct file *file)
813 struct ath6kl *ar = inode->i_private;
815 unsigned long int reg_len;
816 unsigned int len = 0, n_reg;
821 /* Dump all the registers if no register is specified */
822 if (!ar->debug.dbgfs_diag_reg)
823 n_reg = ath6kl_get_num_reg();
827 reg_len = n_reg * REG_OUTPUT_LEN_PER_LINE;
829 reg_len += REGTYPE_STR_LEN;
831 buf = vmalloc(reg_len);
836 addr = ar->debug.dbgfs_diag_reg;
838 status = ath6kl_diag_read32(ar,
839 TARG_VTOP(ar->target_type, addr),
844 len += scnprintf(buf + len, reg_len - len,
845 "0x%06x 0x%08x\n", addr, le32_to_cpu(reg_val));
849 for (i = 0; i < ARRAY_SIZE(diag_reg); i++) {
850 len += scnprintf(buf + len, reg_len - len,
851 "%s\n", diag_reg[i].reg_info);
852 for (addr = diag_reg[i].reg_start;
853 addr <= diag_reg[i].reg_end; addr += 4) {
854 status = ath6kl_diag_read32(ar,
855 TARG_VTOP(ar->target_type, addr),
860 len += scnprintf(buf + len, reg_len - len,
862 addr, le32_to_cpu(reg_val));
867 file->private_data = buf;
871 ath6kl_warn("Unable to read memory:%u\n", addr);
876 static ssize_t ath6kl_regdump_read(struct file *file, char __user *user_buf,
877 size_t count, loff_t *ppos)
879 u8 *buf = file->private_data;
880 return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
883 static int ath6kl_regdump_release(struct inode *inode, struct file *file)
885 vfree(file->private_data);
889 static const struct file_operations fops_reg_dump = {
890 .open = ath6kl_regdump_open,
891 .read = ath6kl_regdump_read,
892 .release = ath6kl_regdump_release,
893 .owner = THIS_MODULE,
894 .llseek = default_llseek,
897 static ssize_t ath6kl_lrssi_roam_write(struct file *file,
898 const char __user *user_buf,
899 size_t count, loff_t *ppos)
901 struct ath6kl *ar = file->private_data;
902 unsigned long lrssi_roam_threshold;
906 len = min(count, sizeof(buf) - 1);
907 if (copy_from_user(buf, user_buf, len))
911 if (strict_strtoul(buf, 0, &lrssi_roam_threshold))
914 ar->lrssi_roam_threshold = lrssi_roam_threshold;
916 ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold);
921 static ssize_t ath6kl_lrssi_roam_read(struct file *file,
922 char __user *user_buf,
923 size_t count, loff_t *ppos)
925 struct ath6kl *ar = file->private_data;
929 len = snprintf(buf, sizeof(buf), "%u\n", ar->lrssi_roam_threshold);
931 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
934 static const struct file_operations fops_lrssi_roam_threshold = {
935 .read = ath6kl_lrssi_roam_read,
936 .write = ath6kl_lrssi_roam_write,
937 .open = ath6kl_debugfs_open,
938 .owner = THIS_MODULE,
939 .llseek = default_llseek,
942 static ssize_t ath6kl_regwrite_read(struct file *file,
943 char __user *user_buf,
944 size_t count, loff_t *ppos)
946 struct ath6kl *ar = file->private_data;
948 unsigned int len = 0;
950 len = scnprintf(buf, sizeof(buf), "Addr: 0x%x Val: 0x%x\n",
951 ar->debug.diag_reg_addr_wr, ar->debug.diag_reg_val_wr);
953 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
956 static ssize_t ath6kl_regwrite_write(struct file *file,
957 const char __user *user_buf,
958 size_t count, loff_t *ppos)
960 struct ath6kl *ar = file->private_data;
963 unsigned int len = 0;
964 u32 reg_addr, reg_val;
966 len = min(count, sizeof(buf) - 1);
967 if (copy_from_user(buf, user_buf, len))
973 token = strsep(&sptr, "=");
977 if (kstrtou32(token, 0, ®_addr))
980 if (!ath6kl_dbg_is_diag_reg_valid(reg_addr))
983 if (kstrtou32(sptr, 0, ®_val))
986 ar->debug.diag_reg_addr_wr = reg_addr;
987 ar->debug.diag_reg_val_wr = reg_val;
989 if (ath6kl_diag_write32(ar, ar->debug.diag_reg_addr_wr,
990 cpu_to_le32(ar->debug.diag_reg_val_wr)))
996 static const struct file_operations fops_diag_reg_write = {
997 .read = ath6kl_regwrite_read,
998 .write = ath6kl_regwrite_write,
999 .open = ath6kl_debugfs_open,
1000 .owner = THIS_MODULE,
1001 .llseek = default_llseek,
1004 int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf,
1007 const struct wmi_target_roam_tbl *tbl;
1010 if (len < sizeof(*tbl))
1013 tbl = (const struct wmi_target_roam_tbl *) buf;
1014 num_entries = le16_to_cpu(tbl->num_entries);
1015 if (sizeof(*tbl) + num_entries * sizeof(struct wmi_bss_roam_info) >
1019 if (ar->debug.roam_tbl == NULL ||
1020 ar->debug.roam_tbl_len < (unsigned int) len) {
1021 kfree(ar->debug.roam_tbl);
1022 ar->debug.roam_tbl = kmalloc(len, GFP_ATOMIC);
1023 if (ar->debug.roam_tbl == NULL)
1027 memcpy(ar->debug.roam_tbl, buf, len);
1028 ar->debug.roam_tbl_len = len;
1030 if (test_bit(ROAM_TBL_PEND, &ar->flag)) {
1031 clear_bit(ROAM_TBL_PEND, &ar->flag);
1032 wake_up(&ar->event_wq);
1038 static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf,
1039 size_t count, loff_t *ppos)
1041 struct ath6kl *ar = file->private_data;
1044 struct wmi_target_roam_tbl *tbl;
1047 unsigned int len, buf_len;
1050 if (down_interruptible(&ar->sem))
1053 set_bit(ROAM_TBL_PEND, &ar->flag);
1055 ret = ath6kl_wmi_get_roam_tbl_cmd(ar->wmi);
1061 left = wait_event_interruptible_timeout(
1062 ar->event_wq, !test_bit(ROAM_TBL_PEND, &ar->flag), WMI_TIMEOUT);
1068 if (ar->debug.roam_tbl == NULL)
1071 tbl = (struct wmi_target_roam_tbl *) ar->debug.roam_tbl;
1072 num_entries = le16_to_cpu(tbl->num_entries);
1074 buf_len = 100 + num_entries * 100;
1075 buf = kzalloc(buf_len, GFP_KERNEL);
1079 len += scnprintf(buf + len, buf_len - len,
1081 "# roam_util bssid rssi rssidt last_rssi util bias\n",
1082 le16_to_cpu(tbl->roam_mode));
1084 for (i = 0; i < num_entries; i++) {
1085 struct wmi_bss_roam_info *info = &tbl->info[i];
1086 len += scnprintf(buf + len, buf_len - len,
1087 "%d %pM %d %d %d %d %d\n",
1088 a_sle32_to_cpu(info->roam_util), info->bssid,
1089 info->rssi, info->rssidt, info->last_rssi,
1090 info->util, info->bias);
1096 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
1102 static const struct file_operations fops_roam_table = {
1103 .read = ath6kl_roam_table_read,
1104 .open = ath6kl_debugfs_open,
1105 .owner = THIS_MODULE,
1106 .llseek = default_llseek,
1109 static ssize_t ath6kl_force_roam_write(struct file *file,
1110 const char __user *user_buf,
1111 size_t count, loff_t *ppos)
1113 struct ath6kl *ar = file->private_data;
1121 len = min(count, sizeof(buf) - 1);
1122 if (copy_from_user(buf, user_buf, len))
1126 if (sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
1127 &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
1130 for (i = 0; i < ETH_ALEN; i++)
1133 ret = ath6kl_wmi_force_roam_cmd(ar->wmi, bssid);
1140 static const struct file_operations fops_force_roam = {
1141 .write = ath6kl_force_roam_write,
1142 .open = ath6kl_debugfs_open,
1143 .owner = THIS_MODULE,
1144 .llseek = default_llseek,
1147 static ssize_t ath6kl_roam_mode_write(struct file *file,
1148 const char __user *user_buf,
1149 size_t count, loff_t *ppos)
1151 struct ath6kl *ar = file->private_data;
1155 enum wmi_roam_mode mode;
1157 len = min(count, sizeof(buf) - 1);
1158 if (copy_from_user(buf, user_buf, len))
1161 if (len > 0 && buf[len - 1] == '\n')
1162 buf[len - 1] = '\0';
1164 if (strcasecmp(buf, "default") == 0)
1165 mode = WMI_DEFAULT_ROAM_MODE;
1166 else if (strcasecmp(buf, "bssbias") == 0)
1167 mode = WMI_HOST_BIAS_ROAM_MODE;
1168 else if (strcasecmp(buf, "lock") == 0)
1169 mode = WMI_LOCK_BSS_MODE;
1173 ret = ath6kl_wmi_set_roam_mode_cmd(ar->wmi, mode);
1180 static const struct file_operations fops_roam_mode = {
1181 .write = ath6kl_roam_mode_write,
1182 .open = ath6kl_debugfs_open,
1183 .owner = THIS_MODULE,
1184 .llseek = default_llseek,
1187 void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive)
1189 ar->debug.keepalive = keepalive;
1192 static ssize_t ath6kl_keepalive_read(struct file *file, char __user *user_buf,
1193 size_t count, loff_t *ppos)
1195 struct ath6kl *ar = file->private_data;
1199 len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.keepalive);
1201 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1204 static ssize_t ath6kl_keepalive_write(struct file *file,
1205 const char __user *user_buf,
1206 size_t count, loff_t *ppos)
1208 struct ath6kl *ar = file->private_data;
1212 ret = kstrtou8_from_user(user_buf, count, 0, &val);
1216 ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, 0, val);
1223 static const struct file_operations fops_keepalive = {
1224 .open = ath6kl_debugfs_open,
1225 .read = ath6kl_keepalive_read,
1226 .write = ath6kl_keepalive_write,
1227 .owner = THIS_MODULE,
1228 .llseek = default_llseek,
1231 void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout)
1233 ar->debug.disc_timeout = timeout;
1236 static ssize_t ath6kl_disconnect_timeout_read(struct file *file,
1237 char __user *user_buf,
1238 size_t count, loff_t *ppos)
1240 struct ath6kl *ar = file->private_data;
1244 len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.disc_timeout);
1246 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1249 static ssize_t ath6kl_disconnect_timeout_write(struct file *file,
1250 const char __user *user_buf,
1251 size_t count, loff_t *ppos)
1253 struct ath6kl *ar = file->private_data;
1257 ret = kstrtou8_from_user(user_buf, count, 0, &val);
1261 ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, 0, val);
1268 static const struct file_operations fops_disconnect_timeout = {
1269 .open = ath6kl_debugfs_open,
1270 .read = ath6kl_disconnect_timeout_read,
1271 .write = ath6kl_disconnect_timeout_write,
1272 .owner = THIS_MODULE,
1273 .llseek = default_llseek,
1276 static ssize_t ath6kl_create_qos_write(struct file *file,
1277 const char __user *user_buf,
1278 size_t count, loff_t *ppos)
1281 struct ath6kl *ar = file->private_data;
1282 struct ath6kl_vif *vif;
1286 struct wmi_create_pstream_cmd pstream;
1290 vif = ath6kl_vif_first(ar);
1294 len = min(count, sizeof(buf) - 1);
1295 if (copy_from_user(buf, user_buf, len))
1300 token = strsep(&sptr, " ");
1303 if (kstrtou8(token, 0, &pstream.user_pri))
1306 token = strsep(&sptr, " ");
1309 if (kstrtou8(token, 0, &pstream.traffic_direc))
1312 token = strsep(&sptr, " ");
1315 if (kstrtou8(token, 0, &pstream.traffic_class))
1318 token = strsep(&sptr, " ");
1321 if (kstrtou8(token, 0, &pstream.traffic_type))
1324 token = strsep(&sptr, " ");
1327 if (kstrtou8(token, 0, &pstream.voice_psc_cap))
1330 token = strsep(&sptr, " ");
1333 if (kstrtou32(token, 0, &val32))
1335 pstream.min_service_int = cpu_to_le32(val32);
1337 token = strsep(&sptr, " ");
1340 if (kstrtou32(token, 0, &val32))
1342 pstream.max_service_int = cpu_to_le32(val32);
1344 token = strsep(&sptr, " ");
1347 if (kstrtou32(token, 0, &val32))
1349 pstream.inactivity_int = cpu_to_le32(val32);
1351 token = strsep(&sptr, " ");
1354 if (kstrtou32(token, 0, &val32))
1356 pstream.suspension_int = cpu_to_le32(val32);
1358 token = strsep(&sptr, " ");
1361 if (kstrtou32(token, 0, &val32))
1363 pstream.service_start_time = cpu_to_le32(val32);
1365 token = strsep(&sptr, " ");
1368 if (kstrtou8(token, 0, &pstream.tsid))
1371 token = strsep(&sptr, " ");
1374 if (kstrtou16(token, 0, &val16))
1376 pstream.nominal_msdu = cpu_to_le16(val16);
1378 token = strsep(&sptr, " ");
1381 if (kstrtou16(token, 0, &val16))
1383 pstream.max_msdu = cpu_to_le16(val16);
1385 token = strsep(&sptr, " ");
1388 if (kstrtou32(token, 0, &val32))
1390 pstream.min_data_rate = cpu_to_le32(val32);
1392 token = strsep(&sptr, " ");
1395 if (kstrtou32(token, 0, &val32))
1397 pstream.mean_data_rate = cpu_to_le32(val32);
1399 token = strsep(&sptr, " ");
1402 if (kstrtou32(token, 0, &val32))
1404 pstream.peak_data_rate = cpu_to_le32(val32);
1406 token = strsep(&sptr, " ");
1409 if (kstrtou32(token, 0, &val32))
1411 pstream.max_burst_size = cpu_to_le32(val32);
1413 token = strsep(&sptr, " ");
1416 if (kstrtou32(token, 0, &val32))
1418 pstream.delay_bound = cpu_to_le32(val32);
1420 token = strsep(&sptr, " ");
1423 if (kstrtou32(token, 0, &val32))
1425 pstream.min_phy_rate = cpu_to_le32(val32);
1427 token = strsep(&sptr, " ");
1430 if (kstrtou32(token, 0, &val32))
1432 pstream.sba = cpu_to_le32(val32);
1434 token = strsep(&sptr, " ");
1437 if (kstrtou32(token, 0, &val32))
1439 pstream.medium_time = cpu_to_le32(val32);
1441 ath6kl_wmi_create_pstream_cmd(ar->wmi, vif->fw_vif_idx, &pstream);
1446 static const struct file_operations fops_create_qos = {
1447 .write = ath6kl_create_qos_write,
1448 .open = ath6kl_debugfs_open,
1449 .owner = THIS_MODULE,
1450 .llseek = default_llseek,
1453 static ssize_t ath6kl_delete_qos_write(struct file *file,
1454 const char __user *user_buf,
1455 size_t count, loff_t *ppos)
1458 struct ath6kl *ar = file->private_data;
1459 struct ath6kl_vif *vif;
1466 vif = ath6kl_vif_first(ar);
1470 len = min(count, sizeof(buf) - 1);
1471 if (copy_from_user(buf, user_buf, len))
1476 token = strsep(&sptr, " ");
1479 if (kstrtou8(token, 0, &traffic_class))
1482 token = strsep(&sptr, " ");
1485 if (kstrtou8(token, 0, &tsid))
1488 ath6kl_wmi_delete_pstream_cmd(ar->wmi, vif->fw_vif_idx,
1489 traffic_class, tsid);
1494 static const struct file_operations fops_delete_qos = {
1495 .write = ath6kl_delete_qos_write,
1496 .open = ath6kl_debugfs_open,
1497 .owner = THIS_MODULE,
1498 .llseek = default_llseek,
1501 static ssize_t ath6kl_bgscan_int_write(struct file *file,
1502 const char __user *user_buf,
1503 size_t count, loff_t *ppos)
1505 struct ath6kl *ar = file->private_data;
1510 len = min(count, sizeof(buf) - 1);
1511 if (copy_from_user(buf, user_buf, len))
1515 if (kstrtou16(buf, 0, &bgscan_int))
1518 if (bgscan_int == 0)
1519 bgscan_int = 0xffff;
1521 ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, 0, bgscan_int, 0, 0, 0, 3,
1527 static const struct file_operations fops_bgscan_int = {
1528 .write = ath6kl_bgscan_int_write,
1529 .open = ath6kl_debugfs_open,
1530 .owner = THIS_MODULE,
1531 .llseek = default_llseek,
1534 static ssize_t ath6kl_listen_int_write(struct file *file,
1535 const char __user *user_buf,
1536 size_t count, loff_t *ppos)
1538 struct ath6kl *ar = file->private_data;
1539 struct ath6kl_vif *vif;
1540 u16 listen_interval;
1544 vif = ath6kl_vif_first(ar);
1548 len = min(count, sizeof(buf) - 1);
1549 if (copy_from_user(buf, user_buf, len))
1553 if (kstrtou16(buf, 0, &listen_interval))
1556 if ((listen_interval < 1) || (listen_interval > 50))
1559 ar->listen_intvl_b = listen_interval;
1560 ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, 0,
1561 ar->listen_intvl_b);
1566 static ssize_t ath6kl_listen_int_read(struct file *file,
1567 char __user *user_buf,
1568 size_t count, loff_t *ppos)
1570 struct ath6kl *ar = file->private_data;
1574 len = scnprintf(buf, sizeof(buf), "%u\n", ar->listen_intvl_b);
1576 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1579 static const struct file_operations fops_listen_int = {
1580 .read = ath6kl_listen_int_read,
1581 .write = ath6kl_listen_int_write,
1582 .open = ath6kl_debugfs_open,
1583 .owner = THIS_MODULE,
1584 .llseek = default_llseek,
1587 static ssize_t ath6kl_power_params_write(struct file *file,
1588 const char __user *user_buf,
1589 size_t count, loff_t *ppos)
1591 struct ath6kl *ar = file->private_data;
1593 unsigned int len = 0;
1595 u16 idle_period, ps_poll_num, dtim,
1598 len = min(count, sizeof(buf) - 1);
1599 if (copy_from_user(buf, user_buf, len))
1604 token = strsep(&sptr, " ");
1607 if (kstrtou16(token, 0, &idle_period))
1610 token = strsep(&sptr, " ");
1613 if (kstrtou16(token, 0, &ps_poll_num))
1616 token = strsep(&sptr, " ");
1619 if (kstrtou16(token, 0, &dtim))
1622 token = strsep(&sptr, " ");
1625 if (kstrtou16(token, 0, &tx_wakeup))
1628 token = strsep(&sptr, " ");
1631 if (kstrtou16(token, 0, &num_tx))
1634 ath6kl_wmi_pmparams_cmd(ar->wmi, 0, idle_period, ps_poll_num,
1635 dtim, tx_wakeup, num_tx, 0);
1640 static const struct file_operations fops_power_params = {
1641 .write = ath6kl_power_params_write,
1642 .open = ath6kl_debugfs_open,
1643 .owner = THIS_MODULE,
1644 .llseek = default_llseek,
1647 int ath6kl_debug_init(struct ath6kl *ar)
1649 ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
1650 if (ar->debug.fwlog_buf.buf == NULL)
1653 ar->debug.fwlog_tmp = kmalloc(ATH6KL_FWLOG_SLOT_SIZE, GFP_KERNEL);
1654 if (ar->debug.fwlog_tmp == NULL) {
1655 vfree(ar->debug.fwlog_buf.buf);
1659 spin_lock_init(&ar->debug.fwlog_lock);
1662 * Actually we are lying here but don't know how to read the mask
1663 * value from the firmware.
1665 ar->debug.fwlog_mask = 0;
1667 ar->debugfs_phy = debugfs_create_dir("ath6kl",
1668 ar->wiphy->debugfsdir);
1669 if (!ar->debugfs_phy) {
1670 vfree(ar->debug.fwlog_buf.buf);
1671 kfree(ar->debug.fwlog_tmp);
1675 debugfs_create_file("tgt_stats", S_IRUSR, ar->debugfs_phy, ar,
1678 debugfs_create_file("credit_dist_stats", S_IRUSR, ar->debugfs_phy, ar,
1679 &fops_credit_dist_stats);
1681 debugfs_create_file("endpoint_stats", S_IRUSR | S_IWUSR,
1682 ar->debugfs_phy, ar, &fops_endpoint_stats);
1684 debugfs_create_file("fwlog", S_IRUSR, ar->debugfs_phy, ar,
1687 debugfs_create_file("fwlog_mask", S_IRUSR | S_IWUSR, ar->debugfs_phy,
1688 ar, &fops_fwlog_mask);
1690 debugfs_create_file("reg_addr", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar,
1691 &fops_diag_reg_read);
1693 debugfs_create_file("reg_dump", S_IRUSR, ar->debugfs_phy, ar,
1696 debugfs_create_file("lrssi_roam_threshold", S_IRUSR | S_IWUSR,
1697 ar->debugfs_phy, ar, &fops_lrssi_roam_threshold);
1699 debugfs_create_file("reg_write", S_IRUSR | S_IWUSR,
1700 ar->debugfs_phy, ar, &fops_diag_reg_write);
1702 debugfs_create_file("war_stats", S_IRUSR, ar->debugfs_phy, ar,
1705 debugfs_create_file("roam_table", S_IRUSR, ar->debugfs_phy, ar,
1708 debugfs_create_file("force_roam", S_IWUSR, ar->debugfs_phy, ar,
1711 debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar,
1714 debugfs_create_file("keepalive", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar,
1717 debugfs_create_file("disconnect_timeout", S_IRUSR | S_IWUSR,
1718 ar->debugfs_phy, ar, &fops_disconnect_timeout);
1720 debugfs_create_file("create_qos", S_IWUSR, ar->debugfs_phy, ar,
1723 debugfs_create_file("delete_qos", S_IWUSR, ar->debugfs_phy, ar,
1726 debugfs_create_file("bgscan_interval", S_IWUSR,
1727 ar->debugfs_phy, ar, &fops_bgscan_int);
1729 debugfs_create_file("listen_interval", S_IRUSR | S_IWUSR,
1730 ar->debugfs_phy, ar, &fops_listen_int);
1732 debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
1733 &fops_power_params);
1738 void ath6kl_debug_cleanup(struct ath6kl *ar)
1740 vfree(ar->debug.fwlog_buf.buf);
1741 kfree(ar->debug.fwlog_tmp);
1742 kfree(ar->debug.roam_tbl);