2 * Header file of Broadcom Dongle Host Driver (DHD)
3 * Prefered Network Offload code and Wi-Fi Location Service(WLS) code.
4 * $Copyright Open Broadcom Corporation$
6 * $Id: dhd_pno.h 423669 2013-09-18 13:01:55Z $
12 #if defined(PNO_SUPPORT)
13 #define PNO_TLV_PREFIX 'S'
14 #define PNO_TLV_VERSION '1'
15 #define PNO_TLV_SUBTYPE_LEGACY_PNO '2'
16 #define PNO_TLV_RESERVED '0'
18 #define PNO_BATCHING_SET "SET"
19 #define PNO_BATCHING_GET "GET"
20 #define PNO_BATCHING_STOP "STOP"
22 #define PNO_PARAMS_DELIMETER " "
23 #define PNO_PARAM_CHANNEL_DELIMETER ","
24 #define PNO_PARAM_VALUE_DELLIMETER '='
25 #define PNO_PARAM_SCANFREQ "SCANFREQ"
26 #define PNO_PARAM_BESTN "BESTN"
27 #define PNO_PARAM_MSCAN "MSCAN"
28 #define PNO_PARAM_CHANNEL "CHANNEL"
29 #define PNO_PARAM_RTT "RTT"
31 #define PNO_TLV_TYPE_SSID_IE 'S'
32 #define PNO_TLV_TYPE_TIME 'T'
33 #define PNO_TLV_FREQ_REPEAT 'R'
34 #define PNO_TLV_FREQ_EXPO_MAX 'M'
36 #define MAXNUM_SSID_PER_ADD 16
37 #define MAXNUM_PNO_PARAMS 2
38 #define PNO_TLV_COMMON_LENGTH 1
39 #define DEFAULT_BATCH_MSCAN 16
41 #define RESULTS_END_MARKER "----\n"
42 #define SCAN_END_MARKER "####\n"
43 #define AP_END_MARKER "====\n"
46 /* SCAN ABORT by other scan */
48 /* RTT is presence or not */
49 PNO_STATUS_RTT_PRESENCE,
50 /* Disable PNO by Driver */
52 /* NORMAL BATCHING GET */
54 /* WLC_E_PFN_BEST_BATCHING */
58 #define PNO_STATUS_ABORT_MASK 0x0001
59 #define PNO_STATUS_RTT_MASK 0x0002
60 #define PNO_STATUS_DISABLE_MASK 0x0004
61 #define PNO_STATUS_OOM_MASK 0x0010
64 INDEX_OF_LEGACY_PARAMS,
65 INDEX_OF_BATCH_PARAMS,
66 INDEX_OF_HOTLIST_PARAMS,
74 typedef struct cmd_tlv {
80 typedef enum dhd_pno_mode {
81 /* Wi-Fi Legacy PNO Mode */
82 DHD_PNO_NONE_MODE = 0,
83 DHD_PNO_LEGACY_MODE = (1 << (0)),
84 /* Wi-Fi Android BATCH SCAN Mode */
85 DHD_PNO_BATCH_MODE = (1 << (1)),
86 /* Wi-Fi Android Hotlist SCAN Mode */
87 DHD_PNO_HOTLIST_MODE = (1 << (2))
91 uchar SSID[DOT11_MAX_SSID_LEN];
92 struct list_head list;
94 struct dhd_pno_bssid {
95 struct ether_addr macaddr;
96 /* Bit4: suppress_lost, Bit3: suppress_found */
98 struct list_head list;
100 typedef struct dhd_pno_bestnet_entry {
101 struct ether_addr BSSID;
103 uint8 SSID[DOT11_MAX_SSID_LEN];
107 uint16 rtt0; /* distance_cm based on RTT */
108 uint16 rtt1; /* distance_cm based on sample standard deviation */
109 unsigned long recorded_time;
110 struct list_head list;
111 } dhd_pno_bestnet_entry_t;
112 #define BESTNET_ENTRY_SIZE (sizeof(dhd_pno_bestnet_entry_t))
114 typedef struct dhd_pno_bestnet_header {
115 struct dhd_pno_bestnet_header *next;
119 struct list_head entry_list;
120 } dhd_pno_best_header_t;
121 #define BEST_HEADER_SIZE (sizeof(dhd_pno_best_header_t))
123 typedef struct dhd_pno_scan_results {
124 dhd_pno_best_header_t *bestnetheader;
126 struct list_head list;
127 } dhd_pno_scan_results_t;
128 #define SCAN_RESULTS_SIZE (sizeof(dhd_pno_scan_results_t))
130 struct dhd_pno_get_batch_info {
131 /* info related to get batch */
135 uint32 expired_tot_scan_cnt;
138 uint32 bytes_written;
140 struct list_head scan_results_list;
141 struct list_head expired_scan_results_list;
143 struct dhd_pno_legacy_params {
145 uint16 chan_list[WL_NUMCHANNELS];
148 int pno_freq_expo_max;
150 struct list_head ssid_list;
152 struct dhd_pno_batch_params {
157 uint16 chan_list[WL_NUMCHANNELS];
160 struct dhd_pno_get_batch_info get_batch;
162 struct dhd_pno_hotlist_params {
165 uint16 chan_list[WL_NUMCHANNELS];
168 struct list_head bssid_list;
170 typedef union dhd_pno_params {
171 struct dhd_pno_legacy_params params_legacy;
172 struct dhd_pno_batch_params params_batch;
173 struct dhd_pno_hotlist_params params_hotlist;
175 typedef struct dhd_pno_status_info {
177 struct work_struct work;
178 struct mutex pno_mutex;
179 struct completion get_batch_done;
180 bool wls_supported; /* wifi location service supported or not */
181 enum dhd_pno_status pno_status;
182 enum dhd_pno_mode pno_mode;
183 dhd_pno_params_t pno_params_arr[INDEX_MODE_MAX];
184 struct list_head head_list;
185 } dhd_pno_status_info_t;
187 /* wrapper functions */
189 dhd_dev_pno_enable(struct net_device *dev, int enable);
192 dhd_dev_pno_stop_for_ssid(struct net_device *dev);
195 dhd_dev_pno_set_for_ssid(struct net_device *dev, wlc_ssid_t* ssids_local, int nssid,
196 uint16 scan_fr, int pno_repeat, int pno_freq_expo_max, uint16 *channel_list, int nchan);
199 dhd_dev_pno_set_for_batch(struct net_device *dev,
200 struct dhd_pno_batch_params *batch_params);
203 dhd_dev_pno_get_for_batch(struct net_device *dev, char *buf, int bufsize);
206 dhd_dev_pno_stop_for_batch(struct net_device *dev);
209 dhd_dev_pno_set_for_hotlist(struct net_device *dev, wl_pfn_bssid_t *p_pfn_bssid,
210 struct dhd_pno_hotlist_params *hotlist_params);
212 /* dhd pno fuctions */
213 extern int dhd_pno_stop_for_ssid(dhd_pub_t *dhd);
214 extern int dhd_pno_enable(dhd_pub_t *dhd, int enable);
215 extern int dhd_pno_set_for_ssid(dhd_pub_t *dhd, wlc_ssid_t* ssid_list, int nssid,
216 uint16 scan_fr, int pno_repeat, int pno_freq_expo_max, uint16 *channel_list, int nchan);
218 extern int dhd_pno_set_for_batch(dhd_pub_t *dhd, struct dhd_pno_batch_params *batch_params);
220 extern int dhd_pno_get_for_batch(dhd_pub_t *dhd, char *buf, int bufsize, int reason);
223 extern int dhd_pno_stop_for_batch(dhd_pub_t *dhd);
225 extern int dhd_pno_set_for_hotlist(dhd_pub_t *dhd, wl_pfn_bssid_t *p_pfn_bssid,
226 struct dhd_pno_hotlist_params *hotlist_params);
228 extern int dhd_pno_stop_for_hotlist(dhd_pub_t *dhd);
230 extern int dhd_pno_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data);
231 extern int dhd_pno_init(dhd_pub_t *dhd);
232 extern int dhd_pno_deinit(dhd_pub_t *dhd);
236 #if defined(PNO_SUPPORT)
237 #if (NDISVER >= 0x0630)
238 extern int dhd_pno_cfg(dhd_pub_t *dhd, wl_pfn_cfg_t *pcfg);
239 extern int dhd_pno_suspend(dhd_pub_t *dhd, int pfn_suspend);
240 extern int dhd_pno_set_add(dhd_pub_t *dhd, wl_pfn_t *netinfo, int nssid, ushort scan_fr,
241 ushort slowscan_fr, uint8 pno_repeat, uint8 pno_freq_expo_max, int16 flags);
242 extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled);
243 extern int dhd_pno_clean(dhd_pub_t *dhd);
244 #endif /* #if (NDISVER >= 0x0630) */
245 #endif /* #if defined(PNO_SUPPORT) */
246 #endif /* #if defined(NDISVER) */
247 #endif /* __DHD_PNO_H__ */