Linux wireless drivers development
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: Daniel Drake <dsd@laptop.org>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	libertas-dev@lists.infradead.org
Subject: Re: [PATCH] libertas: scan behaviour consistency improvements
Date: Thu, 22 Sep 2011 12:05:12 -0500	[thread overview]
Message-ID: <1316711112.3698.15.camel@dcbw.foobar.com> (raw)
In-Reply-To: <20110921174359.DD2B39D401D@zog.reactivated.net>

On Wed, 2011-09-21 at 18:43 +0100, Daniel Drake wrote:
> 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).

I reviewed the specs for v9 and v10 and this is correct.

> 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: Daniel Drake <dsd@laptop.org>

Acked-by: Dan Williams <dcbw@redhat.com>

> ---
>  drivers/net/wireless/libertas/cfg.c |   33 +++++++++++++++++----------------
>  drivers/net/wireless/libertas/dev.h |    1 -
>  2 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
> index b456a53..93e5dea 100644
> --- a/drivers/net/wireless/libertas/cfg.c
> +++ b/drivers/net/wireless/libertas/cfg.c
> @@ -691,7 +691,7 @@ static void lbs_scan_worker(struct work_struct *work)
>  	tlv = scan_cmd->tlvbuffer;
>  
>  	/* 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,
>  					priv->scan_req->ssids[0].ssid,
>  					priv->scan_req->ssids[0].ssid_len);
> @@ -732,7 +732,6 @@ static void lbs_scan_worker(struct work_struct *work)
>  			cfg80211_scan_done(priv->scan_req, false);
>  
>  		priv->scan_req = NULL;
> -		priv->last_scan = jiffies;
>  	}
>  
>  	/* Restart network */
> @@ -1295,24 +1294,26 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
>  	lbs_deb_enter(LBS_DEB_CFG80211);
>  
>  	if (!sme->bssid) {
> -		/* Run a scan if one isn't in-progress already and if the last
> -		 * 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;
> +		struct cfg80211_scan_request *creq;
>  
> -			creq = _new_connect_scan_req(wiphy, sme);
> -			if (!creq) {
> -				ret = -EINVAL;
> -				goto done;
> -			}
> +		/*
> +		 * Scan for the requested network after waiting for existing
> +		 * scans to finish.
> +		 */
> +		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");
> -			_internal_start_scan(priv, true, creq);
> +		creq = _new_connect_scan_req(wiphy, sme);
> +		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");
>  		wait_event_interruptible_timeout(priv->scan_q,
>  						 (priv->scan_req == NULL),
> diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
> index adb3490..5ac4d17 100644
> --- a/drivers/net/wireless/libertas/dev.h
> +++ b/drivers/net/wireless/libertas/dev.h
> @@ -167,7 +167,6 @@ struct lbs_private {
>  	wait_queue_head_t scan_q;
>  	/* Whether the scan was initiated internally and not by cfg80211 */
>  	bool internal_scan;
> -	unsigned long last_scan;
>  };
>  
>  extern struct cmd_confirm_sleep confirm_sleep;



      reply	other threads:[~2011-09-22 17:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21 17:43 [PATCH] libertas: scan behaviour consistency improvements Daniel Drake
2011-09-22 17:05 ` Dan Williams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316711112.3698.15.camel@dcbw.foobar.com \
    --to=dcbw@redhat.com \
    --cc=dsd@laptop.org \
    --cc=libertas-dev@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox