hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dhd_pno.h
....@@ -1,16 +1,17 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
21 /*
32 * Header file of Broadcom Dongle Host Driver (DHD)
43 * Prefered Network Offload code and Wi-Fi Location Service(WLS) code.
54 *
6
- * Copyright (C) 1999-2019, Broadcom Corporation
7
- *
5
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
6
+ *
7
+ * Copyright (C) 1999-2017, Broadcom Corporation
8
+ *
89 * Unless you and Broadcom execute a separate written software license
910 * agreement governing use of this software, this software is licensed to you
1011 * under the terms of the GNU General Public License version 2 (the "GPL"),
1112 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
1213 * following added to such license:
13
- *
14
+ *
1415 * As a special exception, the copyright holders of this software give you
1516 * permission to link this software with independent modules, and to copy and
1617 * distribute the resulting executable under terms of your choice, provided that
....@@ -18,7 +19,7 @@
1819 * the license of that module. An independent module is a module which is not
1920 * derived from this software. The special exception does not apply to any
2021 * modifications of the software.
21
- *
22
+ *
2223 * Notwithstanding the above, under no circumstances may you combine this
2324 * software in any way with any other Broadcom software provided under a license
2425 * other than the GPL, without Broadcom's express prior written consent.
....@@ -26,20 +27,22 @@
2627 *
2728 * <<Broadcom-WL-IPTag/Open:>>
2829 *
29
- * $Id: dhd_pno.h 423669 2013-09-18 13:01:55Z $
30
+ * $Id: dhd_pno.h 805174 2019-02-15 17:26:01Z $
3031 */
3132
3233 #ifndef __DHD_PNO_H__
3334 #define __DHD_PNO_H__
3435
35
-#if defined(PNO_SUPPORT)
36
+#if defined(OEM_ANDROID) && defined(PNO_SUPPORT)
3637 #define PNO_TLV_PREFIX 'S'
3738 #define PNO_TLV_VERSION '1'
3839 #define PNO_TLV_SUBTYPE_LEGACY_PNO '2'
3940 #define PNO_TLV_RESERVED '0'
41
+
4042 #define PNO_BATCHING_SET "SET"
4143 #define PNO_BATCHING_GET "GET"
4244 #define PNO_BATCHING_STOP "STOP"
45
+
4346 #define PNO_PARAMS_DELIMETER " "
4447 #define PNO_PARAM_CHANNEL_DELIMETER ","
4548 #define PNO_PARAM_VALUE_DELLIMETER '='
....@@ -64,8 +67,28 @@
6467 #define AP_END_MARKER "====\n"
6568 #define PNO_RSSI_MARGIN_DBM 30
6669
67
-#ifdef GSCAN_SUPPORT
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'
6881
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)
6992 #define GSCAN_MAX_CH_BUCKETS 8
7093 #define GSCAN_MAX_CHANNELS_IN_BUCKET 32
7194 #define GSCAN_MAX_AP_CACHE_PER_SCAN 32
....@@ -88,6 +111,7 @@
88111 #define DHD_EPNO_A_BAND_TRIG (1 << 1)
89112 #define DHD_EPNO_BG_BAND_TRIG (1 << 2)
90113 #define DHD_EPNO_STRICT_MATCH (1 << 3)
114
+#define DHD_EPNO_SAME_NETWORK (1 << 4)
91115 #define DHD_PNO_USE_SSID (DHD_EPNO_HIDDEN_SSID | DHD_EPNO_STRICT_MATCH)
92116
93117 /* Do not change GSCAN_BATCH_RETRIEVAL_COMPLETE */
....@@ -97,10 +121,11 @@
97121 #define GSCAN_LOST_AP_WINDOW_DEFAULT 4
98122 #define GSCAN_MIN_BSSID_TIMEOUT 90
99123 #define GSCAN_BATCH_GET_MAX_WAIT 500
100
-#define CHANNEL_BUCKET_EMPTY_INDEX 0xFF
124
+#define CHANNEL_BUCKET_EMPTY_INDEX 0xFFFF
101125 #define GSCAN_RETRY_THRESHOLD 3
102
-#define MAX_EPNO_SSID_NUM 32
103
-#endif /* GSCAN_SUPPORT */
126
+
127
+#define MAX_EPNO_SSID_NUM 64
128
+#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
104129
105130 enum scan_status {
106131 /* SCAN ABORT by other scan */
....@@ -127,9 +152,7 @@
127152 /* GSCAN includes hotlist scan and they do not run
128153 * independent of each other
129154 */
130
-#ifdef GSCAN_SUPPORT
131155 INDEX_OF_GSCAN_PARAMS = INDEX_OF_HOTLIST_PARAMS,
132
-#endif /* GSCAN_SUPPORT */
133156 INDEX_MODE_MAX
134157 };
135158 enum dhd_pno_status {
....@@ -143,7 +166,7 @@
143166 char subtype;
144167 char reserved;
145168 } cmd_tlv_t;
146
-#ifdef GSCAN_SUPPORT
169
+#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
147170 typedef enum {
148171 WIFI_BAND_UNSPECIFIED,
149172 WIFI_BAND_BG = 1, /* 2.4 GHz */
....@@ -167,9 +190,10 @@
167190 DHD_PNO_GET_CAPABILITIES,
168191 DHD_PNO_GET_BATCH_RESULTS,
169192 DHD_PNO_GET_CHANNEL_LIST,
170
- DHD_PNO_GET_EPNO_SSID_ELEM,
193
+ DHD_PNO_GET_NEW_EPNO_SSID_ELEM,
171194 DHD_PNO_EPNO_CFG_ID,
172
- DHD_PNO_GET_AUTOJOIN_CAPABILITIES
195
+ DHD_PNO_GET_AUTOJOIN_CAPABILITIES,
196
+ DHD_PNO_EPNO_PARAMS_ID
173197 } dhd_pno_gscan_cmd_cfg_t;
174198
175199 typedef enum dhd_pno_mode {
....@@ -193,21 +217,26 @@
193217 /* Wi-Fi Android Hotlist SCAN Mode */
194218 DHD_PNO_HOTLIST_MODE = (1 << (2))
195219 } dhd_pno_mode_t;
196
-#endif /* GSCAN_SUPPORT */
197
-struct dhd_pno_ssid {
220
+#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
221
+
222
+typedef struct dhd_pno_ssid {
198223 bool hidden;
199224 int8 rssi_thresh;
200225 uint8 dummy;
201226 uint16 SSID_len;
227
+ uint32 flags;
228
+ int32 wpa_auth;
202229 uchar SSID[DOT11_MAX_SSID_LEN];
203230 struct list_head list;
204
-};
231
+} dhd_pno_ssid_t;
232
+
205233 struct dhd_pno_bssid {
206234 struct ether_addr macaddr;
207235 /* Bit4: suppress_lost, Bit3: suppress_found */
208236 uint16 flags;
209237 struct list_head list;
210238 };
239
+
211240 typedef struct dhd_pno_bestnet_entry {
212241 struct ether_addr BSSID;
213242 uint8 SSID_len;
....@@ -278,7 +307,7 @@
278307 uint16 nbssid;
279308 struct list_head bssid_list;
280309 };
281
-#ifdef GSCAN_SUPPORT
310
+#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
282311 #define DHD_PNO_REPORT_NO_BATCH (1 << 2)
283312
284313 typedef struct dhd_pno_gscan_channel_bucket {
....@@ -294,7 +323,6 @@
294323 uint16 bucket_max_multiple;
295324 uint16 chan_list[GSCAN_MAX_CHANNELS_IN_BUCKET];
296325 } dhd_pno_gscan_channel_bucket_t;
297
-
298326
299327 #define DHD_PNO_AUTH_CODE_OPEN 1 /* Open */
300328 #define DHD_PNO_AUTH_CODE_PSK 2 /* WPA_PSK or WPA2PSK */
....@@ -328,18 +356,24 @@
328356 } dhd_pno_swc_evt_param_t;
329357
330358 typedef struct wifi_gscan_result {
331
- uint64 ts; /* Time of discovery */
332
- char ssid[DOT11_MAX_SSID_LEN+1]; /* null terminated */
333
- struct ether_addr macaddr; /* BSSID */
334
- uint32 channel; /* channel frequency in MHz */
335
- int32 rssi; /* in db */
336
- uint64 rtt; /* in nanoseconds */
337
- uint64 rtt_sd; /* standard deviation in rtt */
338
- uint16 beacon_period; /* units are Kusec */
339
- uint16 capability; /* Capability information */
340
- uint32 ie_length; /* byte length of Information Elements */
341
- char ie_data[1]; /* IE data to follow */
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;
342369 } 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;
343377
344378 typedef struct gscan_results_cache {
345379 struct gscan_results_cache *next;
....@@ -347,6 +381,7 @@
347381 uint8 flag;
348382 uint8 tot_count;
349383 uint8 tot_consumed;
384
+ uint32 scan_ch_bucket;
350385 wifi_gscan_result_t results[1];
351386 } gscan_results_cache_t;
352387
....@@ -356,12 +391,20 @@
356391 int max_ap_cache_per_scan;
357392 int max_rssi_sample_size;
358393 int max_scan_reporting_threshold;
359
- int max_hotlist_aps;
394
+ int max_hotlist_bssids;
395
+ int max_hotlist_ssids;
360396 int max_significant_wifi_change_aps;
397
+ int max_bssid_history_entries;
361398 int max_epno_ssid_crc32;
362399 int max_epno_hidden_ssid;
363400 int max_white_list_ssid;
364401 } 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;
365408
366409 struct dhd_pno_gscan_params {
367410 int32 scan_fr;
....@@ -378,21 +421,14 @@
378421 uint16 max_ch_bucket_freq;
379422 gscan_results_cache_t *gscan_batch_cache;
380423 gscan_results_cache_t *gscan_hotlist_found;
381
- gscan_results_cache_t *gscan_hotlist_lost;
424
+ gscan_results_cache_t*gscan_hotlist_lost;
382425 uint16 nbssid_significant_change;
383426 uint16 nbssid_hotlist;
384
- uint16 num_epno_ssid;
385
- uint8 num_visible_epno_ssid;
386
- /* To keep track of visble ssid index
387
- * across multiple FW configs i.e. config
388
- * w/o clear in between
389
- */
390
- uint8 ssid_ext_last_used_index;
391427 struct dhd_pno_swc_evt_param param_significant;
392428 struct dhd_pno_gscan_channel_bucket channel_bucket[GSCAN_MAX_CH_BUCKETS];
393429 struct list_head hotlist_bssid_list;
394430 struct list_head significant_bssid_list;
395
- struct list_head epno_ssid_list;
431
+ dhd_epno_ssid_cfg_t epno_cfg;
396432 uint32 scan_id;
397433 };
398434
....@@ -419,35 +455,17 @@
419455 struct bssid_t bssid[1]; /* n bssids to follow */
420456 } gscan_hotlist_scan_params_t;
421457
422
-/* SWC (Significant WiFi Change) params */
423
-typedef struct gscan_swc_params {
424
- /* Rssi averaging window size */
425
- uint8 rssi_window;
426
- /* Number of scans that the AP has to be absent before
427
- * being declared LOST
428
- */
429
- uint8 lost_ap_window;
430
- /* if x Aps have a significant change generate an event. */
431
- uint8 swc_threshold;
432
- uint8 nbssid;
433
- wl_pfn_significant_bssid_t bssid_elem_list[1];
434
-} gscan_swc_params_t;
458
+#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
435459
436
-typedef struct dhd_pno_significant_bssid {
437
- struct ether_addr BSSID;
438
- int8 rssi_low_threshold;
439
- int8 rssi_high_threshold;
440
- struct list_head list;
441
-} dhd_pno_significant_bssid_t;
442
-#endif /* GSCAN_SUPPORT */
443460 typedef union dhd_pno_params {
444461 struct dhd_pno_legacy_params params_legacy;
445462 struct dhd_pno_batch_params params_batch;
446463 struct dhd_pno_hotlist_params params_hotlist;
447
-#ifdef GSCAN_SUPPORT
464
+#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
448465 struct dhd_pno_gscan_params params_gscan;
449
-#endif /* GSCAN_SUPPORT */
466
+#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */
450467 } dhd_pno_params_t;
468
+
451469 typedef struct dhd_pno_status_info {
452470 dhd_pub_t *dhd;
453471 struct work_struct work;
....@@ -488,29 +506,31 @@
488506 dhd_dev_pno_set_for_hotlist(struct net_device *dev, wl_pfn_bssid_t *p_pfn_bssid,
489507 struct dhd_pno_hotlist_params *hotlist_params);
490508 extern bool dhd_dev_is_legacy_pno_enabled(struct net_device *dev);
491
-#ifdef GSCAN_SUPPORT
492
-extern int
493
-dhd_dev_pno_set_cfg_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type,
494
- void *buf, uint8 flush);
509
+#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
495510 extern void *
496511 dhd_dev_pno_get_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, void *info,
497512 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);
498518 int dhd_dev_pno_lock_access_batch_results(struct net_device *dev);
499519 void dhd_dev_pno_unlock_access_batch_results(struct net_device *dev);
500520 extern int dhd_dev_pno_run_gscan(struct net_device *dev, bool run, bool flush);
501521 extern int dhd_dev_pno_enable_full_scan_result(struct net_device *dev, bool real_time);
502
-extern void * dhd_dev_swc_scan_event(struct net_device *dev, const void *data,
503
- int *send_evt_bytes);
504522 int dhd_retreive_batch_scan_results(dhd_pub_t *dhd);
505523 extern void * dhd_dev_hotlist_scan_event(struct net_device *dev,
506
- const void *data, int *send_evt_bytes, hotlist_type_t type);
524
+ const void *data, int *send_evt_bytes, hotlist_type_t type, u32 *buf_len);
507525 void * dhd_dev_process_full_gscan_result(struct net_device *dev,
508526 const void *data, uint32 len, int *send_evt_bytes);
509527 extern int dhd_dev_gscan_batch_cache_cleanup(struct net_device *dev);
510528 extern void dhd_dev_gscan_hotlist_cache_cleanup(struct net_device *dev, hotlist_type_t type);
511529 extern int dhd_dev_wait_batch_results_complete(struct net_device *dev);
512530 extern void * dhd_dev_process_epno_result(struct net_device *dev,
513
- const void *data, uint32 event, int *send_evt_bytes);
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);
514534 #endif /* GSCAN_SUPPORT */
515535 /* dhd pno fuctions */
516536 extern int dhd_pno_stop_for_ssid(dhd_pub_t *dhd);
....@@ -521,7 +541,6 @@
521541 extern int dhd_pno_set_for_batch(dhd_pub_t *dhd, struct dhd_pno_batch_params *batch_params);
522542
523543 extern int dhd_pno_get_for_batch(dhd_pub_t *dhd, char *buf, int bufsize, int reason);
524
-
525544
526545 extern int dhd_pno_stop_for_batch(dhd_pub_t *dhd);
527546
....@@ -534,22 +553,22 @@
534553 extern int dhd_pno_init(dhd_pub_t *dhd);
535554 extern int dhd_pno_deinit(dhd_pub_t *dhd);
536555 extern bool dhd_is_pno_supported(dhd_pub_t *dhd);
537
-extern int dhd_pno_set_mac_oui(dhd_pub_t *dhd, uint8 *oui);
538556 extern bool dhd_is_legacy_pno_enabled(dhd_pub_t *dhd);
539
-#ifdef GSCAN_SUPPORT
540
-extern int dhd_pno_set_cfg_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type,
541
- void *buf, uint8 flush);
557
+#if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS)
542558 extern void * dhd_pno_get_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type, void *info,
543559 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);
544564 extern int dhd_pno_lock_batch_results(dhd_pub_t *dhd);
545565 extern void dhd_pno_unlock_batch_results(dhd_pub_t *dhd);
546566 extern int dhd_pno_initiate_gscan_request(dhd_pub_t *dhd, bool run, bool flush);
547567 extern int dhd_pno_enable_full_scan_result(dhd_pub_t *dhd, bool real_time_flag);
548568 extern int dhd_pno_cfg_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type, void *buf);
549569 extern int dhd_dev_retrieve_batch_scan(struct net_device *dev);
550
-extern void *dhd_handle_swc_evt(dhd_pub_t *dhd, const void *event_data, int *send_evt_bytes);
551570 extern void *dhd_handle_hotlist_scan_evt(dhd_pub_t *dhd, const void *event_data,
552
- int *send_evt_bytes, hotlist_type_t type);
571
+ int *send_evt_bytes, hotlist_type_t type, u32 *buf_len);
553572 extern void *dhd_process_full_gscan_result(dhd_pub_t *dhd, const void *event_data,
554573 uint32 len, int *send_evt_bytes);
555574 extern int dhd_gscan_batch_cache_cleanup(dhd_pub_t *dhd);
....@@ -557,7 +576,11 @@
557576 extern int dhd_wait_batch_results_complete(dhd_pub_t *dhd);
558577 extern void * dhd_pno_process_epno_result(dhd_pub_t *dhd, const void *data,
559578 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);
560583 #endif /* GSCAN_SUPPORT */
561
-#endif
584
+#endif /* #if defined(OEM_ANDROID) && defined(PNO_SUPPORT) */
562585
563586 #endif /* __DHD_PNO_H__ */