cfg80211: Add support for aborting an ongoing scan

Implement new functionality for aborting an ongoing scan.

Add NL80211_CMD_ABORT_SCAN to the nl80211 interface. After
aborting the scan, driver shall provide the scan status by
calling cfg80211_scan_done().

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>
[change command to take wdev instead of netdev so that it
 can be used on p2p-device scans]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Git-commit: 91d3ab46730379e89e1e908c6f62fbcadb3d8f08
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Change-Id: I071841cfea5b0da72f70032d0d99b05678d3d747
CRs-fixed: 930859
This commit is contained in:
Vidyullatha Kanchanapally 2015-10-30 19:14:49 +05:30 committed by Sachin Ahuja
parent d7f4b6ff7d
commit ab86d5f634
5 changed files with 44 additions and 0 deletions

View File

@ -1980,6 +1980,8 @@ struct cfg80211_qos_map {
* the driver, and will be valid until passed to cfg80211_scan_done().
* For scan results, call cfg80211_inform_bss(); you can call this outside
* the scan/scan_done bracket too.
* @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
* indicate the status of the scan through cfg80211_scan_done().
*
* @auth: Request to authenticate with the specified peer
* @assoc: Request to (re)associate with the specified peer
@ -2209,6 +2211,7 @@ struct cfg80211_ops {
int (*scan)(struct wiphy *wiphy,
struct cfg80211_scan_request *request);
void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
int (*auth)(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_auth_request *req);

View File

@ -690,6 +690,10 @@
* QoS mapping is relevant for IP packets, it is only valid during an
* association. This is cleared on disassociation and AP restart.
*
* @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
* not running. The driver indicates the status of the scan through
* cfg80211_scan_done().
*
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@ -861,6 +865,8 @@ enum nl80211_commands {
NL80211_CMD_SET_QOS_MAP,
NL80211_CMD_ABORT_SCAN,
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */

View File

@ -5456,6 +5456,21 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
return err;
}
static int nl80211_abort_scan(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct wireless_dev *wdev = info->user_ptr[1];
if (!rdev->ops->abort_scan)
return -EOPNOTSUPP;
if (!rdev->scan_req)
return -ENOENT;
rdev_abort_scan(rdev, wdev);
return 0;
}
static int nl80211_start_sched_scan(struct sk_buff *skb,
struct genl_info *info)
{
@ -9064,6 +9079,14 @@ static struct genl_ops nl80211_ops[] = {
.internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL,
},
{
.cmd = NL80211_CMD_ABORT_SCAN,
.doit = nl80211_abort_scan,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL,
},
{
.cmd = NL80211_CMD_GET_SCAN,
.policy = nl80211_policy,

View File

@ -379,6 +379,14 @@ static inline int rdev_scan(struct cfg80211_registered_device *rdev,
return ret;
}
static inline void rdev_abort_scan(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev)
{
trace_rdev_abort_scan(&rdev->wiphy, wdev);
rdev->ops->abort_scan(&rdev->wiphy, wdev);
trace_rdev_return_void(&rdev->wiphy);
}
static inline int rdev_auth(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_auth_request *req)

View File

@ -2589,6 +2589,10 @@ TRACE_EVENT(cfg80211_ft_event,
WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(target_ap))
);
DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
TP_ARGS(wiphy, wdev)
);
#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH