3 #include <linux/types.h>
5 #include <linux/export.h>
11 #define PROC_LIMIT (PAGE_SIZE - 80)
14 #ifndef PRISM2_NO_PROCFS_DEBUG
15 static int prism2_debug_proc_read(
char *
page,
char **
start,
off_t off,
27 p +=
sprintf(p,
"next_txfid=%d next_alloc=%d\n",
28 local->next_txfid, local->next_alloc);
29 for (i = 0; i < PRISM2_TXFID_COUNT; i++)
30 p +=
sprintf(p,
"FID: tx=%04X intransmit=%04X\n",
31 local->txfid[i], local->intransmitfid[i]);
32 p +=
sprintf(p,
"FW TX rate control: %d\n", local->fw_tx_rate_control);
33 p +=
sprintf(p,
"beacon_int=%d\n", local->beacon_int);
34 p +=
sprintf(p,
"dtim_period=%d\n", local->dtim_period);
35 p +=
sprintf(p,
"wds_max_connections=%d\n",
36 local->wds_max_connections);
37 p +=
sprintf(p,
"dev_enabled=%d\n", local->dev_enabled);
38 p +=
sprintf(p,
"sw_tick_stuck=%d\n", local->sw_tick_stuck);
40 if (local->crypt_info.crypt[i] &&
41 local->crypt_info.crypt[i]->ops) {
42 p +=
sprintf(p,
"crypt[%d]=%s\n", i,
43 local->crypt_info.crypt[i]->ops->name);
46 p +=
sprintf(p,
"pri_only=%d\n", local->pri_only);
47 p +=
sprintf(p,
"pci=%d\n", local->func->hw_type == HOSTAP_HW_PCI);
48 p +=
sprintf(p,
"sram_type=%d\n", local->sram_type);
49 p +=
sprintf(p,
"no_pri=%d\n", local->no_pri);
56 static int prism2_stats_proc_read(
char *
page,
char **
start,
off_t off,
73 p +=
sprintf(p,
"TxDeferredTransmissions=%u\n",
75 p +=
sprintf(p,
"TxSingleRetryFrames=%u\n",
77 p +=
sprintf(p,
"TxMultipleRetryFrames=%u\n",
79 p +=
sprintf(p,
"TxRetryLimitExceeded=%u\n",
88 p +=
sprintf(p,
"RxDiscardsNoBuffer=%u\n",
91 p +=
sprintf(p,
"RxDiscardsWEPUndecryptable=%u\n",
93 p +=
sprintf(p,
"RxMessageInMsgFragments=%u\n",
95 p +=
sprintf(p,
"RxMessageInBadMsgFragments=%u\n",
103 static int prism2_wds_proc_read(
char *page,
char **start,
off_t off,
104 int count,
int *eof,
void *data)
109 struct hostap_interface *iface;
119 if (iface->type != HOSTAP_INTERFACE_WDS)
123 iface->u.wds.remote_addr);
132 if ((p - page) <= off) {
139 return (p - page - off);
143 static int prism2_bss_list_proc_read(
char *page,
char **start,
off_t off,
144 int count,
int *eof,
void *data)
149 struct hostap_bss_info *bss;
157 p +=
sprintf(p,
"#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t"
158 "SSID(hex)\tWPA IE\n");
159 spin_lock_bh(&local->lock);
162 p +=
sprintf(p,
"%pM\t%lu\t%u\t0x%x\t",
163 bss->bssid, bss->last_update,
164 bss->count, bss->capab_info);
165 for (i = 0; i < bss->ssid_len; i++) {
167 bss->ssid[i] >= 32 && bss->ssid[i] < 127 ?
171 for (i = 0; i < bss->ssid_len; i++) {
172 p +=
sprintf(p,
"%02x", bss->ssid[i]);
175 for (i = 0; i < bss->wpa_ie_len; i++) {
176 p +=
sprintf(p,
"%02x", bss->wpa_ie[i]);
185 spin_unlock_bh(&local->lock);
187 if ((p - page) <= off) {
194 return (p - page - off);
198 static int prism2_crypt_proc_read(
char *page,
char **start,
off_t off,
199 int count,
int *eof,
void *data)
210 p +=
sprintf(p,
"tx_keyidx=%d\n", local->crypt_info.tx_keyidx);
212 if (local->crypt_info.crypt[i] &&
213 local->crypt_info.crypt[i]->ops &&
214 local->crypt_info.crypt[i]->ops->print_stats) {
215 p = local->crypt_info.crypt[
i]->ops->print_stats(
216 p, local->crypt_info.crypt[i]->priv);
220 if ((p - page) <= off) {
227 return (p - page - off);
231 static int prism2_pda_proc_read(
char *page,
char **start,
off_t off,
232 int count,
int *eof,
void *data)
244 memcpy(page, local->pda + off, count);
249 static int prism2_aux_dump_proc_read(
char *page,
char **start,
off_t off,
250 int count,
int *eof,
void *data)
254 if (local->func->read_aux ==
NULL) {
259 if (local->func->read_aux(local->
dev, off, count, page)) {
269 #ifdef PRISM2_IO_DEBUG
270 static int prism2_io_debug_proc_read(
char *page,
char **start,
off_t off,
271 int count,
int *eof,
void *data)
274 int head = local->io_debug_head;
275 int start_bytes,
left, copy, copied;
277 if (off + count > PRISM2_IO_DEBUG_SIZE * 4) {
279 if (off >= PRISM2_IO_DEBUG_SIZE * 4)
281 count = PRISM2_IO_DEBUG_SIZE * 4 - off;
285 start_bytes = (PRISM2_IO_DEBUG_SIZE -
head) * 4;
288 if (off < start_bytes) {
289 copy = start_bytes - off;
292 memcpy(page, ((
u8 *) &local->io_debug[head]) + off, copy);
295 memcpy(&page[copy], local->io_debug, left);
297 memcpy(page, ((
u8 *) local->io_debug) + (off - start_bytes),
308 #ifndef PRISM2_NO_STATION_MODES
309 static int prism2_scan_results_proc_read(
char *page,
char **start,
off_t off,
310 int count,
int *eof,
void *data)
318 p +=
sprintf(p,
"CHID ANL SL BcnInt Capab Rate BSSID ATIM SupRates "
321 spin_lock_bh(&local->lock);
322 for (entry = 0; entry < local->last_scan_results_count; entry++) {
323 scanres = &local->last_scan_results[
entry];
325 if (total + (p - page) <= off) {
329 if (total + (p - page) > off + count)
334 p +=
sprintf(p,
"%d %d %d %d 0x%02x %d %pM %d ",
345 for (i = 0; i <
sizeof(scanres->
sup_rates); i++) {
348 p +=
sprintf(p,
"<%02x>", pos[i]);
356 for (i = 0; i < len; i++) {
357 unsigned char c = pos[
i];
358 if (c >= 32 && c < 127)
365 spin_unlock_bh(&local->lock);
368 if (total >= off + count)
377 if (len > (p - page))
399 if (local->proc ==
NULL) {
405 #ifndef PRISM2_NO_PROCFS_DEBUG
406 create_proc_read_entry(
"debug", 0, local->proc,
407 prism2_debug_proc_read, local);
409 create_proc_read_entry(
"stats", 0, local->proc,
410 prism2_stats_proc_read, local);
411 create_proc_read_entry(
"wds", 0, local->proc,
412 prism2_wds_proc_read, local);
413 create_proc_read_entry(
"pda", 0, local->proc,
414 prism2_pda_proc_read, local);
415 create_proc_read_entry(
"aux_dump", 0, local->proc,
416 prism2_aux_dump_proc_read, local);
417 create_proc_read_entry(
"bss_list", 0, local->proc,
418 prism2_bss_list_proc_read, local);
419 create_proc_read_entry(
"crypt", 0, local->proc,
420 prism2_crypt_proc_read, local);
421 #ifdef PRISM2_IO_DEBUG
422 create_proc_read_entry(
"io_debug", 0, local->proc,
423 prism2_io_debug_proc_read, local);
425 #ifndef PRISM2_NO_STATION_MODES
426 create_proc_read_entry(
"scan_results", 0, local->proc,
427 prism2_scan_results_proc_read, local);
434 if (local->proc !=
NULL) {
435 #ifndef PRISM2_NO_STATION_MODES
438 #ifdef PRISM2_IO_DEBUG
447 #ifndef PRISM2_NO_PROCFS_DEBUG