diff options
author | Holger Schurig <hs4233@mail.mn-solutions.de> | 2007-05-25 11:27:16 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:37 -0400 |
commit | 9012b28a407511fb355f6d2176a12d4653489672 (patch) | |
tree | 771b0f7adb9dbab5c907981bd4fa3a7f6219587d /drivers/net/wireless/libertas/main.c | |
parent | 46868202b2dd22156460a220553a223f406f4f22 (diff) |
[PATCH] libertas: make debug configurable
The debug output of libertas was either not present or it was overwhelming.
This patch adds the possibility to specify a bitmask for the area of
interest. One should then only get the desired output.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 192 |
1 files changed, 101 insertions, 91 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 6bf162a107b0..cd107366beb7 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/if_arp.h> | 11 | #include <linux/if_arp.h> |
12 | 12 | ||
13 | #include <net/iw_handler.h> | 13 | #include <net/iw_handler.h> |
14 | #include <net/ieee80211.h> | ||
14 | 15 | ||
15 | #include "host.h" | 16 | #include "host.h" |
16 | #include "sbi.h" | 17 | #include "sbi.h" |
@@ -227,7 +228,8 @@ static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, | |||
227 | * function to work around the issue. | 228 | * function to work around the issue. |
228 | * | 229 | * |
229 | */ | 230 | */ |
230 | static int pre_open_check(struct net_device *dev) { | 231 | static int pre_open_check(struct net_device *dev) |
232 | { | ||
231 | wlan_private *priv = (wlan_private *) dev->priv; | 233 | wlan_private *priv = (wlan_private *) dev->priv; |
232 | wlan_adapter *adapter = priv->adapter; | 234 | wlan_adapter *adapter = priv->adapter; |
233 | int i = 0; | 235 | int i = 0; |
@@ -237,8 +239,7 @@ static int pre_open_check(struct net_device *dev) { | |||
237 | msleep_interruptible(100); | 239 | msleep_interruptible(100); |
238 | } | 240 | } |
239 | if (!adapter->fw_ready) { | 241 | if (!adapter->fw_ready) { |
240 | lbs_pr_info("FW not ready, pre_open_check() return failure\n"); | 242 | lbs_pr_err("firmware not ready\n"); |
241 | LEAVE(); | ||
242 | return -1; | 243 | return -1; |
243 | } | 244 | } |
244 | 245 | ||
@@ -256,8 +257,7 @@ static int wlan_dev_open(struct net_device *dev) | |||
256 | wlan_private *priv = (wlan_private *) dev->priv; | 257 | wlan_private *priv = (wlan_private *) dev->priv; |
257 | wlan_adapter *adapter = priv->adapter; | 258 | wlan_adapter *adapter = priv->adapter; |
258 | 259 | ||
259 | ENTER(); | 260 | lbs_deb_enter(LBS_DEB_NET); |
260 | |||
261 | 261 | ||
262 | priv->open = 1; | 262 | priv->open = 1; |
263 | 263 | ||
@@ -266,7 +266,7 @@ static int wlan_dev_open(struct net_device *dev) | |||
266 | } else | 266 | } else |
267 | netif_carrier_off(priv->wlan_dev.netdev); | 267 | netif_carrier_off(priv->wlan_dev.netdev); |
268 | 268 | ||
269 | LEAVE(); | 269 | lbs_deb_leave(LBS_DEB_NET); |
270 | return 0; | 270 | return 0; |
271 | } | 271 | } |
272 | /** | 272 | /** |
@@ -311,12 +311,12 @@ static int wlan_dev_close(struct net_device *dev) | |||
311 | { | 311 | { |
312 | wlan_private *priv = dev->priv; | 312 | wlan_private *priv = dev->priv; |
313 | 313 | ||
314 | ENTER(); | 314 | lbs_deb_enter(LBS_DEB_NET); |
315 | 315 | ||
316 | netif_carrier_off(priv->wlan_dev.netdev); | 316 | netif_carrier_off(priv->wlan_dev.netdev); |
317 | priv->open = 0; | 317 | priv->open = 0; |
318 | 318 | ||
319 | LEAVE(); | 319 | lbs_deb_leave(LBS_DEB_NET); |
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | 322 | ||
@@ -361,7 +361,7 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
361 | int ret = 0; | 361 | int ret = 0; |
362 | wlan_private *priv = dev->priv; | 362 | wlan_private *priv = dev->priv; |
363 | 363 | ||
364 | ENTER(); | 364 | lbs_deb_enter(LBS_DEB_NET); |
365 | 365 | ||
366 | if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) { | 366 | if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) { |
367 | priv->stats.tx_dropped++; | 367 | priv->stats.tx_dropped++; |
@@ -373,7 +373,7 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
373 | if (libertas_process_tx(priv, skb) == 0) | 373 | if (libertas_process_tx(priv, skb) == 0) |
374 | dev->trans_start = jiffies; | 374 | dev->trans_start = jiffies; |
375 | done: | 375 | done: |
376 | LEAVE(); | 376 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); |
377 | return ret; | 377 | return ret; |
378 | } | 378 | } |
379 | 379 | ||
@@ -384,31 +384,41 @@ done: | |||
384 | static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) | 384 | static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) |
385 | { | 385 | { |
386 | wlan_private *priv = dev->priv; | 386 | wlan_private *priv = dev->priv; |
387 | ENTER(); | 387 | int ret; |
388 | |||
389 | lbs_deb_enter(LBS_DEB_MESH); | ||
390 | |||
388 | SET_MESH_FRAME(skb); | 391 | SET_MESH_FRAME(skb); |
389 | LEAVE(); | ||
390 | 392 | ||
391 | return wlan_hard_start_xmit(skb, priv->wlan_dev.netdev); | 393 | ret = wlan_hard_start_xmit(skb, priv->wlan_dev.netdev); |
394 | lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); | ||
395 | return ret; | ||
392 | } | 396 | } |
393 | 397 | ||
394 | /** | 398 | /** |
395 | * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit | 399 | * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit |
396 | * | 400 | * |
397 | */ | 401 | */ |
398 | static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) { | 402 | static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) |
399 | ENTER(); | 403 | { |
404 | int ret; | ||
405 | |||
406 | lbs_deb_enter(LBS_DEB_NET); | ||
407 | |||
400 | UNSET_MESH_FRAME(skb); | 408 | UNSET_MESH_FRAME(skb); |
401 | LEAVE(); | 409 | |
402 | return wlan_hard_start_xmit(skb, dev); | 410 | ret = wlan_hard_start_xmit(skb, dev); |
411 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); | ||
412 | return ret; | ||
403 | } | 413 | } |
404 | 414 | ||
405 | static void wlan_tx_timeout(struct net_device *dev) | 415 | static void wlan_tx_timeout(struct net_device *dev) |
406 | { | 416 | { |
407 | wlan_private *priv = (wlan_private *) dev->priv; | 417 | wlan_private *priv = (wlan_private *) dev->priv; |
408 | 418 | ||
409 | ENTER(); | 419 | lbs_deb_enter(LBS_DEB_TX); |
410 | 420 | ||
411 | lbs_pr_err("tx watch dog timeout!\n"); | 421 | lbs_pr_err("tx watch dog timeout\n"); |
412 | 422 | ||
413 | priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; | 423 | priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; |
414 | dev->trans_start = jiffies; | 424 | dev->trans_start = jiffies; |
@@ -424,7 +434,7 @@ static void wlan_tx_timeout(struct net_device *dev) | |||
424 | } else if (priv->adapter->connect_status == libertas_connected) | 434 | } else if (priv->adapter->connect_status == libertas_connected) |
425 | netif_wake_queue(priv->wlan_dev.netdev); | 435 | netif_wake_queue(priv->wlan_dev.netdev); |
426 | 436 | ||
427 | LEAVE(); | 437 | lbs_deb_leave(LBS_DEB_TX); |
428 | } | 438 | } |
429 | 439 | ||
430 | /** | 440 | /** |
@@ -447,7 +457,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr) | |||
447 | wlan_adapter *adapter = priv->adapter; | 457 | wlan_adapter *adapter = priv->adapter; |
448 | struct sockaddr *phwaddr = addr; | 458 | struct sockaddr *phwaddr = addr; |
449 | 459 | ||
450 | ENTER(); | 460 | lbs_deb_enter(LBS_DEB_NET); |
451 | 461 | ||
452 | memset(adapter->current_addr, 0, ETH_ALEN); | 462 | memset(adapter->current_addr, 0, ETH_ALEN); |
453 | 463 | ||
@@ -462,7 +472,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr) | |||
462 | cmd_option_waitforrsp, 0, NULL); | 472 | cmd_option_waitforrsp, 0, NULL); |
463 | 473 | ||
464 | if (ret) { | 474 | if (ret) { |
465 | lbs_pr_debug(1, "set mac address failed.\n"); | 475 | lbs_deb_net("set MAC address failed\n"); |
466 | ret = -1; | 476 | ret = -1; |
467 | goto done; | 477 | goto done; |
468 | } | 478 | } |
@@ -472,7 +482,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr) | |||
472 | memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); | 482 | memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); |
473 | 483 | ||
474 | done: | 484 | done: |
475 | LEAVE(); | 485 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); |
476 | return ret; | 486 | return ret; |
477 | } | 487 | } |
478 | 488 | ||
@@ -497,12 +507,12 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
497 | wlan_adapter *adapter = priv->adapter; | 507 | wlan_adapter *adapter = priv->adapter; |
498 | int oldpacketfilter; | 508 | int oldpacketfilter; |
499 | 509 | ||
500 | ENTER(); | 510 | lbs_deb_enter(LBS_DEB_NET); |
501 | 511 | ||
502 | oldpacketfilter = adapter->currentpacketfilter; | 512 | oldpacketfilter = adapter->currentpacketfilter; |
503 | 513 | ||
504 | if (dev->flags & IFF_PROMISC) { | 514 | if (dev->flags & IFF_PROMISC) { |
505 | lbs_pr_debug(1, "enable Promiscuous mode\n"); | 515 | lbs_deb_net("enable promiscuous mode\n"); |
506 | adapter->currentpacketfilter |= | 516 | adapter->currentpacketfilter |= |
507 | cmd_act_mac_promiscuous_enable; | 517 | cmd_act_mac_promiscuous_enable; |
508 | adapter->currentpacketfilter &= | 518 | adapter->currentpacketfilter &= |
@@ -515,7 +525,7 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
515 | 525 | ||
516 | if (dev->flags & IFF_ALLMULTI || dev->mc_count > | 526 | if (dev->flags & IFF_ALLMULTI || dev->mc_count > |
517 | MRVDRV_MAX_MULTICAST_LIST_SIZE) { | 527 | MRVDRV_MAX_MULTICAST_LIST_SIZE) { |
518 | lbs_pr_debug(1, "Enabling All Multicast!\n"); | 528 | lbs_deb_net( "enabling all multicast\n"); |
519 | adapter->currentpacketfilter |= | 529 | adapter->currentpacketfilter |= |
520 | cmd_act_mac_all_multicast_enable; | 530 | cmd_act_mac_all_multicast_enable; |
521 | adapter->currentpacketfilter &= | 531 | adapter->currentpacketfilter &= |
@@ -525,8 +535,8 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
525 | ~cmd_act_mac_all_multicast_enable; | 535 | ~cmd_act_mac_all_multicast_enable; |
526 | 536 | ||
527 | if (!dev->mc_count) { | 537 | if (!dev->mc_count) { |
528 | lbs_pr_debug(1, "No multicast addresses - " | 538 | lbs_deb_net("no multicast addresses, " |
529 | "disabling multicast!\n"); | 539 | "disabling multicast\n"); |
530 | adapter->currentpacketfilter &= | 540 | adapter->currentpacketfilter &= |
531 | ~cmd_act_mac_multicast_enable; | 541 | ~cmd_act_mac_multicast_enable; |
532 | } else { | 542 | } else { |
@@ -538,12 +548,12 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
538 | adapter->nr_of_multicastmacaddr = | 548 | adapter->nr_of_multicastmacaddr = |
539 | wlan_copy_multicast_address(adapter, dev); | 549 | wlan_copy_multicast_address(adapter, dev); |
540 | 550 | ||
541 | lbs_pr_debug(1, "Multicast addresses: %d\n", | 551 | lbs_deb_net("multicast addresses: %d\n", |
542 | dev->mc_count); | 552 | dev->mc_count); |
543 | 553 | ||
544 | for (i = 0; i < dev->mc_count; i++) { | 554 | for (i = 0; i < dev->mc_count; i++) { |
545 | lbs_pr_debug(1, "Multicast address %d:" | 555 | lbs_deb_net("Multicast address %d:" |
546 | "%x %x %x %x %x %x\n", i, | 556 | MAC_FMT "\n", i, |
547 | adapter->multicastlist[i][0], | 557 | adapter->multicastlist[i][0], |
548 | adapter->multicastlist[i][1], | 558 | adapter->multicastlist[i][1], |
549 | adapter->multicastlist[i][2], | 559 | adapter->multicastlist[i][2], |
@@ -551,7 +561,7 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
551 | adapter->multicastlist[i][4], | 561 | adapter->multicastlist[i][4], |
552 | adapter->multicastlist[i][5]); | 562 | adapter->multicastlist[i][5]); |
553 | } | 563 | } |
554 | /* set multicast addresses to firmware */ | 564 | /* send multicast addresses to firmware */ |
555 | libertas_prepare_and_send_command(priv, | 565 | libertas_prepare_and_send_command(priv, |
556 | cmd_mac_multicast_adr, | 566 | cmd_mac_multicast_adr, |
557 | cmd_act_set, 0, 0, | 567 | cmd_act_set, 0, 0, |
@@ -564,13 +574,13 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
564 | libertas_set_mac_packet_filter(priv); | 574 | libertas_set_mac_packet_filter(priv); |
565 | } | 575 | } |
566 | 576 | ||
567 | LEAVE(); | 577 | lbs_deb_leave(LBS_DEB_NET); |
568 | } | 578 | } |
569 | 579 | ||
570 | /** | 580 | /** |
571 | * @brief This function hanldes the major job in WLAN driver. | 581 | * @brief This function handles the major jobs in the WLAN driver. |
572 | * it handles the event generated by firmware, rx data received | 582 | * It handles all events generated by firmware, RX data received |
573 | * from firmware and tx data sent from kernel. | 583 | * from firmware and TX data sent from kernel. |
574 | * | 584 | * |
575 | * @param data A pointer to wlan_thread structure | 585 | * @param data A pointer to wlan_thread structure |
576 | * @return 0 | 586 | * @return 0 |
@@ -583,14 +593,14 @@ static int wlan_service_main_thread(void *data) | |||
583 | wait_queue_t wait; | 593 | wait_queue_t wait; |
584 | u8 ireg = 0; | 594 | u8 ireg = 0; |
585 | 595 | ||
586 | ENTER(); | 596 | lbs_deb_enter(LBS_DEB_THREAD); |
587 | 597 | ||
588 | wlan_activate_thread(thread); | 598 | wlan_activate_thread(thread); |
589 | 599 | ||
590 | init_waitqueue_entry(&wait, current); | 600 | init_waitqueue_entry(&wait, current); |
591 | 601 | ||
592 | for (;;) { | 602 | for (;;) { |
593 | lbs_pr_debug(1, "main-thread 111: intcounter=%d " | 603 | lbs_deb_thread( "main-thread 111: intcounter=%d " |
594 | "currenttxskb=%p dnld_sent=%d\n", | 604 | "currenttxskb=%p dnld_sent=%d\n", |
595 | adapter->intcounter, | 605 | adapter->intcounter, |
596 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); | 606 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); |
@@ -602,7 +612,7 @@ static int wlan_service_main_thread(void *data) | |||
602 | (!adapter->intcounter | 612 | (!adapter->intcounter |
603 | && (priv->wlan_dev.dnld_sent || adapter->cur_cmd || | 613 | && (priv->wlan_dev.dnld_sent || adapter->cur_cmd || |
604 | list_empty(&adapter->cmdpendingq)))) { | 614 | list_empty(&adapter->cmdpendingq)))) { |
605 | lbs_pr_debug(1, | 615 | lbs_deb_thread( |
606 | "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", | 616 | "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", |
607 | adapter->connect_status, adapter->intcounter, | 617 | adapter->connect_status, adapter->intcounter, |
608 | adapter->psmode, adapter->psstate); | 618 | adapter->psmode, adapter->psstate); |
@@ -612,7 +622,7 @@ static int wlan_service_main_thread(void *data) | |||
612 | spin_unlock_irq(&adapter->driver_lock); | 622 | spin_unlock_irq(&adapter->driver_lock); |
613 | 623 | ||
614 | 624 | ||
615 | lbs_pr_debug(1, | 625 | lbs_deb_thread( |
616 | "main-thread 222 (waking up): intcounter=%d currenttxskb=%p " | 626 | "main-thread 222 (waking up): intcounter=%d currenttxskb=%p " |
617 | "dnld_sent=%d\n", adapter->intcounter, | 627 | "dnld_sent=%d\n", adapter->intcounter, |
618 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); | 628 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); |
@@ -621,14 +631,14 @@ static int wlan_service_main_thread(void *data) | |||
621 | remove_wait_queue(&thread->waitq, &wait); | 631 | remove_wait_queue(&thread->waitq, &wait); |
622 | try_to_freeze(); | 632 | try_to_freeze(); |
623 | 633 | ||
624 | lbs_pr_debug(1, "main-thread 333: intcounter=%d currenttxskb=%p " | 634 | lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p " |
625 | "dnld_sent=%d\n", | 635 | "dnld_sent=%d\n", |
626 | adapter->intcounter, | 636 | adapter->intcounter, |
627 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); | 637 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); |
628 | 638 | ||
629 | if (kthread_should_stop() | 639 | if (kthread_should_stop() |
630 | || adapter->surpriseremoved) { | 640 | || adapter->surpriseremoved) { |
631 | lbs_pr_debug(1, | 641 | lbs_deb_thread( |
632 | "main-thread: break from main thread: surpriseremoved=0x%x\n", | 642 | "main-thread: break from main thread: surpriseremoved=0x%x\n", |
633 | adapter->surpriseremoved); | 643 | adapter->surpriseremoved); |
634 | break; | 644 | break; |
@@ -642,7 +652,7 @@ static int wlan_service_main_thread(void *data) | |||
642 | int_status = libertas_sbi_get_int_status(priv, &ireg); | 652 | int_status = libertas_sbi_get_int_status(priv, &ireg); |
643 | 653 | ||
644 | if (int_status) { | 654 | if (int_status) { |
645 | lbs_pr_debug(1, | 655 | lbs_deb_thread( |
646 | "main-thread: reading HOST_INT_STATUS_REG failed\n"); | 656 | "main-thread: reading HOST_INT_STATUS_REG failed\n"); |
647 | spin_unlock_irq(&adapter->driver_lock); | 657 | spin_unlock_irq(&adapter->driver_lock); |
648 | continue; | 658 | continue; |
@@ -650,14 +660,14 @@ static int wlan_service_main_thread(void *data) | |||
650 | adapter->hisregcpy |= ireg; | 660 | adapter->hisregcpy |= ireg; |
651 | } | 661 | } |
652 | 662 | ||
653 | lbs_pr_debug(1, "main-thread 444: intcounter=%d currenttxskb=%p " | 663 | lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p " |
654 | "dnld_sent=%d\n", | 664 | "dnld_sent=%d\n", |
655 | adapter->intcounter, | 665 | adapter->intcounter, |
656 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); | 666 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); |
657 | 667 | ||
658 | /* command response? */ | 668 | /* command response? */ |
659 | if (adapter->hisregcpy & his_cmdupldrdy) { | 669 | if (adapter->hisregcpy & his_cmdupldrdy) { |
660 | lbs_pr_debug(1, "main-thread: cmd response ready.\n"); | 670 | lbs_deb_thread("main-thread: cmd response ready\n"); |
661 | 671 | ||
662 | adapter->hisregcpy &= ~his_cmdupldrdy; | 672 | adapter->hisregcpy &= ~his_cmdupldrdy; |
663 | spin_unlock_irq(&adapter->driver_lock); | 673 | spin_unlock_irq(&adapter->driver_lock); |
@@ -667,13 +677,13 @@ static int wlan_service_main_thread(void *data) | |||
667 | 677 | ||
668 | /* Any Card Event */ | 678 | /* Any Card Event */ |
669 | if (adapter->hisregcpy & his_cardevent) { | 679 | if (adapter->hisregcpy & his_cardevent) { |
670 | lbs_pr_debug(1, "main-thread: Card Event Activity.\n"); | 680 | lbs_deb_thread("main-thread: Card Event Activity\n"); |
671 | 681 | ||
672 | adapter->hisregcpy &= ~his_cardevent; | 682 | adapter->hisregcpy &= ~his_cardevent; |
673 | 683 | ||
674 | if (libertas_sbi_read_event_cause(priv)) { | 684 | if (libertas_sbi_read_event_cause(priv)) { |
675 | lbs_pr_alert( | 685 | lbs_pr_alert( |
676 | "main-thread: libertas_sbi_read_event_cause failed.\n"); | 686 | "main-thread: libertas_sbi_read_event_cause failed\n"); |
677 | spin_unlock_irq(&adapter->driver_lock); | 687 | spin_unlock_irq(&adapter->driver_lock); |
678 | continue; | 688 | continue; |
679 | } | 689 | } |
@@ -687,7 +697,7 @@ static int wlan_service_main_thread(void *data) | |||
687 | if (!priv->wlan_dev.dnld_sent && !adapter->cur_cmd) { | 697 | if (!priv->wlan_dev.dnld_sent && !adapter->cur_cmd) { |
688 | if (adapter->connect_status == | 698 | if (adapter->connect_status == |
689 | libertas_connected) { | 699 | libertas_connected) { |
690 | lbs_pr_debug(1, | 700 | lbs_deb_thread( |
691 | "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p " | 701 | "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p " |
692 | "dnld_sent=%d cur_cmd=%p, confirm now\n", | 702 | "dnld_sent=%d cur_cmd=%p, confirm now\n", |
693 | adapter->intcounter, | 703 | adapter->intcounter, |
@@ -735,7 +745,7 @@ static int wlan_service_main_thread(void *data) | |||
735 | wake_up_all(&adapter->cmd_pending); | 745 | wake_up_all(&adapter->cmd_pending); |
736 | wlan_deactivate_thread(thread); | 746 | wlan_deactivate_thread(thread); |
737 | 747 | ||
738 | LEAVE(); | 748 | lbs_deb_leave(LBS_DEB_THREAD); |
739 | return 0; | 749 | return 0; |
740 | } | 750 | } |
741 | 751 | ||
@@ -752,11 +762,11 @@ wlan_private *wlan_add_card(void *card) | |||
752 | struct net_device *mesh_dev = NULL; | 762 | struct net_device *mesh_dev = NULL; |
753 | wlan_private *priv = NULL; | 763 | wlan_private *priv = NULL; |
754 | 764 | ||
755 | ENTER(); | 765 | lbs_deb_enter(LBS_DEB_NET); |
756 | 766 | ||
757 | /* Allocate an Ethernet device and register it */ | 767 | /* Allocate an Ethernet device and register it */ |
758 | if (!(dev = alloc_etherdev(sizeof(wlan_private)))) { | 768 | if (!(dev = alloc_etherdev(sizeof(wlan_private)))) { |
759 | lbs_pr_alert( "Init ethernet device failed!\n"); | 769 | lbs_pr_err("init ethX device failed\n"); |
760 | return NULL; | 770 | return NULL; |
761 | } | 771 | } |
762 | 772 | ||
@@ -764,13 +774,13 @@ wlan_private *wlan_add_card(void *card) | |||
764 | 774 | ||
765 | /* allocate buffer for wlan_adapter */ | 775 | /* allocate buffer for wlan_adapter */ |
766 | if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) { | 776 | if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) { |
767 | lbs_pr_alert( "Allocate buffer for wlan_adapter failed!\n"); | 777 | lbs_pr_err("allocate buffer for wlan_adapter failed\n"); |
768 | goto err_kmalloc; | 778 | goto err_kmalloc; |
769 | } | 779 | } |
770 | 780 | ||
771 | /* Allocate a virtual mesh device */ | 781 | /* Allocate a virtual mesh device */ |
772 | if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) { | 782 | if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) { |
773 | lbs_pr_debug(1, "Init ethernet device failed!\n"); | 783 | lbs_deb_mesh("init mshX device failed\n"); |
774 | return NULL; | 784 | return NULL; |
775 | } | 785 | } |
776 | 786 | ||
@@ -827,7 +837,7 @@ wlan_private *wlan_add_card(void *card) | |||
827 | init_waitqueue_head(&priv->adapter->cmd_pending); | 837 | init_waitqueue_head(&priv->adapter->cmd_pending); |
828 | priv->adapter->nr_cmd_pending = 0; | 838 | priv->adapter->nr_cmd_pending = 0; |
829 | 839 | ||
830 | lbs_pr_debug(1, "Starting kthread...\n"); | 840 | lbs_deb_thread("Starting kthread...\n"); |
831 | priv->mainthread.priv = priv; | 841 | priv->mainthread.priv = priv; |
832 | wlan_create_thread(wlan_service_main_thread, | 842 | wlan_create_thread(wlan_service_main_thread, |
833 | &priv->mainthread, "wlan_main_service"); | 843 | &priv->mainthread, "wlan_main_service"); |
@@ -842,28 +852,28 @@ wlan_private *wlan_add_card(void *card) | |||
842 | * IRQ. | 852 | * IRQ. |
843 | */ | 853 | */ |
844 | if (libertas_sbi_register_dev(priv) < 0) { | 854 | if (libertas_sbi_register_dev(priv) < 0) { |
845 | lbs_pr_info("failed to register wlan device!\n"); | 855 | lbs_pr_err("failed to register WLAN device\n"); |
846 | goto err_registerdev; | 856 | goto err_registerdev; |
847 | } | 857 | } |
848 | 858 | ||
849 | /* init FW and HW */ | 859 | /* init FW and HW */ |
850 | if (libertas_init_fw(priv)) { | 860 | if (libertas_init_fw(priv)) { |
851 | lbs_pr_debug(1, "Firmware Init failed\n"); | 861 | lbs_pr_err("firmware init failed\n"); |
852 | goto err_registerdev; | 862 | goto err_registerdev; |
853 | } | 863 | } |
854 | 864 | ||
855 | if (register_netdev(dev)) { | 865 | if (register_netdev(dev)) { |
856 | lbs_pr_err("Cannot register network device!\n"); | 866 | lbs_pr_err("cannot register ethX device\n"); |
857 | goto err_init_fw; | 867 | goto err_init_fw; |
858 | } | 868 | } |
859 | 869 | ||
860 | /* Register virtual mesh interface */ | 870 | /* Register virtual mesh interface */ |
861 | if (register_netdev(mesh_dev)) { | 871 | if (register_netdev(mesh_dev)) { |
862 | lbs_pr_info("Cannot register mesh virtual interface!\n"); | 872 | lbs_pr_err("cannot register mshX virtual interface\n"); |
863 | goto err_init_fw; | 873 | goto err_init_fw; |
864 | } | 874 | } |
865 | 875 | ||
866 | lbs_pr_info("%s: Marvell Wlan 802.11 adapter\n", dev->name); | 876 | lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name); |
867 | 877 | ||
868 | libertas_debugfs_init_one(priv, dev); | 878 | libertas_debugfs_init_one(priv, dev); |
869 | 879 | ||
@@ -874,7 +884,7 @@ wlan_private *wlan_add_card(void *card) | |||
874 | if (device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp)) | 884 | if (device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp)) |
875 | goto err_create_file; | 885 | goto err_create_file; |
876 | 886 | ||
877 | LEAVE(); | 887 | lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv); |
878 | return priv; | 888 | return priv; |
879 | 889 | ||
880 | err_create_file: | 890 | err_create_file: |
@@ -891,7 +901,7 @@ err_kmalloc: | |||
891 | free_netdev(dev); | 901 | free_netdev(dev); |
892 | free_netdev(mesh_dev); | 902 | free_netdev(mesh_dev); |
893 | 903 | ||
894 | LEAVE(); | 904 | lbs_deb_leave_args(LBS_DEB_NET, "priv NULL"); |
895 | return NULL; | 905 | return NULL; |
896 | } | 906 | } |
897 | 907 | ||
@@ -900,6 +910,8 @@ static void wake_pending_cmdnodes(wlan_private *priv) | |||
900 | struct cmd_ctrl_node *cmdnode; | 910 | struct cmd_ctrl_node *cmdnode; |
901 | unsigned long flags; | 911 | unsigned long flags; |
902 | 912 | ||
913 | lbs_deb_enter(LBS_DEB_CMD); | ||
914 | |||
903 | spin_lock_irqsave(&priv->adapter->driver_lock, flags); | 915 | spin_lock_irqsave(&priv->adapter->driver_lock, flags); |
904 | list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) { | 916 | list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) { |
905 | cmdnode->cmdwaitqwoken = 1; | 917 | cmdnode->cmdwaitqwoken = 1; |
@@ -918,19 +930,15 @@ int wlan_remove_card(void *card) | |||
918 | union iwreq_data wrqu; | 930 | union iwreq_data wrqu; |
919 | int i; | 931 | int i; |
920 | 932 | ||
921 | ENTER(); | 933 | lbs_deb_enter(LBS_DEB_NET); |
922 | 934 | ||
923 | if (!priv) { | 935 | if (!priv) |
924 | LEAVE(); | 936 | goto out; |
925 | return 0; | ||
926 | } | ||
927 | 937 | ||
928 | adapter = priv->adapter; | 938 | adapter = priv->adapter; |
929 | 939 | ||
930 | if (!adapter) { | 940 | if (!adapter) |
931 | LEAVE(); | 941 | goto out; |
932 | return 0; | ||
933 | } | ||
934 | 942 | ||
935 | dev = priv->wlan_dev.netdev; | 943 | dev = priv->wlan_dev.netdev; |
936 | mesh_dev = priv->mesh_dev; | 944 | mesh_dev = priv->mesh_dev; |
@@ -964,7 +972,7 @@ int wlan_remove_card(void *card) | |||
964 | 972 | ||
965 | libertas_debugfs_remove_one(priv); | 973 | libertas_debugfs_remove_one(priv); |
966 | 974 | ||
967 | lbs_pr_debug(1, "Free adapter\n"); | 975 | lbs_deb_net("free adapter\n"); |
968 | libertas_free_adapter(priv); | 976 | libertas_free_adapter(priv); |
969 | 977 | ||
970 | for (i = 0; i<libertas_found; i++) { | 978 | for (i = 0; i<libertas_found; i++) { |
@@ -975,14 +983,15 @@ int wlan_remove_card(void *card) | |||
975 | } | 983 | } |
976 | } | 984 | } |
977 | 985 | ||
978 | lbs_pr_debug(1, "Unregister finish\n"); | 986 | lbs_deb_net("unregister finish\n"); |
979 | 987 | ||
980 | priv->wlan_dev.netdev = NULL; | 988 | priv->wlan_dev.netdev = NULL; |
981 | priv->mesh_dev = NULL ; | 989 | priv->mesh_dev = NULL ; |
982 | free_netdev(mesh_dev); | 990 | free_netdev(mesh_dev); |
983 | free_netdev(dev); | 991 | free_netdev(dev); |
984 | 992 | ||
985 | LEAVE(); | 993 | out: |
994 | lbs_deb_leave(LBS_DEB_NET); | ||
986 | return 0; | 995 | return 0; |
987 | } | 996 | } |
988 | 997 | ||
@@ -999,33 +1008,34 @@ struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, int *c | |||
999 | { | 1008 | { |
1000 | int i, end; | 1009 | int i, end; |
1001 | 1010 | ||
1002 | ENTER(); | 1011 | lbs_deb_enter(LBS_DEB_MAIN); |
1003 | 1012 | ||
1004 | end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table); | 1013 | end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table); |
1005 | 1014 | ||
1006 | for (i = 0; i < end ; i++) { | 1015 | for (i = 0; i < end ; i++) { |
1007 | lbs_pr_debug(1, "region_cfp_table[i].region=%d\n", | 1016 | lbs_deb_main("region_cfp_table[i].region=%d\n", |
1008 | region_cfp_table[i].region); | 1017 | region_cfp_table[i].region); |
1009 | if (region_cfp_table[i].region == region) { | 1018 | if (region_cfp_table[i].region == region) { |
1010 | *cfp_no = region_cfp_table[i].cfp_no_BG; | 1019 | *cfp_no = region_cfp_table[i].cfp_no_BG; |
1011 | LEAVE(); | 1020 | lbs_deb_leave(LBS_DEB_MAIN); |
1012 | return region_cfp_table[i].cfp_BG; | 1021 | return region_cfp_table[i].cfp_BG; |
1013 | } | 1022 | } |
1014 | } | 1023 | } |
1015 | 1024 | ||
1016 | LEAVE(); | 1025 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL"); |
1017 | return NULL; | 1026 | return NULL; |
1018 | } | 1027 | } |
1019 | 1028 | ||
1020 | int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) | 1029 | int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) |
1021 | { | 1030 | { |
1022 | wlan_adapter *adapter = priv->adapter; | 1031 | wlan_adapter *adapter = priv->adapter; |
1032 | int ret = 0; | ||
1023 | int i = 0; | 1033 | int i = 0; |
1024 | 1034 | ||
1025 | struct chan_freq_power *cfp; | 1035 | struct chan_freq_power *cfp; |
1026 | int cfp_no; | 1036 | int cfp_no; |
1027 | 1037 | ||
1028 | ENTER(); | 1038 | lbs_deb_enter(LBS_DEB_MAIN); |
1029 | 1039 | ||
1030 | memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); | 1040 | memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); |
1031 | 1041 | ||
@@ -1035,17 +1045,19 @@ int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) | |||
1035 | adapter->region_channel[i].nrcfp = cfp_no; | 1045 | adapter->region_channel[i].nrcfp = cfp_no; |
1036 | adapter->region_channel[i].CFP = cfp; | 1046 | adapter->region_channel[i].CFP = cfp; |
1037 | } else { | 1047 | } else { |
1038 | lbs_pr_debug(1, "wrong region code %#x in band B-G\n", | 1048 | lbs_deb_main("wrong region code %#x in band B/G\n", |
1039 | region); | 1049 | region); |
1040 | return -1; | 1050 | ret = -1; |
1051 | goto out; | ||
1041 | } | 1052 | } |
1042 | adapter->region_channel[i].valid = 1; | 1053 | adapter->region_channel[i].valid = 1; |
1043 | adapter->region_channel[i].region = region; | 1054 | adapter->region_channel[i].region = region; |
1044 | adapter->region_channel[i].band = band; | 1055 | adapter->region_channel[i].band = band; |
1045 | i++; | 1056 | i++; |
1046 | } | 1057 | } |
1047 | LEAVE(); | 1058 | out: |
1048 | return 0; | 1059 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); |
1060 | return ret; | ||
1049 | } | 1061 | } |
1050 | 1062 | ||
1051 | /** | 1063 | /** |
@@ -1060,9 +1072,9 @@ void libertas_interrupt(struct net_device *dev) | |||
1060 | { | 1072 | { |
1061 | wlan_private *priv = dev->priv; | 1073 | wlan_private *priv = dev->priv; |
1062 | 1074 | ||
1063 | ENTER(); | 1075 | lbs_deb_enter(LBS_DEB_MAIN); |
1064 | 1076 | ||
1065 | lbs_pr_debug(1, "libertas_interrupt: intcounter=%d\n", | 1077 | lbs_deb_main("libertas_interrupt: intcounter=%d\n", |
1066 | priv->adapter->intcounter); | 1078 | priv->adapter->intcounter); |
1067 | 1079 | ||
1068 | priv->adapter->intcounter++; | 1080 | priv->adapter->intcounter++; |
@@ -1074,14 +1086,14 @@ void libertas_interrupt(struct net_device *dev) | |||
1074 | 1086 | ||
1075 | wake_up_interruptible(&priv->mainthread.waitq); | 1087 | wake_up_interruptible(&priv->mainthread.waitq); |
1076 | 1088 | ||
1077 | LEAVE(); | 1089 | lbs_deb_leave(LBS_DEB_MAIN); |
1078 | } | 1090 | } |
1079 | 1091 | ||
1080 | static int wlan_init_module(void) | 1092 | static int wlan_init_module(void) |
1081 | { | 1093 | { |
1082 | int ret = 0; | 1094 | int ret = 0; |
1083 | 1095 | ||
1084 | ENTER(); | 1096 | lbs_deb_enter(LBS_DEB_MAIN); |
1085 | 1097 | ||
1086 | if (libertas_fw_name == NULL) { | 1098 | if (libertas_fw_name == NULL) { |
1087 | libertas_fw_name = default_fw_name; | 1099 | libertas_fw_name = default_fw_name; |
@@ -1092,11 +1104,9 @@ static int wlan_init_module(void) | |||
1092 | if (libertas_sbi_register()) { | 1104 | if (libertas_sbi_register()) { |
1093 | ret = -1; | 1105 | ret = -1; |
1094 | libertas_debugfs_remove(); | 1106 | libertas_debugfs_remove(); |
1095 | goto done; | ||
1096 | } | 1107 | } |
1097 | 1108 | ||
1098 | done: | 1109 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); |
1099 | LEAVE(); | ||
1100 | return ret; | 1110 | return ret; |
1101 | } | 1111 | } |
1102 | 1112 | ||
@@ -1104,7 +1114,7 @@ static void wlan_cleanup_module(void) | |||
1104 | { | 1114 | { |
1105 | int i; | 1115 | int i; |
1106 | 1116 | ||
1107 | ENTER(); | 1117 | lbs_deb_enter(LBS_DEB_MAIN); |
1108 | 1118 | ||
1109 | for (i = 0; i<libertas_found; i++) { | 1119 | for (i = 0; i<libertas_found; i++) { |
1110 | wlan_private *priv = libertas_devs[i]->priv; | 1120 | wlan_private *priv = libertas_devs[i]->priv; |
@@ -1114,7 +1124,7 @@ static void wlan_cleanup_module(void) | |||
1114 | libertas_sbi_unregister(); | 1124 | libertas_sbi_unregister(); |
1115 | libertas_debugfs_remove(); | 1125 | libertas_debugfs_remove(); |
1116 | 1126 | ||
1117 | LEAVE(); | 1127 | lbs_deb_leave(LBS_DEB_MAIN); |
1118 | } | 1128 | } |
1119 | 1129 | ||
1120 | module_init(wlan_init_module); | 1130 | module_init(wlan_init_module); |