diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2007-05-24 23:37:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:35 -0400 |
commit | 064827edf6901e5fcbd84fc258fb2326a530da9c (patch) | |
tree | 83d69827adb39ede44f0e9c29e66893bee32d5b9 /drivers/net/wireless/libertas/scan.c | |
parent | 5ecd3100e695228ac5e0ce0e325e252c0f11806f (diff) |
[PATCH] libertas: scan two channels per scan command
Scan two channels per each command on set_scan(), then bail out and let
get_scan() continue the scanning work up to the last channel.
This gives time to the firmware so it can go back to the association
channel and keep the connection alive.
Fixes http://dev.laptop.org/ticket/841
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/scan.c')
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 3c0b1a2a1727..c9f573716f77 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -613,7 +613,8 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
613 | u8 filteredscan, | 613 | u8 filteredscan, |
614 | struct wlan_scan_cmd_config * pscancfgout, | 614 | struct wlan_scan_cmd_config * pscancfgout, |
615 | struct mrvlietypes_chanlistparamset * pchantlvout, | 615 | struct mrvlietypes_chanlistparamset * pchantlvout, |
616 | struct chanscanparamset * pscanchanlist) | 616 | struct chanscanparamset * pscanchanlist, |
617 | const struct wlan_ioctl_user_scan_cfg * puserscanin) | ||
617 | { | 618 | { |
618 | struct chanscanparamset *ptmpchan; | 619 | struct chanscanparamset *ptmpchan; |
619 | struct chanscanparamset *pstartchan; | 620 | struct chanscanparamset *pstartchan; |
@@ -621,6 +622,8 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
621 | int doneearly; | 622 | int doneearly; |
622 | int tlvidx; | 623 | int tlvidx; |
623 | int ret = 0; | 624 | int ret = 0; |
625 | int scanned = 0; | ||
626 | union iwreq_data wrqu; | ||
624 | 627 | ||
625 | ENTER(); | 628 | ENTER(); |
626 | 629 | ||
@@ -635,6 +638,9 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
635 | /* Set the temp channel struct pointer to the start of the desired list */ | 638 | /* Set the temp channel struct pointer to the start of the desired list */ |
636 | ptmpchan = pscanchanlist; | 639 | ptmpchan = pscanchanlist; |
637 | 640 | ||
641 | if (priv->adapter->last_scanned_channel && !puserscanin) | ||
642 | ptmpchan += priv->adapter->last_scanned_channel; | ||
643 | |||
638 | /* Loop through the desired channel list, sending a new firmware scan | 644 | /* Loop through the desired channel list, sending a new firmware scan |
639 | * commands for each maxchanperscan channels (or for 1,6,11 individually | 645 | * commands for each maxchanperscan channels (or for 1,6,11 individually |
640 | * if configured accordingly) | 646 | * if configured accordingly) |
@@ -654,7 +660,7 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
654 | * - doneearly is set (controlling individual scanning of 1,6,11) | 660 | * - doneearly is set (controlling individual scanning of 1,6,11) |
655 | */ | 661 | */ |
656 | while (tlvidx < maxchanperscan && ptmpchan->channumber | 662 | while (tlvidx < maxchanperscan && ptmpchan->channumber |
657 | && !doneearly) { | 663 | && !doneearly && scanned < 2) { |
658 | 664 | ||
659 | lbs_pr_debug(1, | 665 | lbs_pr_debug(1, |
660 | "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n", | 666 | "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n", |
@@ -701,6 +707,7 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
701 | 707 | ||
702 | /* Increment the tmp pointer to the next channel to be scanned */ | 708 | /* Increment the tmp pointer to the next channel to be scanned */ |
703 | ptmpchan++; | 709 | ptmpchan++; |
710 | scanned++; | ||
704 | 711 | ||
705 | /* Stop the loop if the *next* channel is in the 1,6,11 set. | 712 | /* Stop the loop if the *next* channel is in the 1,6,11 set. |
706 | * This will cause it to be the only channel scanned on the next | 713 | * This will cause it to be the only channel scanned on the next |
@@ -716,8 +723,18 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
716 | /* Send the scan command to the firmware with the specified cfg */ | 723 | /* Send the scan command to the firmware with the specified cfg */ |
717 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0, | 724 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0, |
718 | 0, 0, pscancfgout); | 725 | 0, 0, pscancfgout); |
726 | if (scanned >= 2) { | ||
727 | priv->adapter->last_scanned_channel = ptmpchan->channumber; | ||
728 | return 0; | ||
729 | } | ||
730 | |||
719 | } | 731 | } |
720 | 732 | ||
733 | priv->adapter->last_scanned_channel = ptmpchan->channumber; | ||
734 | |||
735 | memset(&wrqu, 0, sizeof(union iwreq_data)); | ||
736 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL); | ||
737 | |||
721 | LEAVE(); | 738 | LEAVE(); |
722 | return ret; | 739 | return ret; |
723 | } | 740 | } |
@@ -775,6 +792,9 @@ int wlan_scan_networks(wlan_private * priv, | |||
775 | keeppreviousscan = puserscanin->keeppreviousscan; | 792 | keeppreviousscan = puserscanin->keeppreviousscan; |
776 | } | 793 | } |
777 | 794 | ||
795 | if (adapter->last_scanned_channel) | ||
796 | keeppreviousscan = 1; | ||
797 | |||
778 | if (!keeppreviousscan) { | 798 | if (!keeppreviousscan) { |
779 | memset(adapter->scantable, 0x00, | 799 | memset(adapter->scantable, 0x00, |
780 | sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST); | 800 | sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST); |
@@ -792,7 +812,8 @@ int wlan_scan_networks(wlan_private * priv, | |||
792 | filteredscan, | 812 | filteredscan, |
793 | scan_cfg, | 813 | scan_cfg, |
794 | pchantlvout, | 814 | pchantlvout, |
795 | scan_chan_list); | 815 | scan_chan_list, |
816 | puserscanin); | ||
796 | 817 | ||
797 | /* Process the resulting scan table: | 818 | /* Process the resulting scan table: |
798 | * - Remove any bad ssids | 819 | * - Remove any bad ssids |
@@ -1407,15 +1428,10 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, | |||
1407 | { | 1428 | { |
1408 | wlan_private *priv = dev->priv; | 1429 | wlan_private *priv = dev->priv; |
1409 | wlan_adapter *adapter = priv->adapter; | 1430 | wlan_adapter *adapter = priv->adapter; |
1410 | union iwreq_data wrqu; | ||
1411 | 1431 | ||
1412 | ENTER(); | 1432 | ENTER(); |
1413 | 1433 | ||
1414 | if (!wlan_scan_networks(priv, NULL)) { | 1434 | wlan_scan_networks(priv, NULL); |
1415 | memset(&wrqu, 0, sizeof(union iwreq_data)); | ||
1416 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, | ||
1417 | NULL); | ||
1418 | } | ||
1419 | 1435 | ||
1420 | if (adapter->surpriseremoved) | 1436 | if (adapter->surpriseremoved) |
1421 | return -1; | 1437 | return -1; |