aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2013-06-02 23:49:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-06-03 15:55:47 -0400
commit6e4d291eec82c682d82d02cd275a6ec511f9b203 (patch)
tree4612f3c396a4b1ea82aeb0e55a3f2a6b49d52f06
parent4f4395c692fd74f6ebfb99892e5da3842f70d4c3 (diff)
ath9k: Print ANI statistics in debugfs
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c81
2 files changed, 64 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
index c585e053ce68..78b9fa9f6455 100644
--- a/drivers/net/wireless/ath/ath9k/ani.h
+++ b/drivers/net/wireless/ath/ath9k/ani.h
@@ -111,8 +111,6 @@ struct ar5416AniState {
111}; 111};
112 112
113struct ar5416Stats { 113struct ar5416Stats {
114 u32 ast_ani_niup;
115 u32 ast_ani_nidown;
116 u32 ast_ani_spurup; 114 u32 ast_ani_spurup;
117 u32 ast_ani_spurdown; 115 u32 ast_ani_spurdown;
118 u32 ast_ani_ofdmon; 116 u32 ast_ani_ofdmon;
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index fc96ad3a135b..7852f6e59964 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -173,25 +173,69 @@ static const struct file_operations fops_rx_chainmask = {
173 .llseek = default_llseek, 173 .llseek = default_llseek,
174}; 174};
175 175
176static ssize_t read_file_disable_ani(struct file *file, char __user *user_buf, 176static ssize_t read_file_ani(struct file *file, char __user *user_buf,
177 size_t count, loff_t *ppos) 177 size_t count, loff_t *ppos)
178{ 178{
179 struct ath_softc *sc = file->private_data; 179 struct ath_softc *sc = file->private_data;
180 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 180 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
181 char buf[32]; 181 struct ath_hw *ah = sc->sc_ah;
182 unsigned int len; 182 unsigned int len = 0, size = 1024;
183 ssize_t retval = 0;
184 char *buf;
183 185
184 len = sprintf(buf, "%d\n", common->disable_ani); 186 buf = kzalloc(size, GFP_KERNEL);
185 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 187 if (buf == NULL)
188 return -ENOMEM;
189
190 if (common->disable_ani) {
191 len += snprintf(buf + len, size - len, "%s: %s\n",
192 "ANI", "DISABLED");
193 goto exit;
194 }
195
196 len += snprintf(buf + len, size - len, "%15s: %s\n",
197 "ANI", "ENABLED");
198 len += snprintf(buf + len, size - len, "%15s: %u\n",
199 "ANI RESET", ah->stats.ast_ani_reset);
200 len += snprintf(buf + len, size - len, "%15s: %u\n",
201 "SPUR UP", ah->stats.ast_ani_spurup);
202 len += snprintf(buf + len, size - len, "%15s: %u\n",
203 "SPUR DOWN", ah->stats.ast_ani_spurup);
204 len += snprintf(buf + len, size - len, "%15s: %u\n",
205 "OFDM WS-DET ON", ah->stats.ast_ani_ofdmon);
206 len += snprintf(buf + len, size - len, "%15s: %u\n",
207 "OFDM WS-DET OFF", ah->stats.ast_ani_ofdmoff);
208 len += snprintf(buf + len, size - len, "%15s: %u\n",
209 "MRC-CCK ON", ah->stats.ast_ani_ccklow);
210 len += snprintf(buf + len, size - len, "%15s: %u\n",
211 "MRC-CCK OFF", ah->stats.ast_ani_cckhigh);
212 len += snprintf(buf + len, size - len, "%15s: %u\n",
213 "FIR-STEP UP", ah->stats.ast_ani_stepup);
214 len += snprintf(buf + len, size - len, "%15s: %u\n",
215 "FIR-STEP DOWN", ah->stats.ast_ani_stepdown);
216 len += snprintf(buf + len, size - len, "%15s: %u\n",
217 "INV LISTENTIME", ah->stats.ast_ani_lneg_or_lzero);
218 len += snprintf(buf + len, size - len, "%15s: %u\n",
219 "OFDM ERRORS", ah->stats.ast_ani_ofdmerrs);
220 len += snprintf(buf + len, size - len, "%15s: %u\n",
221 "CCK ERRORS", ah->stats.ast_ani_cckerrs);
222exit:
223 if (len > size)
224 len = size;
225
226 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
227 kfree(buf);
228
229 return retval;
186} 230}
187 231
188static ssize_t write_file_disable_ani(struct file *file, 232static ssize_t write_file_ani(struct file *file,
189 const char __user *user_buf, 233 const char __user *user_buf,
190 size_t count, loff_t *ppos) 234 size_t count, loff_t *ppos)
191{ 235{
192 struct ath_softc *sc = file->private_data; 236 struct ath_softc *sc = file->private_data;
193 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 237 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
194 unsigned long disable_ani; 238 unsigned long ani;
195 char buf[32]; 239 char buf[32];
196 ssize_t len; 240 ssize_t len;
197 241
@@ -200,12 +244,15 @@ static ssize_t write_file_disable_ani(struct file *file,
200 return -EFAULT; 244 return -EFAULT;
201 245
202 buf[len] = '\0'; 246 buf[len] = '\0';
203 if (strict_strtoul(buf, 0, &disable_ani)) 247 if (strict_strtoul(buf, 0, &ani))
248 return -EINVAL;
249
250 if (ani < 0 || ani > 1)
204 return -EINVAL; 251 return -EINVAL;
205 252
206 common->disable_ani = !!disable_ani; 253 common->disable_ani = !ani;
207 254
208 if (disable_ani) { 255 if (common->disable_ani) {
209 clear_bit(SC_OP_ANI_RUN, &sc->sc_flags); 256 clear_bit(SC_OP_ANI_RUN, &sc->sc_flags);
210 ath_stop_ani(sc); 257 ath_stop_ani(sc);
211 } else { 258 } else {
@@ -215,9 +262,9 @@ static ssize_t write_file_disable_ani(struct file *file,
215 return count; 262 return count;
216} 263}
217 264
218static const struct file_operations fops_disable_ani = { 265static const struct file_operations fops_ani = {
219 .read = read_file_disable_ani, 266 .read = read_file_ani,
220 .write = write_file_disable_ani, 267 .write = write_file_ani,
221 .open = simple_open, 268 .open = simple_open,
222 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
223 .llseek = default_llseek, 270 .llseek = default_llseek,
@@ -1719,8 +1766,8 @@ int ath9k_init_debug(struct ath_hw *ah)
1719 sc->debug.debugfs_phy, sc, &fops_rx_chainmask); 1766 sc->debug.debugfs_phy, sc, &fops_rx_chainmask);
1720 debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, 1767 debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR,
1721 sc->debug.debugfs_phy, sc, &fops_tx_chainmask); 1768 sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
1722 debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR, 1769 debugfs_create_file("ani", S_IRUSR | S_IWUSR,
1723 sc->debug.debugfs_phy, sc, &fops_disable_ani); 1770 sc->debug.debugfs_phy, sc, &fops_ani);
1724 debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, 1771 debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1725 &sc->sc_ah->config.enable_paprd); 1772 &sc->sc_ah->config.enable_paprd);
1726 debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, 1773 debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,