xref: /wlan-dirver/qcacld-3.0/core/hdd/src/wlan_hdd_scan.h (revision 0bec9a925953c0d92cb530c808dd67de56a0923e)
1 /*
2  * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
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"
33 #include "csr_inside_api.h"
34 #include <wlan_cfg80211_scan.h>
35 
36 #define MAX_PENDING_LOG 5
37 
38 /* (30 Mins) */
39 #define MIN_TIME_REQUIRED_FOR_NEXT_BUG_REPORT (30 * 60 * 1000)
40 
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 
46 int hdd_scan_context_init(struct hdd_context *hdd_ctx);
47 void hdd_scan_context_destroy(struct hdd_context *hdd_ctx);
48 
49 int wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
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 
58 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
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  */
71 int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy,
72 				      struct net_device *dev);
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) */
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);
87 #else
88 static inline int wlan_hdd_sched_scan_stop(struct net_device *dev)
89 {
90 	return 0;
91 }
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 
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 
114 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) || \
115 	defined(CFG80211_ABORT_SCAN)
116 void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy,
117 				  struct wireless_dev *wdev);
118 #endif
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);
129 #endif /* end #if !defined(WLAN_HDD_SCAN_H) */
130 
131