2 * Copyright (c) 2008-2009 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.
17 #include <asm/unaligned.h>
21 #define REG_WRITE_D(_ah, _reg, _val) \
22 ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
23 #define REG_READ_D(_ah, _reg) \
24 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
26 static struct dentry
*ath9k_debugfs_root
;
28 static int ath9k_debugfs_open(struct inode
*inode
, struct file
*file
)
30 file
->private_data
= inode
->i_private
;
34 static ssize_t
read_file_debug(struct file
*file
, char __user
*user_buf
,
35 size_t count
, loff_t
*ppos
)
37 struct ath_softc
*sc
= file
->private_data
;
38 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
42 len
= snprintf(buf
, sizeof(buf
), "0x%08x\n", common
->debug_mask
);
43 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
46 static ssize_t
write_file_debug(struct file
*file
, const char __user
*user_buf
,
47 size_t count
, loff_t
*ppos
)
49 struct ath_softc
*sc
= file
->private_data
;
50 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
55 len
= min(count
, sizeof(buf
) - 1);
56 if (copy_from_user(buf
, user_buf
, len
))
60 if (strict_strtoul(buf
, 0, &mask
))
63 common
->debug_mask
= mask
;
67 static const struct file_operations fops_debug
= {
68 .read
= read_file_debug
,
69 .write
= write_file_debug
,
70 .open
= ath9k_debugfs_open
,
74 static ssize_t
read_file_dma(struct file
*file
, char __user
*user_buf
,
75 size_t count
, loff_t
*ppos
)
77 struct ath_softc
*sc
= file
->private_data
;
78 struct ath_hw
*ah
= sc
->sc_ah
;
81 u32 val
[ATH9K_NUM_DMA_DEBUG_REGS
];
82 int i
, qcuOffset
= 0, dcuOffset
= 0;
83 u32
*qcuBase
= &val
[0], *dcuBase
= &val
[4];
87 REG_WRITE_D(ah
, AR_MACMISC
,
88 ((AR_MACMISC_DMA_OBS_LINE_8
<< AR_MACMISC_DMA_OBS_S
) |
89 (AR_MACMISC_MISC_OBS_BUS_1
<<
90 AR_MACMISC_MISC_OBS_BUS_MSB_S
)));
92 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
93 "Raw DMA Debug values:\n");
95 for (i
= 0; i
< ATH9K_NUM_DMA_DEBUG_REGS
; i
++) {
97 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "\n");
99 val
[i
] = REG_READ_D(ah
, AR_DMADBG_0
+ (i
* sizeof(u32
)));
100 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "%d: %08x ",
104 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "\n\n");
105 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
106 "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
108 for (i
= 0; i
< ATH9K_NUM_QUEUES
; i
++, qcuOffset
+= 4, dcuOffset
+= 5) {
119 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
120 "%2d %2x %1x %2x %2x\n",
121 i
, (*qcuBase
& (0x7 << qcuOffset
)) >> qcuOffset
,
122 (*qcuBase
& (0x8 << qcuOffset
)) >> (qcuOffset
+ 3),
123 val
[2] & (0x7 << (i
* 3)) >> (i
* 3),
124 (*dcuBase
& (0x1f << dcuOffset
)) >> dcuOffset
);
127 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "\n");
129 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
130 "qcu_stitch state: %2x qcu_fetch state: %2x\n",
131 (val
[3] & 0x003c0000) >> 18, (val
[3] & 0x03c00000) >> 22);
132 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
133 "qcu_complete state: %2x dcu_complete state: %2x\n",
134 (val
[3] & 0x1c000000) >> 26, (val
[6] & 0x3));
135 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
136 "dcu_arb state: %2x dcu_fp state: %2x\n",
137 (val
[5] & 0x06000000) >> 25, (val
[5] & 0x38000000) >> 27);
138 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
139 "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n",
140 (val
[6] & 0x000003fc) >> 2, (val
[6] & 0x00000400) >> 10);
141 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
142 "txfifo_valid_0: %1d txfifo_valid_1: %1d\n",
143 (val
[6] & 0x00000800) >> 11, (val
[6] & 0x00001000) >> 12);
144 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
145 "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n",
146 (val
[6] & 0x0001e000) >> 13, (val
[6] & 0x001e0000) >> 17);
148 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "pcu observe: 0x%x \n",
149 REG_READ_D(ah
, AR_OBS_BUS_1
));
150 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
151 "AR_CR: 0x%x \n", REG_READ_D(ah
, AR_CR
));
153 ath9k_ps_restore(sc
);
155 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
158 static const struct file_operations fops_dma
= {
159 .read
= read_file_dma
,
160 .open
= ath9k_debugfs_open
,
165 void ath_debug_stat_interrupt(struct ath_softc
*sc
, enum ath9k_int status
)
168 sc
->debug
.stats
.istats
.total
++;
169 if (status
& ATH9K_INT_RX
)
170 sc
->debug
.stats
.istats
.rxok
++;
171 if (status
& ATH9K_INT_RXEOL
)
172 sc
->debug
.stats
.istats
.rxeol
++;
173 if (status
& ATH9K_INT_RXORN
)
174 sc
->debug
.stats
.istats
.rxorn
++;
175 if (status
& ATH9K_INT_TX
)
176 sc
->debug
.stats
.istats
.txok
++;
177 if (status
& ATH9K_INT_TXURN
)
178 sc
->debug
.stats
.istats
.txurn
++;
179 if (status
& ATH9K_INT_MIB
)
180 sc
->debug
.stats
.istats
.mib
++;
181 if (status
& ATH9K_INT_RXPHY
)
182 sc
->debug
.stats
.istats
.rxphyerr
++;
183 if (status
& ATH9K_INT_RXKCM
)
184 sc
->debug
.stats
.istats
.rx_keycache_miss
++;
185 if (status
& ATH9K_INT_SWBA
)
186 sc
->debug
.stats
.istats
.swba
++;
187 if (status
& ATH9K_INT_BMISS
)
188 sc
->debug
.stats
.istats
.bmiss
++;
189 if (status
& ATH9K_INT_BNR
)
190 sc
->debug
.stats
.istats
.bnr
++;
191 if (status
& ATH9K_INT_CST
)
192 sc
->debug
.stats
.istats
.cst
++;
193 if (status
& ATH9K_INT_GTT
)
194 sc
->debug
.stats
.istats
.gtt
++;
195 if (status
& ATH9K_INT_TIM
)
196 sc
->debug
.stats
.istats
.tim
++;
197 if (status
& ATH9K_INT_CABEND
)
198 sc
->debug
.stats
.istats
.cabend
++;
199 if (status
& ATH9K_INT_DTIMSYNC
)
200 sc
->debug
.stats
.istats
.dtimsync
++;
201 if (status
& ATH9K_INT_DTIM
)
202 sc
->debug
.stats
.istats
.dtim
++;
205 static ssize_t
read_file_interrupt(struct file
*file
, char __user
*user_buf
,
206 size_t count
, loff_t
*ppos
)
208 struct ath_softc
*sc
= file
->private_data
;
210 unsigned int len
= 0;
212 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
213 "%8s: %10u\n", "RX", sc
->debug
.stats
.istats
.rxok
);
214 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
215 "%8s: %10u\n", "RXEOL", sc
->debug
.stats
.istats
.rxeol
);
216 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
217 "%8s: %10u\n", "RXORN", sc
->debug
.stats
.istats
.rxorn
);
218 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
219 "%8s: %10u\n", "TX", sc
->debug
.stats
.istats
.txok
);
220 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
221 "%8s: %10u\n", "TXURN", sc
->debug
.stats
.istats
.txurn
);
222 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
223 "%8s: %10u\n", "MIB", sc
->debug
.stats
.istats
.mib
);
224 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
225 "%8s: %10u\n", "RXPHY", sc
->debug
.stats
.istats
.rxphyerr
);
226 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
227 "%8s: %10u\n", "RXKCM", sc
->debug
.stats
.istats
.rx_keycache_miss
);
228 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
229 "%8s: %10u\n", "SWBA", sc
->debug
.stats
.istats
.swba
);
230 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
231 "%8s: %10u\n", "BMISS", sc
->debug
.stats
.istats
.bmiss
);
232 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
233 "%8s: %10u\n", "BNR", sc
->debug
.stats
.istats
.bnr
);
234 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
235 "%8s: %10u\n", "CST", sc
->debug
.stats
.istats
.cst
);
236 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
237 "%8s: %10u\n", "GTT", sc
->debug
.stats
.istats
.gtt
);
238 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
239 "%8s: %10u\n", "TIM", sc
->debug
.stats
.istats
.tim
);
240 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
241 "%8s: %10u\n", "CABEND", sc
->debug
.stats
.istats
.cabend
);
242 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
243 "%8s: %10u\n", "DTIMSYNC", sc
->debug
.stats
.istats
.dtimsync
);
244 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
245 "%8s: %10u\n", "DTIM", sc
->debug
.stats
.istats
.dtim
);
246 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
247 "%8s: %10u\n", "TOTAL", sc
->debug
.stats
.istats
.total
);
249 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
252 static const struct file_operations fops_interrupt
= {
253 .read
= read_file_interrupt
,
254 .open
= ath9k_debugfs_open
,
258 void ath_debug_stat_rc(struct ath_softc
*sc
, struct sk_buff
*skb
)
260 struct ath_tx_info_priv
*tx_info_priv
= NULL
;
261 struct ieee80211_tx_info
*tx_info
= IEEE80211_SKB_CB(skb
);
262 struct ieee80211_tx_rate
*rates
= tx_info
->status
.rates
;
263 int final_ts_idx
, idx
;
264 struct ath_rc_stats
*stats
;
266 tx_info_priv
= ATH_TX_INFO_PRIV(tx_info
);
267 final_ts_idx
= tx_info_priv
->tx
.ts_rateindex
;
268 idx
= rates
[final_ts_idx
].idx
;
269 stats
= &sc
->debug
.stats
.rcstats
[idx
];
273 void ath_debug_stat_retries(struct ath_softc
*sc
, int rix
,
274 int xretries
, int retries
, u8 per
)
276 struct ath_rc_stats
*stats
= &sc
->debug
.stats
.rcstats
[rix
];
278 stats
->xretries
+= xretries
;
279 stats
->retries
+= retries
;
283 static ssize_t
read_file_rcstat(struct file
*file
, char __user
*user_buf
,
284 size_t count
, loff_t
*ppos
)
286 struct ath_softc
*sc
= file
->private_data
;
288 unsigned int len
= 0, max
;
292 if (sc
->cur_rate_table
== NULL
)
295 max
= 80 + sc
->cur_rate_table
->rate_cnt
* 64;
296 buf
= kmalloc(max
+ 1, GFP_KERNEL
);
301 len
+= sprintf(buf
, "%5s %15s %8s %9s %3s\n\n", "Rate", "Success",
302 "Retries", "XRetries", "PER");
304 for (i
= 0; i
< sc
->cur_rate_table
->rate_cnt
; i
++) {
305 u32 ratekbps
= sc
->cur_rate_table
->info
[i
].ratekbps
;
306 struct ath_rc_stats
*stats
= &sc
->debug
.stats
.rcstats
[i
];
308 len
+= snprintf(buf
+ len
, max
- len
,
309 "%3u.%d: %8u %8u %8u %8u\n", ratekbps
/ 1000,
310 (ratekbps
% 1000) / 100, stats
->success
,
311 stats
->retries
, stats
->xretries
,
315 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
320 static const struct file_operations fops_rcstat
= {
321 .read
= read_file_rcstat
,
322 .open
= ath9k_debugfs_open
,
326 static const char * ath_wiphy_state_str(enum ath_wiphy_state state
)
329 case ATH_WIPHY_INACTIVE
:
331 case ATH_WIPHY_ACTIVE
:
333 case ATH_WIPHY_PAUSING
:
335 case ATH_WIPHY_PAUSED
:
343 static ssize_t
read_file_wiphy(struct file
*file
, char __user
*user_buf
,
344 size_t count
, loff_t
*ppos
)
346 struct ath_softc
*sc
= file
->private_data
;
348 unsigned int len
= 0;
352 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
353 "primary: %s (%s chan=%d ht=%d)\n",
354 wiphy_name(sc
->pri_wiphy
->hw
->wiphy
),
355 ath_wiphy_state_str(sc
->pri_wiphy
->state
),
356 sc
->pri_wiphy
->chan_idx
, sc
->pri_wiphy
->chan_is_ht
);
357 for (i
= 0; i
< sc
->num_sec_wiphy
; i
++) {
358 struct ath_wiphy
*aphy
= sc
->sec_wiphy
[i
];
361 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
362 "secondary: %s (%s chan=%d ht=%d)\n",
363 wiphy_name(aphy
->hw
->wiphy
),
364 ath_wiphy_state_str(aphy
->state
),
365 aphy
->chan_idx
, aphy
->chan_is_ht
);
368 put_unaligned_le32(REG_READ_D(sc
->sc_ah
, AR_STA_ID0
), addr
);
369 put_unaligned_le16(REG_READ_D(sc
->sc_ah
, AR_STA_ID1
) & 0xffff, addr
+ 4);
370 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
371 "addr: %pM\n", addr
);
372 put_unaligned_le32(REG_READ_D(sc
->sc_ah
, AR_BSSMSKL
), addr
);
373 put_unaligned_le16(REG_READ_D(sc
->sc_ah
, AR_BSSMSKU
) & 0xffff, addr
+ 4);
374 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
375 "addrmask: %pM\n", addr
);
377 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
380 static struct ath_wiphy
* get_wiphy(struct ath_softc
*sc
, const char *name
)
383 if (strcmp(name
, wiphy_name(sc
->pri_wiphy
->hw
->wiphy
)) == 0)
384 return sc
->pri_wiphy
;
385 for (i
= 0; i
< sc
->num_sec_wiphy
; i
++) {
386 struct ath_wiphy
*aphy
= sc
->sec_wiphy
[i
];
387 if (aphy
&& strcmp(name
, wiphy_name(aphy
->hw
->wiphy
)) == 0)
393 static int del_wiphy(struct ath_softc
*sc
, const char *name
)
395 struct ath_wiphy
*aphy
= get_wiphy(sc
, name
);
398 return ath9k_wiphy_del(aphy
);
401 static int pause_wiphy(struct ath_softc
*sc
, const char *name
)
403 struct ath_wiphy
*aphy
= get_wiphy(sc
, name
);
406 return ath9k_wiphy_pause(aphy
);
409 static int unpause_wiphy(struct ath_softc
*sc
, const char *name
)
411 struct ath_wiphy
*aphy
= get_wiphy(sc
, name
);
414 return ath9k_wiphy_unpause(aphy
);
417 static int select_wiphy(struct ath_softc
*sc
, const char *name
)
419 struct ath_wiphy
*aphy
= get_wiphy(sc
, name
);
422 return ath9k_wiphy_select(aphy
);
425 static int schedule_wiphy(struct ath_softc
*sc
, const char *msec
)
427 ath9k_wiphy_set_scheduler(sc
, simple_strtoul(msec
, NULL
, 0));
431 static ssize_t
write_file_wiphy(struct file
*file
, const char __user
*user_buf
,
432 size_t count
, loff_t
*ppos
)
434 struct ath_softc
*sc
= file
->private_data
;
438 len
= min(count
, sizeof(buf
) - 1);
439 if (copy_from_user(buf
, user_buf
, len
))
442 if (len
> 0 && buf
[len
- 1] == '\n')
445 if (strncmp(buf
, "add", 3) == 0) {
446 int res
= ath9k_wiphy_add(sc
);
449 } else if (strncmp(buf
, "del=", 4) == 0) {
450 int res
= del_wiphy(sc
, buf
+ 4);
453 } else if (strncmp(buf
, "pause=", 6) == 0) {
454 int res
= pause_wiphy(sc
, buf
+ 6);
457 } else if (strncmp(buf
, "unpause=", 8) == 0) {
458 int res
= unpause_wiphy(sc
, buf
+ 8);
461 } else if (strncmp(buf
, "select=", 7) == 0) {
462 int res
= select_wiphy(sc
, buf
+ 7);
465 } else if (strncmp(buf
, "schedule=", 9) == 0) {
466 int res
= schedule_wiphy(sc
, buf
+ 9);
475 static const struct file_operations fops_wiphy
= {
476 .read
= read_file_wiphy
,
477 .write
= write_file_wiphy
,
478 .open
= ath9k_debugfs_open
,
482 #define PR(str, elem) \
484 len += snprintf(buf + len, size - len, \
485 "%s%13u%11u%10u%10u\n", str, \
486 sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_BE]].elem, \
487 sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_BK]].elem, \
488 sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_VI]].elem, \
489 sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_VO]].elem); \
492 static ssize_t
read_file_xmit(struct file
*file
, char __user
*user_buf
,
493 size_t count
, loff_t
*ppos
)
495 struct ath_softc
*sc
= file
->private_data
;
497 unsigned int len
= 0, size
= 2048;
500 buf
= kzalloc(size
, GFP_KERNEL
);
504 len
+= sprintf(buf
, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO");
506 PR("MPDUs Queued: ", queued
);
507 PR("MPDUs Completed: ", completed
);
508 PR("Aggregates: ", a_aggr
);
509 PR("AMPDUs Queued: ", a_queued
);
510 PR("AMPDUs Completed:", a_completed
);
511 PR("AMPDUs Retried: ", a_retries
);
512 PR("AMPDUs XRetried: ", a_xretries
);
513 PR("FIFO Underrun: ", fifo_underrun
);
514 PR("TXOP Exceeded: ", xtxop
);
515 PR("TXTIMER Expiry: ", timer_exp
);
516 PR("DESC CFG Error: ", desc_cfg_err
);
517 PR("DATA Underrun: ", data_underrun
);
518 PR("DELIM Underrun: ", delim_underrun
);
520 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
526 void ath_debug_stat_tx(struct ath_softc
*sc
, struct ath_txq
*txq
,
529 struct ath_desc
*ds
= bf
->bf_desc
;
531 if (bf_isampdu(bf
)) {
532 if (bf_isxretried(bf
))
533 TX_STAT_INC(txq
->axq_qnum
, a_xretries
);
535 TX_STAT_INC(txq
->axq_qnum
, a_completed
);
537 TX_STAT_INC(txq
->axq_qnum
, completed
);
540 if (ds
->ds_txstat
.ts_status
& ATH9K_TXERR_FIFO
)
541 TX_STAT_INC(txq
->axq_qnum
, fifo_underrun
);
542 if (ds
->ds_txstat
.ts_status
& ATH9K_TXERR_XTXOP
)
543 TX_STAT_INC(txq
->axq_qnum
, xtxop
);
544 if (ds
->ds_txstat
.ts_status
& ATH9K_TXERR_TIMER_EXPIRED
)
545 TX_STAT_INC(txq
->axq_qnum
, timer_exp
);
546 if (ds
->ds_txstat
.ts_flags
& ATH9K_TX_DESC_CFG_ERR
)
547 TX_STAT_INC(txq
->axq_qnum
, desc_cfg_err
);
548 if (ds
->ds_txstat
.ts_flags
& ATH9K_TX_DATA_UNDERRUN
)
549 TX_STAT_INC(txq
->axq_qnum
, data_underrun
);
550 if (ds
->ds_txstat
.ts_flags
& ATH9K_TX_DELIM_UNDERRUN
)
551 TX_STAT_INC(txq
->axq_qnum
, delim_underrun
);
554 static const struct file_operations fops_xmit
= {
555 .read
= read_file_xmit
,
556 .open
= ath9k_debugfs_open
,
560 int ath9k_init_debug(struct ath_hw
*ah
)
562 struct ath_common
*common
= ath9k_hw_common(ah
);
563 struct ath_softc
*sc
= (struct ath_softc
*) common
->priv
;
565 if (!ath9k_debugfs_root
)
568 sc
->debug
.debugfs_phy
= debugfs_create_dir(wiphy_name(sc
->hw
->wiphy
),
570 if (!sc
->debug
.debugfs_phy
)
573 sc
->debug
.debugfs_debug
= debugfs_create_file("debug",
574 S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
, sc
, &fops_debug
);
575 if (!sc
->debug
.debugfs_debug
)
578 sc
->debug
.debugfs_dma
= debugfs_create_file("dma", S_IRUSR
,
579 sc
->debug
.debugfs_phy
, sc
, &fops_dma
);
580 if (!sc
->debug
.debugfs_dma
)
583 sc
->debug
.debugfs_interrupt
= debugfs_create_file("interrupt",
585 sc
->debug
.debugfs_phy
,
586 sc
, &fops_interrupt
);
587 if (!sc
->debug
.debugfs_interrupt
)
590 sc
->debug
.debugfs_rcstat
= debugfs_create_file("rcstat",
592 sc
->debug
.debugfs_phy
,
594 if (!sc
->debug
.debugfs_rcstat
)
597 sc
->debug
.debugfs_wiphy
= debugfs_create_file(
598 "wiphy", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
, sc
,
600 if (!sc
->debug
.debugfs_wiphy
)
603 sc
->debug
.debugfs_xmit
= debugfs_create_file("xmit",
605 sc
->debug
.debugfs_phy
,
607 if (!sc
->debug
.debugfs_xmit
)
612 ath9k_exit_debug(ah
);
616 void ath9k_exit_debug(struct ath_hw
*ah
)
618 struct ath_common
*common
= ath9k_hw_common(ah
);
619 struct ath_softc
*sc
= (struct ath_softc
*) common
->priv
;
621 debugfs_remove(sc
->debug
.debugfs_xmit
);
622 debugfs_remove(sc
->debug
.debugfs_wiphy
);
623 debugfs_remove(sc
->debug
.debugfs_rcstat
);
624 debugfs_remove(sc
->debug
.debugfs_interrupt
);
625 debugfs_remove(sc
->debug
.debugfs_dma
);
626 debugfs_remove(sc
->debug
.debugfs_debug
);
627 debugfs_remove(sc
->debug
.debugfs_phy
);
630 int ath9k_debug_create_root(void)
632 ath9k_debugfs_root
= debugfs_create_dir(KBUILD_MODNAME
, NULL
);
633 if (!ath9k_debugfs_root
)
639 void ath9k_debug_remove_root(void)
641 debugfs_remove(ath9k_debugfs_root
);
642 ath9k_debugfs_root
= NULL
;