diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2014-05-11 04:04:37 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-05-13 15:56:41 -0400 |
commit | 87ea9b0b3ce1200ef5900e561ffdfea9702af9cd (patch) | |
tree | 9d170b8caa33408c609cd693ca892e039a9ec54c /drivers/net/wireless/ath/ath9k/common-debug.c | |
parent | b5a0c86a56e4494eab84b142ab5501eb62685150 (diff) |
ath9k: move recv to ath9k_cmn_debug_recv
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/common-debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/common-debug.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common-debug.c b/drivers/net/wireless/ath/ath9k/common-debug.c index ef538d23b18c..1d4158a8ea6b 100644 --- a/drivers/net/wireless/ath/ath9k/common-debug.c +++ b/drivers/net/wireless/ath/ath9k/common-debug.c | |||
@@ -119,3 +119,66 @@ void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, | |||
119 | #undef RX_PHY_ERR_INC | 119 | #undef RX_PHY_ERR_INC |
120 | } | 120 | } |
121 | EXPORT_SYMBOL(ath9k_cmn_debug_stat_rx); | 121 | EXPORT_SYMBOL(ath9k_cmn_debug_stat_rx); |
122 | |||
123 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | ||
124 | size_t count, loff_t *ppos) | ||
125 | { | ||
126 | #define RXS_ERR(s, e) \ | ||
127 | do { \ | ||
128 | len += scnprintf(buf + len, size - len, \ | ||
129 | "%18s : %10u\n", s, \ | ||
130 | rxstats->e); \ | ||
131 | } while (0) | ||
132 | |||
133 | struct ath_rx_stats *rxstats = file->private_data; | ||
134 | char *buf; | ||
135 | unsigned int len = 0, size = 1600; | ||
136 | ssize_t retval = 0; | ||
137 | |||
138 | buf = kzalloc(size, GFP_KERNEL); | ||
139 | if (buf == NULL) | ||
140 | return -ENOMEM; | ||
141 | |||
142 | RXS_ERR("PKTS-ALL", rx_pkts_all); | ||
143 | RXS_ERR("BYTES-ALL", rx_bytes_all); | ||
144 | RXS_ERR("BEACONS", rx_beacons); | ||
145 | RXS_ERR("FRAGS", rx_frags); | ||
146 | RXS_ERR("SPECTRAL", rx_spectral); | ||
147 | |||
148 | RXS_ERR("CRC ERR", crc_err); | ||
149 | RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); | ||
150 | RXS_ERR("PHY ERR", phy_err); | ||
151 | RXS_ERR("MIC ERR", mic_err); | ||
152 | RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); | ||
153 | RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); | ||
154 | RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); | ||
155 | RXS_ERR("LENGTH-ERR", rx_len_err); | ||
156 | RXS_ERR("OOM-ERR", rx_oom_err); | ||
157 | RXS_ERR("RATE-ERR", rx_rate_err); | ||
158 | RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); | ||
159 | |||
160 | if (len > size) | ||
161 | len = size; | ||
162 | |||
163 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
164 | kfree(buf); | ||
165 | |||
166 | return retval; | ||
167 | |||
168 | #undef RXS_ERR | ||
169 | } | ||
170 | |||
171 | static const struct file_operations fops_recv = { | ||
172 | .read = read_file_recv, | ||
173 | .open = simple_open, | ||
174 | .owner = THIS_MODULE, | ||
175 | .llseek = default_llseek, | ||
176 | }; | ||
177 | |||
178 | void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, | ||
179 | struct ath_rx_stats *rxstats) | ||
180 | { | ||
181 | debugfs_create_file("recv", S_IRUSR, debugfs_phy, rxstats, | ||
182 | &fops_recv); | ||
183 | } | ||
184 | EXPORT_SYMBOL(ath9k_cmn_debug_recv); | ||