mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
cfg80211: add request id to cfg80211_sched_scan_*() api
Have proper request id filled in the SCHED_SCAN_RESULTS and SCHED_SCAN_STOPPED notifications toward user-space by having the driver provide it through the api. Reviewed-by: Hante Meuleman <[email protected]> Reviewed-by: Pieter-Paul Giesberts <[email protected]> Reviewed-by: Franky Lin <[email protected]> Signed-off-by: Arend van Spriel <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
This commit is contained in:
parent
e38a017bf0
commit
b34939b983
16 changed files with 77 additions and 59 deletions
|
|
@ -456,7 +456,6 @@ use_default_name:
|
|||
INIT_LIST_HEAD(&rdev->bss_list);
|
||||
INIT_LIST_HEAD(&rdev->sched_scan_req_list);
|
||||
INIT_WORK(&rdev->scan_done_wk, __cfg80211_scan_done);
|
||||
INIT_WORK(&rdev->sched_scan_results_wk, __cfg80211_sched_scan_results);
|
||||
INIT_LIST_HEAD(&rdev->mlme_unreg);
|
||||
spin_lock_init(&rdev->mlme_unreg_lock);
|
||||
INIT_WORK(&rdev->mlme_unreg_wk, cfg80211_mlme_unreg_wk);
|
||||
|
|
@ -473,6 +472,7 @@ use_default_name:
|
|||
|
||||
INIT_WORK(&rdev->destroy_work, cfg80211_destroy_iface_wk);
|
||||
INIT_WORK(&rdev->sched_scan_stop_wk, cfg80211_sched_scan_stop_wk);
|
||||
INIT_WORK(&rdev->sched_scan_res_wk, cfg80211_sched_scan_results_wk);
|
||||
INIT_WORK(&rdev->propagate_radar_detect_wk,
|
||||
cfg80211_propagate_radar_detect_wk);
|
||||
INIT_WORK(&rdev->propagate_cac_done_wk, cfg80211_propagate_cac_done_wk);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ struct cfg80211_registered_device {
|
|||
struct list_head sched_scan_req_list;
|
||||
unsigned long suspend_at;
|
||||
struct work_struct scan_done_wk;
|
||||
struct work_struct sched_scan_results_wk;
|
||||
|
||||
struct genl_info *cur_cmd_info;
|
||||
|
||||
|
|
@ -93,6 +92,7 @@ struct cfg80211_registered_device {
|
|||
|
||||
struct work_struct destroy_work;
|
||||
struct work_struct sched_scan_stop_wk;
|
||||
struct work_struct sched_scan_res_wk;
|
||||
|
||||
struct cfg80211_chan_def radar_chandef;
|
||||
struct work_struct propagate_radar_detect_wk;
|
||||
|
|
@ -412,7 +412,7 @@ void cfg80211_add_sched_scan_req(struct cfg80211_registered_device *rdev,
|
|||
struct cfg80211_sched_scan_request *req);
|
||||
int cfg80211_sched_scan_req_possible(struct cfg80211_registered_device *rdev,
|
||||
bool want_multi);
|
||||
void __cfg80211_sched_scan_results(struct work_struct *wk);
|
||||
void cfg80211_sched_scan_results_wk(struct work_struct *work);
|
||||
int cfg80211_stop_sched_scan_req(struct cfg80211_registered_device *rdev,
|
||||
struct cfg80211_sched_scan_request *req,
|
||||
bool driver_initiated);
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ cfg80211_find_sched_scan_req(struct cfg80211_registered_device *rdev, u64 reqid)
|
|||
if (pos->reqid == reqid)
|
||||
return pos;
|
||||
}
|
||||
return ERR_PTR(-ENOENT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -364,67 +364,66 @@ int cfg80211_sched_scan_req_possible(struct cfg80211_registered_device *rdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void __cfg80211_sched_scan_results(struct work_struct *wk)
|
||||
void cfg80211_sched_scan_results_wk(struct work_struct *work)
|
||||
{
|
||||
struct cfg80211_registered_device *rdev;
|
||||
struct cfg80211_sched_scan_request *request;
|
||||
struct cfg80211_sched_scan_request *req, *tmp;
|
||||
|
||||
rdev = container_of(wk, struct cfg80211_registered_device,
|
||||
sched_scan_results_wk);
|
||||
rdev = container_of(work, struct cfg80211_registered_device,
|
||||
sched_scan_res_wk);
|
||||
|
||||
rtnl_lock();
|
||||
|
||||
request = cfg80211_find_sched_scan_req(rdev, 0);
|
||||
|
||||
/* we don't have sched_scan_req anymore if the scan is stopping */
|
||||
if (!IS_ERR(request)) {
|
||||
if (request->flags & NL80211_SCAN_FLAG_FLUSH) {
|
||||
/* flush entries from previous scans */
|
||||
spin_lock_bh(&rdev->bss_lock);
|
||||
__cfg80211_bss_expire(rdev, request->scan_start);
|
||||
spin_unlock_bh(&rdev->bss_lock);
|
||||
request->scan_start = jiffies;
|
||||
list_for_each_entry_safe(req, tmp, &rdev->sched_scan_req_list, list) {
|
||||
if (req->report_results) {
|
||||
req->report_results = false;
|
||||
if (req->flags & NL80211_SCAN_FLAG_FLUSH) {
|
||||
/* flush entries from previous scans */
|
||||
spin_lock_bh(&rdev->bss_lock);
|
||||
__cfg80211_bss_expire(rdev, req->scan_start);
|
||||
spin_unlock_bh(&rdev->bss_lock);
|
||||
req->scan_start = jiffies;
|
||||
}
|
||||
nl80211_send_sched_scan(req,
|
||||
NL80211_CMD_SCHED_SCAN_RESULTS);
|
||||
}
|
||||
nl80211_send_sched_scan(request, NL80211_CMD_SCHED_SCAN_RESULTS);
|
||||
}
|
||||
|
||||
rtnl_unlock();
|
||||
}
|
||||
|
||||
void cfg80211_sched_scan_results(struct wiphy *wiphy)
|
||||
void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid)
|
||||
{
|
||||
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
|
||||
struct cfg80211_sched_scan_request *request;
|
||||
|
||||
trace_cfg80211_sched_scan_results(wiphy);
|
||||
trace_cfg80211_sched_scan_results(wiphy, reqid);
|
||||
/* ignore if we're not scanning */
|
||||
|
||||
rtnl_lock();
|
||||
request = cfg80211_find_sched_scan_req(rdev, 0);
|
||||
request = cfg80211_find_sched_scan_req(rdev, reqid);
|
||||
if (request) {
|
||||
request->report_results = true;
|
||||
queue_work(cfg80211_wq, &rdev->sched_scan_res_wk);
|
||||
}
|
||||
rtnl_unlock();
|
||||
|
||||
if (!IS_ERR(request))
|
||||
queue_work(cfg80211_wq,
|
||||
&wiphy_to_rdev(wiphy)->sched_scan_results_wk);
|
||||
}
|
||||
EXPORT_SYMBOL(cfg80211_sched_scan_results);
|
||||
|
||||
void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy)
|
||||
void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid)
|
||||
{
|
||||
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
||||
trace_cfg80211_sched_scan_stopped(wiphy);
|
||||
trace_cfg80211_sched_scan_stopped(wiphy, reqid);
|
||||
|
||||
__cfg80211_stop_sched_scan(rdev, 0, true);
|
||||
__cfg80211_stop_sched_scan(rdev, reqid, true);
|
||||
}
|
||||
EXPORT_SYMBOL(cfg80211_sched_scan_stopped_rtnl);
|
||||
|
||||
void cfg80211_sched_scan_stopped(struct wiphy *wiphy)
|
||||
void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid)
|
||||
{
|
||||
rtnl_lock();
|
||||
cfg80211_sched_scan_stopped_rtnl(wiphy);
|
||||
cfg80211_sched_scan_stopped_rtnl(wiphy, reqid);
|
||||
rtnl_unlock();
|
||||
}
|
||||
EXPORT_SYMBOL(cfg80211_sched_scan_stopped);
|
||||
|
|
@ -456,8 +455,8 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
|
|||
ASSERT_RTNL();
|
||||
|
||||
sched_scan_req = cfg80211_find_sched_scan_req(rdev, reqid);
|
||||
if (IS_ERR(sched_scan_req))
|
||||
return PTR_ERR(sched_scan_req);
|
||||
if (!sched_scan_req)
|
||||
return -ENOENT;
|
||||
|
||||
return cfg80211_stop_sched_scan_req(rdev, sched_scan_req,
|
||||
driver_initiated);
|
||||
|
|
|
|||
|
|
@ -2820,14 +2820,28 @@ TRACE_EVENT(cfg80211_scan_done,
|
|||
MAC_PR_ARG(tsf_bssid))
|
||||
);
|
||||
|
||||
DEFINE_EVENT(wiphy_only_evt, cfg80211_sched_scan_results,
|
||||
TP_PROTO(struct wiphy *wiphy),
|
||||
TP_ARGS(wiphy)
|
||||
DECLARE_EVENT_CLASS(wiphy_id_evt,
|
||||
TP_PROTO(struct wiphy *wiphy, u64 id),
|
||||
TP_ARGS(wiphy, id),
|
||||
TP_STRUCT__entry(
|
||||
WIPHY_ENTRY
|
||||
__field(u64, id)
|
||||
),
|
||||
TP_fast_assign(
|
||||
WIPHY_ASSIGN;
|
||||
__entry->id = id;
|
||||
),
|
||||
TP_printk(WIPHY_PR_FMT ", id: %llu", WIPHY_PR_ARG, __entry->id)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(wiphy_only_evt, cfg80211_sched_scan_stopped,
|
||||
TP_PROTO(struct wiphy *wiphy),
|
||||
TP_ARGS(wiphy)
|
||||
DEFINE_EVENT(wiphy_id_evt, cfg80211_sched_scan_stopped,
|
||||
TP_PROTO(struct wiphy *wiphy, u64 id),
|
||||
TP_ARGS(wiphy, id)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(wiphy_id_evt, cfg80211_sched_scan_results,
|
||||
TP_PROTO(struct wiphy *wiphy, u64 id),
|
||||
TP_ARGS(wiphy, id)
|
||||
);
|
||||
|
||||
TRACE_EVENT(cfg80211_get_bss,
|
||||
|
|
|
|||
Loading…
Reference in a new issue