diff mbox

[2/2] mac80211: Add support for aborting an ongoing scan

Message ID 1446104804-8312-2-git-send-email-usdutt@qti.qualcomm.com (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show

Commit Message

Sunil Dutt Undekari Oct. 29, 2015, 7:46 a.m. UTC
From: Vidyullatha Kanchanapally <vkanchan@qti.qualcomm.com>

This commit adds implementation for abort scan in mac80211.

Reviewed-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Vidyullatha Kanchanapally <vkanchan@qti.qualcomm.com>
Signed-off-by: Sunil Dutt <usdutt@qti.qualcomm.com>
---
 net/mac80211/cfg.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Johannes Berg Oct. 30, 2015, 9:35 a.m. UTC | #1
On Thu, 2015-10-29 at 13:16 +0530, Sunil Dutt wrote:
> From: Vidyullatha Kanchanapally <vkanchan@qti.qualcomm.com>
> 
> This commit adds implementation for abort scan in mac80211.
> 
> Reviewed-by: Jouni Malinen <jouni@qca.qualcomm.com>
> Signed-off-by: Vidyullatha Kanchanapally <vkanchan@qti.qualcomm.com>
> Signed-off-by: Sunil Dutt <usdutt@qti.qualcomm.com>
> ---
>  net/mac80211/cfg.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 713cdbf..d4d78e1 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -3797,6 +3797,16 @@ static int ieee80211_del_tx_ts(struct wiphy 
> *wiphy, struct net_device *dev,
>  	return -ENOENT;
>  }
>  
> +static int ieee80211_abort_scan(struct wiphy *wiphy, struct 
> net_device *dev)
> +{
> +	struct ieee80211_sub_if_data *sdata = 
> IEEE80211_DEV_TO_SUB_IF(dev);
> +	struct ieee80211_local *local = sdata->local;
> +
> +	/* Cancel the ongoing scan */
> +	ieee80211_scan_cancel(local);
> +	return 0;
> +}

You're not returning -ENOENT when there's no scan, which could be racy?
I'm not sure those races would be relevant, but you should think about
that and document it.

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 713cdbf..d4d78e1 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3797,6 +3797,16 @@  static int ieee80211_del_tx_ts(struct wiphy *wiphy, struct net_device *dev,
 	return -ENOENT;
 }
 
+static int ieee80211_abort_scan(struct wiphy *wiphy, struct net_device *dev)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
+
+	/* Cancel the ongoing scan */
+	ieee80211_scan_cancel(local);
+	return 0;
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
@@ -3881,4 +3891,5 @@  const struct cfg80211_ops mac80211_config_ops = {
 	.set_ap_chanwidth = ieee80211_set_ap_chanwidth,
 	.add_tx_ts = ieee80211_add_tx_ts,
 	.del_tx_ts = ieee80211_del_tx_ts,
+	.abort_scan = ieee80211_abort_scan,
 };