aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-04-13 01:56:26 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-13 15:24:23 -0400
commit01f684de7cc0641a9ee968f2d2c45c3a67241252 (patch)
tree531e76a1ae8239bc15bedaa39f28a46dd482d12f /drivers/net/wireless/ath/ath9k
parent27876a29de221186c9d5883e5fe5f6da18ef9a45 (diff)
ath9k_htc: Add a debugfs file to dump TX slot information
Location: ath9k_htc/phy#/slot Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c42
2 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 6c103edf890a..b9c7bec9dd45 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -338,6 +338,7 @@ struct ath9k_debug {
338 struct dentry *debugfs_tgt_stats; 338 struct dentry *debugfs_tgt_stats;
339 struct dentry *debugfs_xmit; 339 struct dentry *debugfs_xmit;
340 struct dentry *debugfs_recv; 340 struct dentry *debugfs_recv;
341 struct dentry *debugfs_slot;
341 struct ath_tx_stats tx_stats; 342 struct ath_tx_stats tx_stats;
342 struct ath_rx_stats rx_stats; 343 struct ath_rx_stats rx_stats;
343 u32 txrate; 344 u32 txrate;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index 91a486cca32a..119cc544cea0 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -244,6 +244,41 @@ static const struct file_operations fops_recv = {
244 .llseek = default_llseek, 244 .llseek = default_llseek,
245}; 245};
246 246
247static ssize_t read_file_slot(struct file *file, char __user *user_buf,
248 size_t count, loff_t *ppos)
249{
250 struct ath9k_htc_priv *priv = file->private_data;
251 char buf[512];
252 unsigned int len = 0;
253
254 spin_lock_bh(&priv->tx.tx_lock);
255
256 len += snprintf(buf + len, sizeof(buf) - len, "TX slot bitmap : ");
257
258 len += bitmap_scnprintf(buf + len, sizeof(buf) - len,
259 priv->tx.tx_slot, MAX_TX_BUF_NUM);
260
261 len += snprintf(buf + len, sizeof(buf) - len, "\n");
262
263 len += snprintf(buf + len, sizeof(buf) - len,
264 "Used slots : %d\n",
265 bitmap_weight(priv->tx.tx_slot, MAX_TX_BUF_NUM));
266
267 spin_unlock_bh(&priv->tx.tx_lock);
268
269 if (len > sizeof(buf))
270 len = sizeof(buf);
271
272 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
273}
274
275static const struct file_operations fops_slot = {
276 .read = read_file_slot,
277 .open = ath9k_debugfs_open,
278 .owner = THIS_MODULE,
279 .llseek = default_llseek,
280};
281
247int ath9k_htc_init_debug(struct ath_hw *ah) 282int ath9k_htc_init_debug(struct ath_hw *ah)
248{ 283{
249 struct ath_common *common = ath9k_hw_common(ah); 284 struct ath_common *common = ath9k_hw_common(ah);
@@ -276,6 +311,12 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
276 if (!priv->debug.debugfs_recv) 311 if (!priv->debug.debugfs_recv)
277 goto err; 312 goto err;
278 313
314 priv->debug.debugfs_slot = debugfs_create_file("slot", S_IRUSR,
315 priv->debug.debugfs_phy,
316 priv, &fops_slot);
317 if (!priv->debug.debugfs_slot)
318 goto err;
319
279 return 0; 320 return 0;
280 321
281err: 322err:
@@ -288,6 +329,7 @@ void ath9k_htc_exit_debug(struct ath_hw *ah)
288 struct ath_common *common = ath9k_hw_common(ah); 329 struct ath_common *common = ath9k_hw_common(ah);
289 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; 330 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
290 331
332 debugfs_remove(priv->debug.debugfs_slot);
291 debugfs_remove(priv->debug.debugfs_recv); 333 debugfs_remove(priv->debug.debugfs_recv);
292 debugfs_remove(priv->debug.debugfs_xmit); 334 debugfs_remove(priv->debug.debugfs_xmit);
293 debugfs_remove(priv->debug.debugfs_tgt_stats); 335 debugfs_remove(priv->debug.debugfs_tgt_stats);