aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-04-13 11:26:26 +0530
committerJohn W. Linville <linville@tuxdriver.com>2011-04-13 15:24:23 -0400
commit01f684de7cc0641a9ee968f2d2c45c3a67241252 (patch)
tree531e76a1ae8239bc15bedaa39f28a46dd482d12f
parent27876a29de221186c9d5883e5fe5f6da18ef9a45 (diff)
downloadkernel_samsung_smdk4412-01f684de7cc0641a9ee968f2d2c45c3a67241252.zip
kernel_samsung_smdk4412-01f684de7cc0641a9ee968f2d2c45c3a67241252.tar.gz
kernel_samsung_smdk4412-01f684de7cc0641a9ee968f2d2c45c3a67241252.tar.bz2
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>
-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 6c103ed..b9c7bec 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -338,6 +338,7 @@ struct ath9k_debug {
struct dentry *debugfs_tgt_stats;
struct dentry *debugfs_xmit;
struct dentry *debugfs_recv;
+ struct dentry *debugfs_slot;
struct ath_tx_stats tx_stats;
struct ath_rx_stats rx_stats;
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 91a486c..119cc54 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 = {
.llseek = default_llseek,
};
+static ssize_t read_file_slot(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ char buf[512];
+ unsigned int len = 0;
+
+ spin_lock_bh(&priv->tx.tx_lock);
+
+ len += snprintf(buf + len, sizeof(buf) - len, "TX slot bitmap : ");
+
+ len += bitmap_scnprintf(buf + len, sizeof(buf) - len,
+ priv->tx.tx_slot, MAX_TX_BUF_NUM);
+
+ len += snprintf(buf + len, sizeof(buf) - len, "\n");
+
+ len += snprintf(buf + len, sizeof(buf) - len,
+ "Used slots : %d\n",
+ bitmap_weight(priv->tx.tx_slot, MAX_TX_BUF_NUM));
+
+ spin_unlock_bh(&priv->tx.tx_lock);
+
+ if (len > sizeof(buf))
+ len = sizeof(buf);
+
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static const struct file_operations fops_slot = {
+ .read = read_file_slot,
+ .open = ath9k_debugfs_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
int ath9k_htc_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -276,6 +311,12 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
if (!priv->debug.debugfs_recv)
goto err;
+ priv->debug.debugfs_slot = debugfs_create_file("slot", S_IRUSR,
+ priv->debug.debugfs_phy,
+ priv, &fops_slot);
+ if (!priv->debug.debugfs_slot)
+ goto err;
+
return 0;
err:
@@ -288,6 +329,7 @@ void ath9k_htc_exit_debug(struct ath_hw *ah)
struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
+ debugfs_remove(priv->debug.debugfs_slot);
debugfs_remove(priv->debug.debugfs_recv);
debugfs_remove(priv->debug.debugfs_xmit);
debugfs_remove(priv->debug.debugfs_tgt_stats);