xref: /wlan-dirver/qca-wifi-host-cmn/target_if/cfr/inc/target_if_cfr_enh.h (revision ccbe42985c6c1f3dc6126b32352a4a4277478959)
1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-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 #ifndef _TARGET_IF_CFR_ENH_H_
21 #define _TARGET_IF_CFR_ENH_H_
22 
23 #ifdef WLAN_ENH_CFR_ENABLE
24 /*
25  * Memory requirements :
26  *
27  *  1. DMA header :
28  *
29  * Legacy DMA header(QCA8074V2) : 2 words (length = 8 bytes)
30  * Enhanced DMA header(QCA6018) : Upto 16 words depending on no. of MU users
31  *                       in UL-MU-PPDU (Max length = 64 bytes)
32  *
33  * Fixed 4 words for whal_cfir_enhanced_hdr + freeze TLV
34  *                                          + uplink_user_info TLV (MAX 4)
35  *
36  * mu_rx_num_users -> No. of words in CFR DMA header
37  * 0 -> 12  =  4 + 7(freeze TLV) + 1(for 64-bit alignment)
38  * 1 -> 12  =  4 + 7(freeze TLV) + 1(user1)
39  * 2 -> 14  =  4 + 7(freeze TLV) + 2(users 1,2) + 1(for 64-bit alignment)
40  * 3 -> 14  =  4 + 7(freeze TLV) + 3(users 1,2,3)
41  * 4 -> 16  =  4 + 7(freeze TLV) + 4(users 1,2,3,4) + 1(for 64-bit alignment)
42  *
43  *
44  * 2. CFR data size for max BW/Nss/Nrx
45  *
46  *	Cypress : Max BW = 80 MHz
47  *			 NSS = 2
48  *			 Nrx = 2
49  *			 Size of one tone = 4 bytes
50  *
51  *		a. RTT-H - 2048 bytes
52  *
53  *		b. Debug-H (MIMO CFR) - 16016 bytes
54  *
55  *		c. RTT-H + CIR - 10240 bytes = 2048(RTT-H) + 8192(CIR)
56  */
57 
58 /* Max 4 users in MU case */
59 #define CYP_CFR_MU_USERS 4
60 
61 #define CYP_MAX_HEADER_LENGTH_WORDS 16
62 
63 /* payload_len = Max(2048, 16016, 10240) = 16064 (64-bit alignment) */
64 #define CYP_MAX_DATA_LENGTH_BYTES 16064
65 
66 /* in ms */
67 #define LUT_AGE_TIMER 3000
68 #define LUT_AGE_THRESHOLD 3000
69 
70 /* Max size :
71  * sizeof(csi_cfr_header) + 64 bytes(cfr header) + 16064 bytes(cfr payload)
72  */
73 #define STREAMFS_MAX_SUBBUF_CYP \
74 	(sizeof(struct csi_cfr_header) + \
75 	 (CYP_MAX_HEADER_LENGTH_WORDS * 4) + \
76 	 CYP_MAX_DATA_LENGTH_BYTES)
77 
78 #define STREAMFS_NUM_SUBBUF_CYP 255
79 
80 /* Max 37 users in MU case for Pine */
81 #define PINE_CFR_MU_USERS 37
82 
83 #define PINE_MAX_HEADER_LENGTH_WORDS 50
84 
85 #define PINE_MAX_DATA_LENGTH_BYTES 16384
86 
87 /* Max size :
88  * sizeof(csi_cfr_header) + 200 bytes(cfr header) + 16384 bytes(cfr payload)
89  */
90 #define STREAMFS_MAX_SUBBUF_PINE \
91 	(sizeof(struct csi_cfr_header) + \
92 	 (PINE_MAX_HEADER_LENGTH_WORDS * 4) + \
93 	 PINE_MAX_DATA_LENGTH_BYTES)
94 
95 #define STREAMFS_NUM_SUBBUF_PINE 255
96 
97 /* Max 37 users in MU case for Waikiki */
98 #define WAIKIKI_CFR_MU_USERS 37
99 
100 #define WAIKIKI_MAX_HEADER_LENGTH_WORDS 88
101 
102 #define WAIKIKI_MAX_DATA_LENGTH_BYTES 64512
103 
104 /* Max size :
105  * sizeof(csi_cfr_header) + 352 bytes(cfr header) + 64512 bytes(cfr payload)
106  * where cfr_header size = rtt upload header len + freeze_tlv len +
107  *                         uplink user setup info + alignment/reserved bytes
108  *                       = 16bytes + 32bytes + (8bytes * 37users) + 8bytes
109  */
110 #define STREAMFS_MAX_SUBBUF_WAIKIKI \
111 	(sizeof(struct csi_cfr_header) + \
112 	 (WAIKIKI_MAX_HEADER_LENGTH_WORDS * 4) + \
113 	 WAIKIKI_MAX_DATA_LENGTH_BYTES)
114 
115 #define STREAMFS_NUM_SUBBUF_WAIKIKI  127
116 
117 /* Max 4 users in MU case for Spruce */
118 #define SPRUCE_CFR_MU_USERS 4
119 
120 #define SPRUCE_MAX_HEADER_LENGTH_WORDS 16
121 
122 #define SPRUCE_MAX_DATA_LENGTH_BYTES 16384
123 
124 /* Max size :
125  * sizeof(csi_cfr_header) + 200 bytes(cfr header) + 16384 bytes(cfr payload)
126  */
127 #define STREAMFS_MAX_SUBBUF_SPRUCE \
128 	(sizeof(struct csi_cfr_header) + \
129 	 (SPRUCE_MAX_HEADER_LENGTH_WORDS * 4) + \
130 	 SPRUCE_MAX_DATA_LENGTH_BYTES)
131 
132 #define STREAMFS_NUM_SUBBUF_SPRUCE 255
133 
134 /* Max 8 users in MU case for QCN6432 */
135 #define QCN6432_CFR_MU_USERS 8
136 
137 /* uCode header = (14 + (max number of MU users supported *2))*4 Bytes */
138 #define QCN6432_MAX_HEADER_LENGTH_WORDS 30
139 
140 /* Maximum number of tones that can be uploaded is 1001
141  * Max data len = Num tones per stream per chain * max chains
142  * max nss * size of tone
143  *              = 1001 * 2 * 4 * 4 = 32032 Bytes
144  * Total length = Max data len + ucode header
145  *              = 32032 + 120 = 32152 Bytes
146  */
147 #define QCN6432_MAX_DATA_LENGTH_BYTES 32152
148 
149 /* Max size :
150  * sizeof(csi_cfr_header) + 120 bytes(ucode header) + 32152 bytes(cfr payload)
151  */
152 #define STREAMFS_MAX_SUBBUF_QCN6432 \
153 	(sizeof(struct csi_cfr_header) + \
154 	 (QCN6432_MAX_HEADER_LENGTH_WORDS * 4) + \
155 	 QCN6432_MAX_DATA_LENGTH_BYTES)
156 
157 /* The number of buffers allotted by two IPC rings is 103.
158  * Hence, the relayFS should be have more than 103 buffers.
159  * Considering the maximum size of CFR log size to be 8MB
160  * and which should be multiple of relayFS buffer pool memory.
161  *
162  * Size of a relayFS buffer = csi metadata + QCN6432_MAX_DATA_LENGTH_BYTES
163  *                          = 310 + 32152
164  *                          = 32462 Bytes
165  *
166  * Num of streamfs sub buffers = 4MB / 32462B
167  *                             = 128 (approax)
168  */
169 #define STREAMFS_NUM_SUBBUF_QCN6432 128
170 
171 /* Max 4 users in MU case for QCA5332 */
172 #define QCA5332_CFR_MU_USERS 4
173 
174 #define QCA5332_MAX_HEADER_LENGTH_WORDS 22
175 
176 #define QCA5332_MAX_DATA_LENGTH_BYTES 8192
177 
178 /* Max size :
179  * sizeof(csi_cfr_header) + 88 bytes(cfr header) + 8192 bytes(cfr payload)
180  * where cfr_header size = rtt upload header len + freeze_tlv len +
181  *                         uplink user setup info + alignment/reserved bytes
182  *                       = 16bytes + 32bytes + (8bytes * 4users) + 8bytes
183  */
184 #define STREAMFS_MAX_SUBBUF_QCA5332 \
185 	(sizeof(struct csi_cfr_header) + \
186 	 (QCA5332_MAX_HEADER_LENGTH_WORDS * 4) + \
187 	QCA5332_MAX_DATA_LENGTH_BYTES)
188 
189 #define STREAMFS_NUM_SUBBUF_QCA5332 255
190 
191 /* enum macrx_freeze_tlv_version: Reported by uCode in enh_dma_header
192  * MACRX_FREEZE_TLV_VERSION_1: Single MU UL user info reported by MAC.
193  * This is used in Cypress/HastingsPrime chips. Corresponding structures are
194  * macrx_freeze_capture_channel and 1 uplink_user_setup_info.
195  *
196  * MACRX_FREEZE_TLV_VERSION_2: Upto 4 MU UL user info reported by MAC.
197  * This is used in Maple/Spruce/Moselle chips. Corresponding structures are
198  * macrx_freeze_capture_channel and 2 uplink_user_setup_info.
199  *
200  * MACRX_FREEZE_TLV_VERSION_3: Upto 37 MU UL user info reported by MAC.
201  * This is used in Pine chip. The corresponding structures are
202  * macrx_freeze_capture_channel_v3 and 37 uplink_user_setup_info.
203  *
204  * MACRX_FREEZE_TLV_VERSION_4: Upto 37 MU UL user info reported by MAC.
205  * This is used in Hamilton 1/2.
206  *
207  * MACRX_FREEZE_TLV_VERSION_5: Upto 37 MU UL user info reported by MAC.
208  * This is used in Waikiki chipsets.
209  */
210 enum macrx_freeze_tlv_version {
211 	MACRX_FREEZE_TLV_VERSION_1 = 1,
212 	MACRX_FREEZE_TLV_VERSION_2 = 2,
213 	MACRX_FREEZE_TLV_VERSION_3 = 3,
214 	MACRX_FREEZE_TLV_VERSION_4 = 4,
215 	MACRX_FREEZE_TLV_VERSION_5 = 5,
216 	MACRX_FREEZE_TLV_VERSION_MAX
217 };
218 
219 /* Max 4 users in MU case for Maple */
220 #define MAPLE_CFR_MU_USERS 4
221 
222 #define MAPLE_MAX_HEADER_LENGTH_WORDS 16
223 
224 #define MAPLE_MAX_DATA_LENGTH_BYTES 4096
225 
226 /* Max size :
227  * sizeof(csi_cfr_header) + 64 bytes(cfr uCode header) +
228  * 4096 bytes(cfr payload)
229  */
230 #define STREAMFS_MAX_SUBBUF_MAPLE \
231 	(sizeof(struct csi_cfr_header) + \
232 	 (MAPLE_MAX_HEADER_LENGTH_WORDS * 4) + \
233 	 MAPLE_MAX_DATA_LENGTH_BYTES)
234 
235 /*
236  * RelayFS memory required:
237  * Max sub buffer size * Number of sub buffers
238  *
239  * Cascade: (2200B  * 1100) ~= 2MB
240  * Dakota:  (1100B  * 2200) ~= 2MB
241  * Hawkeye: (8200B  * 255 ) ~= 2MB
242  * Cypress: (16438B * 255 ) ~= 4MB
243  * Pine   : (16894B * 255 ) ~= 4MB
244  * Maple  : (4470B *  255 ) ~= 1MB
245  *
246  */
247 #define STREAMFS_NUM_SUBBUF_MAPLE 255
248 
249 enum UCODE_UPLOAD_HEADER_VERSION {
250 	UPLOAD_HEADER_VERSION_1 = 1,
251 	UPLOAD_HEADER_VERSION_2 = 2,
252 	UPLOAD_HEADER_VERSION_3 = 3,
253 	UPLOAD_HEADER_VERSION_4 = 4,
254 	UPLOAD_HEADER_VERSION_8 = 8,
255 	UPLOAD_HEADER_VERSION_9 = 9,
256 	UPLOAD_HEADER_VERSION_MAX
257 };
258 
259 /*
260  * @tag: ucode fills this with 0xBA
261  *
262  * @length: length of CFR header in words (32-bit)
263  *
264  * @upload_done: ucode sets this to 1 to indicate DMA completion
265  *
266  * @capture_type:
267  *
268  *			0 - None
269  *			1 - RTT-H (Nss = 1, Nrx)
270  *			2 - Debug-H (Nss, Nrx)
271  *			3 - Reserved
272  *			5 - RTT-H + CIR(Nss, Nrx)
273  *
274  * @preamble_type:
275  *
276  *			0 - Legacy
277  *			1 - HT
278  *			2 - VHT
279  *			3 - HE
280  *
281  * @nss:
282  *
283  *			0 - 1-stream
284  *			1 - 2-stream
285  *			..	..
286  *			7 - 8-stream
287  *
288  *@num_chains:
289  *
290  *			0 - 1-chain
291  *			1 - 2-chain
292  *			..  ..
293  *			7 - 8-chain
294  *
295  *@upload_bw_pkt:
296  *
297  *			0 - 20 MHz
298  *			1 - 40 MHz
299  *			2 - 80 MHz
300  *			3 - 160 MHz
301  *
302  * @sw_peer_id_valid: Indicates whether sw_peer_id field is valid or not,
303  * sent from MAC to PHY via the MACRX_FREEZE_CAPTURE_CHANNEL TLV
304  *
305  * @sw_peer_id: Indicates peer id based on AST search, sent from MAC to PHY
306  * via the MACRX_FREEZE_CAPTURE_CHANNEL TLV
307  *
308  * @phy_ppdu_id: sent from PHY to MAC, copied to MACRX_FREEZE_CAPTURE_CHANNEL
309  * TLV
310  *
311  * @total_bytes: Total size of CFR payload (FFT bins)
312  *
313  * @header_version:
314  *
315  *			1 - HKV2/Hastings
316  *			2 - Cypress
317  *			3 - Hasting Prime
318  *			4 - Pine
319  *			8 - Hamilton
320  *			9 - Waikiki
321  *
322  * @target_id:
323  *
324  *			1 - Hastings
325  *			2 - Cypress
326  *			3 - Hastings Prime
327  *			4 - Pine
328  *
329  * @cfr_fmt:
330  *
331  *			0 - raw (32-bit format)
332  *			1 - compressed (24-bit format)
333  *
334  * @mu_rx_data_incl: Indicates whether CFR header contains UL-MU-MIMO info
335  *
336  * @freeze_data_incl: Indicates whether CFR header contains
337  * MACRX_FREEZE_CAPTURE_CHANNEL TLV
338  *
339  * @freeze_tlv_version: Indicates the version of freeze_tlv
340  *			1 - HSP, Cypress
341  *			2 - Maple/Spruce/Moselle
342  *			3 - Pine
343  *
344  * @decimation_factor: FFT bins decimation
345  * @mu_rx_num_users: Number of users in UL-MU-PPDU
346  */
347 struct whal_cfir_enhanced_hdr {
348 	uint16_t tag              :  8,
349 		 length           :  6,
350 		 rsvd1            :  2;
351 
352 	uint16_t upload_done        :  1,
353 		 capture_type       :  3,
354 		 preamble_type      :  2,
355 		 nss                :  3,
356 		 num_chains         :  3,
357 		 upload_pkt_bw      :  3,
358 		 sw_peer_id_valid   :  1;
359 
360 	uint16_t sw_peer_id         : 16;
361 
362 	uint16_t phy_ppdu_id        : 16;
363 
364 	uint16_t total_bytes;
365 
366 	uint16_t header_version     :4,
367 		 target_id          :4,
368 		 cfr_fmt            :1,
369 		 rsvd2              :1,
370 		 mu_rx_data_incl    :1,
371 		 freeze_data_incl   :1,
372 		 freeze_tlv_version :4;
373 
374 	uint16_t mu_rx_num_users   :8,
375 		 decimation_factor :4,
376 		 rsvd3             :4;
377 
378 	uint16_t rsvd4;
379 };
380 
381 /*
382  * freeze_tlv v1/v2 used by Hastings/Cypress/Maple/Spruce/Moselle supports upto
383  * 4 UL MU users
384  *
385  * @freeze:
386  *		0: Allow channel capture
387  *		1: Freeze channel capture
388  *
389  * @capture_reason: Field only valid when the freeze field is 1. Indicates why
390  * the MAC asked to capture the channel
391  *		0: freeze_reason_TM
392  *		1: freeze_reason_FTM
393  *		2: freeze_reason_ACK_resp_to_TM_FTM
394  *		3: freeze_reason_TA_RA_TYPE_FILTER
395  *		4: freeze readon NDP_NDP
396  *		5: freeze_reason_ALL_PACKET
397  *
398  * @packet_type: Packet type of captured packets.
399  *		0: Management
400  *		1: Control
401  *		2: Data
402  *		3: Extension
403  *
404  * @packet_sub_type: packet subtype of the captured packets.
405  * @sw_peer_id_valid: It is valid only when the freeze field is set to 1.
406  *		0: no TA address search on the received frame has been
407  *		   performed. This is due to the frame not having a TA address
408  *		   (like ACK frame), or the received frame being from an other
409  *		   AP to which this device is not associated.
410  *		1: field sw_peer_id will contain valid information.
411  *		   This implies that a (successful) address search has been
412  *		   performed on the TA address of the received frame.
413  *
414  * @sw_peer_id: Valid only when sw_peer_id_valid field is set. It is an
415  * identifier that allows SW to double check that the CSI info stored belongs
416  * to the device with this SW identifier.
417  *
418  * @phy_ppdu_id: ppdu_id of ppdu which has channel capture performed. Field
419  * only valid when the freeze field is set to 1.
420  *
421  * @packet_ta_lower_16: Packet’s lower 16bits transmit address in MAC header.
422  *
423  * @packet_ta_mid_16: Packet’s middle 16bits transmit address in MAC header.
424  *
425  * @packet_ta_upper_16: Packet’s upper 16bits transmit address in MAC header.
426  *
427  * @packet_ra_lower_16: Packet’s lower 16bits receive address in MAC header.
428  *
429  * @packet_ra_mid_16: Packet’s middle 16bits receive address in MAC header.
430  *
431  * @packet_ra_upper_16: Packet’s upper 16bits receive address in MAC header.
432  *
433  * @tsf_timestamp_15_0: MAC side 64bit TSF timestamp when this TLV is sent to
434  * PHY. Bits [15:0].
435  *
436  * @tsf_timestamp_31_16: MAC side 64bit TSF timestamp when this TLV is sent to
437  * PHY. Bits [31:16].
438  *
439  * @tsf_timestamp_47_32: MAC side 64bit TSF timestamp when this TLV is sent to
440  * PHY. Bits [47:32].
441  *
442  * @tsf_timestamp_63_48: MAC side 64bit TSF timestamp when this TLV is sent to
443  * PHY. Bits [63:48].
444  *
445  * @user_index_or_user_mask_5_0: When freeze_tlv_version is 1, this field from
446  * MAC, indicate to PHY which user's channel information need to be uploaded.
447  * When freeze_tlv_version is 2 & MU_SUPPORT_IN_TLV is 1, this field indicates
448  * bitmap of users upto 4 to which channel capture need to be uploaded. And if
449  * freeze_tlv_version is 2 & MU_SUPPORT_IN_TLV is 0, this field indicate to PHY
450  * which user's channel information need to be uploaded
451  *
452  * @directed: Indicate the frame is directed to us or not when NDPA/NDP capture
453  * or FTM/TM/ACK capture. 1=directed. For other modes, it is 0.
454  */
455 struct macrx_freeze_capture_channel {
456 	uint16_t freeze                          :  1, //[0]
457 		 capture_reason                  :  3, //[3:1]
458 		 packet_type                     :  2, //[5:4]
459 		 packet_sub_type                 :  4, //[9:6]
460 		 reserved                        :  5, //[14:10]
461 		 sw_peer_id_valid                :  1; //[15]
462 	uint16_t sw_peer_id                      : 16; //[15:0]
463 	uint16_t phy_ppdu_id                     : 16; //[15:0]
464 	uint16_t packet_ta_lower_16              : 16; //[15:0]
465 	uint16_t packet_ta_mid_16                : 16; //[15:0]
466 	uint16_t packet_ta_upper_16              : 16; //[15:0]
467 	uint16_t packet_ra_lower_16              : 16; //[15:0]
468 	uint16_t packet_ra_mid_16                : 16; //[15:0]
469 	uint16_t packet_ra_upper_16              : 16; //[15:0]
470 	uint16_t tsf_timestamp_15_0              : 16; //[15:0]
471 	uint16_t tsf_timestamp_31_16             : 16; //[15:0]
472 	uint16_t tsf_timestamp_47_32             : 16; //[15:0]
473 	uint16_t tsf_timestamp_63_48             : 16; //[15:0]
474 	uint16_t user_index_or_user_mask_5_0     :  6, //[5:0]
475 		 directed                        :  1, //[6]
476 		 reserved_13                     :  9; //[15:7]
477 };
478 
479 /*
480  * freeze_tlv v3 used by Pine
481  *
482  * @freeze:
483  *		0: Allow channel capture
484  *		1: Freeze channel capture
485  *
486  * @capture_reason: Field only valid when the freeze field is 1. Indicates why
487  * the MAC asked to capture the channel
488  *		0: freeze_reason_TM
489  *		1: freeze_reason_FTM
490  *		2: freeze_reason_ACK_resp_to_TM_FTM
491  *		3: freeze_reason_TA_RA_TYPE_FILTER
492  *		4: freeze readon NDP_NDP
493  *		5: freeze_reason_ALL_PACKET
494  *
495  * @packet_type: Packet type of captured packets.
496  *		0: Management
497  *		1: Control
498  *		2: Data
499  *		3: Extension
500  *
501  * @packet_sub_type: packet subtype of the captured packets.
502  *
503  * @directed: Indicate the frame is directed to us or not when NDPA/NDP capture
504  * or FTM/TM/ACK capture. 1=directed. For other modes, it is 0.
505  *
506  * @sw_peer_id_valid: It is valid only when the freeze field is set to 1.
507  *		0: no TA address search on the received frame has been
508  *		   performed. This is due to the frame not having a TA address
509  *		   (like ACK frame), or the received frame being from an other
510  *		   AP to which this device is not associated.
511  *		1: field sw_peer_id will contain valid information.
512  *		   This implies that a (successful) address search has been
513  *		   performed on the TA address of the received frame.
514  *
515  * @sw_peer_id: Valid only when sw_peer_id_valid field is set. It is an
516  * identifier that allows SW to double check that the CSI info stored belongs
517  * to the device with this SW identifier.
518  *
519  * @phy_ppdu_id: ppdu_id of ppdu which has channel capture performed. Field
520  * only valid when the freeze field is set to 1.
521  *
522  * @packet_ta_lower_16: Packet’s lower 16bits transmit address in MAC header.
523  *
524  * @packet_ta_mid_16: Packet’s middle 16bits transmit address in MAC header.
525  *
526  * @packet_ta_upper_16: Packet’s upper 16bits transmit address in MAC header.
527  *
528  * @packet_ra_lower_16: Packet’s lower 16bits receive address in MAC header.
529  *
530  * @packet_ra_mid_16: Packet’s middle 16bits receive address in MAC header.
531  *
532  * @packet_ra_upper_16: Packet’s upper 16bits receive address in MAC header.
533  *
534  * @tsf_timestamp_15_0: MAC side 64bit TSF timestamp when this TLV is sent to
535  * PHY. Bits [15:0].
536  *
537  * @tsf_timestamp_31_16: MAC side 64bit TSF timestamp when this TLV is sent to
538  * PHY. Bits [31:16].
539  *
540  * @tsf_timestamp_47_32: MAC side 64bit TSF timestamp when this TLV is sent to
541  * PHY. Bits [47:32].
542  *
543  * @tsf_63_48_or_user_mask_36_32: Indicates to PHY which user's channel info
544  * need to be uploaded. Only valid in UL MU case with MU_SUPPORT_IN_TLV = 1.
545  * Otherwise this indicates to PHY MSBs 63:48 of the MAC side 64bit TSF
546  * timestamp when this TLV is sent to PHY.
547  *
548  * @user_index_or_user_mask_15_0: Indicate to PHY which user's channel info
549  * need to be uploaded in UL MU case with MU_SUPPORT_IN_TLV = 1. Otherwise it
550  * indicate PHY which user’s channel information need to be uploaded.
551  *
552  * @user_mask_31_16: Indicate to PHY which user’s channel information need to
553  * be uploaded. Only valid in UL MU case with MU_SUPPORT_IN_TLV = 1.
554  */
555 struct macrx_freeze_capture_channel_v3 {
556 	uint16_t freeze                          :  1, //[0]
557 		 capture_reason                  :  3, //[3:1]
558 		 packet_type                     :  2, //[5:4]
559 		 packet_sub_type                 :  4, //[9:6]
560 		 directed                        :  1, //[10]
561 		 reserved                        :  4, //[14:11]
562 		 sw_peer_id_valid                :  1; //[15]
563 	uint16_t sw_peer_id                      : 16; //[15:0]
564 	uint16_t phy_ppdu_id                     : 16; //[15:0]
565 	uint16_t packet_ta_lower_16              : 16; //[15:0]
566 	uint16_t packet_ta_mid_16                : 16; //[15:0]
567 	uint16_t packet_ta_upper_16              : 16; //[15:0]
568 	uint16_t packet_ra_lower_16              : 16; //[15:0]
569 	uint16_t packet_ra_mid_16                : 16; //[15:0]
570 	uint16_t packet_ra_upper_16              : 16; //[15:0]
571 	uint16_t tsf_timestamp_15_0              : 16; //[15:0]
572 	uint16_t tsf_timestamp_31_16             : 16; //[15:0]
573 	uint16_t tsf_timestamp_47_32             : 16; //[15:0]
574 	uint16_t tsf_63_48_or_user_mask_36_32    : 16; //[15:0]
575 	uint16_t user_index_or_user_mask_15_0    : 16; //[15:0]
576 	uint16_t user_mask_31_16                 : 16; //[15:0]
577 };
578 
579 struct uplink_user_setup_info {
580 	uint32_t bw_info_valid                   :  1, //[0]
581 		 uplink_receive_type             :  2, //[2:1]
582 		 reserved_0a                     :  1, //[3]
583 		 uplink_11ax_mcs                 :  4, //[7:4]
584 		 ru_width                        :  7, //[14:8]
585 		 reserved_0b                     :  1, //[15]
586 		 nss                             :  3, //[18:16]
587 		 stream_offset                   :  3, //[21:19]
588 		 sta_dcm                         :  1, //[22]
589 		 sta_coding                      :  1, //[23]
590 		 ru_start_index                  :  7, //[30:24]
591 		 reserved_0c                     :  1; //[31]
592 };
593 
594 struct macrx_freeze_capture_channel_v5 {
595 	uint16_t freeze                          :  1, //[0]
596 		 capture_reason                  :  3, //[3:1]
597 		 packet_type                     :  2, //[5:4]
598 		 packet_sub_type                 :  4, //[9:6]
599 		 reserved                        :  5, //[14:10]
600 		 sw_peer_id_valid                :  1; //[15]
601 	uint16_t sw_peer_id                      : 16; //[15:0]
602 	uint16_t phy_ppdu_id                     : 16; //[15:0]
603 	uint16_t packet_ta_lower_16              : 16; //[15:0]
604 	uint16_t packet_ta_mid_16                : 16; //[15:0]
605 	uint16_t packet_ta_upper_16              : 16; //[15:0]
606 	uint16_t packet_ra_lower_16              : 16; //[15:0]
607 	uint16_t packet_ra_mid_16                : 16; //[15:0]
608 	uint16_t packet_ra_upper_16              : 16; //[15:0]
609 	uint16_t tsf_timestamp_15_0              : 16; //[15:0]
610 	uint16_t tsf_timestamp_31_16             : 16; //[15:0]
611 	uint16_t tsf_timestamp_47_32             : 16; //[15:0]
612 	uint16_t tsf_timestamp_63_48             : 16; //[15:0]
613 	uint16_t user_index_or_user_mask_5_0     :  6, //[5:0]
614 		 directed                        :  1, //[6]
615 		 reserved_13                     :  9; //[15:7]
616 	uint16_t user_mask_21_6                  : 16; //[15:0]
617 	uint16_t user_mask_36_22                 : 15, //[14:0]
618 		 reserved_15a                    :  1; //[15]
619 };
620 
621 struct uplink_user_setup_info_v2 {
622 	uint32_t bw_info_valid                   :  1, //[0]
623 		 uplink_receive_type             :  2, //[2:1]
624 		 reserved_0a                     :  1, //[3]
625 		 uplink_11ax_mcs                 :  4, //[7:4]
626 		 nss                             :  3, //[10:8]
627 		 stream_offset                   :  3, //[13:11]
628 		 sta_dcm                         :  1, //[14]
629 		 sta_coding                      :  1, //[15]
630 		 ru_type_80_0                    :  4, //[19:16]
631 		 ru_type_80_1                    :  4, //[23:20]
632 		 ru_type_80_2                    :  4, //[27:24]
633 		 ru_type_80_3                    :  4; //[31:28]
634 	uint32_t ru_start_index_80_0             :  6, //[5:0]
635 		 reserved_1a                     :  2, //[7:6]
636 		 ru_start_index_80_1             :  6, //[13:8]
637 		 reserved_1b                     :  2, //[15:14]
638 		 ru_start_index_80_2             :  6, //[21:16]
639 		 reserved_1c                     :  2, //[23:22]
640 		 ru_start_index_80_3             :  6, //[29:24]
641 		 reserved_1d                     :  2; //[31-30]
642 };
643 
644 /**
645  * cfr_enh_init_pdev() - Inits cfr pdev and registers necessary handlers.
646  * @psoc: pointer to psoc object
647  * @pdev: pointer to pdev object
648  *
649  * Return: Registration status for necessary handlers
650  */
651 QDF_STATUS cfr_enh_init_pdev(
652 		struct wlan_objmgr_psoc *psoc,
653 		struct wlan_objmgr_pdev *pdev);
654 
655 /**
656  * cfr_enh_deinit_pdev() - De-inits corresponding pdev and handlers.
657  * @psoc: pointer to psoc object
658  * @pdev: pointer to pdev object
659  *
660  * Return: De-registration status for necessary handlers
661  */
662 QDF_STATUS cfr_enh_deinit_pdev(
663 		struct wlan_objmgr_psoc *psoc,
664 		struct wlan_objmgr_pdev *pdev);
665 
666 /**
667  * target_if_cfr_start_lut_age_timer() - Start timer to flush aged-out LUT
668  * entries
669  * @pdev: pointer to pdev object
670  *
671  * Return: None
672  */
673 void target_if_cfr_start_lut_age_timer(struct wlan_objmgr_pdev *pdev);
674 
675 /**
676  * target_if_cfr_stop_lut_age_timer() - Stop timer to flush aged-out LUT
677  * entries
678  * @pdev: pointer to pdev object
679  *
680  * Return: None
681  */
682 void target_if_cfr_stop_lut_age_timer(struct wlan_objmgr_pdev *pdev);
683 
684 /**
685  * target_if_cfr_dump_lut_enh() - Dump all valid LUT entries
686  * @pdev: objmgr PDEV
687  *
688  * Return: none
689  */
690 void target_if_cfr_dump_lut_enh(struct wlan_objmgr_pdev *pdev);
691 
692 /**
693  * target_if_cfr_config_rcc() - Start repetitive channel capture
694  * @pdev: pointer to pdev object
695  * @rcc_param: rcc configurations
696  *
697  * Return: Success/Failure status
698  */
699 QDF_STATUS target_if_cfr_config_rcc(struct wlan_objmgr_pdev *pdev,
700 				    struct cfr_rcc_param *rcc_param);
701 
702 /**
703  *  target_if_cfr_default_ta_ra_config() - Configure default values to all
704  *  params(BW/NSS/TA/RA) in TA_RA mode
705  * @rcc_param: rcc configurations
706  * @allvalid: Indicates whether all TA_RA params are valid or not.
707  *            It could be either 0 or 1.
708  *            1: should be sent to FW during CFR initialization
709  *            0: should be set, after a successful commit session.
710  * @reset_cfg: This bitmap is being used to determine which groups'
711  *            parameters are needed to be reset to its default state.
712  */
713 void target_if_cfr_default_ta_ra_config(struct cfr_rcc_param *rcc_param,
714 					bool allvalid, uint16_t reset_cfg);
715 
716 /**
717  * target_if_cfr_rx_tlv_process() - Process PPDU status TLVs and store info in
718  * lookup table
719  * @pdev: PDEV object
720  * @nbuf: ppdu info
721  *
722  * Return: none
723  */
724 void target_if_cfr_rx_tlv_process(struct wlan_objmgr_pdev *pdev, void *nbuf);
725 
726 /**
727  * target_if_cfr_update_global_cfg() - Update global config after a successful
728  * commit
729  * @pdev: pointer to pdev object
730  *
731  * Return: None
732  */
733 void target_if_cfr_update_global_cfg(struct wlan_objmgr_pdev *pdev);
734 #else
735 static inline QDF_STATUS cfr_enh_init_pdev(
736 		struct wlan_objmgr_psoc *psoc,
737 		struct wlan_objmgr_pdev *pdev)
738 {
739 	return QDF_STATUS_SUCCESS;
740 }
741 
742 static inline QDF_STATUS cfr_enh_deinit_pdev(
743 		struct wlan_objmgr_psoc *psoc,
744 		struct wlan_objmgr_pdev *pdev)
745 {
746 	return QDF_STATUS_SUCCESS;
747 }
748 #endif
749 #endif
750