Update
[plateforme-wifi:dev-guide.git] / debugfs_tx_queue_info.patch
1 From 618a4cabe2ae42af61fcbb972c6ced2613758d9c Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?=C3=89lie=20Bouttier?= <elie.bouttier@gmail.com>
3 Date: Wed, 5 Sep 2012 11:59:01 +0200
4 Subject: [PATCH] =?UTF-8?q?Ajout=20d=E2=80=99une=20nouvelle=20entr=C3=A9e=20debugfs=20tx=5Fqueue=5Finfo?=
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 ---
10  ath9k/debug.c |  109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11  1 files changed, 109 insertions(+), 0 deletions(-)
12
13 diff --git a/ath9k/debug.c b/ath9k/debug.c
14 index 68d972b..bd6969f 100644
15 --- a/ath9k/debug.c
16 +++ b/ath9k/debug.c
17 @@ -1615,6 +1615,113 @@ static const struct file_operations fops_samps = {
18         .llseek = default_llseek,
19  };
20  
21 +static ssize_t read_file_tx_queue_info(struct file *file, char __user *user_buf,
22 +                                     size_t count, loff_t *ppos)
23 +{
24 +       struct ath_softc *sc = file->private_data;
25 +       struct ath_hw *ah = sc->sc_ah;
26 +       struct ath9k_tx_queue_info qi;
27 +       u32 len = 0, size = 6000;
28 +       char *buf;
29 +       size_t retval;
30 +       int qnum;
31 +
32 +       buf = kzalloc(size, GFP_KERNEL);
33 +       if (buf == NULL)
34 +               return -ENOMEM;
35 +
36 +       for (qnum = 0; qnum < ATH9K_NUM_TX_QUEUES; qnum++) {
37 +               ath9k_hw_get_txq_props(ah, qnum, &qi);
38 +               len += snprintf(buf + len, size - len,
39 +                               "Queue %d:\n  ver: %d\n  type: ", qnum, qi.tqi_ver);
40 +               switch (qi.tqi_type) {
41 +                       case ATH9K_TX_QUEUE_INACTIVE:
42 +                               len += snprintf(buf + len, size - len,
43 +                                               "inactive\n");
44 +                               break;
45 +                       case ATH9K_TX_QUEUE_DATA:
46 +                               len += snprintf(buf + len, size - len,
47 +                                               "data\n");
48 +                               break;
49 +                       case ATH9K_TX_QUEUE_BEACON:
50 +                               len += snprintf(buf + len, size - len,
51 +                                               "beacon\n");
52 +                               break;
53 +                       case ATH9K_TX_QUEUE_CAB:
54 +                               len += snprintf(buf + len, size - len,
55 +                                               "cab\n");
56 +                               break;
57 +                       case ATH9K_TX_QUEUE_UAPSD:
58 +                               len += snprintf(buf + len, size - len,
59 +                                               "uapsd\n");
60 +                               break;
61 +                       case ATH9K_TX_QUEUE_PSPOLL:
62 +                               len += snprintf(buf + len, size - len,
63 +                                               "pspoll\n");
64 +                               break;
65 +               }
66 +               len += snprintf(buf + len, size - len,
67 +                               "  subtype: %d\n", qi.tqi_subtype);
68 +               len += snprintf(buf + len, size - len,
69 +                               "  options:\n"
70 +                               "    txokint_enable: %s\n"
71 +                               "    txerrint_enable: %s\n"
72 +                               "    txdescint_enable: %s\n"
73 +                               "    txeolint_enable: %s\n"
74 +                               "    txurnint_enable: %s\n"
75 +                               "    backoff_disable: %s\n"
76 +                               "    compression_enable: %s\n"
77 +                               "    rdytime_exp_policy_enable: %s\n"
78 +                               "    frag_burst_backoff_enable: %s\n",
79 +                               (TXQ_FLAG_TXOKINT_ENABLE & qi.tqi_qflags)?"yes":"no",
80 +                               (TXQ_FLAG_TXERRINT_ENABLE & qi.tqi_qflags)?"yes":"no",
81 +                               (TXQ_FLAG_TXDESCINT_ENABLE & qi.tqi_qflags)?"yes":"no",
82 +                               (TXQ_FLAG_TXEOLINT_ENABLE & qi.tqi_qflags)?"yes":"no",
83 +                               (TXQ_FLAG_TXURNINT_ENABLE & qi.tqi_qflags)?"yes":"no",
84 +                               (TXQ_FLAG_BACKOFF_DISABLE & qi.tqi_qflags)?"yes":"no",
85 +                               (TXQ_FLAG_COMPRESSION_ENABLE & qi.tqi_qflags)?"yes":"no",
86 +                               (TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE & qi.tqi_qflags)?"yes":"no",
87 +                               (TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE & qi.tqi_qflags)?"yes":"no");
88 +               len += snprintf(buf + len, size - len,
89 +                               "  priority: %d\n"
90 +                               "  aifs: %d\n"
91 +                               "  cwmin: %d\n"
92 +                               "  cwmax: %d\n"
93 +                               "  shretry: %d\n"
94 +                               "  lgretry: %d\n"
95 +                               "  cbrPeriod: %d\n"
96 +                               "  cbrOverflowLimit: %d\n"
97 +                               "  burstTime: %d\n"
98 +                               "  readyTime: %d\n"
99 +                               "  physCompBuf: %d\n"
100 +                               "  intFlags: %d\n",
101 +                               qi.tqi_priority,
102 +                               qi.tqi_aifs,
103 +                               qi.tqi_cwmin,
104 +                               qi.tqi_cwmax,
105 +                               qi.tqi_shretry,
106 +                               qi.tqi_lgretry,
107 +                               qi.tqi_cbrPeriod,
108 +                               qi.tqi_cbrOverflowLimit,
109 +                               qi.tqi_burstTime,
110 +                               qi.tqi_readyTime,
111 +                               qi.tqi_physCompBuf,
112 +                               qi.tqi_intFlags);
113 +       }
114 +
115 +       retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
116 +       kfree(buf);
117 +
118 +       return retval;
119 +}
120 +
121 +static const struct file_operations fops_tx_queue_info = {
122 +       .read = read_file_tx_queue_info,
123 +       .open = ath9k_debugfs_open,
124 +       .owner = THIS_MODULE,
125 +       .llseek = default_llseek,
126 +};
127 +
128  
129  int ath9k_init_debug(struct ath_hw *ah)
130  {
131 @@ -1670,6 +1777,8 @@ int ath9k_init_debug(struct ath_hw *ah)
132                             &fops_modal_eeprom);
133         debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc,
134                             &fops_samps);
135 +       debugfs_create_file("tx_queue_info", S_IRUSR, sc->debug.debugfs_phy, sc,
136 +                           &fops_tx_queue_info);
137  
138         debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
139                            sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
140 -- 
141 1.7.2.5
142