Commit b4c3f34a authored by Daniel Drake's avatar Daniel Drake Committed by John W. Linville

libertas: scan behaviour consistency improvements

When scanning for the broadcast SSID, there is no need to add the
SSID TLV (restoring the behaviour of the driver behaviour in the wext
days, confirmed in Marvell specifications).

If bssid is unspecified, the current scan code will usually fire off an
active scan probing for the specific requested SSID. However, if a scan
is ongoing (or has just finished), those scan results will be used
instead (even if that scan is totally different, e.g. a passive scan on
channel 4 for a different SSID). Fix this inconsistency by always
firing off a scan when associating without a bssid.
Signed-off-by: default avatarDaniel Drake <dsd@laptop.org>
Acked-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 38ba3c57
...@@ -695,7 +695,7 @@ static void lbs_scan_worker(struct work_struct *work) ...@@ -695,7 +695,7 @@ static void lbs_scan_worker(struct work_struct *work)
tlv = scan_cmd->tlvbuffer; tlv = scan_cmd->tlvbuffer;
/* add SSID TLV */ /* add SSID TLV */
if (priv->scan_req->n_ssids) if (priv->scan_req->n_ssids && priv->scan_req->ssids[0].ssid_len > 0)
tlv += lbs_add_ssid_tlv(tlv, tlv += lbs_add_ssid_tlv(tlv,
priv->scan_req->ssids[0].ssid, priv->scan_req->ssids[0].ssid,
priv->scan_req->ssids[0].ssid_len); priv->scan_req->ssids[0].ssid_len);
...@@ -736,7 +736,6 @@ static void lbs_scan_worker(struct work_struct *work) ...@@ -736,7 +736,6 @@ static void lbs_scan_worker(struct work_struct *work)
cfg80211_scan_done(priv->scan_req, false); cfg80211_scan_done(priv->scan_req, false);
priv->scan_req = NULL; priv->scan_req = NULL;
priv->last_scan = jiffies;
} }
/* Restart network */ /* Restart network */
...@@ -1302,24 +1301,26 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -1302,24 +1301,26 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
lbs_deb_enter(LBS_DEB_CFG80211); lbs_deb_enter(LBS_DEB_CFG80211);
if (!sme->bssid) { if (!sme->bssid) {
/* Run a scan if one isn't in-progress already and if the last struct cfg80211_scan_request *creq;
* scan was done more than 2 seconds ago.
*/
if (priv->scan_req == NULL &&
time_after(jiffies, priv->last_scan + (2 * HZ))) {
struct cfg80211_scan_request *creq;
creq = _new_connect_scan_req(wiphy, sme); /*
if (!creq) { * Scan for the requested network after waiting for existing
ret = -EINVAL; * scans to finish.
goto done; */
} lbs_deb_assoc("assoc: waiting for existing scans\n");
wait_event_interruptible_timeout(priv->scan_q,
(priv->scan_req == NULL),
(15 * HZ));
lbs_deb_assoc("assoc: scanning for compatible AP\n"); creq = _new_connect_scan_req(wiphy, sme);
_internal_start_scan(priv, true, creq); if (!creq) {
ret = -EINVAL;
goto done;
} }
/* Wait for any in-progress scan to complete */ lbs_deb_assoc("assoc: scanning for compatible AP\n");
_internal_start_scan(priv, true, creq);
lbs_deb_assoc("assoc: waiting for scan to complete\n"); lbs_deb_assoc("assoc: waiting for scan to complete\n");
wait_event_interruptible_timeout(priv->scan_q, wait_event_interruptible_timeout(priv->scan_q,
(priv->scan_req == NULL), (priv->scan_req == NULL),
......
...@@ -179,7 +179,6 @@ struct lbs_private { ...@@ -179,7 +179,6 @@ struct lbs_private {
wait_queue_head_t scan_q; wait_queue_head_t scan_q;
/* Whether the scan was initiated internally and not by cfg80211 */ /* Whether the scan was initiated internally and not by cfg80211 */
bool internal_scan; bool internal_scan;
unsigned long last_scan;
}; };
extern struct cmd_confirm_sleep confirm_sleep; extern struct cmd_confirm_sleep confirm_sleep;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment