xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pno.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Header file of Broadcom Dongle Host Driver (DHD)
3  * Prefered Network Offload code and Wi-Fi Location Service(WLS) code.
4  *
5  * Copyright (C) 2020, Broadcom.
6  *
7  *      Unless you and Broadcom execute a separate written software license
8  * agreement governing use of this software, this software is licensed to you
9  * under the terms of the GNU General Public License version 2 (the "GPL"),
10  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
11  * following added to such license:
12  *
13  *      As a special exception, the copyright holders of this software give you
14  * permission to link this software with independent modules, and to copy and
15  * distribute the resulting executable under terms of your choice, provided that
16  * you also meet, for each linked independent module, the terms and conditions of
17  * the license of that module.  An independent module is a module which is not
18  * derived from this software.  The special exception does not apply to any
19  * modifications of the software.
20  *
21  *
22  * <<Broadcom-WL-IPTag/Dual:>>
23  */
24 
25 #ifndef __DHD_PNO_H__
26 #define __DHD_PNO_H__
27 
28 #if defined(OEM_ANDROID) && defined(PNO_SUPPORT)
29 #define PNO_TLV_PREFIX			'S'
30 #define PNO_TLV_VERSION			'1'
31 #define PNO_TLV_SUBTYPE_LEGACY_PNO '2'
32 #define PNO_TLV_RESERVED		'0'
33 
34 #define PNO_BATCHING_SET "SET"
35 #define PNO_BATCHING_GET "GET"
36 #define PNO_BATCHING_STOP "STOP"
37 
38 #define PNO_PARAMS_DELIMETER " "
39 #define PNO_PARAM_CHANNEL_DELIMETER ","
40 #define PNO_PARAM_VALUE_DELLIMETER '='
41 #define PNO_PARAM_SCANFREQ "SCANFREQ"
42 #define PNO_PARAM_BESTN	"BESTN"
43 #define PNO_PARAM_MSCAN "MSCAN"
44 #define PNO_PARAM_CHANNEL "CHANNEL"
45 #define PNO_PARAM_RTT "RTT"
46 
47 #define PNO_TLV_TYPE_SSID_IE		'S'
48 #define PNO_TLV_TYPE_TIME		'T'
49 #define PNO_TLV_FREQ_REPEAT		'R'
50 #define PNO_TLV_FREQ_EXPO_MAX		'M'
51 
52 #define MAXNUM_SSID_PER_ADD	16
53 #define MAXNUM_PNO_PARAMS 2
54 #define PNO_TLV_COMMON_LENGTH	1
55 #define DEFAULT_BATCH_MSCAN 16
56 
57 #define RESULTS_END_MARKER "----\n"
58 #define SCAN_END_MARKER "####\n"
59 #define AP_END_MARKER "====\n"
60 #define PNO_RSSI_MARGIN_DBM          30
61 
62 #define CSCAN_COMMAND			"CSCAN "
63 #define CSCAN_TLV_PREFIX		'S'
64 #define CSCAN_TLV_VERSION		1
65 #define CSCAN_TLV_SUBVERSION		0
66 #define CSCAN_TLV_TYPE_SSID_IE		'S'
67 #define CSCAN_TLV_TYPE_CHANNEL_IE	'C'
68 #define CSCAN_TLV_TYPE_NPROBE_IE	'N'
69 #define CSCAN_TLV_TYPE_ACTIVE_IE	'A'
70 #define CSCAN_TLV_TYPE_PASSIVE_IE	'P'
71 #define CSCAN_TLV_TYPE_HOME_IE		'H'
72 #define CSCAN_TLV_TYPE_STYPE_IE		'T'
73 
74 #define WL_SCAN_PARAMS_SSID_MAX         10
75 #define GET_SSID                        "SSID="
76 #define GET_CHANNEL                     "CH="
77 #define GET_NPROBE                      "NPROBE="
78 #define GET_ACTIVE_ASSOC_DWELL          "ACTIVE="
79 #define GET_PASSIVE_ASSOC_DWELL         "PASSIVE="
80 #define GET_HOME_DWELL                  "HOME="
81 #define GET_SCAN_TYPE                   "TYPE="
82 
83 #if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
84 #define GSCAN_MAX_CH_BUCKETS             8
85 #define GSCAN_MAX_CHANNELS_IN_BUCKET     32
86 #define GSCAN_MAX_AP_CACHE_PER_SCAN      32
87 #define GSCAN_MAX_AP_CACHE               320
88 #define GSCAN_BG_BAND_MASK             (1 << 0)
89 #define GSCAN_A_BAND_MASK              (1 << 1)
90 #define GSCAN_DFS_MASK                 (1 << 2)
91 #define GSCAN_ABG_BAND_MASK            (GSCAN_A_BAND_MASK | GSCAN_BG_BAND_MASK)
92 #define GSCAN_BAND_MASK                (GSCAN_ABG_BAND_MASK | GSCAN_DFS_MASK)
93 
94 #define GSCAN_FLUSH_HOTLIST_CFG      (1 << 0)
95 #define GSCAN_FLUSH_SIGNIFICANT_CFG  (1 << 1)
96 #define GSCAN_FLUSH_SCAN_CFG         (1 << 2)
97 #define GSCAN_FLUSH_EPNO_CFG         (1 << 3)
98 #define GSCAN_FLUSH_ALL_CFG     (GSCAN_FLUSH_SCAN_CFG | \
99 								GSCAN_FLUSH_SIGNIFICANT_CFG | \
100 								GSCAN_FLUSH_HOTLIST_CFG  | \
101 								GSCAN_FLUSH_EPNO_CFG)
102 #define DHD_EPNO_HIDDEN_SSID          (1 << 0)
103 #define DHD_EPNO_A_BAND_TRIG          (1 << 1)
104 #define DHD_EPNO_BG_BAND_TRIG         (1 << 2)
105 #define DHD_EPNO_STRICT_MATCH         (1 << 3)
106 #define DHD_EPNO_SAME_NETWORK         (1 << 4)
107 #define DHD_PNO_USE_SSID              (DHD_EPNO_HIDDEN_SSID | DHD_EPNO_STRICT_MATCH)
108 
109 /* Do not change GSCAN_BATCH_RETRIEVAL_COMPLETE */
110 #define GSCAN_BATCH_RETRIEVAL_COMPLETE      0
111 #define GSCAN_BATCH_RETRIEVAL_IN_PROGRESS   1
112 #define GSCAN_BATCH_NO_THR_SET              101
113 #define GSCAN_LOST_AP_WINDOW_DEFAULT        4
114 #define GSCAN_MIN_BSSID_TIMEOUT             90
115 #define GSCAN_BATCH_GET_MAX_WAIT            500
116 #define CHANNEL_BUCKET_EMPTY_INDEX                      0xFFFF
117 #define GSCAN_RETRY_THRESHOLD              3
118 
119 #define MAX_EPNO_SSID_NUM                   64
120 #endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
121 
122 enum scan_status {
123 	/* SCAN ABORT by other scan */
124 	PNO_STATUS_ABORT,
125 	/* RTT is presence or not */
126 	PNO_STATUS_RTT_PRESENCE,
127 	/* Disable PNO by Driver */
128 	PNO_STATUS_DISABLE,
129 	/* NORMAL BATCHING GET */
130 	PNO_STATUS_NORMAL,
131 	/* WLC_E_PFN_BEST_BATCHING */
132 	PNO_STATUS_EVENT,
133 	PNO_STATUS_MAX
134 };
135 #define PNO_STATUS_ABORT_MASK 0x0001
136 #define PNO_STATUS_RTT_MASK 0x0002
137 #define PNO_STATUS_DISABLE_MASK 0x0004
138 #define PNO_STATUS_OOM_MASK 0x0010
139 
140 enum index_mode {
141 	INDEX_OF_LEGACY_PARAMS,
142 	INDEX_OF_BATCH_PARAMS,
143 	INDEX_OF_HOTLIST_PARAMS,
144 	/* GSCAN includes hotlist scan and they do not run
145 	 * independent of each other
146 	 */
147 	INDEX_OF_GSCAN_PARAMS = INDEX_OF_HOTLIST_PARAMS,
148 	INDEX_MODE_MAX
149 };
150 enum dhd_pno_status {
151 	DHD_PNO_DISABLED,
152 	DHD_PNO_ENABLED,
153 	DHD_PNO_SUSPEND
154 };
155 typedef struct cmd_tlv {
156 	char prefix;
157 	char version;
158 	char subtype;
159 	char reserved;
160 } cmd_tlv_t;
161 #if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
162 typedef enum {
163 	HOTLIST_LOST,
164 	HOTLIST_FOUND
165 } hotlist_type_t;
166 
167 typedef enum dhd_pno_gscan_cmd_cfg {
168 	DHD_PNO_BATCH_SCAN_CFG_ID = 0,
169 	DHD_PNO_GEOFENCE_SCAN_CFG_ID,
170 	DHD_PNO_SIGNIFICANT_SCAN_CFG_ID,
171 	DHD_PNO_SCAN_CFG_ID,
172 	DHD_PNO_GET_CAPABILITIES,
173 	DHD_PNO_GET_BATCH_RESULTS,
174 	DHD_PNO_GET_CHANNEL_LIST,
175 	DHD_PNO_GET_NEW_EPNO_SSID_ELEM,
176 	DHD_PNO_EPNO_CFG_ID,
177 	DHD_PNO_GET_AUTOJOIN_CAPABILITIES,
178 	DHD_PNO_EPNO_PARAMS_ID
179 } dhd_pno_gscan_cmd_cfg_t;
180 
181 typedef enum dhd_pno_mode {
182 	/* Wi-Fi Legacy PNO Mode */
183 	DHD_PNO_NONE_MODE   = 0,
184 	DHD_PNO_LEGACY_MODE = (1 << (0)),
185 	/* Wi-Fi Android BATCH SCAN Mode */
186 	DHD_PNO_BATCH_MODE = (1 << (1)),
187 	/* Wi-Fi Android Hotlist SCAN Mode */
188 	DHD_PNO_HOTLIST_MODE = (1 << (2)),
189 	/* Wi-Fi Google Android SCAN Mode */
190 	DHD_PNO_GSCAN_MODE = (1 << (3))
191 } dhd_pno_mode_t;
192 #else
193 typedef enum dhd_pno_mode {
194 	/* Wi-Fi Legacy PNO Mode */
195 	DHD_PNO_NONE_MODE   = 0,
196 	DHD_PNO_LEGACY_MODE = (1 << (0)),
197 	/* Wi-Fi Android BATCH SCAN Mode */
198 	DHD_PNO_BATCH_MODE = (1 << (1)),
199 	/* Wi-Fi Android Hotlist SCAN Mode */
200 	DHD_PNO_HOTLIST_MODE = (1 << (2))
201 } dhd_pno_mode_t;
202 #endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
203 
204 typedef struct dhd_pno_ssid {
205 	bool		hidden;
206 	int8		rssi_thresh;
207 	uint8		dummy;
208 	uint16		SSID_len;
209 	uint32		flags;
210 	int32		wpa_auth;
211 	uchar		SSID[DOT11_MAX_SSID_LEN];
212 	struct list_head list;
213 } dhd_pno_ssid_t;
214 
215 struct dhd_pno_bssid {
216 	struct ether_addr	macaddr;
217 	/* Bit4: suppress_lost, Bit3: suppress_found */
218 	uint16			flags;
219 	struct list_head list;
220 };
221 
222 typedef struct dhd_pno_bestnet_entry {
223 	struct ether_addr BSSID;
224 	uint8	SSID_len;
225 	uint8	SSID[DOT11_MAX_SSID_LEN];
226 	int8	RSSI;
227 	uint8	channel;
228 	uint32	timestamp;
229 	uint16	rtt0; /* distance_cm based on RTT */
230 	uint16	rtt1; /* distance_cm based on sample standard deviation */
231 	unsigned long recorded_time;
232 	struct list_head list;
233 } dhd_pno_bestnet_entry_t;
234 #define BESTNET_ENTRY_SIZE (sizeof(dhd_pno_bestnet_entry_t))
235 
236 typedef struct dhd_pno_bestnet_header {
237 	struct dhd_pno_bestnet_header *next;
238 	uint8 reason;
239 	uint32 tot_cnt;
240 	uint32 tot_size;
241 	struct list_head entry_list;
242 } dhd_pno_best_header_t;
243 #define BEST_HEADER_SIZE (sizeof(dhd_pno_best_header_t))
244 
245 typedef struct dhd_pno_scan_results {
246 	dhd_pno_best_header_t *bestnetheader;
247 	uint8 cnt_header;
248 	struct list_head list;
249 } dhd_pno_scan_results_t;
250 #define SCAN_RESULTS_SIZE (sizeof(dhd_pno_scan_results_t))
251 
252 struct dhd_pno_get_batch_info {
253 	/* info related to get batch */
254 	char *buf;
255 	bool batch_started;
256 	uint32 tot_scan_cnt;
257 	uint32 expired_tot_scan_cnt;
258 	uint32 top_node_cnt;
259 	uint32 bufsize;
260 	uint32 bytes_written;
261 	int reason;
262 	struct list_head scan_results_list;
263 	struct list_head expired_scan_results_list;
264 };
265 struct dhd_pno_legacy_params {
266 	uint16 scan_fr;
267 	uint16 chan_list[WL_NUMCHANNELS];
268 	uint16 nchan;
269 	int pno_repeat;
270 	int pno_freq_expo_max;
271 	int nssid;
272 	struct list_head ssid_list;
273 };
274 struct dhd_pno_batch_params {
275 	int32 scan_fr;
276 	uint8 bestn;
277 	uint8 mscan;
278 	uint8 band;
279 	uint16 chan_list[WL_NUMCHANNELS];
280 	uint16 nchan;
281 	uint16 rtt;
282 	struct dhd_pno_get_batch_info get_batch;
283 };
284 struct dhd_pno_hotlist_params {
285 	uint8 band;
286 	int32 scan_fr;
287 	uint16 chan_list[WL_NUMCHANNELS];
288 	uint16 nchan;
289 	uint16 nbssid;
290 	struct list_head bssid_list;
291 };
292 
293 #define DHD_PNO_CHSPEC_SUPPORT_VER	14
294 
295 #if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
296 #define DHD_PNO_REPORT_NO_BATCH      (1 << 2)
297 
298 typedef struct dhd_pno_gscan_channel_bucket {
299 	uint16 bucket_freq_multiple;
300 	/* band = 1 All bg band channels,
301 	 * band = 2 All a band channels,
302 	 * band = 0 chan_list channels
303 	 */
304 	uint16 band;
305 	uint8 report_flag;
306 	uint8 num_channels;
307 	uint16 repeat;
308 	uint16 bucket_max_multiple;
309 	uint16 chan_list[GSCAN_MAX_CHANNELS_IN_BUCKET];
310 } dhd_pno_gscan_channel_bucket_t;
311 
312 #define DHD_PNO_AUTH_CODE_OPEN  1 /*  Open   */
313 #define DHD_PNO_AUTH_CODE_PSK   2 /* WPA_PSK or WPA2PSK */
314 #define DHD_PNO_AUTH_CODE_EAPOL 4 /* any EAPOL    */
315 
316 #define DHD_EPNO_DEFAULT_INDEX     0xFFFFFFFF
317 
318 typedef struct dhd_epno_params {
319 	uint8 ssid[DOT11_MAX_SSID_LEN];
320 	uint8 ssid_len;
321 	int8 rssi_thresh;
322 	uint8 flags;
323 	uint8 auth;
324 	/* index required only for visble ssid */
325 	uint32 index;
326 	struct list_head list;
327 } dhd_epno_params_t;
328 
329 typedef struct dhd_epno_results {
330 	uint8 ssid[DOT11_MAX_SSID_LEN];
331 	uint8 ssid_len;
332 	int8 rssi;
333 	uint16 channel;
334 	uint16 flags;
335 	struct ether_addr bssid;
336 } dhd_epno_results_t;
337 
338 typedef struct dhd_pno_swc_evt_param {
339 	uint16 results_rxed_so_far;
340 	wl_pfn_significant_net_t *change_array;
341 } dhd_pno_swc_evt_param_t;
342 
343 typedef struct wifi_gscan_result {
344 	uint64 ts;			/* Time of discovery           */
345 	char ssid[DOT11_MAX_SSID_LEN+1]; /* null terminated		*/
346 	struct ether_addr macaddr;	/* BSSID                      */
347 	uint32 channel;			/* channel frequency in MHz    */
348 	int32 rssi;			/* in db                       */
349 	uint64 rtt;			/* in nanoseconds              */
350 	uint64 rtt_sd;			/* standard deviation in rtt   */
351 	uint16 beacon_period;		/* units are Kusec             */
352 	uint16 capability;		/* Capability information       */
353 	uint32 pad;
354 } wifi_gscan_result_t;
355 
356 typedef struct wifi_gscan_full_result {
357     wifi_gscan_result_t fixed;
358     uint32 scan_ch_bucket;
359     uint32 ie_length;		/* byte length of Information Elements */
360     char  ie_data[1];		/* IE  data to follow       */
361 } wifi_gscan_full_result_t;
362 
363 typedef struct gscan_results_cache {
364 	struct gscan_results_cache *next;
365 	uint8  scan_id;
366 	uint8  flag;
367 	uint8  tot_count;
368 	uint8  tot_consumed;
369 	uint32 scan_ch_bucket;
370 	wifi_gscan_result_t results[1];
371 } gscan_results_cache_t;
372 
373 typedef struct dhd_pno_gscan_capabilities {
374 	int max_scan_cache_size;
375 	int max_scan_buckets;
376 	int max_ap_cache_per_scan;
377 	int max_rssi_sample_size;
378 	int max_scan_reporting_threshold;
379 	int max_hotlist_bssids;
380 	int max_hotlist_ssids;
381 	int max_significant_wifi_change_aps;
382 	int max_bssid_history_entries;
383 	int max_epno_ssid_crc32;
384 	int max_epno_hidden_ssid;
385 	int max_white_list_ssid;
386 } dhd_pno_gscan_capabilities_t;
387 
388 typedef struct dhd_epno_ssid_cfg {
389 	wl_ssid_ext_params_t params;
390 	uint32 num_epno_ssid;
391 	struct list_head epno_ssid_list;
392 } dhd_epno_ssid_cfg_t;
393 
394 struct dhd_pno_gscan_params {
395 	int32 scan_fr;
396 	uint8 bestn;
397 	uint8 mscan;
398 	uint8 buffer_threshold;
399 	uint8 swc_nbssid_threshold;
400 	uint8 swc_rssi_window_size;
401 	uint8 lost_ap_window;
402 	uint8 nchannel_buckets;
403 	uint8 reason;
404 	uint8 get_batch_flag;
405 	uint8 send_all_results_flag;
406 	uint16 max_ch_bucket_freq;
407 	gscan_results_cache_t *gscan_batch_cache;
408 	gscan_results_cache_t *gscan_hotlist_found;
409 	gscan_results_cache_t*gscan_hotlist_lost;
410 	uint16 nbssid_significant_change;
411 	uint16 nbssid_hotlist;
412 	struct dhd_pno_swc_evt_param param_significant;
413 	struct dhd_pno_gscan_channel_bucket channel_bucket[GSCAN_MAX_CH_BUCKETS];
414 	struct list_head hotlist_bssid_list;
415 	struct list_head significant_bssid_list;
416 	dhd_epno_ssid_cfg_t epno_cfg;
417 	uint32 scan_id;
418 };
419 
420 typedef struct gscan_scan_params {
421 	int32 scan_fr;
422 	uint16 nchannel_buckets;
423 	struct dhd_pno_gscan_channel_bucket channel_bucket[GSCAN_MAX_CH_BUCKETS];
424 } gscan_scan_params_t;
425 
426 typedef struct gscan_batch_params {
427 	uint8 bestn;
428 	uint8 mscan;
429 	uint8 buffer_threshold;
430 } gscan_batch_params_t;
431 
432 struct bssid_t {
433 	struct ether_addr	macaddr;
434 	int16 rssi_reporting_threshold;  /* 0 -> no reporting threshold */
435 };
436 
437 typedef struct gscan_hotlist_scan_params {
438 	uint16 lost_ap_window; /* number of scans to declare LOST */
439 	uint16 nbssid;   /* number of bssids  */
440 	struct bssid_t bssid[1];  /* n bssids to follow */
441 } gscan_hotlist_scan_params_t;
442 
443 #endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
444 
445 typedef union dhd_pno_params {
446 	struct dhd_pno_legacy_params params_legacy;
447 	struct dhd_pno_batch_params params_batch;
448 	struct dhd_pno_hotlist_params params_hotlist;
449 #if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
450 	struct dhd_pno_gscan_params params_gscan;
451 #endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
452 } dhd_pno_params_t;
453 
454 typedef struct dhd_pno_status_info {
455 	dhd_pub_t *dhd;
456 	struct work_struct work;
457 	struct mutex pno_mutex;
458 #ifdef GSCAN_SUPPORT
459 	wait_queue_head_t batch_get_wait;
460 #endif /* GSCAN_SUPPORT */
461 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0))
462 	wait_queue_head_t get_batch_done;
463 	bool batch_recvd;
464 #else
465 	struct completion get_batch_done;
466 #endif
467 	bool wls_supported; /* wifi location service supported or not */
468 	enum dhd_pno_status pno_status;
469 	enum dhd_pno_mode pno_mode;
470 	dhd_pno_params_t pno_params_arr[INDEX_MODE_MAX];
471 	struct list_head head_list;
472 } dhd_pno_status_info_t;
473 
474 /* wrapper functions */
475 extern int
476 dhd_dev_pno_enable(struct net_device *dev, int enable);
477 
478 extern int
479 dhd_dev_pno_stop_for_ssid(struct net_device *dev);
480 
481 extern int
482 dhd_dev_pno_set_for_ssid(struct net_device *dev, wlc_ssid_ext_t* ssids_local, int nssid,
483 	uint16 scan_fr, int pno_repeat, int pno_freq_expo_max, uint16 *channel_list, int nchan);
484 
485 extern int
486 dhd_dev_pno_set_for_batch(struct net_device *dev,
487 	struct dhd_pno_batch_params *batch_params);
488 
489 extern int
490 dhd_dev_pno_get_for_batch(struct net_device *dev, char *buf, int bufsize);
491 
492 extern int
493 dhd_dev_pno_stop_for_batch(struct net_device *dev);
494 
495 extern int
496 dhd_dev_pno_set_for_hotlist(struct net_device *dev, wl_pfn_bssid_t *p_pfn_bssid,
497 	struct dhd_pno_hotlist_params *hotlist_params);
498 extern bool dhd_dev_is_legacy_pno_enabled(struct net_device *dev);
499 #if defined (GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
500 extern void *
501 dhd_dev_pno_get_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, void *info,
502         uint32 *len);
503 #endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
504 #ifdef GSCAN_SUPPORT
505 extern int
506 dhd_dev_pno_set_cfg_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type,
507               void *buf, bool flush);
508 int dhd_dev_pno_lock_access_batch_results(struct net_device *dev);
509 void dhd_dev_pno_unlock_access_batch_results(struct net_device *dev);
510 extern int dhd_dev_pno_run_gscan(struct net_device *dev, bool run, bool flush);
511 extern int dhd_dev_pno_enable_full_scan_result(struct net_device *dev, bool real_time);
512 int dhd_retreive_batch_scan_results(dhd_pub_t *dhd);
513 extern void * dhd_dev_hotlist_scan_event(struct net_device *dev,
514             const void  *data, int *send_evt_bytes, hotlist_type_t type, u32 *buf_len);
515 void * dhd_dev_process_full_gscan_result(struct net_device *dev,
516             const void  *data, uint32 len, int *send_evt_bytes);
517 extern int dhd_dev_gscan_batch_cache_cleanup(struct net_device *dev);
518 extern void dhd_dev_gscan_hotlist_cache_cleanup(struct net_device *dev, hotlist_type_t type);
519 extern int dhd_dev_wait_batch_results_complete(struct net_device *dev);
520 extern void * dhd_dev_process_epno_result(struct net_device *dev,
521 		const void  *data, uint32 event, int *send_evt_bytes);
522 extern int dhd_dev_set_epno(struct net_device *dev);
523 extern int dhd_dev_flush_fw_epno(struct net_device *dev);
524 #endif /* GSCAN_SUPPORT */
525 /* dhd pno fuctions */
526 extern int dhd_pno_stop_for_ssid(dhd_pub_t *dhd);
527 extern int dhd_pno_enable(dhd_pub_t *dhd, int enable);
528 extern int dhd_pno_set_for_ssid(dhd_pub_t *dhd, wlc_ssid_ext_t* ssid_list, int nssid,
529 	uint16  scan_fr, int pno_repeat, int pno_freq_expo_max, uint16 *channel_list, int nchan);
530 
531 extern int dhd_pno_set_for_batch(dhd_pub_t *dhd, struct dhd_pno_batch_params *batch_params);
532 
533 extern int dhd_pno_get_for_batch(dhd_pub_t *dhd, char *buf, int bufsize, int reason);
534 
535 extern int dhd_pno_stop_for_batch(dhd_pub_t *dhd);
536 
537 extern int dhd_pno_set_for_hotlist(dhd_pub_t *dhd, wl_pfn_bssid_t *p_pfn_bssid,
538 	struct dhd_pno_hotlist_params *hotlist_params);
539 
540 extern int dhd_pno_stop_for_hotlist(dhd_pub_t *dhd);
541 
542 extern int dhd_pno_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data);
543 extern int dhd_pno_init(dhd_pub_t *dhd);
544 extern int dhd_pno_deinit(dhd_pub_t *dhd);
545 extern bool dhd_is_pno_supported(dhd_pub_t *dhd);
546 extern bool dhd_is_legacy_pno_enabled(dhd_pub_t *dhd);
547 #if defined (GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
548 extern void * dhd_pno_get_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type, void *info,
549                        uint32 *len);
550 #endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
551 #ifdef GSCAN_SUPPORT
552 extern int dhd_pno_set_cfg_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type,
553                        void *buf, bool flush);
554 extern int dhd_pno_lock_batch_results(dhd_pub_t *dhd);
555 extern void dhd_pno_unlock_batch_results(dhd_pub_t *dhd);
556 extern int dhd_pno_initiate_gscan_request(dhd_pub_t *dhd, bool run, bool flush);
557 extern int dhd_pno_enable_full_scan_result(dhd_pub_t *dhd, bool real_time_flag);
558 extern int dhd_pno_cfg_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type, void *buf);
559 extern int dhd_dev_retrieve_batch_scan(struct net_device *dev);
560 extern void *dhd_handle_hotlist_scan_evt(dhd_pub_t *dhd, const void *event_data,
561                        int *send_evt_bytes, hotlist_type_t type, u32 *buf_len);
562 extern void *dhd_process_full_gscan_result(dhd_pub_t *dhd, const void *event_data,
563                        uint32 len, int *send_evt_bytes);
564 extern int dhd_gscan_batch_cache_cleanup(dhd_pub_t *dhd);
565 extern void dhd_gscan_hotlist_cache_cleanup(dhd_pub_t *dhd, hotlist_type_t type);
566 extern int dhd_wait_batch_results_complete(dhd_pub_t *dhd);
567 extern void * dhd_pno_process_epno_result(dhd_pub_t *dhd, const void *data,
568          uint32 event, int *size);
569 extern void dhd_pno_translate_epno_fw_flags(uint32 *flags);
570 extern int dhd_pno_set_epno(dhd_pub_t *dhd);
571 extern int dhd_pno_flush_fw_epno(dhd_pub_t *dhd);
572 extern void dhd_pno_set_epno_auth_flag(uint32 *wpa_auth);
573 #endif /* GSCAN_SUPPORT */
574 #endif /* #if defined(OEM_ANDROID) && defined(PNO_SUPPORT) */
575 
576 #if defined(NDIS)
577 #if defined(PNO_SUPPORT)
578 extern int dhd_pno_cfg(dhd_pub_t *dhd, wl_pfn_cfg_t *pcfg);
579 extern int dhd_pno_suspend(dhd_pub_t *dhd, int pfn_suspend);
580 extern int dhd_pno_set_add(dhd_pub_t *dhd, wl_pfn_t *netinfo, int nssid, ushort scan_fr,
581 	ushort slowscan_fr, uint8 pno_repeat, uint8 pno_freq_expo_max, int16 flags);
582 extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled);
583 extern int dhd_pno_clean(dhd_pub_t *dhd);
584 #endif /* #if defined(PNO_SUPPORT) */
585 #endif /* #if defined(NDIS) */
586 #endif /* __DHD_PNO_H__ */
587