2 * Copyright (c) 2013 Qualcomm Atheros, Inc.
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.
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.
19 static ssize_t
read_file_node_aggr(struct file
*file
, char __user
*user_buf
,
20 size_t count
, loff_t
*ppos
)
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
;
27 u32 len
= 0, size
= 4096;
32 buf
= kzalloc(size
, GFP_KERNEL
);
36 if (!an
->sta
->ht_cap
.ht_supported
) {
37 len
= scnprintf(buf
, size
, "%s\n",
42 len
= scnprintf(buf
, size
, "Max-AMPDU: %d\n",
44 len
+= scnprintf(buf
+ len
, size
- len
, "MPDU Density: %d\n\n",
47 len
+= scnprintf(buf
+ len
, size
- len
,
48 "%2s%7s\n", "AC", "SCHED");
50 for (acno
= 0, ac
= &an
->ac
[acno
];
51 acno
< IEEE80211_NUM_ACS
; acno
++, ac
++) {
53 ath_txq_lock(sc
, txq
);
54 len
+= scnprintf(buf
+ len
, size
- len
,
57 ath_txq_unlock(sc
, txq
);
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");
65 for (tidno
= 0, tid
= &an
->tid
[tidno
];
66 tidno
< IEEE80211_NUM_TIDS
; tidno
++, tid
++) {
68 ath_txq_lock(sc
, txq
);
69 len
+= scnprintf(buf
+ len
, size
- len
,
70 "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n",
71 tid
->tidno
, tid
->seq_start
, tid
->seq_next
,
72 tid
->baw_size
, tid
->baw_head
, tid
->baw_tail
,
73 tid
->bar_index
, tid
->sched
, tid
->paused
);
74 ath_txq_unlock(sc
, txq
);
77 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
83 static const struct file_operations fops_node_aggr
= {
84 .read
= read_file_node_aggr
,
87 .llseek
= default_llseek
,
90 void ath9k_sta_add_debugfs(struct ieee80211_hw
*hw
,
91 struct ieee80211_vif
*vif
,
92 struct ieee80211_sta
*sta
,
95 struct ath_node
*an
= (struct ath_node
*)sta
->drv_priv
;
96 debugfs_create_file("node_aggr", S_IRUGO
, dir
, an
, &fops_node_aggr
);