xref: /wlan-driver/qcacld-3.0/components/fw_offload/dispatcher/inc/wlan_fwol_public_structs.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 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: contains fw offload structure definitions
22  */
23 
24 #ifndef _WLAN_FWOL_PUBLIC_STRUCTS_H_
25 #define _WLAN_FWOL_PUBLIC_STRUCTS_H_
26 
27 #include "wlan_objmgr_psoc_obj.h"
28 #include "wlan_thermal_public_struct.h"
29 #include "wmi_unified.h"
30 
31 #ifdef WLAN_FEATURE_ELNA
32 
33 /**
34  * enum fwol_extlna_mode - provides elna modes
35  * @EXTLNA_MODE_DISABLE_ELNA_BYPASS:  disables elna bypass
36  * @EXTLNA_MODE_ENABLE_ELNA_BYPASS:   enables elna bypass
37  * @EXTLNA_MODE_FIRMWARE_DEFAULT:     Reset eLNA bypass configuration,
38  *                                    the driver should revert to the default
39  *                                    configuration of eLNA bypass
40  */
41 enum fwol_extlna_mode {
42 	EXTLNA_MODE_DISABLE_ELNA_BYPASS = 0,
43 	EXTLNA_MODE_ENABLE_ELNA_BYPASS,
44 	EXTLNA_MODE_FIRMWARE_DEFAULT,
45 };
46 
47 /**
48  * struct set_elna_bypass_request - set eLNA bypass request
49  * @vdev_id: vdev id
50  * @elna_mode:0 - disable eLNA bypass
51  *            1 - enable eLNA bypass
52  *            2 - firmware default
53  */
54 struct set_elna_bypass_request {
55 	uint8_t vdev_id;
56 	enum fwol_extlna_mode elna_mode;
57 };
58 
59 /**
60  * struct get_elna_bypass_request - get eLNA bypass request
61  * @vdev_id: vdev id
62  */
63 struct get_elna_bypass_request {
64 	uint8_t vdev_id;
65 };
66 
67 /**
68  * struct get_elna_bypass_response - get eLNA bypass response
69  * @vdev_id: vdev id
70  * @elna_mode:0 - disable eLNA bypass
71  *            1 - enable eLNA bypass
72  *            2 - firmware default
73  */
74 struct get_elna_bypass_response {
75 	uint8_t vdev_id;
76 	enum fwol_extlna_mode elna_mode;
77 };
78 #endif
79 
80 /**
81  * struct thermal_throttle_info - thermal throttle info from Target
82  * @temperature: current temperature in c Degree
83  * @level: target thermal level info
84  * @pdev_id: pdev id
85  * @therm_throt_levels: Number of thermal throttle levels
86  * @level_info: Thermal Stats for each level
87  */
88 struct thermal_throttle_info {
89 	uint32_t temperature;
90 	enum thermal_throttle_level level;
91 	uint32_t pdev_id;
92 	uint32_t therm_throt_levels;
93 	struct thermal_throt_level_stats level_info[WMI_THERMAL_STATS_TEMP_THRESH_LEVEL_MAX];
94 };
95 
96 /**
97  * struct wlan_fwol_callbacks - fw offload callbacks
98  * @get_elna_bypass_callback: callback for get eLNA bypass
99  * @get_elna_bypass_context: context for get eLNA bypass
100  * @get_thermal_stats_callback: callback for get thermal stats
101  * @get_thermal_stats_context: context for get thermal stats
102  */
103 struct wlan_fwol_callbacks {
104 #ifdef WLAN_FEATURE_ELNA
105 	void (*get_elna_bypass_callback)(void *context,
106 				     struct get_elna_bypass_response *response);
107 	void *get_elna_bypass_context;
108 #endif
109 #ifdef THERMAL_STATS_SUPPORT
110 	void (*get_thermal_stats_callback)(void *context,
111 				     struct thermal_throttle_info *response);
112 	void *get_thermal_stats_context;
113 #endif
114 };
115 
116 #ifdef WLAN_FEATURE_MDNS_OFFLOAD
117 
118 #define MDNS_FQDN_TYPE_GENERAL	(0)
119 /* Maximum length of FQDN string including the NULL byte */
120 #define MAX_FQDN_LEN		(64)
121 /* This length depends on the WMI Message and TLV Header size.
122  * ((WMI_SVC_MSG_MAX_SIZE - WMI_TLV_HDR_SIZE)
123  */
124 #define MAX_MDNS_RESP_LEN	(512)
125 
126 /**
127  * struct mdns_config_info - Multicast DNS configuration information
128  * @vdev_id: vdev id
129  * @enable: false - disable mdns
130  *          true - enable mdns
131  * @fqdn_type: FQDN type
132  * @fqdn_data: Fully Qualified Domain Name of the local network
133  * @fqdn_len: FQDN length
134  * @resource_record_count: Number Resource Records present in the answer payload
135  * @answer_payload_len: Length of the answer payload sent by mdnsResponder in userspace
136  * @answer_payload_data: Binary blob used to frame mdns response for mdns queries
137  */
138 struct mdns_config_info {
139 	uint32_t vdev_id;
140 	bool enable;
141 	uint32_t fqdn_type;
142 	uint32_t fqdn_len;
143 	uint8_t fqdn_data[MAX_FQDN_LEN];
144 	uint32_t resource_record_count;
145 	uint32_t answer_payload_len;
146 	uint8_t answer_payload_data[MAX_MDNS_RESP_LEN];
147 };
148 #endif
149 
150 /**
151  * struct wlan_fwol_tx_ops - structure of tx func pointers
152  * @set_elna_bypass: set eLNA bypass
153  * @get_elna_bypass: get eLNA bypass
154  * @reg_evt_handler: register event handler
155  * @unreg_evt_handler: unregister event handler
156  * @send_dscp_up_map_to_fw: send dscp-to-up map values to FW
157  * @set_mdns_config: set mdns config info
158  * @get_thermal_stats: send get_thermal_stats cmd to FW
159  */
160 struct wlan_fwol_tx_ops {
161 #ifdef WLAN_FEATURE_ELNA
162 	QDF_STATUS (*set_elna_bypass)(struct wlan_objmgr_psoc *psoc,
163 				      struct set_elna_bypass_request *req);
164 	QDF_STATUS (*get_elna_bypass)(struct wlan_objmgr_psoc *psoc,
165 				      struct get_elna_bypass_request *req);
166 #endif
167 	QDF_STATUS (*reg_evt_handler)(struct wlan_objmgr_psoc *psoc,
168 				      void *arg);
169 	QDF_STATUS (*unreg_evt_handler)(struct wlan_objmgr_psoc *psoc,
170 					void *arg);
171 #ifdef WLAN_SEND_DSCP_UP_MAP_TO_FW
172 	QDF_STATUS (*send_dscp_up_map_to_fw)(
173 			struct wlan_objmgr_psoc *psoc,
174 			uint32_t *dscp_to_up_map);
175 #endif
176 #ifdef WLAN_FEATURE_MDNS_OFFLOAD
177 	QDF_STATUS (*set_mdns_config)(struct wlan_objmgr_psoc *psoc,
178 				      struct mdns_config_info *mdns_info);
179 #endif
180 #ifdef THERMAL_STATS_SUPPORT
181 	QDF_STATUS (*get_thermal_stats)(struct wlan_objmgr_psoc *psoc,
182 				      enum thermal_stats_request_type req_type,
183 				      uint8_t therm_stats_offset);
184 #endif
185 };
186 
187 /**
188  * struct wlan_fwol_rx_ops - structure of rx func pointers
189  * @get_elna_bypass_resp: get eLNA bypass response
190  * @notify_thermal_throttle_handler: thermal stats indication callback to fwol
191  *  core from target if layer
192  * @get_thermal_stats_resp: thermal stats cmd response callback to fwol
193  */
194 struct wlan_fwol_rx_ops {
195 #ifdef WLAN_FEATURE_ELNA
196 	QDF_STATUS (*get_elna_bypass_resp)(struct wlan_objmgr_psoc *psoc,
197 					 struct get_elna_bypass_response *resp);
198 #endif
199 #ifdef FW_THERMAL_THROTTLE_SUPPORT
200 	QDF_STATUS (*notify_thermal_throttle_handler)(
201 				struct wlan_objmgr_psoc *psoc,
202 				struct thermal_throttle_info *info);
203 #endif
204 #ifdef THERMAL_STATS_SUPPORT
205 	QDF_STATUS (*get_thermal_stats_resp)(struct wlan_objmgr_psoc *psoc,
206 					    struct thermal_throttle_info *resp);
207 #endif
208 };
209 
210 /**
211  * struct fwol_thermal_callbacks - structure of rx callback to hdd layer
212  * @notify_thermal_throttle_handler: thermal throttle event callback
213  */
214 struct fwol_thermal_callbacks {
215 	QDF_STATUS (*notify_thermal_throttle_handler)(
216 					struct wlan_objmgr_psoc *psoc,
217 					struct thermal_throttle_info *info);
218 };
219 #endif /* _WLAN_FWOL_PUBLIC_STRUCTS_H_ */
220 
221