aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/htc_drv_debug.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c42
1 files changed, 42 insertions, 0 deletions
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);