1 /*
2  * Copyright (c) 2017-2021 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 any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: Contains mandatory API from legacy
20  */
21 
22 #ifndef _WLAN_UTILITY_H_
23 #define _WLAN_UTILITY_H_
24 
25 #include <qdf_types.h>
26 #include <wlan_objmgr_psoc_obj.h>
27 #include <wlan_objmgr_pdev_obj.h>
28 #include <wlan_objmgr_vdev_obj.h>
29 
30 #define TGT_INVALID_SNR         (0)
31 #define TGT_MAX_SNR             (TGT_NOISE_FLOOR_DBM * (-1))
32 #define TGT_NOISE_FLOOR_DBM     (-96)
33 #define TGT_IS_VALID_SNR(x)     ((x) >= 0 && (x) < TGT_MAX_SNR)
34 #define TGT_IS_VALID_RSSI(x)    ((x) != 0xFF)
35 
36 /**
37  * struct wlan_vdev_ch_check_filter - vdev chan check filter object
38  * @flag:     matches or not
39  * @vdev:     vdev to be checked against all the active vdevs
40  */
41 struct wlan_vdev_ch_check_filter {
42 	uint8_t flag;
43 	struct wlan_objmgr_vdev *vdev;
44 };
45 
46 /**
47  * struct wlan_op_mode_peer_count - vdev connected peer count
48  * @opmode: QDF mode
49  * @peer_count: peer count
50  **/
51 struct wlan_op_mode_peer_count {
52 	enum QDF_OPMODE opmode;
53 	uint16_t peer_count;
54 };
55 
56 /**
57  * wlan_construct_shortssid() - construct the short ssid with the help of
58  * shortssid table
59  * @ssid: pointer to ssid
60  * @ssid_len: ssid length
61  *
62  * return: short ssid length
63  */
64 uint32_t wlan_construct_shortssid(uint8_t *ssid, uint8_t ssid_len);
65 
66 /**
67  * wlan_chan_to_freq() - converts channel to frequency
68  * @chan: channel number
69  *
70  * @return frequency of the channel
71  */
72 uint32_t wlan_chan_to_freq(uint8_t chan);
73 
74 /**
75   * wlan_get_320_center_freq() - find center frequencies for 320Mhz channel
76   * @freq: Primary frequency
77   * @center_freq1: possible 1st center frequency
78   * @center_freq2: possible 2nd center frequency
79   *
80   * return: void
81   **/
82 void
83 wlan_get_320_center_freq(qdf_freq_t freq,
84 			 qdf_freq_t *center_freq1,
85 			 qdf_freq_t *center_freq2);
86 
87 /**
88  * wlan_freq_to_chan() - converts frequency to channel
89  * @freq: frequency
90  *
91  * Return: channel of frequency
92  */
93 uint8_t wlan_freq_to_chan(uint32_t freq);
94 
95 /**
96  * wlan_is_ie_valid() - Determine if an IE sequence is valid
97  * @ie: Pointer to the IE buffer
98  * @ie_len: Length of the IE buffer @ie
99  *
100  * This function validates that the IE sequence is valid by verifying
101  * that the sum of the lengths of the embedded elements match the
102  * length of the sequence.
103  *
104  * Note well that a 0-length IE sequence is considered valid.
105  *
106  * Return: true if the IE sequence is valid, false if it is invalid
107  */
108 bool wlan_is_ie_valid(const uint8_t *ie, size_t ie_len);
109 
110 /**
111  * wlan_get_ie_ptr_from_eid() - Find out ie from eid
112  * @eid: element id
113  * @ie: source ie address
114  * @ie_len: source ie length
115  *
116  * Return: vendor ie address - success
117  *         NULL - failure
118  */
119 const uint8_t *wlan_get_ie_ptr_from_eid(uint8_t eid,
120 					const uint8_t *ie,
121 					int ie_len);
122 
123 /**
124  * wlan_get_vendor_ie_ptr_from_oui() - Find out vendor ie
125  * @oui: oui buffer
126  * @oui_size: oui size
127  * @ie: source ie address
128  * @ie_len: source ie length
129  *
130  * This function find out vendor ie by pass source ie and vendor oui.
131  *
132  * Return: vendor ie address - success
133  *         NULL - failure
134  */
135 const uint8_t *wlan_get_vendor_ie_ptr_from_oui(const uint8_t *oui,
136 					       uint8_t oui_size,
137 					       const uint8_t *ie,
138 					       uint16_t ie_len);
139 
140 /**
141  * wlan_get_ext_ie_ptr_from_ext_id() - Find out ext ie
142  * @oui: oui buffer
143  * @oui_size: oui size
144  * @ie: source ie address
145  * @ie_len: source ie length
146  *
147  * This function find out ext ie from ext id (passed oui)
148  *
149  * Return: vendor ie address - success
150  *         NULL - failure
151  */
152 const uint8_t *wlan_get_ext_ie_ptr_from_ext_id(const uint8_t *oui,
153 					       uint8_t oui_size,
154 					       const uint8_t *ie,
155 					       uint16_t ie_len);
156 
157 /**
158  * wlan_iecap_set() - Set the capability in the IE
159  * @iecap: pointer to capability IE
160  * @bit_pos: bit position of capability from start of capability field
161  * @tot_bits: total bits of capability
162  * @value: value to be set
163  *
164  * This function sets the value in capability IE at the bit position
165  * specified for specified number of bits in byte order.
166  *
167  * Return: void
168  */
169 void wlan_iecap_set(uint8_t *iecap,
170 		    uint8_t bit_pos,
171 		    uint8_t tot_bits,
172 		    uint32_t value);
173 
174 /**
175  * wlan_iecap_get() - Get the capability in the IE
176  * @iecap: pointer to capability IE
177  * @bit_pos: bit position of capability from start of capability field
178  * @tot_bits: total bits of capability
179  *
180  * This function gets the value at bit position for specified bits
181  * from start of capability field.
182  *
183  * Return: capability value
184  */
185 uint32_t wlan_iecap_get(uint8_t *iecap,
186 			uint8_t bit_pos,
187 			uint32_t tot_bits);
188 
189 /**
190  * wlan_get_elem_fragseq_requirements() - Get requirements related to generation
191  * of element fragment sequence.
192  *
193  * @elemid: Element ID
194  * @payloadlen: Length of element payload to be fragmented. Irrespective of
195  * whether inline fragmentation in wlan_create_elem_fragseq() is to be used or
196  * not, this length should not include the length of the element ID and element
197  * length, and if the element ID is WLAN_ELEMID_EXTN_ELEM, it should not include
198  * the length of the element ID extension.
199  * @is_frag_required: Pointer to location where the function should update
200  * whether fragmentation is required or not for the given element ID and payload
201  * length. The caller should ignore this if the function returns failure.
202  * @required_fragbuff_size: Pointer to location where the function should update
203  * the required minimum size of the buffer where the fragment sequence created
204  * would be written, starting from the beginning of the buffer (irrespective of
205  * whether inline fragmentation in wlan_create_elem_fragseq() is to be used or
206  * not). This is the total size of the element fragment sequence, inclusive of
207  * the header and payload of the leading element and the headers and payloads of
208  * all subsequent fragments applicable to that element. If the element ID is
209  * WLAN_ELEMID_EXTN_ELEM, this also includes the length of the element ID
210  * extension. The caller should ignore this if the function returns a value of
211  * false for is_frag_required, or if the function returns failure.
212  *
213  * Get information on requirements related to generation of element fragment
214  * sequence. Currently this includes an indication of whether fragmentation is
215  * required or not for the given element ID and payload length, and if
216  * fragmentation is applicable, the minimum required size of the buffer where
217  * the fragment sequence created would be written (irrespective of whether
218  * inline fragmentation in wlan_create_elem_fragseq() is to be used or not).
219  *
220  * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
221  * the reason for error in the case of failure
222  */
223 QDF_STATUS
224 wlan_get_elem_fragseq_requirements(uint8_t elemid,
225 				   qdf_size_t payloadlen,
226 				   bool *is_frag_required,
227 				   qdf_size_t *required_fragbuff_size);
228 
229 /**
230  * wlan_create_elem_fragseq() - Create sequence of element fragments
231  *
232  * @inline_frag: Whether to use inline fragmentation, wherein the fragmentation
233  * is carried out inline within the source buffer and no memmoves/memcopy would
234  * be required for the lead element.
235  * @elemid: Element ID
236  * @elemidext: Element ID extension. This is applicable only if elemid is
237  * WLAN_ELEMID_EXTN_ELEM, otherwise it is ignored.
238  * @payloadbuff: Buffer containing the element payload to be fragmented. If
239  * inline fragmentation is selected, the corresponding element fragment sequence
240  * will be generated inline into this buffer, and prior to the payload the
241  * buffer should have two bytes reserved in the beginning for the element ID and
242  * element length fields to be written, and a third byte reserved after them for
243  * the element ID extension to be written (if the element ID is
244  * WLAN_ELEMID_EXTN_ELEM).
245  * @payloadbuff_maxsize: Maximum size of payloadbuff
246  * @payloadlen: Length of element payload to be fragmented. Irrespective of
247  * whether inline fragmentation is to be used or not, this should not include
248  * the length of the element ID and element length, and if the element ID is
249  * WLAN_ELEMID_EXTN_ELEM, it should not include the length of the element ID
250  * extension.
251  * @fragbuff: The buffer into which the element fragment sequence should be
252  * generated. This is inapplicable and ignored if inline fragmentation is used.
253  * @fragbuff_maxsize: The maximum size of fragbuff. This is inapplicable and
254  * ignored if inline fragmentation is used.
255  * @fragseqlen: Pointer to location where the length of the fragment sequence
256  * created should be written. This is the total length of the element fragment
257  * sequence, inclusive of the header and payload of the leading element and the
258  * headers and payloads of all subsequent fragments applicable to that element.
259  * If the element ID is WLAN_ELEMID_EXTN_ELEM, this also includes the length of
260  * the element ID extension. The caller should ignore this if the function
261  * returns failure.
262  *
263  * Create a sequence of element fragments. In case fragmentation is not required
264  * for the given element ID and payload length, the function returns an error.
265  * This function is intended to be used by callers which do not have the ability
266  * (or for maintainability purposes do not desire the complexity) to inject new
267  * fragments on the fly where required, when populating the fields in the
268  * element (which would completely eliminate memory moves/copies). An inline
269  * mode is available to carry out the fragmentation within the source buffer in
270  * order to reduce buffer requirements and to eliminate memory copies/moves for
271  * the lead element. In the inline mode, the source buffer should have bytes
272  * reserved in the beginning for the element ID, element length, and if
273  * applicable, the element ID extension. In the inline mode the buffer content
274  * (if any) after the fragments is moved as well.
275  *
276  * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
277  * the reason for error in the case of failure
278  */
279 QDF_STATUS wlan_create_elem_fragseq(bool inline_frag,
280 				    uint8_t elemid,
281 				    uint8_t elemidext,
282 				    uint8_t *payloadbuff,
283 				    qdf_size_t payloadbuff_maxsize,
284 				    qdf_size_t payloadlen,
285 				    uint8_t *fragbuff,
286 				    qdf_size_t fragbuff_maxsize,
287 				    qdf_size_t *fragseqlen);
288 
289 /**
290  * wlan_get_subelem_fragseq_requirements() - Get requirements related to
291  * generation of subelement fragment sequence.
292  *
293  * @subelemid: Subelement ID
294  * @payloadlen: Length of subelement payload to be fragmented. Irrespective of
295  * whether inline fragmentation in wlan_create_subelem_fragseq() is to be used
296  * or not, this length should not include the length of the subelement ID and
297  * subelement length.
298  * @is_frag_required: Pointer to location where the function should update
299  * whether fragmentation is required or not for the given payload length. The
300  * caller should ignore this if the function returns failure.
301  * @required_fragbuff_size: Pointer to location where the function should update
302  * the required minimum size of the buffer where the fragment sequence created
303  * would be written, starting from the beginning of the buffer (irrespective of
304  * whether inline fragmentation in wlan_create_subelem_fragseq() is to be used
305  * or not). This is the total size of the subelement fragment sequence,
306  * inclusive of the header and payload of the leading subelement and the headers
307  * and payloads of all subsequent fragments applicable to that subelement. The
308  * caller should ignore this if the function returns a value of false for
309  * is_frag_required, or if the function returns failure.
310  *
311  * Get information on requirements related to generation of subelement fragment
312  * sequence. Currently this includes an indication of whether fragmentation is
313  * required or not for the given payload length, and if fragmentation is
314  * applicable, the minimum required size of the buffer where the fragment
315  * sequence created would be written (irrespective of whether inline
316  * fragmentation in wlan_create_subelem_fragseq() is to be used or not). Note
317  * that the subelement ID does not currently play a role in determining the
318  * requirements, but is added as an argument in case it is required in the
319  * future.
320  *
321  * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
322  * the reason for error in the case of failure
323  */
324 QDF_STATUS
325 wlan_get_subelem_fragseq_requirements(uint8_t subelemid,
326 				      qdf_size_t payloadlen,
327 				      bool *is_frag_required,
328 				      qdf_size_t *required_fragbuff_size);
329 
330 /**
331  * wlan_create_subelem_fragseq() - Create sequence of subelement fragments
332  *
333  * @inline_frag: Whether to use inline fragmentation, wherein the fragmentation
334  * is carried out inline within the source buffer and no memmoves/memcopy would
335  * be required for the lead subelement.
336  * @subelemid: Subelement ID
337  * @subelemfragid: Fragment ID to be used for the subelement (this can
338  * potentially vary across protocol areas)
339  * @payloadbuff: Buffer containing the subelement payload to be fragmented. If
340  * inline fragmentation is selected, the corresponding subelement fragment
341  * sequence will be generated inline into this buffer, and prior to the payload
342  * the buffer should have two bytes reserved in the beginning for the subelement
343  * ID and subelement length fields to be written.
344  * @payloadbuff_maxsize: Maximum size of payloadbuff
345  * @payloadlen: Length of subelement payload to be fragmented. Irrespective of
346  * whether inline fragmentation is to be used or not, this should not include
347  * the length of the subelement ID and subelement length.
348  * @fragbuff: The buffer into which the subelement fragment sequence should be
349  * generated. This is inapplicable and ignored if inline fragmentation is used.
350  * @fragbuff_maxsize: The maximum size of fragbuff. This is inapplicable and
351  * ignored if inline fragmentation is used.
352  * @fragseqlen: Pointer to location where the length of the fragment sequence
353  * created should be written. This is the total length of the subelement
354  * fragment sequence, inclusive of the header and payload of the leading
355  * subelement and the headers and payloads of all subsequent fragments
356  * applicable to that subelement. The caller should ignore this if the function
357  * returns failure.
358  *
359  * Create a sequence of subelement fragments. In case fragmentation is not
360  * required for the given payload length, the function returns an error. This
361  * function is intended to be used by callers which do not have the ability (or
362  * for maintainability purposes do not desire the complexity) to inject new
363  * fragments on the fly where required, when populating the fields in the
364  * subelement (which would completely eliminate memory moves/copies). An inline
365  * mode is available to carry out the fragmentation within the source buffer in
366  * order to reduce buffer requirements and to eliminate memory copies/moves for
367  * the lead subelement. In the inline mode, the source buffer should have bytes
368  * reserved in the beginning for the subelement ID and the subelement length. In
369  * the inline mode the buffer content (if any) after the fragments is moved as
370  * well.
371  *
372  * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
373  * the reason for error in the case of failure
374  */
375 QDF_STATUS wlan_create_subelem_fragseq(bool inline_frag,
376 				       uint8_t subelemid,
377 				       uint8_t subelemfragid,
378 				       uint8_t *payloadbuff,
379 				       qdf_size_t payloadbuff_maxsize,
380 				       qdf_size_t payloadlen,
381 				       uint8_t *fragbuff,
382 				       qdf_size_t fragbuff_maxsize,
383 				       qdf_size_t *fragseqlen);
384 
385 /**
386  * wlan_get_elem_fragseq_info() - Get information about element fragment
387  * sequence
388  *
389  * @elembuff: Buffer containing a series of elements to be checked for whether a
390  * contiguous subset of these elements (starting with the first element in the
391  * buffer) form an element fragment sequence. The buffer should start with the
392  * Element ID of the first element. The buffer should not contain any material
393  * other than elements.
394  * @elembuff_maxsize: Maximum size of elembuff
395  * @is_fragseq: Pointer to location of a flag indicating whether this is an
396  * element fragment sequence or not. The flag will be set to true if elembuff
397  * contains an element fragment sequence starting with the element present in
398  * the beginning of the buffer, or the flag will be set to false if the buffer
399  * contains a single non-fragmented element in the beginning. Please note
400  * standards related limitation given in function description below.
401  * @fragseq_totallen: Pointer to location of total length of element fragment
402  * sequence. If is_fragseq is true, then this is set to the total length of the
403  * element fragment sequence, inclusive of the header and payload of the leading
404  * element and the headers and payloads of all subsequent fragments applicable
405  * to that element. If is_fragseq is false, the caller should ignore this.
406  * Please note standards related limitation given in function description below.
407  * @fragseq_payloadlen: Pointer to location of length of payload of element
408  * fragment sequence. If is_fragseq is true, then this length is set to the
409  * total size of the element fragment sequence payload, which does not include
410  * the sizes of the headers of the lead element and subsequent fragments, and
411  * which (if the lead element's element ID is WLAN_ELEMID_EXTN_ELEM) does not
412  * include the size of the lead element's element ID extension. If is_fragseq is
413  * false, the caller should ignore this. Please note standards related
414  * limitation given in function description below.
415  *
416  * Get the following information for a first element present in the beginning of
417  * a given buffer, and a series of elements after it in the given buffer: a)
418  * Whether a contiguous subset of these elements starting with the first element
419  * form an element fragment sequence. b) If they form an element fragment
420  * sequence, then the total length of this sequence inclusive of headers and
421  * payloads of all the elements in the sequence. c) If they form an element
422  * fragment sequence, then the total size of the payloads of all the elements in
423  * the sequence (not including the element ID extension of the lead element, if
424  * applicable). While determining this information, the function may return
425  * errors, including for protocol parsing issues. These protocol parsing issues
426  * include one in which the first element has a length lesser than 255, but the
427  * very next element after it is a fragment element (which is not allowed by the
428  * standard).  Separately, please note a limitation arising from the standard
429  * wherein if the caller passes a truncated maximum buffer size such that the
430  * buffer ends prematurely just at the end of a potential lead element with
431  * length 255 or just at the end of a non-lead fragment element with length 255,
432  * the function will have to conclude that the last successfully parsed element
433  * is the final one in the non-fragment or fragment sequence, and return results
434  * accordingly. If another fragment actually exists beyond the given buffer,
435  * this function cannot detect the condition since there is no provision in the
436  * standard to indicate a total fragment sequence size in one place in the
437  * beginning or anywhere else. Hence the caller should take care to provide the
438  * complete buffer with the max size set accordingly.
439  *
440  * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
441  * the reason for error in the case of failure
442  */
443 QDF_STATUS wlan_get_elem_fragseq_info(uint8_t *elembuff,
444 				      qdf_size_t elembuff_maxsize,
445 				      bool *is_fragseq,
446 				      qdf_size_t *fragseq_totallen,
447 				      qdf_size_t *fragseq_payloadlen);
448 
449 /**
450  * wlan_defrag_elem_fragseq() - Defragment sequence of element fragments
451  *
452  * @inline_defrag: Whether to use inline defragmentation, wherein the
453  * defragmentation is carried out inline within the source buffer and no
454  * memmoves/memcopy would be required for the lead element.
455  * @fragbuff: Source buffer containing the element fragment sequence starting
456  * with the Element ID of the lead element. The buffer should not contain any
457  * material other than elements. If inline defragmentation is enabled, the
458  * corresponding defragmented payload will be generated inline into this buffer
459  * and the defragmented payload will start after the location of the lead
460  * element's element ID, element length, and (if the lead element's element ID
461  * is WLAN_ELEMID_EXTN_ELEM), the element ID extension. This defragmented
462  * payload will not contain the headers of any of the other fragments in the
463  * fragment sequence.
464  * @fragbuff_maxsize: Maximum size of fragbuff. This should be greater than or
465  * equal to the total size of the element fragment sequence, inclusive of the
466  * header and payload of the leading element and the headers and payloads of all
467  * subsequent fragments applicable to that element.
468  * @defragbuff: The destination buffer into which the defragmented payload
469  * should be copied. This is inapplicable and ignored if inline_defrag is true.
470  * The defragmented payload will be copied to the start of the destination
471  * buffer without including the headers of the lead element and the subsequent
472  * fragment elements, and (if the lead element's element ID is
473  * WLAN_ELEMID_EXTN_ELEM), without including the element ID extension.
474  * @defragbuff_maxsize: Maximum size of defragbuff. This is inapplicable and
475  * ignored if inline_defrag is true. The size should be large enough to contain
476  * the entire defragmented payload, otherwise an error will be returned.
477  * @defragpayload_len: Pointer to the location where the length of the
478  * defragmented payload should be updated. Irrespective of whether inline_defrag
479  * is true or false, this will not include the sizes of the headers of the lead
480  * element and subsequent fragments, and (if the lead element's element ID is
481  * WLAN_ELEMID_EXTN_ELEM), it will not include the size of the lead element's
482  * element ID extension. Please note standards related limitation given in
483  * function description below.
484  *
485  * Defragment a sequence of element fragments. If the source buffer does not
486  * contain an element fragment sequence (in the beginning), an error is
487  * returned. An inline mode is available to carry out the defragmentation within
488  * the source buffer in order to reduce buffer requirements and to eliminate
489  * memory copies/moves for the lead element. In the inline mode, the buffer
490  * content (if any) after the fragments is moved as well. The contents of the
491  * defragmented payload are intended for end consumption by control path
492  * protocol processing code within the driver in a manner uniform with other
493  * protocol data in byte buffers, and not for onward forwarding to other
494  * subsystems or for intrusive specialized processing different from other
495  * protocol data. Hence zero copy methods such as network buffer fragment
496  * processing, etc. are not used in this use case.  Additionally, this API is
497  * intended for use cases where the nature of the payload is complex and it is
498  * infeasible for the caller to skip the (un-defragmented) fragment boundaries
499  * on its own in a scalable and maintainable manner. Separately, please note a
500  * limitation arising from the standard wherein if the caller passes a truncated
501  * maximum buffer size such that the buffer ends prematurely just at the end of
502  * a fragment element with length 255, the function will have to conclude that
503  * the last successfully parsed fragment element is the final one in the
504  * fragment sequence, and return results accordingly. If another fragment
505  * actually exists beyond the given buffer, this function cannot detect the
506  * condition since there is no provision in the standard to indicate a total
507  * fragment sequence size in one place in the beginning or anywhere else. Hence
508  * the caller should take care to provide the complete buffer with the max size
509  * set accordingly.
510  *
511  * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
512  * the reason for error in the case of failure
513  */
514 QDF_STATUS wlan_defrag_elem_fragseq(bool inline_defrag,
515 				    uint8_t *fragbuff,
516 				    qdf_size_t fragbuff_maxsize,
517 				    uint8_t *defragbuff,
518 				    qdf_size_t defragbuff_maxsize,
519 				    qdf_size_t *defragpayload_len);
520 
521 /**
522  * wlan_get_subelem_fragseq_info() - Get information about subelement fragment
523  * sequence
524  *
525  * @subelemfragid: Fragment ID applicable for the subelement (this can
526  * potentially vary across protocol areas)
527  * @subelembuff: Buffer containing a series of subelements to be checked for
528  * whether a contiguous subset of these subelements (starting with the first
529  * subelement in the buffer) form a subelement fragment sequence. The containing
530  * element is required to have already been defragmented (if applicable). The
531  * buffer should start with the subelement ID of the first subelement. The
532  * buffer should not contain any material apart from subelements.
533  * @subelembuff_maxsize: Maximum size of subelembuff
534  * @is_fragseq: Pointer to location of a flag indicating whether this is a
535  * subelement fragment sequence or not. The flag will be set to true if the
536  * buffer contains a subelement fragment sequence starting with the subelement
537  * present in the beginning of the buffer, or the flag will be set to false if
538  * the buffer contains a single non-fragmented subelement in the beginning.
539  * Please note standards related limitation given in function description below.
540  * @fragseq_totallen: Pointer to location of total length of subelement fragment
541  * sequence. If is_fragseq is true, then this is set to the total length of the
542  * subelement fragment sequence, inclusive of the header and payload of the
543  * leading subelement and the headers and payloads of all subsequent fragments
544  * applicable to that subelement. If is_fragseq is false, the caller should
545  * ignore this. Please note standards related limitation given in function
546  * description below.
547  * @fragseq_payloadlen: Pointer to location of length of payload of subelement
548  * fragment sequence. If is_fragseq is true, then this length is set to the
549  * total size of the subelement fragment sequence payload, which does not
550  * include the sizes of the headers of the lead subelement and subsequent
551  * fragments. If is_fragseq is false, the caller should ignore this. Please note
552  * standards related limitation given in function description below.
553  *
554  * Get the following information for a first subelement present in the beginning
555  * of a given buffer, and a series of subelements after it in the given buffer:
556  * a) Whether a contiguous subset of these subelements starting with the first
557  * subelement form a subelement fragment sequence. b) If they form a subelement
558  * fragment sequence, then the total length of this sequence inclusive of
559  * headers and payloads of all the subelements in the sequence. c) If they form
560  * a subelement fragment sequence, then the total size of the payloads of all
561  * the subelements in the sequence.  While determining this information, the
562  * function may return errors, including for protocol parsing issues. These
563  * protocol parsing issues include one in which the first subelement has a
564  * length lesser than 255, but the very next subelement after it is a fragment
565  * subelement (which is not allowed by the standard so far). Separately, please
566  * note a limitation arising from the standard wherein if the caller passes a
567  * truncated maximum buffer size such that the buffer ends prematurely just at
568  * the end of a potential lead subelement with length 255 or just at the end of
569  * a non-lead fragment subelement with length 255, the function will have to
570  * conclude that the last successfully parsed subelement is the final one in the
571  * non-fragment or fragment sequence, and return results accordingly. If another
572  * fragment actually exists beyond the given buffer, this function cannot detect
573  * the condition since there is no provision in the standard to indicate a total
574  * fragment sequence size in one place in the beginning or anywhere else. Hence
575  * the caller should take care to provide the complete buffer with the max size
576  * set accordingly.
577  *
578  * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
579  * the reason for error in the case of failure
580  */
581 QDF_STATUS wlan_get_subelem_fragseq_info(uint8_t subelemfragid,
582 					 uint8_t *subelembuff,
583 					 qdf_size_t subelembuff_maxsize,
584 					 bool *is_fragseq,
585 					 qdf_size_t *fragseq_totallen,
586 					 qdf_size_t *fragseq_payloadlen);
587 
588 /**
589  * wlan_defrag_subelem_fragseq() - Defragment sequence of subelement fragments
590  *
591  * @inline_defrag: Whether to use inline defragmentation, wherein the
592  * defragmentation is carried out inline within the source buffer and no
593  * memmoves/memcopy would be required for the lead subelement.
594  * @subelemfragid: Fragment ID applicable for the subelement (this can
595  * potentially vary across protocol areas)
596  * @fragbuff: Source buffer containing the subelement fragment sequence starting
597  * with the subelement ID of the lead subelement. The containing element is
598  * required to have already been defragmented (if applicable). If inline
599  * defragmentation is enabled, the corresponding defragmented payload will be
600  * generated inline into this buffer and the defragmented payload will start
601  * after the location of the lead subelement's subelement ID and subelement
602  * length. This defragmented payload will not contain the headers of any of the
603  * other fragments in the fragment sequence.
604  * @fragbuff_maxsize: Maximum size of fragbuff. This should be greater than or
605  * equal to the total size of the subelement fragment sequence, inclusive of the
606  * header and payload of the leading subelement and the headers and payloads of
607  * all subsequent fragments applicable to that subelement.
608  * @defragbuff: The destination buffer into which the defragmented payload
609  * should be copied. This is inapplicable and ignored if inline_defrag is true.
610  * The defragmented payload will be copied to the start of the destination
611  * buffer without including the headers of the lead subelement and the
612  * subsequent fragment subelements.
613  * @defragbuff_maxsize: Maximum size of defragbuff. This is inapplicable and
614  * ignored if inline_defrag is true. The size should be large enough to contain
615  * the entire defragmented payload, otherwise an error will be returned.
616  * @defragpayload_len: Pointer to the location where the length of the
617  * defragmented payload should be updated. Irrespective of whether inline_defrag
618  * is true or false, this will not include the sizes of the headers of the lead
619  * subelement and subsequent fragments. Please note standards related limitation
620  * given in function description below.
621  *
622  * Defragment a sequence of subelement fragments. If the source buffer does not
623  * contain a subelement fragment sequence (in the beginning), the function
624  * returns an error. The containing element is required to have already been
625  * defragmented. An inline mode is available to carry out the defragmentation
626  * within the source buffer in order to reduce buffer requirements and to
627  * eliminate memory copies/moves for the lead subelement. In the inline mode,
628  * the buffer content (if any) after the fragments is moved as well. The
629  * contents of the defragmented payload are intended for end consumption by
630  * control path protocol processing code within the driver in a manner uniform
631  * with other protocol data in byte buffers, and not for onward forwarding to
632  * other subsystems or for intrusive specialized processing different from other
633  * protocol data. Hence zero copy methods such as network buffer fragment
634  * processing, etc. are not used in this use case.  Additionally, this API is
635  * intended for use cases where the nature of the payload is complex and it is
636  * infeasible for the caller to skip the (un-defragmented) fragment boundaries
637  * on its own in a scalable and maintainable manner.  Separately, please note a
638  * limitation arising from the standard wherein if the caller passes a truncated
639  * maximum buffer size such that the buffer ends prematurely just at the end of
640  * a fragment subelement with length 255, the function will have to conclude
641  * that the last successfully parsed fragment subelement is the final one in the
642  * fragment sequence, and return results accordingly. If another fragment
643  * actually exists beyond the given buffer, this function cannot detect the
644  * condition since there is no provision in the standard to indicate a total
645  * fragment sequence size in one place in the beginning or anywhere else. Hence
646  * the caller should take care to provide the complete buffer with the max size
647  * set accordingly.
648  *
649  * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
650  * the reason for error in the case of failure
651  */
652 QDF_STATUS wlan_defrag_subelem_fragseq(bool inline_defrag,
653 				       uint8_t subelemfragid,
654 				       uint8_t *fragbuff,
655 				       qdf_size_t fragbuff_maxsize,
656 				       uint8_t *defragbuff,
657 				       qdf_size_t defragbuff_maxsize,
658 				       qdf_size_t *defragpayload_len);
659 
660 /**
661  * wlan_is_emulation_platform() - check if platform is emulation based
662  * @phy_version: psoc nif phy_version
663  *
664  * Return: boolean value based on platform type
665  */
666 bool wlan_is_emulation_platform(uint32_t phy_version);
667 
668 /**
669  * wlan_get_pdev_id_from_vdev_id() - Helper func to derive pdev id from vdev_id
670  * @psoc: psoc object
671  * @vdev_id: vdev identifier
672  * @dbg_id: object manager debug id
673  *
674  * This function is used to derive the pdev id from vdev id for a psoc
675  *
676  * Return : pdev_id - +ve integer for success and WLAN_INVALID_PDEV_ID
677  *          for failure
678  */
679 uint32_t wlan_get_pdev_id_from_vdev_id(struct wlan_objmgr_psoc *psoc,
680 				 uint8_t vdev_id,
681 				 wlan_objmgr_ref_dbgid dbg_id);
682 
683 /**
684  * wlan_util_is_vdev_active() - Check for vdev active
685  * @pdev: pdev pointer
686  * @dbg_id: debug id for ref counting
687  *
688  * Return: QDF_STATUS_SUCCESS in case of vdev active
689  *          QDF_STATUS_E_INVAL, if dev is not active
690  */
691 QDF_STATUS wlan_util_is_vdev_active(struct wlan_objmgr_pdev *pdev,
692 				    wlan_objmgr_ref_dbgid dbg_id);
693 
694 /**
695  * wlan_vdev_is_up() - Check for vdev is in UP state
696  * @vdev: vdev pointer
697  *
698  * Return: QDF_STATUS_SUCCESS, if vdev is in up, otherwise QDF_STATUS_E_FAILURE
699  */
700 QDF_STATUS wlan_vdev_is_up(struct wlan_objmgr_vdev *vdev);
701 
702 /**
703  * wlan_util_pdev_vdevs_deschan_match() - function to check des channel matches
704  *                                        with other vdevs in pdev
705  * @pdev: pdev object
706  * @vdev: vdev object
707  * @dbg_id: object manager ref id
708  *
709  * This function checks the vdev desired channel with other vdev channels
710  *
711  * Return: QDF_STATUS_SUCCESS, if it matches, otherwise QDF_STATUS_E_FAILURE
712  */
713 QDF_STATUS wlan_util_pdev_vdevs_deschan_match(struct wlan_objmgr_pdev *pdev,
714 					      struct wlan_objmgr_vdev *vdev,
715 					      wlan_objmgr_ref_dbgid dbg_id);
716 
717 /**
718  * wlan_util_change_map_index() - function to set/reset given index bit
719  * @map: bitmpap
720  * @id: bit index
721  * @set: 1 for set, 0 of reset
722  *
723  * This function set/reset given index bit
724  *
725  * Return: void
726  */
727 void wlan_util_change_map_index(unsigned long *map, uint8_t id, uint8_t set);
728 
729 /**
730  * wlan_util_map_index_is_set() - function to check whether given index bit is
731  *                                set
732  * @map: bitmpap
733  * @id: bit index
734  *
735  * This function checks the given index bit is set
736  *
737  * Return: true, if bit is set, otherwise false
738  */
739 bool wlan_util_map_index_is_set(unsigned long *map, uint8_t id);
740 
741 /**
742  * wlan_util_map_is_any_index_set() - Check if any bit is set in given bitmap
743  * @map: bitmap
744  * @nbytes: number of bytes in bitmap
745  *
746  * Return: true, if any of the bit is set, otherwise false
747  */
748 bool wlan_util_map_is_any_index_set(unsigned long *map, unsigned long nbytes);
749 
750 /**
751  * wlan_pdev_chan_change_pending_vdevs() - function to test/set channel change
752  *                                         pending flag
753  * @pdev: pdev object
754  * @vdev_id_map: bitmap to derive channel change vdevs
755  * @dbg_id: object manager ref id
756  *
757  * This function test/set channel change pending flag
758  *
759  * Return: QDF_STATUS_SUCCESS, if it iterates through all vdevs,
760  *         otherwise QDF_STATUS_E_FAILURE
761  */
762 QDF_STATUS wlan_pdev_chan_change_pending_vdevs(struct wlan_objmgr_pdev *pdev,
763 					       unsigned long *vdev_id_map,
764 					       wlan_objmgr_ref_dbgid dbg_id);
765 
766 /**
767  * wlan_pdev_chan_change_pending_vdevs_down() - function to test/set down
768  *                                              change pending flag
769  * @pdev: pdev object
770  * @vdev_id_map: bitmap to derive channel change vdevs
771  * @dbg_id: object manager ref id
772  *
773  * This function test/set channel change pending flag
774  *
775  * Return: QDF_STATUS_SUCCESS, if it iterates through all vdevs,
776  *         otherwise QDF_STATUS_E_FAILURE
777  */
778 QDF_STATUS wlan_pdev_chan_change_pending_vdevs_down(
779 					struct wlan_objmgr_pdev *pdev,
780 					unsigned long *vdev_id_map,
781 					wlan_objmgr_ref_dbgid dbg_id);
782 
783 /**
784  * wlan_pdev_chan_change_pending_ap_vdevs_down() - function to test/set channel
785  *                                            change pending flag for AP VDEVs
786  * @pdev: pdev object
787  * @vdev_id_map: bitmap to derive channel change AP vdevs
788  * @dbg_id: object manager ref id
789  *
790  * This function test/set channel change pending flag for AP vdevs
791  *
792  * Return: QDF_STATUS_SUCCESS, if it iterates through all vdevs,
793  *         otherwise QDF_STATUS_E_FAILURE
794  */
795 QDF_STATUS wlan_pdev_chan_change_pending_ap_vdevs_down(
796 					struct wlan_objmgr_pdev *pdev,
797 					unsigned long *vdev_id_map,
798 					wlan_objmgr_ref_dbgid dbg_id);
799 
800 /**
801  * wlan_chan_eq() - function to check whether both channels are same
802  * @chan1: channel1 object
803  * @chan2: channel2 object
804  *
805  * This function checks the chan1 and chan2 are same
806  *
807  * Return: QDF_STATUS_SUCCESS, if it matches, otherwise QDF_STATUS_E_FAILURE
808  */
809 QDF_STATUS wlan_chan_eq(struct wlan_channel *chan1, struct wlan_channel *chan2);
810 
811 /**
812  * wlan_chan_copy() - function to copy channel
813  * @tgt:  target channel object
814  * @src:  src achannel object
815  *
816  * This function copies channel data from src to tgt
817  *
818  * Return: void
819  */
820 void wlan_chan_copy(struct wlan_channel *tgt, struct wlan_channel *src);
821 
822 /**
823  * wlan_vdev_get_active_channel() - derives the vdev operating channel
824  * @vdev:  VDEV object
825  *
826  * This function checks vdev state and return the channel pointer accordingly
827  *
828  * Return: active channel, if vdev chan config is valid
829  *         NULL, if VDEV is in INIT or STOP state
830  */
831 struct wlan_channel *wlan_vdev_get_active_channel
832 				(struct wlan_objmgr_vdev *vdev);
833 
834 /**
835  * wlan_get_connected_vdev_by_bssid() - check/get any vdev connected on bssid
836  * @pdev: pdev object
837  * @bssid: bssid to be checked
838  * @vdev_id: vdev id
839  *
840  * This function will loop through all the vdev in psoc and find/return the
841  * vdev which is connected to bssid provided.
842  *
843  * Return: bool
844  */
845 bool wlan_get_connected_vdev_by_bssid(struct wlan_objmgr_pdev *pdev,
846 				      uint8_t *bssid, uint8_t *vdev_id);
847 
848 /**
849  * wlan_get_connected_vdev_from_psoc_by_bssid() - check/get any vdev
850  *                                                connected on bssid
851  * @psoc: psoc object
852  * @bssid: bssid to be checked
853  * @vdev_id: vdev id
854  *
855  * This function will loop through all the vdev in psoc and find/return the
856  * vdev which is connected to bssid provided.
857  *
858  * Return: bool
859  */
860 bool wlan_get_connected_vdev_from_psoc_by_bssid(struct wlan_objmgr_psoc *psoc,
861 						uint8_t *bssid,
862 						uint8_t *vdev_id);
863 
864 #ifdef WLAN_FEATURE_11BE_MLO
865 /**
866  * wlan_get_connected_vdev_by_mld_addr() - check/get any vdev
867  *                                         connected on mld mac
868  * @psoc: psoc object
869  * @mld_mac: mld mac to be checked
870  * @vdev_id: vdev id
871  *
872  * This function will loop through all the vdev in psoc and find/return the
873  * first vdev which is connected to mld mac provided.
874  *
875  * Return: bool
876  */
877 bool wlan_get_connected_vdev_by_mld_addr(struct wlan_objmgr_psoc *psoc,
878 					 uint8_t *mld_mac, uint8_t *vdev_id);
879 #endif
880 
881 /**
882  * wlan_util_stats_get_rssi() - API to get rssi in dbm
883  * @db2dbm_enabled: If db2dbm capability is enabled
884  * @bcn_snr: beacon snr
885  * @dat_snr: data snr
886  * @rssi: rssi
887  *
888  * This function gets the rssi based on db2dbm support. If this feature is
889  * present in hw then it means firmware directly sends rssi and no conversion
890  * is required. If this capability is not present then host needs to convert
891  * snr to rssi
892  *
893  * Return: None
894  */
895 void
896 wlan_util_stats_get_rssi(bool db2dbm_enabled, int32_t bcn_snr, int32_t dat_snr,
897 			 int8_t *rssi);
898 
899 /**
900  * wlan_util_is_pdev_restart_progress() - Check if any vdev is in restart state
901  * @pdev: pdev pointer
902  * @dbg_id: module id
903  *
904  * Iterates through all vdevs, checks if any VDEV is in RESTART_PROGRESS
905  * substate
906  *
907  * Return: QDF_STATUS_SUCCESS,if any vdev is in RESTART_PROGRESS substate
908  *         otherwise QDF_STATUS_E_FAILURE
909  */
910 QDF_STATUS wlan_util_is_pdev_restart_progress(struct wlan_objmgr_pdev *pdev,
911 					      wlan_objmgr_ref_dbgid dbg_id);
912 
913 /**
914  * wlan_util_is_pdev_scan_allowed() - Check for vdev is allowed to scan
915  * @pdev: pdev pointer
916  * @dbg_id: module id
917  *
918  * Iterates through all vdevs, checks if any VDEV is not either in S_INIT or in
919  * S_UP state
920  *
921  * Return: QDF_STATUS_SUCCESS,if scan is allowed, otherwise QDF_STATUS_E_FAILURE
922  */
923 QDF_STATUS wlan_util_is_pdev_scan_allowed(struct wlan_objmgr_pdev *pdev,
924 					  wlan_objmgr_ref_dbgid dbg_id);
925 
926 /**
927  * wlan_util_get_peer_count_for_mode - This api gives vdev mode specific
928  * peer count`
929  * @pdev: PDEV object
930  * @mode: Operation mode.
931  *
932  * Return: int- peer count for operating mode
933  */
934 uint16_t wlan_util_get_peer_count_for_mode(struct wlan_objmgr_pdev *pdev,
935 					   enum QDF_OPMODE mode);
936 
937 /**
938  * enum wlan_minidump_host_data - Data structure type logged in Minidump
939  * @WLAN_MD_CP_EXT_PDEV: ol_ath_softc_net80211
940  * @WLAN_MD_CP_EXT_PSOC: ol_ath_soc_softc
941  * @WLAN_MD_CP_EXT_VDEV: ieee80211vap
942  * @WLAN_MD_CP_EXT_PEER: ieee80211_node
943  * @WLAN_MD_DP_SOC: dp_soc
944  * @WLAN_MD_DP_PDEV: dp_pdev
945  * @WLAN_MD_DP_VDEV: dp_vdev
946  * @WLAN_MD_DP_PEER: dp_peer
947  * @WLAN_MD_DP_SRNG_REO_DEST: dp_srng type for reo dest
948  * @WLAN_MD_DP_SRNG_REO_EXCEPTION: dp_srng type for reo exception
949  * @WLAN_MD_DP_SRNG_REO_CMD: dp_srng type for reo cmd
950  * @WLAN_MD_DP_SRNG_RX_REL: dp_srng type for reo release
951  * @WLAN_MD_DP_SRNG_REO_REINJECT: dp_srng type for reo reinject
952  * @WLAN_MD_DP_SRNG_REO_STATUS: dp_srng type for reo status
953  * @WLAN_MD_DP_SRNG_TCL_DATA: dp_srng type for tcl data
954  * @WLAN_MD_DP_SRNG_TCL_CMD: dp_srng type for tcl cmd
955  * @WLAN_MD_DP_SRNG_TCL_STATUS: dp_srng type for tcl status
956  * @WLAN_MD_DP_SRNG_TX_COMP: dp_srng type for tcl comp
957  * @WLAN_MD_DP_SRNG_WBM_DESC_REL: dp_srng_type for wbm desc rel
958  * @WLAN_MD_DP_SRNG_WBM_IDLE_LINK: dp_srng type for wbm idle link
959  * @WLAN_MD_DP_LINK_DESC_BANK: Wbm link_desc_bank
960  * @WLAN_MD_DP_SRNG_RXDMA_MON_STATUS: dp_srng type for rxdma mon status
961  * @WLAN_MD_DP_SRNG_RXDMA_MON_BUF: dp_srng type for rxdma mon buf
962  * @WLAN_MD_DP_SRNG_RXDMA_MON_DST: dp_srng type for rxdma mon dest
963  * @WLAN_MD_DP_SRNG_RXDMA_MON_DESC: dp_srng type for rxdma mon desc
964  * @WLAN_MD_DP_SRNG_RXDMA_ERR_DST: dp_srng type for rxdma err dst
965  * @WLAN_MD_DP_HAL_SOC: hal_soc
966  * @WLAN_MD_OBJMGR_PSOC: wlan_objmgr_psoc
967  * @WLAN_MD_OBJMGR_PSOC_TGT_INFO: wlan_objmgr_tgt_psoc_info
968  * @WLAN_MD_OBJMGR_PDEV: wlan_objmgr_pdev
969  * @WLAN_MD_OBJMGR_PDEV_MLME: pdev_mlme
970  * @WLAN_MD_OBJMGR_VDEV: wlan_objmgr_vdev
971  * @WLAN_MD_OBJMGR_VDEV_MLME: vdev mlme
972  * @WLAN_MD_OBJMGR_VDEV_SM: wlan_sm
973  * @WLAN_MD_DP_SRNG_REO2PPE: dp_srng type PPE rx ring
974  * @WLAN_MD_DP_SRNG_PPE2TCL: dp_srng type for PPE tx ring
975  * @WLAN_MD_DP_SRNG_PPE_RELEASE: dp_srng type for PPE tx com ring
976  * @WLAN_MD_DP_SRNG_PPE_WBM2SW_RELEASE: dp_srng type for PPE2TCL tx com ring
977  * @WLAN_MD_DP_SRNG_SW2RXDMA_LINK_RING: dp_srng type for SW2RXDMA link ring
978  * @WLAN_MD_MAX: Max value
979  */
980 enum wlan_minidump_host_data {
981 	WLAN_MD_CP_EXT_PDEV,
982 	WLAN_MD_CP_EXT_PSOC,
983 	WLAN_MD_CP_EXT_VDEV,
984 	WLAN_MD_CP_EXT_PEER,
985 	WLAN_MD_DP_SOC,
986 	WLAN_MD_DP_PDEV,
987 	WLAN_MD_DP_VDEV,
988 	WLAN_MD_DP_PEER,
989 	WLAN_MD_DP_SRNG_REO_DEST,
990 	WLAN_MD_DP_SRNG_REO_EXCEPTION,
991 	WLAN_MD_DP_SRNG_REO_CMD,
992 	WLAN_MD_DP_SRNG_RX_REL,
993 	WLAN_MD_DP_SRNG_REO_REINJECT,
994 	WLAN_MD_DP_SRNG_REO_STATUS,
995 	WLAN_MD_DP_SRNG_TCL_DATA,
996 	WLAN_MD_DP_SRNG_TCL_CMD,
997 	WLAN_MD_DP_SRNG_TCL_STATUS,
998 	WLAN_MD_DP_SRNG_TX_COMP,
999 	WLAN_MD_DP_SRNG_WBM_DESC_REL,
1000 	WLAN_MD_DP_SRNG_WBM_IDLE_LINK,
1001 	WLAN_MD_DP_LINK_DESC_BANK,
1002 	WLAN_MD_DP_SRNG_RXDMA_MON_STATUS,
1003 	WLAN_MD_DP_SRNG_RXDMA_MON_BUF,
1004 	WLAN_MD_DP_SRNG_RXDMA_MON_DST,
1005 	WLAN_MD_DP_SRNG_RXDMA_MON_DESC,
1006 	WLAN_MD_DP_SRNG_RXDMA_ERR_DST,
1007 	WLAN_MD_DP_HAL_SOC,
1008 	WLAN_MD_OBJMGR_PSOC,
1009 	WLAN_MD_OBJMGR_PSOC_TGT_INFO,
1010 	WLAN_MD_OBJMGR_PDEV,
1011 	WLAN_MD_OBJMGR_PDEV_MLME,
1012 	WLAN_MD_OBJMGR_VDEV,
1013 	WLAN_MD_OBJMGR_VDEV_MLME,
1014 	WLAN_MD_OBJMGR_VDEV_SM,
1015 	WLAN_MD_DP_SRNG_REO2PPE,
1016 	WLAN_MD_DP_SRNG_PPE2TCL,
1017 	WLAN_MD_DP_SRNG_PPE_RELEASE,
1018 	WLAN_MD_DP_SRNG_PPE_WBM2SW_RELEASE,
1019 	WLAN_MD_DP_SRNG_SW2RXDMA_LINK_RING,
1020 	WLAN_MD_MAX
1021 };
1022 
1023 /**
1024  * wlan_minidump_log() - Log memory address to be included in minidump
1025  * @start_addr: Start address of the memory to be dumped
1026  * @size: Size in bytes
1027  * @psoc_obj: Psoc Object
1028  * @type: Type of data structure
1029  * @name: String to identify this entry
1030  */
1031 void wlan_minidump_log(void *start_addr, const size_t size,
1032 		       void *psoc_obj,
1033 		       enum wlan_minidump_host_data type,
1034 		       const char *name);
1035 
1036 /**
1037  * wlan_minidump_remove() - Remove memory address from  minidump
1038  * @start_addr: Start address of the memory previously added
1039  * @size: Size in bytes
1040  * @psoc_obj: Psoc Object
1041  * @type: Type of data structure
1042  * @name: String to identify this entry
1043  */
1044 void wlan_minidump_remove(void *start_addr, const size_t size,
1045 			  void *psoc_obj,
1046 			  enum wlan_minidump_host_data type,
1047 			  const char *name);
1048 
1049 /**
1050  * wlan_util_is_vdev_in_cac_wait() - Check if dfs sap vdev is in cac wait
1051  * @pdev: pdev object
1052  * @dbg_id: object manager ref id
1053  *
1054  * This function checks if dfs sap vdev is in cac wait state
1055  *
1056  * Return: true, if cac is in progress, otherwise false
1057  */
1058 bool wlan_util_is_vdev_in_cac_wait(struct wlan_objmgr_pdev *pdev,
1059 				   wlan_objmgr_ref_dbgid dbg_id);
1060 
1061 /**
1062  * wlan_eht_chan_phy_mode - convert eht chan to phy mode
1063  * @freq: frequency
1064  * @bw_val: bandwidth
1065  * @chan_width: channel width
1066  *
1067  * Return: return phy mode
1068  */
1069 enum wlan_phymode
1070 wlan_eht_chan_phy_mode(uint32_t freq,
1071 		       uint16_t bw_val,
1072 		       enum phy_ch_width chan_width);
1073 #endif /* _WLAN_UTILITY_H_ */
1074