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