linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: luciano.coelho@nokia.com
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFC v2 1/2] cfg80211/nl80211: add support for scheduled scans
Date: Fri, 10 Dec 2010 21:03:26 +0100	[thread overview]
Message-ID: <1292011406.3531.17.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1291993632-6921-2-git-send-email-luciano.coelho@nokia.com>

On Fri, 2010-12-10 at 17:07 +0200, luciano.coelho@nokia.com wrote:


> With this feature we
> can scan automatically for specific SSIDs (or any if not specified) at
> certain intervals.

I'd hope that "if not specified" actually means a passive scan like in
normal scanning, and you need to specify the wildcard if you want to
scan for it?

> +	u8 max_sched_scan_ssids;

shouldn't this be advertised in nl80211 as well?

> @@ -647,6 +648,11 @@ static void wdev_cleanup_work(struct work_struct *work)
>  		___cfg80211_scan_done(rdev, true);
>  	}
>  
> +	if (rdev->sched_scan_req &&
> +	    rdev->sched_scan_req->dev == wdev->netdev) {
> +		nl80211_sched_scan_stopped(rdev, wdev->netdev);
> +	}

Hmm, are you sure that shouldn't be a warning like the scan case? If the
driver didn't stop -- maybe this is still going on? I think instead the
netdev down notifier should actually ask the device to stop the sched
scan (core.c).


> +	if (!rdev->ops->sched_scan_start) {
> +		return -EOPNOTSUPP;
> +	}
> +
> +	if (rdev->sched_scan_req) {
> +		return -EINPROGRESS;
> +	}

bit too many braces for my taste :)

> +	if (ie_len > wiphy->max_scan_ie_len)
> +		return -EINVAL;

So # SSIDs is different, but IE len is the same? Isn't that a bad
assumption to make?

> +	request->dev = dev;
> +	request->wiphy = &rdev->wiphy;
> +
> +	rdev->sched_scan_req = request;
> +
> +	err = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
> +	if (!err) {
> +		nl80211_send_sched_scan(rdev, dev,
> +					NL80211_CMD_START_SCHED_SCAN);
> +		dev_hold(dev);

I don't think you want the dev_hold here. That's a trick I used to warn
about scans that didn't finish when the interface went down. Here,
instead, since it's a longer-running process, you should do what I said
above -- stop the sched scan when the interface is going down.

> +	err = rdev->ops->sched_scan_stop(&rdev->wiphy, dev);
> +	if (err)
> +		goto out;

return err; instead? There's no cleanup code at the out label :)

> +	nl80211_send_sched_scan(rdev, dev, NL80211_CMD_STOP_SCHED_SCAN);
> +
> +	nl80211_sched_scan_stopped(rdev, dev);

Shouldn't the former be part of the latter function? And actually,
you'll want to roll it all into a helper function that you can call from
the netdev down notifier :)

johannes


  reply	other threads:[~2010-12-10 20:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-10 15:07 [RFC v2 0/2] implementation of scheduled scan luciano.coelho
2010-12-10 15:07 ` [RFC v2 1/2] cfg80211/nl80211: add support for scheduled scans luciano.coelho
2010-12-10 20:03   ` Johannes Berg [this message]
2010-12-13 14:04     ` Luciano Coelho
2010-12-10 20:05   ` Johannes Berg
2010-12-13 15:30     ` Luciano Coelho
2010-12-10 15:07 ` [RFC v2 2/2] mac80211: add support for HW scheduled scan luciano.coelho
2010-12-10 20:15   ` Johannes Berg
2010-12-14 16:06     ` Luciano Coelho
2010-12-10 19:53 ` [RFC v2 0/2] implementation of " Johannes Berg
2010-12-10 20:17   ` Johannes Berg
2010-12-13 16:13     ` Luciano Coelho

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=1292011406.3531.17.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@nokia.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;
as well as URLs for NNTP newsgroup(s).