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 #define REG_OUTPUT_LEN_PER_LINE 25
61 #define REGTYPE_STR_LEN 100
63 struct ath6kl_diag_reg_info {
69 static const struct ath6kl_diag_reg_info diag_reg[] = {
70 { 0x20000, 0x200fc, "General DMA and Rx registers" },
71 { 0x28000, 0x28900, "MAC PCU register & keycache" },
72 { 0x20800, 0x20a40, "QCU" },
73 { 0x21000, 0x212f0, "DCU" },
74 { 0x4000, 0x42e4, "RTC" },
75 { 0x540000, 0x540000 + (256 * 1024), "RAM" },
76 { 0x29800, 0x2B210, "Base Band" },
77 { 0x1C000, 0x1C748, "Analog" },
80 void ath6kl_dump_registers(struct ath6kl_device *dev,
81 struct ath6kl_irq_proc_registers *irq_proc_reg,
82 struct ath6kl_irq_enable_reg *irq_enable_reg)
85 ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n"));
87 if (irq_proc_reg != NULL) {
88 ath6kl_dbg(ATH6KL_DBG_IRQ,
89 "Host Int status: 0x%x\n",
90 irq_proc_reg->host_int_status);
91 ath6kl_dbg(ATH6KL_DBG_IRQ,
92 "CPU Int status: 0x%x\n",
93 irq_proc_reg->cpu_int_status);
94 ath6kl_dbg(ATH6KL_DBG_IRQ,
95 "Error Int status: 0x%x\n",
96 irq_proc_reg->error_int_status);
97 ath6kl_dbg(ATH6KL_DBG_IRQ,
98 "Counter Int status: 0x%x\n",
99 irq_proc_reg->counter_int_status);
100 ath6kl_dbg(ATH6KL_DBG_IRQ,
101 "Mbox Frame: 0x%x\n",
102 irq_proc_reg->mbox_frame);
103 ath6kl_dbg(ATH6KL_DBG_IRQ,
104 "Rx Lookahead Valid: 0x%x\n",
105 irq_proc_reg->rx_lkahd_valid);
106 ath6kl_dbg(ATH6KL_DBG_IRQ,
107 "Rx Lookahead 0: 0x%x\n",
108 irq_proc_reg->rx_lkahd[0]);
109 ath6kl_dbg(ATH6KL_DBG_IRQ,
110 "Rx Lookahead 1: 0x%x\n",
111 irq_proc_reg->rx_lkahd[1]);
113 if (dev->ar->mbox_info.gmbox_addr != 0) {
115 * If the target supports GMBOX hardware, dump some
118 ath6kl_dbg(ATH6KL_DBG_IRQ,
119 "GMBOX Host Int status 2: 0x%x\n",
120 irq_proc_reg->host_int_status2);
121 ath6kl_dbg(ATH6KL_DBG_IRQ,
122 "GMBOX RX Avail: 0x%x\n",
123 irq_proc_reg->gmbox_rx_avail);
124 ath6kl_dbg(ATH6KL_DBG_IRQ,
125 "GMBOX lookahead alias 0: 0x%x\n",
126 irq_proc_reg->rx_gmbox_lkahd_alias[0]);
127 ath6kl_dbg(ATH6KL_DBG_IRQ,
128 "GMBOX lookahead alias 1: 0x%x\n",
129 irq_proc_reg->rx_gmbox_lkahd_alias[1]);
134 if (irq_enable_reg != NULL) {
135 ath6kl_dbg(ATH6KL_DBG_IRQ,
136 "Int status Enable: 0x%x\n",
137 irq_enable_reg->int_status_en);
138 ath6kl_dbg(ATH6KL_DBG_IRQ, "Counter Int status Enable: 0x%x\n",
139 irq_enable_reg->cntr_int_status_en);
141 ath6kl_dbg(ATH6KL_DBG_IRQ, "<------------------------------->\n");
144 static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist)
146 ath6kl_dbg(ATH6KL_DBG_CREDIT,
147 "--- endpoint: %d svc_id: 0x%X ---\n",
148 ep_dist->endpoint, ep_dist->svc_id);
149 ath6kl_dbg(ATH6KL_DBG_CREDIT, " dist_flags : 0x%X\n",
150 ep_dist->dist_flags);
151 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_norm : %d\n",
153 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_min : %d\n",
155 ath6kl_dbg(ATH6KL_DBG_CREDIT, " credits : %d\n",
157 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_assngd : %d\n",
158 ep_dist->cred_assngd);
159 ath6kl_dbg(ATH6KL_DBG_CREDIT, " seek_cred : %d\n",
161 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_sz : %d\n",
163 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_per_msg : %d\n",
164 ep_dist->cred_per_msg);
165 ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_to_dist : %d\n",
166 ep_dist->cred_to_dist);
167 ath6kl_dbg(ATH6KL_DBG_CREDIT, " txq_depth : %d\n",
168 get_queue_depth(&ep_dist->htc_ep->txq));
169 ath6kl_dbg(ATH6KL_DBG_CREDIT,
170 "----------------------------------\n");
173 /* FIXME: move to htc.c */
174 void dump_cred_dist_stats(struct htc_target *target)
176 struct htc_endpoint_credit_dist *ep_list;
178 list_for_each_entry(ep_list, &target->cred_dist_list, list)
179 dump_cred_dist(ep_list);
181 ath6kl_dbg(ATH6KL_DBG_CREDIT,
182 "credit distribution total %d free %d\n",
183 target->credit_info->total_avail_credits,
184 target->credit_info->cur_free_credits);
187 static int ath6kl_debugfs_open(struct inode *inode, struct file *file)
189 file->private_data = inode->i_private;
193 void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war)
196 case ATH6KL_WAR_INVALID_RATE:
197 ar->debug.war_stats.invalid_rate++;
202 static ssize_t read_file_war_stats(struct file *file, char __user *user_buf,
203 size_t count, loff_t *ppos)
205 struct ath6kl *ar = file->private_data;
207 unsigned int len = 0, buf_len = 1500;
210 buf = kzalloc(buf_len, GFP_KERNEL);
214 len += scnprintf(buf + len, buf_len - len, "\n");
215 len += scnprintf(buf + len, buf_len - len, "%25s\n",
217 len += scnprintf(buf + len, buf_len - len, "%25s\n\n",
218 "=================");
219 len += scnprintf(buf + len, buf_len - len, "%20s %10u\n",
220 "Invalid rates", ar->debug.war_stats.invalid_rate);
222 if (WARN_ON(len > buf_len))
225 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
231 static const struct file_operations fops_war_stats = {
232 .read = read_file_war_stats,
233 .open = ath6kl_debugfs_open,
234 .owner = THIS_MODULE,
235 .llseek = default_llseek,
238 static void ath6kl_debug_fwlog_add(struct ath6kl *ar, const void *buf,
241 struct circ_buf *fwlog = &ar->debug.fwlog_buf;
245 /* entries must all be equal size */
246 if (WARN_ON(buf_len != ATH6KL_FWLOG_SLOT_SIZE))
249 space = CIRC_SPACE(fwlog->head, fwlog->tail, ATH6KL_FWLOG_SIZE);
251 /* discard oldest slot */
252 fwlog->tail = (fwlog->tail + ATH6KL_FWLOG_SLOT_SIZE) &
253 (ATH6KL_FWLOG_SIZE - 1);
255 for (i = 0; i < buf_len; i += space) {
256 space = CIRC_SPACE_TO_END(fwlog->head, fwlog->tail,
259 if ((size_t) space > buf_len - i)
262 memcpy(&fwlog->buf[fwlog->head], buf, space);
263 fwlog->head = (fwlog->head + space) & (ATH6KL_FWLOG_SIZE - 1);
268 void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len)
270 struct ath6kl_fwlog_slot *slot = ar->debug.fwlog_tmp;
273 if (WARN_ON(len > ATH6KL_FWLOG_PAYLOAD_SIZE))
276 spin_lock_bh(&ar->debug.fwlog_lock);
278 slot->timestamp = cpu_to_le32(jiffies);
279 slot->length = cpu_to_le32(len);
280 memcpy(slot->payload, buf, len);
282 slot_len = sizeof(*slot) + len;
284 if (slot_len < ATH6KL_FWLOG_SLOT_SIZE)
285 memset(slot->payload + len, 0,
286 ATH6KL_FWLOG_SLOT_SIZE - slot_len);
288 ath6kl_debug_fwlog_add(ar, slot, ATH6KL_FWLOG_SLOT_SIZE);
290 spin_unlock_bh(&ar->debug.fwlog_lock);
293 static bool ath6kl_debug_fwlog_empty(struct ath6kl *ar)
295 return CIRC_CNT(ar->debug.fwlog_buf.head,
296 ar->debug.fwlog_buf.tail,
297 ATH6KL_FWLOG_SLOT_SIZE) == 0;
300 static ssize_t ath6kl_fwlog_read(struct file *file, char __user *user_buf,
301 size_t count, loff_t *ppos)
303 struct ath6kl *ar = file->private_data;
304 struct circ_buf *fwlog = &ar->debug.fwlog_buf;
305 size_t len = 0, buf_len = count;
310 buf = vmalloc(buf_len);
314 /* read undelivered logs from firmware */
315 ath6kl_read_fwlogs(ar);
317 spin_lock_bh(&ar->debug.fwlog_lock);
319 while (len < buf_len && !ath6kl_debug_fwlog_empty(ar)) {
320 ccnt = CIRC_CNT_TO_END(fwlog->head, fwlog->tail,
323 if ((size_t) ccnt > buf_len - len)
324 ccnt = buf_len - len;
326 memcpy(buf + len, &fwlog->buf[fwlog->tail], ccnt);
329 fwlog->tail = (fwlog->tail + ccnt) &
330 (ATH6KL_FWLOG_SIZE - 1);
333 spin_unlock_bh(&ar->debug.fwlog_lock);
335 if (WARN_ON(len > buf_len))
338 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
345 static const struct file_operations fops_fwlog = {
346 .open = ath6kl_debugfs_open,
347 .read = ath6kl_fwlog_read,
348 .owner = THIS_MODULE,
349 .llseek = default_llseek,
352 static ssize_t ath6kl_fwlog_mask_read(struct file *file, char __user *user_buf,
353 size_t count, loff_t *ppos)
355 struct ath6kl *ar = file->private_data;
359 len = snprintf(buf, sizeof(buf), "0x%x\n", ar->debug.fwlog_mask);
361 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
364 static ssize_t ath6kl_fwlog_mask_write(struct file *file,
365 const char __user *user_buf,
366 size_t count, loff_t *ppos)
368 struct ath6kl *ar = file->private_data;
371 ret = kstrtou32_from_user(user_buf, count, 0, &ar->debug.fwlog_mask);
375 ret = ath6kl_wmi_config_debug_module_cmd(ar->wmi,
376 ATH6KL_FWLOG_VALID_MASK,
377 ar->debug.fwlog_mask);
384 static const struct file_operations fops_fwlog_mask = {
385 .open = ath6kl_debugfs_open,
386 .read = ath6kl_fwlog_mask_read,
387 .write = ath6kl_fwlog_mask_write,
388 .owner = THIS_MODULE,
389 .llseek = default_llseek,
392 static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
393 size_t count, loff_t *ppos)
395 struct ath6kl *ar = file->private_data;
396 struct ath6kl_vif *vif;
397 struct target_stats *tgt_stats;
399 unsigned int len = 0, buf_len = 1500;
404 vif = ath6kl_vif_first(ar);
408 tgt_stats = &vif->target_stats;
410 buf = kzalloc(buf_len, GFP_KERNEL);
414 if (down_interruptible(&ar->sem)) {
419 set_bit(STATS_UPDATE_PEND, &vif->flags);
421 if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) {
427 left = wait_event_interruptible_timeout(ar->event_wq,
428 !test_bit(STATS_UPDATE_PEND,
429 &vif->flags), WMI_TIMEOUT);
438 len += scnprintf(buf + len, buf_len - len, "\n");
439 len += scnprintf(buf + len, buf_len - len, "%25s\n",
441 len += scnprintf(buf + len, buf_len - len, "%25s\n\n",
442 "=================");
443 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
444 "Ucast packets", tgt_stats->tx_ucast_pkt);
445 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
446 "Bcast packets", tgt_stats->tx_bcast_pkt);
447 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
448 "Ucast byte", tgt_stats->tx_ucast_byte);
449 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
450 "Bcast byte", tgt_stats->tx_bcast_byte);
451 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
452 "Rts success cnt", tgt_stats->tx_rts_success_cnt);
453 for (i = 0; i < 4; i++)
454 len += scnprintf(buf + len, buf_len - len,
455 "%18s %d %10llu\n", "PER on ac",
456 i, tgt_stats->tx_pkt_per_ac[i]);
457 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
458 "Error", tgt_stats->tx_err);
459 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
460 "Fail count", tgt_stats->tx_fail_cnt);
461 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
462 "Retry count", tgt_stats->tx_retry_cnt);
463 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
464 "Multi retry cnt", tgt_stats->tx_mult_retry_cnt);
465 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
466 "Rts fail cnt", tgt_stats->tx_rts_fail_cnt);
467 len += scnprintf(buf + len, buf_len - len, "%25s %10llu\n\n",
468 "TKIP counter measure used",
469 tgt_stats->tkip_cnter_measures_invoked);
471 len += scnprintf(buf + len, buf_len - len, "%25s\n",
473 len += scnprintf(buf + len, buf_len - len, "%25s\n",
474 "=================");
476 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
477 "Ucast packets", tgt_stats->rx_ucast_pkt);
478 len += scnprintf(buf + len, buf_len - len, "%20s %10d\n",
479 "Ucast Rate", tgt_stats->rx_ucast_rate);
480 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
481 "Bcast packets", tgt_stats->rx_bcast_pkt);
482 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
483 "Ucast byte", tgt_stats->rx_ucast_byte);
484 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
485 "Bcast byte", tgt_stats->rx_bcast_byte);
486 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
487 "Fragmented pkt", tgt_stats->rx_frgment_pkt);
488 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
489 "Error", tgt_stats->rx_err);
490 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
491 "CRC Err", tgt_stats->rx_crc_err);
492 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
493 "Key chache miss", tgt_stats->rx_key_cache_miss);
494 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
495 "Decrypt Err", tgt_stats->rx_decrypt_err);
496 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
497 "Duplicate frame", tgt_stats->rx_dupl_frame);
498 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
499 "Tkip Mic failure", tgt_stats->tkip_local_mic_fail);
500 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
501 "TKIP format err", tgt_stats->tkip_fmt_err);
502 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
503 "CCMP format Err", tgt_stats->ccmp_fmt_err);
504 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n\n",
505 "CCMP Replay Err", tgt_stats->ccmp_replays);
507 len += scnprintf(buf + len, buf_len - len, "%25s\n",
508 "Misc Target stats");
509 len += scnprintf(buf + len, buf_len - len, "%25s\n",
510 "=================");
511 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
512 "Beacon Miss count", tgt_stats->cs_bmiss_cnt);
513 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
514 "Num Connects", tgt_stats->cs_connect_cnt);
515 len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
516 "Num disconnects", tgt_stats->cs_discon_cnt);
517 len += scnprintf(buf + len, buf_len - len, "%20s %10d\n",
518 "Beacon avg rssi", tgt_stats->cs_ave_beacon_rssi);
523 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
529 static const struct file_operations fops_tgt_stats = {
530 .read = read_file_tgt_stats,
531 .open = ath6kl_debugfs_open,
532 .owner = THIS_MODULE,
533 .llseek = default_llseek,
536 #define print_credit_info(fmt_str, ep_list_field) \
537 (len += scnprintf(buf + len, buf_len - len, fmt_str, \
538 ep_list->ep_list_field))
539 #define CREDIT_INFO_DISPLAY_STRING_LEN 200
540 #define CREDIT_INFO_LEN 128
542 static ssize_t read_file_credit_dist_stats(struct file *file,
543 char __user *user_buf,
544 size_t count, loff_t *ppos)
546 struct ath6kl *ar = file->private_data;
547 struct htc_target *target = ar->htc_target;
548 struct htc_endpoint_credit_dist *ep_list;
550 unsigned int buf_len, len = 0;
553 buf_len = CREDIT_INFO_DISPLAY_STRING_LEN +
554 get_queue_depth(&target->cred_dist_list) * CREDIT_INFO_LEN;
555 buf = kzalloc(buf_len, GFP_KERNEL);
559 len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
560 "Total Avail Credits: ",
561 target->credit_info->total_avail_credits);
562 len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
564 target->credit_info->cur_free_credits);
566 len += scnprintf(buf + len, buf_len - len,
567 " Epid Flags Cred_norm Cred_min Credits Cred_assngd"
568 " Seek_cred Cred_sz Cred_per_msg Cred_to_dist"
571 list_for_each_entry(ep_list, &target->cred_dist_list, list) {
572 print_credit_info(" %2d", endpoint);
573 print_credit_info("%10x", dist_flags);
574 print_credit_info("%8d", cred_norm);
575 print_credit_info("%9d", cred_min);
576 print_credit_info("%9d", credits);
577 print_credit_info("%10d", cred_assngd);
578 print_credit_info("%13d", seek_cred);
579 print_credit_info("%12d", cred_sz);
580 print_credit_info("%9d", cred_per_msg);
581 print_credit_info("%14d", cred_to_dist);
582 len += scnprintf(buf + len, buf_len - len, "%12d\n",
583 get_queue_depth(&ep_list->htc_ep->txq));
589 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
594 static const struct file_operations fops_credit_dist_stats = {
595 .read = read_file_credit_dist_stats,
596 .open = ath6kl_debugfs_open,
597 .owner = THIS_MODULE,
598 .llseek = default_llseek,
601 static unsigned int print_endpoint_stat(struct htc_target *target, char *buf,
602 unsigned int buf_len, unsigned int len,
603 int offset, const char *name)
606 struct htc_endpoint_stats *ep_st;
609 len += scnprintf(buf + len, buf_len - len, "%s:", name);
610 for (i = 0; i < ENDPOINT_MAX; i++) {
611 ep_st = &target->endpoint[i].ep_st;
612 counter = ((u32 *) ep_st) + (offset / 4);
613 len += scnprintf(buf + len, buf_len - len, " %u", *counter);
615 len += scnprintf(buf + len, buf_len - len, "\n");
620 static ssize_t ath6kl_endpoint_stats_read(struct file *file,
621 char __user *user_buf,
622 size_t count, loff_t *ppos)
624 struct ath6kl *ar = file->private_data;
625 struct htc_target *target = ar->htc_target;
627 unsigned int buf_len, len = 0;
630 buf_len = sizeof(struct htc_endpoint_stats) / sizeof(u32) *
631 (25 + ENDPOINT_MAX * 11);
632 buf = kmalloc(buf_len, GFP_KERNEL);
636 #define EPSTAT(name) \
637 len = print_endpoint_stat(target, buf, buf_len, len, \
638 offsetof(struct htc_endpoint_stats, name), \
640 EPSTAT(cred_low_indicate);
642 EPSTAT(tx_pkt_bundled);
646 EPSTAT(cred_rpt_from_rx);
647 EPSTAT(cred_rpt_from_other);
648 EPSTAT(cred_rpt_ep0);
649 EPSTAT(cred_from_rx);
650 EPSTAT(cred_from_other);
651 EPSTAT(cred_from_ep0);
657 EPSTAT(rx_bundle_lkahd);
658 EPSTAT(rx_bundle_from_hdr);
659 EPSTAT(rx_alloc_thresh_hit);
660 EPSTAT(rxalloc_thresh_byte);
666 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
671 static ssize_t ath6kl_endpoint_stats_write(struct file *file,
672 const char __user *user_buf,
673 size_t count, loff_t *ppos)
675 struct ath6kl *ar = file->private_data;
676 struct htc_target *target = ar->htc_target;
679 struct htc_endpoint_stats *ep_st;
681 ret = kstrtou32_from_user(user_buf, count, 0, &val);
685 for (i = 0; i < ENDPOINT_MAX; i++) {
686 ep_st = &target->endpoint[i].ep_st;
687 memset(ep_st, 0, sizeof(*ep_st));
694 static const struct file_operations fops_endpoint_stats = {
695 .open = ath6kl_debugfs_open,
696 .read = ath6kl_endpoint_stats_read,
697 .write = ath6kl_endpoint_stats_write,
698 .owner = THIS_MODULE,
699 .llseek = default_llseek,
702 static unsigned long ath6kl_get_num_reg(void)
705 unsigned long n_reg = 0;
707 for (i = 0; i < ARRAY_SIZE(diag_reg); i++)
709 (diag_reg[i].reg_end - diag_reg[i].reg_start) / 4 + 1;
714 static bool ath6kl_dbg_is_diag_reg_valid(u32 reg_addr)
718 for (i = 0; i < ARRAY_SIZE(diag_reg); i++) {
719 if (reg_addr >= diag_reg[i].reg_start &&
720 reg_addr <= diag_reg[i].reg_end)
727 static ssize_t ath6kl_regread_read(struct file *file, char __user *user_buf,
728 size_t count, loff_t *ppos)
730 struct ath6kl *ar = file->private_data;
732 unsigned int len = 0;
734 if (ar->debug.dbgfs_diag_reg)
735 len += scnprintf(buf + len, sizeof(buf) - len, "0x%x\n",
736 ar->debug.dbgfs_diag_reg);
738 len += scnprintf(buf + len, sizeof(buf) - len,
739 "All diag registers\n");
741 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
744 static ssize_t ath6kl_regread_write(struct file *file,
745 const char __user *user_buf,
746 size_t count, loff_t *ppos)
748 struct ath6kl *ar = file->private_data;
751 unsigned long reg_addr;
753 len = min(count, sizeof(buf) - 1);
754 if (copy_from_user(buf, user_buf, len))
759 if (strict_strtoul(buf, 0, ®_addr))
762 if ((reg_addr % 4) != 0)
765 if (reg_addr && !ath6kl_dbg_is_diag_reg_valid(reg_addr))
768 ar->debug.dbgfs_diag_reg = reg_addr;
773 static const struct file_operations fops_diag_reg_read = {
774 .read = ath6kl_regread_read,
775 .write = ath6kl_regread_write,
776 .open = ath6kl_debugfs_open,
777 .owner = THIS_MODULE,
778 .llseek = default_llseek,
781 static int ath6kl_regdump_open(struct inode *inode, struct file *file)
783 struct ath6kl *ar = inode->i_private;
785 unsigned long int reg_len;
786 unsigned int len = 0, n_reg;
791 /* Dump all the registers if no register is specified */
792 if (!ar->debug.dbgfs_diag_reg)
793 n_reg = ath6kl_get_num_reg();
797 reg_len = n_reg * REG_OUTPUT_LEN_PER_LINE;
799 reg_len += REGTYPE_STR_LEN;
801 buf = vmalloc(reg_len);
806 addr = ar->debug.dbgfs_diag_reg;
808 status = ath6kl_diag_read32(ar,
809 TARG_VTOP(ar->target_type, addr),
814 len += scnprintf(buf + len, reg_len - len,
815 "0x%06x 0x%08x\n", addr, le32_to_cpu(reg_val));
819 for (i = 0; i < ARRAY_SIZE(diag_reg); i++) {
820 len += scnprintf(buf + len, reg_len - len,
821 "%s\n", diag_reg[i].reg_info);
822 for (addr = diag_reg[i].reg_start;
823 addr <= diag_reg[i].reg_end; addr += 4) {
824 status = ath6kl_diag_read32(ar,
825 TARG_VTOP(ar->target_type, addr),
830 len += scnprintf(buf + len, reg_len - len,
832 addr, le32_to_cpu(reg_val));
837 file->private_data = buf;
841 ath6kl_warn("Unable to read memory:%u\n", addr);
846 static ssize_t ath6kl_regdump_read(struct file *file, char __user *user_buf,
847 size_t count, loff_t *ppos)
849 u8 *buf = file->private_data;
850 return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
853 static int ath6kl_regdump_release(struct inode *inode, struct file *file)
855 vfree(file->private_data);
859 static const struct file_operations fops_reg_dump = {
860 .open = ath6kl_regdump_open,
861 .read = ath6kl_regdump_read,
862 .release = ath6kl_regdump_release,
863 .owner = THIS_MODULE,
864 .llseek = default_llseek,
867 static ssize_t ath6kl_lrssi_roam_write(struct file *file,
868 const char __user *user_buf,
869 size_t count, loff_t *ppos)
871 struct ath6kl *ar = file->private_data;
872 unsigned long lrssi_roam_threshold;
876 len = min(count, sizeof(buf) - 1);
877 if (copy_from_user(buf, user_buf, len))
881 if (strict_strtoul(buf, 0, &lrssi_roam_threshold))
884 ar->lrssi_roam_threshold = lrssi_roam_threshold;
886 ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold);
891 static ssize_t ath6kl_lrssi_roam_read(struct file *file,
892 char __user *user_buf,
893 size_t count, loff_t *ppos)
895 struct ath6kl *ar = file->private_data;
899 len = snprintf(buf, sizeof(buf), "%u\n", ar->lrssi_roam_threshold);
901 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
904 static const struct file_operations fops_lrssi_roam_threshold = {
905 .read = ath6kl_lrssi_roam_read,
906 .write = ath6kl_lrssi_roam_write,
907 .open = ath6kl_debugfs_open,
908 .owner = THIS_MODULE,
909 .llseek = default_llseek,
912 static ssize_t ath6kl_regwrite_read(struct file *file,
913 char __user *user_buf,
914 size_t count, loff_t *ppos)
916 struct ath6kl *ar = file->private_data;
918 unsigned int len = 0;
920 len = scnprintf(buf, sizeof(buf), "Addr: 0x%x Val: 0x%x\n",
921 ar->debug.diag_reg_addr_wr, ar->debug.diag_reg_val_wr);
923 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
926 static ssize_t ath6kl_regwrite_write(struct file *file,
927 const char __user *user_buf,
928 size_t count, loff_t *ppos)
930 struct ath6kl *ar = file->private_data;
933 unsigned int len = 0;
934 u32 reg_addr, reg_val;
936 len = min(count, sizeof(buf) - 1);
937 if (copy_from_user(buf, user_buf, len))
943 token = strsep(&sptr, "=");
947 if (kstrtou32(token, 0, ®_addr))
950 if (!ath6kl_dbg_is_diag_reg_valid(reg_addr))
953 if (kstrtou32(sptr, 0, ®_val))
956 ar->debug.diag_reg_addr_wr = reg_addr;
957 ar->debug.diag_reg_val_wr = reg_val;
959 if (ath6kl_diag_write32(ar, ar->debug.diag_reg_addr_wr,
960 cpu_to_le32(ar->debug.diag_reg_val_wr)))
966 static const struct file_operations fops_diag_reg_write = {
967 .read = ath6kl_regwrite_read,
968 .write = ath6kl_regwrite_write,
969 .open = ath6kl_debugfs_open,
970 .owner = THIS_MODULE,
971 .llseek = default_llseek,
974 int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf,
977 const struct wmi_target_roam_tbl *tbl;
980 if (len < sizeof(*tbl))
983 tbl = (const struct wmi_target_roam_tbl *) buf;
984 num_entries = le16_to_cpu(tbl->num_entries);
985 if (sizeof(*tbl) + num_entries * sizeof(struct wmi_bss_roam_info) >
989 if (ar->debug.roam_tbl == NULL ||
990 ar->debug.roam_tbl_len < (unsigned int) len) {
991 kfree(ar->debug.roam_tbl);
992 ar->debug.roam_tbl = kmalloc(len, GFP_ATOMIC);
993 if (ar->debug.roam_tbl == NULL)
997 memcpy(ar->debug.roam_tbl, buf, len);
998 ar->debug.roam_tbl_len = len;
1000 if (test_bit(ROAM_TBL_PEND, &ar->flag)) {
1001 clear_bit(ROAM_TBL_PEND, &ar->flag);
1002 wake_up(&ar->event_wq);
1008 static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf,
1009 size_t count, loff_t *ppos)
1011 struct ath6kl *ar = file->private_data;
1014 struct wmi_target_roam_tbl *tbl;
1017 unsigned int len, buf_len;
1020 if (down_interruptible(&ar->sem))
1023 set_bit(ROAM_TBL_PEND, &ar->flag);
1025 ret = ath6kl_wmi_get_roam_tbl_cmd(ar->wmi);
1031 left = wait_event_interruptible_timeout(
1032 ar->event_wq, !test_bit(ROAM_TBL_PEND, &ar->flag), WMI_TIMEOUT);
1038 if (ar->debug.roam_tbl == NULL)
1041 tbl = (struct wmi_target_roam_tbl *) ar->debug.roam_tbl;
1042 num_entries = le16_to_cpu(tbl->num_entries);
1044 buf_len = 100 + num_entries * 100;
1045 buf = kzalloc(buf_len, GFP_KERNEL);
1049 len += scnprintf(buf + len, buf_len - len,
1051 "# roam_util bssid rssi rssidt last_rssi util bias\n",
1052 le16_to_cpu(tbl->roam_mode));
1054 for (i = 0; i < num_entries; i++) {
1055 struct wmi_bss_roam_info *info = &tbl->info[i];
1056 len += scnprintf(buf + len, buf_len - len,
1057 "%d %pM %d %d %d %d %d\n",
1058 a_sle32_to_cpu(info->roam_util), info->bssid,
1059 info->rssi, info->rssidt, info->last_rssi,
1060 info->util, info->bias);
1066 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
1072 static const struct file_operations fops_roam_table = {
1073 .read = ath6kl_roam_table_read,
1074 .open = ath6kl_debugfs_open,
1075 .owner = THIS_MODULE,
1076 .llseek = default_llseek,
1079 static ssize_t ath6kl_force_roam_write(struct file *file,
1080 const char __user *user_buf,
1081 size_t count, loff_t *ppos)
1083 struct ath6kl *ar = file->private_data;
1091 len = min(count, sizeof(buf) - 1);
1092 if (copy_from_user(buf, user_buf, len))
1096 if (sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
1097 &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
1100 for (i = 0; i < ETH_ALEN; i++)
1103 ret = ath6kl_wmi_force_roam_cmd(ar->wmi, bssid);
1110 static const struct file_operations fops_force_roam = {
1111 .write = ath6kl_force_roam_write,
1112 .open = ath6kl_debugfs_open,
1113 .owner = THIS_MODULE,
1114 .llseek = default_llseek,
1117 static ssize_t ath6kl_roam_mode_write(struct file *file,
1118 const char __user *user_buf,
1119 size_t count, loff_t *ppos)
1121 struct ath6kl *ar = file->private_data;
1125 enum wmi_roam_mode mode;
1127 len = min(count, sizeof(buf) - 1);
1128 if (copy_from_user(buf, user_buf, len))
1131 if (len > 0 && buf[len - 1] == '\n')
1132 buf[len - 1] = '\0';
1134 if (strcasecmp(buf, "default") == 0)
1135 mode = WMI_DEFAULT_ROAM_MODE;
1136 else if (strcasecmp(buf, "bssbias") == 0)
1137 mode = WMI_HOST_BIAS_ROAM_MODE;
1138 else if (strcasecmp(buf, "lock") == 0)
1139 mode = WMI_LOCK_BSS_MODE;
1143 ret = ath6kl_wmi_set_roam_mode_cmd(ar->wmi, mode);
1150 static const struct file_operations fops_roam_mode = {
1151 .write = ath6kl_roam_mode_write,
1152 .open = ath6kl_debugfs_open,
1153 .owner = THIS_MODULE,
1154 .llseek = default_llseek,
1157 void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive)
1159 ar->debug.keepalive = keepalive;
1162 static ssize_t ath6kl_keepalive_read(struct file *file, char __user *user_buf,
1163 size_t count, loff_t *ppos)
1165 struct ath6kl *ar = file->private_data;
1169 len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.keepalive);
1171 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1174 static ssize_t ath6kl_keepalive_write(struct file *file,
1175 const char __user *user_buf,
1176 size_t count, loff_t *ppos)
1178 struct ath6kl *ar = file->private_data;
1182 ret = kstrtou8_from_user(user_buf, count, 0, &val);
1186 ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, 0, val);
1193 static const struct file_operations fops_keepalive = {
1194 .open = ath6kl_debugfs_open,
1195 .read = ath6kl_keepalive_read,
1196 .write = ath6kl_keepalive_write,
1197 .owner = THIS_MODULE,
1198 .llseek = default_llseek,
1201 void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout)
1203 ar->debug.disc_timeout = timeout;
1206 static ssize_t ath6kl_disconnect_timeout_read(struct file *file,
1207 char __user *user_buf,
1208 size_t count, loff_t *ppos)
1210 struct ath6kl *ar = file->private_data;
1214 len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.disc_timeout);
1216 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1219 static ssize_t ath6kl_disconnect_timeout_write(struct file *file,
1220 const char __user *user_buf,
1221 size_t count, loff_t *ppos)
1223 struct ath6kl *ar = file->private_data;
1227 ret = kstrtou8_from_user(user_buf, count, 0, &val);
1231 ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, 0, val);
1238 static const struct file_operations fops_disconnect_timeout = {
1239 .open = ath6kl_debugfs_open,
1240 .read = ath6kl_disconnect_timeout_read,
1241 .write = ath6kl_disconnect_timeout_write,
1242 .owner = THIS_MODULE,
1243 .llseek = default_llseek,
1246 static ssize_t ath6kl_create_qos_write(struct file *file,
1247 const char __user *user_buf,
1248 size_t count, loff_t *ppos)
1251 struct ath6kl *ar = file->private_data;
1252 struct ath6kl_vif *vif;
1256 struct wmi_create_pstream_cmd pstream;
1260 vif = ath6kl_vif_first(ar);
1264 len = min(count, sizeof(buf) - 1);
1265 if (copy_from_user(buf, user_buf, len))
1270 token = strsep(&sptr, " ");
1273 if (kstrtou8(token, 0, &pstream.user_pri))
1276 token = strsep(&sptr, " ");
1279 if (kstrtou8(token, 0, &pstream.traffic_direc))
1282 token = strsep(&sptr, " ");
1285 if (kstrtou8(token, 0, &pstream.traffic_class))
1288 token = strsep(&sptr, " ");
1291 if (kstrtou8(token, 0, &pstream.traffic_type))
1294 token = strsep(&sptr, " ");
1297 if (kstrtou8(token, 0, &pstream.voice_psc_cap))
1300 token = strsep(&sptr, " ");
1303 if (kstrtou32(token, 0, &val32))
1305 pstream.min_service_int = cpu_to_le32(val32);
1307 token = strsep(&sptr, " ");
1310 if (kstrtou32(token, 0, &val32))
1312 pstream.max_service_int = cpu_to_le32(val32);
1314 token = strsep(&sptr, " ");
1317 if (kstrtou32(token, 0, &val32))
1319 pstream.inactivity_int = cpu_to_le32(val32);
1321 token = strsep(&sptr, " ");
1324 if (kstrtou32(token, 0, &val32))
1326 pstream.suspension_int = cpu_to_le32(val32);
1328 token = strsep(&sptr, " ");
1331 if (kstrtou32(token, 0, &val32))
1333 pstream.service_start_time = cpu_to_le32(val32);
1335 token = strsep(&sptr, " ");
1338 if (kstrtou8(token, 0, &pstream.tsid))
1341 token = strsep(&sptr, " ");
1344 if (kstrtou16(token, 0, &val16))
1346 pstream.nominal_msdu = cpu_to_le16(val16);
1348 token = strsep(&sptr, " ");
1351 if (kstrtou16(token, 0, &val16))
1353 pstream.max_msdu = cpu_to_le16(val16);
1355 token = strsep(&sptr, " ");
1358 if (kstrtou32(token, 0, &val32))
1360 pstream.min_data_rate = cpu_to_le32(val32);
1362 token = strsep(&sptr, " ");
1365 if (kstrtou32(token, 0, &val32))
1367 pstream.mean_data_rate = cpu_to_le32(val32);
1369 token = strsep(&sptr, " ");
1372 if (kstrtou32(token, 0, &val32))
1374 pstream.peak_data_rate = cpu_to_le32(val32);
1376 token = strsep(&sptr, " ");
1379 if (kstrtou32(token, 0, &val32))
1381 pstream.max_burst_size = cpu_to_le32(val32);
1383 token = strsep(&sptr, " ");
1386 if (kstrtou32(token, 0, &val32))
1388 pstream.delay_bound = cpu_to_le32(val32);
1390 token = strsep(&sptr, " ");
1393 if (kstrtou32(token, 0, &val32))
1395 pstream.min_phy_rate = cpu_to_le32(val32);
1397 token = strsep(&sptr, " ");
1400 if (kstrtou32(token, 0, &val32))
1402 pstream.sba = cpu_to_le32(val32);
1404 token = strsep(&sptr, " ");
1407 if (kstrtou32(token, 0, &val32))
1409 pstream.medium_time = cpu_to_le32(val32);
1411 ath6kl_wmi_create_pstream_cmd(ar->wmi, vif->fw_vif_idx, &pstream);
1416 static const struct file_operations fops_create_qos = {
1417 .write = ath6kl_create_qos_write,
1418 .open = ath6kl_debugfs_open,
1419 .owner = THIS_MODULE,
1420 .llseek = default_llseek,
1423 static ssize_t ath6kl_delete_qos_write(struct file *file,
1424 const char __user *user_buf,
1425 size_t count, loff_t *ppos)
1428 struct ath6kl *ar = file->private_data;
1429 struct ath6kl_vif *vif;
1436 vif = ath6kl_vif_first(ar);
1440 len = min(count, sizeof(buf) - 1);
1441 if (copy_from_user(buf, user_buf, len))
1446 token = strsep(&sptr, " ");
1449 if (kstrtou8(token, 0, &traffic_class))
1452 token = strsep(&sptr, " ");
1455 if (kstrtou8(token, 0, &tsid))
1458 ath6kl_wmi_delete_pstream_cmd(ar->wmi, vif->fw_vif_idx,
1459 traffic_class, tsid);
1464 static const struct file_operations fops_delete_qos = {
1465 .write = ath6kl_delete_qos_write,
1466 .open = ath6kl_debugfs_open,
1467 .owner = THIS_MODULE,
1468 .llseek = default_llseek,
1471 static ssize_t ath6kl_bgscan_int_write(struct file *file,
1472 const char __user *user_buf,
1473 size_t count, loff_t *ppos)
1475 struct ath6kl *ar = file->private_data;
1480 len = min(count, sizeof(buf) - 1);
1481 if (copy_from_user(buf, user_buf, len))
1485 if (kstrtou16(buf, 0, &bgscan_int))
1488 if (bgscan_int == 0)
1489 bgscan_int = 0xffff;
1491 ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, 0, bgscan_int, 0, 0, 0, 3,
1497 static const struct file_operations fops_bgscan_int = {
1498 .write = ath6kl_bgscan_int_write,
1499 .open = ath6kl_debugfs_open,
1500 .owner = THIS_MODULE,
1501 .llseek = default_llseek,
1504 static ssize_t ath6kl_listen_int_write(struct file *file,
1505 const char __user *user_buf,
1506 size_t count, loff_t *ppos)
1508 struct ath6kl *ar = file->private_data;
1509 struct ath6kl_vif *vif;
1510 u16 listen_interval;
1514 vif = ath6kl_vif_first(ar);
1518 len = min(count, sizeof(buf) - 1);
1519 if (copy_from_user(buf, user_buf, len))
1523 if (kstrtou16(buf, 0, &listen_interval))
1526 if ((listen_interval < 1) || (listen_interval > 50))
1529 ar->listen_intvl_b = listen_interval;
1530 ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, 0,
1531 ar->listen_intvl_b);
1536 static ssize_t ath6kl_listen_int_read(struct file *file,
1537 char __user *user_buf,
1538 size_t count, loff_t *ppos)
1540 struct ath6kl *ar = file->private_data;
1544 len = scnprintf(buf, sizeof(buf), "%u\n", ar->listen_intvl_b);
1546 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1549 static const struct file_operations fops_listen_int = {
1550 .read = ath6kl_listen_int_read,
1551 .write = ath6kl_listen_int_write,
1552 .open = ath6kl_debugfs_open,
1553 .owner = THIS_MODULE,
1554 .llseek = default_llseek,
1557 static ssize_t ath6kl_power_params_write(struct file *file,
1558 const char __user *user_buf,
1559 size_t count, loff_t *ppos)
1561 struct ath6kl *ar = file->private_data;
1563 unsigned int len = 0;
1565 u16 idle_period, ps_poll_num, dtim,
1568 len = min(count, sizeof(buf) - 1);
1569 if (copy_from_user(buf, user_buf, len))
1574 token = strsep(&sptr, " ");
1577 if (kstrtou16(token, 0, &idle_period))
1580 token = strsep(&sptr, " ");
1583 if (kstrtou16(token, 0, &ps_poll_num))
1586 token = strsep(&sptr, " ");
1589 if (kstrtou16(token, 0, &dtim))
1592 token = strsep(&sptr, " ");
1595 if (kstrtou16(token, 0, &tx_wakeup))
1598 token = strsep(&sptr, " ");
1601 if (kstrtou16(token, 0, &num_tx))
1604 ath6kl_wmi_pmparams_cmd(ar->wmi, 0, idle_period, ps_poll_num,
1605 dtim, tx_wakeup, num_tx, 0);
1610 static const struct file_operations fops_power_params = {
1611 .write = ath6kl_power_params_write,
1612 .open = ath6kl_debugfs_open,
1613 .owner = THIS_MODULE,
1614 .llseek = default_llseek,
1617 int ath6kl_debug_init(struct ath6kl *ar)
1619 ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
1620 if (ar->debug.fwlog_buf.buf == NULL)
1623 ar->debug.fwlog_tmp = kmalloc(ATH6KL_FWLOG_SLOT_SIZE, GFP_KERNEL);
1624 if (ar->debug.fwlog_tmp == NULL) {
1625 vfree(ar->debug.fwlog_buf.buf);
1629 spin_lock_init(&ar->debug.fwlog_lock);
1632 * Actually we are lying here but don't know how to read the mask
1633 * value from the firmware.
1635 ar->debug.fwlog_mask = 0;
1637 ar->debugfs_phy = debugfs_create_dir("ath6kl",
1638 ar->wiphy->debugfsdir);
1639 if (!ar->debugfs_phy) {
1640 vfree(ar->debug.fwlog_buf.buf);
1641 kfree(ar->debug.fwlog_tmp);
1645 debugfs_create_file("tgt_stats", S_IRUSR, ar->debugfs_phy, ar,
1648 debugfs_create_file("credit_dist_stats", S_IRUSR, ar->debugfs_phy, ar,
1649 &fops_credit_dist_stats);
1651 debugfs_create_file("endpoint_stats", S_IRUSR | S_IWUSR,
1652 ar->debugfs_phy, ar, &fops_endpoint_stats);
1654 debugfs_create_file("fwlog", S_IRUSR, ar->debugfs_phy, ar,
1657 debugfs_create_file("fwlog_mask", S_IRUSR | S_IWUSR, ar->debugfs_phy,
1658 ar, &fops_fwlog_mask);
1660 debugfs_create_file("reg_addr", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar,
1661 &fops_diag_reg_read);
1663 debugfs_create_file("reg_dump", S_IRUSR, ar->debugfs_phy, ar,
1666 debugfs_create_file("lrssi_roam_threshold", S_IRUSR | S_IWUSR,
1667 ar->debugfs_phy, ar, &fops_lrssi_roam_threshold);
1669 debugfs_create_file("reg_write", S_IRUSR | S_IWUSR,
1670 ar->debugfs_phy, ar, &fops_diag_reg_write);
1672 debugfs_create_file("war_stats", S_IRUSR, ar->debugfs_phy, ar,
1675 debugfs_create_file("roam_table", S_IRUSR, ar->debugfs_phy, ar,
1678 debugfs_create_file("force_roam", S_IWUSR, ar->debugfs_phy, ar,
1681 debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar,
1684 debugfs_create_file("keepalive", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar,
1687 debugfs_create_file("disconnect_timeout", S_IRUSR | S_IWUSR,
1688 ar->debugfs_phy, ar, &fops_disconnect_timeout);
1690 debugfs_create_file("create_qos", S_IWUSR, ar->debugfs_phy, ar,
1693 debugfs_create_file("delete_qos", S_IWUSR, ar->debugfs_phy, ar,
1696 debugfs_create_file("bgscan_interval", S_IWUSR,
1697 ar->debugfs_phy, ar, &fops_bgscan_int);
1699 debugfs_create_file("listen_interval", S_IRUSR | S_IWUSR,
1700 ar->debugfs_phy, ar, &fops_listen_int);
1702 debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
1703 &fops_power_params);
1708 void ath6kl_debug_cleanup(struct ath6kl *ar)
1710 vfree(ar->debug.fwlog_buf.buf);
1711 kfree(ar->debug.fwlog_tmp);
1712 kfree(ar->debug.roam_tbl);