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/assoc.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/assoc.c')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 9da29ebe8b0d..4605bd3a26ba 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -18,7 +18,7 @@ static int assoc_helper_essid(wlan_private *priv, | |||
18 | { | 18 | { |
19 | wlan_adapter *adapter = priv->adapter; | 19 | wlan_adapter *adapter = priv->adapter; |
20 | int ret = 0; | 20 | int ret = 0; |
21 | int i; | 21 | struct bss_descriptor * bss; |
22 | 22 | ||
23 | lbs_deb_enter(LBS_DEB_ASSOC); | 23 | lbs_deb_enter(LBS_DEB_ASSOC); |
24 | 24 | ||
@@ -28,17 +28,13 @@ static int assoc_helper_essid(wlan_private *priv, | |||
28 | libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); | 28 | libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); |
29 | } | 29 | } |
30 | 30 | ||
31 | i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, | 31 | bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, |
32 | NULL, IW_MODE_INFRA); | 32 | NULL, IW_MODE_INFRA); |
33 | if (i >= 0) { | 33 | if (bss != NULL) { |
34 | lbs_deb_assoc( | 34 | lbs_deb_assoc("SSID found in scan list, associating\n"); |
35 | "SSID found in scan list ... associating...\n"); | 35 | ret = wlan_associate(priv, bss); |
36 | |||
37 | ret = wlan_associate(priv, &adapter->scantable[i]); | ||
38 | if (ret == 0) { | 36 | if (ret == 0) { |
39 | memcpy(&assoc_req->bssid, | 37 | memcpy(&assoc_req->bssid, bss->bssid, ETH_ALEN); |
40 | &adapter->scantable[i].bssid, | ||
41 | ETH_ALEN); | ||
42 | } | 38 | } |
43 | } else { | 39 | } else { |
44 | lbs_deb_assoc("SSID '%s' not found; cannot associate\n", | 40 | lbs_deb_assoc("SSID '%s' not found; cannot associate\n", |
@@ -51,11 +47,11 @@ static int assoc_helper_essid(wlan_private *priv, | |||
51 | libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0); | 47 | libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0); |
52 | 48 | ||
53 | /* Search for the requested SSID in the scan table */ | 49 | /* Search for the requested SSID in the scan table */ |
54 | i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, | 50 | bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, |
55 | IW_MODE_ADHOC); | 51 | IW_MODE_ADHOC); |
56 | if (i >= 0) { | 52 | if (bss != NULL) { |
57 | lbs_deb_assoc("SSID found at %d in List, so join\n", ret); | 53 | lbs_deb_assoc("SSID found joining\n"); |
58 | libertas_join_adhoc_network(priv, &adapter->scantable[i]); | 54 | libertas_join_adhoc_network(priv, bss); |
59 | } else { | 55 | } else { |
60 | /* else send START command */ | 56 | /* else send START command */ |
61 | lbs_deb_assoc("SSID not found in list, so creating adhoc" | 57 | lbs_deb_assoc("SSID not found in list, so creating adhoc" |
@@ -74,28 +70,28 @@ static int assoc_helper_bssid(wlan_private *priv, | |||
74 | struct assoc_request * assoc_req) | 70 | struct assoc_request * assoc_req) |
75 | { | 71 | { |
76 | wlan_adapter *adapter = priv->adapter; | 72 | wlan_adapter *adapter = priv->adapter; |
77 | int i, ret = 0; | 73 | int ret = 0; |
74 | struct bss_descriptor * bss; | ||
78 | 75 | ||
79 | lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID" MAC_FMT "\n", | 76 | lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID" MAC_FMT "\n", |
80 | MAC_ARG(assoc_req->bssid)); | 77 | MAC_ARG(assoc_req->bssid)); |
81 | 78 | ||
82 | /* Search for index position in list for requested MAC */ | 79 | /* Search for index position in list for requested MAC */ |
83 | i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid, | 80 | bss = libertas_find_BSSID_in_list(adapter, assoc_req->bssid, |
84 | assoc_req->mode); | 81 | assoc_req->mode); |
85 | if (i < 0) { | 82 | if (bss == NULL) { |
86 | lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, " | 83 | lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, " |
87 | "cannot associate.\n", MAC_ARG(assoc_req->bssid)); | 84 | "cannot associate.\n", MAC_ARG(assoc_req->bssid)); |
88 | goto out; | 85 | goto out; |
89 | } | 86 | } |
90 | 87 | ||
91 | if (assoc_req->mode == IW_MODE_INFRA) { | 88 | if (assoc_req->mode == IW_MODE_INFRA) { |
92 | ret = wlan_associate(priv, &adapter->scantable[i]); | 89 | ret = wlan_associate(priv, bss); |
93 | lbs_deb_assoc("ASSOC: return from wlan_associate(bssd) was %d\n", ret); | 90 | lbs_deb_assoc("ASSOC: wlan_associate(bssid) returned %d\n", ret); |
94 | } else if (assoc_req->mode == IW_MODE_ADHOC) { | 91 | } else if (assoc_req->mode == IW_MODE_ADHOC) { |
95 | libertas_join_adhoc_network(priv, &adapter->scantable[i]); | 92 | libertas_join_adhoc_network(priv, bss); |
96 | } | 93 | } |
97 | memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid, | 94 | memcpy(&assoc_req->ssid, &bss->ssid, sizeof(struct WLAN_802_11_SSID)); |
98 | sizeof(struct WLAN_802_11_SSID)); | ||
99 | 95 | ||
100 | out: | 96 | out: |
101 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | 97 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |