summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/net/wireless/libertas/debugfs.c2
-rw-r--r--drivers/net/wireless/libertas/scan.c28
-rw-r--r--drivers/net/wireless/libertas/scan.h3
3 files changed, 21 insertions, 12 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 1f06b0752d0..d77bec9f5d1 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -387,7 +387,7 @@ static ssize_t libertas_setuserscan(struct file *file,
libertas_parse_probes(buf, count, scan_cfg);
libertas_parse_type(buf, count, scan_cfg);
- wlan_scan_networks(priv, scan_cfg);
+ wlan_scan_networks(priv, scan_cfg, 1);
wait_event_interruptible(priv->adapter->cmd_pending,
!priv->adapter->nr_cmd_pending);
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index c9f573716f7..966a8936706 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,
struct wlan_scan_cmd_config * pscancfgout,
struct mrvlietypes_chanlistparamset * pchantlvout,
struct chanscanparamset * pscanchanlist,
- const struct wlan_ioctl_user_scan_cfg * puserscanin)
+ const struct wlan_ioctl_user_scan_cfg * puserscanin,
+ int full_scan)
{
struct chanscanparamset *ptmpchan;
struct chanscanparamset *pstartchan;
@@ -723,11 +724,11 @@ static int wlan_scan_channel_list(wlan_private * priv,
/* Send the scan command to the firmware with the specified cfg */
ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0,
0, 0, pscancfgout);
- if (scanned >= 2) {
+ if (scanned >= 2 && !full_scan) {
priv->adapter->last_scanned_channel = ptmpchan->channumber;
return 0;
}
-
+ scanned = 0;
}
priv->adapter->last_scanned_channel = ptmpchan->channumber;
@@ -753,7 +754,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
* @return 0 or < 0 if error
*/
int wlan_scan_networks(wlan_private * priv,
- const struct wlan_ioctl_user_scan_cfg * puserscanin)
+ const struct wlan_ioctl_user_scan_cfg * puserscanin,
+ int full_scan)
{
wlan_adapter *adapter = priv->adapter;
struct mrvlietypes_chanlistparamset *pchantlvout;
@@ -813,7 +815,8 @@ int wlan_scan_networks(wlan_private * priv,
scan_cfg,
pchantlvout,
scan_chan_list,
- puserscanin);
+ puserscanin,
+ full_scan);
/* Process the resulting scan table:
* - Remove any bad ssids
@@ -1388,7 +1391,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID));
- wlan_scan_networks(priv, NULL);
+ wlan_scan_networks(priv, NULL, 1);
if (adapter->surpriseremoved)
return -1;
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,
ENTER();
- wlan_scan_networks(priv, NULL);
+ wlan_scan_networks(priv, NULL, 0);
if (adapter->surpriseremoved)
return -1;
@@ -1468,7 +1471,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
prequestedssid->ssidlength);
scancfg.keeppreviousscan = keeppreviousscan;
- wlan_scan_networks(priv, &scancfg);
+ wlan_scan_networks(priv, &scancfg, 1);
if (adapter->surpriseremoved)
return -1;
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
memcpy(scancfg.specificBSSID, bssid, sizeof(scancfg.specificBSSID));
scancfg.keeppreviousscan = keeppreviousscan;
- wlan_scan_networks(priv, &scancfg);
+ wlan_scan_networks(priv, &scancfg, 1);
if (priv->adapter->surpriseremoved)
return -1;
wait_event_interruptible(priv->adapter->cmd_pending,
@@ -1549,8 +1552,13 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
* if there's either commands in the queue or one being
* processed return -EAGAIN for iwlist to retry later.
*/
- if (adapter->nr_cmd_pending)
+ if (adapter->nr_cmd_pending)
+ return -EAGAIN;
+
+ if (adapter->last_scanned_channel) {
+ wlan_scan_networks(priv, NULL, 0);
return -EAGAIN;
+ }
if (adapter->connect_status == libertas_connected)
lbs_pr_debug(1, "Current ssid: %32s\n",
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h
index 405f4f0fe57..26287caaf9b 100644
--- a/drivers/net/wireless/libertas/scan.h
+++ b/drivers/net/wireless/libertas/scan.h
@@ -199,7 +199,8 @@ extern int libertas_ret_80211_scan(wlan_private * priv,
struct cmd_ds_command *resp);
int wlan_scan_networks(wlan_private * priv,
- const struct wlan_ioctl_user_scan_cfg * puserscanin);
+ const struct wlan_ioctl_user_scan_cfg * puserscanin,
+ int full_scan);
struct ifreq;