diff options
author | Dan Williams <dcbw@redhat.com> | 2007-05-25 16:15:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:41 -0400 |
commit | fcdb53dbc743f288bf72e485fefb3a967b733686 (patch) | |
tree | ceafcff8076af2da654214e3b72caa7b15164a28 /drivers/net/wireless/libertas/debugfs.c | |
parent | 90e8eafc93ed159846bb7126af8502f2a8570a11 (diff) |
[PATCH] libertas: make scan result handling more flexible
- use a linked list for scan results
- age scan results
- pass bss_descriptors around instead of indexes into the scan table
- lock access to the scan results
- stop returning EAGAIN from SIOCGIWSCAN handler
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r-- | drivers/net/wireless/libertas/debugfs.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index aa11e0a6cae8..c26227adf897 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -63,35 +63,34 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf, | |||
63 | int numscansdone = 0, res; | 63 | int numscansdone = 0, res; |
64 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 64 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
65 | char *buf = (char *)addr; | 65 | char *buf = (char *)addr; |
66 | struct bss_descriptor * iter_bss; | ||
66 | 67 | ||
67 | pos += snprintf(buf+pos, len-pos, | 68 | pos += snprintf(buf+pos, len-pos, |
68 | "# | ch | ss | bssid | cap | TSF | Qual | SSID \n"); | 69 | "# | ch | ss | bssid | cap | TSF | Qual | SSID \n"); |
69 | 70 | ||
70 | while (numscansdone < priv->adapter->numinscantable) { | 71 | mutex_lock(&priv->adapter->lock); |
71 | struct bss_descriptor *pbssinfo; | 72 | list_for_each_entry (iter_bss, &priv->adapter->network_list, list) { |
72 | u16 cap; | 73 | u16 cap; |
73 | 74 | ||
74 | pbssinfo = &priv->adapter->scantable[numscansdone]; | 75 | memcpy(&cap, &iter_bss->cap, sizeof(cap)); |
75 | memcpy(&cap, &pbssinfo->cap, sizeof(cap)); | ||
76 | pos += snprintf(buf+pos, len-pos, | 76 | pos += snprintf(buf+pos, len-pos, |
77 | "%02u| %03d | %03ld | %02x:%02x:%02x:%02x:%02x:%02x |", | 77 | "%02u| %03d | %03ld | %02x:%02x:%02x:%02x:%02x:%02x |", |
78 | numscansdone, pbssinfo->channel, pbssinfo->rssi, | 78 | numscansdone, iter_bss->channel, iter_bss->rssi, |
79 | pbssinfo->bssid[0], pbssinfo->bssid[1], | 79 | iter_bss->bssid[0], iter_bss->bssid[1], |
80 | pbssinfo->bssid[2], pbssinfo->bssid[3], | 80 | iter_bss->bssid[2], iter_bss->bssid[3], |
81 | pbssinfo->bssid[4], pbssinfo->bssid[5]); | 81 | iter_bss->bssid[4], iter_bss->bssid[5]); |
82 | pos += snprintf(buf+pos, len-pos, " %04x-", cap); | 82 | pos += snprintf(buf+pos, len-pos, " %04x-", cap); |
83 | pos += snprintf(buf+pos, len-pos, "%c%c%c |", | 83 | pos += snprintf(buf+pos, len-pos, "%c%c%c |", |
84 | pbssinfo->cap.ibss ? 'A' : 'I', | 84 | iter_bss->cap.ibss ? 'A' : 'I', |
85 | pbssinfo->cap.privacy ? 'P' : ' ', | 85 | iter_bss->cap.privacy ? 'P' : ' ', |
86 | pbssinfo->cap.spectrummgmt ? 'S' : ' '); | 86 | iter_bss->cap.spectrummgmt ? 'S' : ' '); |
87 | pos += snprintf(buf+pos, len-pos, " %08llx |", pbssinfo->networktsf); | 87 | pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf); |
88 | pos += snprintf(buf+pos, len-pos, " %d |", | 88 | pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi)); |
89 | SCAN_RSSI(priv->adapter->scantable[numscansdone].rssi)); | 89 | pos += snprintf(buf+pos, len-pos, " %s\n", iter_bss->ssid.ssid); |
90 | |||
91 | pos += snprintf(buf+pos, len-pos, " %s\n", pbssinfo->ssid.ssid); | ||
92 | 90 | ||
93 | numscansdone++; | 91 | numscansdone++; |
94 | } | 92 | } |
93 | mutex_unlock(&priv->adapter->lock); | ||
95 | 94 | ||
96 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 95 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
97 | 96 | ||