1 /*
2  * Copyright (c) 2013-2020 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  * This file contains the API definitions for the STA WMI APIs.
22  */
23 
24 #ifndef _WMI_UNIFIED_STA_PARAM_H_
25 #define _WMI_UNIFIED_STA_PARAM_H_
26 
27 /**
28  * struct sta_keep_alive_params - sta keep alive parameters
29  * @vdev_id: vdev id
30  * @method: keep alive method
31  * @timeperiod: time to keep alive
32  * @hostv4addr: host ipv4 address
33  * @destv4addr: destination ipv4 address
34  * @destmac: destination mac address
35  */
36 struct sta_keep_alive_params {
37 	uint8_t vdev_id;
38 	uint32_t method;
39 	uint32_t timeperiod;
40 	uint8_t hostv4addr[QDF_IPV4_ADDR_SIZE];
41 	uint8_t destv4addr[QDF_IPV4_ADDR_SIZE];
42 	uint8_t destmac[QDF_MAC_ADDR_SIZE];
43 };
44 
45 /**
46  * struct wmi_gtx_config - GTX config
47  * @gtx_rt_mask: for HT and VHT rate masks
48  * @gtx_usrcfg: host request for GTX mask
49  * @gtx_threshold: PER Threshold (default: 10%)
50  * @gtx_margin: PER margin (default: 2%)
51  * @gtx_tpcstep: TPC step (default: 1)
52  * @gtx_tpcmin: TPC min (default: 5)
53  * @gtx_bwmask: BW mask (20/40/80/160 Mhz)
54  */
55 struct wmi_gtx_config {
56 	uint32_t gtx_rt_mask[2];
57 	uint32_t gtx_usrcfg;
58 	uint32_t gtx_threshold;
59 	uint32_t gtx_margin;
60 	uint32_t gtx_tpcstep;
61 	uint32_t gtx_tpcmin;
62 	uint32_t gtx_bwmask;
63 };
64 
65 /**
66  * struct wlm_latency_level_param - WLM parameters
67  * @wlm_latency_level: wlm latency level to set
68  *  0 - normal, 1 - moderate, 2 - low, 3 - ultralow
69  * @wlm_latency_flags: wlm latency flags to set
70  *  |31  12|  11  |  10  |9    8|7    6|5    4|3    2|  1  |  0  |
71  *  +------+------+------+------+------+------+------+-----+-----+
72  *  | RSVD | SSLP | CSLP | RSVD | Roam | RSVD | DWLT | DFS | SUP |
73  *  +------+-------------+-------------+-------------------------+
74  *  |  WAL |      PS     |     Roam    |         Scan            |
75  *
76  *  bit 0: Avoid scan request from HLOS if setting
77  *  bit 1: Skip DFS channel SCAN if setting
78  *  bit 2-3: Define policy of dwell time/duration for each foreign channel
79  *     (b2 b3)
80  *     (0  0 ): Default scan dwell time
81  *     (0  1 ): Reserve
82  *     (1  0 ): Shrink off channel dwell time
83  *     (1  1 ): Reserve
84  *  bit 4-5: Reserve for scan
85  *  bit 6-7: Define roaming policy
86  *     (b6 b7)
87  *     (0  0 ): Default roaming behavior, allow roaming in all scenarios
88  *     (0  1 ): Disallow all roaming
89  *     (1  0 ): Allow roaming when final bmissed
90  *     (1  1 ): Reserve
91  *  bit 8-9: Reserve for roaming
92  *  bit 10: Disable css power collapse if setting
93  *  bit 11: Disable sys sleep if setting
94  *  bit 12-31: Reserve for future usage
95  * @vdev_id: vdev id
96  * @force_reset: bit 0 used as force reset to override the latency level as
97  * default for all the wlm clients
98  * @client_id_bitmask: clients of WLM Arbiter
99  */
100 struct wlm_latency_level_param {
101 	uint16_t wlm_latency_level;
102 	uint32_t wlm_latency_flags;
103 	uint16_t vdev_id;
104 #ifdef MULTI_CLIENT_LL_SUPPORT
105 	uint32_t force_reset;
106 	uint32_t client_id_bitmask;
107 #endif
108 };
109 
110 #define WMI_2_4_GHZ_MAX_FREQ  3000
111 
112 /**
113  * struct vdev_ie_info_param - IE info
114  * @vdev_id: vdev for which the IE is being sent
115  * @ie_id: ID of the IE
116  * @length: length of the IE data
117  * @ie_source:
118  * @band:
119  * @data: IE data
120  *
121  * This structure is used to store the IE information.
122  */
123 struct vdev_ie_info_param {
124 	uint32_t vdev_id;
125 	uint32_t ie_id;
126 	uint32_t length;
127 	uint32_t ie_source;
128 	uint32_t band;
129 	uint8_t *data;
130 };
131 
132 #define MAX_SAR_LIMIT_ROWS_SUPPORTED 64
133 /**
134  * struct sar_limit_cmd_row - sar limits row
135  * @band_id: Optional param for frequency band
136  *           See %enum wmi_sar_band_id_flags for possible values
137  * @chain_id: Optional param for antenna chain id
138  * @mod_id: Optional param for modulation scheme
139  *          See %enum wmi_sar_mod_id_flags for possible values
140  * @limit_value: Mandatory param providing power limits in steps of 0.5 dbm
141  * @validity_bitmap: bitmap of valid optional params in sar_limit_cmd_row struct
142  *                   See WMI_SAR_*_VALID_MASK for possible values
143  */
144 struct sar_limit_cmd_row {
145 	uint32_t band_id;
146 	uint32_t chain_id;
147 	uint32_t mod_id;
148 	uint32_t limit_value;
149 	uint32_t validity_bitmap;
150 };
151 
152 /**
153  * struct sar_limit_cmd_params - sar limits params
154  * @sar_enable: flag to enable SAR
155  *              See %enum wmi_sar_feature_state_flags for possible values
156  * @num_limit_rows: number of items in sar_limits
157  * @commit_limits: indicates firmware to start apply new SAR values
158  * @sar_limit_row_list: pointer to array of sar limit rows
159  */
160 struct sar_limit_cmd_params {
161 	uint32_t sar_enable;
162 	uint32_t num_limit_rows;
163 	uint32_t commit_limits;
164 	struct sar_limit_cmd_row *sar_limit_row_list;
165 };
166 
167 /**
168  * struct sar_limit_event_row - sar limits row
169  * @band_id: Frequency band.
170  *           See %enum wmi_sar_band_id_flags for possible values
171  * @chain_id: Chain id
172  * @mod_id: Modulation scheme
173  *          See %enum wmi_sar_mod_id_flags for possible values
174  * @limit_value: Power limits in steps of 0.5 dbm that is currently active for
175  *     the given @band_id, @chain_id, and @mod_id
176  */
177 struct sar_limit_event_row {
178 	uint32_t band_id;
179 	uint32_t chain_id;
180 	uint32_t mod_id;
181 	uint32_t limit_value;
182 };
183 
184 /**
185  * struct sar_limit_event - sar limits params
186  * @sar_enable: Current status of SAR enablement.
187  *              See %enum wmi_sar_feature_state_flags for possible values
188  * @num_limit_rows: number of items in sar_limits
189  * @sar_limit_row: array of sar limit rows. Only @num_limit_rows
190  *                 should be considered valid.
191  */
192 struct sar_limit_event {
193 	uint32_t sar_enable;
194 	uint32_t num_limit_rows;
195 	struct sar_limit_event_row
196 			sar_limit_row[MAX_SAR_LIMIT_ROWS_SUPPORTED];
197 };
198 
199 #define WMI_UNIFIED_MAX_PMKID_LEN   16
200 #define WMI_UNIFIED_MAX_PMK_LEN     64
201 
202 /**
203  * struct wmi_unified_pmk_cache - used to set del pmkid cache
204  * @vdev_id: ID of the vdev being configured
205  * @pmk_len: PMK len
206  *	for big-endian hosts, manual endian conversion will be needed to keep
207  *	the array values in their original order in spite of the automatic
208  *	byte-swap applied to WMI messages during download
209  * @pmk: PMK array
210  * @pmkid_len: PMK ID Len
211  * @pmkid: PMK ID Array
212  * @bssid: BSSID
213  * @ssid: SSID
214  * @cache_id: PMK Cache ID
215  * @cat_flag: whether (bssid) or (ssid,cache_id) is valid
216  * @action_flag: add/delete the entry
217  * @is_flush_all: FLAG to indicate PMKSA flush. True if PMKSA cache flush is
218  * needed.
219  */
220 struct wmi_unified_pmk_cache {
221 	uint8_t             vdev_id;
222 	uint32_t            pmk_len;
223 	uint8_t             pmk[WMI_UNIFIED_MAX_PMK_LEN];
224 	uint32_t            pmkid_len;
225 	uint8_t             pmkid[WMI_UNIFIED_MAX_PMKID_LEN];
226 	wmi_host_mac_addr   bssid;
227 	struct wlan_ssid    ssid;
228 	uint32_t            cache_id;
229 	uint32_t            cat_flag;
230 	uint32_t            action_flag;
231 	bool                is_flush_all;
232 };
233 
234 #define WMI_QOS_NUM_AC_MAX 4
235 
236 /**
237  * struct aggr_add_ts_param - ADDTS parameters
238  * @tspecIdx: TSPEC handler uniquely identifying a TSPEC for a STA in a BSS
239  * @tspec: tspec value
240  * @status: QDF status
241  * @sessionId: session id
242  * @vdev_id: vdev id
243  */
244 struct aggr_add_ts_param {
245 	uint16_t tspecIdx;
246 	struct mac_tspec_ie tspec[WMI_QOS_NUM_AC_MAX];
247 	QDF_STATUS status[WMI_QOS_NUM_AC_MAX];
248 	uint8_t sessionId;
249 	uint8_t vdev_id;
250 };
251 
252 #define WMI_PERIODIC_TX_PTRN_MAX_SIZE 1536
253 /**
254  * struct periodic_tx_pattern - periodic tx pattern
255  * @mac_address: MAC Address for the adapter
256  * @ucPtrnId: Pattern ID
257  * @ucPtrnSize: Pattern size
258  * @usPtrnIntervalMs: in ms
259  * @ucPattern: Pattern buffer
260  */
261 struct periodic_tx_pattern {
262 	struct qdf_mac_addr mac_address;
263 	uint8_t ucPtrnId;
264 	uint16_t ucPtrnSize;
265 	uint32_t usPtrnIntervalMs;
266 	uint8_t ucPattern[WMI_PERIODIC_TX_PTRN_MAX_SIZE];
267 };
268 
269 /**
270  * struct flashing_req_params - led flashing parameter
271  * @req_id: request id
272  * @pattern_id: pattern identifier. 0: disconnected 1: connected
273  * @led_x0: led flashing parameter0
274  * @led_x1: led flashing parameter1
275  */
276 struct flashing_req_params {
277 	uint32_t req_id;
278 	uint32_t pattern_id;
279 	uint32_t led_x0;
280 	uint32_t led_x1;
281 };
282 
283 /**
284  * struct wmi_pcl_chan_weights - Params to get the valid weighed list
285  * @pcl_list: channel freq list sorted in preferred order
286  * @pcl_len: Length of the PCL
287  * @saved_chan_list: Valid channel freq list updated as part of
288  * WMA_UPDATE_CHAN_LIST_REQ
289  * @saved_num_chan: Length of the valid channel list
290  * @weighed_valid_list: Weights of the valid channel list. This will have one
291  * to one mapping with valid_chan_list. FW expects channel order and size to be
292  * as per the list provided in WMI_SCAN_CHAN_LIST_CMDID.
293  * @weight_list: Weights assigned by policy manager
294  */
295 struct wmi_pcl_chan_weights {
296 	uint32_t pcl_list[NUM_CHANNELS];
297 	uint32_t pcl_len;
298 	uint32_t saved_chan_list[NUM_CHANNELS];
299 	uint32_t saved_num_chan;
300 	uint8_t weighed_valid_list[NUM_CHANNELS];
301 	uint8_t weight_list[NUM_CHANNELS];
302 };
303 
304 /**
305  * struct wmi_adaptive_dwelltime_params - the adaptive dwelltime params
306  * @vdev_id: vdev id
307  * @is_enabled: Adaptive dwell time is enabled/disabled
308  * @dwelltime_mode: global default adaptive dwell mode
309  * @lpf_weight: weight to calculate the average low pass
310  * filter for channel congestion
311  * @passive_mon_intval: intval to monitor wifi activity in passive scan in msec
312  * @wifi_act_threshold: % of wifi activity used in passive scan 0-100
313  *
314  */
315 struct wmi_adaptive_dwelltime_params {
316 	uint32_t vdev_id;
317 	bool is_enabled;
318 	enum scan_dwelltime_adaptive_mode dwelltime_mode;
319 	uint8_t lpf_weight;
320 	uint8_t passive_mon_intval;
321 	uint8_t wifi_act_threshold;
322 };
323 
324 #define WMI_SCAN_CLIENT_MAX        7
325 
326 /**
327  * struct wmi_dbs_scan_sel_params - DBS scan selection params
328  * @num_clients: Number of scan clients dutycycle
329  * @pdev_id: pdev_id for identifying the MAC
330  * @module_id: scan client module id
331  * @num_dbs_scans: number of DBS scans
332  * @num_non_dbs_scans: number of non-DBS scans
333  */
334 struct wmi_dbs_scan_sel_params {
335 	uint32_t num_clients;
336 	uint32_t pdev_id;
337 	uint32_t module_id[WMI_SCAN_CLIENT_MAX];
338 	uint32_t num_dbs_scans[WMI_SCAN_CLIENT_MAX];
339 	uint32_t num_non_dbs_scans[WMI_SCAN_CLIENT_MAX];
340 };
341 
342 /**
343  * struct set_arp_stats - set/reset arp stats
344  * @vdev_id: session id
345  * @flag: enable/disable stats
346  * @pkt_type: type of packet(1 - arp)
347  * @ip_addr: subnet ipv4 address in case of encrypted packets
348  * @pkt_type_bitmap: pkt bitmap
349  * @tcp_src_port: tcp src port for pkt tracking
350  * @tcp_dst_port: tcp dst port for pkt tracking
351  * @icmp_ipv4: target ipv4 address to track ping packets
352  * @reserved: reserved
353  */
354 struct set_arp_stats {
355 	uint32_t vdev_id;
356 	uint8_t flag;
357 	uint8_t pkt_type;
358 	uint32_t ip_addr;
359 	uint32_t pkt_type_bitmap;
360 	uint32_t tcp_src_port;
361 	uint32_t tcp_dst_port;
362 	uint32_t icmp_ipv4;
363 	uint32_t reserved;
364 };
365 
366 /**
367  * struct get_arp_stats - get arp stats from firmware
368  * @pkt_type: packet type(1 - ARP)
369  * @vdev_id: session id
370  */
371 struct get_arp_stats {
372 	uint8_t pkt_type;
373 	uint32_t vdev_id;
374 };
375 
376 #endif /* _WMI_UNIFIED_STA_PARAM_H_ */
377