xref: /wlan-driver/qcacld-3.0/core/wma/src/wma_nan_datapath.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: wma_nan_datapath.h
22  *
23  * WMA NAN Data path API specification
24  */
25 
26 #ifndef __WMA_NAN_DATAPATH_H
27 #define __WMA_NAN_DATAPATH_H
28 
29 #include <sir_common.h>
30 #include <ani_global.h>
31 #include "wma.h"
32 #include "sir_api.h"
33 #include "sme_nan_datapath.h"
34 
wma_ndp_wow_event_callback(void * handle,void * event,uint32_t len,uint32_t event_id)35 static inline int wma_ndp_wow_event_callback(void *handle, void *event,
36 					     uint32_t len, uint32_t event_id)
37 {
38 	return 0;
39 }
40 
wma_ndp_get_eventid_from_tlvtag(uint32_t tag)41 static inline uint32_t wma_ndp_get_eventid_from_tlvtag(uint32_t tag)
42 {
43 	return 0;
44 }
45 
46 #ifdef WLAN_FEATURE_NAN
47 #define WMA_IS_VDEV_IN_NDI_MODE(intf, vdev_id) \
48 				(WMI_VDEV_TYPE_NDI == intf[vdev_id].type)
49 
50 /**
51  * wma_add_sta_ndi_mode() - Process ADD_STA for NaN Data path
52  * @wma: wma handle
53  * @add_sta: Parameters of ADD_STA command
54  *
55  * Sends CREATE_PEER command to firmware
56  * Return: QDF status
57  */
58 QDF_STATUS  wma_add_sta_ndi_mode(tp_wma_handle wma, tpAddStaParams add_sta);
59 
60 /**
61  * wma_update_hdd_cfg_ndp() - Update target device NAN datapath capability
62  * @wma_handle: pointer to WMA context
63  * @tgt_cfg: Pointer to target configuration data structure
64  *
65  * Return: none
66  */
wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,struct wma_tgt_cfg * tgt_cfg)67 static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
68 					struct wma_tgt_cfg *tgt_cfg)
69 {
70 	tgt_cfg->nan_datapath_enabled = wma_handle->nan_datapath_enabled;
71 }
72 
73 /**
74  * wma_delete_sta_req_ndi_mode() - Process DEL_STA request for NDI data peer
75  * @wma: WMA context
76  * @del_sta: DEL_STA parameters from LIM
77  *
78  * Removes wma/txrx peer entry for the NDI STA
79  *
80  * Returns: QDF_STATUS_SUCCESS if peer deletion is successful
81  */
82 QDF_STATUS wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
83 				       tpDeleteStaParams del_sta);
84 
85 /**
86  * wma_is_ndi_active() - Determines of the nan data iface is active
87  * @wma_handle: handle to wma context
88  *
89  * Returns: true if ndi active, flase otherwise
90  */
wma_is_ndi_active(tp_wma_handle wma_handle)91 static inline bool wma_is_ndi_active(tp_wma_handle wma_handle)
92 {
93 	int i;
94 
95 	for (i = 0; i < wma_handle->max_bssid; i++) {
96 		if (wma_handle->interfaces[i].type == WMI_VDEV_TYPE_NDI &&
97 				wma_handle->interfaces[i].peer_count > 0)
98 			return true;
99 	}
100 	return false;
101 }
102 #else /* WLAN_FEATURE_NAN */
103 #define WMA_IS_VDEV_IN_NDI_MODE(intf, vdev_id) (false)
wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,struct wma_tgt_cfg * tgt_cfg)104 static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
105 					struct wma_tgt_cfg *tgt_cfg)
106 {
107 	return;
108 }
109 
110 static inline
wma_delete_sta_req_ndi_mode(tp_wma_handle wma,tpDeleteStaParams del_sta)111 QDF_STATUS wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
112 				       tpDeleteStaParams del_sta)
113 {
114 	return QDF_STATUS_E_NOSUPPORT;
115 }
116 
117 static inline
wma_add_sta_ndi_mode(tp_wma_handle wma,tpAddStaParams add_sta)118 QDF_STATUS wma_add_sta_ndi_mode(tp_wma_handle wma,
119 				tpAddStaParams add_sta)
120 {
121 	return QDF_STATUS_E_NOSUPPORT;
122 }
123 
wma_is_ndi_active(tp_wma_handle wma_handle)124 static inline bool wma_is_ndi_active(tp_wma_handle wma_handle) { return false; }
125 #endif /* WLAN_FEATURE_NAN */
126 
127 #endif /* __WMA_NAN_DATAPATH_H */
128