aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/wext.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r--drivers/net/wireless/libertas/wext.c352
1 files changed, 176 insertions, 176 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 408bc0aa9567..3cbefea68738 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -110,8 +110,8 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada
110 } 110 }
111 111
112 if (!cfp && channel) 112 if (!cfp && channel)
113 lbs_pr_debug(1, "libertas_find_cfp_by_band_and_channel(): cannot find " 113 lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find "
114 "cfp by band %d & channel %d\n", band, channel); 114 "cfp by band %d / channel %d\n", band, channel);
115 115
116 return cfp; 116 return cfp;
117} 117}
@@ -151,8 +151,8 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter,
151 } 151 }
152 152
153 if (!cfp && freq) 153 if (!cfp && freq)
154 lbs_pr_debug(1, "find_cfp_by_band_and_freql(): cannot find cfp by " 154 lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by "
155 "band %d & freq %d\n", band, freq); 155 "band %d / freq %d\n", band, freq);
156 156
157 return cfp; 157 return cfp;
158} 158}
@@ -168,7 +168,7 @@ static int updatecurrentchannel(wlan_private * priv)
168 cmd_opt_802_11_rf_channel_get, 168 cmd_opt_802_11_rf_channel_get,
169 cmd_option_waitforrsp, 0, NULL); 169 cmd_option_waitforrsp, 0, NULL);
170 170
171 lbs_pr_debug(1, "Current channel = %d\n", 171 lbs_deb_wext("current channel %d\n",
172 priv->adapter->curbssparams.channel); 172 priv->adapter->curbssparams.channel);
173 173
174 return ret; 174 return ret;
@@ -176,7 +176,7 @@ static int updatecurrentchannel(wlan_private * priv)
176 176
177static int setcurrentchannel(wlan_private * priv, int channel) 177static int setcurrentchannel(wlan_private * priv, int channel)
178{ 178{
179 lbs_pr_debug(1, "Set channel = %d\n", channel); 179 lbs_deb_wext("set channel %d\n", channel);
180 180
181 /* 181 /*
182 ** Current channel is not set to adhocchannel requested, set channel 182 ** Current channel is not set to adhocchannel requested, set channel
@@ -197,11 +197,10 @@ static int changeadhocchannel(wlan_private * priv, int channel)
197 197
198 if (adapter->curbssparams.channel == adapter->adhocchannel) { 198 if (adapter->curbssparams.channel == adapter->adhocchannel) {
199 /* adhocchannel is set to the current channel already */ 199 /* adhocchannel is set to the current channel already */
200 LEAVE(); 200 goto out;
201 return 0;
202 } 201 }
203 202
204 lbs_pr_debug(1, "Updating channel from %d to %d\n", 203 lbs_deb_wext("updating channel from %d to %d\n",
205 adapter->curbssparams.channel, adapter->adhocchannel); 204 adapter->curbssparams.channel, adapter->adhocchannel);
206 205
207 setcurrentchannel(priv, adapter->adhocchannel); 206 setcurrentchannel(priv, adapter->adhocchannel);
@@ -209,30 +208,29 @@ static int changeadhocchannel(wlan_private * priv, int channel)
209 updatecurrentchannel(priv); 208 updatecurrentchannel(priv);
210 209
211 if (adapter->curbssparams.channel != adapter->adhocchannel) { 210 if (adapter->curbssparams.channel != adapter->adhocchannel) {
212 lbs_pr_debug(1, "failed to updated channel to %d, channel = %d\n", 211 lbs_deb_wext("failed to updated channel to %d, channel = %d\n",
213 adapter->adhocchannel, adapter->curbssparams.channel); 212 adapter->adhocchannel, adapter->curbssparams.channel);
214 LEAVE(); 213 ret = -1;
215 return -1; 214 goto out;
216 } 215 }
217 216
218 if (adapter->connect_status == libertas_connected) { 217 if (adapter->connect_status == libertas_connected) {
219 int i; 218 int i;
220 struct WLAN_802_11_SSID curadhocssid; 219 struct WLAN_802_11_SSID curadhocssid;
221 220
222 lbs_pr_debug(1, "channel Changed while in an IBSS\n"); 221 lbs_deb_wext("channel changed while in IBSS\n");
223 222
224 /* Copy the current ssid */ 223 /* Copy the current ssid */
225 memcpy(&curadhocssid, &adapter->curbssparams.ssid, 224 memcpy(&curadhocssid, &adapter->curbssparams.ssid,
226 sizeof(struct WLAN_802_11_SSID)); 225 sizeof(struct WLAN_802_11_SSID));
227 226
228 /* Exit Adhoc mode */ 227 /* Exit Adhoc mode */
229 lbs_pr_debug(1, "In changeadhocchannel(): Sending Adhoc Stop\n"); 228 lbs_deb_wext("in changeadhocchannel(): sending Adhoc stop\n");
230 ret = libertas_stop_adhoc_network(priv); 229 ret = libertas_stop_adhoc_network(priv);
231 230
232 if (ret) { 231 if (ret)
233 LEAVE(); 232 goto out;
234 return ret; 233
235 }
236 /* Scan for the network, do not save previous results. Stale 234 /* Scan for the network, do not save previous results. Stale
237 * scan data will cause us to join a non-existant adhoc network 235 * scan data will cause us to join a non-existant adhoc network
238 */ 236 */
@@ -243,20 +241,21 @@ static int changeadhocchannel(wlan_private * priv, int channel)
243 IW_MODE_ADHOC); 241 IW_MODE_ADHOC);
244 242
245 if (i >= 0) { 243 if (i >= 0) {
246 lbs_pr_debug(1, "SSID found at %d in List," 244 lbs_deb_wext("SSID found at %d in list,"
247 "so join\n", i); 245 "so join\n", i);
248 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 246 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
249 } else { 247 } else {
250 // else send START command 248 // else send START command
251 lbs_pr_debug(1, "SSID not found in list, " 249 lbs_deb_wext("SSID not found in list, "
252 "so creating adhoc with ssid = %s\n", 250 "creating AdHoc with SSID '%s'\n",
253 curadhocssid.ssid); 251 curadhocssid.ssid);
254 libertas_start_adhoc_network(priv, &curadhocssid); 252 libertas_start_adhoc_network(priv, &curadhocssid);
255 } // end of else (START command) 253 } // end of else (START command)
256 } 254 }
257 255
258 LEAVE(); 256out:
259 return 0; 257 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
258 return ret;
260} 259}
261 260
262/** 261/**
@@ -271,10 +270,10 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
271 int ret = 0; 270 int ret = 0;
272 wlan_adapter *adapter = priv->adapter; 271 wlan_adapter *adapter = priv->adapter;
273 272
274 ENTER(); 273 lbs_deb_enter(LBS_DEB_WEXT);
275 274
276 if (adapter->radioon != option) { 275 if (adapter->radioon != option) {
277 lbs_pr_debug(1, "Switching %s the Radio\n", option ? "On" : "Off"); 276 lbs_deb_wext("switching radio %s\n", option ? "on" : "off");
278 adapter->radioon = option; 277 adapter->radioon = option;
279 278
280 ret = libertas_prepare_and_send_command(priv, 279 ret = libertas_prepare_and_send_command(priv,
@@ -283,7 +282,7 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
283 cmd_option_waitforrsp, 0, NULL); 282 cmd_option_waitforrsp, 0, NULL);
284 } 283 }
285 284
286 LEAVE(); 285 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
287 return ret; 286 return ret;
288} 287}
289 288
@@ -320,15 +319,15 @@ static int get_active_data_rates(wlan_adapter * adapter,
320{ 319{
321 int k = 0; 320 int k = 0;
322 321
323 ENTER(); 322 lbs_deb_enter(LBS_DEB_WEXT);
324 323
325 if (adapter->connect_status != libertas_connected) { 324 if (adapter->connect_status != libertas_connected) {
326 if (adapter->mode == IW_MODE_INFRA) { 325 if (adapter->mode == IW_MODE_INFRA) {
327 lbs_pr_debug(1, "Infra\n"); 326 lbs_deb_wext("infra\n");
328 k = copyrates(rates, k, libertas_supported_rates, 327 k = copyrates(rates, k, libertas_supported_rates,
329 sizeof(libertas_supported_rates)); 328 sizeof(libertas_supported_rates));
330 } else { 329 } else {
331 lbs_pr_debug(1, "Adhoc G\n"); 330 lbs_deb_wext("Adhoc G\n");
332 k = copyrates(rates, k, libertas_adhoc_rates_g, 331 k = copyrates(rates, k, libertas_adhoc_rates_g,
333 sizeof(libertas_adhoc_rates_g)); 332 sizeof(libertas_adhoc_rates_g));
334 } 333 }
@@ -337,8 +336,7 @@ static int get_active_data_rates(wlan_adapter * adapter,
337 adapter->curbssparams.numofrates); 336 adapter->curbssparams.numofrates);
338 } 337 }
339 338
340 LEAVE(); 339 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", k);
341
342 return k; 340 return k;
343} 341}
344 342
@@ -350,7 +348,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
350 char mrvl[6] = { "MRVL-" }; 348 char mrvl[6] = { "MRVL-" };
351 int cnt; 349 int cnt;
352 350
353 ENTER(); 351 lbs_deb_enter(LBS_DEB_WEXT);
354 352
355 strcpy(cwrq, mrvl); 353 strcpy(cwrq, mrvl);
356 354
@@ -368,8 +366,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
368 } 366 }
369 *cwrq = '\0'; 367 *cwrq = '\0';
370 368
371 LEAVE(); 369 lbs_deb_leave(LBS_DEB_WEXT);
372
373 return 0; 370 return 0;
374} 371}
375 372
@@ -380,14 +377,14 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
380 wlan_adapter *adapter = priv->adapter; 377 wlan_adapter *adapter = priv->adapter;
381 struct chan_freq_power *cfp; 378 struct chan_freq_power *cfp;
382 379
383 ENTER(); 380 lbs_deb_enter(LBS_DEB_WEXT);
384 381
385 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, 382 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0,
386 adapter->curbssparams.channel); 383 adapter->curbssparams.channel);
387 384
388 if (!cfp) { 385 if (!cfp) {
389 if (adapter->curbssparams.channel) 386 if (adapter->curbssparams.channel)
390 lbs_pr_debug(1, "Invalid channel=%d\n", 387 lbs_deb_wext("invalid channel %d\n",
391 adapter->curbssparams.channel); 388 adapter->curbssparams.channel);
392 return -EINVAL; 389 return -EINVAL;
393 } 390 }
@@ -395,9 +392,8 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
395 fwrq->m = (long)cfp->freq * 100000; 392 fwrq->m = (long)cfp->freq * 100000;
396 fwrq->e = 1; 393 fwrq->e = 1;
397 394
398 lbs_pr_debug(1, "freq=%u\n", fwrq->m); 395 lbs_deb_wext("freq %u\n", fwrq->m);
399 396 lbs_deb_leave(LBS_DEB_WEXT);
400 LEAVE();
401 return 0; 397 return 0;
402} 398}
403 399
@@ -407,7 +403,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
407 wlan_private *priv = dev->priv; 403 wlan_private *priv = dev->priv;
408 wlan_adapter *adapter = priv->adapter; 404 wlan_adapter *adapter = priv->adapter;
409 405
410 ENTER(); 406 lbs_deb_enter(LBS_DEB_WEXT);
411 407
412 if (adapter->connect_status == libertas_connected) { 408 if (adapter->connect_status == libertas_connected) {
413 memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); 409 memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN);
@@ -416,7 +412,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
416 } 412 }
417 awrq->sa_family = ARPHRD_ETHER; 413 awrq->sa_family = ARPHRD_ETHER;
418 414
419 LEAVE(); 415 lbs_deb_leave(LBS_DEB_WEXT);
420 return 0; 416 return 0;
421} 417}
422 418
@@ -426,7 +422,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
426 wlan_private *priv = dev->priv; 422 wlan_private *priv = dev->priv;
427 wlan_adapter *adapter = priv->adapter; 423 wlan_adapter *adapter = priv->adapter;
428 424
429 ENTER(); 425 lbs_deb_enter(LBS_DEB_WEXT);
430 426
431 /* 427 /*
432 * Check the size of the string 428 * Check the size of the string
@@ -441,7 +437,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
441 memcpy(adapter->nodename, extra, dwrq->length); 437 memcpy(adapter->nodename, extra, dwrq->length);
442 mutex_unlock(&adapter->lock); 438 mutex_unlock(&adapter->lock);
443 439
444 LEAVE(); 440 lbs_deb_leave(LBS_DEB_WEXT);
445 return 0; 441 return 0;
446} 442}
447 443
@@ -451,7 +447,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
451 wlan_private *priv = dev->priv; 447 wlan_private *priv = dev->priv;
452 wlan_adapter *adapter = priv->adapter; 448 wlan_adapter *adapter = priv->adapter;
453 449
454 ENTER(); 450 lbs_deb_enter(LBS_DEB_WEXT);
455 451
456 /* 452 /*
457 * Get the Nick Name saved 453 * Get the Nick Name saved
@@ -472,7 +468,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
472 */ 468 */
473 dwrq->length = strlen(extra) + 1; 469 dwrq->length = strlen(extra) + 1;
474 470
475 LEAVE(); 471 lbs_deb_leave(LBS_DEB_WEXT);
476 return 0; 472 return 0;
477} 473}
478 474
@@ -484,7 +480,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
484 wlan_adapter *adapter = priv->adapter; 480 wlan_adapter *adapter = priv->adapter;
485 int rthr = vwrq->value; 481 int rthr = vwrq->value;
486 482
487 ENTER(); 483 lbs_deb_enter(LBS_DEB_WEXT);
488 484
489 if (vwrq->disabled) { 485 if (vwrq->disabled) {
490 adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; 486 adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE;
@@ -498,7 +494,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
498 cmd_act_set, cmd_option_waitforrsp, 494 cmd_act_set, cmd_option_waitforrsp,
499 OID_802_11_RTS_THRESHOLD, &rthr); 495 OID_802_11_RTS_THRESHOLD, &rthr);
500 496
501 LEAVE(); 497 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
502 return ret; 498 return ret;
503} 499}
504 500
@@ -509,24 +505,23 @@ static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
509 wlan_private *priv = dev->priv; 505 wlan_private *priv = dev->priv;
510 wlan_adapter *adapter = priv->adapter; 506 wlan_adapter *adapter = priv->adapter;
511 507
512 ENTER(); 508 lbs_deb_enter(LBS_DEB_WEXT);
513 509
514 adapter->rtsthsd = 0; 510 adapter->rtsthsd = 0;
515 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, 511 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
516 cmd_act_get, cmd_option_waitforrsp, 512 cmd_act_get, cmd_option_waitforrsp,
517 OID_802_11_RTS_THRESHOLD, NULL); 513 OID_802_11_RTS_THRESHOLD, NULL);
518 if (ret) { 514 if (ret)
519 LEAVE(); 515 goto out;
520 return ret;
521 }
522 516
523 vwrq->value = adapter->rtsthsd; 517 vwrq->value = adapter->rtsthsd;
524 vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) 518 vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE)
525 || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); 519 || (vwrq->value > MRVDRV_RTS_MAX_VALUE));
526 vwrq->fixed = 1; 520 vwrq->fixed = 1;
527 521
528 LEAVE(); 522out:
529 return 0; 523 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
524 return ret;
530} 525}
531 526
532static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, 527static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
@@ -537,7 +532,7 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
537 wlan_private *priv = dev->priv; 532 wlan_private *priv = dev->priv;
538 wlan_adapter *adapter = priv->adapter; 533 wlan_adapter *adapter = priv->adapter;
539 534
540 ENTER(); 535 lbs_deb_enter(LBS_DEB_WEXT);
541 536
542 if (vwrq->disabled) { 537 if (vwrq->disabled) {
543 adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; 538 adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE;
@@ -551,7 +546,8 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
551 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, 546 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
552 cmd_act_set, cmd_option_waitforrsp, 547 cmd_act_set, cmd_option_waitforrsp,
553 OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); 548 OID_802_11_FRAGMENTATION_THRESHOLD, &fthr);
554 LEAVE(); 549
550 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
555 return ret; 551 return ret;
556} 552}
557 553
@@ -562,24 +558,23 @@ static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info,
562 wlan_private *priv = dev->priv; 558 wlan_private *priv = dev->priv;
563 wlan_adapter *adapter = priv->adapter; 559 wlan_adapter *adapter = priv->adapter;
564 560
565 ENTER(); 561 lbs_deb_enter(LBS_DEB_WEXT);
566 562
567 adapter->fragthsd = 0; 563 adapter->fragthsd = 0;
568 ret = libertas_prepare_and_send_command(priv, 564 ret = libertas_prepare_and_send_command(priv,
569 cmd_802_11_snmp_mib, 565 cmd_802_11_snmp_mib,
570 cmd_act_get, cmd_option_waitforrsp, 566 cmd_act_get, cmd_option_waitforrsp,
571 OID_802_11_FRAGMENTATION_THRESHOLD, NULL); 567 OID_802_11_FRAGMENTATION_THRESHOLD, NULL);
572 if (ret) { 568 if (ret)
573 LEAVE(); 569 goto out;
574 return ret;
575 }
576 570
577 vwrq->value = adapter->fragthsd; 571 vwrq->value = adapter->fragthsd;
578 vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) 572 vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE)
579 || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); 573 || (vwrq->value > MRVDRV_FRAG_MAX_VALUE));
580 vwrq->fixed = 1; 574 vwrq->fixed = 1;
581 575
582 LEAVE(); 576out:
577 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
583 return ret; 578 return ret;
584} 579}
585 580
@@ -589,11 +584,11 @@ static int wlan_get_mode(struct net_device *dev,
589 wlan_private *priv = dev->priv; 584 wlan_private *priv = dev->priv;
590 wlan_adapter *adapter = priv->adapter; 585 wlan_adapter *adapter = priv->adapter;
591 586
592 ENTER(); 587 lbs_deb_enter(LBS_DEB_WEXT);
593 588
594 *uwrq = adapter->mode; 589 *uwrq = adapter->mode;
595 590
596 LEAVE(); 591 lbs_deb_leave(LBS_DEB_WEXT);
597 return 0; 592 return 0;
598} 593}
599 594
@@ -605,19 +600,17 @@ static int wlan_get_txpow(struct net_device *dev,
605 wlan_private *priv = dev->priv; 600 wlan_private *priv = dev->priv;
606 wlan_adapter *adapter = priv->adapter; 601 wlan_adapter *adapter = priv->adapter;
607 602
608 ENTER(); 603 lbs_deb_enter(LBS_DEB_WEXT);
609 604
610 ret = libertas_prepare_and_send_command(priv, 605 ret = libertas_prepare_and_send_command(priv,
611 cmd_802_11_rf_tx_power, 606 cmd_802_11_rf_tx_power,
612 cmd_act_tx_power_opt_get, 607 cmd_act_tx_power_opt_get,
613 cmd_option_waitforrsp, 0, NULL); 608 cmd_option_waitforrsp, 0, NULL);
614 609
615 if (ret) { 610 if (ret)
616 LEAVE(); 611 goto out;
617 return ret;
618 }
619 612
620 lbs_pr_debug(1, "TXPOWER GET %d dbm.\n", adapter->txpowerlevel); 613 lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel);
621 vwrq->value = adapter->txpowerlevel; 614 vwrq->value = adapter->txpowerlevel;
622 vwrq->fixed = 1; 615 vwrq->fixed = 1;
623 if (adapter->radioon) { 616 if (adapter->radioon) {
@@ -627,8 +620,9 @@ static int wlan_get_txpow(struct net_device *dev,
627 vwrq->disabled = 1; 620 vwrq->disabled = 1;
628 } 621 }
629 622
630 LEAVE(); 623out:
631 return 0; 624 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
625 return ret;
632} 626}
633 627
634static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, 628static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
@@ -638,7 +632,7 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
638 wlan_private *priv = dev->priv; 632 wlan_private *priv = dev->priv;
639 wlan_adapter *adapter = priv->adapter; 633 wlan_adapter *adapter = priv->adapter;
640 634
641 ENTER(); 635 lbs_deb_enter(LBS_DEB_WEXT);
642 636
643 if (vwrq->flags == IW_RETRY_LIMIT) { 637 if (vwrq->flags == IW_RETRY_LIMIT) {
644 /* The MAC has a 4-bit Total_Tx_Count register 638 /* The MAC has a 4-bit Total_Tx_Count register
@@ -656,16 +650,15 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
656 cmd_option_waitforrsp, 650 cmd_option_waitforrsp,
657 OID_802_11_TX_RETRYCOUNT, NULL); 651 OID_802_11_TX_RETRYCOUNT, NULL);
658 652
659 if (ret) { 653 if (ret)
660 LEAVE(); 654 goto out;
661 return ret;
662 }
663 } else { 655 } else {
664 return -EOPNOTSUPP; 656 return -EOPNOTSUPP;
665 } 657 }
666 658
667 LEAVE(); 659out:
668 return 0; 660 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
661 return ret;
669} 662}
670 663
671static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, 664static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
@@ -675,16 +668,16 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
675 wlan_adapter *adapter = priv->adapter; 668 wlan_adapter *adapter = priv->adapter;
676 int ret = 0; 669 int ret = 0;
677 670
678 ENTER(); 671 lbs_deb_enter(LBS_DEB_WEXT);
672
679 adapter->txretrycount = 0; 673 adapter->txretrycount = 0;
680 ret = libertas_prepare_and_send_command(priv, 674 ret = libertas_prepare_and_send_command(priv,
681 cmd_802_11_snmp_mib, 675 cmd_802_11_snmp_mib,
682 cmd_act_get, cmd_option_waitforrsp, 676 cmd_act_get, cmd_option_waitforrsp,
683 OID_802_11_TX_RETRYCOUNT, NULL); 677 OID_802_11_TX_RETRYCOUNT, NULL);
684 if (ret) { 678 if (ret)
685 LEAVE(); 679 goto out;
686 return ret; 680
687 }
688 vwrq->disabled = 0; 681 vwrq->disabled = 0;
689 if (!vwrq->flags) { 682 if (!vwrq->flags) {
690 vwrq->flags = IW_RETRY_LIMIT; 683 vwrq->flags = IW_RETRY_LIMIT;
@@ -692,8 +685,9 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
692 vwrq->value = adapter->txretrycount - 1; 685 vwrq->value = adapter->txretrycount - 1;
693 } 686 }
694 687
695 LEAVE(); 688out:
696 return 0; 689 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
690 return ret;
697} 691}
698 692
699static inline void sort_channels(struct iw_freq *freq, int num) 693static inline void sort_channels(struct iw_freq *freq, int num)
@@ -747,7 +741,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
747 741
748 u8 flag = 0; 742 u8 flag = 0;
749 743
750 ENTER(); 744 lbs_deb_enter(LBS_DEB_WEXT);
751 745
752 dwrq->length = sizeof(struct iw_range); 746 dwrq->length = sizeof(struct iw_range);
753 memset(range, 0, sizeof(struct iw_range)); 747 memset(range, 0, sizeof(struct iw_range));
@@ -763,7 +757,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
763 range->bitrate[i] = (rates[i] & 0x7f) * 500000; 757 range->bitrate[i] = (rates[i] & 0x7f) * 500000;
764 } 758 }
765 range->num_bitrates = i; 759 range->num_bitrates = i;
766 lbs_pr_debug(1, "IW_MAX_BITRATES=%d num_bitrates=%d\n", IW_MAX_BITRATES, 760 lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES,
767 range->num_bitrates); 761 range->num_bitrates);
768 762
769 range->num_frequency = 0; 763 range->num_frequency = 0;
@@ -776,18 +770,17 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
776 &adapter->parsed_region_chan; 770 &adapter->parsed_region_chan;
777 771
778 if (parsed_region_chan == NULL) { 772 if (parsed_region_chan == NULL) {
779 lbs_pr_debug(1, "11D:parsed_region_chan is NULL\n"); 773 lbs_deb_wext("11d: parsed_region_chan is NULL\n");
780 LEAVE(); 774 goto out;
781 return 0;
782 } 775 }
783 band = parsed_region_chan->band; 776 band = parsed_region_chan->band;
784 lbs_pr_debug(1, "band=%d NoOfChan=%d\n", band, 777 lbs_deb_wext("band %d, nr_char %d\n", band,
785 parsed_region_chan->nr_chan); 778 parsed_region_chan->nr_chan);
786 779
787 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) 780 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
788 && (i < parsed_region_chan->nr_chan); i++) { 781 && (i < parsed_region_chan->nr_chan); i++) {
789 chan_no = parsed_region_chan->chanpwr[i].chan; 782 chan_no = parsed_region_chan->chanpwr[i].chan;
790 lbs_pr_debug(1, "chan_no=%d\n", chan_no); 783 lbs_deb_wext("chan_no %d\n", chan_no);
791 range->freq[range->num_frequency].i = (long)chan_no; 784 range->freq[range->num_frequency].i = (long)chan_no;
792 range->freq[range->num_frequency].m = 785 range->freq[range->num_frequency].m =
793 (long)libertas_chan_2_freq(chan_no, band) * 100000; 786 (long)libertas_chan_2_freq(chan_no, band) * 100000;
@@ -816,7 +809,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
816 } 809 }
817 } 810 }
818 811
819 lbs_pr_debug(1, "IW_MAX_FREQUENCIES=%d num_frequency=%d\n", 812 lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
820 IW_MAX_FREQUENCIES, range->num_frequency); 813 IW_MAX_FREQUENCIES, range->num_frequency);
821 814
822 range->num_channels = range->num_frequency; 815 range->num_channels = range->num_frequency;
@@ -911,7 +904,8 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
911 | IW_ENC_CAPA_CIPHER_CCMP; 904 | IW_ENC_CAPA_CIPHER_CCMP;
912 } 905 }
913 906
914 LEAVE(); 907out:
908 lbs_deb_leave(LBS_DEB_WEXT);
915 return 0; 909 return 0;
916} 910}
917 911
@@ -921,7 +915,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
921 wlan_private *priv = dev->priv; 915 wlan_private *priv = dev->priv;
922 wlan_adapter *adapter = priv->adapter; 916 wlan_adapter *adapter = priv->adapter;
923 917
924 ENTER(); 918 lbs_deb_enter(LBS_DEB_WEXT);
925 919
926 /* PS is currently supported only in Infrastructure mode 920 /* PS is currently supported only in Infrastructure mode
927 * Remove this check if it is to be supported in IBSS mode also 921 * Remove this check if it is to be supported in IBSS mode also
@@ -937,11 +931,11 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
937 } 931 }
938 932
939 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { 933 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
940 lbs_pr_debug(1, 934 lbs_deb_wext(
941 "Setting power timeout command is not supported\n"); 935 "setting power timeout is not supported\n");
942 return -EINVAL; 936 return -EINVAL;
943 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { 937 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
944 lbs_pr_debug(1, "Setting power period command is not supported\n"); 938 lbs_deb_wext("setting power period not supported\n");
945 return -EINVAL; 939 return -EINVAL;
946 } 940 }
947 941
@@ -955,7 +949,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
955 libertas_ps_sleep(priv, cmd_option_waitforrsp); 949 libertas_ps_sleep(priv, cmd_option_waitforrsp);
956 } 950 }
957 951
958 LEAVE(); 952 lbs_deb_leave(LBS_DEB_WEXT);
959 return 0; 953 return 0;
960} 954}
961 955
@@ -966,19 +960,20 @@ static int wlan_get_power(struct net_device *dev, struct iw_request_info *info,
966 wlan_adapter *adapter = priv->adapter; 960 wlan_adapter *adapter = priv->adapter;
967 int mode; 961 int mode;
968 962
969 ENTER(); 963 lbs_deb_enter(LBS_DEB_WEXT);
970 964
971 mode = adapter->psmode; 965 mode = adapter->psmode;
972 966
973 if ((vwrq->disabled = (mode == wlan802_11powermodecam)) 967 if ((vwrq->disabled = (mode == wlan802_11powermodecam))
974 || adapter->connect_status == libertas_disconnected) { 968 || adapter->connect_status == libertas_disconnected)
975 LEAVE(); 969 {
976 return 0; 970 goto out;
977 } 971 }
978 972
979 vwrq->value = 0; 973 vwrq->value = 0;
980 974
981 LEAVE(); 975out:
976 lbs_deb_leave(LBS_DEB_WEXT);
982 return 0; 977 return 0;
983} 978}
984 979
@@ -1133,7 +1128,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1133 u8 rssi; 1128 u8 rssi;
1134 u32 tx_retries; 1129 u32 tx_retries;
1135 1130
1136 ENTER(); 1131 lbs_deb_enter(LBS_DEB_WEXT);
1137 1132
1138 priv->wstats.status = adapter->mode; 1133 priv->wstats.status = adapter->mode;
1139 1134
@@ -1153,8 +1148,8 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1153 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); 1148 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1154 } 1149 }
1155 1150
1156 lbs_pr_debug(1, "Signal Level = %#x\n", priv->wstats.qual.level); 1151 lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level);
1157 lbs_pr_debug(1, "Noise = %#x\n", priv->wstats.qual.noise); 1152 lbs_deb_wext("noise %#x\n", priv->wstats.qual.noise);
1158 1153
1159 rssi = priv->wstats.qual.level - priv->wstats.qual.noise; 1154 rssi = priv->wstats.qual.level - priv->wstats.qual.noise;
1160 if (rssi < 15) 1155 if (rssi < 15)
@@ -1217,7 +1212,7 @@ out:
1217 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; 1212 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
1218 } 1213 }
1219 1214
1220 LEAVE (); 1215 lbs_deb_leave(LBS_DEB_WEXT);
1221 return &priv->wstats; 1216 return &priv->wstats;
1222 1217
1223 1218
@@ -1232,7 +1227,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1232 int rc = -EINPROGRESS; /* Call commit handler */ 1227 int rc = -EINPROGRESS; /* Call commit handler */
1233 struct chan_freq_power *cfp; 1228 struct chan_freq_power *cfp;
1234 1229
1235 ENTER(); 1230 lbs_deb_enter(LBS_DEB_WEXT);
1236 1231
1237 /* 1232 /*
1238 * If setting by frequency, convert to a channel 1233 * If setting by frequency, convert to a channel
@@ -1244,7 +1239,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1244 1239
1245 cfp = find_cfp_by_band_and_freq(adapter, 0, f); 1240 cfp = find_cfp_by_band_and_freq(adapter, 0, f);
1246 if (!cfp) { 1241 if (!cfp) {
1247 lbs_pr_debug(1, "Invalid freq=%ld\n", f); 1242 lbs_deb_wext("invalid freq %ld\n", f);
1248 return -EINVAL; 1243 return -EINVAL;
1249 } 1244 }
1250 1245
@@ -1275,7 +1270,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1275 * command to set WEP in firmware 1270 * command to set WEP in firmware
1276 */ 1271 */
1277 if (adapter->secinfo.wep_enabled) { 1272 if (adapter->secinfo.wep_enabled) {
1278 lbs_pr_debug(1, "set_freq: WEP enabled\n"); 1273 lbs_deb_wext("set_freq: WEP enabled\n");
1279 ret = libertas_prepare_and_send_command(priv, 1274 ret = libertas_prepare_and_send_command(priv,
1280 cmd_802_11_set_wep, 1275 cmd_802_11_set_wep,
1281 cmd_act_add, 1276 cmd_act_add,
@@ -1284,8 +1279,8 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1284 NULL); 1279 NULL);
1285 1280
1286 if (ret) { 1281 if (ret) {
1287 LEAVE(); 1282 rc = ret;
1288 return ret; 1283 goto out;
1289 } 1284 }
1290 1285
1291 adapter->currentpacketfilter |= 1286 adapter->currentpacketfilter |=
@@ -1299,7 +1294,8 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1299 } 1294 }
1300 } 1295 }
1301 1296
1302 LEAVE(); 1297out:
1298 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", rc);
1303 return rc; 1299 return rc;
1304} 1300}
1305 1301
@@ -1346,9 +1342,9 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1346 u8 rates[WLAN_SUPPORTED_RATES]; 1342 u8 rates[WLAN_SUPPORTED_RATES];
1347 u8 *rate; 1343 u8 *rate;
1348 1344
1349 ENTER(); 1345 lbs_deb_enter(LBS_DEB_WEXT);
1350 1346
1351 lbs_pr_debug(1, "Vwrq->value = %d\n", vwrq->value); 1347 lbs_deb_wext("vwrq->value %d\n", vwrq->value);
1352 1348
1353 if (vwrq->value == -1) { 1349 if (vwrq->value == -1) {
1354 action = cmd_act_set_tx_auto; // Auto 1350 action = cmd_act_set_tx_auto; // Auto
@@ -1365,15 +1361,15 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1365 get_active_data_rates(adapter, rates); 1361 get_active_data_rates(adapter, rates);
1366 rate = rates; 1362 rate = rates;
1367 while (*rate) { 1363 while (*rate) {
1368 lbs_pr_debug(1, "Rate=0x%X Wanted=0x%X\n", *rate, 1364 lbs_deb_wext("rate=0x%X, wanted data_rate 0x%X\n", *rate,
1369 data_rate); 1365 data_rate);
1370 if ((*rate & 0x7f) == (data_rate & 0x7f)) 1366 if ((*rate & 0x7f) == (data_rate & 0x7f))
1371 break; 1367 break;
1372 rate++; 1368 rate++;
1373 } 1369 }
1374 if (!*rate) { 1370 if (!*rate) {
1375 lbs_pr_alert( "The fixed data rate 0x%X is out " 1371 lbs_pr_alert("fixed data rate 0x%X out "
1376 "of range.\n", data_rate); 1372 "of range\n", data_rate);
1377 return -EINVAL; 1373 return -EINVAL;
1378 } 1374 }
1379 1375
@@ -1385,7 +1381,7 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1385 ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate, 1381 ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate,
1386 action, cmd_option_waitforrsp, 0, NULL); 1382 action, cmd_option_waitforrsp, 0, NULL);
1387 1383
1388 LEAVE(); 1384 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1389 return ret; 1385 return ret;
1390} 1386}
1391 1387
@@ -1395,7 +1391,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
1395 wlan_private *priv = dev->priv; 1391 wlan_private *priv = dev->priv;
1396 wlan_adapter *adapter = priv->adapter; 1392 wlan_adapter *adapter = priv->adapter;
1397 1393
1398 ENTER(); 1394 lbs_deb_enter(LBS_DEB_WEXT);
1399 1395
1400 if (adapter->is_datarate_auto) { 1396 if (adapter->is_datarate_auto) {
1401 vwrq->fixed = 0; 1397 vwrq->fixed = 0;
@@ -1405,7 +1401,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
1405 1401
1406 vwrq->value = adapter->datarate * 500000; 1402 vwrq->value = adapter->datarate * 500000;
1407 1403
1408 LEAVE(); 1404 lbs_deb_leave(LBS_DEB_WEXT);
1409 return 0; 1405 return 0;
1410} 1406}
1411 1407
@@ -1417,12 +1413,12 @@ static int wlan_set_mode(struct net_device *dev,
1417 wlan_adapter *adapter = priv->adapter; 1413 wlan_adapter *adapter = priv->adapter;
1418 struct assoc_request * assoc_req; 1414 struct assoc_request * assoc_req;
1419 1415
1420 ENTER(); 1416 lbs_deb_enter(LBS_DEB_WEXT);
1421 1417
1422 if ( (*uwrq != IW_MODE_ADHOC) 1418 if ( (*uwrq != IW_MODE_ADHOC)
1423 && (*uwrq != IW_MODE_INFRA) 1419 && (*uwrq != IW_MODE_INFRA)
1424 && (*uwrq != IW_MODE_AUTO)) { 1420 && (*uwrq != IW_MODE_AUTO)) {
1425 lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq); 1421 lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq);
1426 ret = -EINVAL; 1422 ret = -EINVAL;
1427 goto out; 1423 goto out;
1428 } 1424 }
@@ -1436,12 +1432,12 @@ static int wlan_set_mode(struct net_device *dev,
1436 assoc_req->mode = *uwrq; 1432 assoc_req->mode = *uwrq;
1437 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 1433 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
1438 wlan_postpone_association_work(priv); 1434 wlan_postpone_association_work(priv);
1439 lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq); 1435 lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq);
1440 } 1436 }
1441 mutex_unlock(&adapter->lock); 1437 mutex_unlock(&adapter->lock);
1442 1438
1443out: 1439out:
1444 LEAVE(); 1440 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1445 return ret; 1441 return ret;
1446} 1442}
1447 1443
@@ -1463,9 +1459,9 @@ static int wlan_get_encode(struct net_device *dev,
1463 wlan_adapter *adapter = priv->adapter; 1459 wlan_adapter *adapter = priv->adapter;
1464 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; 1460 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1465 1461
1466 ENTER(); 1462 lbs_deb_enter(LBS_DEB_WEXT);
1467 1463
1468 lbs_pr_debug(1, "flags=0x%x index=%d length=%d wep_tx_keyidx=%d\n", 1464 lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n",
1469 dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); 1465 dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx);
1470 1466
1471 dwrq->flags = 0; 1467 dwrq->flags = 0;
@@ -1521,13 +1517,13 @@ static int wlan_get_encode(struct net_device *dev,
1521 1517
1522 dwrq->flags |= IW_ENCODE_NOKEY; 1518 dwrq->flags |= IW_ENCODE_NOKEY;
1523 1519
1524 lbs_pr_debug(1, "key:%02x:%02x:%02x:%02x:%02x:%02x keylen=%d\n", 1520 lbs_deb_wext("key: " MAC_FMT ", keylen %d\n",
1525 extra[0], extra[1], extra[2], 1521 extra[0], extra[1], extra[2],
1526 extra[3], extra[4], extra[5], dwrq->length); 1522 extra[3], extra[4], extra[5], dwrq->length);
1527 1523
1528 lbs_pr_debug(1, "Return flags=0x%x\n", dwrq->flags); 1524 lbs_deb_wext("return flags 0x%x\n", dwrq->flags);
1529 1525
1530 LEAVE(); 1526 lbs_deb_leave(LBS_DEB_WEXT);
1531 return 0; 1527 return 0;
1532} 1528}
1533 1529
@@ -1547,20 +1543,21 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
1547 u16 index, 1543 u16 index,
1548 int set_tx_key) 1544 int set_tx_key)
1549{ 1545{
1546 int ret = 0;
1550 struct WLAN_802_11_KEY *pkey; 1547 struct WLAN_802_11_KEY *pkey;
1551 1548
1552 ENTER(); 1549 lbs_deb_enter(LBS_DEB_WEXT);
1553 1550
1554 /* Paranoid validation of key index */ 1551 /* Paranoid validation of key index */
1555 if (index > 3) { 1552 if (index > 3) {
1556 LEAVE(); 1553 ret = -EINVAL;
1557 return -EINVAL; 1554 goto out;
1558 } 1555 }
1559 1556
1560 /* validate max key length */ 1557 /* validate max key length */
1561 if (key_length > KEY_LEN_WEP_104) { 1558 if (key_length > KEY_LEN_WEP_104) {
1562 LEAVE(); 1559 ret = -EINVAL;
1563 return -EINVAL; 1560 goto out;
1564 } 1561 }
1565 1562
1566 pkey = &assoc_req->wep_keys[index]; 1563 pkey = &assoc_req->wep_keys[index];
@@ -1578,17 +1575,18 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
1578 if (set_tx_key) { 1575 if (set_tx_key) {
1579 /* Ensure the chosen key is valid */ 1576 /* Ensure the chosen key is valid */
1580 if (!pkey->len) { 1577 if (!pkey->len) {
1581 lbs_pr_debug(1, "key not set, so cannot enable it\n"); 1578 lbs_deb_wext("key not set, so cannot enable it\n");
1582 LEAVE(); 1579 ret = -EINVAL;
1583 return -EINVAL; 1580 goto out;
1584 } 1581 }
1585 assoc_req->wep_tx_keyidx = index; 1582 assoc_req->wep_tx_keyidx = index;
1586 } 1583 }
1587 1584
1588 assoc_req->secinfo.wep_enabled = 1; 1585 assoc_req->secinfo.wep_enabled = 1;
1589 1586
1590 LEAVE(); 1587out:
1591 return 0; 1588 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1589 return ret;
1592} 1590}
1593 1591
1594static int validate_key_index(u16 def_index, u16 raw_index, 1592static int validate_key_index(u16 def_index, u16 raw_index,
@@ -1644,7 +1642,7 @@ static int wlan_set_encode(struct net_device *dev,
1644 struct assoc_request * assoc_req; 1642 struct assoc_request * assoc_req;
1645 u16 is_default = 0, index = 0, set_tx_key = 0; 1643 u16 is_default = 0, index = 0, set_tx_key = 0;
1646 1644
1647 ENTER(); 1645 lbs_deb_enter(LBS_DEB_WEXT);
1648 1646
1649 mutex_lock(&adapter->lock); 1647 mutex_lock(&adapter->lock);
1650 assoc_req = wlan_get_association_request(adapter); 1648 assoc_req = wlan_get_association_request(adapter);
@@ -1696,7 +1694,7 @@ out:
1696 } 1694 }
1697 mutex_unlock(&adapter->lock); 1695 mutex_unlock(&adapter->lock);
1698 1696
1699 LEAVE(); 1697 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1700 return ret; 1698 return ret;
1701} 1699}
1702 1700
@@ -1720,7 +1718,7 @@ static int wlan_get_encodeext(struct net_device *dev,
1720 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1718 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1721 int index, max_key_len; 1719 int index, max_key_len;
1722 1720
1723 ENTER(); 1721 lbs_deb_enter(LBS_DEB_WEXT);
1724 1722
1725 max_key_len = dwrq->length - sizeof(*ext); 1723 max_key_len = dwrq->length - sizeof(*ext);
1726 if (max_key_len < 0) 1724 if (max_key_len < 0)
@@ -1783,7 +1781,7 @@ static int wlan_get_encodeext(struct net_device *dev,
1783 ret = 0; 1781 ret = 0;
1784 1782
1785out: 1783out:
1786 LEAVE(); 1784 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1787 return ret; 1785 return ret;
1788} 1786}
1789 1787
@@ -1808,7 +1806,7 @@ static int wlan_set_encodeext(struct net_device *dev,
1808 int alg = ext->alg; 1806 int alg = ext->alg;
1809 struct assoc_request * assoc_req; 1807 struct assoc_request * assoc_req;
1810 1808
1811 ENTER(); 1809 lbs_deb_enter(LBS_DEB_WEXT);
1812 1810
1813 mutex_lock(&adapter->lock); 1811 mutex_lock(&adapter->lock);
1814 assoc_req = wlan_get_association_request(adapter); 1812 assoc_req = wlan_get_association_request(adapter);
@@ -1863,8 +1861,8 @@ static int wlan_set_encodeext(struct net_device *dev,
1863 && (ext->key_len != KEY_LEN_WPA_TKIP)) 1861 && (ext->key_len != KEY_LEN_WPA_TKIP))
1864 || ((alg == IW_ENCODE_ALG_CCMP) 1862 || ((alg == IW_ENCODE_ALG_CCMP)
1865 && (ext->key_len != KEY_LEN_WPA_AES))) { 1863 && (ext->key_len != KEY_LEN_WPA_AES))) {
1866 lbs_pr_debug(1, "Invalid size %d for key of alg" 1864 lbs_deb_wext("invalid size %d for key of alg"
1867 "type %d.\n", 1865 "type %d\n",
1868 ext->key_len, 1866 ext->key_len,
1869 alg); 1867 alg);
1870 ret = -EINVAL; 1868 ret = -EINVAL;
@@ -1913,7 +1911,7 @@ out:
1913 } 1911 }
1914 mutex_unlock(&adapter->lock); 1912 mutex_unlock(&adapter->lock);
1915 1913
1916 LEAVE(); 1914 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1917 return ret; 1915 return ret;
1918} 1916}
1919 1917
@@ -1928,7 +1926,7 @@ static int wlan_set_genie(struct net_device *dev,
1928 int ret = 0; 1926 int ret = 0;
1929 struct assoc_request * assoc_req; 1927 struct assoc_request * assoc_req;
1930 1928
1931 ENTER(); 1929 lbs_deb_enter(LBS_DEB_WEXT);
1932 1930
1933 mutex_lock(&adapter->lock); 1931 mutex_lock(&adapter->lock);
1934 assoc_req = wlan_get_association_request(adapter); 1932 assoc_req = wlan_get_association_request(adapter);
@@ -1960,7 +1958,7 @@ out:
1960 } 1958 }
1961 mutex_unlock(&adapter->lock); 1959 mutex_unlock(&adapter->lock);
1962 1960
1963 LEAVE(); 1961 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1964 return ret; 1962 return ret;
1965} 1963}
1966 1964
@@ -1969,27 +1967,28 @@ static int wlan_get_genie(struct net_device *dev,
1969 struct iw_point *dwrq, 1967 struct iw_point *dwrq,
1970 char *extra) 1968 char *extra)
1971{ 1969{
1970 int ret = 0;
1972 wlan_private *priv = dev->priv; 1971 wlan_private *priv = dev->priv;
1973 wlan_adapter *adapter = priv->adapter; 1972 wlan_adapter *adapter = priv->adapter;
1974 1973
1975 ENTER(); 1974 lbs_deb_enter(LBS_DEB_WEXT);
1976 1975
1977 if (adapter->wpa_ie_len == 0) { 1976 if (adapter->wpa_ie_len == 0) {
1978 dwrq->length = 0; 1977 dwrq->length = 0;
1979 LEAVE(); 1978 goto out;
1980 return 0;
1981 } 1979 }
1982 1980
1983 if (dwrq->length < adapter->wpa_ie_len) { 1981 if (dwrq->length < adapter->wpa_ie_len) {
1984 LEAVE(); 1982 ret = -E2BIG;
1985 return -E2BIG; 1983 goto out;
1986 } 1984 }
1987 1985
1988 dwrq->length = adapter->wpa_ie_len; 1986 dwrq->length = adapter->wpa_ie_len;
1989 memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); 1987 memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len);
1990 1988
1991 LEAVE(); 1989out:
1992 return 0; 1990 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1991 return ret;
1993} 1992}
1994 1993
1995 1994
@@ -2004,7 +2003,7 @@ static int wlan_set_auth(struct net_device *dev,
2004 int ret = 0; 2003 int ret = 0;
2005 int updated = 0; 2004 int updated = 0;
2006 2005
2007 ENTER(); 2006 lbs_deb_enter(LBS_DEB_WEXT);
2008 2007
2009 mutex_lock(&adapter->lock); 2008 mutex_lock(&adapter->lock);
2010 assoc_req = wlan_get_association_request(adapter); 2009 assoc_req = wlan_get_association_request(adapter);
@@ -2096,7 +2095,7 @@ out:
2096 } 2095 }
2097 mutex_unlock(&adapter->lock); 2096 mutex_unlock(&adapter->lock);
2098 2097
2099 LEAVE(); 2098 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2100 return ret; 2099 return ret;
2101} 2100}
2102 2101
@@ -2105,10 +2104,11 @@ static int wlan_get_auth(struct net_device *dev,
2105 struct iw_param *dwrq, 2104 struct iw_param *dwrq,
2106 char *extra) 2105 char *extra)
2107{ 2106{
2107 int ret = 0;
2108 wlan_private *priv = dev->priv; 2108 wlan_private *priv = dev->priv;
2109 wlan_adapter *adapter = priv->adapter; 2109 wlan_adapter *adapter = priv->adapter;
2110 2110
2111 ENTER(); 2111 lbs_deb_enter(LBS_DEB_WEXT);
2112 2112
2113 switch (dwrq->flags & IW_AUTH_INDEX) { 2113 switch (dwrq->flags & IW_AUTH_INDEX) {
2114 case IW_AUTH_WPA_VERSION: 2114 case IW_AUTH_WPA_VERSION:
@@ -2138,12 +2138,11 @@ static int wlan_get_auth(struct net_device *dev,
2138 break; 2138 break;
2139 2139
2140 default: 2140 default:
2141 LEAVE(); 2141 ret = -EOPNOTSUPP;
2142 return -EOPNOTSUPP;
2143 } 2142 }
2144 2143
2145 LEAVE(); 2144 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2146 return 0; 2145 return ret;
2147} 2146}
2148 2147
2149 2148
@@ -2156,7 +2155,7 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
2156 2155
2157 u16 dbm; 2156 u16 dbm;
2158 2157
2159 ENTER(); 2158 lbs_deb_enter(LBS_DEB_WEXT);
2160 2159
2161 if (vwrq->disabled) { 2160 if (vwrq->disabled) {
2162 wlan_radio_ioctl(priv, RADIO_OFF); 2161 wlan_radio_ioctl(priv, RADIO_OFF);
@@ -2177,14 +2176,14 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
2177 if (vwrq->fixed == 0) 2176 if (vwrq->fixed == 0)
2178 dbm = 0xffff; 2177 dbm = 0xffff;
2179 2178
2180 lbs_pr_debug(1, "<1>TXPOWER SET %d dbm.\n", dbm); 2179 lbs_deb_wext("txpower set %d dbm\n", dbm);
2181 2180
2182 ret = libertas_prepare_and_send_command(priv, 2181 ret = libertas_prepare_and_send_command(priv,
2183 cmd_802_11_rf_tx_power, 2182 cmd_802_11_rf_tx_power,
2184 cmd_act_tx_power_opt_set_low, 2183 cmd_act_tx_power_opt_set_low,
2185 cmd_option_waitforrsp, 0, (void *)&dbm); 2184 cmd_option_waitforrsp, 0, (void *)&dbm);
2186 2185
2187 LEAVE(); 2186 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2188 return ret; 2187 return ret;
2189} 2188}
2190 2189
@@ -2194,7 +2193,8 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2194 wlan_private *priv = dev->priv; 2193 wlan_private *priv = dev->priv;
2195 wlan_adapter *adapter = priv->adapter; 2194 wlan_adapter *adapter = priv->adapter;
2196 2195
2197 ENTER(); 2196 lbs_deb_enter(LBS_DEB_WEXT);
2197
2198 /* 2198 /*
2199 * Note : if dwrq->flags != 0, we should get the relevant SSID from 2199 * Note : if dwrq->flags != 0, we should get the relevant SSID from
2200 * the SSID list... 2200 * the SSID list...
@@ -2224,7 +2224,7 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2224 2224
2225 dwrq->flags = 1; /* active */ 2225 dwrq->flags = 1; /* active */
2226 2226
2227 LEAVE(); 2227 lbs_deb_leave(LBS_DEB_WEXT);
2228 return 0; 2228 return 0;
2229} 2229}
2230 2230
@@ -2238,7 +2238,7 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
2238 struct assoc_request * assoc_req; 2238 struct assoc_request * assoc_req;
2239 int ssid_len = dwrq->length; 2239 int ssid_len = dwrq->length;
2240 2240
2241 ENTER(); 2241 lbs_deb_enter(LBS_DEB_WEXT);
2242 2242
2243 /* 2243 /*
2244 * WE-20 and earlier NULL pad the end of the SSID and increment 2244 * WE-20 and earlier NULL pad the end of the SSID and increment
@@ -2264,7 +2264,7 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
2264 ssid.ssidlength = ssid_len; 2264 ssid.ssidlength = ssid_len;
2265 } 2265 }
2266 2266
2267 lbs_pr_debug(1, "Requested new SSID = %s\n", 2267 lbs_deb_wext("requested new SSID '%s'\n",
2268 (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any"); 2268 (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any");
2269 2269
2270out: 2270out:
@@ -2289,7 +2289,7 @@ out:
2289 2289
2290 mutex_unlock(&adapter->lock); 2290 mutex_unlock(&adapter->lock);
2291 2291
2292 LEAVE(); 2292 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2293 return ret; 2293 return ret;
2294} 2294}
2295 2295
@@ -2310,12 +2310,12 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
2310 struct assoc_request * assoc_req; 2310 struct assoc_request * assoc_req;
2311 int ret = 0; 2311 int ret = 0;
2312 2312
2313 ENTER(); 2313 lbs_deb_enter(LBS_DEB_WEXT);
2314 2314
2315 if (awrq->sa_family != ARPHRD_ETHER) 2315 if (awrq->sa_family != ARPHRD_ETHER)
2316 return -EINVAL; 2316 return -EINVAL;
2317 2317
2318 lbs_pr_debug(1, "ASSOC: WAP: sa_data: " MAC_FMT "\n", MAC_ARG(awrq->sa_data)); 2318 lbs_deb_wext("ASSOC: WAP: sa_data " MAC_FMT "\n", MAC_ARG(awrq->sa_data));
2319 2319
2320 mutex_lock(&adapter->lock); 2320 mutex_lock(&adapter->lock);
2321 2321