dp_tx.h 60 KB

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