diff options
author | Dan Williams <dcbw@redhat.com> | 2007-05-25 17:09:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:42 -0400 |
commit | e76850d620a0a26fa807b4fa189c64a94789461e (patch) | |
tree | ca251090429ebfb75da58af966254d547ba703f6 /drivers/net/wireless/libertas/join.c | |
parent | ef9a264b7a288a07c43ddb244c4f9ab0e8df90e4 (diff) |
[PATCH] libertas: make association paths consistent
The BSS to associate with (in either Infrastructure or IBSS join
operations) is now stored in _one_ place in the association request (the
bss member), not two places as before (pattemptedbss and
curbssparams->bssdescriptor).
Association requests are passed to the necessary association functions
to (a) give them access to the bss member and (b) ensure that
association/join/start setup uses settings from the request, not the
current adapter settings (which may not be valid for the requested
settings).
Because the 'bss' member of the association request is used now, the
command return functions from associate and adhoc join/start need access
to the in-progress association request to update curbssparams when
everything is done. The association worker moves the request from
pending to in-progress for the duration of the association attempt.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/join.c')
-rw-r--r-- | drivers/net/wireless/libertas/join.c | 224 |
1 files changed, 91 insertions, 133 deletions
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index a11ce3a6f611..65777b40d57b 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/netdevice.h> | 7 | #include <linux/netdevice.h> |
8 | #include <linux/if_arp.h> | 8 | #include <linux/if_arp.h> |
9 | #include <linux/wireless.h> | 9 | #include <linux/wireless.h> |
10 | #include <linux/etherdevice.h> | ||
10 | 11 | ||
11 | #include <net/iw_handler.h> | 12 | #include <net/iw_handler.h> |
12 | 13 | ||
@@ -14,6 +15,7 @@ | |||
14 | #include "decl.h" | 15 | #include "decl.h" |
15 | #include "join.h" | 16 | #include "join.h" |
16 | #include "dev.h" | 17 | #include "dev.h" |
18 | #include "assoc.h" | ||
17 | 19 | ||
18 | #define AD_HOC_CAP_PRIVACY_ON 1 | 20 | #define AD_HOC_CAP_PRIVACY_ON 1 |
19 | 21 | ||
@@ -104,7 +106,7 @@ int libertas_send_deauth(wlan_private * priv) | |||
104 | * | 106 | * |
105 | * @return 0-success, otherwise fail | 107 | * @return 0-success, otherwise fail |
106 | */ | 108 | */ |
107 | int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc) | 109 | int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req) |
108 | { | 110 | { |
109 | wlan_adapter *adapter = priv->adapter; | 111 | wlan_adapter *adapter = priv->adapter; |
110 | int ret; | 112 | int ret; |
@@ -113,13 +115,13 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc) | |||
113 | 115 | ||
114 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate, | 116 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate, |
115 | 0, cmd_option_waitforrsp, | 117 | 0, cmd_option_waitforrsp, |
116 | 0, pbssdesc->bssid); | 118 | 0, assoc_req->bss.bssid); |
117 | 119 | ||
118 | if (ret) | 120 | if (ret) |
119 | goto done; | 121 | goto done; |
120 | 122 | ||
121 | /* set preamble to firmware */ | 123 | /* set preamble to firmware */ |
122 | if (adapter->capinfo.shortpreamble && pbssdesc->cap.shortpreamble) | 124 | if (adapter->capinfo.shortpreamble && assoc_req->bss.cap.shortpreamble) |
123 | adapter->preamble = cmd_type_short_preamble; | 125 | adapter->preamble = cmd_type_short_preamble; |
124 | else | 126 | else |
125 | adapter->preamble = cmd_type_long_preamble; | 127 | adapter->preamble = cmd_type_long_preamble; |
@@ -127,7 +129,7 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc) | |||
127 | libertas_set_radio_control(priv); | 129 | libertas_set_radio_control(priv); |
128 | 130 | ||
129 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate, | 131 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate, |
130 | 0, cmd_option_waitforrsp, 0, pbssdesc); | 132 | 0, cmd_option_waitforrsp, 0, assoc_req); |
131 | 133 | ||
132 | done: | 134 | done: |
133 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); | 135 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); |
@@ -141,7 +143,7 @@ done: | |||
141 | * @param adhocssid The ssid of the Adhoc Network | 143 | * @param adhocssid The ssid of the Adhoc Network |
142 | * @return 0--success, -1--fail | 144 | * @return 0--success, -1--fail |
143 | */ | 145 | */ |
144 | int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *adhocssid) | 146 | int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req) |
145 | { | 147 | { |
146 | wlan_adapter *adapter = priv->adapter; | 148 | wlan_adapter *adapter = priv->adapter; |
147 | int ret = 0; | 149 | int ret = 0; |
@@ -158,12 +160,11 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a | |||
158 | 160 | ||
159 | libertas_set_radio_control(priv); | 161 | libertas_set_radio_control(priv); |
160 | 162 | ||
161 | lbs_deb_join("curbssparams.channel = %d\n", | 163 | lbs_deb_join("AdhocStart: channel = %d\n", assoc_req->channel); |
162 | adapter->curbssparams.channel); | 164 | lbs_deb_join("AdhocStart: band = %d\n", assoc_req->band); |
163 | lbs_deb_join("curbssparams.band = %d\n", adapter->curbssparams.band); | ||
164 | 165 | ||
165 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start, | 166 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start, |
166 | 0, cmd_option_waitforrsp, 0, adhocssid); | 167 | 0, cmd_option_waitforrsp, 0, assoc_req); |
167 | 168 | ||
168 | return ret; | 169 | return ret; |
169 | } | 170 | } |
@@ -177,34 +178,34 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a | |||
177 | * | 178 | * |
178 | * @return 0--success, -1--fail | 179 | * @return 0--success, -1--fail |
179 | */ | 180 | */ |
180 | int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbssdesc) | 181 | int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req) |
181 | { | 182 | { |
182 | wlan_adapter *adapter = priv->adapter; | 183 | wlan_adapter *adapter = priv->adapter; |
184 | struct bss_descriptor * bss = &assoc_req->bss; | ||
183 | int ret = 0; | 185 | int ret = 0; |
184 | 186 | ||
185 | lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid =%s\n", | 187 | lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid =%s\n", |
186 | adapter->curbssparams.ssid.ssid); | 188 | adapter->curbssparams.ssid.ssid); |
187 | lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid_len =%u\n", | 189 | lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid_len =%u\n", |
188 | adapter->curbssparams.ssid.ssidlength); | 190 | adapter->curbssparams.ssid.ssidlength); |
189 | lbs_deb_join("libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid); | 191 | lbs_deb_join("libertas_join_adhoc_network: ssid = '%s'\n", |
190 | lbs_deb_join("libertas_join_adhoc_network: ssid len =%u\n", | 192 | bss->ssid.ssid); |
191 | pbssdesc->ssid.ssidlength); | 193 | lbs_deb_join("libertas_join_adhoc_network: ssid len = %u\n", |
194 | bss->ssid.ssidlength); | ||
192 | 195 | ||
193 | /* check if the requested SSID is already joined */ | 196 | /* check if the requested SSID is already joined */ |
194 | if (adapter->curbssparams.ssid.ssidlength | 197 | if (adapter->curbssparams.ssid.ssidlength |
195 | && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid) | 198 | && !libertas_SSID_cmp(&bss->ssid, &adapter->curbssparams.ssid) |
196 | && (adapter->mode == IW_MODE_ADHOC)) { | 199 | && (adapter->mode == IW_MODE_ADHOC)) { |
197 | 200 | lbs_deb_join( | |
198 | lbs_deb_join( | ||
199 | "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " | 201 | "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " |
200 | "not attempting to re-join"); | 202 | "not attempting to re-join"); |
201 | |||
202 | return -1; | 203 | return -1; |
203 | } | 204 | } |
204 | 205 | ||
205 | /*Use shortpreamble only when both creator and card supports | 206 | /*Use shortpreamble only when both creator and card supports |
206 | short preamble */ | 207 | short preamble */ |
207 | if (!pbssdesc->cap.shortpreamble || !adapter->capinfo.shortpreamble) { | 208 | if (!bss->cap.shortpreamble || !adapter->capinfo.shortpreamble) { |
208 | lbs_deb_join("AdhocJoin: Long preamble\n"); | 209 | lbs_deb_join("AdhocJoin: Long preamble\n"); |
209 | adapter->preamble = cmd_type_long_preamble; | 210 | adapter->preamble = cmd_type_long_preamble; |
210 | } else { | 211 | } else { |
@@ -214,15 +215,14 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs | |||
214 | 215 | ||
215 | libertas_set_radio_control(priv); | 216 | libertas_set_radio_control(priv); |
216 | 217 | ||
217 | lbs_deb_join("curbssparams.channel = %d\n", | 218 | lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel); |
218 | adapter->curbssparams.channel); | 219 | lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band); |
219 | lbs_deb_join("curbssparams.band = %c\n", adapter->curbssparams.band); | ||
220 | 220 | ||
221 | adapter->adhoccreate = 0; | 221 | adapter->adhoccreate = 0; |
222 | 222 | ||
223 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join, | 223 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join, |
224 | 0, cmd_option_waitforrsp, | 224 | 0, cmd_option_waitforrsp, |
225 | OID_802_11_SSID, pbssdesc); | 225 | OID_802_11_SSID, assoc_req); |
226 | 226 | ||
227 | return ret; | 227 | return ret; |
228 | } | 228 | } |
@@ -325,7 +325,8 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
325 | wlan_adapter *adapter = priv->adapter; | 325 | wlan_adapter *adapter = priv->adapter; |
326 | struct cmd_ds_802_11_associate *passo = &cmd->params.associate; | 326 | struct cmd_ds_802_11_associate *passo = &cmd->params.associate; |
327 | int ret = 0; | 327 | int ret = 0; |
328 | struct bss_descriptor *pbssdesc; | 328 | struct assoc_request * assoc_req = pdata_buf; |
329 | struct bss_descriptor * bss = &assoc_req->bss; | ||
329 | u8 *card_rates; | 330 | u8 *card_rates; |
330 | u8 *pos; | 331 | u8 *pos; |
331 | int card_rates_size; | 332 | int card_rates_size; |
@@ -338,7 +339,6 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
338 | 339 | ||
339 | lbs_deb_enter(LBS_DEB_JOIN); | 340 | lbs_deb_enter(LBS_DEB_JOIN); |
340 | 341 | ||
341 | pbssdesc = pdata_buf; | ||
342 | pos = (u8 *) passo; | 342 | pos = (u8 *) passo; |
343 | 343 | ||
344 | if (!adapter) { | 344 | if (!adapter) { |
@@ -348,11 +348,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
348 | 348 | ||
349 | cmd->command = cpu_to_le16(cmd_802_11_associate); | 349 | cmd->command = cpu_to_le16(cmd_802_11_associate); |
350 | 350 | ||
351 | /* Save so we know which BSS Desc to use in the response handler */ | 351 | memcpy(passo->peerstaaddr, bss->bssid, sizeof(passo->peerstaaddr)); |
352 | adapter->pattemptedbssdesc = pbssdesc; | ||
353 | |||
354 | memcpy(passo->peerstaaddr, | ||
355 | pbssdesc->bssid, sizeof(passo->peerstaaddr)); | ||
356 | pos += sizeof(passo->peerstaaddr); | 352 | pos += sizeof(passo->peerstaaddr); |
357 | 353 | ||
358 | /* set the listen interval */ | 354 | /* set the listen interval */ |
@@ -365,8 +361,8 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
365 | 361 | ||
366 | ssid = (struct mrvlietypes_ssidparamset *) pos; | 362 | ssid = (struct mrvlietypes_ssidparamset *) pos; |
367 | ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); | 363 | ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); |
368 | ssid->header.len = pbssdesc->ssid.ssidlength; | 364 | ssid->header.len = bss->ssid.ssidlength; |
369 | memcpy(ssid->ssid, pbssdesc->ssid.ssid, ssid->header.len); | 365 | memcpy(ssid->ssid, bss->ssid.ssid, ssid->header.len); |
370 | pos += sizeof(ssid->header) + ssid->header.len; | 366 | pos += sizeof(ssid->header) + ssid->header.len; |
371 | ssid->header.len = cpu_to_le16(ssid->header.len); | 367 | ssid->header.len = cpu_to_le16(ssid->header.len); |
372 | 368 | ||
@@ -374,7 +370,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
374 | phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); | 370 | phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); |
375 | phy->header.len = sizeof(phy->fh_ds.dsparamset); | 371 | phy->header.len = sizeof(phy->fh_ds.dsparamset); |
376 | memcpy(&phy->fh_ds.dsparamset, | 372 | memcpy(&phy->fh_ds.dsparamset, |
377 | &pbssdesc->phyparamset.dsparamset.currentchan, | 373 | &bss->phyparamset.dsparamset.currentchan, |
378 | sizeof(phy->fh_ds.dsparamset)); | 374 | sizeof(phy->fh_ds.dsparamset)); |
379 | pos += sizeof(phy->header) + phy->header.len; | 375 | pos += sizeof(phy->header) + phy->header.len; |
380 | phy->header.len = cpu_to_le16(phy->header.len); | 376 | phy->header.len = cpu_to_le16(phy->header.len); |
@@ -388,7 +384,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
388 | rates = (struct mrvlietypes_ratesparamset *) pos; | 384 | rates = (struct mrvlietypes_ratesparamset *) pos; |
389 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); | 385 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); |
390 | 386 | ||
391 | memcpy(&rates->rates, &pbssdesc->libertas_supported_rates, WLAN_SUPPORTED_RATES); | 387 | memcpy(&rates->rates, &bss->libertas_supported_rates, WLAN_SUPPORTED_RATES); |
392 | 388 | ||
393 | card_rates = libertas_supported_rates; | 389 | card_rates = libertas_supported_rates; |
394 | card_rates_size = sizeof(libertas_supported_rates); | 390 | card_rates_size = sizeof(libertas_supported_rates); |
@@ -405,12 +401,12 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
405 | pos += sizeof(rates->header) + rates->header.len; | 401 | pos += sizeof(rates->header) + rates->header.len; |
406 | rates->header.len = cpu_to_le16(rates->header.len); | 402 | rates->header.len = cpu_to_le16(rates->header.len); |
407 | 403 | ||
408 | if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { | 404 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { |
409 | rsn = (struct mrvlietypes_rsnparamset *) pos; | 405 | rsn = (struct mrvlietypes_rsnparamset *) pos; |
410 | rsn->header.type = (u16) adapter->wpa_ie[0]; /* WPA_IE or WPA2_IE */ | 406 | rsn->header.type = (u16) assoc_req->wpa_ie[0]; /* WPA_IE or WPA2_IE */ |
411 | rsn->header.type = cpu_to_le16(rsn->header.type); | 407 | rsn->header.type = cpu_to_le16(rsn->header.type); |
412 | rsn->header.len = (u16) adapter->wpa_ie[1]; | 408 | rsn->header.len = (u16) assoc_req->wpa_ie[1]; |
413 | memcpy(rsn->rsnie, &adapter->wpa_ie[2], rsn->header.len); | 409 | memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], rsn->header.len); |
414 | lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, | 410 | lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, |
415 | sizeof(rsn->header) + rsn->header.len); | 411 | sizeof(rsn->header) + rsn->header.len); |
416 | pos += sizeof(rsn->header) + rsn->header.len; | 412 | pos += sizeof(rsn->header) + rsn->header.len; |
@@ -419,7 +415,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
419 | 415 | ||
420 | /* update curbssparams */ | 416 | /* update curbssparams */ |
421 | adapter->curbssparams.channel = | 417 | adapter->curbssparams.channel = |
422 | (pbssdesc->phyparamset.dsparamset.currentchan); | 418 | (bss->phyparamset.dsparamset.currentchan); |
423 | 419 | ||
424 | /* Copy the infra. association rates into Current BSS state structure */ | 420 | /* Copy the infra. association rates into Current BSS state structure */ |
425 | memcpy(&adapter->curbssparams.datarates, &rates->rates, | 421 | memcpy(&adapter->curbssparams.datarates, &rates->rates, |
@@ -428,12 +424,12 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
428 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", rates->header.len); | 424 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", rates->header.len); |
429 | 425 | ||
430 | /* set IBSS field */ | 426 | /* set IBSS field */ |
431 | if (pbssdesc->mode == IW_MODE_INFRA) { | 427 | if (bss->mode == IW_MODE_INFRA) { |
432 | #define CAPINFO_ESS_MODE 1 | 428 | #define CAPINFO_ESS_MODE 1 |
433 | passo->capinfo.ess = CAPINFO_ESS_MODE; | 429 | passo->capinfo.ess = CAPINFO_ESS_MODE; |
434 | } | 430 | } |
435 | 431 | ||
436 | if (libertas_parse_dnld_countryinfo_11d(priv)) { | 432 | if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { |
437 | ret = -1; | 433 | ret = -1; |
438 | goto done; | 434 | goto done; |
439 | } | 435 | } |
@@ -441,7 +437,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
441 | cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); | 437 | cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); |
442 | 438 | ||
443 | /* set the capability info at last */ | 439 | /* set the capability info at last */ |
444 | memcpy(&tmpcap, &pbssdesc->cap, sizeof(passo->capinfo)); | 440 | memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo)); |
445 | tmpcap &= CAPINFO_MASK; | 441 | tmpcap &= CAPINFO_MASK; |
446 | lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", | 442 | lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", |
447 | tmpcap, CAPINFO_MASK); | 443 | tmpcap, CAPINFO_MASK); |
@@ -454,7 +450,7 @@ done: | |||
454 | } | 450 | } |
455 | 451 | ||
456 | int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | 452 | int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, |
457 | struct cmd_ds_command *cmd, void *pssid) | 453 | struct cmd_ds_command *cmd, void *pdata_buf) |
458 | { | 454 | { |
459 | wlan_adapter *adapter = priv->adapter; | 455 | wlan_adapter *adapter = priv->adapter; |
460 | struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; | 456 | struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; |
@@ -462,8 +458,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
462 | int cmdappendsize = 0; | 458 | int cmdappendsize = 0; |
463 | int i; | 459 | int i; |
464 | u16 tmpcap; | 460 | u16 tmpcap; |
465 | struct bss_descriptor *pbssdesc; | 461 | struct assoc_request * assoc_req = pdata_buf; |
466 | struct WLAN_802_11_SSID *ssid = pssid; | ||
467 | 462 | ||
468 | lbs_deb_enter(LBS_DEB_JOIN); | 463 | lbs_deb_enter(LBS_DEB_JOIN); |
469 | 464 | ||
@@ -474,9 +469,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
474 | 469 | ||
475 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start); | 470 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start); |
476 | 471 | ||
477 | pbssdesc = &adapter->curbssparams.bssdescriptor; | ||
478 | adapter->pattemptedbssdesc = pbssdesc; | ||
479 | |||
480 | /* | 472 | /* |
481 | * Fill in the parameters for 2 data structures: | 473 | * Fill in the parameters for 2 data structures: |
482 | * 1. cmd_ds_802_11_ad_hoc_start command | 474 | * 1. cmd_ds_802_11_ad_hoc_start command |
@@ -490,19 +482,13 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
490 | */ | 482 | */ |
491 | 483 | ||
492 | memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE); | 484 | memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE); |
493 | 485 | memcpy(adhs->SSID, assoc_req->ssid.ssid, assoc_req->ssid.ssidlength); | |
494 | memcpy(adhs->SSID, ssid->ssid, ssid->ssidlength); | ||
495 | 486 | ||
496 | lbs_deb_join("ADHOC_S_CMD: SSID = %s\n", adhs->SSID); | 487 | lbs_deb_join("ADHOC_S_CMD: SSID = %s\n", adhs->SSID); |
497 | 488 | ||
498 | memset(pbssdesc->ssid.ssid, 0, IW_ESSID_MAX_SIZE); | ||
499 | memcpy(pbssdesc->ssid.ssid, ssid->ssid, ssid->ssidlength); | ||
500 | |||
501 | pbssdesc->ssid.ssidlength = ssid->ssidlength; | ||
502 | |||
503 | /* set the BSS type */ | 489 | /* set the BSS type */ |
504 | adhs->bsstype = cmd_bss_type_ibss; | 490 | adhs->bsstype = cmd_bss_type_ibss; |
505 | pbssdesc->mode = IW_MODE_ADHOC; | 491 | adapter->mode = IW_MODE_ADHOC; |
506 | adhs->beaconperiod = adapter->beaconperiod; | 492 | adhs->beaconperiod = adapter->beaconperiod; |
507 | 493 | ||
508 | /* set Physical param set */ | 494 | /* set Physical param set */ |
@@ -512,16 +498,12 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
512 | adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID; | 498 | adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID; |
513 | adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN; | 499 | adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN; |
514 | 500 | ||
515 | WARN_ON(!adapter->curbssparams.channel); | 501 | WARN_ON(!assoc_req->channel); |
516 | 502 | ||
517 | lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n", | 503 | lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n", |
518 | adapter->curbssparams.channel); | 504 | assoc_req->channel); |
519 | 505 | ||
520 | pbssdesc->channel = adapter->curbssparams.channel; | 506 | adhs->phyparamset.dsparamset.currentchan = assoc_req->channel; |
521 | adhs->phyparamset.dsparamset.currentchan = adapter->curbssparams.channel; | ||
522 | |||
523 | memcpy(&pbssdesc->phyparamset, | ||
524 | &adhs->phyparamset, sizeof(union ieeetypes_phyparamset)); | ||
525 | 507 | ||
526 | /* set IBSS param set */ | 508 | /* set IBSS param set */ |
527 | #define IBSS_PARA_IE_ID 6 | 509 | #define IBSS_PARA_IE_ID 6 |
@@ -530,25 +512,20 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
530 | adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; | 512 | adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; |
531 | adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; | 513 | adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; |
532 | adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow; | 514 | adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow; |
533 | memcpy(&pbssdesc->ssparamset, | ||
534 | &adhs->ssparamset, sizeof(union IEEEtypes_ssparamset)); | ||
535 | 515 | ||
536 | /* set capability info */ | 516 | /* set capability info */ |
537 | adhs->cap.ess = 0; | 517 | adhs->cap.ess = 0; |
538 | adhs->cap.ibss = 1; | 518 | adhs->cap.ibss = 1; |
539 | pbssdesc->cap.ibss = 1; | ||
540 | 519 | ||
541 | /* probedelay */ | 520 | /* probedelay */ |
542 | adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); | 521 | adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); |
543 | 522 | ||
544 | /* set up privacy in adapter->scantable[i] */ | 523 | /* set up privacy in adapter->scantable[i] */ |
545 | if (adapter->secinfo.wep_enabled) { | 524 | if (assoc_req->secinfo.wep_enabled) { |
546 | lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n"); | 525 | lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n"); |
547 | pbssdesc->privacy = wlan802_11privfilter8021xWEP; | ||
548 | adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; | 526 | adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; |
549 | } else { | 527 | } else { |
550 | lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n"); | 528 | lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n"); |
551 | pbssdesc->privacy = wlan802_11privfilteracceptall; | ||
552 | } | 529 | } |
553 | 530 | ||
554 | memset(adhs->datarate, 0, sizeof(adhs->datarate)); | 531 | memset(adhs->datarate, 0, sizeof(adhs->datarate)); |
@@ -610,7 +587,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
610 | { | 587 | { |
611 | wlan_adapter *adapter = priv->adapter; | 588 | wlan_adapter *adapter = priv->adapter; |
612 | struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj; | 589 | struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj; |
613 | struct bss_descriptor *pbssdesc = pdata_buf; | 590 | struct assoc_request * assoc_req = pdata_buf; |
591 | struct bss_descriptor *bss = &assoc_req->bss; | ||
614 | int cmdappendsize = 0; | 592 | int cmdappendsize = 0; |
615 | int ret = 0; | 593 | int ret = 0; |
616 | u8 *card_rates; | 594 | u8 *card_rates; |
@@ -620,27 +598,22 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
620 | 598 | ||
621 | lbs_deb_enter(LBS_DEB_JOIN); | 599 | lbs_deb_enter(LBS_DEB_JOIN); |
622 | 600 | ||
623 | adapter->pattemptedbssdesc = pbssdesc; | ||
624 | |||
625 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join); | 601 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join); |
626 | 602 | ||
627 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; | 603 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; |
628 | 604 | ||
629 | padhocjoin->bssdescriptor.beaconperiod = pbssdesc->beaconperiod; | 605 | padhocjoin->bssdescriptor.beaconperiod = bss->beaconperiod; |
630 | 606 | ||
631 | memcpy(&padhocjoin->bssdescriptor.BSSID, | 607 | memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); |
632 | &pbssdesc->bssid, ETH_ALEN); | 608 | memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength); |
633 | |||
634 | memcpy(&padhocjoin->bssdescriptor.SSID, | ||
635 | &pbssdesc->ssid.ssid, pbssdesc->ssid.ssidlength); | ||
636 | 609 | ||
637 | memcpy(&padhocjoin->bssdescriptor.phyparamset, | 610 | memcpy(&padhocjoin->bssdescriptor.phyparamset, |
638 | &pbssdesc->phyparamset, sizeof(union ieeetypes_phyparamset)); | 611 | &bss->phyparamset, sizeof(union ieeetypes_phyparamset)); |
639 | 612 | ||
640 | memcpy(&padhocjoin->bssdescriptor.ssparamset, | 613 | memcpy(&padhocjoin->bssdescriptor.ssparamset, |
641 | &pbssdesc->ssparamset, sizeof(union IEEEtypes_ssparamset)); | 614 | &bss->ssparamset, sizeof(union IEEEtypes_ssparamset)); |
642 | 615 | ||
643 | memcpy(&tmpcap, &pbssdesc->cap, sizeof(struct ieeetypes_capinfo)); | 616 | memcpy(&tmpcap, &bss->cap, sizeof(struct ieeetypes_capinfo)); |
644 | tmpcap &= CAPINFO_MASK; | 617 | tmpcap &= CAPINFO_MASK; |
645 | 618 | ||
646 | lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", | 619 | lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", |
@@ -649,14 +622,9 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
649 | sizeof(struct ieeetypes_capinfo)); | 622 | sizeof(struct ieeetypes_capinfo)); |
650 | 623 | ||
651 | /* information on BSSID descriptor passed to FW */ | 624 | /* information on BSSID descriptor passed to FW */ |
652 | lbs_deb_join( | 625 | lbs_deb_join( |
653 | "ADHOC_J_CMD: BSSID = %2x-%2x-%2x-%2x-%2x-%2x, SSID = %s\n", | 626 | "ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n", |
654 | padhocjoin->bssdescriptor.BSSID[0], | 627 | MAC_ARG(padhocjoin->bssdescriptor.BSSID), |
655 | padhocjoin->bssdescriptor.BSSID[1], | ||
656 | padhocjoin->bssdescriptor.BSSID[2], | ||
657 | padhocjoin->bssdescriptor.BSSID[3], | ||
658 | padhocjoin->bssdescriptor.BSSID[4], | ||
659 | padhocjoin->bssdescriptor.BSSID[5], | ||
660 | padhocjoin->bssdescriptor.SSID); | 628 | padhocjoin->bssdescriptor.SSID); |
661 | 629 | ||
662 | /* failtimeout */ | 630 | /* failtimeout */ |
@@ -669,14 +637,14 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
669 | /* Copy Data rates from the rates recorded in scan response */ | 637 | /* Copy Data rates from the rates recorded in scan response */ |
670 | memset(padhocjoin->bssdescriptor.datarates, 0, | 638 | memset(padhocjoin->bssdescriptor.datarates, 0, |
671 | sizeof(padhocjoin->bssdescriptor.datarates)); | 639 | sizeof(padhocjoin->bssdescriptor.datarates)); |
672 | memcpy(padhocjoin->bssdescriptor.datarates, pbssdesc->datarates, | 640 | memcpy(padhocjoin->bssdescriptor.datarates, bss->datarates, |
673 | min(sizeof(padhocjoin->bssdescriptor.datarates), | 641 | min(sizeof(padhocjoin->bssdescriptor.datarates), |
674 | sizeof(pbssdesc->datarates))); | 642 | sizeof(bss->datarates))); |
675 | 643 | ||
676 | card_rates = libertas_supported_rates; | 644 | card_rates = libertas_supported_rates; |
677 | card_rates_size = sizeof(libertas_supported_rates); | 645 | card_rates_size = sizeof(libertas_supported_rates); |
678 | 646 | ||
679 | adapter->curbssparams.channel = pbssdesc->channel; | 647 | adapter->curbssparams.channel = bss->channel; |
680 | 648 | ||
681 | if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates, | 649 | if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates, |
682 | sizeof(padhocjoin->bssdescriptor.datarates), | 650 | sizeof(padhocjoin->bssdescriptor.datarates), |
@@ -700,9 +668,9 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
700 | adapter->curbssparams.numofrates); | 668 | adapter->curbssparams.numofrates); |
701 | 669 | ||
702 | padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = | 670 | padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = |
703 | cpu_to_le16(pbssdesc->atimwindow); | 671 | cpu_to_le16(bss->atimwindow); |
704 | 672 | ||
705 | if (adapter->secinfo.wep_enabled) { | 673 | if (assoc_req->secinfo.wep_enabled) { |
706 | padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; | 674 | padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; |
707 | } | 675 | } |
708 | 676 | ||
@@ -722,7 +690,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
722 | } | 690 | } |
723 | } | 691 | } |
724 | 692 | ||
725 | if (libertas_parse_dnld_countryinfo_11d(priv)) { | 693 | if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { |
726 | ret = -1; | 694 | ret = -1; |
727 | goto done; | 695 | goto done; |
728 | } | 696 | } |
@@ -750,17 +718,23 @@ int libertas_ret_80211_associate(wlan_private * priv, | |||
750 | int ret = 0; | 718 | int ret = 0; |
751 | union iwreq_data wrqu; | 719 | union iwreq_data wrqu; |
752 | struct ieeetypes_assocrsp *passocrsp; | 720 | struct ieeetypes_assocrsp *passocrsp; |
753 | struct bss_descriptor *pbssdesc; | 721 | struct bss_descriptor * bss; |
754 | 722 | ||
755 | lbs_deb_enter(LBS_DEB_JOIN); | 723 | lbs_deb_enter(LBS_DEB_JOIN); |
756 | 724 | ||
725 | if (!adapter->in_progress_assoc_req) { | ||
726 | lbs_deb_join("ASSOC_RESP: no in-progress association request\n"); | ||
727 | ret = -1; | ||
728 | goto done; | ||
729 | } | ||
730 | bss = &adapter->in_progress_assoc_req->bss; | ||
731 | |||
757 | passocrsp = (struct ieeetypes_assocrsp *) & resp->params; | 732 | passocrsp = (struct ieeetypes_assocrsp *) & resp->params; |
758 | 733 | ||
759 | if (passocrsp->statuscode) { | 734 | if (passocrsp->statuscode) { |
760 | |||
761 | libertas_mac_event_disconnected(priv); | 735 | libertas_mac_event_disconnected(priv); |
762 | 736 | ||
763 | lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n", | 737 | lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n", |
764 | passocrsp->statuscode); | 738 | passocrsp->statuscode); |
765 | 739 | ||
766 | ret = -1; | 740 | ret = -1; |
@@ -773,22 +747,12 @@ int libertas_ret_80211_associate(wlan_private * priv, | |||
773 | /* Send a Media Connected event, according to the Spec */ | 747 | /* Send a Media Connected event, according to the Spec */ |
774 | adapter->connect_status = libertas_connected; | 748 | adapter->connect_status = libertas_connected; |
775 | 749 | ||
776 | /* Set the attempted BSSID Index to current */ | 750 | lbs_deb_join("ASSOC_RESP: %s\n", bss->ssid.ssid); |
777 | pbssdesc = adapter->pattemptedbssdesc; | ||
778 | |||
779 | lbs_deb_join("ASSOC_RESP: %s\n", pbssdesc->ssid.ssid); | ||
780 | 751 | ||
781 | /* Set the new SSID to current SSID */ | 752 | /* Update current SSID and BSSID */ |
782 | memcpy(&adapter->curbssparams.ssid, | 753 | memcpy(&adapter->curbssparams.ssid, |
783 | &pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID)); | 754 | &bss->ssid, sizeof(struct WLAN_802_11_SSID)); |
784 | 755 | memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); | |
785 | /* Set the new BSSID (AP's MAC address) to current BSSID */ | ||
786 | memcpy(adapter->curbssparams.bssid, | ||
787 | pbssdesc->bssid, ETH_ALEN); | ||
788 | |||
789 | /* Make a copy of current BSSID descriptor */ | ||
790 | memcpy(&adapter->curbssparams.bssdescriptor, | ||
791 | pbssdesc, sizeof(struct bss_descriptor)); | ||
792 | 756 | ||
793 | lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n", | 757 | lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n", |
794 | adapter->currentpacketfilter); | 758 | adapter->currentpacketfilter); |
@@ -838,30 +802,31 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, | |||
838 | u16 result = le16_to_cpu(resp->result); | 802 | u16 result = le16_to_cpu(resp->result); |
839 | struct cmd_ds_802_11_ad_hoc_result *padhocresult; | 803 | struct cmd_ds_802_11_ad_hoc_result *padhocresult; |
840 | union iwreq_data wrqu; | 804 | union iwreq_data wrqu; |
841 | struct bss_descriptor *pbssdesc; | 805 | struct bss_descriptor *bss; |
842 | 806 | ||
843 | lbs_deb_enter(LBS_DEB_JOIN); | 807 | lbs_deb_enter(LBS_DEB_JOIN); |
844 | 808 | ||
845 | padhocresult = &resp->params.result; | 809 | padhocresult = &resp->params.result; |
846 | 810 | ||
847 | lbs_deb_join("ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size)); | 811 | lbs_deb_join("ADHOC_RESP: size = %d\n", le16_to_cpu(resp->size)); |
848 | lbs_deb_join("ADHOC_S_RESP: command = %x\n", command); | 812 | lbs_deb_join("ADHOC_RESP: command = %x\n", command); |
849 | lbs_deb_join("ADHOC_S_RESP: result = %x\n", result); | 813 | lbs_deb_join("ADHOC_RESP: result = %x\n", result); |
850 | 814 | ||
851 | pbssdesc = adapter->pattemptedbssdesc; | 815 | if (!adapter->in_progress_assoc_req) { |
816 | lbs_deb_join("ADHOC_RESP: no in-progress association request\n"); | ||
817 | ret = -1; | ||
818 | goto done; | ||
819 | } | ||
820 | bss = &adapter->in_progress_assoc_req->bss; | ||
852 | 821 | ||
853 | /* | 822 | /* |
854 | * Join result code 0 --> SUCCESS | 823 | * Join result code 0 --> SUCCESS |
855 | */ | 824 | */ |
856 | if (result) { | 825 | if (result) { |
857 | lbs_deb_join("ADHOC_RESP failed\n"); | 826 | lbs_deb_join("ADHOC_RESP: failed\n"); |
858 | if (adapter->connect_status == libertas_connected) { | 827 | if (adapter->connect_status == libertas_connected) { |
859 | libertas_mac_event_disconnected(priv); | 828 | libertas_mac_event_disconnected(priv); |
860 | } | 829 | } |
861 | |||
862 | memset(&adapter->curbssparams.bssdescriptor, | ||
863 | 0x00, sizeof(adapter->curbssparams.bssdescriptor)); | ||
864 | |||
865 | ret = -1; | 830 | ret = -1; |
866 | goto done; | 831 | goto done; |
867 | } | 832 | } |
@@ -870,29 +835,22 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, | |||
870 | * Now the join cmd should be successful | 835 | * Now the join cmd should be successful |
871 | * If BSSID has changed use SSID to compare instead of BSSID | 836 | * If BSSID has changed use SSID to compare instead of BSSID |
872 | */ | 837 | */ |
873 | lbs_deb_join("ADHOC_J_RESP %s\n", pbssdesc->ssid.ssid); | 838 | lbs_deb_join("ADHOC_RESP: %s\n", bss->ssid.ssid); |
874 | 839 | ||
875 | /* Send a Media Connected event, according to the Spec */ | 840 | /* Send a Media Connected event, according to the Spec */ |
876 | adapter->connect_status = libertas_connected; | 841 | adapter->connect_status = libertas_connected; |
877 | 842 | ||
878 | if (command == cmd_ret_802_11_ad_hoc_start) { | 843 | if (command == cmd_ret_802_11_ad_hoc_start) { |
879 | /* Update the created network descriptor with the new BSSID */ | 844 | /* Update the created network descriptor with the new BSSID */ |
880 | memcpy(pbssdesc->bssid, padhocresult->BSSID, ETH_ALEN); | 845 | memcpy(bss->bssid, padhocresult->BSSID, ETH_ALEN); |
881 | } else { | ||
882 | |||
883 | /* Make a copy of current BSSID descriptor, only needed for join since | ||
884 | * the current descriptor is already being used for adhoc start | ||
885 | */ | ||
886 | memmove(&adapter->curbssparams.bssdescriptor, | ||
887 | pbssdesc, sizeof(struct bss_descriptor)); | ||
888 | } | 846 | } |
889 | 847 | ||
890 | /* Set the BSSID from the joined/started descriptor */ | 848 | /* Set the BSSID from the joined/started descriptor */ |
891 | memcpy(&adapter->curbssparams.bssid, pbssdesc->bssid, ETH_ALEN); | 849 | memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); |
892 | 850 | ||
893 | /* Set the new SSID to current SSID */ | 851 | /* Set the new SSID to current SSID */ |
894 | memcpy(&adapter->curbssparams.ssid, | 852 | memcpy(&adapter->curbssparams.ssid, &bss->ssid, |
895 | &pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID)); | 853 | sizeof(struct WLAN_802_11_SSID)); |
896 | 854 | ||
897 | netif_carrier_on(priv->dev); | 855 | netif_carrier_on(priv->dev); |
898 | netif_wake_queue(priv->dev); | 856 | netif_wake_queue(priv->dev); |