From patchwork Mon Mar 7 02:16:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 614401 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p272GEbb019225 for ; Mon, 7 Mar 2011 02:16:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755246Ab1CGCQN (ORCPT ); Sun, 6 Mar 2011 21:16:13 -0500 Received: from mail-gw0-f51.google.com ([74.125.83.51]:43113 "EHLO mail-gw0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755136Ab1CGCQM (ORCPT ); Sun, 6 Mar 2011 21:16:12 -0500 Received: by gwb15 with SMTP id 15so2263735gwb.10 for ; Sun, 06 Mar 2011 18:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:x-mailer:cc:subject; bh=O4h6NtCcktvVsP4/L33unWSVHiOUWN/BAxNhBcB5jlE=; b=QyUOpRt1RqUKJicA+fXuNVIxd6XfqjZofgWyJLVzjbUGA2ecfm+k/EuUltBSasZSlo R996JsghKLLfGWaCpx4Tbab23O5SNRb/aM3QPVvTnLeYY3MomJSQZYJ0UcvloMBHxPaa phvtB45kwkHvENheSf4qrN75HU2A6aJ6Bt6PY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:mime-version:content-type:content-transfer-encoding:message-id :date:to:x-mailer:cc:subject; b=wBzlLEznnX9OjVQvzGZlQwM/nczaoyXmksPztii/4i4Xc6/C40h6At0A2GkCFTP61q FtXXR3c77G6E31jRLMiUoBNlRi7cxuUvP8V4RX+wyhXT4zuR81c70vhF6Xl9ZmY9TCPz Tg+4tgJdgedCLUUf8A2BcJmerZ/kSgiPXzPtg= Received: by 10.101.2.25 with SMTP id e25mr363248ani.28.1299464171922; Sun, 06 Mar 2011 18:16:11 -0800 (PST) Received: from bodhi ([117.197.194.30]) by mx.google.com with ESMTPS id u20sm3076824anu.34.2011.03.06.18.16.09 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Mar 2011 18:16:11 -0800 (PST) From: Sujith MIME-Version: 1.0 Message-ID: <19828.16355.660715.581026@gargle.gargle.HOWL> Date: Mon, 7 Mar 2011 07:46:03 +0530 To: linux-wireless@vger.kernel.org X-Mailer: VM 8.1.1 under 23.2.1 (x86_64-unknown-linux-gnu) CC: ath9k-devel@venema.h4ckr.net Subject: [RFC 31/34] ath9k_htc: Add a debugfs file to dump TX slot information Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 07 Mar 2011 02:16:14 +0000 (UTC) diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index 07a63cc..32552e4 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h @@ -335,6 +335,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);