aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-04-13 01:56:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-13 15:24:41 -0400
commitfbc29d6c3da58bc51416f65a50bdb419d4ea85b8 (patch)
tree8a79d7a2c238015880358c7ee03b9919dd540abf /drivers
parent821f9414c0546fbc99a999e9dc613d1756e1de8a (diff)
ath9k_htc: Add detailed firmware statistics
New debugfs files: <debugfs_root>/ath9k_htc/<phy#>/tgt_int_stats <debugfs_root>/ath9k_htc/<phy#>/tgt_tx_stats <debugfs_root>/ath9k_htc/<phy#>/tgt_rx_stats Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h36
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c185
-rw-r--r--drivers/net/wireless/ath/ath9k/wmi.c19
-rw-r--r--drivers/net/wireless/ath/ath9k/wmi.h7
4 files changed, 195 insertions, 52 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index b413b46119b0..cc5d0a4b9da2 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -175,12 +175,31 @@ struct ath9k_htc_target_rate {
175 struct ath9k_htc_rate rates; 175 struct ath9k_htc_rate rates;
176}; 176};
177 177
178struct ath9k_htc_target_stats { 178struct ath9k_htc_target_int_stats {
179 __be32 tx_shortretry; 179 __be32 rx;
180 __be32 tx_longretry; 180 __be32 rxorn;
181 __be32 tx_xretries; 181 __be32 rxeol;
182 __be32 ht_txunaggr_xretry; 182 __be32 txurn;
183 __be32 ht_tx_xretries; 183 __be32 txto;
184 __be32 cst;
185} __packed;
186
187struct ath9k_htc_target_tx_stats {
188 __be32 xretries;
189 __be32 fifoerr;
190 __be32 filtered;
191 __be32 timer_exp;
192 __be32 shortretries;
193 __be32 longretries;
194 __be32 qnull;
195 __be32 encap_fail;
196 __be32 nobuf;
197} __packed;
198
199struct ath9k_htc_target_rx_stats {
200 __be32 nobuf;
201 __be32 host_send;
202 __be32 host_done;
184} __packed; 203} __packed;
185 204
186#define ATH9K_HTC_MAX_VIF 2 205#define ATH9K_HTC_MAX_VIF 2
@@ -340,14 +359,15 @@ struct ath_rx_stats {
340 359
341struct ath9k_debug { 360struct ath9k_debug {
342 struct dentry *debugfs_phy; 361 struct dentry *debugfs_phy;
343 struct dentry *debugfs_tgt_stats; 362 struct dentry *debugfs_tgt_int_stats;
363 struct dentry *debugfs_tgt_tx_stats;
364 struct dentry *debugfs_tgt_rx_stats;
344 struct dentry *debugfs_xmit; 365 struct dentry *debugfs_xmit;
345 struct dentry *debugfs_recv; 366 struct dentry *debugfs_recv;
346 struct dentry *debugfs_slot; 367 struct dentry *debugfs_slot;
347 struct dentry *debugfs_queue; 368 struct dentry *debugfs_queue;
348 struct ath_tx_stats tx_stats; 369 struct ath_tx_stats tx_stats;
349 struct ath_rx_stats rx_stats; 370 struct ath_rx_stats rx_stats;
350 u32 txrate;
351}; 371};
352 372
353#else 373#else
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index 961bec20d140..8d0de60e0c27 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -24,39 +24,108 @@ static int ath9k_debugfs_open(struct inode *inode, struct file *file)
24 return 0; 24 return 0;
25} 25}
26 26
27static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, 27static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf,
28 size_t count, loff_t *ppos) 28 size_t count, loff_t *ppos)
29{ 29{
30 struct ath9k_htc_priv *priv = file->private_data; 30 struct ath9k_htc_priv *priv = file->private_data;
31 struct ath9k_htc_target_stats cmd_rsp; 31 struct ath9k_htc_target_int_stats cmd_rsp;
32 char buf[512]; 32 char buf[512];
33 unsigned int len = 0; 33 unsigned int len = 0;
34 int ret = 0; 34 int ret = 0;
35 35
36 memset(&cmd_rsp, 0, sizeof(cmd_rsp)); 36 memset(&cmd_rsp, 0, sizeof(cmd_rsp));
37 37
38 WMI_CMD(WMI_TGT_STATS_CMDID); 38 WMI_CMD(WMI_INT_STATS_CMDID);
39 if (ret) 39 if (ret)
40 return -EINVAL; 40 return -EINVAL;
41 41
42 len += snprintf(buf + len, sizeof(buf) - len,
43 "%20s : %10u\n", "RX",
44 be32_to_cpu(cmd_rsp.rx));
45
46 len += snprintf(buf + len, sizeof(buf) - len,
47 "%20s : %10u\n", "RXORN",
48 be32_to_cpu(cmd_rsp.rxorn));
49
50 len += snprintf(buf + len, sizeof(buf) - len,
51 "%20s : %10u\n", "RXEOL",
52 be32_to_cpu(cmd_rsp.rxeol));
53
54 len += snprintf(buf + len, sizeof(buf) - len,
55 "%20s : %10u\n", "TXURN",
56 be32_to_cpu(cmd_rsp.txurn));
57
58 len += snprintf(buf + len, sizeof(buf) - len,
59 "%20s : %10u\n", "TXTO",
60 be32_to_cpu(cmd_rsp.txto));
61
62 len += snprintf(buf + len, sizeof(buf) - len,
63 "%20s : %10u\n", "CST",
64 be32_to_cpu(cmd_rsp.cst));
65
66 if (len > sizeof(buf))
67 len = sizeof(buf);
68
69 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
70}
71
72static const struct file_operations fops_tgt_int_stats = {
73 .read = read_file_tgt_int_stats,
74 .open = ath9k_debugfs_open,
75 .owner = THIS_MODULE,
76 .llseek = default_llseek,
77};
78
79static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf,
80 size_t count, loff_t *ppos)
81{
82 struct ath9k_htc_priv *priv = file->private_data;
83 struct ath9k_htc_target_tx_stats cmd_rsp;
84 char buf[512];
85 unsigned int len = 0;
86 int ret = 0;
87
88 memset(&cmd_rsp, 0, sizeof(cmd_rsp));
89
90 WMI_CMD(WMI_TX_STATS_CMDID);
91 if (ret)
92 return -EINVAL;
93
94 len += snprintf(buf + len, sizeof(buf) - len,
95 "%20s : %10u\n", "Xretries",
96 be32_to_cpu(cmd_rsp.xretries));
97
98 len += snprintf(buf + len, sizeof(buf) - len,
99 "%20s : %10u\n", "FifoErr",
100 be32_to_cpu(cmd_rsp.fifoerr));
101
102 len += snprintf(buf + len, sizeof(buf) - len,
103 "%20s : %10u\n", "Filtered",
104 be32_to_cpu(cmd_rsp.filtered));
42 105
43 len += snprintf(buf + len, sizeof(buf) - len, 106 len += snprintf(buf + len, sizeof(buf) - len,
44 "%19s : %10u\n", "TX Short Retries", 107 "%20s : %10u\n", "TimerExp",
45 be32_to_cpu(cmd_rsp.tx_shortretry)); 108 be32_to_cpu(cmd_rsp.timer_exp));
109
46 len += snprintf(buf + len, sizeof(buf) - len, 110 len += snprintf(buf + len, sizeof(buf) - len,
47 "%19s : %10u\n", "TX Long Retries", 111 "%20s : %10u\n", "ShortRetries",
48 be32_to_cpu(cmd_rsp.tx_longretry)); 112 be32_to_cpu(cmd_rsp.shortretries));
113
49 len += snprintf(buf + len, sizeof(buf) - len, 114 len += snprintf(buf + len, sizeof(buf) - len,
50 "%19s : %10u\n", "TX Xretries", 115 "%20s : %10u\n", "LongRetries",
51 be32_to_cpu(cmd_rsp.tx_xretries)); 116 be32_to_cpu(cmd_rsp.longretries));
117
52 len += snprintf(buf + len, sizeof(buf) - len, 118 len += snprintf(buf + len, sizeof(buf) - len,
53 "%19s : %10u\n", "TX Unaggr. Xretries", 119 "%20s : %10u\n", "QueueNull",
54 be32_to_cpu(cmd_rsp.ht_txunaggr_xretry)); 120 be32_to_cpu(cmd_rsp.qnull));
121
55 len += snprintf(buf + len, sizeof(buf) - len, 122 len += snprintf(buf + len, sizeof(buf) - len,
56 "%19s : %10u\n", "TX Xretries (HT)", 123 "%20s : %10u\n", "EncapFail",
57 be32_to_cpu(cmd_rsp.ht_tx_xretries)); 124 be32_to_cpu(cmd_rsp.encap_fail));
125
58 len += snprintf(buf + len, sizeof(buf) - len, 126 len += snprintf(buf + len, sizeof(buf) - len,
59 "%19s : %10u\n", "TX Rate", priv->debug.txrate); 127 "%20s : %10u\n", "NoBuf",
128 be32_to_cpu(cmd_rsp.nobuf));
60 129
61 if (len > sizeof(buf)) 130 if (len > sizeof(buf))
62 len = sizeof(buf); 131 len = sizeof(buf);
@@ -64,8 +133,48 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
64 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 133 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
65} 134}
66 135
67static const struct file_operations fops_tgt_stats = { 136static const struct file_operations fops_tgt_tx_stats = {
68 .read = read_file_tgt_stats, 137 .read = read_file_tgt_tx_stats,
138 .open = ath9k_debugfs_open,
139 .owner = THIS_MODULE,
140 .llseek = default_llseek,
141};
142
143static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf,
144 size_t count, loff_t *ppos)
145{
146 struct ath9k_htc_priv *priv = file->private_data;
147 struct ath9k_htc_target_rx_stats cmd_rsp;
148 char buf[512];
149 unsigned int len = 0;
150 int ret = 0;
151
152 memset(&cmd_rsp, 0, sizeof(cmd_rsp));
153
154 WMI_CMD(WMI_RX_STATS_CMDID);
155 if (ret)
156 return -EINVAL;
157
158 len += snprintf(buf + len, sizeof(buf) - len,
159 "%20s : %10u\n", "NoBuf",
160 be32_to_cpu(cmd_rsp.nobuf));
161
162 len += snprintf(buf + len, sizeof(buf) - len,
163 "%20s : %10u\n", "HostSend",
164 be32_to_cpu(cmd_rsp.host_send));
165
166 len += snprintf(buf + len, sizeof(buf) - len,
167 "%20s : %10u\n", "HostDone",
168 be32_to_cpu(cmd_rsp.host_done));
169
170 if (len > sizeof(buf))
171 len = sizeof(buf);
172
173 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
174}
175
176static const struct file_operations fops_tgt_rx_stats = {
177 .read = read_file_tgt_rx_stats,
69 .open = ath9k_debugfs_open, 178 .open = ath9k_debugfs_open,
70 .owner = THIS_MODULE, 179 .owner = THIS_MODULE,
71 .llseek = default_llseek, 180 .llseek = default_llseek,
@@ -286,29 +395,29 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
286 char buf[512]; 395 char buf[512];
287 unsigned int len = 0; 396 unsigned int len = 0;
288 397
289 len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n", 398 len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
290 "Mgmt endpoint", skb_queue_len(&priv->tx.mgmt_ep_queue)); 399 "Mgmt endpoint", skb_queue_len(&priv->tx.mgmt_ep_queue));
291 400
292 len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n", 401 len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
293 "Cab endpoint", skb_queue_len(&priv->tx.cab_ep_queue)); 402 "Cab endpoint", skb_queue_len(&priv->tx.cab_ep_queue));
294 403
295 len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n", 404 len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
296 "Data BE endpoint", skb_queue_len(&priv->tx.data_be_queue)); 405 "Data BE endpoint", skb_queue_len(&priv->tx.data_be_queue));
297 406
298 len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n", 407 len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
299 "Data BK endpoint", skb_queue_len(&priv->tx.data_bk_queue)); 408 "Data BK endpoint", skb_queue_len(&priv->tx.data_bk_queue));
300 409
301 len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n", 410 len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
302 "Data VI endpoint", skb_queue_len(&priv->tx.data_vi_queue)); 411 "Data VI endpoint", skb_queue_len(&priv->tx.data_vi_queue));
303 412
304 len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n", 413 len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
305 "Data VO endpoint", skb_queue_len(&priv->tx.data_vo_queue)); 414 "Data VO endpoint", skb_queue_len(&priv->tx.data_vo_queue));
306 415
307 len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n", 416 len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
308 "Failed queue", skb_queue_len(&priv->tx.tx_failed)); 417 "Failed queue", skb_queue_len(&priv->tx.tx_failed));
309 418
310 spin_lock_bh(&priv->tx.tx_lock); 419 spin_lock_bh(&priv->tx.tx_lock);
311 len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n", 420 len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
312 "Queued count", priv->tx.queued_cnt); 421 "Queued count", priv->tx.queued_cnt);
313 spin_unlock_bh(&priv->tx.tx_lock); 422 spin_unlock_bh(&priv->tx.tx_lock);
314 423
@@ -339,12 +448,26 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
339 if (!priv->debug.debugfs_phy) 448 if (!priv->debug.debugfs_phy)
340 goto err; 449 goto err;
341 450
342 priv->debug.debugfs_tgt_stats = debugfs_create_file("tgt_stats", S_IRUSR, 451 priv->debug.debugfs_tgt_int_stats = debugfs_create_file("tgt_int_stats",
343 priv->debug.debugfs_phy, 452 S_IRUSR,
344 priv, &fops_tgt_stats); 453 priv->debug.debugfs_phy,
345 if (!priv->debug.debugfs_tgt_stats) 454 priv, &fops_tgt_int_stats);
455 if (!priv->debug.debugfs_tgt_int_stats)
346 goto err; 456 goto err;
347 457
458 priv->debug.debugfs_tgt_tx_stats = debugfs_create_file("tgt_tx_stats",
459 S_IRUSR,
460 priv->debug.debugfs_phy,
461 priv, &fops_tgt_tx_stats);
462 if (!priv->debug.debugfs_tgt_tx_stats)
463 goto err;
464
465 priv->debug.debugfs_tgt_rx_stats = debugfs_create_file("tgt_rx_stats",
466 S_IRUSR,
467 priv->debug.debugfs_phy,
468 priv, &fops_tgt_rx_stats);
469 if (!priv->debug.debugfs_tgt_rx_stats)
470 goto err;
348 471
349 priv->debug.debugfs_xmit = debugfs_create_file("xmit", S_IRUSR, 472 priv->debug.debugfs_xmit = debugfs_create_file("xmit", S_IRUSR,
350 priv->debug.debugfs_phy, 473 priv->debug.debugfs_phy,
@@ -386,7 +509,9 @@ void ath9k_htc_exit_debug(struct ath_hw *ah)
386 debugfs_remove(priv->debug.debugfs_slot); 509 debugfs_remove(priv->debug.debugfs_slot);
387 debugfs_remove(priv->debug.debugfs_recv); 510 debugfs_remove(priv->debug.debugfs_recv);
388 debugfs_remove(priv->debug.debugfs_xmit); 511 debugfs_remove(priv->debug.debugfs_xmit);
389 debugfs_remove(priv->debug.debugfs_tgt_stats); 512 debugfs_remove(priv->debug.debugfs_tgt_int_stats);
513 debugfs_remove(priv->debug.debugfs_tgt_tx_stats);
514 debugfs_remove(priv->debug.debugfs_tgt_rx_stats);
390 debugfs_remove(priv->debug.debugfs_phy); 515 debugfs_remove(priv->debug.debugfs_phy);
391} 516}
392 517
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index 697e5af842c1..8f095ad0a3db 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -67,12 +67,18 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
67 return "WMI_RC_RATE_UPDATE_CMDID"; 67 return "WMI_RC_RATE_UPDATE_CMDID";
68 case WMI_TARGET_IC_UPDATE_CMDID: 68 case WMI_TARGET_IC_UPDATE_CMDID:
69 return "WMI_TARGET_IC_UPDATE_CMDID"; 69 return "WMI_TARGET_IC_UPDATE_CMDID";
70 case WMI_TGT_STATS_CMDID:
71 return "WMI_TGT_STATS_CMDID";
72 case WMI_TX_AGGR_ENABLE_CMDID: 70 case WMI_TX_AGGR_ENABLE_CMDID:
73 return "WMI_TX_AGGR_ENABLE_CMDID"; 71 return "WMI_TX_AGGR_ENABLE_CMDID";
74 case WMI_TGT_DETACH_CMDID: 72 case WMI_TGT_DETACH_CMDID:
75 return "WMI_TGT_DETACH_CMDID"; 73 return "WMI_TGT_DETACH_CMDID";
74 case WMI_NODE_UPDATE_CMDID:
75 return "WMI_NODE_UPDATE_CMDID";
76 case WMI_INT_STATS_CMDID:
77 return "WMI_INT_STATS_CMDID";
78 case WMI_TX_STATS_CMDID:
79 return "WMI_TX_STATS_CMDID";
80 case WMI_RX_STATS_CMDID:
81 return "WMI_RX_STATS_CMDID";
76 case WMI_AGGR_LIMIT_CMD: 82 case WMI_AGGR_LIMIT_CMD:
77 return "WMI_AGGR_LIMIT_CMD"; 83 return "WMI_AGGR_LIMIT_CMD";
78 } 84 }
@@ -134,9 +140,6 @@ void ath9k_wmi_event_tasklet(unsigned long data)
134 struct sk_buff *skb = NULL; 140 struct sk_buff *skb = NULL;
135 unsigned long flags; 141 unsigned long flags;
136 u16 cmd_id; 142 u16 cmd_id;
137#ifdef CONFIG_ATH9K_HTC_DEBUGFS
138 __be32 txrate;
139#endif
140 143
141 do { 144 do {
142 spin_lock_irqsave(&wmi->wmi_lock, flags); 145 spin_lock_irqsave(&wmi->wmi_lock, flags);
@@ -160,12 +163,6 @@ void ath9k_wmi_event_tasklet(unsigned long data)
160 ieee80211_queue_work(wmi->drv_priv->hw, 163 ieee80211_queue_work(wmi->drv_priv->hw,
161 &wmi->drv_priv->fatal_work); 164 &wmi->drv_priv->fatal_work);
162 break; 165 break;
163 case WMI_TXRATE_EVENTID:
164#ifdef CONFIG_ATH9K_HTC_DEBUGFS
165 txrate = ((struct wmi_event_txrate *)wmi_event)->txrate;
166 wmi->drv_priv->debug.txrate = be32_to_cpu(txrate);
167#endif
168 break;
169 case WMI_TXSTATUS_EVENTID: 166 case WMI_TXSTATUS_EVENTID:
170 spin_lock_bh(&priv->tx.tx_lock); 167 spin_lock_bh(&priv->tx.tx_lock);
171 if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) { 168 if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) {
diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/ath/ath9k/wmi.h
index 310d94eaed19..02ecb9f06db0 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.h
+++ b/drivers/net/wireless/ath/ath9k/wmi.h
@@ -17,7 +17,6 @@
17#ifndef WMI_H 17#ifndef WMI_H
18#define WMI_H 18#define WMI_H
19 19
20
21struct wmi_event_txrate { 20struct wmi_event_txrate {
22 __be32 txrate; 21 __be32 txrate;
23 struct { 22 struct {
@@ -106,9 +105,12 @@ enum wmi_cmd_id {
106 WMI_RC_STATE_CHANGE_CMDID, 105 WMI_RC_STATE_CHANGE_CMDID,
107 WMI_RC_RATE_UPDATE_CMDID, 106 WMI_RC_RATE_UPDATE_CMDID,
108 WMI_TARGET_IC_UPDATE_CMDID, 107 WMI_TARGET_IC_UPDATE_CMDID,
109 WMI_TGT_STATS_CMDID,
110 WMI_TX_AGGR_ENABLE_CMDID, 108 WMI_TX_AGGR_ENABLE_CMDID,
111 WMI_TGT_DETACH_CMDID, 109 WMI_TGT_DETACH_CMDID,
110 WMI_NODE_UPDATE_CMDID,
111 WMI_INT_STATS_CMDID,
112 WMI_TX_STATS_CMDID,
113 WMI_RX_STATS_CMDID,
112 WMI_AGGR_LIMIT_CMD = 0x0026, 114 WMI_AGGR_LIMIT_CMD = 0x0026,
113}; 115};
114 116
@@ -119,7 +121,6 @@ enum wmi_event_id {
119 WMI_TXTO_EVENTID, 121 WMI_TXTO_EVENTID,
120 WMI_BMISS_EVENTID, 122 WMI_BMISS_EVENTID,
121 WMI_DELBA_EVENTID, 123 WMI_DELBA_EVENTID,
122 WMI_TXRATE_EVENTID,
123 WMI_TXSTATUS_EVENTID, 124 WMI_TXSTATUS_EVENTID,
124}; 125};
125 126