19 static ssize_t read_file_tgt_int_stats(
struct file *
file,
char __user *user_buf,
20 size_t count, loff_t *ppos)
40 len +=
snprintf(buf + len,
sizeof(buf) - len,
41 "%20s : %10u\n",
"RX",
44 len +=
snprintf(buf + len,
sizeof(buf) - len,
45 "%20s : %10u\n",
"RXORN",
48 len +=
snprintf(buf + len,
sizeof(buf) - len,
49 "%20s : %10u\n",
"RXEOL",
52 len +=
snprintf(buf + len,
sizeof(buf) - len,
53 "%20s : %10u\n",
"TXURN",
56 len +=
snprintf(buf + len,
sizeof(buf) - len,
57 "%20s : %10u\n",
"TXTO",
60 len +=
snprintf(buf + len,
sizeof(buf) - len,
61 "%20s : %10u\n",
"CST",
64 if (len >
sizeof(buf))
71 .read = read_file_tgt_int_stats,
77 static ssize_t read_file_tgt_tx_stats(
struct file *file,
char __user *user_buf,
78 size_t count, loff_t *ppos)
98 len +=
snprintf(buf + len,
sizeof(buf) - len,
99 "%20s : %10u\n",
"Xretries",
102 len +=
snprintf(buf + len,
sizeof(buf) - len,
103 "%20s : %10u\n",
"FifoErr",
106 len +=
snprintf(buf + len,
sizeof(buf) - len,
107 "%20s : %10u\n",
"Filtered",
110 len +=
snprintf(buf + len,
sizeof(buf) - len,
111 "%20s : %10u\n",
"TimerExp",
114 len +=
snprintf(buf + len,
sizeof(buf) - len,
115 "%20s : %10u\n",
"ShortRetries",
118 len +=
snprintf(buf + len,
sizeof(buf) - len,
119 "%20s : %10u\n",
"LongRetries",
122 len +=
snprintf(buf + len,
sizeof(buf) - len,
123 "%20s : %10u\n",
"QueueNull",
126 len +=
snprintf(buf + len,
sizeof(buf) - len,
127 "%20s : %10u\n",
"EncapFail",
130 len +=
snprintf(buf + len,
sizeof(buf) - len,
131 "%20s : %10u\n",
"NoBuf",
134 if (len >
sizeof(buf))
141 .read = read_file_tgt_tx_stats,
147 static ssize_t read_file_tgt_rx_stats(
struct file *file,
char __user *user_buf,
148 size_t count, loff_t *ppos)
153 unsigned int len = 0;
168 len +=
snprintf(buf + len,
sizeof(buf) - len,
169 "%20s : %10u\n",
"NoBuf",
172 len +=
snprintf(buf + len,
sizeof(buf) - len,
173 "%20s : %10u\n",
"HostSend",
176 len +=
snprintf(buf + len,
sizeof(buf) - len,
177 "%20s : %10u\n",
"HostDone",
180 if (len >
sizeof(buf))
187 .read = read_file_tgt_rx_stats,
193 static ssize_t read_file_xmit(
struct file *file,
char __user *user_buf,
194 size_t count, loff_t *ppos)
198 unsigned int len = 0;
200 len +=
snprintf(buf + len,
sizeof(buf) - len,
201 "%20s : %10u\n",
"Buffers queued",
202 priv->debug.tx_stats.buf_queued);
203 len +=
snprintf(buf + len,
sizeof(buf) - len,
204 "%20s : %10u\n",
"Buffers completed",
205 priv->debug.tx_stats.buf_completed);
206 len +=
snprintf(buf + len,
sizeof(buf) - len,
207 "%20s : %10u\n",
"SKBs queued",
208 priv->debug.tx_stats.skb_queued);
209 len +=
snprintf(buf + len,
sizeof(buf) - len,
210 "%20s : %10u\n",
"SKBs success",
211 priv->debug.tx_stats.skb_success);
212 len +=
snprintf(buf + len,
sizeof(buf) - len,
213 "%20s : %10u\n",
"SKBs failed",
214 priv->debug.tx_stats.skb_failed);
215 len +=
snprintf(buf + len,
sizeof(buf) - len,
216 "%20s : %10u\n",
"CAB queued",
217 priv->debug.tx_stats.cab_queued);
219 len +=
snprintf(buf + len,
sizeof(buf) - len,
220 "%20s : %10u\n",
"BE queued",
221 priv->debug.tx_stats.queue_stats[
WME_AC_BE]);
222 len +=
snprintf(buf + len,
sizeof(buf) - len,
223 "%20s : %10u\n",
"BK queued",
224 priv->debug.tx_stats.queue_stats[
WME_AC_BK]);
225 len +=
snprintf(buf + len,
sizeof(buf) - len,
226 "%20s : %10u\n",
"VI queued",
227 priv->debug.tx_stats.queue_stats[
WME_AC_VI]);
228 len +=
snprintf(buf + len,
sizeof(buf) - len,
229 "%20s : %10u\n",
"VO queued",
230 priv->debug.tx_stats.queue_stats[
WME_AC_VO]);
232 if (len >
sizeof(buf))
239 .read = read_file_xmit,
248 #define RX_PHY_ERR_INC(c) priv->debug.rx_stats.err_phy_stats[c]++
251 priv->debug.rx_stats.err_crc++;
253 priv->debug.rx_stats.err_decrypt_crc++;
255 priv->debug.rx_stats.err_mic++;
257 priv->debug.rx_stats.err_pre_delim++;
259 priv->debug.rx_stats.err_post_delim++;
261 priv->debug.rx_stats.err_decrypt_busy++;
264 priv->debug.rx_stats.err_phy++;
269 #undef RX_PHY_ERR_INC
272 static ssize_t read_file_recv(
struct file *file,
char __user *user_buf,
273 size_t count, loff_t *ppos)
275 #define PHY_ERR(s, p) \
276 len += snprintf(buf + len, size - len, "%20s : %10u\n", s, \
277 priv->debug.rx_stats.err_phy_stats[p]);
281 unsigned int len = 0,
size = 1500;
289 "%20s : %10u\n",
"SKBs allocated",
290 priv->debug.rx_stats.skb_allocated);
292 "%20s : %10u\n",
"SKBs completed",
293 priv->debug.rx_stats.skb_completed);
295 "%20s : %10u\n",
"SKBs Dropped",
296 priv->debug.rx_stats.skb_dropped);
299 "%20s : %10u\n",
"CRC ERR",
300 priv->debug.rx_stats.err_crc);
302 "%20s : %10u\n",
"DECRYPT CRC ERR",
303 priv->debug.rx_stats.err_decrypt_crc);
305 "%20s : %10u\n",
"MIC ERR",
306 priv->debug.rx_stats.err_mic);
308 "%20s : %10u\n",
"PRE-DELIM CRC ERR",
309 priv->debug.rx_stats.err_pre_delim);
311 "%20s : %10u\n",
"POST-DELIM CRC ERR",
312 priv->debug.rx_stats.err_post_delim);
314 "%20s : %10u\n",
"DECRYPT BUSY ERR",
315 priv->debug.rx_stats.err_decrypt_busy);
317 "%20s : %10u\n",
"TOTAL PHY ERR",
318 priv->debug.rx_stats.err_phy);
360 .read = read_file_recv,
366 static ssize_t read_file_slot(
struct file *file,
char __user *user_buf,
367 size_t count, loff_t *ppos)
371 unsigned int len = 0;
373 spin_lock_bh(&priv->
tx.tx_lock);
375 len +=
snprintf(buf + len,
sizeof(buf) - len,
"TX slot bitmap : ");
380 len +=
snprintf(buf + len,
sizeof(buf) - len,
"\n");
382 len +=
snprintf(buf + len,
sizeof(buf) - len,
386 spin_unlock_bh(&priv->
tx.tx_lock);
388 if (len >
sizeof(buf))
395 .read = read_file_slot,
401 static ssize_t read_file_queue(
struct file *file,
char __user *user_buf,
402 size_t count, loff_t *ppos)
406 unsigned int len = 0;
408 len +=
snprintf(buf + len,
sizeof(buf) - len,
"%20s : %10u\n",
409 "Mgmt endpoint", skb_queue_len(&priv->
tx.mgmt_ep_queue));
411 len +=
snprintf(buf + len,
sizeof(buf) - len,
"%20s : %10u\n",
412 "Cab endpoint", skb_queue_len(&priv->
tx.cab_ep_queue));
414 len +=
snprintf(buf + len,
sizeof(buf) - len,
"%20s : %10u\n",
415 "Data BE endpoint", skb_queue_len(&priv->
tx.data_be_queue));
417 len +=
snprintf(buf + len,
sizeof(buf) - len,
"%20s : %10u\n",
418 "Data BK endpoint", skb_queue_len(&priv->
tx.data_bk_queue));
420 len +=
snprintf(buf + len,
sizeof(buf) - len,
"%20s : %10u\n",
421 "Data VI endpoint", skb_queue_len(&priv->
tx.data_vi_queue));
423 len +=
snprintf(buf + len,
sizeof(buf) - len,
"%20s : %10u\n",
424 "Data VO endpoint", skb_queue_len(&priv->
tx.data_vo_queue));
426 len +=
snprintf(buf + len,
sizeof(buf) - len,
"%20s : %10u\n",
427 "Failed queue", skb_queue_len(&priv->
tx.tx_failed));
429 spin_lock_bh(&priv->
tx.tx_lock);
430 len +=
snprintf(buf + len,
sizeof(buf) - len,
"%20s : %10u\n",
431 "Queued count", priv->
tx.queued_cnt);
432 spin_unlock_bh(&priv->
tx.tx_lock);
434 if (len >
sizeof(buf))
442 .read = read_file_queue,
448 static ssize_t read_file_debug(
struct file *file,
char __user *user_buf,
449 size_t count, loff_t *ppos)
460 static ssize_t write_file_debug(
struct file *file,
const char __user *user_buf,
461 size_t count, loff_t *ppos)
469 len =
min(count,
sizeof(buf) - 1);
482 .read = read_file_debug,
483 .write = write_file_debug,
489 static ssize_t read_file_base_eeprom(
struct file *file,
char __user *user_buf,
490 size_t count, loff_t *ppos)
495 unsigned int len = 0,
size = 1500;
507 &priv->
ah->eeprom.map4k.baseEepHeader;
510 &priv->
ah->eeprom.def.baseEepHeader;
513 &priv->
ah->eeprom.map9287.baseEepHeader;
516 ath_err(common,
"Unknown EEPROM type\n");
525 "%20s : %10d\n",
"Major Version",
528 "%20s : %10d\n",
"Minor Version",
531 "%20s : %10d\n",
"Checksum",
534 "%20s : %10d\n",
"Length",
537 "%20s : %10d\n",
"RegDomain1",
540 "%20s : %10d\n",
"RegDomain2",
544 "TX Mask", pBase->
txMask);
547 "RX Mask", pBase->
rxMask);
594 &priv->
ah->eeprom.map4k.baseEepHeader;
607 &priv->
ah->eeprom.map9287.baseEepHeader;
611 "Power Table Offset",
616 "OpenLoop Power Ctrl",
620 len +=
snprintf(buf + len,
size - len,
"%20s : %pM\n",
"MacAddress",
632 .read = read_file_base_eeprom,
638 static ssize_t read_4k_modal_eeprom(
struct file *file,
639 char __user *user_buf,
640 size_t count, loff_t *ppos)
642 #define PR_EEP(_s, _val) \
644 len += snprintf(buf + len, size - len, "%20s : %10d\n", \
650 unsigned int len = 0,
size = 2048;
717 static ssize_t read_def_modal_eeprom(
struct file *file,
718 char __user *user_buf,
719 size_t count, loff_t *ppos)
721 #define PR_EEP(_s, _val) \
723 if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \
724 pModal = &priv->ah->eeprom.def.modalHeader[1]; \
725 len += snprintf(buf + len, size - len, "%20s : %8d%7s", \
728 if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \
729 pModal = &priv->ah->eeprom.def.modalHeader[0]; \
730 len += snprintf(buf + len, size - len, "%9d\n", \
738 unsigned int len = 0,
size = 3500;
747 "%31s %15s\n",
"2G",
"5G");
749 "%32s %16s\n",
"====",
"====\n");
786 PR_EEP(
"Chain0 OutputBias", pModal->
ob);
787 PR_EEP(
"Chain0 DriverBias", pModal->
db);
825 static ssize_t read_9287_modal_eeprom(
struct file *file,
826 char __user *user_buf,
827 size_t count, loff_t *ppos)
829 #define PR_EEP(_s, _val) \
831 len += snprintf(buf + len, size - len, "%20s : %10d\n", \
837 unsigned int len = 0,
size = 3000;
897 static ssize_t read_file_modal_eeprom(
struct file *file,
char __user *user_buf,
898 size_t count, loff_t *ppos)
903 return read_4k_modal_eeprom(file, user_buf, count, ppos);
905 return read_def_modal_eeprom(file, user_buf, count, ppos);
907 return read_9287_modal_eeprom(file, user_buf, count, ppos);
913 .read = read_file_modal_eeprom,
921 struct ath_common *common = ath9k_hw_common(ah);
925 priv->
hw->wiphy->debugfsdir);
926 if (!priv->debug.debugfs_phy)
930 priv, &fops_tgt_int_stats);
932 priv, &fops_tgt_tx_stats);
934 priv, &fops_tgt_rx_stats);
946 priv, &fops_base_eeprom);
948 priv, &fops_modal_eeprom);