scan.c (3a3ecf1d5971b1f272124b445ef2d6b6ad3074fd) | scan.c (b34939b9836950d261610132853311054b507247) |
---|---|
1/* 2 * cfg80211 scan result handling 3 * 4 * Copyright 2008 Johannes Berg <johannes@sipsolutions.net> 5 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 * Copyright 2016 Intel Deutschland GmbH 7 */ 8#include <linux/kernel.h> --- 314 unchanged lines hidden (view full) --- 323 struct cfg80211_sched_scan_request *pos; 324 325 ASSERT_RTNL(); 326 327 list_for_each_entry(pos, &rdev->sched_scan_req_list, list) { 328 if (pos->reqid == reqid) 329 return pos; 330 } | 1/* 2 * cfg80211 scan result handling 3 * 4 * Copyright 2008 Johannes Berg <johannes@sipsolutions.net> 5 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 * Copyright 2016 Intel Deutschland GmbH 7 */ 8#include <linux/kernel.h> --- 314 unchanged lines hidden (view full) --- 323 struct cfg80211_sched_scan_request *pos; 324 325 ASSERT_RTNL(); 326 327 list_for_each_entry(pos, &rdev->sched_scan_req_list, list) { 328 if (pos->reqid == reqid) 329 return pos; 330 } |
331 return ERR_PTR(-ENOENT); | 331 return NULL; |
332} 333 334/* 335 * Determines if a scheduled scan request can be handled. When a legacy 336 * scheduled scan is running no other scheduled scan is allowed regardless 337 * whether the request is for legacy or multi-support scan. When a multi-support 338 * scheduled scan is running a request for legacy scan is not allowed. In this 339 * case a request for multi-support scan can be handled if resources are --- 19 unchanged lines hidden (view full) --- 359 360 /* resource limit reached */ 361 if (i == rdev->wiphy.max_sched_scan_reqs) 362 return -ENOSPC; 363 } 364 return 0; 365} 366 | 332} 333 334/* 335 * Determines if a scheduled scan request can be handled. When a legacy 336 * scheduled scan is running no other scheduled scan is allowed regardless 337 * whether the request is for legacy or multi-support scan. When a multi-support 338 * scheduled scan is running a request for legacy scan is not allowed. In this 339 * case a request for multi-support scan can be handled if resources are --- 19 unchanged lines hidden (view full) --- 359 360 /* resource limit reached */ 361 if (i == rdev->wiphy.max_sched_scan_reqs) 362 return -ENOSPC; 363 } 364 return 0; 365} 366 |
367void __cfg80211_sched_scan_results(struct work_struct *wk) | 367void cfg80211_sched_scan_results_wk(struct work_struct *work) |
368{ 369 struct cfg80211_registered_device *rdev; | 368{ 369 struct cfg80211_registered_device *rdev; |
370 struct cfg80211_sched_scan_request *request; | 370 struct cfg80211_sched_scan_request *req, *tmp; |
371 | 371 |
372 rdev = container_of(wk, struct cfg80211_registered_device, 373 sched_scan_results_wk); | 372 rdev = container_of(work, struct cfg80211_registered_device, 373 sched_scan_res_wk); |
374 375 rtnl_lock(); | 374 375 rtnl_lock(); |
376 377 request = cfg80211_find_sched_scan_req(rdev, 0); 378 379 /* we don't have sched_scan_req anymore if the scan is stopping */ 380 if (!IS_ERR(request)) { 381 if (request->flags & NL80211_SCAN_FLAG_FLUSH) { 382 /* flush entries from previous scans */ 383 spin_lock_bh(&rdev->bss_lock); 384 __cfg80211_bss_expire(rdev, request->scan_start); 385 spin_unlock_bh(&rdev->bss_lock); 386 request->scan_start = jiffies; | 376 list_for_each_entry_safe(req, tmp, &rdev->sched_scan_req_list, list) { 377 if (req->report_results) { 378 req->report_results = false; 379 if (req->flags & NL80211_SCAN_FLAG_FLUSH) { 380 /* flush entries from previous scans */ 381 spin_lock_bh(&rdev->bss_lock); 382 __cfg80211_bss_expire(rdev, req->scan_start); 383 spin_unlock_bh(&rdev->bss_lock); 384 req->scan_start = jiffies; 385 } 386 nl80211_send_sched_scan(req, 387 NL80211_CMD_SCHED_SCAN_RESULTS); |
387 } | 388 } |
388 nl80211_send_sched_scan(request, NL80211_CMD_SCHED_SCAN_RESULTS); | |
389 } | 389 } |
390 | |
391 rtnl_unlock(); 392} 393 | 390 rtnl_unlock(); 391} 392 |
394void cfg80211_sched_scan_results(struct wiphy *wiphy) | 393void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid) |
395{ 396 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 397 struct cfg80211_sched_scan_request *request; 398 | 394{ 395 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 396 struct cfg80211_sched_scan_request *request; 397 |
399 trace_cfg80211_sched_scan_results(wiphy); | 398 trace_cfg80211_sched_scan_results(wiphy, reqid); |
400 /* ignore if we're not scanning */ 401 402 rtnl_lock(); | 399 /* ignore if we're not scanning */ 400 401 rtnl_lock(); |
403 request = cfg80211_find_sched_scan_req(rdev, 0); | 402 request = cfg80211_find_sched_scan_req(rdev, reqid); 403 if (request) { 404 request->report_results = true; 405 queue_work(cfg80211_wq, &rdev->sched_scan_res_wk); 406 } |
404 rtnl_unlock(); | 407 rtnl_unlock(); |
405 406 if (!IS_ERR(request)) 407 queue_work(cfg80211_wq, 408 &wiphy_to_rdev(wiphy)->sched_scan_results_wk); | |
409} 410EXPORT_SYMBOL(cfg80211_sched_scan_results); 411 | 408} 409EXPORT_SYMBOL(cfg80211_sched_scan_results); 410 |
412void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy) | 411void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid) |
413{ 414 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 415 416 ASSERT_RTNL(); 417 | 412{ 413 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 414 415 ASSERT_RTNL(); 416 |
418 trace_cfg80211_sched_scan_stopped(wiphy); | 417 trace_cfg80211_sched_scan_stopped(wiphy, reqid); |
419 | 418 |
420 __cfg80211_stop_sched_scan(rdev, 0, true); | 419 __cfg80211_stop_sched_scan(rdev, reqid, true); |
421} 422EXPORT_SYMBOL(cfg80211_sched_scan_stopped_rtnl); 423 | 420} 421EXPORT_SYMBOL(cfg80211_sched_scan_stopped_rtnl); 422 |
424void cfg80211_sched_scan_stopped(struct wiphy *wiphy) | 423void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid) |
425{ 426 rtnl_lock(); | 424{ 425 rtnl_lock(); |
427 cfg80211_sched_scan_stopped_rtnl(wiphy); | 426 cfg80211_sched_scan_stopped_rtnl(wiphy, reqid); |
428 rtnl_unlock(); 429} 430EXPORT_SYMBOL(cfg80211_sched_scan_stopped); 431 432int cfg80211_stop_sched_scan_req(struct cfg80211_registered_device *rdev, 433 struct cfg80211_sched_scan_request *req, 434 bool driver_initiated) 435{ --- 15 unchanged lines hidden (view full) --- 451int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, 452 u64 reqid, bool driver_initiated) 453{ 454 struct cfg80211_sched_scan_request *sched_scan_req; 455 456 ASSERT_RTNL(); 457 458 sched_scan_req = cfg80211_find_sched_scan_req(rdev, reqid); | 427 rtnl_unlock(); 428} 429EXPORT_SYMBOL(cfg80211_sched_scan_stopped); 430 431int cfg80211_stop_sched_scan_req(struct cfg80211_registered_device *rdev, 432 struct cfg80211_sched_scan_request *req, 433 bool driver_initiated) 434{ --- 15 unchanged lines hidden (view full) --- 450int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, 451 u64 reqid, bool driver_initiated) 452{ 453 struct cfg80211_sched_scan_request *sched_scan_req; 454 455 ASSERT_RTNL(); 456 457 sched_scan_req = cfg80211_find_sched_scan_req(rdev, reqid); |
459 if (IS_ERR(sched_scan_req)) 460 return PTR_ERR(sched_scan_req); | 458 if (!sched_scan_req) 459 return -ENOENT; |
461 462 return cfg80211_stop_sched_scan_req(rdev, sched_scan_req, 463 driver_initiated); 464} 465 466void cfg80211_bss_age(struct cfg80211_registered_device *rdev, 467 unsigned long age_secs) 468{ --- 1366 unchanged lines hidden --- | 460 461 return cfg80211_stop_sched_scan_req(rdev, sched_scan_req, 462 driver_initiated); 463} 464 465void cfg80211_bss_age(struct cfg80211_registered_device *rdev, 466 unsigned long age_secs) 467{ --- 1366 unchanged lines hidden --- |