diff options
author | Vidyullatha Kanchanapally <vkanchan@qti.qualcomm.com> | 2015-10-30 09:44:49 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-12-04 08:43:32 -0500 |
commit | 91d3ab46730379e89e1e908c6f62fbcadb3d8f08 (patch) | |
tree | cc59634568963090cf4d732e34ee6bebc0b49ec1 | |
parent | b115b972997428b9134aba377721fea6486adbd0 (diff) |
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>
-rw-r--r-- | include/net/cfg80211.h | 3 | ||||
-rw-r--r-- | include/uapi/linux/nl80211.h | 6 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 26 | ||||
-rw-r--r-- | net/wireless/rdev-ops.h | 8 | ||||
-rw-r--r-- | net/wireless/trace.h | 4 |
5 files changed, 47 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index e568872203a5..9bcaaf7cd15a 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -2321,6 +2321,8 @@ struct cfg80211_qos_map { | |||
2321 | * the driver, and will be valid until passed to cfg80211_scan_done(). | 2321 | * the driver, and will be valid until passed to cfg80211_scan_done(). |
2322 | * For scan results, call cfg80211_inform_bss(); you can call this outside | 2322 | * For scan results, call cfg80211_inform_bss(); you can call this outside |
2323 | * the scan/scan_done bracket too. | 2323 | * the scan/scan_done bracket too. |
2324 | * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall | ||
2325 | * indicate the status of the scan through cfg80211_scan_done(). | ||
2324 | * | 2326 | * |
2325 | * @auth: Request to authenticate with the specified peer | 2327 | * @auth: Request to authenticate with the specified peer |
2326 | * (invoked with the wireless_dev mutex held) | 2328 | * (invoked with the wireless_dev mutex held) |
@@ -2593,6 +2595,7 @@ struct cfg80211_ops { | |||
2593 | 2595 | ||
2594 | int (*scan)(struct wiphy *wiphy, | 2596 | int (*scan)(struct wiphy *wiphy, |
2595 | struct cfg80211_scan_request *request); | 2597 | struct cfg80211_scan_request *request); |
2598 | void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); | ||
2596 | 2599 | ||
2597 | int (*auth)(struct wiphy *wiphy, struct net_device *dev, | 2600 | int (*auth)(struct wiphy *wiphy, struct net_device *dev, |
2598 | struct cfg80211_auth_request *req); | 2601 | struct cfg80211_auth_request *req); |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 07099cb14778..5b7b5ebe7ca8 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
@@ -820,6 +820,10 @@ | |||
820 | * as an event to indicate changes for devices with wiphy-specific regdom | 820 | * as an event to indicate changes for devices with wiphy-specific regdom |
821 | * management. | 821 | * management. |
822 | * | 822 | * |
823 | * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is | ||
824 | * not running. The driver indicates the status of the scan through | ||
825 | * cfg80211_scan_done(). | ||
826 | * | ||
823 | * @NL80211_CMD_MAX: highest used command number | 827 | * @NL80211_CMD_MAX: highest used command number |
824 | * @__NL80211_CMD_AFTER_LAST: internal use | 828 | * @__NL80211_CMD_AFTER_LAST: internal use |
825 | */ | 829 | */ |
@@ -1006,6 +1010,8 @@ enum nl80211_commands { | |||
1006 | 1010 | ||
1007 | NL80211_CMD_WIPHY_REG_CHANGE, | 1011 | NL80211_CMD_WIPHY_REG_CHANGE, |
1008 | 1012 | ||
1013 | NL80211_CMD_ABORT_SCAN, | ||
1014 | |||
1009 | /* add new commands above here */ | 1015 | /* add new commands above here */ |
1010 | 1016 | ||
1011 | /* used to define NL80211_CMD_MAX below */ | 1017 | /* used to define NL80211_CMD_MAX below */ |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 41e57d0c4d43..67e7b531db79 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -5997,6 +5997,24 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
5997 | return err; | 5997 | return err; |
5998 | } | 5998 | } |
5999 | 5999 | ||
6000 | static int nl80211_abort_scan(struct sk_buff *skb, struct genl_info *info) | ||
6001 | { | ||
6002 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | ||
6003 | struct wireless_dev *wdev = info->user_ptr[1]; | ||
6004 | |||
6005 | if (!rdev->ops->abort_scan) | ||
6006 | return -EOPNOTSUPP; | ||
6007 | |||
6008 | if (rdev->scan_msg) | ||
6009 | return 0; | ||
6010 | |||
6011 | if (!rdev->scan_req) | ||
6012 | return -ENOENT; | ||
6013 | |||
6014 | rdev_abort_scan(rdev, wdev); | ||
6015 | return 0; | ||
6016 | } | ||
6017 | |||
6000 | static int | 6018 | static int |
6001 | nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, | 6019 | nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, |
6002 | struct cfg80211_sched_scan_request *request, | 6020 | struct cfg80211_sched_scan_request *request, |
@@ -10945,6 +10963,14 @@ static const struct genl_ops nl80211_ops[] = { | |||
10945 | NL80211_FLAG_NEED_RTNL, | 10963 | NL80211_FLAG_NEED_RTNL, |
10946 | }, | 10964 | }, |
10947 | { | 10965 | { |
10966 | .cmd = NL80211_CMD_ABORT_SCAN, | ||
10967 | .doit = nl80211_abort_scan, | ||
10968 | .policy = nl80211_policy, | ||
10969 | .flags = GENL_ADMIN_PERM, | ||
10970 | .internal_flags = NL80211_FLAG_NEED_WDEV_UP | | ||
10971 | NL80211_FLAG_NEED_RTNL, | ||
10972 | }, | ||
10973 | { | ||
10948 | .cmd = NL80211_CMD_GET_SCAN, | 10974 | .cmd = NL80211_CMD_GET_SCAN, |
10949 | .policy = nl80211_policy, | 10975 | .policy = nl80211_policy, |
10950 | .dumpit = nl80211_dump_scan, | 10976 | .dumpit = nl80211_dump_scan, |
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index b8cc594d409d..8ae0c04f9fc7 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h | |||
@@ -427,6 +427,14 @@ static inline int rdev_scan(struct cfg80211_registered_device *rdev, | |||
427 | return ret; | 427 | return ret; |
428 | } | 428 | } |
429 | 429 | ||
430 | static inline void rdev_abort_scan(struct cfg80211_registered_device *rdev, | ||
431 | struct wireless_dev *wdev) | ||
432 | { | ||
433 | trace_rdev_abort_scan(&rdev->wiphy, wdev); | ||
434 | rdev->ops->abort_scan(&rdev->wiphy, wdev); | ||
435 | trace_rdev_return_void(&rdev->wiphy); | ||
436 | } | ||
437 | |||
430 | static inline int rdev_auth(struct cfg80211_registered_device *rdev, | 438 | static inline int rdev_auth(struct cfg80211_registered_device *rdev, |
431 | struct net_device *dev, | 439 | struct net_device *dev, |
432 | struct cfg80211_auth_request *req) | 440 | struct cfg80211_auth_request *req) |
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 5b9139e53199..09b242b09bed 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -2917,6 +2917,10 @@ TRACE_EVENT(rdev_set_coalesce, | |||
2917 | WIPHY_PR_ARG, __entry->n_rules) | 2917 | WIPHY_PR_ARG, __entry->n_rules) |
2918 | ); | 2918 | ); |
2919 | 2919 | ||
2920 | DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan, | ||
2921 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev), | ||
2922 | TP_ARGS(wiphy, wdev) | ||
2923 | ); | ||
2920 | #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ | 2924 | #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ |
2921 | 2925 | ||
2922 | #undef TRACE_INCLUDE_PATH | 2926 | #undef TRACE_INCLUDE_PATH |