dp_tx.h 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef __DP_TX_H
  20. #define __DP_TX_H
  21. #include <qdf_types.h>
  22. #include <qdf_nbuf.h>
  23. #include "dp_types.h"
  24. #ifdef FEATURE_PERPKT_INFO
  25. #if defined(QCA_SUPPORT_LATENCY_CAPTURE) || \
  26. defined(QCA_TX_CAPTURE_SUPPORT) || \
  27. defined(QCA_MCOPY_SUPPORT)
  28. #include "if_meta_hdr.h"
  29. #endif
  30. #endif
  31. #include "dp_internal.h"
  32. #include "hal_tx.h"
  33. #include <qdf_tracepoint.h>
  34. #ifdef CONFIG_SAWF
  35. #include "dp_sawf.h"
  36. #endif
  37. #include <qdf_pkt_add_timestamp.h>
  38. #include "dp_ipa.h"
  39. #ifdef IPA_OFFLOAD
  40. #include <wlan_ipa_obj_mgmt_api.h>
  41. #endif
  42. #define DP_INVALID_VDEV_ID 0xFF
  43. #define DP_TX_MAX_NUM_FRAGS 6
  44. /* invalid peer id for reinject*/
  45. #define DP_INVALID_PEER 0XFFFE
  46. void dp_tx_nawds_handler(struct dp_soc *soc, struct dp_vdev *vdev,
  47. struct dp_tx_msdu_info_s *msdu_info,
  48. qdf_nbuf_t nbuf, uint16_t sa_peer_id);
  49. int dp_tx_proxy_arp(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  50. /*
  51. * DP_TX_DESC_FLAG_FRAG flags should always be defined to 0x1
  52. * please do not change this flag's definition
  53. */
  54. #define DP_TX_DESC_FLAG_FRAG 0x1
  55. #define DP_TX_DESC_FLAG_TO_FW 0x2
  56. #define DP_TX_DESC_FLAG_SIMPLE 0x4
  57. #define DP_TX_DESC_FLAG_RAW 0x8
  58. #define DP_TX_DESC_FLAG_MESH 0x10
  59. #define DP_TX_DESC_FLAG_QUEUED_TX 0x20
  60. #define DP_TX_DESC_FLAG_COMPLETED_TX 0x40
  61. #define DP_TX_DESC_FLAG_ME 0x80
  62. #define DP_TX_DESC_FLAG_TDLS_FRAME 0x100
  63. #define DP_TX_DESC_FLAG_ALLOCATED 0x200
  64. #define DP_TX_DESC_FLAG_MESH_MODE 0x400
  65. #define DP_TX_DESC_FLAG_UNMAP_DONE 0x800
  66. #define DP_TX_DESC_FLAG_TX_COMP_ERR 0x1000
  67. #define DP_TX_DESC_FLAG_FLUSH 0x2000
  68. #define DP_TX_DESC_FLAG_TRAFFIC_END_IND 0x4000
  69. #define DP_TX_DESC_FLAG_RMNET 0x8000
  70. #define DP_TX_DESC_FLAG_FASTPATH_SIMPLE 0x10000
  71. #define DP_TX_DESC_FLAG_PPEDS 0x20000
  72. #define DP_TX_DESC_FLAG_FAST 0x40000
  73. #define DP_TX_DESC_FLAG_SPECIAL 0x80000
  74. #define DP_TX_EXT_DESC_FLAG_METADATA_VALID 0x1
  75. #define DP_TX_FREE_SINGLE_BUF(soc, buf) \
  76. do { \
  77. qdf_nbuf_unmap(soc->osdev, buf, QDF_DMA_TO_DEVICE); \
  78. qdf_nbuf_free(buf); \
  79. } while (0)
  80. #define OCB_HEADER_VERSION 1
  81. #ifdef TX_PER_PDEV_DESC_POOL
  82. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  83. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id)
  84. #else /* QCA_LL_TX_FLOW_CONTROL_V2 */
  85. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->pdev->pdev_id)
  86. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  87. #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id)
  88. #else
  89. #ifdef TX_PER_VDEV_DESC_POOL
  90. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id)
  91. #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id)
  92. #endif /* TX_PER_VDEV_DESC_POOL */
  93. #endif /* TX_PER_PDEV_DESC_POOL */
  94. #define DP_TX_QUEUE_MASK 0x3
  95. #define MAX_CDP_SEC_TYPE 12
  96. /* number of dwords for htt_tx_msdu_desc_ext2_t */
  97. #define DP_TX_MSDU_INFO_META_DATA_DWORDS 9
  98. #define dp_tx_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_TX, params)
  99. #define dp_tx_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_TX, params)
  100. #define dp_tx_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP_TX, params)
  101. #define dp_tx_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_TX, params)
  102. #define dp_tx_info(params...) \
  103. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX, ## params)
  104. #define dp_tx_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_TX, params)
  105. #define dp_tx_comp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_TX_COMP, params)
  106. #define dp_tx_comp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_TX_COMP, params)
  107. #define dp_tx_comp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_TX_COMP, params)
  108. #define dp_tx_comp_info(params...) \
  109. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX_COMP, ## params)
  110. #define dp_tx_comp_info_rl(params...) \
  111. __QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX_COMP, ## params)
  112. #define dp_tx_comp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_TX_COMP, params)
  113. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  114. /**
  115. * struct dp_tx_frag_info_s
  116. * @vaddr: hlos virtual address for buffer
  117. * @paddr_lo: physical address lower 32bits
  118. * @paddr_hi: physical address higher bits
  119. * @len: length of the buffer
  120. */
  121. struct dp_tx_frag_info_s {
  122. uint8_t *vaddr;
  123. uint32_t paddr_lo;
  124. uint16_t paddr_hi;
  125. uint16_t len;
  126. };
  127. /**
  128. * struct dp_tx_seg_info_s - Segmentation Descriptor
  129. * @nbuf: NBUF pointer if segment corresponds to separate nbuf
  130. * @frag_cnt: Fragment count in this segment
  131. * @total_len: Total length of segment
  132. * @frags: per-Fragment information
  133. * @next: pointer to next MSDU segment
  134. */
  135. struct dp_tx_seg_info_s {
  136. qdf_nbuf_t nbuf;
  137. uint16_t frag_cnt;
  138. uint16_t total_len;
  139. struct dp_tx_frag_info_s frags[DP_TX_MAX_NUM_FRAGS];
  140. struct dp_tx_seg_info_s *next;
  141. };
  142. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  143. /**
  144. * struct dp_tx_sg_info_s - Scatter Gather Descriptor
  145. * @num_segs: Number of segments (TSO/ME) in the frame
  146. * @total_len: Total length of the frame
  147. * @curr_seg: Points to current segment descriptor to be processed. Chain of
  148. * descriptors for SG frames/multicast-unicast converted packets.
  149. *
  150. * Used for SG (802.3 or Raw) frames and Multicast-Unicast converted frames to
  151. * carry fragmentation information
  152. * Raw Frames will be handed over to driver as an SKB chain with MPDU boundaries
  153. * indicated through flags in SKB CB (first_msdu and last_msdu). This will be
  154. * converted into set of skb sg (nr_frags) structures.
  155. */
  156. struct dp_tx_sg_info_s {
  157. uint32_t num_segs;
  158. uint32_t total_len;
  159. struct dp_tx_seg_info_s *curr_seg;
  160. };
  161. /**
  162. * struct dp_tx_queue - Tx queue
  163. * @desc_pool_id: Descriptor Pool to be used for the tx queue
  164. * @ring_id: TCL descriptor ring ID corresponding to the tx queue
  165. *
  166. * Tx queue contains information of the software (Descriptor pool)
  167. * and hardware resources (TCL ring id) to be used for a particular
  168. * transmit queue (obtained from skb_queue_mapping in case of linux)
  169. */
  170. struct dp_tx_queue {
  171. uint8_t desc_pool_id;
  172. uint8_t ring_id;
  173. };
  174. /**
  175. * struct dp_tx_msdu_info_s - MSDU Descriptor
  176. * @frm_type: Frame type - Regular/TSO/SG/Multicast enhancement
  177. * @tx_queue: Tx queue on which this MSDU should be transmitted
  178. * @num_seg: Number of segments (TSO)
  179. * @tid: TID (override) that is sent from HLOS
  180. * @exception_fw: Duplicate frame to be sent to firmware
  181. * @is_tx_sniffer: Indicates if the packet has to be sniffed
  182. * @u: union of frame information structs
  183. * @u.tso_info: TSO information for TSO frame types
  184. * (chain of the TSO segments, number of segments)
  185. * @u.sg_info: Scatter Gather information for non-TSO SG frames
  186. * @meta_data: Mesh meta header information
  187. * @ppdu_cookie: 16-bit ppdu_cookie that has to be replayed back in completions
  188. * @xmit_type: xmit type of packet Link (0)/MLD (1)
  189. * @gsn: global sequence for reinjected mcast packets
  190. * @vdev_id : vdev_id for reinjected mcast packets
  191. * @skip_hp_update : Skip HP update for TSO segments and update in last segment
  192. * @buf_len:
  193. * @payload_addr:
  194. * @driver_ingress_ts: driver ingress timestamp
  195. *
  196. * This structure holds the complete MSDU information needed to program the
  197. * Hardware TCL and MSDU extension descriptors for different frame types
  198. *
  199. */
  200. struct dp_tx_msdu_info_s {
  201. enum dp_tx_frm_type frm_type;
  202. struct dp_tx_queue tx_queue;
  203. uint32_t num_seg;
  204. uint8_t tid;
  205. uint8_t exception_fw;
  206. uint8_t is_tx_sniffer;
  207. union {
  208. struct qdf_tso_info_t tso_info;
  209. struct dp_tx_sg_info_s sg_info;
  210. } u;
  211. uint32_t meta_data[DP_TX_MSDU_INFO_META_DATA_DWORDS];
  212. uint16_t ppdu_cookie;
  213. uint8_t xmit_type;
  214. #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
  215. #ifdef WLAN_MCAST_MLO
  216. uint16_t gsn;
  217. uint8_t vdev_id;
  218. #endif
  219. #endif
  220. #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR
  221. uint8_t skip_hp_update;
  222. #endif
  223. #ifdef QCA_DP_TX_RMNET_OPTIMIZATION
  224. uint16_t buf_len;
  225. uint8_t *payload_addr;
  226. #endif
  227. #ifdef WLAN_FEATURE_TX_LATENCY_STATS
  228. qdf_ktime_t driver_ingress_ts;
  229. #endif
  230. };
  231. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  232. /**
  233. * dp_tx_deinit_pair_by_index() - Deinit TX rings based on index
  234. * @soc: core txrx context
  235. * @index: index of ring to deinit
  236. *
  237. * Deinit 1 TCL and 1 WBM2SW release ring on as needed basis using
  238. * index of the respective TCL/WBM2SW release in soc structure.
  239. * For example, if the index is 2 then &soc->tcl_data_ring[2]
  240. * and &soc->tx_comp_ring[2] will be deinitialized.
  241. *
  242. * Return: none
  243. */
  244. void dp_tx_deinit_pair_by_index(struct dp_soc *soc, int index);
  245. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  246. /**
  247. * dp_tx_comp_process_desc_list() - Tx complete software descriptor handler
  248. * @soc: core txrx main context
  249. * @comp_head: software descriptor head pointer
  250. * @ring_id: ring number
  251. *
  252. * This function will process batch of descriptors reaped by dp_tx_comp_handler
  253. * and release the software descriptors after processing is complete
  254. *
  255. * Return: none
  256. */
  257. void
  258. dp_tx_comp_process_desc_list(struct dp_soc *soc,
  259. struct dp_tx_desc_s *comp_head, uint8_t ring_id);
  260. /**
  261. * dp_tx_comp_process_desc_list_fast() - Tx complete fast sw descriptor handler
  262. * @soc: core txrx main context
  263. * @head_desc: software descriptor head pointer
  264. * @tail_desc: software descriptor tail pointer
  265. * @ring_id: ring number
  266. * @fast_desc_count: Total descriptor count in the list
  267. *
  268. * This function will process batch of descriptors reaped by dp_tx_comp_handler
  269. * and append the list of descriptors to the freelist
  270. *
  271. * Return: none
  272. */
  273. void
  274. dp_tx_comp_process_desc_list_fast(struct dp_soc *soc,
  275. struct dp_tx_desc_s *head_desc,
  276. struct dp_tx_desc_s *tail_desc,
  277. uint8_t ring_id,
  278. uint32_t fast_desc_count);
  279. /**
  280. * dp_tx_comp_free_buf() - Free nbuf associated with the Tx Descriptor
  281. * @soc: Soc handle
  282. * @desc: software Tx descriptor to be processed
  283. * @delayed_free: defer freeing of nbuf
  284. *
  285. * Return: nbuf to be freed later
  286. */
  287. qdf_nbuf_t dp_tx_comp_free_buf(struct dp_soc *soc, struct dp_tx_desc_s *desc,
  288. bool delayed_free);
  289. /**
  290. * dp_tx_desc_release() - Release Tx Descriptor
  291. * @soc: Soc handle
  292. * @tx_desc: Tx Descriptor
  293. * @desc_pool_id: Descriptor Pool ID
  294. *
  295. * Deallocate all resources attached to Tx descriptor and free the Tx
  296. * descriptor.
  297. *
  298. * Return:
  299. */
  300. void dp_tx_desc_release(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc,
  301. uint8_t desc_pool_id);
  302. /**
  303. * dp_tx_compute_delay() - Compute and fill in all timestamps
  304. * to pass in correct fields
  305. * @vdev: pdev handle
  306. * @tx_desc: tx descriptor
  307. * @tid: tid value
  308. * @ring_id: TCL or WBM ring number for transmit path
  309. *
  310. * Return: none
  311. */
  312. void dp_tx_compute_delay(struct dp_vdev *vdev, struct dp_tx_desc_s *tx_desc,
  313. uint8_t tid, uint8_t ring_id);
  314. /**
  315. * dp_tx_comp_process_tx_status() - Parse and Dump Tx completion status info
  316. * @soc: DP soc handle
  317. * @tx_desc: software descriptor head pointer
  318. * @ts: Tx completion status
  319. * @txrx_peer: txrx peer handle
  320. * @ring_id: ring number
  321. *
  322. * Return: none
  323. */
  324. void dp_tx_comp_process_tx_status(struct dp_soc *soc,
  325. struct dp_tx_desc_s *tx_desc,
  326. struct hal_tx_completion_status *ts,
  327. struct dp_txrx_peer *txrx_peer,
  328. uint8_t ring_id);
  329. /**
  330. * dp_tx_comp_process_desc() - Process tx descriptor and free associated nbuf
  331. * @soc: DP Soc handle
  332. * @desc: software Tx descriptor
  333. * @ts: Tx completion status from HAL/HTT descriptor
  334. * @txrx_peer: DP peer context
  335. *
  336. * Return: none
  337. */
  338. void dp_tx_comp_process_desc(struct dp_soc *soc,
  339. struct dp_tx_desc_s *desc,
  340. struct hal_tx_completion_status *ts,
  341. struct dp_txrx_peer *txrx_peer);
  342. /**
  343. * dp_tx_reinject_handler() - Tx Reinject Handler
  344. * @soc: datapath soc handle
  345. * @vdev: datapath vdev handle
  346. * @tx_desc: software descriptor head pointer
  347. * @status: Tx completion status from HTT descriptor
  348. * @reinject_reason: reinject reason from HTT descriptor
  349. *
  350. * This function reinjects frames back to Target.
  351. * Todo - Host queue needs to be added
  352. *
  353. * Return: none
  354. */
  355. void dp_tx_reinject_handler(struct dp_soc *soc,
  356. struct dp_vdev *vdev,
  357. struct dp_tx_desc_s *tx_desc,
  358. uint8_t *status,
  359. uint8_t reinject_reason);
  360. /**
  361. * dp_tx_inspect_handler() - Tx Inspect Handler
  362. * @soc: datapath soc handle
  363. * @vdev: datapath vdev handle
  364. * @tx_desc: software descriptor head pointer
  365. * @status: Tx completion status from HTT descriptor
  366. *
  367. * Handles Tx frames sent back to Host for inspection
  368. * (ProxyARP)
  369. *
  370. * Return: none
  371. */
  372. void dp_tx_inspect_handler(struct dp_soc *soc,
  373. struct dp_vdev *vdev,
  374. struct dp_tx_desc_s *tx_desc,
  375. uint8_t *status);
  376. /**
  377. * dp_tx_update_peer_basic_stats() - Update peer basic stats
  378. * @txrx_peer: Datapath txrx_peer handle
  379. * @length: Length of the packet
  380. * @tx_status: Tx status from TQM/FW
  381. * @update: enhanced flag value present in dp_pdev
  382. *
  383. * Return: none
  384. */
  385. void dp_tx_update_peer_basic_stats(struct dp_txrx_peer *txrx_peer,
  386. uint32_t length, uint8_t tx_status,
  387. bool update);
  388. #ifdef DP_UMAC_HW_RESET_SUPPORT
  389. /**
  390. * dp_tx_drop() - Drop the frame on a given VAP
  391. * @soc: DP soc handle
  392. * @vdev_id: id of DP vdev handle
  393. * @nbuf: skb
  394. *
  395. * Drop all the incoming packets
  396. *
  397. * Return: nbuf
  398. */
  399. qdf_nbuf_t dp_tx_drop(struct cdp_soc_t *soc, uint8_t vdev_id, qdf_nbuf_t nbuf);
  400. /**
  401. * dp_tx_exc_drop() - Drop the frame on a given VAP
  402. * @soc_hdl: DP soc handle
  403. * @vdev_id: id of DP vdev handle
  404. * @nbuf: skb
  405. * @tx_exc_metadata: Handle that holds exception path meta data
  406. *
  407. * Drop all the incoming packets
  408. *
  409. * Return: nbuf
  410. */
  411. qdf_nbuf_t dp_tx_exc_drop(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  412. qdf_nbuf_t nbuf,
  413. struct cdp_tx_exception_metadata *tx_exc_metadata);
  414. #endif
  415. #ifdef WLAN_SUPPORT_PPEDS
  416. qdf_nbuf_t
  417. dp_ppeds_tx_desc_free(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc);
  418. #else
  419. static inline qdf_nbuf_t
  420. dp_ppeds_tx_desc_free(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc)
  421. {
  422. return NULL;
  423. }
  424. #endif
  425. /**
  426. * dp_get_updated_tx_desc() - get updated tx_desc value
  427. * @psoc: psoc object
  428. * @pool_num: Tx desc pool Id
  429. * @current_desc: Current Tx Desc value
  430. *
  431. * In Lowmem profiles the number of Tx desc in 4th pool is reduced to quarter
  432. * for memory optimizations via this flag DP_TX_DESC_POOL_OPTIMIZE
  433. *
  434. * Return: Updated Tx Desc value
  435. */
  436. #ifdef DP_TX_DESC_POOL_OPTIMIZE
  437. static inline uint32_t dp_get_updated_tx_desc(struct cdp_ctrl_objmgr_psoc *psoc,
  438. uint8_t pool_num,
  439. uint32_t current_desc)
  440. {
  441. if (pool_num == 3)
  442. return cfg_get(psoc, CFG_DP_TX_DESC_POOL_3);
  443. else
  444. return current_desc;
  445. }
  446. #else
  447. static inline uint32_t dp_get_updated_tx_desc(struct cdp_ctrl_objmgr_psoc *psoc,
  448. uint8_t pool_num,
  449. uint32_t current_desc)
  450. {
  451. return current_desc;
  452. }
  453. #endif
  454. #ifdef DP_TX_EXT_DESC_POOL_OPTIMIZE
  455. /**
  456. * dp_tx_ext_desc_pool_override() - Override tx ext desc pool Id
  457. * @desc_pool_id: Desc pool Id
  458. *
  459. * For low mem profiles the number of ext_tx_desc_pool is reduced to 1.
  460. * Since in Tx path the desc_pool_id is filled based on CPU core,
  461. * dp_tx_ext_desc_pool_override will return the desc_pool_id as 0 for lowmem
  462. * profiles.
  463. *
  464. * Return: updated tx_ext_desc_pool Id
  465. */
  466. static inline uint8_t dp_tx_ext_desc_pool_override(uint8_t desc_pool_id)
  467. {
  468. return 0;
  469. }
  470. /**
  471. * dp_get_ext_tx_desc_pool_num() - get the number of ext_tx_desc pool
  472. * @soc: core txrx main context
  473. *
  474. * For lowmem profiles the number of ext_tx_desc pool is reduced to 1 for
  475. * memory optimizations.
  476. * Based on this flag DP_TX_EXT_DESC_POOL_OPTIMIZE dp_get_ext_tx_desc_pool_num
  477. * will return reduced desc_pool value 1 for low mem profile and for the other
  478. * profiles it will return the same value as tx_desc pool.
  479. *
  480. * Return: number of ext_tx_desc pool
  481. */
  482. static inline uint8_t dp_get_ext_tx_desc_pool_num(struct dp_soc *soc)
  483. {
  484. return 1;
  485. }
  486. #else
  487. static inline uint8_t dp_tx_ext_desc_pool_override(uint8_t desc_pool_id)
  488. {
  489. return desc_pool_id;
  490. }
  491. static inline uint8_t dp_get_ext_tx_desc_pool_num(struct dp_soc *soc)
  492. {
  493. return wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
  494. }
  495. #endif
  496. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  497. /**
  498. * dp_tso_soc_attach() - TSO Attach handler
  499. * @txrx_soc: Opaque Dp handle
  500. *
  501. * Reserve TSO descriptor buffers
  502. *
  503. * Return: QDF_STATUS_E_FAILURE on failure or
  504. * QDF_STATUS_SUCCESS on success
  505. */
  506. QDF_STATUS dp_tso_soc_attach(struct cdp_soc_t *txrx_soc);
  507. /**
  508. * dp_tso_soc_detach() - TSO Detach handler
  509. * @txrx_soc: Opaque Dp handle
  510. *
  511. * Deallocate TSO descriptor buffers
  512. *
  513. * Return: QDF_STATUS_E_FAILURE on failure or
  514. * QDF_STATUS_SUCCESS on success
  515. */
  516. QDF_STATUS dp_tso_soc_detach(struct cdp_soc_t *txrx_soc);
  517. /**
  518. * dp_tx_send() - Transmit a frame on a given VAP
  519. * @soc_hdl: DP soc handle
  520. * @vdev_id: id of DP vdev handle
  521. * @nbuf: skb
  522. *
  523. * Entry point for Core Tx layer (DP_TX) invoked from
  524. * hard_start_xmit in OSIF/HDD or from dp_rx_process for intravap forwarding
  525. * cases
  526. *
  527. * Return: NULL on success,
  528. * nbuf when it fails to send
  529. */
  530. qdf_nbuf_t dp_tx_send(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  531. qdf_nbuf_t nbuf);
  532. /**
  533. * dp_tx_send_vdev_id_check() - Transmit a frame on a given VAP in special
  534. * case to avoid check in per-packet path.
  535. * @soc_hdl: DP soc handle
  536. * @vdev_id: id of DP vdev handle
  537. * @nbuf: skb
  538. *
  539. * Entry point for Core Tx layer (DP_TX) invoked from
  540. * hard_start_xmit in OSIF/HDD to transmit packet through dp_tx_send
  541. * with special condition to avoid per pkt check in dp_tx_send
  542. *
  543. * Return: NULL on success,
  544. * nbuf when it fails to send
  545. */
  546. qdf_nbuf_t dp_tx_send_vdev_id_check(struct cdp_soc_t *soc_hdl,
  547. uint8_t vdev_id, qdf_nbuf_t nbuf);
  548. /**
  549. * dp_tx_send_exception() - Transmit a frame on a given VAP in exception path
  550. * @soc_hdl: DP soc handle
  551. * @vdev_id: id of DP vdev handle
  552. * @nbuf: skb
  553. * @tx_exc_metadata: Handle that holds exception path meta data
  554. *
  555. * Entry point for Core Tx layer (DP_TX) invoked from
  556. * hard_start_xmit in OSIF/HDD to transmit frames through fw
  557. *
  558. * Return: NULL on success,
  559. * nbuf when it fails to send
  560. */
  561. qdf_nbuf_t
  562. dp_tx_send_exception(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  563. qdf_nbuf_t nbuf,
  564. struct cdp_tx_exception_metadata *tx_exc_metadata);
  565. /**
  566. * dp_tx_send_exception_vdev_id_check() - Transmit a frame on a given VAP
  567. * in exception path in special case to avoid regular exception path chk.
  568. * @soc_hdl: DP soc handle
  569. * @vdev_id: id of DP vdev handle
  570. * @nbuf: skb
  571. * @tx_exc_metadata: Handle that holds exception path meta data
  572. *
  573. * Entry point for Core Tx layer (DP_TX) invoked from
  574. * hard_start_xmit in OSIF/HDD to transmit frames through fw
  575. *
  576. * Return: NULL on success,
  577. * nbuf when it fails to send
  578. */
  579. qdf_nbuf_t
  580. dp_tx_send_exception_vdev_id_check(struct cdp_soc_t *soc_hdl,
  581. uint8_t vdev_id, qdf_nbuf_t nbuf,
  582. struct cdp_tx_exception_metadata *tx_exc_metadata);
  583. /**
  584. * dp_tx_send_mesh() - Transmit mesh frame on a given VAP
  585. * @soc_hdl: DP soc handle
  586. * @vdev_id: DP vdev handle
  587. * @nbuf: skb
  588. *
  589. * Entry point for Core Tx layer (DP_TX) invoked from
  590. * hard_start_xmit in OSIF/HDD
  591. *
  592. * Return: NULL on success,
  593. * nbuf when it fails to send
  594. */
  595. qdf_nbuf_t dp_tx_send_mesh(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  596. qdf_nbuf_t nbuf);
  597. /**
  598. * dp_tx_send_msdu_single() - Setup descriptor and enqueue single MSDU to TCL
  599. * @vdev: DP vdev handle
  600. * @nbuf: skb
  601. * @msdu_info: MSDU information
  602. * @peer_id: peer_id of the peer in case of NAWDS frames
  603. * @tx_exc_metadata: Handle that holds exception path metadata
  604. *
  605. * Return: NULL on success,
  606. * nbuf when it fails to send
  607. */
  608. qdf_nbuf_t
  609. dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  610. struct dp_tx_msdu_info_s *msdu_info, uint16_t peer_id,
  611. struct cdp_tx_exception_metadata *tx_exc_metadata);
  612. /**
  613. * dp_tx_mcast_enhance() - Multicast enhancement on TX
  614. * @vdev: DP vdev handle
  615. * @nbuf: network buffer to be transmitted
  616. *
  617. * Return: true on success
  618. * false on failure
  619. */
  620. bool dp_tx_mcast_enhance(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  621. /**
  622. * dp_tx_send_msdu_multiple() - Enqueue multiple MSDUs
  623. * @vdev: DP vdev handle
  624. * @nbuf: skb
  625. * @msdu_info: MSDU info to be setup in MSDU extension descriptor
  626. *
  627. * Prepare descriptors for multiple MSDUs (TSO segments) and enqueue to TCL
  628. *
  629. * Return: NULL on success,
  630. * nbuf when it fails to send
  631. */
  632. #if QDF_LOCK_STATS
  633. noinline qdf_nbuf_t
  634. dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  635. struct dp_tx_msdu_info_s *msdu_info);
  636. #else
  637. qdf_nbuf_t dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  638. struct dp_tx_msdu_info_s *msdu_info);
  639. #endif
  640. #ifdef FEATURE_WLAN_TDLS
  641. /**
  642. * dp_tx_non_std() - Allow the control-path SW to send data frames
  643. * @soc_hdl: Datapath soc handle
  644. * @vdev_id: id of vdev
  645. * @tx_spec: what non-standard handling to apply to the tx data frames
  646. * @msdu_list: NULL-terminated list of tx MSDUs
  647. *
  648. * Return: NULL on success,
  649. * nbuf when it fails to send
  650. */
  651. qdf_nbuf_t dp_tx_non_std(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  652. enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list);
  653. #endif
  654. /**
  655. * dp_tx_frame_is_drop() - checks if the packet is loopback
  656. * @vdev: DP vdev handle
  657. * @srcmac: source MAC address
  658. * @dstmac: destination MAC address
  659. *
  660. * Return: 1 if frame needs to be dropped else 0
  661. */
  662. int dp_tx_frame_is_drop(struct dp_vdev *vdev, uint8_t *srcmac, uint8_t *dstmac);
  663. #ifndef WLAN_SOFTUMAC_SUPPORT
  664. /**
  665. * dp_tx_comp_handler() - Tx completion handler
  666. * @int_ctx: pointer to DP interrupt context
  667. * @soc: core txrx main context
  668. * @hal_srng: Opaque HAL SRNG pointer
  669. * @ring_id: completion ring id
  670. * @quota: No. of packets/descriptors that can be serviced in one loop
  671. *
  672. * This function will collect hardware release ring element contents and
  673. * handle descriptor contents. Based on contents, free packet or handle error
  674. * conditions
  675. *
  676. * Return: Number of TX completions processed
  677. */
  678. uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
  679. hal_ring_handle_t hal_srng, uint8_t ring_id,
  680. uint32_t quota);
  681. #endif
  682. void
  683. dp_tx_comp_process_desc_list(struct dp_soc *soc,
  684. struct dp_tx_desc_s *comp_head, uint8_t ring_id);
  685. QDF_STATUS
  686. dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  687. QDF_STATUS
  688. dp_tx_prepare_send_igmp_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  689. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  690. #if defined(QCA_HOST_MODE_WIFI_DISABLED) || !defined(ATH_SUPPORT_IQUE)
  691. static inline void dp_tx_me_exit(struct dp_pdev *pdev)
  692. {
  693. return;
  694. }
  695. #endif
  696. /**
  697. * dp_tx_pdev_init() - dp tx pdev init
  698. * @pdev: physical device instance
  699. *
  700. * Return: QDF_STATUS_SUCCESS: success
  701. * QDF_STATUS_E_RESOURCES: Error return
  702. */
  703. static inline QDF_STATUS dp_tx_pdev_init(struct dp_pdev *pdev)
  704. {
  705. struct dp_soc *soc = pdev->soc;
  706. /* Initialize Flow control counters */
  707. qdf_atomic_init(&pdev->num_tx_outstanding);
  708. pdev->tx_descs_max = 0;
  709. if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) {
  710. /* Initialize descriptors in TCL Ring */
  711. hal_tx_init_data_ring(soc->hal_soc,
  712. soc->tcl_data_ring[pdev->pdev_id].hal_srng);
  713. }
  714. return QDF_STATUS_SUCCESS;
  715. }
  716. /**
  717. * dp_tx_prefetch_hw_sw_nbuf_desc() - function to prefetch HW and SW desc
  718. * @soc: Handle to HAL Soc structure
  719. * @hal_soc: HAL SOC handle
  720. * @num_avail_for_reap: descriptors available for reap
  721. * @hal_ring_hdl: ring pointer
  722. * @last_prefetched_hw_desc: pointer to the last prefetched HW descriptor
  723. * @last_prefetched_sw_desc: pointer to last prefetch SW desc
  724. * @last_hw_desc: pointer to last HW desc
  725. *
  726. * Return: None
  727. */
  728. #ifdef QCA_DP_TX_HW_SW_NBUF_DESC_PREFETCH
  729. static inline
  730. void dp_tx_prefetch_hw_sw_nbuf_desc(struct dp_soc *soc,
  731. hal_soc_handle_t hal_soc,
  732. uint32_t num_avail_for_reap,
  733. hal_ring_handle_t hal_ring_hdl,
  734. void **last_prefetched_hw_desc,
  735. struct dp_tx_desc_s
  736. **last_prefetched_sw_desc,
  737. void *last_hw_desc)
  738. {
  739. if (*last_prefetched_sw_desc) {
  740. qdf_prefetch((uint8_t *)(*last_prefetched_sw_desc)->nbuf);
  741. qdf_prefetch((uint8_t *)(*last_prefetched_sw_desc)->nbuf + 64);
  742. }
  743. if (qdf_unlikely(last_hw_desc &&
  744. (*last_prefetched_hw_desc == last_hw_desc)))
  745. return;
  746. if (num_avail_for_reap && *last_prefetched_hw_desc) {
  747. soc->arch_ops.tx_comp_get_params_from_hal_desc(soc,
  748. *last_prefetched_hw_desc,
  749. last_prefetched_sw_desc);
  750. if ((uintptr_t)*last_prefetched_hw_desc & 0x3f)
  751. *last_prefetched_hw_desc =
  752. hal_srng_dst_prefetch_next_cached_desc(
  753. hal_soc,
  754. hal_ring_hdl,
  755. (uint8_t *)*last_prefetched_hw_desc);
  756. else
  757. *last_prefetched_hw_desc =
  758. hal_srng_dst_get_next_32_byte_desc(hal_soc,
  759. hal_ring_hdl,
  760. (uint8_t *)*last_prefetched_hw_desc);
  761. }
  762. }
  763. #else
  764. static inline
  765. void dp_tx_prefetch_hw_sw_nbuf_desc(struct dp_soc *soc,
  766. hal_soc_handle_t hal_soc,
  767. uint32_t num_avail_for_reap,
  768. hal_ring_handle_t hal_ring_hdl,
  769. void **last_prefetched_hw_desc,
  770. struct dp_tx_desc_s
  771. **last_prefetched_sw_desc,
  772. void *last_hw_desc)
  773. {
  774. }
  775. #endif
  776. #ifndef FEATURE_WDS
  777. static inline void dp_tx_mec_handler(struct dp_vdev *vdev, uint8_t *status)
  778. {
  779. return;
  780. }
  781. #endif
  782. #ifndef QCA_MULTIPASS_SUPPORT
  783. static inline
  784. bool dp_tx_multipass_process(struct dp_soc *soc, struct dp_vdev *vdev,
  785. qdf_nbuf_t nbuf,
  786. struct dp_tx_msdu_info_s *msdu_info)
  787. {
  788. return true;
  789. }
  790. static inline
  791. void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev)
  792. {
  793. }
  794. #else
  795. /**
  796. * dp_tx_multipass_process() - Process vlan frames in tx path
  797. * @soc: dp soc handle
  798. * @vdev: DP vdev handle
  799. * @nbuf: skb
  800. * @msdu_info: msdu descriptor
  801. *
  802. * Return: status whether frame needs to be dropped or transmitted
  803. */
  804. bool dp_tx_multipass_process(struct dp_soc *soc, struct dp_vdev *vdev,
  805. qdf_nbuf_t nbuf,
  806. struct dp_tx_msdu_info_s *msdu_info);
  807. /**
  808. * dp_tx_vdev_multipass_deinit() - set vlan map for vdev
  809. * @vdev: pointer to vdev
  810. *
  811. * return: void
  812. */
  813. void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev);
  814. /**
  815. * dp_tx_add_groupkey_metadata() - Add group key in metadata
  816. * @vdev: DP vdev handle
  817. * @msdu_info: MSDU info to be setup in MSDU descriptor
  818. * @group_key: Group key index programmed in metadata
  819. *
  820. * Return: void
  821. */
  822. void dp_tx_add_groupkey_metadata(struct dp_vdev *vdev,
  823. struct dp_tx_msdu_info_s *msdu_info,
  824. uint16_t group_key);
  825. #endif
  826. /**
  827. * dp_tx_hw_to_qdf()- convert hw status to qdf status
  828. * @status: hw status
  829. *
  830. * Return: qdf tx rx status
  831. */
  832. static inline enum qdf_dp_tx_rx_status dp_tx_hw_to_qdf(uint16_t status)
  833. {
  834. switch (status) {
  835. case HAL_TX_TQM_RR_FRAME_ACKED:
  836. return QDF_TX_RX_STATUS_OK;
  837. case HAL_TX_TQM_RR_REM_CMD_TX:
  838. return QDF_TX_RX_STATUS_NO_ACK;
  839. case HAL_TX_TQM_RR_REM_CMD_REM:
  840. case HAL_TX_TQM_RR_REM_CMD_NOTX:
  841. case HAL_TX_TQM_RR_REM_CMD_AGED:
  842. return QDF_TX_RX_STATUS_FW_DISCARD;
  843. default:
  844. return QDF_TX_RX_STATUS_DEFAULT;
  845. }
  846. }
  847. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  848. /**
  849. * dp_tx_get_queue() - Returns Tx queue IDs to be used for this Tx frame
  850. * @vdev: DP Virtual device handle
  851. * @nbuf: Buffer pointer
  852. * @queue: queue ids container for nbuf
  853. *
  854. * TX packet queue has 2 instances, software descriptors id and dma ring id
  855. * Based on tx feature and hardware configuration queue id combination could be
  856. * different.
  857. * For example -
  858. * With XPS enabled,all TX descriptor pools and dma ring are assigned per cpu id
  859. * With no XPS,lock based resource protection, Descriptor pool ids are different
  860. * for each vdev, dma ring id will be same as single pdev id
  861. *
  862. * Return: None
  863. */
  864. #ifdef QCA_OL_TX_MULTIQ_SUPPORT
  865. #if defined(IPA_OFFLOAD) && defined(QCA_IPA_LL_TX_FLOW_CONTROL)
  866. #ifdef IPA_WDI3_TX_TWO_PIPES
  867. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  868. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  869. {
  870. queue->ring_id = qdf_get_cpu();
  871. if (vdev->pdev->soc->wlan_cfg_ctx->ipa_enabled)
  872. if ((queue->ring_id == IPA_TCL_DATA_RING_IDX) ||
  873. (queue->ring_id == IPA_TX_ALT_RING_IDX))
  874. queue->ring_id = 0;
  875. queue->desc_pool_id = queue->ring_id;
  876. }
  877. #else
  878. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  879. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  880. {
  881. queue->ring_id = qdf_get_cpu();
  882. if (vdev->pdev->soc->wlan_cfg_ctx->ipa_enabled)
  883. if (queue->ring_id == IPA_TCL_DATA_RING_IDX)
  884. queue->ring_id = 0;
  885. queue->desc_pool_id = queue->ring_id;
  886. }
  887. #endif
  888. #else
  889. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  890. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  891. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  892. {
  893. if (qdf_unlikely(vdev->is_override_rbm_id))
  894. queue->ring_id = vdev->rbm_id;
  895. else
  896. queue->ring_id = qdf_get_cpu();
  897. queue->desc_pool_id = queue->ring_id;
  898. }
  899. #else
  900. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  901. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  902. {
  903. queue->ring_id = qdf_get_cpu();
  904. queue->desc_pool_id = queue->ring_id;
  905. }
  906. #endif
  907. #endif
  908. /**
  909. * dp_tx_get_hal_ring_hdl() - Get the hal_tx_ring_hdl for data transmission
  910. * @soc: DP soc structure pointer
  911. * @ring_id: Transmit Queue/ring_id to be used when XPS is enabled
  912. *
  913. * Return: HAL ring handle
  914. */
  915. static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc,
  916. uint8_t ring_id)
  917. {
  918. if (ring_id == soc->num_tcl_data_rings)
  919. return soc->tcl_cmd_credit_ring.hal_srng;
  920. return soc->tcl_data_ring[ring_id].hal_srng;
  921. }
  922. #else /* QCA_OL_TX_MULTIQ_SUPPORT */
  923. #ifdef TX_MULTI_TCL
  924. #ifdef IPA_OFFLOAD
  925. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  926. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  927. {
  928. /* get flow id */
  929. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  930. if (vdev->pdev->soc->wlan_cfg_ctx->ipa_enabled &&
  931. !ipa_config_is_opt_wifi_dp_enabled())
  932. queue->ring_id = DP_TX_GET_RING_ID(vdev);
  933. else
  934. queue->ring_id = (qdf_nbuf_get_queue_mapping(nbuf) %
  935. vdev->pdev->soc->num_tcl_data_rings);
  936. }
  937. #else
  938. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  939. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  940. {
  941. /* get flow id */
  942. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  943. queue->ring_id = (qdf_nbuf_get_queue_mapping(nbuf) %
  944. vdev->pdev->soc->num_tcl_data_rings);
  945. }
  946. #endif
  947. #else
  948. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  949. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  950. {
  951. /* get flow id */
  952. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  953. queue->ring_id = DP_TX_GET_RING_ID(vdev);
  954. }
  955. #endif
  956. static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc,
  957. uint8_t ring_id)
  958. {
  959. return soc->tcl_data_ring[ring_id].hal_srng;
  960. }
  961. #endif
  962. #ifdef QCA_OL_TX_LOCK_LESS_ACCESS
  963. /**
  964. * dp_tx_hal_ring_access_start() - hal_tx_ring access for data transmission
  965. * @soc: DP soc structure pointer
  966. * @hal_ring_hdl: HAL ring handle
  967. *
  968. * Return: None
  969. */
  970. static inline int dp_tx_hal_ring_access_start(struct dp_soc *soc,
  971. hal_ring_handle_t hal_ring_hdl)
  972. {
  973. return hal_srng_access_start_unlocked(soc->hal_soc, hal_ring_hdl);
  974. }
  975. /**
  976. * dp_tx_hal_ring_access_end() - hal_tx_ring access for data transmission
  977. * @soc: DP soc structure pointer
  978. * @hal_ring_hdl: HAL ring handle
  979. *
  980. * Return: None
  981. */
  982. static inline void dp_tx_hal_ring_access_end(struct dp_soc *soc,
  983. hal_ring_handle_t hal_ring_hdl)
  984. {
  985. hal_srng_access_end_unlocked(soc->hal_soc, hal_ring_hdl);
  986. }
  987. /**
  988. * dp_tx_hal_ring_access_end_reap() - hal_tx_ring access for data transmission
  989. * @soc: DP soc structure pointer
  990. * @hal_ring_hdl: HAL ring handle
  991. *
  992. * Return: None
  993. */
  994. static inline void dp_tx_hal_ring_access_end_reap(struct dp_soc *soc,
  995. hal_ring_handle_t
  996. hal_ring_hdl)
  997. {
  998. }
  999. #else
  1000. static inline int dp_tx_hal_ring_access_start(struct dp_soc *soc,
  1001. hal_ring_handle_t hal_ring_hdl)
  1002. {
  1003. return hal_srng_access_start(soc->hal_soc, hal_ring_hdl);
  1004. }
  1005. static inline void dp_tx_hal_ring_access_end(struct dp_soc *soc,
  1006. hal_ring_handle_t hal_ring_hdl)
  1007. {
  1008. hal_srng_access_end(soc->hal_soc, hal_ring_hdl);
  1009. }
  1010. static inline void dp_tx_hal_ring_access_end_reap(struct dp_soc *soc,
  1011. hal_ring_handle_t
  1012. hal_ring_hdl)
  1013. {
  1014. hal_srng_access_end_reap(soc->hal_soc, hal_ring_hdl);
  1015. }
  1016. #endif
  1017. #ifdef ATH_TX_PRI_OVERRIDE
  1018. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf) \
  1019. ((_msdu_info)->tid = qdf_nbuf_get_priority(_nbuf))
  1020. #else
  1021. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf)
  1022. #endif
  1023. /* TODO TX_FEATURE_NOT_YET */
  1024. static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
  1025. {
  1026. return;
  1027. }
  1028. /* TODO TX_FEATURE_NOT_YET */
  1029. /**
  1030. * dp_tx_desc_flush() - release resources associated
  1031. * to TX Desc
  1032. *
  1033. * @pdev: Handle to DP pdev structure
  1034. * @vdev: virtual device instance
  1035. * NULL: no specific Vdev is required and check all allcated TX desc
  1036. * on this pdev.
  1037. * Non-NULL: only check the allocated TX Desc associated to this Vdev.
  1038. *
  1039. * @force_free:
  1040. * true: flush the TX desc.
  1041. * false: only reset the Vdev in each allocated TX desc
  1042. * that associated to current Vdev.
  1043. *
  1044. * This function will go through the TX desc pool to flush
  1045. * the outstanding TX data or reset Vdev to NULL in associated TX
  1046. * Desc.
  1047. */
  1048. void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev,
  1049. bool force_free);
  1050. /**
  1051. * dp_tx_vdev_attach() - attach vdev to dp tx
  1052. * @vdev: virtual device instance
  1053. *
  1054. * Return: QDF_STATUS_SUCCESS: success
  1055. * QDF_STATUS_E_RESOURCES: Error return
  1056. */
  1057. QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
  1058. /**
  1059. * dp_tx_vdev_detach() - detach vdev from dp tx
  1060. * @vdev: virtual device instance
  1061. *
  1062. * Return: QDF_STATUS_SUCCESS: success
  1063. * QDF_STATUS_E_RESOURCES: Error return
  1064. */
  1065. QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
  1066. /**
  1067. * dp_tx_vdev_update_search_flags() - Update vdev flags as per opmode
  1068. * @vdev: virtual device instance
  1069. *
  1070. * Return: void
  1071. *
  1072. */
  1073. void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev);
  1074. /**
  1075. * dp_soc_tx_desc_sw_pools_alloc() - Allocate tx descriptor pool memory
  1076. * @soc: core txrx main context
  1077. *
  1078. * This function allocates memory for following descriptor pools
  1079. * 1. regular sw tx descriptor pools (static pools)
  1080. * 2. TX extension descriptor pools (ME, RAW, TSO etc...)
  1081. * 3. TSO descriptor pools
  1082. *
  1083. * Return: QDF_STATUS_SUCCESS: success
  1084. * QDF_STATUS_E_RESOURCES: Error return
  1085. */
  1086. QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc);
  1087. /**
  1088. * dp_soc_tx_desc_sw_pools_init() - Initialise TX descriptor pools
  1089. * @soc: core txrx main context
  1090. *
  1091. * This function initializes the following TX descriptor pools
  1092. * 1. regular sw tx descriptor pools (static pools)
  1093. * 2. TX extension descriptor pools (ME, RAW, TSO etc...)
  1094. * 3. TSO descriptor pools
  1095. *
  1096. * Return: QDF_STATUS_SUCCESS: success
  1097. * QDF_STATUS_E_RESOURCES: Error return
  1098. */
  1099. QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc);
  1100. /**
  1101. * dp_soc_tx_desc_sw_pools_free() - free all TX descriptors
  1102. * @soc: core txrx main context
  1103. *
  1104. * This function frees all tx related descriptors as below
  1105. * 1. Regular TX descriptors (static pools)
  1106. * 2. extension TX descriptors (used for ME, RAW, TSO etc...)
  1107. * 3. TSO descriptors
  1108. *
  1109. */
  1110. void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc);
  1111. /**
  1112. * dp_soc_tx_desc_sw_pools_deinit() - de-initialize all TX descriptors
  1113. * @soc: core txrx main context
  1114. *
  1115. * This function de-initializes all tx related descriptors as below
  1116. * 1. Regular TX descriptors (static pools)
  1117. * 2. extension TX descriptors (used for ME, RAW, TSO etc...)
  1118. * 3. TSO descriptors
  1119. *
  1120. */
  1121. void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc);
  1122. #ifndef WLAN_SOFTUMAC_SUPPORT
  1123. /**
  1124. * dp_handle_wbm_internal_error() - handles wbm_internal_error case
  1125. * @soc: core DP main context
  1126. * @hal_desc: hal descriptor
  1127. * @buf_type: indicates if the buffer is of type link disc or msdu
  1128. *
  1129. * wbm_internal_error is seen in following scenarios :
  1130. *
  1131. * 1. Null pointers detected in WBM_RELEASE_RING descriptors
  1132. * 2. Null pointers detected during delinking process
  1133. *
  1134. * Some null pointer cases:
  1135. *
  1136. * a. MSDU buffer pointer is NULL
  1137. * b. Next_MSDU_Link_Desc pointer is NULL, with no last msdu flag
  1138. * c. MSDU buffer pointer is NULL or Next_Link_Desc pointer is NULL
  1139. *
  1140. * Return: None
  1141. */
  1142. void
  1143. dp_handle_wbm_internal_error(struct dp_soc *soc, void *hal_desc,
  1144. uint32_t buf_type);
  1145. #endif
  1146. #else /* QCA_HOST_MODE_WIFI_DISABLED */
  1147. static inline
  1148. QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc)
  1149. {
  1150. return QDF_STATUS_SUCCESS;
  1151. }
  1152. static inline
  1153. QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc)
  1154. {
  1155. return QDF_STATUS_SUCCESS;
  1156. }
  1157. static inline void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc)
  1158. {
  1159. }
  1160. static inline void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc)
  1161. {
  1162. }
  1163. static inline
  1164. void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev,
  1165. bool force_free)
  1166. {
  1167. }
  1168. static inline QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev)
  1169. {
  1170. return QDF_STATUS_SUCCESS;
  1171. }
  1172. static inline QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev)
  1173. {
  1174. return QDF_STATUS_SUCCESS;
  1175. }
  1176. static inline void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev)
  1177. {
  1178. }
  1179. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  1180. #if defined(QCA_SUPPORT_LATENCY_CAPTURE) || \
  1181. defined(QCA_TX_CAPTURE_SUPPORT) || \
  1182. defined(QCA_MCOPY_SUPPORT)
  1183. #ifdef FEATURE_PERPKT_INFO
  1184. /**
  1185. * dp_get_completion_indication_for_stack() - send completion to stack
  1186. * @soc : dp_soc handle
  1187. * @pdev: dp_pdev handle
  1188. * @txrx_peer: dp peer handle
  1189. * @ts: transmit completion status structure
  1190. * @netbuf: Buffer pointer for free
  1191. * @time_latency:
  1192. *
  1193. * This function is used for indication whether buffer needs to be
  1194. * sent to stack for freeing or not
  1195. *
  1196. * Return: QDF_STATUS
  1197. */
  1198. QDF_STATUS
  1199. dp_get_completion_indication_for_stack(struct dp_soc *soc,
  1200. struct dp_pdev *pdev,
  1201. struct dp_txrx_peer *txrx_peer,
  1202. struct hal_tx_completion_status *ts,
  1203. qdf_nbuf_t netbuf,
  1204. uint64_t time_latency);
  1205. /**
  1206. * dp_send_completion_to_stack() - send completion to stack
  1207. * @soc : dp_soc handle
  1208. * @pdev: dp_pdev handle
  1209. * @peer_id: peer_id of the peer for which completion came
  1210. * @ppdu_id: ppdu_id
  1211. * @netbuf: Buffer pointer for free
  1212. *
  1213. * This function is used to send completion to stack
  1214. * to free buffer
  1215. *
  1216. * Return: QDF_STATUS
  1217. */
  1218. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  1219. uint16_t peer_id, uint32_t ppdu_id,
  1220. qdf_nbuf_t netbuf);
  1221. #endif
  1222. #else
  1223. static inline
  1224. QDF_STATUS dp_get_completion_indication_for_stack(struct dp_soc *soc,
  1225. struct dp_pdev *pdev,
  1226. struct dp_txrx_peer *peer,
  1227. struct hal_tx_completion_status *ts,
  1228. qdf_nbuf_t netbuf,
  1229. uint64_t time_latency)
  1230. {
  1231. return QDF_STATUS_E_NOSUPPORT;
  1232. }
  1233. static inline
  1234. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  1235. uint16_t peer_id, uint32_t ppdu_id,
  1236. qdf_nbuf_t netbuf)
  1237. {
  1238. }
  1239. #endif
  1240. #ifdef WLAN_FEATURE_PKT_CAPTURE_V2
  1241. /**
  1242. * dp_send_completion_to_pkt_capture() - send tx completion to packet capture
  1243. * @soc: dp_soc handle
  1244. * @desc: Tx Descriptor
  1245. * @ts: HAL Tx completion descriptor contents
  1246. *
  1247. * This function is used to send tx completion to packet capture
  1248. */
  1249. void dp_send_completion_to_pkt_capture(struct dp_soc *soc,
  1250. struct dp_tx_desc_s *desc,
  1251. struct hal_tx_completion_status *ts);
  1252. #else
  1253. static inline void
  1254. dp_send_completion_to_pkt_capture(struct dp_soc *soc,
  1255. struct dp_tx_desc_s *desc,
  1256. struct hal_tx_completion_status *ts)
  1257. {
  1258. }
  1259. #endif
  1260. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  1261. #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR
  1262. /**
  1263. * dp_tx_update_stats() - Update soc level tx stats
  1264. * @soc: DP soc handle
  1265. * @tx_desc: TX descriptor reference
  1266. * @ring_id: TCL ring id
  1267. *
  1268. * Return: none
  1269. */
  1270. void dp_tx_update_stats(struct dp_soc *soc,
  1271. struct dp_tx_desc_s *tx_desc,
  1272. uint8_t ring_id);
  1273. /**
  1274. * dp_tx_attempt_coalescing() - Check and attempt TCL register write coalescing
  1275. * @soc: Datapath soc handle
  1276. * @vdev: DP vdev handle
  1277. * @tx_desc: tx packet descriptor
  1278. * @tid: TID for pkt transmission
  1279. * @msdu_info: MSDU info of tx packet
  1280. * @ring_id: TCL ring id
  1281. *
  1282. * Return: 1, if coalescing is to be done
  1283. * 0, if coalescing is not to be done
  1284. */
  1285. int
  1286. dp_tx_attempt_coalescing(struct dp_soc *soc, struct dp_vdev *vdev,
  1287. struct dp_tx_desc_s *tx_desc,
  1288. uint8_t tid,
  1289. struct dp_tx_msdu_info_s *msdu_info,
  1290. uint8_t ring_id);
  1291. /**
  1292. * dp_tx_ring_access_end() - HAL ring access end for data transmission
  1293. * @soc: Datapath soc handle
  1294. * @hal_ring_hdl: HAL ring handle
  1295. * @coalesce: Coalesce the current write or not
  1296. *
  1297. * Return: none
  1298. */
  1299. void
  1300. dp_tx_ring_access_end(struct dp_soc *soc, hal_ring_handle_t hal_ring_hdl,
  1301. int coalesce);
  1302. #else
  1303. /**
  1304. * dp_tx_update_stats() - Update soc level tx stats
  1305. * @soc: DP soc handle
  1306. * @tx_desc: TX descriptor reference
  1307. * @ring_id: TCL ring id
  1308. *
  1309. * Return: none
  1310. */
  1311. static inline void dp_tx_update_stats(struct dp_soc *soc,
  1312. struct dp_tx_desc_s *tx_desc,
  1313. uint8_t ring_id){ }
  1314. static inline void
  1315. dp_tx_ring_access_end(struct dp_soc *soc, hal_ring_handle_t hal_ring_hdl,
  1316. int coalesce)
  1317. {
  1318. dp_tx_hal_ring_access_end(soc, hal_ring_hdl);
  1319. }
  1320. static inline int
  1321. dp_tx_attempt_coalescing(struct dp_soc *soc, struct dp_vdev *vdev,
  1322. struct dp_tx_desc_s *tx_desc,
  1323. uint8_t tid,
  1324. struct dp_tx_msdu_info_s *msdu_info,
  1325. uint8_t ring_id)
  1326. {
  1327. return 0;
  1328. }
  1329. #endif /* WLAN_DP_FEATURE_SW_LATENCY_MGR */
  1330. #ifdef FEATURE_RUNTIME_PM
  1331. /**
  1332. * dp_set_rtpm_tput_policy_requirement() - Update RTPM throughput policy
  1333. * @soc_hdl: DP soc handle
  1334. * @is_high_tput: flag to indicate whether throughput is high
  1335. *
  1336. * Return: none
  1337. */
  1338. static inline
  1339. void dp_set_rtpm_tput_policy_requirement(struct cdp_soc_t *soc_hdl,
  1340. bool is_high_tput)
  1341. {
  1342. struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
  1343. qdf_atomic_set(&soc->rtpm_high_tput_flag, is_high_tput);
  1344. }
  1345. /**
  1346. * dp_tx_ring_access_end_wrapper() - Wrapper for ring access end
  1347. * @soc: Datapath soc handle
  1348. * @hal_ring_hdl: HAL ring handle
  1349. * @coalesce: Coalesce the current write or not
  1350. *
  1351. * Feature-specific wrapper for HAL ring access end for data
  1352. * transmission
  1353. *
  1354. * Return: none
  1355. */
  1356. void
  1357. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  1358. hal_ring_handle_t hal_ring_hdl,
  1359. int coalesce);
  1360. #else
  1361. #ifdef DP_POWER_SAVE
  1362. void
  1363. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  1364. hal_ring_handle_t hal_ring_hdl,
  1365. int coalesce);
  1366. #else
  1367. static inline void
  1368. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  1369. hal_ring_handle_t hal_ring_hdl,
  1370. int coalesce)
  1371. {
  1372. dp_tx_ring_access_end(soc, hal_ring_hdl, coalesce);
  1373. }
  1374. #endif
  1375. static inline void
  1376. dp_set_rtpm_tput_policy_requirement(struct cdp_soc_t *soc_hdl,
  1377. bool is_high_tput)
  1378. { }
  1379. #endif
  1380. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  1381. #ifdef DP_TX_HW_DESC_HISTORY
  1382. static inline void
  1383. dp_tx_hw_desc_update_evt(uint8_t *hal_tx_desc_cached,
  1384. hal_ring_handle_t hal_ring_hdl,
  1385. struct dp_soc *soc, uint8_t ring_id)
  1386. {
  1387. struct dp_tx_hw_desc_history *tx_hw_desc_history =
  1388. &soc->tx_hw_desc_history;
  1389. struct dp_tx_hw_desc_evt *evt;
  1390. uint32_t idx = 0;
  1391. uint16_t slot = 0;
  1392. if (!tx_hw_desc_history->allocated)
  1393. return;
  1394. dp_get_frag_hist_next_atomic_idx(&tx_hw_desc_history->index, &idx,
  1395. &slot,
  1396. DP_TX_HW_DESC_HIST_SLOT_SHIFT,
  1397. DP_TX_HW_DESC_HIST_PER_SLOT_MAX,
  1398. DP_TX_HW_DESC_HIST_MAX);
  1399. evt = &tx_hw_desc_history->entry[slot][idx];
  1400. qdf_mem_copy(evt->tcl_desc, hal_tx_desc_cached, HAL_TX_DESC_LEN_BYTES);
  1401. evt->posted = qdf_get_log_timestamp();
  1402. evt->tcl_ring_id = ring_id;
  1403. hal_get_sw_hptp(soc->hal_soc, hal_ring_hdl, &evt->tp, &evt->hp);
  1404. }
  1405. #else
  1406. static inline void
  1407. dp_tx_hw_desc_update_evt(uint8_t *hal_tx_desc_cached,
  1408. hal_ring_handle_t hal_ring_hdl,
  1409. struct dp_soc *soc, uint8_t ring_id)
  1410. {
  1411. }
  1412. #endif
  1413. #if defined(WLAN_FEATURE_TSF_AUTO_REPORT) || defined(WLAN_CONFIG_TX_DELAY)
  1414. /**
  1415. * dp_tx_compute_hw_delay_us() - Compute hardware Tx completion delay
  1416. * @ts: Tx completion status
  1417. * @delta_tsf: Difference between TSF clock and qtimer
  1418. * @delay_us: Delay in microseconds
  1419. *
  1420. * Return: QDF_STATUS_SUCCESS : Success
  1421. * QDF_STATUS_E_INVAL : Tx completion status is invalid or
  1422. * delay_us is NULL
  1423. * QDF_STATUS_E_FAILURE : Error in delay calculation
  1424. */
  1425. QDF_STATUS
  1426. dp_tx_compute_hw_delay_us(struct hal_tx_completion_status *ts,
  1427. uint32_t delta_tsf,
  1428. uint32_t *delay_us);
  1429. /**
  1430. * dp_set_delta_tsf() - Set delta_tsf to dp_soc structure
  1431. * @soc_hdl: cdp soc pointer
  1432. * @vdev_id: vdev id
  1433. * @delta_tsf: difference between TSF clock and qtimer
  1434. *
  1435. * Return: None
  1436. */
  1437. void dp_set_delta_tsf(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  1438. uint32_t delta_tsf);
  1439. #endif
  1440. #ifdef WLAN_FEATURE_TSF_UPLINK_DELAY
  1441. /**
  1442. * dp_set_tsf_ul_delay_report() - Enable or disable reporting uplink delay
  1443. * @soc_hdl: cdp soc pointer
  1444. * @vdev_id: vdev id
  1445. * @enable: true to enable and false to disable
  1446. *
  1447. * Return: QDF_STATUS
  1448. */
  1449. QDF_STATUS dp_set_tsf_ul_delay_report(struct cdp_soc_t *soc_hdl,
  1450. uint8_t vdev_id, bool enable);
  1451. /**
  1452. * dp_get_uplink_delay() - Get uplink delay value
  1453. * @soc_hdl: cdp soc pointer
  1454. * @vdev_id: vdev id
  1455. * @val: pointer to save uplink delay value
  1456. *
  1457. * Return: QDF_STATUS
  1458. */
  1459. QDF_STATUS dp_get_uplink_delay(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  1460. uint32_t *val);
  1461. #endif /* WLAN_FEATURE_TSF_UPLINK_TSF */
  1462. /**
  1463. * dp_tx_pkt_tracepoints_enabled() - Get the state of tx pkt tracepoint
  1464. *
  1465. * Return: True if any tx pkt tracepoint is enabled else false
  1466. */
  1467. static inline
  1468. bool dp_tx_pkt_tracepoints_enabled(void)
  1469. {
  1470. return (qdf_trace_dp_tx_comp_tcp_pkt_enabled() ||
  1471. qdf_trace_dp_tx_comp_udp_pkt_enabled() ||
  1472. qdf_trace_dp_tx_comp_pkt_enabled());
  1473. }
  1474. #ifdef QCA_SUPPORT_DP_GLOBAL_CTX
  1475. static inline
  1476. struct dp_tx_desc_pool_s *dp_get_tx_desc_pool(struct dp_soc *soc,
  1477. uint8_t pool_id)
  1478. {
  1479. struct dp_global_context *dp_global = NULL;
  1480. dp_global = wlan_objmgr_get_global_ctx();
  1481. return dp_global->tx_desc[soc->arch_id][pool_id];
  1482. }
  1483. static inline
  1484. struct dp_tx_desc_pool_s *dp_get_spcl_tx_desc_pool(struct dp_soc *soc,
  1485. uint8_t pool_id)
  1486. {
  1487. struct dp_global_context *dp_global = NULL;
  1488. dp_global = wlan_objmgr_get_global_ctx();
  1489. return dp_global->spcl_tx_desc[soc->arch_id][pool_id];
  1490. }
  1491. #else
  1492. static inline
  1493. struct dp_tx_desc_pool_s *dp_get_tx_desc_pool(struct dp_soc *soc,
  1494. uint8_t pool_id)
  1495. {
  1496. return &soc->tx_desc[pool_id];
  1497. }
  1498. static inline
  1499. struct dp_tx_desc_pool_s *dp_get_spcl_tx_desc_pool(struct dp_soc *soc,
  1500. uint8_t pool_id)
  1501. {
  1502. return &soc->tx_desc[pool_id];
  1503. }
  1504. #endif
  1505. #ifdef DP_TX_TRACKING
  1506. /**
  1507. * dp_tx_desc_set_timestamp() - set timestamp in tx descriptor
  1508. * @tx_desc: tx descriptor
  1509. *
  1510. * Return: None
  1511. */
  1512. static inline
  1513. void dp_tx_desc_set_timestamp(struct dp_tx_desc_s *tx_desc)
  1514. {
  1515. tx_desc->timestamp_tick = qdf_system_ticks();
  1516. }
  1517. /**
  1518. * dp_tx_desc_check_corruption() - Verify magic pattern in tx descriptor
  1519. * @tx_desc: tx descriptor
  1520. *
  1521. * Check for corruption in tx descriptor, if magic pattern is not matching
  1522. * trigger self recovery
  1523. *
  1524. * Return: none
  1525. */
  1526. void dp_tx_desc_check_corruption(struct dp_tx_desc_s *tx_desc);
  1527. #else
  1528. static inline
  1529. void dp_tx_desc_set_timestamp(struct dp_tx_desc_s *tx_desc)
  1530. {
  1531. }
  1532. static inline
  1533. void dp_tx_desc_check_corruption(struct dp_tx_desc_s *tx_desc)
  1534. {
  1535. }
  1536. #endif
  1537. #ifndef CONFIG_SAWF
  1538. static inline bool dp_sawf_tag_valid_get(qdf_nbuf_t nbuf)
  1539. {
  1540. return false;
  1541. }
  1542. #endif
  1543. #ifdef HW_TX_DELAY_STATS_ENABLE
  1544. /**
  1545. * dp_tx_desc_set_ktimestamp() - set kernel timestamp in tx descriptor
  1546. * @vdev: DP vdev handle
  1547. * @tx_desc: tx descriptor
  1548. *
  1549. * Return: true when descriptor is timestamped, false otherwise
  1550. */
  1551. static inline
  1552. bool dp_tx_desc_set_ktimestamp(struct dp_vdev *vdev,
  1553. struct dp_tx_desc_s *tx_desc)
  1554. {
  1555. if (qdf_unlikely(vdev->pdev->delay_stats_flag) ||
  1556. qdf_unlikely(vdev->pdev->soc->wlan_cfg_ctx->pext_stats_enabled) ||
  1557. qdf_unlikely(dp_tx_pkt_tracepoints_enabled()) ||
  1558. qdf_unlikely(vdev->pdev->soc->peerstats_enabled) ||
  1559. qdf_unlikely(dp_is_vdev_tx_delay_stats_enabled(vdev)) ||
  1560. qdf_unlikely(wlan_cfg_is_peer_jitter_stats_enabled(vdev->pdev->soc->wlan_cfg_ctx))) {
  1561. tx_desc->timestamp = qdf_ktime_real_get();
  1562. return true;
  1563. }
  1564. return false;
  1565. }
  1566. #else
  1567. static inline
  1568. bool dp_tx_desc_set_ktimestamp(struct dp_vdev *vdev,
  1569. struct dp_tx_desc_s *tx_desc)
  1570. {
  1571. if (qdf_unlikely(vdev->pdev->delay_stats_flag) ||
  1572. qdf_unlikely(vdev->pdev->soc->wlan_cfg_ctx->pext_stats_enabled) ||
  1573. qdf_unlikely(dp_tx_pkt_tracepoints_enabled()) ||
  1574. qdf_unlikely(vdev->pdev->soc->peerstats_enabled) ||
  1575. qdf_unlikely(wlan_cfg_is_peer_jitter_stats_enabled(vdev->pdev->soc->wlan_cfg_ctx))) {
  1576. tx_desc->timestamp = qdf_ktime_real_get();
  1577. return true;
  1578. }
  1579. return false;
  1580. }
  1581. #endif
  1582. #ifdef CONFIG_DP_PKT_ADD_TIMESTAMP
  1583. /**
  1584. * dp_pkt_add_timestamp() - add timestamp in data payload
  1585. *
  1586. * @vdev: dp vdev
  1587. * @index: index to decide offset in payload
  1588. * @time: timestamp to add in data payload
  1589. * @nbuf: network buffer
  1590. *
  1591. * Return: none
  1592. */
  1593. void dp_pkt_add_timestamp(struct dp_vdev *vdev,
  1594. enum qdf_pkt_timestamp_index index, uint64_t time,
  1595. qdf_nbuf_t nbuf);
  1596. /**
  1597. * dp_pkt_get_timestamp() - get current system time
  1598. *
  1599. * @time: return current system time
  1600. *
  1601. * Return: none
  1602. */
  1603. void dp_pkt_get_timestamp(uint64_t *time);
  1604. #else
  1605. #define dp_pkt_add_timestamp(vdev, index, time, nbuf)
  1606. static inline
  1607. void dp_pkt_get_timestamp(uint64_t *time)
  1608. {
  1609. }
  1610. #endif
  1611. #ifdef CONFIG_WLAN_SYSFS_MEM_STATS
  1612. /**
  1613. * dp_update_tx_desc_stats - Update the increase or decrease in
  1614. * outstanding tx desc count
  1615. * values on pdev and soc
  1616. * @pdev: DP pdev handle
  1617. *
  1618. * Return: void
  1619. */
  1620. static inline void
  1621. dp_update_tx_desc_stats(struct dp_pdev *pdev)
  1622. {
  1623. int32_t tx_descs_cnt =
  1624. qdf_atomic_read(&pdev->num_tx_outstanding);
  1625. if (pdev->tx_descs_max < tx_descs_cnt)
  1626. pdev->tx_descs_max = tx_descs_cnt;
  1627. qdf_mem_tx_desc_cnt_update(pdev->num_tx_outstanding,
  1628. pdev->tx_descs_max);
  1629. }
  1630. #else /* CONFIG_WLAN_SYSFS_MEM_STATS */
  1631. static inline void
  1632. dp_update_tx_desc_stats(struct dp_pdev *pdev)
  1633. {
  1634. }
  1635. #endif /* CONFIG_WLAN_SYSFS_MEM_STATS */
  1636. #ifdef QCA_SUPPORT_DP_GLOBAL_CTX
  1637. /**
  1638. * dp_tx_get_global_desc_in_use() - read global descriptors in usage
  1639. * @dp_global: Datapath global context
  1640. *
  1641. * Return: global descriptors in use
  1642. */
  1643. static inline int32_t
  1644. dp_tx_get_global_desc_in_use(struct dp_global_context *dp_global)
  1645. {
  1646. return qdf_atomic_read(&dp_global->global_descriptor_in_use);
  1647. }
  1648. #endif
  1649. #ifdef QCA_TX_LIMIT_CHECK
  1650. static inline bool is_spl_packet(qdf_nbuf_t nbuf)
  1651. {
  1652. if (qdf_nbuf_is_ipv4_eapol_pkt(nbuf))
  1653. return true;
  1654. return false;
  1655. }
  1656. #ifdef QCA_SUPPORT_DP_GLOBAL_CTX
  1657. /**
  1658. * dp_tx_limit_check - Check if allocated tx descriptors reached
  1659. * global max reg limit and pdev max reg limit for regular packets. Also check
  1660. * if the limit is reached for special packets.
  1661. * @vdev: DP vdev handle
  1662. * @nbuf: network buffer
  1663. *
  1664. * Return: true if allocated tx descriptors reached max limit for regular
  1665. * packets and in case of special packets, if the limit is reached max
  1666. * configured vale for the soc/pdev, else false
  1667. */
  1668. static inline bool
  1669. dp_tx_limit_check(struct dp_vdev *vdev, qdf_nbuf_t nbuf)
  1670. {
  1671. return false;
  1672. }
  1673. static inline bool
  1674. __dp_tx_limit_check(struct dp_soc *soc)
  1675. {
  1676. return false;
  1677. }
  1678. #else
  1679. /**
  1680. * is_dp_spl_tx_limit_reached - Check if the packet is a special packet to allow
  1681. * allocation if allocated tx descriptors are within the soc max limit
  1682. * and pdev max limit.
  1683. * @vdev: DP vdev handle
  1684. * @nbuf: network buffer
  1685. *
  1686. * Return: true if allocated tx descriptors reached max configured value, else
  1687. * false
  1688. */
  1689. static inline bool
  1690. is_dp_spl_tx_limit_reached(struct dp_vdev *vdev, qdf_nbuf_t nbuf)
  1691. {
  1692. struct dp_pdev *pdev = vdev->pdev;
  1693. struct dp_soc *soc = pdev->soc;
  1694. if (is_spl_packet(nbuf)) {
  1695. if (qdf_atomic_read(&soc->num_tx_outstanding) >=
  1696. soc->num_tx_allowed)
  1697. return true;
  1698. if (qdf_atomic_read(&pdev->num_tx_outstanding) >=
  1699. pdev->num_tx_allowed)
  1700. return true;
  1701. return false;
  1702. }
  1703. return true;
  1704. }
  1705. static inline bool
  1706. __dp_tx_limit_check(struct dp_soc *soc)
  1707. {
  1708. return (qdf_atomic_read(&soc->num_tx_outstanding) >=
  1709. soc->num_reg_tx_allowed);
  1710. }
  1711. /**
  1712. * dp_tx_limit_check - Check if allocated tx descriptors reached
  1713. * soc max reg limit and pdev max reg limit for regular packets. Also check if
  1714. * the limit is reached for special packets.
  1715. * @vdev: DP vdev handle
  1716. * @nbuf: network buffer
  1717. *
  1718. * Return: true if allocated tx descriptors reached max limit for regular
  1719. * packets and in case of special packets, if the limit is reached max
  1720. * configured vale for the soc/pdev, else false
  1721. */
  1722. static inline bool
  1723. dp_tx_limit_check(struct dp_vdev *vdev, qdf_nbuf_t nbuf)
  1724. {
  1725. struct dp_pdev *pdev = vdev->pdev;
  1726. struct dp_soc *soc = pdev->soc;
  1727. uint8_t xmit_type = qdf_nbuf_get_vdev_xmit_type(nbuf);
  1728. if (__dp_tx_limit_check(soc)) {
  1729. if (is_dp_spl_tx_limit_reached(vdev, nbuf)) {
  1730. dp_tx_info("queued packets are more than max tx, drop the frame");
  1731. DP_STATS_INC(vdev,
  1732. tx_i[xmit_type].dropped.desc_na.num, 1);
  1733. return true;
  1734. }
  1735. }
  1736. if (qdf_atomic_read(&pdev->num_tx_outstanding) >=
  1737. pdev->num_reg_tx_allowed) {
  1738. if (is_dp_spl_tx_limit_reached(vdev, nbuf)) {
  1739. dp_tx_info("queued packets are more than max tx, drop the frame");
  1740. DP_STATS_INC(vdev,
  1741. tx_i[xmit_type].dropped.desc_na.num, 1);
  1742. DP_STATS_INC(vdev,
  1743. tx_i[xmit_type].dropped.desc_na_exc_outstand.num,
  1744. 1);
  1745. return true;
  1746. }
  1747. }
  1748. return false;
  1749. }
  1750. #endif
  1751. /**
  1752. * dp_tx_exception_limit_check - Check if allocated tx exception descriptors
  1753. * reached soc max limit
  1754. * @vdev: DP vdev handle
  1755. * @xmit_type: xmit type of packet - MLD/Link
  1756. *
  1757. * Return: true if allocated tx descriptors reached max configured value, else
  1758. * false
  1759. */
  1760. static inline bool
  1761. dp_tx_exception_limit_check(struct dp_vdev *vdev, uint8_t xmit_type)
  1762. {
  1763. struct dp_pdev *pdev = vdev->pdev;
  1764. struct dp_soc *soc = pdev->soc;
  1765. if (qdf_atomic_read(&soc->num_tx_exception) >=
  1766. soc->num_msdu_exception_desc) {
  1767. dp_info("exc packets are more than max drop the exc pkt");
  1768. DP_STATS_INC(vdev, tx_i[xmit_type].dropped.exc_desc_na.num, 1);
  1769. return true;
  1770. }
  1771. return false;
  1772. }
  1773. #ifdef QCA_SUPPORT_DP_GLOBAL_CTX
  1774. /**
  1775. * dp_tx_outstanding_inc - Inc outstanding tx desc values on global and pdev
  1776. * @pdev: DP pdev handle
  1777. *
  1778. * Return: void
  1779. */
  1780. static inline void
  1781. dp_tx_outstanding_inc(struct dp_pdev *pdev)
  1782. {
  1783. }
  1784. static inline void
  1785. __dp_tx_outstanding_inc(struct dp_soc *soc)
  1786. {
  1787. }
  1788. static inline void
  1789. __dp_tx_outstanding_dec(struct dp_soc *soc)
  1790. {
  1791. }
  1792. /**
  1793. * dp_tx_outstanding_dec - Dec outstanding tx desc values on global and pdev
  1794. * @pdev: DP pdev handle
  1795. *
  1796. * Return: void
  1797. */
  1798. static inline void
  1799. dp_tx_outstanding_dec(struct dp_pdev *pdev)
  1800. {
  1801. }
  1802. /**
  1803. * dp_tx_outstanding_sub - Subtract outstanding tx desc values on pdev
  1804. * @pdev: DP pdev handle
  1805. * @count: count of descs to subtract from outstanding
  1806. *
  1807. * Return: void
  1808. */
  1809. static inline void
  1810. dp_tx_outstanding_sub(struct dp_pdev *pdev, uint32_t count)
  1811. {
  1812. }
  1813. #else
  1814. static inline void
  1815. __dp_tx_outstanding_inc(struct dp_soc *soc)
  1816. {
  1817. qdf_atomic_inc(&soc->num_tx_outstanding);
  1818. }
  1819. /**
  1820. * dp_tx_outstanding_inc - Increment outstanding tx desc values on pdev and soc
  1821. * @pdev: DP pdev handle
  1822. *
  1823. * Return: void
  1824. */
  1825. static inline void
  1826. dp_tx_outstanding_inc(struct dp_pdev *pdev)
  1827. {
  1828. struct dp_soc *soc = pdev->soc;
  1829. __dp_tx_outstanding_inc(soc);
  1830. qdf_atomic_inc(&pdev->num_tx_outstanding);
  1831. dp_update_tx_desc_stats(pdev);
  1832. }
  1833. static inline void
  1834. __dp_tx_outstanding_dec(struct dp_soc *soc)
  1835. {
  1836. qdf_atomic_dec(&soc->num_tx_outstanding);
  1837. }
  1838. /**
  1839. * dp_tx_outstanding_dec - Decrement outstanding tx desc values on pdev and soc
  1840. * @pdev: DP pdev handle
  1841. *
  1842. * Return: void
  1843. */
  1844. static inline void
  1845. dp_tx_outstanding_dec(struct dp_pdev *pdev)
  1846. {
  1847. struct dp_soc *soc = pdev->soc;
  1848. __dp_tx_outstanding_dec(soc);
  1849. qdf_atomic_dec(&pdev->num_tx_outstanding);
  1850. dp_update_tx_desc_stats(pdev);
  1851. }
  1852. /**
  1853. * __dp_tx_outstanding_sub - Sub outstanding tx desc values from soc
  1854. * @soc: DP soc handle
  1855. * @count: count of descs to subtract from outstanding
  1856. *
  1857. * Return: void
  1858. */
  1859. static inline void
  1860. __dp_tx_outstanding_sub(struct dp_soc *soc, uint32_t count)
  1861. {
  1862. qdf_atomic_sub(count, &soc->num_tx_outstanding);
  1863. }
  1864. /**
  1865. * dp_tx_outstanding_sub - Subtract outstanding tx desc values on pdev
  1866. * @pdev: DP pdev handle
  1867. * @count: count of descs to subtract from outstanding
  1868. *
  1869. * Return: void
  1870. */
  1871. static inline void
  1872. dp_tx_outstanding_sub(struct dp_pdev *pdev, uint32_t count)
  1873. {
  1874. struct dp_soc *soc = pdev->soc;
  1875. __dp_tx_outstanding_sub(soc, count);
  1876. qdf_atomic_sub(count, &pdev->num_tx_outstanding);
  1877. dp_update_tx_desc_stats(pdev);
  1878. }
  1879. #endif /* QCA_SUPPORT_DP_GLOBAL_CTX */
  1880. #else //QCA_TX_LIMIT_CHECK
  1881. static inline bool
  1882. __dp_tx_limit_check(struct dp_soc *soc)
  1883. {
  1884. return false;
  1885. }
  1886. static inline bool
  1887. dp_tx_limit_check(struct dp_vdev *vdev, qdf_nbuf_t nbuf)
  1888. {
  1889. return false;
  1890. }
  1891. static inline bool
  1892. dp_tx_exception_limit_check(struct dp_vdev *vdev, uint8_t xmit_type)
  1893. {
  1894. return false;
  1895. }
  1896. static inline void
  1897. __dp_tx_outstanding_inc(struct dp_soc *soc)
  1898. {
  1899. }
  1900. static inline void
  1901. dp_tx_outstanding_inc(struct dp_pdev *pdev)
  1902. {
  1903. qdf_atomic_inc(&pdev->num_tx_outstanding);
  1904. dp_update_tx_desc_stats(pdev);
  1905. }
  1906. static inline void
  1907. __dp_tx_outstanding_dec(struct dp_soc *soc)
  1908. {
  1909. }
  1910. static inline void
  1911. dp_tx_outstanding_dec(struct dp_pdev *pdev)
  1912. {
  1913. qdf_atomic_dec(&pdev->num_tx_outstanding);
  1914. dp_update_tx_desc_stats(pdev);
  1915. }
  1916. static inline void
  1917. __dp_tx_outstanding_sub(struct dp_soc *soc, uint32_t count)
  1918. {
  1919. }
  1920. /**
  1921. * dp_tx_outstanding_sub - Subtract outstanding tx desc values on pdev
  1922. * @pdev: DP pdev handle
  1923. * @count: count of descs to subtract from outstanding
  1924. *
  1925. * Return: void
  1926. */
  1927. static inline void
  1928. dp_tx_outstanding_sub(struct dp_pdev *pdev, uint32_t count)
  1929. {
  1930. qdf_atomic_sub(count, &pdev->num_tx_outstanding);
  1931. dp_update_tx_desc_stats(pdev);
  1932. }
  1933. #endif //QCA_TX_LIMIT_CHECK
  1934. /**
  1935. * dp_tx_get_pkt_len() - Get the packet length of a msdu
  1936. * @tx_desc: tx descriptor
  1937. *
  1938. * Return: Packet length of a msdu. If the packet is fragmented,
  1939. * it will return the single fragment length.
  1940. *
  1941. * In TSO mode, the msdu from stack will be fragmented into small
  1942. * fragments and each of these new fragments will be transmitted
  1943. * as an individual msdu.
  1944. *
  1945. * Please note that the length of a msdu from stack may be smaller
  1946. * than the length of the total length of the fragments it has been
  1947. * fragmentted because each of the fragments has a nbuf header.
  1948. */
  1949. static inline uint32_t dp_tx_get_pkt_len(struct dp_tx_desc_s *tx_desc)
  1950. {
  1951. return tx_desc->frm_type == dp_tx_frm_tso ?
  1952. tx_desc->msdu_ext_desc->tso_desc->seg.total_len :
  1953. tx_desc->length;
  1954. }
  1955. #ifdef FEATURE_RUNTIME_PM
  1956. static inline int dp_get_rtpm_tput_policy_requirement(struct dp_soc *soc)
  1957. {
  1958. return qdf_atomic_read(&soc->rtpm_high_tput_flag) &&
  1959. (hif_rtpm_get_state() <= HIF_RTPM_STATE_ON);
  1960. }
  1961. #else
  1962. static inline int dp_get_rtpm_tput_policy_requirement(struct dp_soc *soc)
  1963. {
  1964. return 0;
  1965. }
  1966. #endif
  1967. #if defined WLAN_FEATURE_11BE_MLO && defined DP_MLO_LINK_STATS_SUPPORT
  1968. /**
  1969. * dp_tx_set_nbuf_band() - Set band info in nbuf cb
  1970. * @nbuf: nbuf pointer
  1971. * @txrx_peer: txrx_peer pointer
  1972. * @link_id: Peer Link ID
  1973. *
  1974. * Return: None
  1975. */
  1976. static inline void
  1977. dp_tx_set_nbuf_band(qdf_nbuf_t nbuf, struct dp_txrx_peer *txrx_peer,
  1978. uint8_t link_id)
  1979. {
  1980. qdf_nbuf_tx_set_band(nbuf, txrx_peer->band[link_id]);
  1981. }
  1982. #else
  1983. static inline void
  1984. dp_tx_set_nbuf_band(qdf_nbuf_t nbuf, struct dp_txrx_peer *txrx_peer,
  1985. uint8_t link_id)
  1986. {
  1987. }
  1988. #endif
  1989. #ifdef WLAN_FEATURE_TX_LATENCY_STATS
  1990. /**
  1991. * dp_tx_latency_stats_fetch() - fetch transmit latency statistics for
  1992. * specified link mac address
  1993. * @soc_hdl: Handle to struct dp_soc
  1994. * @vdev_id: vdev id
  1995. * @mac: link mac address of remote peer
  1996. * @latency: buffer to hold per-link transmit latency statistics
  1997. *
  1998. * Return: QDF_STATUS
  1999. */
  2000. QDF_STATUS
  2001. dp_tx_latency_stats_fetch(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  2002. uint8_t *mac, struct cdp_tx_latency *latency);
  2003. /**
  2004. * dp_tx_latency_stats_config() - config transmit latency statistics for
  2005. * specified vdev
  2006. * @soc_hdl: Handle to struct dp_soc
  2007. * @vdev_id: vdev id
  2008. * @cfg: configuration for transmit latency statistics
  2009. *
  2010. * Return: QDF_STATUS
  2011. */
  2012. QDF_STATUS
  2013. dp_tx_latency_stats_config(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  2014. struct cdp_tx_latency_config *cfg);
  2015. /**
  2016. * dp_tx_latency_stats_register_cb() - register transmit latency statistics
  2017. * callback
  2018. * @handle: Handle to struct dp_soc
  2019. * @cb: callback function for transmit latency statistics
  2020. *
  2021. * Return: QDF_STATUS
  2022. */
  2023. QDF_STATUS dp_tx_latency_stats_register_cb(struct cdp_soc_t *handle,
  2024. cdp_tx_latency_cb cb);
  2025. #endif
  2026. #endif