aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/scan.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2007-05-25 00:33:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:37 -0400
commit2be9219680e8abfa79da74e8d827ecf5c41be76d (patch)
tree10435b4a845ac321ebd5a36b788246cee2a16e16 /drivers/net/wireless/libertas/scan.c
parentbf68dac89b6502f8577a8be1b4fc06cb641ae1f3 (diff)
[PATCH] libertas: fix scanning from associate path
The previous scan fix did not account for scan paths other than set_scan() that need to do a full scan at once. Add a "full_scan" parameter to wlan_scan_networks() to control such behaviour. 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.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index c9f573716f77..966a89367061 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -614,7 +614,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
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 const struct wlan_ioctl_user_scan_cfg * puserscanin,
618 int full_scan)
618{ 619{
619 struct chanscanparamset *ptmpchan; 620 struct chanscanparamset *ptmpchan;
620 struct chanscanparamset *pstartchan; 621 struct chanscanparamset *pstartchan;
@@ -723,11 +724,11 @@ static int wlan_scan_channel_list(wlan_private * priv,
723 /* Send the scan command to the firmware with the specified cfg */ 724 /* Send the scan command to the firmware with the specified cfg */
724 ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0, 725 ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0,
725 0, 0, pscancfgout); 726 0, 0, pscancfgout);
726 if (scanned >= 2) { 727 if (scanned >= 2 && !full_scan) {
727 priv->adapter->last_scanned_channel = ptmpchan->channumber; 728 priv->adapter->last_scanned_channel = ptmpchan->channumber;
728 return 0; 729 return 0;
729 } 730 }
730 731 scanned = 0;
731 } 732 }
732 733
733 priv->adapter->last_scanned_channel = ptmpchan->channumber; 734 priv->adapter->last_scanned_channel = ptmpchan->channumber;
@@ -753,7 +754,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
753 * @return 0 or < 0 if error 754 * @return 0 or < 0 if error
754 */ 755 */
755int wlan_scan_networks(wlan_private * priv, 756int wlan_scan_networks(wlan_private * priv,
756 const struct wlan_ioctl_user_scan_cfg * puserscanin) 757 const struct wlan_ioctl_user_scan_cfg * puserscanin,
758 int full_scan)
757{ 759{
758 wlan_adapter *adapter = priv->adapter; 760 wlan_adapter *adapter = priv->adapter;
759 struct mrvlietypes_chanlistparamset *pchantlvout; 761 struct mrvlietypes_chanlistparamset *pchantlvout;
@@ -813,7 +815,8 @@ int wlan_scan_networks(wlan_private * priv,
813 scan_cfg, 815 scan_cfg,
814 pchantlvout, 816 pchantlvout,
815 scan_chan_list, 817 scan_chan_list,
816 puserscanin); 818 puserscanin,
819 full_scan);
817 820
818 /* Process the resulting scan table: 821 /* Process the resulting scan table:
819 * - Remove any bad ssids 822 * - Remove any bad ssids
@@ -1388,7 +1391,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
1388 1391
1389 memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID)); 1392 memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID));
1390 1393
1391 wlan_scan_networks(priv, NULL); 1394 wlan_scan_networks(priv, NULL, 1);
1392 if (adapter->surpriseremoved) 1395 if (adapter->surpriseremoved)
1393 return -1; 1396 return -1;
1394 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); 1397 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
@@ -1431,7 +1434,7 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
1431 1434
1432 ENTER(); 1435 ENTER();
1433 1436
1434 wlan_scan_networks(priv, NULL); 1437 wlan_scan_networks(priv, NULL, 0);
1435 1438
1436 if (adapter->surpriseremoved) 1439 if (adapter->surpriseremoved)
1437 return -1; 1440 return -1;
@@ -1468,7 +1471,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
1468 prequestedssid->ssidlength); 1471 prequestedssid->ssidlength);
1469 scancfg.keeppreviousscan = keeppreviousscan; 1472 scancfg.keeppreviousscan = keeppreviousscan;
1470 1473
1471 wlan_scan_networks(priv, &scancfg); 1474 wlan_scan_networks(priv, &scancfg, 1);
1472 if (adapter->surpriseremoved) 1475 if (adapter->surpriseremoved)
1473 return -1; 1476 return -1;
1474 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); 1477 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
@@ -1500,7 +1503,7 @@ int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppr
1500 memcpy(scancfg.specificBSSID, bssid, sizeof(scancfg.specificBSSID)); 1503 memcpy(scancfg.specificBSSID, bssid, sizeof(scancfg.specificBSSID));
1501 scancfg.keeppreviousscan = keeppreviousscan; 1504 scancfg.keeppreviousscan = keeppreviousscan;
1502 1505
1503 wlan_scan_networks(priv, &scancfg); 1506 wlan_scan_networks(priv, &scancfg, 1);
1504 if (priv->adapter->surpriseremoved) 1507 if (priv->adapter->surpriseremoved)
1505 return -1; 1508 return -1;
1506 wait_event_interruptible(priv->adapter->cmd_pending, 1509 wait_event_interruptible(priv->adapter->cmd_pending,
@@ -1549,8 +1552,13 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1549 * if there's either commands in the queue or one being 1552 * if there's either commands in the queue or one being
1550 * processed return -EAGAIN for iwlist to retry later. 1553 * processed return -EAGAIN for iwlist to retry later.
1551 */ 1554 */
1552 if (adapter->nr_cmd_pending) 1555 if (adapter->nr_cmd_pending)
1556 return -EAGAIN;
1557
1558 if (adapter->last_scanned_channel) {
1559 wlan_scan_networks(priv, NULL, 0);
1553 return -EAGAIN; 1560 return -EAGAIN;
1561 }
1554 1562
1555 if (adapter->connect_status == libertas_connected) 1563 if (adapter->connect_status == libertas_connected)
1556 lbs_pr_debug(1, "Current ssid: %32s\n", 1564 lbs_pr_debug(1, "Current ssid: %32s\n",