xref: /wlan-dirver/qca-wifi-host-cmn/umac/cfr/dispatcher/inc/wlan_cfr_utils_api.h (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 
2 /*
3  * Copyright (c) 2019-2020 The Linux Foundation. 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 _WLAN_CFR_UTILS_API_H_
21 #define _WLAN_CFR_UTILS_API_H_
22 
23 #include <wlan_objmgr_cmn.h>
24 #include <qdf_streamfs.h>
25 #ifdef WLAN_ENH_CFR_ENABLE
26 #include <qdf_timer.h>
27 #endif
28 
29 #define cfr_alert(format, args...) \
30 		QDF_TRACE_FATAL(QDF_MODULE_ID_CFR, format, ## args)
31 
32 #define cfr_err(format, args...) \
33 		QDF_TRACE_ERROR(QDF_MODULE_ID_CFR, format, ## args)
34 
35 #define cfr_warn(format, args...) \
36 		QDF_TRACE_WARN(QDF_MODULE_ID_CFR, format, ## args)
37 
38 #define cfr_info(format, args...) \
39 		QDF_TRACE_INFO(QDF_MODULE_ID_CFR, format, ## args)
40 
41 #define cfr_debug(format, args...) \
42 		QDF_TRACE_DEBUG(QDF_MODULE_ID_CFR, format, ## args)
43 
44 #define DBR_EVENT_TIMEOUT_IN_MS_CFR 1
45 #define DBR_NUM_RESP_PER_EVENT_CFR 1
46 #define MAX_CFR_ENABLED_CLIENTS 10
47 #define CFR_CAPTURE_HOST_MEM_REQ_ID 9
48 #define CFR_HOST_MEM_READ_INDEX_DEFAULT 8
49 #define CFR_VENDOR_ID 0x8cfdf0
50 #ifdef WLAN_ENH_CFR_ENABLE
51 #define MAX_CFR_MU_USERS 4
52 #define NUM_CHAN_CAPTURE_STATUS 4
53 #define NUM_CHAN_CAPTURE_REASON 6
54 #define MAX_TA_RA_ENTRIES 16
55 #define MAX_RESET_CFG_ENTRY 0xFFFF
56 #define CFR_INVALID_VDEV_ID 0xff
57 #define DEFAULT_SRNGID_CFR 0
58 #endif
59 
60 enum cfrmetaversion {
61 	CFR_META_VERSION_NONE,
62 	CFR_META_VERSION_1,
63 	CFR_META_VERSION_2,
64 	CFR_META_VERSION_3,
65 	CFR_META_VERSION_MAX = 0xFF,
66 };
67 
68 enum cfrdataversion {
69 	CFR_DATA_VERSION_NONE,
70 	CFR_DATA_VERSION_1,
71 	CFR_DATA_VERSION_MAX = 0xFF,
72 };
73 
74 enum cfrplatformtype {
75 	CFR_PLATFORM_TYPE_NONE,
76 	CFR_PLATFORM_TYPE_MIPS,
77 	CFR_PLATFORM_TYPE_ARM,
78 	CFR_PLATFFORM_TYPE_MAX = 0xFF,
79 };
80 
81 enum cfrradiotype {
82 	CFR_CAPTURE_RADIO_NONE,
83 	CFR_CAPTURE_RADIO_OSPREY,
84 	CFR_CAPTURE_RADIO_PEAKCOCK,
85 	CFR_CAPTURE_RADIO_SCORPION,
86 	CFR_CAPTURE_RADIO_HONEYBEE,
87 	CFR_CAPTURE_RADIO_DRAGONFLY,
88 	CFR_CAPTURE_RADIO_JET,
89 	CFR_CAPTURE_RADIO_PEREGRINE = 17,
90 	CFR_CAPTURE_RADIO_SWIFT,
91 	CFR_CAPTURE_RADIO_BEELINER,
92 	CFR_CAPTURE_RADIO_CASCADE,
93 	CFR_CAPTURE_RADIO_DAKOTA,
94 	CFR_CAPTURE_RADIO_BESRA,
95 	CFR_CAPTURE_RADIO_HKV2,
96 	CFR_CAPTURE_RADIO_CYP,
97 	CFR_CAPTURE_RADIO_HSP,
98 	CFR_CAPTURE_RADIO_PINE,
99 	CFR_CAPTURE_RADIO_ADRASTEA,
100 	CFR_CAPTURE_RADIO_MAPLE,
101 	CFR_CAPTURE_RADIO_MOSELLE,
102 	CFR_CAPTURE_RADIO_MAX = 0xFF,
103 };
104 
105 enum ack_capture_mode {
106 	CFR_LEGACY_ACK     = 0,
107 	CFR_DUP_LEGACY_ACK = 1,
108 	CFR_HT_ACK         = 2,
109 	CFR_VHT_ACK        = 3,
110 	CFR_INVALID_ACK, /*Always keep this at last*/
111 };
112 
113 /* Similar to WMI_PEER_CFR_CAPTURE_METHOD used in one-shot capture */
114 enum cfr_capture_type {
115 	CFR_TYPE_METHOD_NULL_FRAME = 0,
116 	CFR_TYPE_METHOD_NULL_FRAME_WITH_PHASE = 1,
117 	CFR_TYPE_METHOD_PROBE_RESP = 2,
118 	CFR_TYPE_METHOD_TM = 3,
119 	CFR_TYPE_METHOD_FTM = 4,
120 	CFR_TYPE_METHOD_ACK_RESP_TO_TM_FTM = 5,
121 	CFR_TYPE_METHOD_TA_RA_TYPE_FILTER = 6,
122 	CFR_TYPE_METHOD_NDPA_NDP = 7,
123 	CFR_TYPE_METHOD_ALL_PACKET = 8,
124 	/* Add new capture methods before this line */
125 	CFR_TYPE_METHOD_LAST_VALID,
126 	CFR_TYPE_METHOD_AUTO = 0xff,
127 	CFR_TYPE_METHOD_MAX,
128 };
129 
130 struct cfr_metadata_version_1 {
131 	u_int8_t    peer_addr[QDF_MAC_ADDR_SIZE];
132 	u_int8_t    status;
133 	u_int8_t    capture_bw;
134 	u_int8_t    channel_bw;
135 	u_int8_t    phy_mode;
136 	u_int16_t   prim20_chan;
137 	u_int16_t   center_freq1;
138 	u_int16_t   center_freq2;
139 	u_int8_t    capture_mode;
140 	u_int8_t    capture_type;
141 	u_int8_t    sts_count;
142 	u_int8_t    num_rx_chain;
143 	u_int32_t   timestamp;
144 	u_int32_t   length;
145 } __attribute__ ((__packed__));
146 
147 #define HOST_MAX_CHAINS 8
148 
149 struct cfr_metadata_version_2 {
150 	u_int8_t    peer_addr[QDF_MAC_ADDR_SIZE];
151 	u_int8_t    status;
152 	u_int8_t    capture_bw;
153 	u_int8_t    channel_bw;
154 	u_int8_t    phy_mode;
155 	u_int16_t   prim20_chan;
156 	u_int16_t   center_freq1;
157 	u_int16_t   center_freq2;
158 	u_int8_t    capture_mode;
159 	u_int8_t    capture_type;
160 	u_int8_t    sts_count;
161 	u_int8_t    num_rx_chain;
162 	u_int32_t   timestamp;
163 	u_int32_t   length;
164 	u_int32_t   chain_rssi[HOST_MAX_CHAINS];
165 	u_int16_t   chain_phase[HOST_MAX_CHAINS];
166 } __attribute__ ((__packed__));
167 
168 #ifdef WLAN_ENH_CFR_ENABLE
169 struct cfr_metadata_version_3 {
170 	u_int8_t    status;
171 	u_int8_t    capture_bw;
172 	u_int8_t    channel_bw;
173 	u_int8_t    phy_mode;
174 	u_int16_t   prim20_chan;
175 	u_int16_t   center_freq1;
176 	u_int16_t   center_freq2;
177 	u_int8_t    capture_mode; /* ack_capture_mode */
178 	u_int8_t    capture_type; /* cfr_capture_type */
179 	u_int8_t    sts_count;
180 	u_int8_t    num_rx_chain;
181 	u_int64_t   timestamp;
182 	u_int32_t   length;
183 	u_int8_t    is_mu_ppdu;
184 	u_int8_t    num_mu_users;
185 	union {
186 		u_int8_t    su_peer_addr[QDF_MAC_ADDR_SIZE];
187 		u_int8_t    mu_peer_addr[MAX_CFR_MU_USERS][QDF_MAC_ADDR_SIZE];
188 	} peer_addr;
189 	u_int32_t   chain_rssi[HOST_MAX_CHAINS];
190 	u_int16_t   chain_phase[HOST_MAX_CHAINS];
191 } __attribute__ ((__packed__));
192 #endif
193 
194 struct csi_cfr_header {
195 	u_int32_t   start_magic_num;
196 	u_int32_t   vendorid;
197 	u_int8_t    cfr_metadata_version;
198 	u_int8_t    cfr_data_version;
199 	u_int8_t    chip_type;
200 	u_int8_t    pltform_type;
201 	u_int32_t   Reserved;
202 
203 	union {
204 		struct cfr_metadata_version_1 meta_v1;
205 		struct cfr_metadata_version_2 meta_v2;
206 #ifdef WLAN_ENH_CFR_ENABLE
207 		struct cfr_metadata_version_3 meta_v3;
208 #endif
209 	} u;
210 } __attribute__ ((__packed__));
211 
212 /**
213  * struct cfr_capture_params - structure to store cfr config param
214  * bandwidth: bandwitdh of capture
215  * period: period of capture
216  * method: enum of method being followed to capture cfr data. 0-QoS null data
217  */
218 struct cfr_capture_params {
219 	u_int8_t   bandwidth;
220 	u_int32_t  period;
221 	u_int8_t   method;
222 };
223 
224 /**
225  * struct psoc_cfr - private psoc object for cfr
226  * psoc_obj: pointer to psoc object
227  * is_cfr_capable: flag to determine if cfr is enabled or not
228  * is_cap_interval_mode_sel_support: flag to determine if target supports both
229  *				     capture_count and capture_duration modes
230  *				     with a nob provided to configure
231  * is_mo_marking_support: flag to determine if MO marking is supported or not
232  */
233 struct psoc_cfr {
234 	struct wlan_objmgr_psoc *psoc_obj;
235 	uint8_t is_cfr_capable;
236 #ifdef WLAN_ENH_CFR_ENABLE
237 	uint8_t is_cap_interval_mode_sel_support;
238 	uint8_t is_mo_marking_support;
239 #endif
240 };
241 
242 /**
243  * struct cfr_wmi_host_mem_chunk - wmi mem chunk related
244  * vaddr: pointer to virtual address
245  * paddr: physical address
246  * len: len of the mem chunk allocated
247  * req_id: reqid related to the mem chunk
248  */
249 struct cfr_wmi_host_mem_chunk {
250 	uint32_t *vaddr;
251 	qdf_dma_addr_t paddr;
252 	uint32_t len;
253 	uint32_t req_id;
254 };
255 
256 struct whal_cfir_dma_hdr {
257 	uint16_t
258 		// 'BA'
259 		tag                 : 8,
260 		// '02', length of header in 4 octet units
261 		length              : 6,
262 		// 00
263 		reserved            : 2;
264 	uint16_t
265 		// [16]
266 		upload_done         : 1,
267 		// [17:18], 0: invalid, 1: CFR, 2: CIR, 3: DebugH
268 		capture_type        : 3,
269 		// [19:20], 0: Legacy, 1: HT, 2: VHT, 3: HE
270 		preamble_type       : 2,
271 		// [21:23], 0: 1-stream, 1: 2-stream, ..., 7: 8-stream
272 		nss                 : 3,
273 		// [24:27], 0: invalid, 1: 1-chain, 2: 2-chain, etc.
274 		num_chains          : 3,
275 		// [28:30], 0: 20 MHz, 1: 40 MHz, 2: 80 MHz, 3: 160 MHz
276 		upload_pkt_bw       : 3,    // [31]
277 		sw_peer_id_valid    : 1;
278 	uint16_t
279 		sw_peer_id          : 16;   // [15:0]
280 	uint16_t
281 		phy_ppdu_id         : 16;   // [15:0]
282 };
283 
284 #define MAX_LUT_ENTRIES 140 /* For HKv2 136 is max */
285 
286 /**
287  * struct look_up_table - Placeholder for 2 asynchronous events (DBR and
288  * TXRX event)
289  * dbr_recv: Indicates whether WMI for DBR completion is received or not
290  * tx_recv: Indicates whether WMI for TX completion (or) WDI event for RX
291  * status is received or not
292  * data: pointer to CFR data that ucode DMAs to host memory
293  * data_len: length of CFR data DMAed by ucode
294  * dbr_ppdu_id: PPDU id retrieved from DBR completion WMI event
295  * tx_ppdu_id: PPDU id retrieved from WMI TX completion event (or) PPDU status
296  * TLV
297  * dbr_address: Physical address of the CFR data dump retrieved from DBR
298  * completion WMI event
299  * tx_address1: Physical address of the CFR data from TX/RX event
300  * tx_address2: Physical address of the CFR data from TX/RX event
301  * csi_cfr_header: CFR header constructed by host
302  * whal_cfir_enhanced_hdr: CFR header constructed by ucode
303  * tx_tstamp: Timestamp when TX/RX event was received
304  * dbr_tstamp: Timestamp when DBR completion event was received
305  * header_length: Length of header DMAed by ucode in words
306  * payload_length: Length of CFR payload
307  */
308 struct look_up_table {
309 	bool dbr_recv;
310 	bool tx_recv;
311 	uint8_t *data; /* capture payload */
312 	uint32_t data_len; /* capture len */
313 	uint16_t dbr_ppdu_id; /* ppdu id from dbr */
314 	uint16_t tx_ppdu_id; /* ppdu id from TX event */
315 	qdf_dma_addr_t dbr_address; /* capture len */
316 	uint32_t tx_address1; /* capture len */
317 	uint32_t tx_address2; /* capture len */
318 	struct csi_cfr_header header;
319 	struct whal_cfir_dma_hdr dma_hdr;
320 	uint64_t txrx_tstamp;
321 	uint64_t dbr_tstamp;
322 	uint32_t header_length;
323 	uint32_t payload_length;
324 };
325 
326 struct unassoc_pool_entry {
327 	struct qdf_mac_addr mac;
328 	struct cfr_capture_params cfr_params;
329 	bool is_valid;
330 };
331 
332 #ifdef WLAN_ENH_CFR_ENABLE
333 /**
334  * struct ta_ra_cfr_cfg - structure to store configuration of 16 groups in
335  * M_TA_RA mode
336  * filter_group_id: Filter group number for which the below filters needs to be
337  * applied
338  * bw: CFR capture will be done for packets matching the bandwidths specified
339  * within this bitmask
340  * nss: CFR capture will be done for packets matching the Nss specified within
341  * this bitmask
342  * valid_ta: Ta_addr is valid if set
343  * valid_ta_mask: Ta_addr_mask is valid if set
344  * valid_ra: Ra_addr is valid if set
345  * valid_ra_mask: Ra_addr_mask is valid if set
346  * valid_bw_mask: Bandwidth is valid if set
347  * valid_nss_mask: NSS is valid if set
348  * valid_mgmt_subtype: Mgmt_subtype is valid if set
349  * valid_ctrl_subtype: Ctrl_subtype is valid if set
350  * valid_data_subtype: Data_subtype is valid if set
351  * mgmt_subtype_filter: Managments Packets matching the subtype filter
352  * categories will be filtered in by MAC for CFR capture.
353  * ctrl_subtype_filter: Control Packets matching the subtype filter
354  * categories will be filtered in by MAC for CFR capture.
355  * data_subtype_filter: Data Packets matching the subtype filter
356  * categories will be filtered in by MAC for CFR capture.
357  * tx_addr: Packets whose transmitter address matches (tx_addr & tx_addr_mask)
358  * will be filtered in by MAC
359  * tx_addr_mask: Packets whose transmitter address matches (tx_addr &
360  * tx_addr_mask) will be filtered in by MAC
361  * rx_addr: Packets whose receiver address matches (rx_addr & rx_addr_mask)
362  * will be filtered in by MAC
363  * rx_addr_mask: Packets whose receiver address matches (rx_addr &
364  * rx_addr_mask) will be filtered in by MAC
365  */
366 struct ta_ra_cfr_cfg {
367 	uint8_t filter_group_id;
368 	uint16_t bw                          :5,
369 		 nss                         :8,
370 		 rsvd0                       :3;
371 	uint16_t valid_ta                    :1,
372 		 valid_ta_mask               :1,
373 		 valid_ra                    :1,
374 		 valid_ra_mask               :1,
375 		 valid_bw_mask               :1,
376 		 valid_nss_mask              :1,
377 		 valid_mgmt_subtype          :1,
378 		 valid_ctrl_subtype          :1,
379 		 valid_data_subtype          :1,
380 		 rsvd1                       :7;
381 	uint16_t mgmt_subtype_filter;
382 	uint16_t ctrl_subtype_filter;
383 	uint16_t data_subtype_filter;
384 	uint8_t tx_addr[QDF_MAC_ADDR_SIZE];
385 	uint8_t rx_addr[QDF_MAC_ADDR_SIZE];
386 	uint8_t tx_addr_mask[QDF_MAC_ADDR_SIZE];
387 	uint8_t rx_addr_mask[QDF_MAC_ADDR_SIZE];
388 
389 } qdf_packed;
390 
391 /**
392  * struct cfr_rcc_param - structure to store cfr config param
393  * pdev_id: pdev_id for identifying the MAC
394  * vdev_id: vdev_id of current rcc configures
395  * srng_id: srng id of current rcc configures
396  * capture_duration: Capture Duration field for which CFR capture has to happen,
397  * in microsecond units
398  * capture_interval: Capture interval field which is time in between
399  * consecutive CFR capture, in microsecond units
400  * ul_mu_user_mask_lower: Bitfields indicates which of the users in the current
401  * UL MU tranmission are enabled for CFR capture.
402  * ul_mu_user_mask_upper: This is contiuation of the above lower mask.
403  * freeze_tlv_delay_cnt_en: Enable Freeze TLV delay counter in MAC
404  * freeze_tlv_delay_cnt_thr: Indicates the number of consecutive Rx packets to
405  * be skipped before CFR capture is enabled again.
406  * filter_group_bitmap: Bitfields set indicates which of the CFR group config is
407  * enabled
408  * m_directed_ftm: Filter Directed FTM ACK frames for CFR capture
409  * m_all_ftm_ack: Filter All FTM ACK frames for CFR capture
410  * m_ndpa_ndp_directed: Filter NDPA NDP Directed Frames for CFR capture
411  * m_ndpa_ndp_all: Filter all NDPA NDP for CFR capture
412  * m_ta_ra_filter: Filter Frames based on TA/RA/Subtype as provided in CFR Group
413  * config
414  * m_all_packet: Filter in All packets for CFR Capture
415  * en_ta_ra_filter_in_as_fp: Filter in frames as FP/MO in m_ta_ra_filter mode
416  * num_grp_tlvs: Indicates the number of groups in M_TA_RA mode, that have
417  * changes in the current commit session, use to construct WMI group TLV(s)
418  * curr: Placeholder for M_TA_RA group config in current commit session
419  * modified_in_curr_session: Bitmap indicating number of groups in M_TA_RA mode
420  * that have changed in current commit session.
421  * capture_count: After capture_count+1 number of captures, MAC stops RCC  and
422  * waits for capture_interval duration before enabling again
423  * capture_intval_mode_sel: 0 indicates capture_duration mode, 1 indicates the
424  * capture_count mode.
425  */
426 struct cfr_rcc_param {
427 	uint8_t pdev_id;
428 	uint8_t vdev_id;
429 	uint8_t srng_id;
430 	uint32_t capture_duration;
431 	uint32_t capture_interval;
432 	uint32_t ul_mu_user_mask_lower;
433 	uint32_t ul_mu_user_mask_upper;
434 	uint16_t freeze_tlv_delay_cnt_en  :1,
435 		 freeze_tlv_delay_cnt_thr :8,
436 		 rsvd0 :7;
437 	uint16_t filter_group_bitmap;
438 	uint8_t m_directed_ftm           : 1,
439 		m_all_ftm_ack            : 1,
440 		m_ndpa_ndp_directed      : 1,
441 		m_ndpa_ndp_all           : 1,
442 		m_ta_ra_filter           : 1,
443 		m_all_packet             : 1,
444 		en_ta_ra_filter_in_as_fp : 1,
445 		rsvd1                    : 1;
446 	uint8_t num_grp_tlvs;
447 
448 	struct ta_ra_cfr_cfg curr[MAX_TA_RA_ENTRIES];
449 	unsigned long modified_in_curr_session;
450 	uint32_t capture_count            :16,
451 		 capture_intval_mode_sel  :1,
452 		 rsvd2                    :15;
453 };
454 #endif /* WLAN_ENH_CFR_ENABLE */
455 
456 /**
457  * struct pdev_cfr - private pdev object for cfr
458  * pdev_obj: pointer to pdev object
459  * is_cfr_capable: flag to determine if cfr is enabled or not
460  * cfr_timer_enable: flag to enable/disable timer
461  * chip_type: chip type which is defined in enum cfrradiotype
462  * cfr_mem_chunk: Region of memory used for storing cfr data
463  * cfr_max_sta_count: Maximum stations supported in one-shot capture mode
464  * num_subbufs: No. of sub-buffers used in relayfs
465  * subbuf_size: Size of sub-buffer used in relayfs
466  * chan_ptr: Channel in relayfs
467  * dir_ptr: Parent directory of relayfs file
468  * lut: lookup table used to store asynchronous DBR and TX/RX events for
469  * correlation
470  * lut_num: Number of lut
471  * dbr_buf_size: Size of DBR completion buffer
472  * dbr_num_bufs: No. of DBR completions
473  * tx_evt_cnt: No. of TX completion events till CFR stop was issued
474  * total_tx_evt_cnt: No. of Tx completion events since wifi was up
475  * dbr_evt_cnt: No. of WMI DBR completion events
476  * release_cnt: No. of CFR data buffers relayed to userspace
477  * tx_peer_status_cfr_fail: No. of tx events without tx status set to
478  * PEER_CFR_CAPTURE_EVT_STATUS_MASK indicating CFR capture failure on a peer.
479  * tx_evt_status_cfr_fail: No. of tx events without tx status set to
480  * CFR_TX_EVT_STATUS_MASK indicating CFR capture status failure.
481  * tx_dbr_cookie_lookup_fail: No. of dbr cookie lookup failures during tx event
482  * process.
483  * rcc_param: Structure to store CFR config for the current commit session
484  * global: Structure to store accumulated CFR config
485  * rx_tlv_evt_cnt: Number of CFR WDI events from datapath
486  * lut_age_timer: Timer to flush pending TXRX/DBR events in lookup table
487  * lut_timer_init: flag to determine if lut_age_timer is initialized or not
488  * is_cfr_rcc_capable: Flag to determine if RCC is enabled or not.
489  * flush_dbr_cnt: No. of un-correlated DBR completions flushed when a newer PPDU
490  * is correlated successfully with newer DBR completion
491  * invalid_dma_length_cnt: No. of buffers for which CFR DMA header length (or)
492  * data length was invalid
493  * flush_timeout_dbr_cnt: No. of DBR completion flushed out in ageout logic
494  * clear_txrx_event: No. of PPDU status TLVs over-written in LUT
495  * last_success_tstamp: DBR timestamp which indicates that both DBR and TX/RX
496  * events have been received successfully.
497  * cfr_dma_aborts: No. of CFR DMA aborts in ucode
498  * is_cap_interval_mode_sel_support: flag to determine if target supports both
499  * is_mo_marking_support: flag to determine if MO marking is supported or not
500  * capture_count and capture_duration modes with a nob provided to configure.
501  * unassoc_pool: Pool of un-associated clients used when capture method is
502  * CFR_CAPTURE_METHOD_PROBE_RESPONSE
503  * lut_lock: Lock to protect access to cfr lookup table
504  */
505 /*
506  * To be extended if we get more capbality info
507  * from FW's extended service ready event.
508  */
509 struct pdev_cfr {
510 	struct wlan_objmgr_pdev *pdev_obj;
511 	uint8_t is_cfr_capable;
512 	uint8_t cfr_timer_enable;
513 	uint8_t chip_type;
514 	struct cfr_wmi_host_mem_chunk cfr_mem_chunk;
515 	uint16_t cfr_max_sta_count;
516 	uint16_t cfr_current_sta_count;
517 	uint32_t num_subbufs;
518 	uint32_t subbuf_size;
519 	qdf_streamfs_chan_t chan_ptr;
520 	qdf_dentry_t dir_ptr;
521 	struct look_up_table **lut;
522 	uint32_t lut_num;
523 	uint32_t dbr_buf_size;
524 	uint32_t dbr_num_bufs;
525 	uint32_t max_mu_users;
526 	uint64_t tx_evt_cnt;
527 	uint64_t total_tx_evt_cnt;
528 	uint64_t dbr_evt_cnt;
529 	uint64_t release_cnt;
530 	uint64_t tx_peer_status_cfr_fail;
531 	uint64_t tx_evt_status_cfr_fail;
532 	uint64_t tx_dbr_cookie_lookup_fail;
533 #ifdef WLAN_ENH_CFR_ENABLE
534 	struct cfr_rcc_param rcc_param;
535 	struct ta_ra_cfr_cfg global[MAX_TA_RA_ENTRIES];
536 	uint64_t rx_tlv_evt_cnt;
537 	qdf_timer_t lut_age_timer;
538 	uint8_t lut_timer_init;
539 	uint8_t is_cfr_rcc_capable;
540 	uint64_t flush_dbr_cnt;
541 	uint64_t invalid_dma_length_cnt;
542 	uint64_t flush_timeout_dbr_cnt;
543 	uint64_t clear_txrx_event;
544 	uint64_t last_success_tstamp;
545 	uint64_t cfr_dma_aborts;
546 	uint8_t is_cap_interval_mode_sel_support;
547 	uint8_t is_mo_marking_support;
548 #endif
549 	struct unassoc_pool_entry unassoc_pool[MAX_CFR_ENABLED_CLIENTS];
550 	qdf_spinlock_t lut_lock;
551 };
552 
553 /**
554  * enum cfr_capt_status - CFR capture status
555  */
556 enum cfr_capt_status {
557 	/* Capture not in progress */
558 	PEER_CFR_CAPTURE_DISABLE,
559 	/* Capture in progress */
560 	PEER_CFR_CAPTURE_ENABLE,
561 };
562 
563 /**
564  * struct peer_cfr - private peer object for cfr
565  * peer_obj: pointer to peer_obj
566  * request: Type of request (start/stop)
567  * bandwidth: bandwitdth of capture for this peer
568  * capture_method: enum determining type of cfr data capture.
569  *                 0-Qos null data
570  */
571 struct peer_cfr {
572 	struct wlan_objmgr_peer *peer_obj;
573 	u_int8_t   request;            /* start/stop */
574 	u_int8_t   bandwidth;
575 	u_int32_t  period;
576 	u_int8_t   capture_method;
577 };
578 
579 /**
580  * cfr_initialize_pdev() - cfr initialize pdev
581  * @pdev: Pointer to pdev_obj
582  *
583  * Return: status of cfr pdev init
584  */
585 QDF_STATUS cfr_initialize_pdev(struct wlan_objmgr_pdev *pdev);
586 
587 /**
588  * cfr_deinitialize_pdev() - cfr deinitialize pdev
589  * @pdev: Pointer to pdev_obj
590  *
591  * Return: status of cfr pdev deinit
592  */
593 QDF_STATUS cfr_deinitialize_pdev(struct wlan_objmgr_pdev *pdev);
594 
595 /**
596  * wlan_cfr_init() - Global init for cfr.
597  *
598  * Return: status of global init pass/fail
599  */
600 QDF_STATUS wlan_cfr_init(void);
601 
602 /**
603  * wlan_cfr_deinit() - Global de-init for cfr.
604  *
605  * Return: status of global de-init pass/fail
606  */
607 QDF_STATUS wlan_cfr_deinit(void);
608 
609 /**
610  * wlan_cfr_pdev_open() - pdev_open function for cfr.
611  * @pdev: pointer to pdev object
612  *
613  * Return: status of pdev_open pass/fail
614  */
615 QDF_STATUS wlan_cfr_pdev_open(struct wlan_objmgr_pdev *pdev);
616 
617 /**
618  * wlan_cfr_pdev_close() - pdev_close function for cfr.
619  * @pdev: pointer to pdev object
620  *
621  * Return: status of pdev_close pass/fail
622  */
623 QDF_STATUS wlan_cfr_pdev_close(struct wlan_objmgr_pdev *pdev);
624 
625 /**
626  * count_set_bits() - function to count set bits in a bitmap
627  * @value: input bitmap
628  *
629  * Return: No. of set bits
630  */
631 uint8_t count_set_bits(unsigned long value);
632 
633 /**
634  * wlan_cfr_is_feature_disabled() - Check if cfr feature is disabled
635  * @pdev - the physical device object.
636  *
637  * Return : true if cfr is disabled, else false.
638  */
639 bool wlan_cfr_is_feature_disabled(struct wlan_objmgr_pdev *pdev);
640 
641 #ifdef WLAN_ENH_CFR_ENABLE
642 /**
643  * wlan_cfr_rx_tlv_process() - Process PPDU status TLVs and store info in
644  * lookup table
645  * @pdev_obj: PDEV object
646  * @nbuf: ppdu info
647  *
648  * Return: none
649  */
650 void wlan_cfr_rx_tlv_process(struct wlan_objmgr_pdev *pdev, void *nbuf);
651 #endif
652 #endif
653