Sujith Manoharan | 1cdbaf0 | 2014-01-13 07:29:27 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 Qualcomm Atheros, Inc. |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #include "ath9k.h" |
| 18 | |
| 19 | static ssize_t read_file_node_aggr(struct file *file, char __user *user_buf, |
| 20 | size_t count, loff_t *ppos) |
| 21 | { |
| 22 | struct ath_node *an = file->private_data; |
| 23 | struct ath_softc *sc = an->sc; |
| 24 | struct ath_atx_tid *tid; |
| 25 | struct ath_atx_ac *ac; |
| 26 | struct ath_txq *txq; |
| 27 | u32 len = 0, size = 4096; |
| 28 | char *buf; |
| 29 | size_t retval; |
| 30 | int tidno, acno; |
| 31 | |
| 32 | buf = kzalloc(size, GFP_KERNEL); |
| 33 | if (buf == NULL) |
| 34 | return -ENOMEM; |
| 35 | |
| 36 | if (!an->sta->ht_cap.ht_supported) { |
| 37 | len = scnprintf(buf, size, "%s\n", |
| 38 | "HT not supported"); |
| 39 | goto exit; |
| 40 | } |
| 41 | |
| 42 | len = scnprintf(buf, size, "Max-AMPDU: %d\n", |
| 43 | an->maxampdu); |
| 44 | len += scnprintf(buf + len, size - len, "MPDU Density: %d\n\n", |
| 45 | an->mpdudensity); |
| 46 | |
| 47 | len += scnprintf(buf + len, size - len, |
| 48 | "%2s%7s\n", "AC", "SCHED"); |
| 49 | |
| 50 | for (acno = 0, ac = &an->ac[acno]; |
| 51 | acno < IEEE80211_NUM_ACS; acno++, ac++) { |
| 52 | txq = ac->txq; |
| 53 | ath_txq_lock(sc, txq); |
| 54 | len += scnprintf(buf + len, size - len, |
| 55 | "%2d%7d\n", |
| 56 | acno, ac->sched); |
| 57 | ath_txq_unlock(sc, txq); |
| 58 | } |
| 59 | |
| 60 | len += scnprintf(buf + len, size - len, |
| 61 | "\n%3s%11s%10s%10s%10s%10s%9s%6s%8s\n", |
| 62 | "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE", |
| 63 | "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED"); |
| 64 | |
| 65 | for (tidno = 0, tid = &an->tid[tidno]; |
| 66 | tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { |
| 67 | txq = tid->ac->txq; |
| 68 | ath_txq_lock(sc, txq); |
Sujith Manoharan | 78175fc | 2014-01-13 07:29:28 +0530 | [diff] [blame^] | 69 | if (tid->active) { |
| 70 | len += scnprintf(buf + len, size - len, |
| 71 | "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n", |
| 72 | tid->tidno, |
| 73 | tid->seq_start, |
| 74 | tid->seq_next, |
| 75 | tid->baw_size, |
| 76 | tid->baw_head, |
| 77 | tid->baw_tail, |
| 78 | tid->bar_index, |
| 79 | tid->sched, |
| 80 | tid->paused); |
| 81 | } |
Sujith Manoharan | 1cdbaf0 | 2014-01-13 07:29:27 +0530 | [diff] [blame] | 82 | ath_txq_unlock(sc, txq); |
| 83 | } |
| 84 | exit: |
| 85 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 86 | kfree(buf); |
| 87 | |
| 88 | return retval; |
| 89 | } |
| 90 | |
| 91 | static const struct file_operations fops_node_aggr = { |
| 92 | .read = read_file_node_aggr, |
| 93 | .open = simple_open, |
| 94 | .owner = THIS_MODULE, |
| 95 | .llseek = default_llseek, |
| 96 | }; |
| 97 | |
| 98 | void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, |
| 99 | struct ieee80211_vif *vif, |
| 100 | struct ieee80211_sta *sta, |
| 101 | struct dentry *dir) |
| 102 | { |
| 103 | struct ath_node *an = (struct ath_node *)sta->drv_priv; |
| 104 | debugfs_create_file("node_aggr", S_IRUGO, dir, an, &fops_node_aggr); |
| 105 | } |