diff options
| author | Sujith Manoharan <[email protected]> | 2012-11-28 15:08:54 +0530 | 
|---|---|---|
| committer | John W. Linville <[email protected]> | 2012-11-30 13:38:15 -0500 | 
| commit | a145daf7f04696d0cec98d5328760fe65fe418c5 (patch) | |
| tree | 9b39043c4ba827a65d524a2afda047d1f8b01659 /drivers/net/wireless/ath/ath9k/debug.c | |
| parent | de7b7604eae91f00cd587f8541eec11a7fc505aa (diff) | |
ath9k: Implement sta_add_debugfs/sta_remove_debugfs
Signed-off-by: Sujith Manoharan <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 90 | 
1 files changed, 90 insertions, 0 deletions
| diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index cb5e45798ac4..13ff9edc2401 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c @@ -1509,6 +1509,96 @@ static const struct file_operations fops_btcoex = {  };  #endif +static ssize_t read_file_node_stat(struct file *file, char __user *user_buf, +				   size_t count, loff_t *ppos) +{ +	struct ath_node *an = file->private_data; +	struct ath_softc *sc = an->sc; +	struct ath_atx_tid *tid; +	struct ath_atx_ac *ac; +	struct ath_txq *txq; +	u32 len = 0, size = 4096; +	char *buf; +	size_t retval; +	int tidno, acno; + +	buf = kzalloc(size, GFP_KERNEL); +	if (buf == NULL) +		return -ENOMEM; + +	if (!an->sta->ht_cap.ht_supported) { +		len = snprintf(buf, size, "%s\n", +			       "HT not supported"); +		goto exit; +	} + +	len = snprintf(buf, size, "Max-AMPDU: %d\n", +		       an->maxampdu); +	len += snprintf(buf + len, size - len, "MPDU Density: %d\n\n", +			an->mpdudensity); + +	len += snprintf(buf + len, size - len, +			"%2s%7s\n", "AC", "SCHED"); + +	for (acno = 0, ac = &an->ac[acno]; +	     acno < IEEE80211_NUM_ACS; acno++, ac++) { +		txq = ac->txq; +		ath_txq_lock(sc, txq); +		len += snprintf(buf + len, size - len, +				"%2d%7d\n", +				acno, ac->sched); +		ath_txq_unlock(sc, txq); +	} + +	len += snprintf(buf + len, size - len, +			"\n%3s%11s%10s%10s%10s%10s%9s%6s%8s\n", +			"TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE", +			"BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED"); + +	for (tidno = 0, tid = &an->tid[tidno]; +	     tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { +		txq = tid->ac->txq; +		ath_txq_lock(sc, txq); +		len += snprintf(buf + len, size - len, +				"%3d%11d%10d%10d%10d%10d%9d%6d%8d\n", +				tid->tidno, tid->seq_start, tid->seq_next, +				tid->baw_size, tid->baw_head, tid->baw_tail, +				tid->bar_index, tid->sched, tid->paused); +		ath_txq_unlock(sc, txq); +	} +exit: +	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); +	kfree(buf); + +	return retval; +} + +static const struct file_operations fops_node_stat = { +	.read = read_file_node_stat, +	.open = simple_open, +	.owner = THIS_MODULE, +	.llseek = default_llseek, +}; + +void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, +			   struct ieee80211_vif *vif, +			   struct ieee80211_sta *sta, +			   struct dentry *dir) +{ +	struct ath_node *an = (struct ath_node *)sta->drv_priv; +	an->node_stat = debugfs_create_file("node_stat", S_IRUGO, +					    dir, an, &fops_node_stat); +} + +void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw, +			      struct ieee80211_vif *vif, +			      struct ieee80211_sta *sta, +			      struct dentry *dir) +{ +	struct ath_node *an = (struct ath_node *)sta->drv_priv; +	debugfs_remove(an->node_stat); +} +  /* Ethtool support for get-stats */  #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" |