wlan_utility.h 46 KB

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