xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_rtt.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Broadcom Dongle Host Driver (DHD), RTT
3  *
4  * Copyright (C) 2020, Broadcom.
5  *
6  *      Unless you and Broadcom execute a separate written software license
7  * agreement governing use of this software, this software is licensed to you
8  * under the terms of the GNU General Public License version 2 (the "GPL"),
9  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10  * following added to such license:
11  *
12  *      As a special exception, the copyright holders of this software give you
13  * permission to link this software with independent modules, and to copy and
14  * distribute the resulting executable under terms of your choice, provided that
15  * you also meet, for each linked independent module, the terms and conditions of
16  * the license of that module.  An independent module is a module which is not
17  * derived from this software.  The special exception does not apply to any
18  * modifications of the software.
19  *
20  *
21  * <<Broadcom-WL-IPTag/Dual:>>
22  */
23 #ifndef __DHD_RTT_H__
24 #define __DHD_RTT_H__
25 
26 #include <dngl_stats.h>
27 #include "wifi_stats.h"
28 
29 #define RTT_MAX_TARGET_CNT 50
30 #define RTT_MAX_FRAME_CNT 25
31 #define RTT_MAX_RETRY_CNT 10
32 #define DEFAULT_FTM_CNT 6
33 #define DEFAULT_RETRY_CNT 6
34 #define DEFAULT_FTM_FREQ 5180
35 #define DEFAULT_FTM_CNTR_FREQ0 5210
36 #define RTT_MAX_GEOFENCE_TARGET_CNT 8
37 
38 #define TARGET_INFO_SIZE(count) (sizeof(rtt_target_info_t) * count)
39 
40 #define TARGET_TYPE(target) (target->type)
41 
42 #define RTT_IS_ENABLED(rtt_status) (rtt_status->status == RTT_ENABLED)
43 #define RTT_IS_STOPPED(rtt_status) (rtt_status->status == RTT_STOPPED)
44 
45 #define GEOFENCE_RTT_LOCK(rtt_status) mutex_lock(&(rtt_status)->geofence_mutex)
46 #define GEOFENCE_RTT_UNLOCK(rtt_status) mutex_unlock(&(rtt_status)->geofence_mutex)
47 
48 #ifndef BIT
49 #define BIT(x) (1 << (x))
50 #endif
51 
52 /* DSSS, CCK and 802.11n rates in [500kbps] units */
53 #define WL_MAXRATE	108	/* in 500kbps units */
54 #define WL_RATE_1M	2	/* in 500kbps units */
55 #define WL_RATE_2M	4	/* in 500kbps units */
56 #define WL_RATE_5M5	11	/* in 500kbps units */
57 #define WL_RATE_11M	22	/* in 500kbps units */
58 #define WL_RATE_6M	12	/* in 500kbps units */
59 #define WL_RATE_9M	18	/* in 500kbps units */
60 #define WL_RATE_12M	24	/* in 500kbps units */
61 #define WL_RATE_18M	36	/* in 500kbps units */
62 #define WL_RATE_24M	48	/* in 500kbps units */
63 #define WL_RATE_36M	72	/* in 500kbps units */
64 #define WL_RATE_48M	96	/* in 500kbps units */
65 #define WL_RATE_54M	108	/* in 500kbps units */
66 #define GET_RTTSTATE(dhd) ((rtt_status_info_t *)dhd->rtt_state)
67 
68 #ifdef WL_NAN
69 /* RTT Retry Timer Interval */
70 /* Fix Me: Revert back once retry logic is back in place */
71 #define DHD_RTT_RETRY_TIMER_INTERVAL_MS			-1
72 #endif /* WL_NAN */
73 
74 #define DHD_RTT_INVALID_TARGET_INDEX		-1
75 
76 enum rtt_role {
77 	RTT_INITIATOR = 0,
78 	RTT_TARGET = 1
79 };
80 enum rtt_status {
81 	RTT_STOPPED = 0,
82 	RTT_STARTED = 1,
83 	RTT_ENABLED = 2
84 };
85 typedef int64_t wifi_timestamp; /* In microseconds (us) */
86 typedef int64_t wifi_timespan;
87 typedef int32 wifi_rssi_rtt;
88 
89 typedef enum {
90 	RTT_INVALID,
91 	RTT_ONE_WAY,
92 	RTT_TWO_WAY,
93 	RTT_AUTO
94 } rtt_type_t;
95 
96 /* RTT peer type */
97 typedef enum {
98 	RTT_PEER_AP         = 0x1,
99 	RTT_PEER_STA        = 0x2,
100 	RTT_PEER_P2P_GO     = 0x3,
101 	RTT_PEER_P2P_CLIENT = 0x4,
102 	RTT_PEER_NAN        = 0x5,
103 	RTT_PEER_INVALID    = 0x6
104 } rtt_peer_type_t;
105 
106 /* Ranging status */
107 typedef enum rtt_reason {
108 	RTT_STATUS_SUCCESS       = 0,
109 	RTT_STATUS_FAILURE       = 1,           // general failure status
110 	RTT_STATUS_FAIL_NO_RSP   = 2,           // target STA does not respond to request
111 	RTT_STATUS_FAIL_REJECTED = 3,           // request rejected. Applies to 2-sided RTT only
112 	RTT_STATUS_FAIL_NOT_SCHEDULED_YET  = 4,
113 	RTT_STATUS_FAIL_TM_TIMEOUT         = 5, // timing measurement times out
114 	RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6, // Target on different channel, cannot range
115 	RTT_STATUS_FAIL_NO_CAPABILITY  = 7,     // ranging not supported
116 	RTT_STATUS_ABORTED             = 8,     // request aborted for unknown reason
117 	RTT_STATUS_FAIL_INVALID_TS     = 9,     // Invalid T1-T4 timestamp
118 	RTT_STATUS_FAIL_PROTOCOL       = 10,    // 11mc protocol failed
119 	RTT_STATUS_FAIL_SCHEDULE       = 11,    // request could not be scheduled
120 	RTT_STATUS_FAIL_BUSY_TRY_LATER = 12,    // responder cannot collaborate at time of request
121 	RTT_STATUS_INVALID_REQ         = 13,    // bad request args
122 	RTT_STATUS_NO_WIFI             = 14,    // WiFi not enabled Responder overrides param info
123 						// cannot range with new params
124 	RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE = 15
125 } rtt_reason_t;
126 
127 enum {
128 	RTT_CAP_ONE_WAY	 = BIT(0),
129 	/* IEEE802.11mc */
130 	RTT_CAP_FTM_WAY  = BIT(1)
131 };
132 
133 enum {
134 	RTT_FEATURE_LCI = BIT(0),
135 	RTT_FEATURE_LCR = BIT(1),
136 	RTT_FEATURE_PREAMBLE = BIT(2),
137 	RTT_FEATURE_BW = BIT(3)
138 };
139 
140 enum {
141 	RTT_PREAMBLE_LEGACY = BIT(0),
142 	RTT_PREAMBLE_HT = BIT(1),
143 	RTT_PREAMBLE_VHT = BIT(2)
144 };
145 
146 enum {
147 	RTT_BW_5 = BIT(0),
148 	RTT_BW_10 = BIT(1),
149 	RTT_BW_20 = BIT(2),
150 	RTT_BW_40 = BIT(3),
151 	RTT_BW_80 = BIT(4),
152 	RTT_BW_160 = BIT(5)
153 };
154 
155 enum rtt_rate_bw {
156 	RTT_RATE_20M,
157 	RTT_RATE_40M,
158 	RTT_RATE_80M,
159 	RTT_RATE_160M
160 };
161 
162 typedef enum ranging_type {
163 	RTT_TYPE_INVALID	=	0,
164 	RTT_TYPE_LEGACY		=	1,
165 	RTT_TYPE_NAN_DIRECTED	=	2,
166 	RTT_TYPE_NAN_GEOFENCE	=	3
167 } ranging_type_t;
168 
169 typedef enum ranging_target_list_mode {
170 	RNG_TARGET_LIST_MODE_INVALID	=	0,
171 	RNG_TARGET_LIST_MODE_LEGACY	=	1,
172 	RNG_TARGET_LIST_MODE_NAN	=	2,
173 	RNG_TARGET_LIST_MODE_MIX	=	3
174 } ranging_target_list_mode_t;
175 
176 #define FTM_MAX_NUM_BURST_EXP	14
177 #define HAS_11MC_CAP(cap) (cap & RTT_CAP_FTM_WAY)
178 #define HAS_ONEWAY_CAP(cap) (cap & RTT_CAP_ONE_WAY)
179 #define HAS_RTT_CAP(cap) (HAS_ONEWAY_CAP(cap) || HAS_11MC_CAP(cap))
180 
181 typedef struct rtt_target_info {
182 	struct ether_addr addr;
183 	struct ether_addr local_addr;
184 	rtt_type_t type; /* rtt_type */
185 	rtt_peer_type_t peer; /* peer type */
186 	wifi_channel_info channel; /* channel information */
187 	chanspec_t chanspec; /* chanspec for channel */
188 	bool	disable; /* disable for RTT measurement */
189 	/*
190 	* Time interval between bursts (units: 100 ms).
191 	* Applies to 1-sided and 2-sided RTT multi-burst requests.
192 	* Range: 0-31, 0: no preference by initiator (2-sided RTT)
193 	*/
194 	uint32	burst_period;
195 	/*
196 	* Total number of RTT bursts to be executed. It will be
197 	* specified in the same way as the parameter "Number of
198 	* Burst Exponent" found in the FTM frame format. It
199 	* applies to both: 1-sided RTT and 2-sided RTT. Valid
200 	* values are 0 to 15 as defined in 802.11mc std.
201 	* 0 means single shot
202 	* The implication of this parameter on the maximum
203 	* number of RTT results is the following:
204 	* for 1-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst)
205 	* for 2-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst - 1)
206 	*/
207 	uint16 num_burst;
208 	/*
209 	* num of frames per burst.
210 	* Minimum value = 1, Maximum value = 31
211 	* For 2-sided this equals the number of FTM frames
212 	* to be attempted in a single burst. This also
213 	* equals the number of FTM frames that the
214 	* initiator will request that the responder send
215 	* in a single frame
216 	*/
217 	uint32 num_frames_per_burst;
218 	/*
219 	 * num of frames in each RTT burst
220 	 * for single side, measurement result num = frame number
221 	 * for 2 side RTT, measurement result num  = frame number - 1
222 	 */
223 	uint32 num_retries_per_ftm; /* retry time for RTT measurment frame */
224 	/* following fields are only valid for 2 side RTT */
225 	uint32 num_retries_per_ftmr;
226 	uint8  LCI_request;
227 	uint8  LCR_request;
228 	/*
229 	* Applies to 1-sided and 2-sided RTT. Valid values will
230 	* be 2-11 and 15 as specified by the 802.11mc std for
231 	* the FTM parameter burst duration. In a multi-burst
232 	* request, if responder overrides with larger value,
233 	* the initiator will return failure. In a single-burst
234 	* request if responder overrides with larger value,
235 	* the initiator will sent TMR_STOP to terminate RTT
236 	* at the end of the burst_duration it requested.
237 	*/
238 	uint32 burst_duration;
239 	uint32 burst_timeout;
240 	uint8  preamble; /* 1 - Legacy, 2 - HT, 4 - VHT */
241 	uint8  bw;  /* 5, 10, 20, 40, 80, 160 */
242 } rtt_target_info_t;
243 
244 typedef struct rtt_goefence_target_info {
245 	bool valid;
246 	struct ether_addr peer_addr;
247 } rtt_geofence_target_info_t;
248 
249 typedef struct rtt_config_params {
250 	int8 rtt_target_cnt;
251 	uint8 target_list_mode;
252 	rtt_target_info_t *target_info;
253 } rtt_config_params_t;
254 
255 typedef struct rtt_geofence_setup_status {
256 	bool geofence_setup_inprog; /* Lock to serialize geofence setup */
257 	struct nan_ranging_inst *rng_inst; /* Locked for this ranging instance */
258 } rtt_geofence_setup_status_t;
259 
260 typedef struct rtt_geofence_cfg {
261 	int8 geofence_target_cnt;
262 	int8 cur_target_idx;
263 	rtt_geofence_target_info_t geofence_target_info[RTT_MAX_GEOFENCE_TARGET_CNT];
264 	int geofence_rtt_interval;
265 	int max_geofence_sessions; /* Polled from FW via IOVAR Query */
266 	int geofence_sessions_cnt; /* No. of Geofence/Resp Sessions running currently */
267 	rtt_geofence_setup_status_t geofence_setup_status;
268 #ifdef RTT_GEOFENCE_CONT
269 	bool geofence_cont;
270 #endif /* RTT_GEOFENCE_CONT */
271 } rtt_geofence_cfg_t;
272 
273 typedef struct rtt_directed_setup_status {
274 	bool directed_na_setup_inprog; /* Lock to serialize directed setup */
275 	struct nan_ranging_inst *rng_inst; /* Locked for this ranging instance */
276 } rtt_directed_setup_status_t;
277 
278 typedef struct rtt_directed_cfg {
279 	int directed_sessions_cnt; /* No. of Geofence/Resp Sessions running currently */
280 	rtt_directed_setup_status_t directed_setup_status;
281 } rtt_directed_cfg_t;
282 
283 /*
284  * Keep Adding more reasons
285  * going forward if needed
286  */
287 enum rtt_schedule_reason {
288 	RTT_SCHED_HOST_TRIGGER			= 1, /* On host command for directed RTT */
289 	RTT_SCHED_SUB_MATCH			= 2, /* on Sub Match for svc with range req */
290 	RTT_SCHED_DIR_TRIGGER_FAIL		= 3, /* On failure of Directed RTT Trigger */
291 	RTT_SCHED_DP_END			= 4, /* ON NDP End event from fw */
292 	RTT_SCHED_DP_REJECTED			= 5, /* On receving reject dp event from fw */
293 	RTT_SCHED_RNG_RPT_DIRECTED		= 6, /* On Ranging report for directed RTT */
294 	RTT_SCHED_RNG_TERM			= 7, /* On Range Term Indicator */
295 	RTT_SHCED_HOST_DIRECTED_TERM		= 8, /* On host terminating directed RTT sessions */
296 	RTT_SCHED_RNG_RPT_GEOFENCE		= 9, /* On Ranging report for geofence RTT */
297 	RTT_SCHED_RTT_RETRY_GEOFENCE		= 10, /* On Geofence Retry */
298 	RTT_SCHED_RNG_TERM_PEND_ROLE_CHANGE	= 11, /* On Rng Term, while pending role change */
299 	RTT_SCHED_RNG_TERM_SUB_SVC_CANCEL	= 12, /* Due rng canc attempt, on sub cancel */
300 	RTT_SCHED_RNG_TERM_SUB_SVC_UPD		= 13, /* Due rng canc attempt, on sub update */
301 	RTT_SCHED_RNG_TERM_PUB_RNG_CLEAR	= 14, /* Due rng canc attempt, on pub upd/timeout */
302 	RTT_SCHED_RNG_RESP_IND			= 15, /* Due to rng resp ind */
303 	RTT_SCHED_RNG_DIR_EXCESS_TARGET		= 16  /* On ssn end, if excess dir tgt pending */
304 };
305 
306 /*
307  * Keep Adding more invalid RTT states
308  * going forward if needed
309  */
310 enum rtt_invalid_state {
311 	RTT_STATE_VALID			= 0, /* RTT state is valid */
312 	RTT_STATE_INV_REASON_NDP_EXIST	= 1 /* RTT state invalid as ndp exists */
313 };
314 
315 typedef struct rtt_status_info {
316 	dhd_pub_t	*dhd;
317 	int8		status;   /* current status for the current entry */
318 	int8		txchain; /* current device tx chain */
319 	int		pm; /* to save current value of pm */
320 	int8		pm_restore; /* flag to reset the old value of pm */
321 	int8		cur_idx; /* current entry to do RTT */
322 	int8		start_idx; /* start index for RTT */
323 	bool		all_cancel; /* cancel all request once we got the cancel requet */
324 	uint32		flags; /* indicate whether device is configured as initiator or target */
325 	struct capability {
326 		int32 proto     :8;
327 		int32 feature   :8;
328 		int32 preamble  :8;
329 		int32 bw        :8;
330 	} rtt_capa; /* rtt capability */
331 	struct			mutex rtt_mutex;
332 	struct			mutex geofence_mutex;
333 	rtt_config_params_t	rtt_config;
334 	rtt_geofence_cfg_t	geofence_cfg;
335 	rtt_directed_cfg_t	directed_cfg;
336 	struct work_struct	work;
337 	struct list_head	noti_fn_list;
338 	struct list_head	rtt_results_cache; /* store results for RTT */
339 	int			rtt_sched_reason; /* rtt_schedule_reason: what scheduled RTT */
340 	struct delayed_work	proxd_timeout; /* Proxd Timeout work */
341 	struct delayed_work	rtt_retry_timer;   /* Timer for retry RTT after all targets done */
342 	bool			rtt_sched; /* TO serialize rtt thread */
343 	int			max_nan_rtt_sessions; /* To be Polled from FW via IOVAR Query */
344 } rtt_status_info_t;
345 
346 typedef struct rtt_report {
347 	struct ether_addr addr;
348 	unsigned int burst_num; /* # of burst inside a multi-burst request */
349 	unsigned int ftm_num; /* total RTT measurement frames attempted */
350 	unsigned int success_num; /* total successful RTT measurement frames */
351 	uint8  num_per_burst_peer; /* max number of FTM number per burst the peer support */
352 	rtt_reason_t status; /* raging status */
353 	/* in s, 11mc only, only for RTT_REASON_FAIL_BUSY_TRY_LATER, 1- 31s */
354 	uint8 retry_after_duration;
355 	rtt_type_t type; /* rtt type */
356 	wifi_rssi_rtt  rssi; /* average rssi in 0.5 dB steps e.g. 143 implies -71.5 dB */
357 	wifi_rssi_rtt  rssi_spread; /* rssi spread in 0.5 db steps e.g. 5 implies 2.5 spread */
358 	/*
359 	* 1-sided RTT: TX rate of RTT frame.
360 	* 2-sided RTT: TX rate of initiator's Ack in response to FTM frame.
361 	*/
362 	wifi_rate_v1 tx_rate;
363 	/*
364 	* 1-sided RTT: TX rate of Ack from other side.
365 	* 2-sided RTT: TX rate of FTM frame coming from responder.
366 	*/
367 	wifi_rate_v1 rx_rate;
368 	wifi_timespan rtt;	/*  round trip time in 0.1 nanoseconds */
369 	wifi_timespan rtt_sd;	/* rtt standard deviation in 0.1 nanoseconds */
370 	wifi_timespan rtt_spread; /* difference between max and min rtt times recorded */
371 	int distance; /* distance in cm (optional) */
372 	int distance_sd; /* standard deviation in cm (optional) */
373 	int distance_spread; /* difference between max and min distance recorded (optional) */
374 	wifi_timestamp ts; /* time of the measurement (in microseconds since boot) */
375 	int burst_duration; /* in ms, how long the FW time is to fininish one burst measurement */
376 	int negotiated_burst_num; /* Number of bursts allowed by the responder */
377 	bcm_tlv_t *LCI; /* LCI Report */
378 	bcm_tlv_t *LCR; /* Location Civic Report */
379 } rtt_report_t;
380 #define RTT_REPORT_SIZE (sizeof(rtt_report_t))
381 
382 /* rtt_results_header to maintain rtt result list per mac address */
383 typedef struct rtt_results_header {
384 	struct ether_addr peer_mac;
385 	uint32 result_cnt;
386 	uint32 result_tot_len; /* sum of report_len of rtt_result */
387 	struct list_head list;
388 	struct list_head result_list;
389 } rtt_results_header_t;
390 struct rtt_result_detail {
391 	uint8 num_ota_meas;
392 	uint32 result_flags;
393 };
394 /* rtt_result to link all of rtt_report */
395 typedef struct rtt_result {
396 	struct list_head list;
397 	struct rtt_report report;
398 	int32 report_len; /* total length of rtt_report */
399 	struct rtt_result_detail rtt_detail;
400 	int32 detail_len;
401 } rtt_result_t;
402 
403 /* RTT Capabilities */
404 typedef struct rtt_capabilities {
405 	uint8 rtt_one_sided_supported;  /* if 1-sided rtt data collection is supported */
406 	uint8 rtt_ftm_supported;        /* if ftm rtt data collection is supported */
407 	uint8 lci_support;		/* location configuration information */
408 	uint8 lcr_support;		/* Civic Location */
409 	uint8 preamble_support;         /* bit mask indicate what preamble is supported */
410 	uint8 bw_support;               /* bit mask indicate what BW is supported */
411 } rtt_capabilities_t;
412 
413 /* RTT responder information */
414 typedef struct wifi_rtt_responder {
415 	wifi_channel_info channel;   /* channel of responder */
416 	uint8 preamble;             /* preamble supported by responder */
417 } wifi_rtt_responder_t;
418 
419 typedef void (*dhd_rtt_compl_noti_fn)(void *ctx, void *rtt_data);
420 /* Linux wrapper to call common dhd_rtt_set_cfg */
421 int dhd_dev_rtt_set_cfg(struct net_device *dev, void *buf);
422 
423 int dhd_dev_rtt_cancel_cfg(struct net_device *dev, struct ether_addr *mac_list, int mac_cnt);
424 
425 int dhd_dev_rtt_register_noti_callback(struct net_device *dev, void *ctx,
426 	dhd_rtt_compl_noti_fn noti_fn);
427 
428 int dhd_dev_rtt_unregister_noti_callback(struct net_device *dev, dhd_rtt_compl_noti_fn noti_fn);
429 
430 int dhd_dev_rtt_capability(struct net_device *dev, rtt_capabilities_t *capa);
431 
432 int dhd_dev_rtt_avail_channel(struct net_device *dev, wifi_channel_info *channel_info);
433 
434 int dhd_dev_rtt_enable_responder(struct net_device *dev, wifi_channel_info *channel_info);
435 
436 int dhd_dev_rtt_cancel_responder(struct net_device *dev);
437 /* export to upper layer */
438 chanspec_t dhd_rtt_convert_to_chspec(wifi_channel_info channel);
439 
440 int dhd_rtt_idx_to_burst_duration(uint idx);
441 
442 int dhd_rtt_set_cfg(dhd_pub_t *dhd, rtt_config_params_t *params);
443 
444 #ifdef WL_NAN
445 void dhd_rtt_initialize_geofence_cfg(dhd_pub_t *dhd);
446 #ifdef RTT_GEOFENCE_CONT
447 void dhd_rtt_set_geofence_cont_ind(dhd_pub_t *dhd, bool geofence_cont);
448 
449 void dhd_rtt_get_geofence_cont_ind(dhd_pub_t *dhd, bool* geofence_cont);
450 #endif /* RTT_GEOFENCE_CONT */
451 
452 #ifdef RTT_GEOFENCE_INTERVAL
453 void dhd_rtt_set_geofence_rtt_interval(dhd_pub_t *dhd, int interval);
454 #endif /* RTT_GEOFENCE_INTERVAL */
455 
456 int dhd_rtt_get_geofence_max_sessions(dhd_pub_t *dhd);
457 
458 bool dhd_rtt_geofence_sessions_maxed_out(dhd_pub_t *dhd);
459 
460 int dhd_rtt_get_geofence_sessions_cnt(dhd_pub_t *dhd);
461 
462 int dhd_rtt_update_geofence_sessions_cnt(dhd_pub_t *dhd, bool incr,
463 	struct ether_addr *peer_addr);
464 
465 int8 dhd_rtt_get_geofence_target_cnt(dhd_pub_t *dhd);
466 
467 rtt_geofence_target_info_t* dhd_rtt_get_geofence_target_head(dhd_pub_t *dhd);
468 
469 rtt_geofence_target_info_t* dhd_rtt_get_geofence_current_target(dhd_pub_t *dhd);
470 
471 rtt_geofence_target_info_t*
472 dhd_rtt_get_geofence_target(dhd_pub_t *dhd, struct ether_addr* peer_addr,
473 	int8 *index);
474 
475 int dhd_rtt_add_geofence_target(dhd_pub_t *dhd, rtt_geofence_target_info_t  *target);
476 
477 int dhd_rtt_remove_geofence_target(dhd_pub_t *dhd, struct ether_addr *peer_addr);
478 
479 int dhd_rtt_delete_geofence_target_list(dhd_pub_t *dhd);
480 
481 int dhd_rtt_delete_nan_session(dhd_pub_t *dhd);
482 
483 bool dhd_rtt_nan_is_directed_setup_in_prog(dhd_pub_t *dhd);
484 
485 bool dhd_rtt_nan_is_directed_setup_in_prog_with_peer(dhd_pub_t *dhd,
486 	struct ether_addr *peer);
487 
488 void dhd_rtt_nan_update_directed_setup_inprog(dhd_pub_t *dhd,
489 	struct nan_ranging_inst *rng_inst, bool inprog);
490 
491 bool dhd_rtt_nan_directed_sessions_allowed(dhd_pub_t *dhd);
492 
493 bool dhd_rtt_nan_all_directed_sessions_triggered(dhd_pub_t *dhd);
494 
495 void dhd_rtt_nan_update_directed_sessions_cnt(dhd_pub_t *dhd, bool incr);
496 #endif /* WL_NAN */
497 
498 uint8 dhd_rtt_invalid_states(struct net_device *ndev, struct ether_addr *peer_addr);
499 
500 int8 dhd_rtt_get_cur_target_idx(dhd_pub_t *dhd);
501 
502 int8 dhd_rtt_set_next_target_idx(dhd_pub_t *dhd, int start_idx);
503 
504 void dhd_rtt_schedule_rtt_work_thread(dhd_pub_t *dhd, int sched_reason);
505 
506 int dhd_rtt_stop(dhd_pub_t *dhd, struct ether_addr *mac_list, int mac_cnt);
507 
508 int dhd_rtt_register_noti_callback(dhd_pub_t *dhd, void *ctx, dhd_rtt_compl_noti_fn noti_fn);
509 
510 int dhd_rtt_unregister_noti_callback(dhd_pub_t *dhd, dhd_rtt_compl_noti_fn noti_fn);
511 
512 int dhd_rtt_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data);
513 
514 int dhd_rtt_capability(dhd_pub_t *dhd, rtt_capabilities_t *capa);
515 
516 int dhd_rtt_avail_channel(dhd_pub_t *dhd, wifi_channel_info *channel_info);
517 
518 int dhd_rtt_enable_responder(dhd_pub_t *dhd, wifi_channel_info *channel_info);
519 
520 int dhd_rtt_cancel_responder(dhd_pub_t *dhd);
521 
522 int dhd_rtt_attach(dhd_pub_t *dhd);
523 
524 int dhd_rtt_detach(dhd_pub_t *dhd);
525 
526 int dhd_rtt_init(dhd_pub_t *dhd);
527 
528 int dhd_rtt_deinit(dhd_pub_t *dhd);
529 
530 #ifdef WL_CFG80211
531 #ifdef WL_NAN
532 int dhd_rtt_handle_nan_rtt_session_end(dhd_pub_t *dhd,
533 	struct ether_addr *peer);
534 
535 void dhd_rtt_move_geofence_cur_target_idx_to_next(dhd_pub_t *dhd);
536 
537 int8 dhd_rtt_get_geofence_cur_target_idx(dhd_pub_t *dhd);
538 
539 void dhd_rtt_set_geofence_cur_target_idx(dhd_pub_t *dhd, int8 idx);
540 
541 rtt_geofence_setup_status_t* dhd_rtt_get_geofence_setup_status(dhd_pub_t *dhd);
542 
543 bool dhd_rtt_is_geofence_setup_inprog(dhd_pub_t *dhd);
544 
545 bool dhd_rtt_is_geofence_setup_inprog_with_peer(dhd_pub_t *dhd,
546 	struct ether_addr *peer_addr);
547 
548 void dhd_rtt_set_geofence_setup_status(dhd_pub_t *dhd, bool inprog,
549 	struct ether_addr *peer_addr);
550 
551 int dhd_rtt_get_max_nan_rtt_sessions_supported(dhd_pub_t *dhd);
552 #endif /* WL_NAN */
553 #endif /* WL_CFG80211 */
554 
555 #endif /* __DHD_RTT_H__ */
556