Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | e1422fb | 2017-01-12 08:45:01 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /** |
| 23 | * DOC : wlan_hdd_scan.h |
| 24 | * |
| 25 | * WLAN Host Device Driver scan related implementation |
| 26 | * |
| 27 | */ |
| 28 | |
| 29 | #if !defined(WLAN_HDD_SCAN_H) |
| 30 | #define WLAN_HDD_SCAN_H |
| 31 | |
| 32 | #include "wlan_hdd_main.h" |
Nachiket Kukade | c34d4a3 | 2017-07-12 16:20:27 +0530 | [diff] [blame] | 33 | #include "csr_inside_api.h" |
Sandeep Puligilla | d000421 | 2017-02-26 18:34:56 -0800 | [diff] [blame] | 34 | #include <wlan_cfg80211_scan.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 35 | |
| 36 | #define MAX_PENDING_LOG 5 |
| 37 | |
Kapil Gupta | 0ed58dc | 2016-04-22 15:35:26 +0530 | [diff] [blame] | 38 | /* (30 Mins) */ |
| 39 | #define MIN_TIME_REQUIRED_FOR_NEXT_BUG_REPORT (30 * 60 * 1000) |
| 40 | |
Nachiket Kukade | c34d4a3 | 2017-07-12 16:20:27 +0530 | [diff] [blame] | 41 | /* HDD Scan inactivity timeout set to 10 seconds |
| 42 | * more than the CSR CMD Timeout */ |
| 43 | #define HDD_SCAN_INACTIVITY_TIMEOUT \ |
| 44 | (CSR_ACTIVE_SCAN_LIST_CMD_TIMEOUT + (10*1000)) |
| 45 | |
Jeff Johnson | 24d267e | 2017-08-28 11:43:07 -0700 | [diff] [blame] | 46 | int hdd_scan_context_init(struct hdd_context *hdd_ctx); |
| 47 | void hdd_scan_context_destroy(struct hdd_context *hdd_ctx); |
Prashanth Bhatta | 527fd75 | 2016-04-28 12:35:23 -0700 | [diff] [blame] | 48 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | int wlan_hdd_cfg80211_scan(struct wiphy *wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | struct cfg80211_scan_request *request); |
| 51 | |
| 52 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 53 | int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 54 | struct net_device *dev, |
| 55 | struct cfg80211_sched_scan_request |
| 56 | *request); |
| 57 | |
Dustin Brown | dfc5ef6 | 2017-08-16 15:20:11 -0700 | [diff] [blame] | 58 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) |
Dustin Brown | f27bce8 | 2016-11-03 12:52:27 -0700 | [diff] [blame] | 59 | /** |
| 60 | * wlan_hdd_cfg80211_sched_scan_stop() - stop cfg80211 scheduled (PNO) scan |
| 61 | * @wiphy: Pointer to wiphy |
| 62 | * @dev: Pointer network device |
| 63 | * |
| 64 | * Note, this returns success if the driver is recovering or unloading to |
| 65 | * prevent race conditions between PLD initiating an unload and kernel |
| 66 | * initiating a scheduled scan stop via cfg80211. Unload is expected to stop |
| 67 | * any pending scheduled scans in this case. |
| 68 | * |
| 69 | * Return: 0 for success, non zero for failure |
| 70 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 71 | int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 72 | struct net_device *dev); |
Dustin Brown | dfc5ef6 | 2017-08-16 15:20:11 -0700 | [diff] [blame] | 73 | #else |
| 74 | int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 75 | struct net_device *dev, |
| 76 | uint64_t reqid); |
| 77 | |
| 78 | #endif /* KERNEL_VERSION(4, 12, 0) */ |
Dustin Brown | f27bce8 | 2016-11-03 12:52:27 -0700 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * wlan_hdd_sched_scan_stop() - stop scheduled (PNO) scans |
| 82 | * @dev: Pointer network device |
| 83 | * |
| 84 | * Return: 0 for success, non zero for failure |
| 85 | */ |
| 86 | int wlan_hdd_sched_scan_stop(struct net_device *dev); |
Abhishek Singh | b20db96 | 2017-03-03 21:28:46 +0530 | [diff] [blame] | 87 | #else |
| 88 | static inline int wlan_hdd_sched_scan_stop(struct net_device *dev) |
| 89 | { |
| 90 | return 0; |
| 91 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 92 | #endif /* End of FEATURE_WLAN_SCAN_PNO */ |
| 93 | |
| 94 | int wlan_hdd_cfg80211_vendor_scan(struct wiphy *wiphy, |
| 95 | struct wireless_dev *wdev, const void *data, |
| 96 | int data_len); |
| 97 | |
yeshwanth sriram guntuka | 310b3ac | 2016-11-15 23:25:26 +0530 | [diff] [blame] | 98 | /** |
| 99 | * wlan_hdd_vendor_abort_scan() - API to process vendor command for |
| 100 | * abort scan |
| 101 | * @wiphy: Pointer to wiphy |
| 102 | * @wdev: Pointer to net device |
| 103 | * @data : Pointer to the data |
| 104 | * @data_len : length of the data |
| 105 | * |
| 106 | * This is called from supplicant to abort scan |
| 107 | * |
| 108 | * Return: zero for success and non zero for failure. |
| 109 | */ |
| 110 | int wlan_hdd_vendor_abort_scan( |
| 111 | struct wiphy *wiphy, struct wireless_dev *wdev, |
| 112 | const void *data, int data_len); |
| 113 | |
Vidyullatha, Kanchanapally | 528789e | 2016-05-11 20:38:37 +0530 | [diff] [blame] | 114 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) || \ |
Srinivas Girigowda | 682a16b | 2017-03-24 23:19:34 -0700 | [diff] [blame] | 115 | defined(CFG80211_ABORT_SCAN) |
Vidyullatha, Kanchanapally | 528789e | 2016-05-11 20:38:37 +0530 | [diff] [blame] | 116 | void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy, |
| 117 | struct wireless_dev *wdev); |
| 118 | #endif |
hqu | eaa33ee | 2017-05-04 17:56:35 +0800 | [diff] [blame] | 119 | |
| 120 | /** |
| 121 | * wlan_hdd_cfg80211_scan_block_cb() - scan block work handler |
| 122 | * @work: Pointer to work |
| 123 | * |
| 124 | * This function is used to do scan block work handler |
| 125 | * |
| 126 | * Return: none |
| 127 | */ |
| 128 | void wlan_hdd_cfg80211_scan_block_cb(struct work_struct *work); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 129 | #endif /* end #if !defined(WLAN_HDD_SCAN_H) */ |
| 130 | |