1 /*
2  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: Implement API's specific to CoAP component.
19  */
20 
21 #ifndef _WMI_UNIFIED_COAP_API_H_
22 #define _WMI_UNIFIED_COAP_API_H_
23 
24 #include <wmi_unified_priv.h>
25 
26 #ifdef WLAN_FEATURE_COAP
27 /**
28  * wmi_unified_coap_add_pattern_cmd() - Add pattern for CoAP offload reply
29  * @wmi_handle: wmi handle
30  * @param: parameters for CoAP offload reply
31  *
32  * Return: status of operation
33  */
34 static inline QDF_STATUS
wmi_unified_coap_add_pattern_cmd(wmi_unified_t wmi_handle,struct coap_offload_reply_param * param)35 wmi_unified_coap_add_pattern_cmd(wmi_unified_t wmi_handle,
36 				 struct coap_offload_reply_param *param)
37 {
38 	if (wmi_handle->ops->send_coap_add_pattern_cmd)
39 		return wmi_handle->ops->send_coap_add_pattern_cmd(wmi_handle,
40 								  param);
41 
42 	return QDF_STATUS_E_NOSUPPORT;
43 }
44 
45 /**
46  * wmi_unified_coap_del_pattern_cmd() - Delete pattern for CoAP offload reply
47  * @wmi_handle: wmi handle
48  * @vdev_id: vdev id
49  * @pattern_id: pattern id
50  *
51  * Return: status of operation
52  */
53 static inline QDF_STATUS
wmi_unified_coap_del_pattern_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint32_t pattern_id)54 wmi_unified_coap_del_pattern_cmd(wmi_unified_t wmi_handle,
55 				 uint8_t vdev_id, uint32_t pattern_id)
56 {
57 	if (wmi_handle->ops->send_coap_del_pattern_cmd)
58 		return wmi_handle->ops->send_coap_del_pattern_cmd(wmi_handle,
59 		vdev_id, pattern_id);
60 
61 	return QDF_STATUS_E_NOSUPPORT;
62 }
63 
64 /**
65  * wmi_unified_coap_add_keepalive_pattern_cmd() - Add pattern for CoAP offload
66  * periodic transmitting
67  * @wmi_handle: wmi handle
68  * @param: parameters for CoAP offload periodic transmitting
69  *
70  * Return: status of operation
71  */
72 static inline QDF_STATUS
wmi_unified_coap_add_keepalive_pattern_cmd(wmi_unified_t wmi_handle,struct coap_offload_periodic_tx_param * param)73 wmi_unified_coap_add_keepalive_pattern_cmd(wmi_unified_t wmi_handle,
74 			struct coap_offload_periodic_tx_param *param)
75 {
76 	if (wmi_handle->ops->send_coap_add_keepalive_pattern_cmd)
77 		return wmi_handle->ops->send_coap_add_keepalive_pattern_cmd(
78 					wmi_handle, param);
79 
80 	return QDF_STATUS_E_NOSUPPORT;
81 }
82 
83 /**
84  * wmi_unified_coap_del_keepalive_pattern_cmd() - Delete pattern for CoAP
85  *                                                offload periodic transmitting
86  * @wmi_handle: wmi handle
87  * @vdev_id: vdev id
88  * @pattern_id: pattern id
89  *
90  * Return: status of operation
91  */
92 static inline QDF_STATUS
wmi_unified_coap_del_keepalive_pattern_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint32_t pattern_id)93 wmi_unified_coap_del_keepalive_pattern_cmd(wmi_unified_t wmi_handle,
94 					   uint8_t vdev_id,
95 					   uint32_t pattern_id)
96 {
97 	if (wmi_handle->ops->send_coap_del_keepalive_pattern_cmd)
98 		return wmi_handle->ops->send_coap_del_keepalive_pattern_cmd(
99 					wmi_handle, vdev_id, pattern_id);
100 
101 	return QDF_STATUS_E_NOSUPPORT;
102 }
103 
104 /**
105  * wmi_unified_coap_cache_get() - Get cached CoAP messages
106  * @wmi_handle: wmi handle
107  * @vdev_id: vdev id
108  * @pattern_id: pattern id
109  *
110  * Return: status of operation
111  */
112 static inline QDF_STATUS
wmi_unified_coap_cache_get(wmi_unified_t wmi_handle,uint8_t vdev_id,uint32_t pattern_id)113 wmi_unified_coap_cache_get(wmi_unified_t wmi_handle,
114 			   uint8_t vdev_id, uint32_t pattern_id)
115 {
116 	if (wmi_handle->ops->send_coap_cache_get_cmd)
117 		return wmi_handle->ops->send_coap_cache_get_cmd(wmi_handle,
118 		vdev_id, pattern_id);
119 
120 	return QDF_STATUS_E_NOSUPPORT;
121 }
122 
123 /**
124  * wmi_unified_coap_extract_buf_info() - extract CoAP buf info from event
125  * @wmi_handle: wmi handle
126  * @evt_buf: pointer to event buffer
127  * @info: Pointer to hold CoAP buf info
128  *
129  * The caller needs to free any possible nodes in info->info_list
130  * regardless of failure or success.
131  *
132  * Return: status of operation
133  */
134 static inline QDF_STATUS
wmi_unified_coap_extract_buf_info(wmi_unified_t wmi_handle,void * evt_buf,struct coap_buf_info * info)135 wmi_unified_coap_extract_buf_info(wmi_unified_t wmi_handle, void *evt_buf,
136 				  struct coap_buf_info *info)
137 {
138 	if (wmi_handle->ops->extract_coap_buf_info) {
139 		return wmi_handle->ops->extract_coap_buf_info(wmi_handle,
140 							      evt_buf,
141 							      info);
142 	}
143 
144 	return QDF_STATUS_E_NOSUPPORT;
145 }
146 #endif
147 #endif /* _WMI_UNIFIED_ROAM_API_H_ */
148