aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-05-10 22:58:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-05-11 14:54:54 -0400
commit0dc5a29044d56912bf0d4e5cd19127f82b90c29c (patch)
tree6b9432572a96232da24314b3fa6924d63042028e /drivers/net
parent889c05bdf3056b029b9fa95096eac4f0dfd3fb6f (diff)
[PATCH] libertas: remove WLAN_802_11_NETWORK_INFRASTRUCTURE enum
Use standard IW_MODE_* constants instead. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/libertas/assoc.c34
-rw-r--r--drivers/net/wireless/libertas/cmd.c11
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c2
-rw-r--r--drivers/net/wireless/libertas/defs.h9
-rw-r--r--drivers/net/wireless/libertas/dev.h5
-rw-r--r--drivers/net/wireless/libertas/fw.c2
-rw-r--r--drivers/net/wireless/libertas/ioctl.c6
-rw-r--r--drivers/net/wireless/libertas/join.c30
-rw-r--r--drivers/net/wireless/libertas/scan.c42
-rw-r--r--drivers/net/wireless/libertas/scan.h11
-rw-r--r--drivers/net/wireless/libertas/wext.c65
11 files changed, 85 insertions, 132 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index cc6352ee4385..c260bd1b3d46 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -23,13 +23,13 @@ static int assoc_helper_essid(wlan_private *priv,
23 ENTER(); 23 ENTER();
24 24
25 lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid); 25 lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid);
26 if (assoc_req->mode == wlan802_11infrastructure) { 26 if (assoc_req->mode == IW_MODE_INFRA) {
27 if (adapter->prescan) { 27 if (adapter->prescan) {
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 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
32 NULL, wlan802_11infrastructure); 32 NULL, IW_MODE_INFRA);
33 if (i >= 0) { 33 if (i >= 0) {
34 lbs_pr_debug(1, 34 lbs_pr_debug(1,
35 "SSID found in scan list ... associating...\n"); 35 "SSID found in scan list ... associating...\n");
@@ -44,7 +44,7 @@ static int assoc_helper_essid(wlan_private *priv,
44 lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n", 44 lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n",
45 assoc_req->ssid.ssid); 45 assoc_req->ssid.ssid);
46 } 46 }
47 } else if (assoc_req->mode == wlan802_11ibss) { 47 } else if (assoc_req->mode == IW_MODE_ADHOC) {
48 /* Scan for the network, do not save previous results. Stale 48 /* Scan for the network, do not save previous results. Stale
49 * scan data will cause us to join a non-existant adhoc network 49 * scan data will cause us to join a non-existant adhoc network
50 */ 50 */
@@ -52,7 +52,7 @@ static int assoc_helper_essid(wlan_private *priv,
52 52
53 /* Search for the requested SSID in the scan table */ 53 /* Search for the requested SSID in the scan table */
54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, 54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
55 wlan802_11ibss); 55 IW_MODE_ADHOC);
56 if (i >= 0) { 56 if (i >= 0) {
57 lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret); 57 lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret);
58 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 58 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
@@ -90,10 +90,10 @@ static int assoc_helper_bssid(wlan_private *priv,
90 goto out; 90 goto out;
91 } 91 }
92 92
93 if (assoc_req->mode == wlan802_11infrastructure) { 93 if (assoc_req->mode == IW_MODE_INFRA) {
94 ret = wlan_associate(priv, &adapter->scantable[i]); 94 ret = wlan_associate(priv, &adapter->scantable[i]);
95 lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret); 95 lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret);
96 } else if (assoc_req->mode == wlan802_11ibss) { 96 } else if (assoc_req->mode == IW_MODE_ADHOC) {
97 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 97 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
98 } 98 }
99 memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid, 99 memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid,
@@ -142,23 +142,23 @@ static int assoc_helper_mode(wlan_private *priv,
142 142
143 ENTER(); 143 ENTER();
144 144
145 if (assoc_req->mode == adapter->inframode) { 145 if (assoc_req->mode == adapter->mode) {
146 LEAVE(); 146 LEAVE();
147 return 0; 147 return 0;
148 } 148 }
149 149
150 if (assoc_req->mode == wlan802_11infrastructure) { 150 if (assoc_req->mode == IW_MODE_INFRA) {
151 if (adapter->psstate != PS_STATE_FULL_POWER) 151 if (adapter->psstate != PS_STATE_FULL_POWER)
152 libertas_ps_wakeup(priv, cmd_option_waitforrsp); 152 libertas_ps_wakeup(priv, cmd_option_waitforrsp);
153 adapter->psmode = wlan802_11powermodecam; 153 adapter->psmode = wlan802_11powermodecam;
154 } 154 }
155 155
156 adapter->inframode = assoc_req->mode; 156 adapter->mode = assoc_req->mode;
157 ret = libertas_prepare_and_send_command(priv, 157 ret = libertas_prepare_and_send_command(priv,
158 cmd_802_11_snmp_mib, 158 cmd_802_11_snmp_mib,
159 0, cmd_option_waitforrsp, 159 0, cmd_option_waitforrsp,
160 OID_802_11_INFRASTRUCTURE_MODE, 160 OID_802_11_INFRASTRUCTURE_MODE,
161 (void *) assoc_req->mode); 161 (void *) (size_t) assoc_req->mode);
162 162
163 LEAVE(); 163 LEAVE();
164 return ret; 164 return ret;
@@ -315,7 +315,7 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
315 315
316 /* FIXME: deal with 'auto' mode somehow */ 316 /* FIXME: deal with 'auto' mode somehow */
317 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 317 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
318 if (assoc_req->mode != wlan802_11infrastructure) 318 if (assoc_req->mode != IW_MODE_INFRA)
319 return 1; 319 return 1;
320 } 320 }
321 321
@@ -337,7 +337,7 @@ static int should_stop_adhoc(wlan_adapter *adapter,
337 337
338 /* FIXME: deal with 'auto' mode somehow */ 338 /* FIXME: deal with 'auto' mode somehow */
339 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 339 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
340 if (assoc_req->mode != wlan802_11ibss) 340 if (assoc_req->mode != IW_MODE_ADHOC)
341 return 1; 341 return 1;
342 } 342 }
343 343
@@ -381,7 +381,7 @@ void wlan_association_worker(struct work_struct *work)
381 } 381 }
382 382
383 if (find_any_ssid) { 383 if (find_any_ssid) {
384 enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode; 384 u8 new_mode;
385 385
386 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, 386 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
387 assoc_req->mode, &new_mode); 387 assoc_req->mode, &new_mode);
@@ -392,7 +392,7 @@ void wlan_association_worker(struct work_struct *work)
392 } 392 }
393 393
394 /* Ensure we switch to the mode of the AP */ 394 /* Ensure we switch to the mode of the AP */
395 if (assoc_req->mode == wlan802_11autounknown) { 395 if (assoc_req->mode == IW_MODE_AUTO) {
396 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 396 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
397 assoc_req->mode = new_mode; 397 assoc_req->mode = new_mode;
398 } 398 }
@@ -402,7 +402,7 @@ void wlan_association_worker(struct work_struct *work)
402 * Check if the attributes being changing require deauthentication 402 * Check if the attributes being changing require deauthentication
403 * from the currently associated infrastructure access point. 403 * from the currently associated infrastructure access point.
404 */ 404 */
405 if (adapter->inframode == wlan802_11infrastructure) { 405 if (adapter->mode == IW_MODE_INFRA) {
406 if (should_deauth_infrastructure(adapter, assoc_req)) { 406 if (should_deauth_infrastructure(adapter, assoc_req)) {
407 ret = libertas_send_deauthentication(priv); 407 ret = libertas_send_deauthentication(priv);
408 if (ret) { 408 if (ret) {
@@ -411,7 +411,7 @@ void wlan_association_worker(struct work_struct *work)
411 ret); 411 ret);
412 } 412 }
413 } 413 }
414 } else if (adapter->inframode == wlan802_11ibss) { 414 } else if (adapter->mode == IW_MODE_ADHOC) {
415 if (should_stop_adhoc(adapter, assoc_req)) { 415 if (should_stop_adhoc(adapter, assoc_req)) {
416 ret = libertas_stop_adhoc_network(priv); 416 ret = libertas_stop_adhoc_network(priv);
417 if (ret) { 417 if (ret) {
@@ -542,7 +542,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
542 assoc_req->channel = adapter->curbssparams.channel; 542 assoc_req->channel = adapter->curbssparams.channel;
543 543
544 if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) 544 if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags))
545 assoc_req->mode = adapter->inframode; 545 assoc_req->mode = adapter->mode;
546 546
547 if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 547 if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
548 memcpy(&assoc_req->bssid, adapter->curbssparams.bssid, 548 memcpy(&assoc_req->bssid, adapter->curbssparams.bssid,
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index bfdac58b5c06..092cd20e1227 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -381,15 +381,16 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
381 switch (cmd_oid) { 381 switch (cmd_oid) {
382 case OID_802_11_INFRASTRUCTURE_MODE: 382 case OID_802_11_INFRASTRUCTURE_MODE:
383 { 383 {
384 enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode = 384 u8 mode = (u8) (size_t) pdata_buf;
385 (enum WLAN_802_11_NETWORK_INFRASTRUCTURE) pdata_buf;
386 pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); 385 pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
387 pSNMPMIB->oid = cpu_to_le16((u16) desired_bsstype_i); 386 pSNMPMIB->oid = cpu_to_le16((u16) desired_bsstype_i);
388 pSNMPMIB->bufsize = sizeof(u8); 387 pSNMPMIB->bufsize = sizeof(u8);
389 if (mode == wlan802_11infrastructure) 388 if (mode == IW_MODE_ADHOC) {
390 ucTemp = SNMP_MIB_VALUE_INFRA;
391 else
392 ucTemp = SNMP_MIB_VALUE_ADHOC; 389 ucTemp = SNMP_MIB_VALUE_ADHOC;
390 } else {
391 /* Infra and Auto modes */
392 ucTemp = SNMP_MIB_VALUE_INFRA;
393 }
393 394
394 memmove(pSNMPMIB->value, &ucTemp, sizeof(u8)); 395 memmove(pSNMPMIB->value, &ucTemp, sizeof(u8));
395 396
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 001cdef27343..c86454034b58 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -809,7 +809,7 @@ int libertas_process_rx_command(wlan_private * priv)
809 if (result) { 809 if (result) {
810 lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n", 810 lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n",
811 resp->result); 811 resp->result);
812 if (adapter->inframode == wlan802_11ibss) { 812 if (adapter->mode == IW_MODE_ADHOC) {
813 /* 813 /*
814 * We should not re-try enter-ps command in 814 * We should not re-try enter-ps command in
815 * ad-hoc mode. It takes place in 815 * ad-hoc mode. It takes place in
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h
index 1168903972df..9156bbc53a38 100644
--- a/drivers/net/wireless/libertas/defs.h
+++ b/drivers/net/wireless/libertas/defs.h
@@ -267,15 +267,6 @@ enum mv_ms_type {
267 MVMS_EVENT 267 MVMS_EVENT
268}; 268};
269 269
270/** WLAN_802_11_NETWORK_INFRASTRUCTURE */
271enum WLAN_802_11_NETWORK_INFRASTRUCTURE {
272 wlan802_11ibss,
273 wlan802_11infrastructure,
274 wlan802_11autounknown,
275 /*defined as upper bound */
276 wlan802_11infrastructuremax
277};
278
279/** SNMP_MIB_INDEX_e */ 270/** SNMP_MIB_INDEX_e */
280enum SNMP_MIB_INDEX_e { 271enum SNMP_MIB_INDEX_e {
281 desired_bsstype_i = 0, 272 desired_bsstype_i = 0,
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 014bc1e8b7cc..e8b9020f9bd6 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -183,7 +183,7 @@ struct assoc_request {
183 183
184 struct WLAN_802_11_SSID ssid; 184 struct WLAN_802_11_SSID ssid;
185 u8 channel; 185 u8 channel;
186 enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode; 186 u8 mode;
187 u8 bssid[ETH_ALEN]; 187 u8 bssid[ETH_ALEN];
188 188
189 /** WEP keys */ 189 /** WEP keys */
@@ -252,7 +252,8 @@ struct _wlan_adapter {
252 /** current ssid/bssid related parameters*/ 252 /** current ssid/bssid related parameters*/
253 struct current_bss_params curbssparams; 253 struct current_bss_params curbssparams;
254 254
255 enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode; 255 /* IW_MODE_* */
256 u8 mode;
256 257
257 struct bss_descriptor *pattemptedbssdesc; 258 struct bss_descriptor *pattemptedbssdesc;
258 259
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 565506a9920b..441123c85e62 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -200,7 +200,7 @@ static void wlan_init_adapter(wlan_private * priv)
200 memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY)); 200 memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY));
201 adapter->wep_tx_keyidx = 0; 201 adapter->wep_tx_keyidx = 0;
202 adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 202 adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
203 adapter->inframode = wlan802_11infrastructure; 203 adapter->mode = IW_MODE_INFRA;
204 204
205 adapter->assoc_req = NULL; 205 adapter->assoc_req = NULL;
206 206
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c
index 054c6578d6f7..636a0897150e 100644
--- a/drivers/net/wireless/libertas/ioctl.c
+++ b/drivers/net/wireless/libertas/ioctl.c
@@ -445,8 +445,8 @@ static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq)
445 445
446 memset(status, 0, sizeof(status)); 446 memset(status, 0, sizeof(status));
447 447
448 switch (adapter->inframode) { 448 switch (adapter->mode) {
449 case wlan802_11ibss: 449 case IW_MODE_ADHOC:
450 if (adapter->connect_status == libertas_connected) { 450 if (adapter->connect_status == libertas_connected) {
451 if (adapter->adhoccreate) 451 if (adapter->adhoccreate)
452 memcpy(&status, "AdhocStarted", sizeof(status)); 452 memcpy(&status, "AdhocStarted", sizeof(status));
@@ -456,7 +456,7 @@ static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq)
456 memcpy(&status, "AdhocIdle", sizeof(status)); 456 memcpy(&status, "AdhocIdle", sizeof(status));
457 } 457 }
458 break; 458 break;
459 case wlan802_11infrastructure: 459 case IW_MODE_INFRA:
460 memcpy(&status, "Inframode", sizeof(status)); 460 memcpy(&status, "Inframode", sizeof(status));
461 break; 461 break;
462 default: 462 default:
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index 5a466eced979..2292c14a1531 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -87,7 +87,7 @@ int libertas_send_deauth(wlan_private * priv)
87 wlan_adapter *adapter = priv->adapter; 87 wlan_adapter *adapter = priv->adapter;
88 int ret = 0; 88 int ret = 0;
89 89
90 if (adapter->inframode == wlan802_11infrastructure && 90 if (adapter->mode == IW_MODE_INFRA &&
91 adapter->connect_status == libertas_connected) 91 adapter->connect_status == libertas_connected)
92 ret = libertas_send_deauthentication(priv); 92 ret = libertas_send_deauthentication(priv);
93 else 93 else
@@ -101,7 +101,7 @@ int libertas_do_adhocstop_ioctl(wlan_private * priv)
101 wlan_adapter *adapter = priv->adapter; 101 wlan_adapter *adapter = priv->adapter;
102 int ret = 0; 102 int ret = 0;
103 103
104 if (adapter->inframode == wlan802_11ibss && 104 if (adapter->mode == IW_MODE_ADHOC &&
105 adapter->connect_status == libertas_connected) 105 adapter->connect_status == libertas_connected)
106 ret = libertas_stop_adhoc_network(priv); 106 ret = libertas_stop_adhoc_network(priv);
107 else 107 else
@@ -209,8 +209,7 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
209 /* check if the requested SSID is already joined */ 209 /* check if the requested SSID is already joined */
210 if (adapter->curbssparams.ssid.ssidlength 210 if (adapter->curbssparams.ssid.ssidlength
211 && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid) 211 && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid)
212 && (adapter->curbssparams.bssdescriptor.inframode == 212 && (adapter->mode == IW_MODE_ADHOC)) {
213 wlan802_11ibss)) {
214 213
215 lbs_pr_debug(1, 214 lbs_pr_debug(1,
216 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " 215 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
@@ -278,7 +277,7 @@ int libertas_idle_off(wlan_private * priv)
278 ENTER(); 277 ENTER();
279 278
280 if (adapter->connect_status == libertas_disconnected) { 279 if (adapter->connect_status == libertas_disconnected) {
281 if (adapter->inframode == wlan802_11infrastructure) { 280 if (adapter->mode == IW_MODE_INFRA) {
282 if (memcmp(adapter->previousbssid, zeromac, 281 if (memcmp(adapter->previousbssid, zeromac,
283 sizeof(zeromac)) != 0) { 282 sizeof(zeromac)) != 0) {
284 283
@@ -296,7 +295,7 @@ int libertas_idle_off(wlan_private * priv)
296 i = libertas_find_SSID_in_list(adapter, 295 i = libertas_find_SSID_in_list(adapter,
297 &adapter->previousssid, 296 &adapter->previousssid,
298 adapter->previousbssid, 297 adapter->previousbssid,
299 adapter->inframode); 298 adapter->mode);
300 299
301 if (i < 0) { 300 if (i < 0) {
302 libertas_send_specific_BSSID_scan(priv, 301 libertas_send_specific_BSSID_scan(priv,
@@ -308,8 +307,7 @@ int libertas_idle_off(wlan_private * priv)
308 previousssid, 307 previousssid,
309 adapter-> 308 adapter->
310 previousbssid, 309 previousbssid,
311 adapter-> 310 adapter->mode);
312 inframode);
313 } 311 }
314 312
315 if (i < 0) { 313 if (i < 0) {
@@ -317,8 +315,7 @@ int libertas_idle_off(wlan_private * priv)
317 i = libertas_find_SSID_in_list(adapter, 315 i = libertas_find_SSID_in_list(adapter,
318 &adapter-> 316 &adapter->
319 previousssid, NULL, 317 previousssid, NULL,
320 adapter-> 318 adapter->mode);
321 inframode);
322 } 319 }
323 320
324 if (i < 0) { 321 if (i < 0) {
@@ -329,8 +326,7 @@ int libertas_idle_off(wlan_private * priv)
329 i = libertas_find_SSID_in_list(adapter, 326 i = libertas_find_SSID_in_list(adapter,
330 &adapter-> 327 &adapter->
331 previousssid, NULL, 328 previousssid, NULL,
332 adapter-> 329 adapter->mode);
333 inframode);
334 } 330 }
335 331
336 if (i >= 0) { 332 if (i >= 0) {
@@ -340,7 +336,7 @@ int libertas_idle_off(wlan_private * priv)
340 scantable[i]); 336 scantable[i]);
341 } 337 }
342 } 338 }
343 } else if (adapter->inframode == wlan802_11ibss) { 339 } else if (adapter->mode == IW_MODE_ADHOC) {
344 ret = libertas_prepare_and_send_command(priv, 340 ret = libertas_prepare_and_send_command(priv,
345 cmd_802_11_ad_hoc_start, 341 cmd_802_11_ad_hoc_start,
346 0, 342 0,
@@ -367,7 +363,7 @@ int libertas_idle_on(wlan_private * priv)
367 int ret = 0; 363 int ret = 0;
368 364
369 if (adapter->connect_status == libertas_connected) { 365 if (adapter->connect_status == libertas_connected) {
370 if (adapter->inframode == wlan802_11infrastructure) { 366 if (adapter->mode == IW_MODE_INFRA) {
371 lbs_pr_debug(1, "Previous SSID = %s\n", 367 lbs_pr_debug(1, "Previous SSID = %s\n",
372 adapter->previousssid.ssid); 368 adapter->previousssid.ssid);
373 memmove(&adapter->previousssid, 369 memmove(&adapter->previousssid,
@@ -375,7 +371,7 @@ int libertas_idle_on(wlan_private * priv)
375 sizeof(struct WLAN_802_11_SSID)); 371 sizeof(struct WLAN_802_11_SSID));
376 libertas_send_deauth(priv); 372 libertas_send_deauth(priv);
377 373
378 } else if (adapter->inframode == wlan802_11ibss) { 374 } else if (adapter->mode == IW_MODE_ADHOC) {
379 ret = libertas_stop_adhoc_network(priv); 375 ret = libertas_stop_adhoc_network(priv);
380 } 376 }
381 377
@@ -569,7 +565,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
569 lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len); 565 lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
570 566
571 /* set IBSS field */ 567 /* set IBSS field */
572 if (pbssdesc->inframode == wlan802_11infrastructure) { 568 if (pbssdesc->mode == IW_MODE_INFRA) {
573#define CAPINFO_ESS_MODE 1 569#define CAPINFO_ESS_MODE 1
574 passo->capinfo.ess = CAPINFO_ESS_MODE; 570 passo->capinfo.ess = CAPINFO_ESS_MODE;
575 } 571 }
@@ -643,7 +639,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
643 639
644 /* set the BSS type */ 640 /* set the BSS type */
645 adhs->bsstype = cmd_bss_type_ibss; 641 adhs->bsstype = cmd_bss_type_ibss;
646 pbssdesc->inframode = wlan802_11ibss; 642 pbssdesc->mode = IW_MODE_ADHOC;
647 adhs->beaconperiod = adapter->beaconperiod; 643 adhs->beaconperiod = adapter->beaconperiod;
648 644
649 /* set Physical param set */ 645 /* set Physical param set */
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 23f100a971b5..26488b08f057 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -84,11 +84,11 @@
84 * 84 *
85 * @return Index in scantable, or error code if negative 85 * @return Index in scantable, or error code if negative
86 */ 86 */
87static int is_network_compatible(wlan_adapter * adapter, int index, int mode) 87static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
88{ 88{
89 ENTER(); 89 ENTER();
90 90
91 if (adapter->scantable[index].inframode == mode) { 91 if (adapter->scantable[index].mode == mode) {
92 if ( !adapter->secinfo.wep_enabled 92 if ( !adapter->secinfo.wep_enabled
93 && !adapter->secinfo.WPAenabled 93 && !adapter->secinfo.WPAenabled
94 && !adapter->secinfo.WPA2enabled 94 && !adapter->secinfo.WPA2enabled
@@ -996,9 +996,9 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
996 } 996 }
997 997
998 if (pcap->ibss == 1) { 998 if (pcap->ibss == 1) {
999 pBSSEntry->inframode = wlan802_11ibss; 999 pBSSEntry->mode = IW_MODE_ADHOC;
1000 } else { 1000 } else {
1001 pBSSEntry->inframode = wlan802_11infrastructure; 1001 pBSSEntry->mode = IW_MODE_INFRA;
1002 } 1002 }
1003 1003
1004 /* process variable IE */ 1004 /* process variable IE */
@@ -1196,7 +1196,7 @@ int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *s
1196 * 1196 *
1197 * @return index in BSSID list, or error return code (< 0) 1197 * @return index in BSSID list, or error return code (< 0)
1198 */ 1198 */
1199int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode) 1199int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
1200{ 1200{
1201 int ret = -ENETUNREACH; 1201 int ret = -ENETUNREACH;
1202 int i; 1202 int i;
@@ -1216,8 +1216,8 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode)
1216 for (i = 0; ret < 0 && i < adapter->numinscantable; i++) { 1216 for (i = 0; ret < 0 && i < adapter->numinscantable; i++) {
1217 if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) { 1217 if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) {
1218 switch (mode) { 1218 switch (mode) {
1219 case wlan802_11infrastructure: 1219 case IW_MODE_INFRA:
1220 case wlan802_11ibss: 1220 case IW_MODE_ADHOC:
1221 ret = is_network_compatible(adapter, i, mode); 1221 ret = is_network_compatible(adapter, i, mode);
1222 break; 1222 break;
1223 default: 1223 default:
@@ -1241,7 +1241,7 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode)
1241 * @return index in BSSID list 1241 * @return index in BSSID list
1242 */ 1242 */
1243int libertas_find_SSID_in_list(wlan_adapter * adapter, 1243int libertas_find_SSID_in_list(wlan_adapter * adapter,
1244 struct WLAN_802_11_SSID *ssid, u8 * bssid, int mode) 1244 struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode)
1245{ 1245{
1246 int net = -ENETUNREACH; 1246 int net = -ENETUNREACH;
1247 u8 bestrssi = 0; 1247 u8 bestrssi = 0;
@@ -1256,8 +1256,8 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1256 !memcmp(adapter->scantable[i]. 1256 !memcmp(adapter->scantable[i].
1257 macaddress, bssid, ETH_ALEN))) { 1257 macaddress, bssid, ETH_ALEN))) {
1258 switch (mode) { 1258 switch (mode) {
1259 case wlan802_11infrastructure: 1259 case IW_MODE_INFRA:
1260 case wlan802_11ibss: 1260 case IW_MODE_ADHOC:
1261 j = is_network_compatible(adapter, i, mode); 1261 j = is_network_compatible(adapter, i, mode);
1262 1262
1263 if (j >= 0) { 1263 if (j >= 0) {
@@ -1280,7 +1280,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1280 } 1280 }
1281 } 1281 }
1282 break; 1282 break;
1283 case wlan802_11autounknown: 1283 case IW_MODE_AUTO:
1284 default: 1284 default:
1285 if (SCAN_RSSI(adapter->scantable[i].rssi) 1285 if (SCAN_RSSI(adapter->scantable[i].rssi)
1286 > bestrssi) { 1286 > bestrssi) {
@@ -1307,8 +1307,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1307 * 1307 *
1308 * @return index in BSSID list 1308 * @return index in BSSID list
1309 */ 1309 */
1310int libertas_find_best_SSID_in_list(wlan_adapter * adapter, 1310int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
1311 enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode)
1312{ 1311{
1313 int bestnet = -ENETUNREACH; 1312 int bestnet = -ENETUNREACH;
1314 u8 bestrssi = 0; 1313 u8 bestrssi = 0;
@@ -1320,8 +1319,8 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1320 1319
1321 for (i = 0; i < adapter->numinscantable; i++) { 1320 for (i = 0; i < adapter->numinscantable; i++) {
1322 switch (mode) { 1321 switch (mode) {
1323 case wlan802_11infrastructure: 1322 case IW_MODE_INFRA:
1324 case wlan802_11ibss: 1323 case IW_MODE_ADHOC:
1325 if (is_network_compatible(adapter, i, mode) >= 0) { 1324 if (is_network_compatible(adapter, i, mode) >= 0) {
1326 if (SCAN_RSSI(adapter->scantable[i].rssi) > 1325 if (SCAN_RSSI(adapter->scantable[i].rssi) >
1327 bestrssi) { 1326 bestrssi) {
@@ -1332,7 +1331,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1332 } 1331 }
1333 } 1332 }
1334 break; 1333 break;
1335 case wlan802_11autounknown: 1334 case IW_MODE_AUTO:
1336 default: 1335 default:
1337 if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) { 1336 if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) {
1338 bestrssi = 1337 bestrssi =
@@ -1357,8 +1356,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1357 */ 1356 */
1358int libertas_find_best_network_SSID(wlan_private * priv, 1357int libertas_find_best_network_SSID(wlan_private * priv,
1359 struct WLAN_802_11_SSID *pSSID, 1358 struct WLAN_802_11_SSID *pSSID,
1360 enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, 1359 u8 preferred_mode, u8 *out_mode)
1361 enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode)
1362{ 1360{
1363 wlan_adapter *adapter = priv->adapter; 1361 wlan_adapter *adapter = priv->adapter;
1364 int ret = 0; 1362 int ret = 0;
@@ -1383,7 +1381,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
1383 preqbssid = &adapter->scantable[i]; 1381 preqbssid = &adapter->scantable[i];
1384 memcpy(pSSID, &preqbssid->ssid, 1382 memcpy(pSSID, &preqbssid->ssid,
1385 sizeof(struct WLAN_802_11_SSID)); 1383 sizeof(struct WLAN_802_11_SSID));
1386 *out_mode = preqbssid->inframode; 1384 *out_mode = preqbssid->mode;
1387 1385
1388 if (!pSSID->ssidlength) { 1386 if (!pSSID->ssidlength) {
1389 ret = -1; 1387 ret = -1;
@@ -1601,7 +1599,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1601 1599
1602 //Add mode 1600 //Add mode
1603 iwe.cmd = SIOCGIWMODE; 1601 iwe.cmd = SIOCGIWMODE;
1604 iwe.u.mode = adapter->scantable[i].inframode + 1; 1602 iwe.u.mode = adapter->scantable[i].mode;
1605 iwe.len = IW_EV_UINT_LEN; 1603 iwe.len = IW_EV_UINT_LEN;
1606 current_ev = 1604 current_ev =
1607 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); 1605 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
@@ -1635,7 +1633,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1635 iwe.u.qual.noise = 1633 iwe.u.qual.noise =
1636 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); 1634 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1637 } 1635 }
1638 if ((adapter->inframode == wlan802_11ibss) && 1636 if ((adapter->mode == IW_MODE_ADHOC) &&
1639 !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1637 !libertas_SSID_cmp(&adapter->curbssparams.ssid,
1640 &adapter->scantable[i].ssid) 1638 &adapter->scantable[i].ssid)
1641 && adapter->adhoccreate) { 1639 && adapter->adhoccreate) {
@@ -1700,7 +1698,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1700 end_buf, &iwe, iwe.len); 1698 end_buf, &iwe, iwe.len);
1701 1699
1702 } 1700 }
1703 if ((adapter->scantable[i].inframode == wlan802_11ibss) 1701 if ((adapter->scantable[i].mode == IW_MODE_ADHOC)
1704 && !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1702 && !libertas_SSID_cmp(&adapter->curbssparams.ssid,
1705 &adapter->scantable[i].ssid) 1703 &adapter->scantable[i].ssid)
1706 && adapter->adhoccreate) { 1704 && adapter->adhoccreate) {
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h
index 486bdc4f0935..405f4f0fe575 100644
--- a/drivers/net/wireless/libertas/scan.h
+++ b/drivers/net/wireless/libertas/scan.h
@@ -153,7 +153,7 @@ struct bss_descriptor {
153 153
154 u32 atimwindow; 154 u32 atimwindow;
155 155
156 enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode; 156 u8 mode;
157 u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; 157 u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
158 158
159 int extra_ie; 159 int extra_ie;
@@ -177,14 +177,13 @@ struct bss_descriptor {
177extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, 177extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
178 struct WLAN_802_11_SSID *ssid2); 178 struct WLAN_802_11_SSID *ssid2);
179extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid, 179extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid,
180 u8 * bssid, int mode); 180 u8 * bssid, u8 mode);
181int libertas_find_best_SSID_in_list(wlan_adapter * adapter, enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode); 181int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode);
182extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode); 182extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode);
183 183
184int libertas_find_best_network_SSID(wlan_private * priv, 184int libertas_find_best_network_SSID(wlan_private * priv,
185 struct WLAN_802_11_SSID *pSSID, 185 struct WLAN_802_11_SSID *pSSID,
186 enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, 186 u8 preferred_mode, u8 *out_mode);
187 enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode);
188 187
189extern int libertas_send_specific_SSID_scan(wlan_private * priv, 188extern int libertas_send_specific_SSID_scan(wlan_private * priv,
190 struct WLAN_802_11_SSID *prequestedssid, 189 struct WLAN_802_11_SSID *prequestedssid,
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 62d92ff9fc1c..18629af33282 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -233,7 +233,7 @@ static int changeadhocchannel(wlan_private * priv, int channel)
233 233
234 // find out the BSSID that matches the current SSID 234 // find out the BSSID that matches the current SSID
235 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL, 235 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
236 wlan802_11ibss); 236 IW_MODE_ADHOC);
237 237
238 if (i >= 0) { 238 if (i >= 0) {
239 lbs_pr_debug(1, "SSID found at %d in List," 239 lbs_pr_debug(1, "SSID found at %d in List,"
@@ -316,13 +316,11 @@ static int get_active_data_rates(wlan_adapter * adapter,
316 ENTER(); 316 ENTER();
317 317
318 if (adapter->connect_status != libertas_connected) { 318 if (adapter->connect_status != libertas_connected) {
319 if (adapter->inframode == wlan802_11infrastructure) { 319 if (adapter->mode == IW_MODE_INFRA) {
320 //Infra. mode
321 lbs_pr_debug(1, "Infra\n"); 320 lbs_pr_debug(1, "Infra\n");
322 k = copyrates(rates, k, libertas_supported_rates, 321 k = copyrates(rates, k, libertas_supported_rates,
323 sizeof(libertas_supported_rates)); 322 sizeof(libertas_supported_rates));
324 } else { 323 } else {
325 //ad-hoc mode
326 lbs_pr_debug(1, "Adhoc G\n"); 324 lbs_pr_debug(1, "Adhoc G\n");
327 k = copyrates(rates, k, libertas_adhoc_rates_g, 325 k = copyrates(rates, k, libertas_adhoc_rates_g,
328 sizeof(libertas_adhoc_rates_g)); 326 sizeof(libertas_adhoc_rates_g));
@@ -586,20 +584,7 @@ static int wlan_get_mode(struct net_device *dev,
586 584
587 ENTER(); 585 ENTER();
588 586
589 switch (adapter->inframode) { 587 *uwrq = adapter->mode;
590 case wlan802_11ibss:
591 *uwrq = IW_MODE_ADHOC;
592 break;
593
594 case wlan802_11infrastructure:
595 *uwrq = IW_MODE_INFRA;
596 break;
597
598 default:
599 case wlan802_11autounknown:
600 *uwrq = IW_MODE_AUTO;
601 break;
602 }
603 588
604 LEAVE(); 589 LEAVE();
605 return 0; 590 return 0;
@@ -1417,7 +1402,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1417 1402
1418 ENTER(); 1403 ENTER();
1419 1404
1420 priv->wstats.status = adapter->inframode; 1405 priv->wstats.status = adapter->mode;
1421 1406
1422 /* If we're not associated, all quality values are meaningless */ 1407 /* If we're not associated, all quality values are meaningless */
1423 if (adapter->connect_status != libertas_connected) 1408 if (adapter->connect_status != libertas_connected)
@@ -1551,7 +1536,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1551 if (!cfp) { 1536 if (!cfp) {
1552 rc = -EINVAL; 1537 rc = -EINVAL;
1553 } else { 1538 } else {
1554 if (adapter->inframode == wlan802_11ibss) { 1539 if (adapter->mode == IW_MODE_ADHOC) {
1555 rc = changeadhocchannel(priv, channel); 1540 rc = changeadhocchannel(priv, channel);
1556 /* If station is WEP enabled, send the 1541 /* If station is WEP enabled, send the
1557 * command to set WEP in firmware 1542 * command to set WEP in firmware
@@ -1698,49 +1683,31 @@ static int wlan_set_mode(struct net_device *dev,
1698 wlan_private *priv = dev->priv; 1683 wlan_private *priv = dev->priv;
1699 wlan_adapter *adapter = priv->adapter; 1684 wlan_adapter *adapter = priv->adapter;
1700 struct assoc_request * assoc_req; 1685 struct assoc_request * assoc_req;
1701 enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode;
1702 1686
1703 ENTER(); 1687 ENTER();
1704 1688
1705 switch (*uwrq) { 1689 if ( (*uwrq != IW_MODE_ADHOC)
1706 case IW_MODE_ADHOC: 1690 && (*uwrq != IW_MODE_INFRA)
1707 lbs_pr_debug(1, "Wanted mode is ad-hoc: current datarate=%#x\n", 1691 && (*uwrq != IW_MODE_AUTO)) {
1708 adapter->datarate); 1692 lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq);
1709 new_mode = wlan802_11ibss; 1693 ret = -EINVAL;
1710 adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL; 1694 goto out;
1711 break;
1712
1713 case IW_MODE_INFRA:
1714 lbs_pr_debug(1, "Wanted mode is Infrastructure\n");
1715 new_mode = wlan802_11infrastructure;
1716 break;
1717
1718 case IW_MODE_AUTO:
1719 lbs_pr_debug(1, "Wanted mode is Auto\n");
1720 new_mode = wlan802_11autounknown;
1721 break;
1722
1723 default:
1724 lbs_pr_debug(1, "Wanted mode is Unknown: 0x%x\n", *uwrq);
1725 return -EINVAL;
1726 } 1695 }
1727 1696
1728 mutex_lock(&adapter->lock); 1697 mutex_lock(&adapter->lock);
1729 assoc_req = wlan_get_association_request(adapter); 1698 assoc_req = wlan_get_association_request(adapter);
1730 if (!assoc_req) { 1699 if (!assoc_req) {
1731 ret = -ENOMEM; 1700 ret = -ENOMEM;
1701 wlan_cancel_association_work(priv);
1732 } else { 1702 } else {
1733 assoc_req->mode = new_mode; 1703 assoc_req->mode = *uwrq;
1734 }
1735
1736 if (ret == 0) {
1737 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 1704 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
1738 wlan_postpone_association_work(priv); 1705 wlan_postpone_association_work(priv);
1739 } else { 1706 lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq);
1740 wlan_cancel_association_work(priv);
1741 } 1707 }
1742 mutex_unlock(&adapter->lock); 1708 mutex_unlock(&adapter->lock);
1743 1709
1710out:
1744 LEAVE(); 1711 LEAVE();
1745 return ret; 1712 return ret;
1746} 1713}
@@ -2037,7 +2004,7 @@ static int wlan_get_encodeext(struct net_device *dev,
2037 2004
2038 if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && 2005 if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
2039 ext->alg != IW_ENCODE_ALG_WEP) { 2006 ext->alg != IW_ENCODE_ALG_WEP) {
2040 if (index != 0 || adapter->inframode != wlan802_11infrastructure) 2007 if (index != 0 || adapter->mode != IW_MODE_INFRA)
2041 goto out; 2008 goto out;
2042 } 2009 }
2043 2010