cdp_txrx_cmn.h 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608
  1. /*
  2. * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * @file cdp_txrx_cmn.h
  20. * @brief Define the host data path converged API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_CMN_H_
  24. #define _CDP_TXRX_CMN_H_
  25. #include "qdf_types.h"
  26. #include "qdf_nbuf.h"
  27. #include "cdp_txrx_ops.h"
  28. #include "cdp_txrx_handle.h"
  29. #include "cdp_txrx_cmn_struct.h"
  30. #ifdef ENABLE_VERBOSE_DEBUG
  31. extern bool is_dp_verbose_debug_enabled;
  32. #endif
  33. /******************************************************************************
  34. *
  35. * Common Data Path Header File
  36. *
  37. *****************************************************************************/
  38. #define dp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP, params)
  39. #define dp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
  40. #define dp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP, params)
  41. #define dp_info(params...) \
  42. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
  43. #define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
  44. #ifdef DP_PRINT_NO_CONSOLE
  45. #define dp_err_log(params...) \
  46. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
  47. #define dp_info_rl(params...) \
  48. __QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
  49. #else
  50. #define dp_err_log(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
  51. #define dp_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_DP, params)
  52. #endif /* DP_PRINT_NO_CONSOLE */
  53. #ifdef ENABLE_VERBOSE_DEBUG
  54. /**
  55. * @enum verbose_debug_module:
  56. * if INI "enable_verbose_debug" has to set following bit positions to enable
  57. * respective module's excessive logging,
  58. *
  59. * @hif_verbose_debug_mask: 1st bit [0th index] is for HIF module
  60. * @hal_verbose_debug_mask: 2nd bit [1st index] is for HAL module
  61. * @dp_verbose_debug_mask: 3rd bit [2nd index] is for DP module
  62. */
  63. enum verbose_debug_module {
  64. hif_vebose_debug_mask = 1 << 0,
  65. hal_verbose_debug_mask = 1 << 1,
  66. dp_verbose_debug_mask = 1 << 2,
  67. };
  68. #define dp_verbose_debug(params...) \
  69. if (unlikely(is_dp_verbose_debug_enabled)) \
  70. do {\
  71. QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params); \
  72. } while (0)
  73. #else
  74. #define dp_verbose_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
  75. #endif
  76. #define dp_nofl_alert(params...) \
  77. QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_DP, params)
  78. #define dp_nofl_err(params...) \
  79. QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DP, params)
  80. #define dp_nofl_warn(params...) \
  81. QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_DP, params)
  82. #define dp_nofl_info(params...) \
  83. QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params)
  84. #define dp_nofl_debug(params...) \
  85. QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params)
  86. #define dp_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_DP, params)
  87. #define dp_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP, params)
  88. #define dp_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_DP, params)
  89. #define dp_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_DP, params)
  90. /**
  91. * @enum vdev_host_stats_id:
  92. * host stats update from CDP have to set one of the following stats ID
  93. *
  94. * @DP_VDEV_STATS_PKT_CNT_ONLY: update Tx packet count only
  95. * @DP_VDEV_STATS_TX_ME: update Tx ingress stats
  96. */
  97. enum {
  98. DP_VDEV_STATS_PKT_CNT_ONLY,
  99. DP_VDEV_STATS_TX_ME,
  100. };
  101. static inline QDF_STATUS
  102. cdp_soc_attach_target(ol_txrx_soc_handle soc)
  103. {
  104. if (!soc || !soc->ops) {
  105. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  106. "%s: Invalid Instance:", __func__);
  107. QDF_BUG(0);
  108. return QDF_STATUS_E_INVAL;
  109. }
  110. if (!soc->ops->cmn_drv_ops ||
  111. !soc->ops->cmn_drv_ops->txrx_soc_attach_target)
  112. return QDF_STATUS_SUCCESS;
  113. return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc);
  114. }
  115. static inline QDF_STATUS
  116. cdp_vdev_attach(ol_txrx_soc_handle soc, uint8_t pdev_id,
  117. uint8_t *vdev_mac_addr, uint8_t vdev_id,
  118. enum wlan_op_mode op_mode, enum wlan_op_subtype subtype)
  119. {
  120. if (!soc || !soc->ops) {
  121. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  122. "%s: Invalid Instance:", __func__);
  123. QDF_BUG(0);
  124. return QDF_STATUS_E_FAILURE;
  125. }
  126. if (!soc->ops->cmn_drv_ops ||
  127. !soc->ops->cmn_drv_ops->txrx_vdev_attach)
  128. return QDF_STATUS_E_FAILURE;
  129. return soc->ops->cmn_drv_ops->txrx_vdev_attach(soc, pdev_id,
  130. vdev_mac_addr, vdev_id,
  131. op_mode, subtype);
  132. }
  133. #ifdef DP_FLOW_CTL
  134. /**
  135. * cdp_flow_pool_map() - Create flow pool for vdev
  136. * @soc: data path soc handle
  137. * @pdev_id: id of dp pdev handle
  138. * @vdev_id: vdev_id corresponding to vdev start
  139. *
  140. * Create per vdev flow pool.
  141. *
  142. * return none
  143. */
  144. static inline QDF_STATUS cdp_flow_pool_map(ol_txrx_soc_handle soc,
  145. uint8_t pdev_id, uint8_t vdev_id)
  146. {
  147. if (!soc || !soc->ops) {
  148. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  149. "%s: Invalid Instance:", __func__);
  150. QDF_BUG(0);
  151. return QDF_STATUS_E_INVAL;
  152. }
  153. if (!soc->ops->flowctl_ops ||
  154. !soc->ops->flowctl_ops->flow_pool_map_handler)
  155. return QDF_STATUS_E_INVAL;
  156. return soc->ops->flowctl_ops->flow_pool_map_handler(soc, pdev_id,
  157. vdev_id);
  158. }
  159. /**
  160. * cdp_flow_pool_unmap() - Delete flow pool
  161. * @soc: data path soc handle
  162. * @pdev_id: id of dp pdev handle
  163. * @vdev_id: vdev_id corresponding to vdev start
  164. *
  165. * Delete flow pool
  166. *
  167. * return none
  168. */
  169. static inline void cdp_flow_pool_unmap(ol_txrx_soc_handle soc,
  170. uint8_t pdev_id, uint8_t vdev_id)
  171. {
  172. if (!soc || !soc->ops) {
  173. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  174. "%s: Invalid Instance:", __func__);
  175. QDF_BUG(0);
  176. return;
  177. }
  178. if (!soc->ops->flowctl_ops ||
  179. !soc->ops->flowctl_ops->flow_pool_unmap_handler)
  180. return;
  181. return soc->ops->flowctl_ops->flow_pool_unmap_handler(soc, pdev_id,
  182. vdev_id);
  183. }
  184. #endif
  185. static inline QDF_STATUS
  186. cdp_vdev_detach(ol_txrx_soc_handle soc, uint8_t vdev_id,
  187. ol_txrx_vdev_delete_cb callback, void *cb_context)
  188. {
  189. if (!soc || !soc->ops) {
  190. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  191. "%s: Invalid Instance:", __func__);
  192. QDF_BUG(0);
  193. return QDF_STATUS_E_FAILURE;
  194. }
  195. if (!soc->ops->cmn_drv_ops ||
  196. !soc->ops->cmn_drv_ops->txrx_vdev_detach)
  197. return QDF_STATUS_E_FAILURE;
  198. return soc->ops->cmn_drv_ops->txrx_vdev_detach(soc, vdev_id,
  199. callback, cb_context);
  200. }
  201. static inline int
  202. cdp_pdev_attach_target(ol_txrx_soc_handle soc, uint8_t pdev_id)
  203. {
  204. if (!soc || !soc->ops) {
  205. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  206. "%s: Invalid Instance:", __func__);
  207. QDF_BUG(0);
  208. return 0;
  209. }
  210. if (!soc->ops->cmn_drv_ops ||
  211. !soc->ops->cmn_drv_ops->txrx_pdev_attach_target)
  212. return 0;
  213. return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(soc, pdev_id);
  214. }
  215. static inline QDF_STATUS cdp_pdev_attach
  216. (ol_txrx_soc_handle soc, HTC_HANDLE htc_pdev, qdf_device_t osdev,
  217. uint8_t pdev_id)
  218. {
  219. if (!soc || !soc->ops) {
  220. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  221. "%s: Invalid Instance:", __func__);
  222. QDF_BUG(0);
  223. return QDF_STATUS_E_FAILURE;
  224. }
  225. if (!soc->ops->cmn_drv_ops ||
  226. !soc->ops->cmn_drv_ops->txrx_pdev_attach)
  227. return QDF_STATUS_E_FAILURE;
  228. return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, htc_pdev, osdev,
  229. pdev_id);
  230. }
  231. /**
  232. * cdp_pdev_post_attach() - attach the data SW state
  233. * @soc: datapath soc handle
  234. * @pdev_id: the data physical device id being removed
  235. *
  236. * This function is used when the WLAN driver is being loaded to
  237. * attach the host data component within the driver.
  238. *
  239. * Return: 0 for success or error code
  240. */
  241. static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc, uint8_t pdev_id)
  242. {
  243. if (!soc || !soc->ops) {
  244. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  245. "%s: Invalid Instance:", __func__);
  246. QDF_BUG(0);
  247. return 0;
  248. }
  249. if (!soc->ops->cmn_drv_ops ||
  250. !soc->ops->cmn_drv_ops->txrx_pdev_post_attach)
  251. return 0;
  252. return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(soc, pdev_id);
  253. }
  254. /**
  255. * cdp_pdev_pre_detach() - detach the data SW state
  256. * @soc: datapath soc handle
  257. * @pdev_id: the data physical device id being removed
  258. * @force: delete the pdev (and its vdevs and peers) even if
  259. * there are outstanding references by the target to the vdevs
  260. * and peers within the pdev
  261. *
  262. * This function is used when the WLAN driver is being removed to
  263. * detach the host data component within the driver.
  264. *
  265. * Return: None
  266. */
  267. static inline void
  268. cdp_pdev_pre_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
  269. {
  270. if (!soc || !soc->ops) {
  271. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  272. "%s: Invalid Instance:", __func__);
  273. QDF_BUG(0);
  274. return;
  275. }
  276. if (!soc->ops->cmn_drv_ops ||
  277. !soc->ops->cmn_drv_ops->txrx_pdev_pre_detach)
  278. return;
  279. soc->ops->cmn_drv_ops->txrx_pdev_pre_detach(soc, pdev_id, force);
  280. }
  281. static inline QDF_STATUS
  282. cdp_pdev_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
  283. {
  284. if (!soc || !soc->ops) {
  285. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  286. "%s: Invalid Instance:", __func__);
  287. QDF_BUG(0);
  288. return QDF_STATUS_E_FAILURE;
  289. }
  290. if (!soc->ops->cmn_drv_ops ||
  291. !soc->ops->cmn_drv_ops->txrx_pdev_detach)
  292. return QDF_STATUS_E_FAILURE;
  293. return soc->ops->cmn_drv_ops->txrx_pdev_detach(soc, pdev_id, force);
  294. }
  295. static inline void
  296. cdp_pdev_deinit(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
  297. {
  298. if (!soc || !soc->ops) {
  299. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  300. "%s: Invalid Instance:", __func__);
  301. QDF_BUG(0);
  302. return;
  303. }
  304. if (!soc->ops->cmn_drv_ops ||
  305. !soc->ops->cmn_drv_ops->txrx_pdev_deinit)
  306. return;
  307. soc->ops->cmn_drv_ops->txrx_pdev_deinit(soc, pdev_id, force);
  308. }
  309. static inline QDF_STATUS cdp_peer_create
  310. (ol_txrx_soc_handle soc, uint8_t vdev_id,
  311. uint8_t *peer_mac_addr)
  312. {
  313. if (!soc || !soc->ops) {
  314. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  315. "%s: Invalid Instance:", __func__);
  316. QDF_BUG(0);
  317. return QDF_STATUS_E_FAILURE;
  318. }
  319. if (!soc->ops->cmn_drv_ops ||
  320. !soc->ops->cmn_drv_ops->txrx_peer_create)
  321. return QDF_STATUS_E_FAILURE;
  322. return soc->ops->cmn_drv_ops->txrx_peer_create(soc, vdev_id,
  323. peer_mac_addr);
  324. }
  325. static inline void cdp_peer_setup
  326. (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac)
  327. {
  328. if (!soc || !soc->ops) {
  329. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  330. "%s: Invalid Instance:", __func__);
  331. QDF_BUG(0);
  332. return;
  333. }
  334. if (!soc->ops->cmn_drv_ops ||
  335. !soc->ops->cmn_drv_ops->txrx_peer_setup)
  336. return;
  337. soc->ops->cmn_drv_ops->txrx_peer_setup(soc, vdev_id,
  338. peer_mac);
  339. }
  340. /*
  341. * cdp_cp_peer_del_response - Call the peer delete response handler
  342. * @soc: Datapath SOC handle
  343. * @vdev_id: id of virtual device object
  344. * @peer_mac_addr: Mac address of the peer
  345. *
  346. * Return: void
  347. */
  348. static inline QDF_STATUS cdp_cp_peer_del_response
  349. (ol_txrx_soc_handle soc,
  350. uint8_t vdev_id,
  351. uint8_t *peer_mac_addr)
  352. {
  353. if (!soc || !soc->ops) {
  354. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  355. "%s: Invalid Instance:", __func__);
  356. QDF_BUG(0);
  357. return QDF_STATUS_E_FAILURE;
  358. }
  359. if (!soc->ops->cmn_drv_ops ||
  360. !soc->ops->cmn_drv_ops->txrx_cp_peer_del_response)
  361. return QDF_STATUS_E_FAILURE;
  362. return soc->ops->cmn_drv_ops->txrx_cp_peer_del_response(soc,
  363. vdev_id,
  364. peer_mac_addr);
  365. }
  366. /**
  367. * cdp_peer_get_ast_info_by_soc() - search the soc AST hash table
  368. * and return ast entry information
  369. * of first ast entry found in the
  370. * table with given mac address
  371. *
  372. * @soc - data path soc handle
  373. * @ast_mac_addr - AST entry mac address
  374. * @ast_entry_info - ast entry information
  375. *
  376. * return - true if ast entry found with ast_mac_addr
  377. * false if ast entry not found
  378. */
  379. static inline bool cdp_peer_get_ast_info_by_soc
  380. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  381. struct cdp_ast_entry_info *ast_entry_info)
  382. {
  383. if (!soc || !soc->ops) {
  384. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  385. "%s: Invalid Instance:", __func__);
  386. QDF_BUG(0);
  387. return false;
  388. }
  389. if (!soc->ops->cmn_drv_ops ||
  390. !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc)
  391. return false;
  392. return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc
  393. (soc, ast_mac_addr,
  394. ast_entry_info);
  395. }
  396. /**
  397. * cdp_peer_get_ast_info_by_pdev() - search the soc AST hash table
  398. * and return ast entry information
  399. * if mac address and pdev_id matches
  400. *
  401. * @soc - data path soc handle
  402. * @ast_mac_addr - AST entry mac address
  403. * @pdev_id - pdev_id
  404. * @ast_entry_info - ast entry information
  405. *
  406. * return - true if ast entry found with ast_mac_addr
  407. * false if ast entry not found
  408. */
  409. static inline bool cdp_peer_get_ast_info_by_pdev
  410. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  411. uint8_t pdev_id,
  412. struct cdp_ast_entry_info *ast_entry_info)
  413. {
  414. if (!soc || !soc->ops) {
  415. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  416. "%s: Invalid Instance:", __func__);
  417. QDF_BUG(0);
  418. return false;
  419. }
  420. if (!soc->ops->cmn_drv_ops ||
  421. !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev)
  422. return false;
  423. return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev
  424. (soc,
  425. ast_mac_addr,
  426. pdev_id,
  427. ast_entry_info);
  428. }
  429. /**
  430. * cdp_peer_ast_delete_by_soc() - delete the ast entry from soc AST hash table
  431. * with given mac address
  432. *
  433. * @soc - data path soc handle
  434. * @ast_mac_addr - AST entry mac address
  435. * @callback - callback function to called on ast delete response from FW
  436. * @cookie - argument to be passed to callback
  437. *
  438. * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
  439. * is sent
  440. * QDF_STATUS_E_INVAL false if ast entry not found
  441. */
  442. static inline QDF_STATUS cdp_peer_ast_delete_by_soc
  443. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  444. txrx_ast_free_cb callback,
  445. void *cookie)
  446. {
  447. if (!soc || !soc->ops) {
  448. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  449. "%s: Invalid Instance:", __func__);
  450. QDF_BUG(0);
  451. return QDF_STATUS_E_INVAL;
  452. }
  453. if (!soc->ops->cmn_drv_ops ||
  454. !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc)
  455. return QDF_STATUS_E_INVAL;
  456. return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc
  457. (soc,
  458. ast_mac_addr,
  459. callback,
  460. cookie);
  461. }
  462. /**
  463. * cdp_peer_ast_delete_by_pdev() - delete the ast entry from soc AST hash table
  464. * if mac address and pdev_id matches
  465. *
  466. * @soc - data path soc handle
  467. * @ast_mac_addr - AST entry mac address
  468. * @pdev_id - pdev id
  469. * @callback - callback function to called on ast delete response from FW
  470. * @cookie - argument to be passed to callback
  471. *
  472. * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
  473. * is sent
  474. * QDF_STATUS_E_INVAL false if ast entry not found
  475. */
  476. static inline QDF_STATUS cdp_peer_ast_delete_by_pdev
  477. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  478. uint8_t pdev_id, txrx_ast_free_cb callback,
  479. void *cookie)
  480. {
  481. if (!soc || !soc->ops) {
  482. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  483. "%s: Invalid Instance:", __func__);
  484. QDF_BUG(0);
  485. return QDF_STATUS_E_INVAL;
  486. }
  487. if (!soc->ops->cmn_drv_ops ||
  488. !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev)
  489. return QDF_STATUS_E_INVAL;
  490. return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev
  491. (soc,
  492. ast_mac_addr,
  493. pdev_id,
  494. callback,
  495. cookie);
  496. }
  497. static inline int cdp_peer_add_ast
  498. (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  499. uint8_t *mac_addr,
  500. enum cdp_txrx_ast_entry_type type, uint32_t flags)
  501. {
  502. if (!soc || !soc->ops) {
  503. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  504. "%s: Invalid Instance:", __func__);
  505. QDF_BUG(0);
  506. return 0;
  507. }
  508. if (!soc->ops->cmn_drv_ops ||
  509. !soc->ops->cmn_drv_ops->txrx_peer_add_ast)
  510. return 0;
  511. return soc->ops->cmn_drv_ops->txrx_peer_add_ast(soc,
  512. vdev_id,
  513. peer_mac,
  514. mac_addr,
  515. type,
  516. flags);
  517. }
  518. static inline QDF_STATUS cdp_peer_reset_ast
  519. (ol_txrx_soc_handle soc, uint8_t *wds_macaddr, uint8_t *peer_macaddr,
  520. uint8_t vdev_id)
  521. {
  522. if (!soc || !soc->ops) {
  523. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  524. "%s: Invalid Instance:", __func__);
  525. QDF_BUG(0);
  526. return QDF_STATUS_E_FAILURE;
  527. }
  528. if (!soc->ops->cmn_drv_ops ||
  529. !soc->ops->cmn_drv_ops->txrx_peer_reset_ast)
  530. return QDF_STATUS_E_FAILURE;
  531. return soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr,
  532. peer_macaddr, vdev_id);
  533. }
  534. static inline QDF_STATUS cdp_peer_reset_ast_table
  535. (ol_txrx_soc_handle soc, uint8_t vdev_id)
  536. {
  537. if (!soc || !soc->ops) {
  538. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  539. "%s: Invalid Instance:", __func__);
  540. QDF_BUG(0);
  541. return QDF_STATUS_E_FAILURE;
  542. }
  543. if (!soc->ops->cmn_drv_ops ||
  544. !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table)
  545. return QDF_STATUS_E_FAILURE;
  546. return soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc, vdev_id);
  547. }
  548. static inline void cdp_peer_flush_ast_table
  549. (ol_txrx_soc_handle soc)
  550. {
  551. if (!soc || !soc->ops) {
  552. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  553. "%s: Invalid Instance:", __func__);
  554. QDF_BUG(0);
  555. return;
  556. }
  557. if (!soc->ops->cmn_drv_ops ||
  558. !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table)
  559. return;
  560. soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc);
  561. }
  562. static inline int cdp_peer_update_ast
  563. (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  564. uint8_t *wds_macaddr, uint32_t flags)
  565. {
  566. if (!soc || !soc->ops) {
  567. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  568. "%s: Invalid Instance:", __func__);
  569. QDF_BUG(0);
  570. return 0;
  571. }
  572. if (!soc->ops->cmn_drv_ops ||
  573. !soc->ops->cmn_drv_ops->txrx_peer_update_ast)
  574. return 0;
  575. return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc,
  576. vdev_id,
  577. peer_mac,
  578. wds_macaddr,
  579. flags);
  580. }
  581. static inline void cdp_peer_teardown
  582. (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac)
  583. {
  584. if (!soc || !soc->ops) {
  585. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  586. "%s: Invalid Instance:", __func__);
  587. QDF_BUG(0);
  588. return;
  589. }
  590. if (!soc->ops->cmn_drv_ops ||
  591. !soc->ops->cmn_drv_ops->txrx_peer_teardown)
  592. return;
  593. soc->ops->cmn_drv_ops->txrx_peer_teardown(soc, vdev_id, peer_mac);
  594. }
  595. static inline void
  596. cdp_peer_delete(ol_txrx_soc_handle soc, uint8_t vdev_id,
  597. uint8_t *peer_mac, uint32_t bitmap)
  598. {
  599. if (!soc || !soc->ops) {
  600. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  601. "%s: Invalid Instance:", __func__);
  602. QDF_BUG(0);
  603. return;
  604. }
  605. if (!soc->ops->cmn_drv_ops ||
  606. !soc->ops->cmn_drv_ops->txrx_peer_delete)
  607. return;
  608. soc->ops->cmn_drv_ops->txrx_peer_delete(soc, vdev_id, peer_mac, bitmap);
  609. }
  610. /**
  611. * cdp_peer_detach_sync() - peer detach sync callback
  612. * @soc: datapath soc handle
  613. * @vdev_id: virtual device/interface id
  614. * @peer_mac: peer mac address
  615. * @peer_unmap_sync: peer unmap sync cb.
  616. * @bitmap: bitmap indicating special handling of request.
  617. *
  618. * Return: None
  619. */
  620. static inline void
  621. cdp_peer_delete_sync(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  622. QDF_STATUS(*delete_cb)(
  623. uint8_t vdev_id,
  624. uint32_t peerid_cnt,
  625. uint16_t *peerid_list),
  626. uint32_t bitmap)
  627. {
  628. if (!soc || !soc->ops) {
  629. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  630. "%s: Invalid Instance:", __func__);
  631. QDF_BUG(0);
  632. return;
  633. }
  634. if (!soc->ops->cmn_drv_ops ||
  635. !soc->ops->cmn_drv_ops->txrx_peer_delete_sync)
  636. return;
  637. soc->ops->cmn_drv_ops->txrx_peer_delete_sync(soc, vdev_id, peer_mac,
  638. delete_cb,
  639. bitmap);
  640. }
  641. static inline int
  642. cdp_set_monitor_mode(ol_txrx_soc_handle soc, uint8_t vdev_id,
  643. uint8_t smart_monitor)
  644. {
  645. if (!soc || !soc->ops) {
  646. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  647. "%s: Invalid Instance:", __func__);
  648. QDF_BUG(0);
  649. return 0;
  650. }
  651. if (!soc->ops->cmn_drv_ops ||
  652. !soc->ops->cmn_drv_ops->txrx_set_monitor_mode)
  653. return 0;
  654. return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(soc, vdev_id,
  655. smart_monitor);
  656. }
  657. static inline QDF_STATUS
  658. cdp_set_curchan(ol_txrx_soc_handle soc,
  659. uint8_t pdev_id,
  660. uint32_t chan_mhz)
  661. {
  662. if (!soc || !soc->ops) {
  663. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  664. "%s: Invalid Instance:", __func__);
  665. QDF_BUG(0);
  666. return QDF_STATUS_E_FAILURE;
  667. }
  668. if (!soc->ops->cmn_drv_ops ||
  669. !soc->ops->cmn_drv_ops->txrx_set_curchan)
  670. return QDF_STATUS_E_FAILURE;
  671. return soc->ops->cmn_drv_ops->txrx_set_curchan(soc, pdev_id, chan_mhz);
  672. }
  673. static inline QDF_STATUS
  674. cdp_set_privacy_filters(ol_txrx_soc_handle soc, uint8_t vdev_id,
  675. void *filter, uint32_t num)
  676. {
  677. if (!soc || !soc->ops) {
  678. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  679. "%s: Invalid Instance:", __func__);
  680. QDF_BUG(0);
  681. return QDF_STATUS_E_FAILURE;
  682. }
  683. if (!soc->ops->cmn_drv_ops ||
  684. !soc->ops->cmn_drv_ops->txrx_set_privacy_filters)
  685. return QDF_STATUS_E_FAILURE;
  686. return soc->ops->cmn_drv_ops->txrx_set_privacy_filters(soc, vdev_id,
  687. filter, num);
  688. }
  689. static inline int
  690. cdp_set_monitor_filter(ol_txrx_soc_handle soc, uint8_t pdev_id,
  691. struct cdp_monitor_filter *filter_val)
  692. {
  693. if (soc->ops->mon_ops->txrx_set_advance_monitor_filter)
  694. return soc->ops->mon_ops->txrx_set_advance_monitor_filter(soc,
  695. pdev_id,
  696. filter_val);
  697. return 0;
  698. }
  699. /******************************************************************************
  700. * Data Interface (B Interface)
  701. *****************************************************************************/
  702. static inline void
  703. cdp_vdev_register(ol_txrx_soc_handle soc, uint8_t vdev_id,
  704. ol_osif_vdev_handle osif_vdev,
  705. struct ol_txrx_ops *txrx_ops)
  706. {
  707. if (!soc || !soc->ops) {
  708. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  709. "%s: Invalid Instance:", __func__);
  710. QDF_BUG(0);
  711. return;
  712. }
  713. if (!soc->ops->cmn_drv_ops ||
  714. !soc->ops->cmn_drv_ops->txrx_vdev_register)
  715. return;
  716. soc->ops->cmn_drv_ops->txrx_vdev_register(soc, vdev_id,
  717. osif_vdev, txrx_ops);
  718. }
  719. static inline int
  720. cdp_mgmt_send(ol_txrx_soc_handle soc, uint8_t vdev_id,
  721. qdf_nbuf_t tx_mgmt_frm, uint8_t type)
  722. {
  723. if (!soc || !soc->ops) {
  724. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  725. "%s: Invalid Instance:", __func__);
  726. QDF_BUG(0);
  727. return 0;
  728. }
  729. if (!soc->ops->cmn_drv_ops ||
  730. !soc->ops->cmn_drv_ops->txrx_mgmt_send)
  731. return 0;
  732. return soc->ops->cmn_drv_ops->txrx_mgmt_send(soc, vdev_id,
  733. tx_mgmt_frm, type);
  734. }
  735. static inline int
  736. cdp_mgmt_send_ext(ol_txrx_soc_handle soc, uint8_t vdev_id,
  737. qdf_nbuf_t tx_mgmt_frm, uint8_t type,
  738. uint8_t use_6mbps, uint16_t chanfreq)
  739. {
  740. if (!soc || !soc->ops) {
  741. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  742. "%s: Invalid Instance:", __func__);
  743. QDF_BUG(0);
  744. return 0;
  745. }
  746. if (!soc->ops->cmn_drv_ops ||
  747. !soc->ops->cmn_drv_ops->txrx_mgmt_send_ext)
  748. return 0;
  749. return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext
  750. (soc, vdev_id, tx_mgmt_frm, type, use_6mbps, chanfreq);
  751. }
  752. static inline QDF_STATUS
  753. cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, uint8_t pdev_id,
  754. uint8_t type, ol_txrx_mgmt_tx_cb download_cb,
  755. ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt)
  756. {
  757. if (!soc || !soc->ops) {
  758. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  759. "%s: Invalid Instance:", __func__);
  760. QDF_BUG(0);
  761. return QDF_STATUS_E_FAILURE;
  762. }
  763. if (!soc->ops->cmn_drv_ops ||
  764. !soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set)
  765. return QDF_STATUS_E_FAILURE;
  766. return soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set
  767. (soc, pdev_id, type, download_cb, ota_ack_cb, ctxt);
  768. }
  769. /**
  770. * cdp_peer_unmap_sync_cb_set() - set peer unmap sync callback
  771. * @soc: datapath soc handle
  772. * @pdev_id: physical device instance id
  773. * @peer_unmap_sync: peer unmap sync callback
  774. *
  775. * Return: None
  776. */
  777. static inline void
  778. cdp_peer_unmap_sync_cb_set(ol_txrx_soc_handle soc,
  779. uint8_t pdev_id,
  780. QDF_STATUS(*unmap_resp_cb)(
  781. uint8_t vdev_id,
  782. uint32_t peerid_cnt,
  783. uint16_t *peerid_list))
  784. {
  785. if (!soc || !soc->ops) {
  786. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  787. "%s: Invalid Instance:", __func__);
  788. QDF_BUG(0);
  789. return;
  790. }
  791. if (!soc->ops->cmn_drv_ops ||
  792. !soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set)
  793. return;
  794. soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set(soc, pdev_id,
  795. unmap_resp_cb);
  796. }
  797. /*
  798. * cdp_data_tx_cb_set(): set the callback for non standard tx
  799. * @soc - datapath soc handle
  800. * @vdev_id - virtual device/interface id
  801. * @callback - callback function
  802. * @ctxt: callback context
  803. *
  804. */
  805. static inline void
  806. cdp_data_tx_cb_set(ol_txrx_soc_handle soc, uint8_t vdev_id,
  807. ol_txrx_data_tx_cb callback, void *ctxt)
  808. {
  809. if (!soc || !soc->ops) {
  810. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  811. "%s: Invalid Instance:", __func__);
  812. QDF_BUG(0);
  813. return;
  814. }
  815. if (!soc->ops->cmn_drv_ops ||
  816. !soc->ops->cmn_drv_ops->txrx_data_tx_cb_set)
  817. return;
  818. soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(soc, vdev_id,
  819. callback, ctxt);
  820. }
  821. /******************************************************************************
  822. * Statistics and Debugging Interface (C Interface)
  823. *****************************************************************************/
  824. /**
  825. * External Device physical address types
  826. *
  827. * Currently, both MAC and IPA uController use the same size addresses
  828. * and descriptors are exchanged between these two depending on the mode.
  829. *
  830. * Rationale: qdf_dma_addr_t is the type used internally on the host for DMA
  831. * operations. However, external device physical address sizes
  832. * may be different from host-specific physical address sizes.
  833. * This calls for the following definitions for target devices
  834. * (MAC, IPA uc).
  835. */
  836. #if HTT_PADDR64
  837. typedef uint64_t target_paddr_t;
  838. #else
  839. typedef uint32_t target_paddr_t;
  840. #endif /*HTT_PADDR64 */
  841. static inline int
  842. cdp_aggr_cfg(ol_txrx_soc_handle soc, uint8_t vdev_id,
  843. int max_subfrms_ampdu,
  844. int max_subfrms_amsdu)
  845. {
  846. if (!soc || !soc->ops) {
  847. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  848. "%s: Invalid Instance:", __func__);
  849. QDF_BUG(0);
  850. return 0;
  851. }
  852. if (!soc->ops->cmn_drv_ops ||
  853. !soc->ops->cmn_drv_ops->txrx_aggr_cfg)
  854. return 0;
  855. return soc->ops->cmn_drv_ops->txrx_aggr_cfg(soc, vdev_id,
  856. max_subfrms_ampdu, max_subfrms_amsdu);
  857. }
  858. static inline int
  859. cdp_fw_stats_get(ol_txrx_soc_handle soc, uint8_t vdev_id,
  860. struct ol_txrx_stats_req *req, bool per_vdev,
  861. bool response_expected)
  862. {
  863. if (!soc || !soc->ops) {
  864. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  865. "%s: Invalid Instance:", __func__);
  866. QDF_BUG(0);
  867. return 0;
  868. }
  869. if (!soc->ops->cmn_drv_ops ||
  870. !soc->ops->cmn_drv_ops->txrx_fw_stats_get)
  871. return 0;
  872. return soc->ops->cmn_drv_ops->txrx_fw_stats_get(soc, vdev_id, req,
  873. per_vdev, response_expected);
  874. }
  875. static inline int
  876. cdp_debug(ol_txrx_soc_handle soc, uint8_t vdev_id, int debug_specs)
  877. {
  878. if (!soc || !soc->ops) {
  879. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  880. "%s: Invalid Instance:", __func__);
  881. QDF_BUG(0);
  882. return 0;
  883. }
  884. if (!soc->ops->cmn_drv_ops ||
  885. !soc->ops->cmn_drv_ops->txrx_debug)
  886. return 0;
  887. return soc->ops->cmn_drv_ops->txrx_debug(soc, vdev_id, debug_specs);
  888. }
  889. static inline QDF_STATUS
  890. cdp_fw_stats_cfg(ol_txrx_soc_handle soc,
  891. uint8_t vdev_id, uint8_t cfg_stats_type, uint32_t cfg_val)
  892. {
  893. if (!soc || !soc->ops) {
  894. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  895. "%s: Invalid Instance:", __func__);
  896. QDF_BUG(0);
  897. return QDF_STATUS_E_FAILURE;
  898. }
  899. if (!soc->ops->cmn_drv_ops ||
  900. !soc->ops->cmn_drv_ops->txrx_fw_stats_cfg)
  901. return QDF_STATUS_E_FAILURE;
  902. return soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(soc, vdev_id,
  903. cfg_stats_type, cfg_val);
  904. }
  905. static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level)
  906. {
  907. if (!soc || !soc->ops) {
  908. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  909. "%s: Invalid Instance:", __func__);
  910. QDF_BUG(0);
  911. return;
  912. }
  913. if (!soc->ops->cmn_drv_ops ||
  914. !soc->ops->cmn_drv_ops->txrx_print_level_set)
  915. return;
  916. soc->ops->cmn_drv_ops->txrx_print_level_set(level);
  917. }
  918. /*
  919. * cdp_get_vdev_mac_addr() – Detach txrx peer
  920. * @soc_hdl: Datapath soc handle
  921. * @vdev_id: virtual device/interface id
  922. *
  923. * Return: MAC address on success, NULL on failure.
  924. *
  925. */
  926. static inline uint8_t *
  927. cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, uint8_t vdev_id)
  928. {
  929. if (!soc || !soc->ops) {
  930. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  931. "%s: Invalid Instance:", __func__);
  932. QDF_BUG(0);
  933. return NULL;
  934. }
  935. if (!soc->ops->cmn_drv_ops ||
  936. !soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr)
  937. return NULL;
  938. return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(soc, vdev_id);
  939. }
  940. /**
  941. * cdp_get_os_rx_handles_from_vdev() - Return os rx handles for a vdev
  942. * @soc: ol_txrx_soc_handle handle
  943. * @vdev_id: vdev id for which os rx handles are needed
  944. * @stack_fn_p: pointer to stack function pointer
  945. * @osif_handle_p: pointer to ol_osif_vdev_handle
  946. *
  947. * Return: void
  948. */
  949. static inline
  950. void cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc,
  951. uint8_t vdev_id,
  952. ol_txrx_rx_fp *stack_fn_p,
  953. ol_osif_vdev_handle *osif_handle_p)
  954. {
  955. if (!soc || !soc->ops) {
  956. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  957. "%s: Invalid Instance:", __func__);
  958. QDF_BUG(0);
  959. return;
  960. }
  961. if (!soc->ops->cmn_drv_ops ||
  962. !soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev)
  963. return;
  964. soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev(soc, vdev_id,
  965. stack_fn_p,
  966. osif_handle_p);
  967. }
  968. /**
  969. * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev
  970. * @soc: datapath soc handle
  971. * @vdev_id: virtual device/interface id
  972. *
  973. * Return: Handle to control pdev
  974. */
  975. static inline struct cdp_cfg *
  976. cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, uint8_t vdev_id)
  977. {
  978. if (!soc || !soc->ops) {
  979. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  980. "%s: Invalid Instance:", __func__);
  981. QDF_BUG(0);
  982. return NULL;
  983. }
  984. if (!soc->ops->cmn_drv_ops ||
  985. !soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev)
  986. return NULL;
  987. return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev(soc,
  988. vdev_id);
  989. }
  990. /*
  991. * cdp_get_mon_vdev_from_pdev() - Get vdev handle of monitor mode
  992. * @soc: datapath soc handle
  993. * @pdev_id: physical device instance id
  994. *
  995. * Return: virtual interface id
  996. */
  997. static inline uint8_t
  998. cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc, uint8_t pdev_id)
  999. {
  1000. if (!soc || !soc->ops) {
  1001. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1002. "%s: Invalid Instance:", __func__);
  1003. QDF_BUG(0);
  1004. return -EINVAL;
  1005. }
  1006. if (!soc->ops->cmn_drv_ops ||
  1007. !soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev)
  1008. return -EINVAL;
  1009. return soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev(soc, pdev_id);
  1010. }
  1011. static inline void
  1012. cdp_soc_detach(ol_txrx_soc_handle soc)
  1013. {
  1014. if (!soc || !soc->ops) {
  1015. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1016. "%s: Invalid Instance:", __func__);
  1017. QDF_BUG(0);
  1018. return;
  1019. }
  1020. if (!soc->ops->cmn_drv_ops ||
  1021. !soc->ops->cmn_drv_ops->txrx_soc_detach)
  1022. return;
  1023. soc->ops->cmn_drv_ops->txrx_soc_detach(soc);
  1024. }
  1025. /**
  1026. * cdp_soc_init() - Initialize txrx SOC
  1027. * @soc: ol_txrx_soc_handle handle
  1028. * @devid: Device ID
  1029. * @hif_handle: Opaque HIF handle
  1030. * @psoc: Opaque Objmgr handle
  1031. * @htc_handle: Opaque HTC handle
  1032. * @qdf_dev: QDF device
  1033. * @dp_ol_if_ops: Offload Operations
  1034. *
  1035. * Return: DP SOC handle on success, NULL on failure
  1036. */
  1037. static inline ol_txrx_soc_handle
  1038. cdp_soc_init(ol_txrx_soc_handle soc, u_int16_t devid,
  1039. void *hif_handle,
  1040. struct cdp_ctrl_objmgr_psoc *psoc,
  1041. HTC_HANDLE htc_handle, qdf_device_t qdf_dev,
  1042. struct ol_if_ops *dp_ol_if_ops)
  1043. {
  1044. if (!soc || !soc->ops) {
  1045. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1046. "%s: Invalid Instance:", __func__);
  1047. QDF_BUG(0);
  1048. return NULL;
  1049. }
  1050. if (!soc->ops->cmn_drv_ops ||
  1051. !soc->ops->cmn_drv_ops->txrx_soc_init)
  1052. return NULL;
  1053. return soc->ops->cmn_drv_ops->txrx_soc_init(soc, psoc,
  1054. hif_handle,
  1055. htc_handle, qdf_dev,
  1056. dp_ol_if_ops, devid);
  1057. }
  1058. /**
  1059. * cdp_soc_init() - Initialize txrx SOC
  1060. * @soc: ol_txrx_soc_handle handle
  1061. * @devid: Device ID
  1062. * @hif_handle: Opaque HIF handle
  1063. * @psoc: Opaque Objmgr handle
  1064. * @htc_handle: Opaque HTC handle
  1065. * @qdf_dev: QDF device
  1066. * @dp_ol_if_ops: Offload Operations
  1067. *
  1068. * Return: DP SOC handle on success, NULL on failure
  1069. */
  1070. static inline QDF_STATUS
  1071. cdp_pdev_init(ol_txrx_soc_handle soc,
  1072. HTC_HANDLE htc_handle, qdf_device_t qdf_dev,
  1073. uint8_t pdev_id)
  1074. {
  1075. if (!soc || !soc->ops) {
  1076. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1077. "%s: Invalid Instance:", __func__);
  1078. QDF_BUG(0);
  1079. return 0;
  1080. }
  1081. if (!soc->ops->cmn_drv_ops ||
  1082. !soc->ops->cmn_drv_ops->txrx_pdev_init)
  1083. return 0;
  1084. return soc->ops->cmn_drv_ops->txrx_pdev_init(soc,
  1085. htc_handle, qdf_dev,
  1086. pdev_id);
  1087. }
  1088. /**
  1089. * cdp_soc_deinit() - Deinitialize txrx SOC
  1090. * @soc: Opaque DP SOC handle
  1091. *
  1092. * Return: None
  1093. */
  1094. static inline void
  1095. cdp_soc_deinit(ol_txrx_soc_handle soc)
  1096. {
  1097. if (!soc || !soc->ops) {
  1098. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1099. "%s: Invalid Instance:", __func__);
  1100. QDF_BUG(0);
  1101. return;
  1102. }
  1103. if (!soc->ops->cmn_drv_ops ||
  1104. !soc->ops->cmn_drv_ops->txrx_soc_deinit)
  1105. return;
  1106. soc->ops->cmn_drv_ops->txrx_soc_deinit(soc);
  1107. }
  1108. /**
  1109. * cdp_tso_soc_attach() - TSO attach function
  1110. * @soc: ol_txrx_soc_handle handle
  1111. *
  1112. * Reserve TSO descriptor buffers
  1113. *
  1114. * Return: QDF_STATUS_SUCCESS on Success or
  1115. * QDF_STATUS_E_FAILURE on failure
  1116. */
  1117. static inline QDF_STATUS
  1118. cdp_tso_soc_attach(ol_txrx_soc_handle soc)
  1119. {
  1120. if (!soc || !soc->ops) {
  1121. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1122. "%s: Invalid Instance:", __func__);
  1123. QDF_BUG(0);
  1124. return 0;
  1125. }
  1126. if (!soc->ops->cmn_drv_ops ||
  1127. !soc->ops->cmn_drv_ops->txrx_tso_soc_attach)
  1128. return 0;
  1129. return soc->ops->cmn_drv_ops->txrx_tso_soc_attach(soc);
  1130. }
  1131. /**
  1132. * cdp_tso_soc_detach() - TSO detach function
  1133. * @soc: ol_txrx_soc_handle handle
  1134. *
  1135. * Release TSO descriptor buffers
  1136. *
  1137. * Return: QDF_STATUS_SUCCESS on Success or
  1138. * QDF_STATUS_E_FAILURE on failure
  1139. */
  1140. static inline QDF_STATUS
  1141. cdp_tso_soc_detach(ol_txrx_soc_handle soc)
  1142. {
  1143. if (!soc || !soc->ops) {
  1144. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1145. "%s: Invalid Instance:", __func__);
  1146. QDF_BUG(0);
  1147. return 0;
  1148. }
  1149. if (!soc->ops->cmn_drv_ops ||
  1150. !soc->ops->cmn_drv_ops->txrx_tso_soc_detach)
  1151. return 0;
  1152. return soc->ops->cmn_drv_ops->txrx_tso_soc_detach(soc);
  1153. }
  1154. /**
  1155. * cdp_addba_resp_tx_completion() - Indicate addba response tx
  1156. * completion to dp to change tid state.
  1157. * @soc: soc handle
  1158. * @peer_mac: mac address of peer handle
  1159. * @vdev_id: id of vdev handle
  1160. * @tid: tid
  1161. * @status: Tx completion status
  1162. *
  1163. * Return: success/failure of tid update
  1164. */
  1165. static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc,
  1166. uint8_t *peer_mac,
  1167. uint16_t vdev_id,
  1168. uint8_t tid, int status)
  1169. {
  1170. if (!soc || !soc->ops) {
  1171. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1172. "%s: Invalid Instance:", __func__);
  1173. QDF_BUG(0);
  1174. return 0;
  1175. }
  1176. if (!soc->ops->cmn_drv_ops ||
  1177. !soc->ops->cmn_drv_ops->addba_resp_tx_completion)
  1178. return 0;
  1179. return soc->ops->cmn_drv_ops->addba_resp_tx_completion(soc, peer_mac,
  1180. vdev_id, tid, status);
  1181. }
  1182. static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc,
  1183. uint8_t *peer_mac, uint16_t vdev_id, uint8_t dialogtoken, uint16_t tid,
  1184. uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum)
  1185. {
  1186. if (!soc || !soc->ops) {
  1187. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1188. "%s: Invalid Instance:", __func__);
  1189. QDF_BUG(0);
  1190. return 0;
  1191. }
  1192. if (!soc->ops->cmn_drv_ops ||
  1193. !soc->ops->cmn_drv_ops->addba_requestprocess)
  1194. return 0;
  1195. return soc->ops->cmn_drv_ops->addba_requestprocess(soc, peer_mac,
  1196. vdev_id, dialogtoken, tid, batimeout, buffersize,
  1197. startseqnum);
  1198. }
  1199. static inline QDF_STATUS
  1200. cdp_addba_responsesetup(ol_txrx_soc_handle soc,
  1201. uint8_t *peer_mac, uint16_t vdev_id,
  1202. uint8_t tid, uint8_t *dialogtoken,
  1203. uint16_t *statuscode, uint16_t *buffersize,
  1204. uint16_t *batimeout)
  1205. {
  1206. if (!soc || !soc->ops) {
  1207. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1208. "%s: Invalid Instance:", __func__);
  1209. QDF_BUG(0);
  1210. return QDF_STATUS_E_FAILURE;
  1211. }
  1212. if (!soc->ops->cmn_drv_ops ||
  1213. !soc->ops->cmn_drv_ops->addba_responsesetup)
  1214. return QDF_STATUS_E_FAILURE;
  1215. return soc->ops->cmn_drv_ops->addba_responsesetup(soc, peer_mac,
  1216. vdev_id, tid, dialogtoken, statuscode, buffersize,
  1217. batimeout);
  1218. }
  1219. static inline int cdp_delba_process(ol_txrx_soc_handle soc, uint8_t *peer_mac,
  1220. uint16_t vdev_id, int tid,
  1221. uint16_t reasoncode)
  1222. {
  1223. if (!soc || !soc->ops) {
  1224. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1225. "%s: Invalid Instance:", __func__);
  1226. QDF_BUG(0);
  1227. return 0;
  1228. }
  1229. if (!soc->ops->cmn_drv_ops ||
  1230. !soc->ops->cmn_drv_ops->delba_process)
  1231. return 0;
  1232. return soc->ops->cmn_drv_ops->delba_process(soc, peer_mac,
  1233. vdev_id, tid, reasoncode);
  1234. }
  1235. /**
  1236. * cdp_delba_tx_completion() - Handle delba tx completion
  1237. * to update stats and retry transmission if failed.
  1238. * @soc: soc handle
  1239. * @peer_mac: peer mac address
  1240. * @vdev_id: id of vdev handle
  1241. * @tid: Tid number
  1242. * @status: Tx completion status
  1243. *
  1244. * Return: 0 on Success, 1 on failure
  1245. */
  1246. static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc,
  1247. uint8_t *peer_mac,
  1248. uint16_t vdev_id,
  1249. uint8_t tid, int status)
  1250. {
  1251. if (!soc || !soc->ops) {
  1252. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1253. "%s: Invalid Instance:", __func__);
  1254. QDF_BUG(0);
  1255. return 0;
  1256. }
  1257. if (!soc->ops->cmn_drv_ops ||
  1258. !soc->ops->cmn_drv_ops->delba_tx_completion)
  1259. return 0;
  1260. return soc->ops->cmn_drv_ops->delba_tx_completion(soc, peer_mac,
  1261. vdev_id,
  1262. tid, status);
  1263. }
  1264. static inline QDF_STATUS
  1265. cdp_set_addbaresponse(ol_txrx_soc_handle soc,
  1266. uint8_t *peer_mac, uint16_t vdev_id, int tid,
  1267. uint16_t statuscode)
  1268. {
  1269. if (!soc || !soc->ops) {
  1270. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1271. "%s: Invalid Instance:", __func__);
  1272. QDF_BUG(0);
  1273. return QDF_STATUS_E_FAILURE;
  1274. }
  1275. if (!soc->ops->cmn_drv_ops ||
  1276. !soc->ops->cmn_drv_ops->set_addba_response)
  1277. return QDF_STATUS_E_FAILURE;
  1278. return soc->ops->cmn_drv_ops->set_addba_response(soc, peer_mac, vdev_id,
  1279. tid, statuscode);
  1280. }
  1281. /**
  1282. * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap
  1283. * @soc : soc handle
  1284. * @vdev_id: id of vdev handle
  1285. * @map_id: id of the tid map
  1286. *
  1287. * Return: QDF_STATUS
  1288. */
  1289. static inline QDF_STATUS
  1290. cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,
  1291. uint8_t vdev_id, uint8_t map_id)
  1292. {
  1293. if (!soc || !soc->ops) {
  1294. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1295. "%s: Invalid Instance:", __func__);
  1296. QDF_BUG(0);
  1297. return QDF_STATUS_E_FAILURE;
  1298. }
  1299. if (!soc->ops->cmn_drv_ops ||
  1300. !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map)
  1301. return QDF_STATUS_E_FAILURE;
  1302. return soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(soc, vdev_id,
  1303. map_id);
  1304. }
  1305. #ifdef QCA_MULTIPASS_SUPPORT
  1306. /**
  1307. * cdp_set_vlan_groupkey(): function to set vlan ID - group key map in the vap
  1308. * @soc : soc handle
  1309. * @vdev_id: id of vdev handle
  1310. * @vlan_id: vlan id
  1311. * @group_key: corresponding group key to vlan ID
  1312. *
  1313. * Return: void
  1314. */
  1315. static inline
  1316. QDF_STATUS cdp_set_vlan_groupkey(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1317. uint16_t vlan_id, uint16_t group_key)
  1318. {
  1319. if (!soc || !soc->ops) {
  1320. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1321. "%s: Invalid Instance:", __func__);
  1322. QDF_BUG(0);
  1323. return 0;
  1324. }
  1325. if (!soc->ops->cmn_drv_ops ||
  1326. !soc->ops->cmn_drv_ops->set_vlan_groupkey)
  1327. return 0;
  1328. return soc->ops->cmn_drv_ops->set_vlan_groupkey(soc, vdev_id, vlan_id,
  1329. group_key);
  1330. }
  1331. #endif
  1332. /**
  1333. * cdp_ath_get_total_per(): function to get hw retries
  1334. * @soc : soc handle
  1335. * @pdev_id: id of pdev handle
  1336. *
  1337. * Return: get hw retries
  1338. */
  1339. static inline
  1340. int cdp_ath_get_total_per(ol_txrx_soc_handle soc, uint8_t pdev_id)
  1341. {
  1342. if (!soc || !soc->ops) {
  1343. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1344. "%s: Invalid Instance:", __func__);
  1345. QDF_BUG(0);
  1346. return 0;
  1347. }
  1348. if (!soc->ops->cmn_drv_ops ||
  1349. !soc->ops->cmn_drv_ops->txrx_get_total_per)
  1350. return 0;
  1351. return soc->ops->cmn_drv_ops->txrx_get_total_per(soc, pdev_id);
  1352. }
  1353. /**
  1354. * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map
  1355. * @pdev_id: id of pdev handle
  1356. * @map_id: id of the tid map
  1357. * @tos: index value in map that needs to be changed
  1358. * @tid: tid value passed by user
  1359. *
  1360. * Return: void
  1361. */
  1362. static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,
  1363. uint8_t pdev_id, uint8_t map_id, uint8_t tos, uint8_t tid)
  1364. {
  1365. if (!soc || !soc->ops) {
  1366. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1367. "%s: Invalid Instance:", __func__);
  1368. QDF_BUG(0);
  1369. return;
  1370. }
  1371. if (!soc->ops->cmn_drv_ops ||
  1372. !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map)
  1373. return;
  1374. soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(soc, pdev_id,
  1375. map_id, tos, tid);
  1376. }
  1377. /**
  1378. * cdp_flush_cache_rx_queue() - flush cache rx queue frame
  1379. *
  1380. * Return: None
  1381. */
  1382. static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)
  1383. {
  1384. if (!soc || !soc->ops) {
  1385. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1386. "%s: Invalid Instance:", __func__);
  1387. QDF_BUG(0);
  1388. return;
  1389. }
  1390. if (!soc->ops->cmn_drv_ops ||
  1391. !soc->ops->cmn_drv_ops->flush_cache_rx_queue)
  1392. return;
  1393. soc->ops->cmn_drv_ops->flush_cache_rx_queue();
  1394. }
  1395. /**
  1396. * cdp_txrx_stats_request(): function to map to host and firmware statistics
  1397. * @soc: soc handle
  1398. * @vdev_id: virtual device ID
  1399. * @req: stats request container
  1400. *
  1401. * return: status
  1402. */
  1403. static inline
  1404. int cdp_txrx_stats_request(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1405. struct cdp_txrx_stats_req *req)
  1406. {
  1407. if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) {
  1408. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1409. "%s: Invalid Instance:", __func__);
  1410. QDF_ASSERT(0);
  1411. return 0;
  1412. }
  1413. if (soc->ops->cmn_drv_ops->txrx_stats_request)
  1414. return soc->ops->cmn_drv_ops->txrx_stats_request(soc, vdev_id,
  1415. req);
  1416. return 0;
  1417. }
  1418. /**
  1419. * cdp_txrx_intr_attach(): function to attach and configure interrupt
  1420. * @soc: soc handle
  1421. */
  1422. static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc)
  1423. {
  1424. if (!soc || !soc->ops) {
  1425. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1426. "%s: Invalid Instance:", __func__);
  1427. QDF_BUG(0);
  1428. return 0;
  1429. }
  1430. if (!soc->ops->cmn_drv_ops ||
  1431. !soc->ops->cmn_drv_ops->txrx_intr_attach)
  1432. return 0;
  1433. return soc->ops->cmn_drv_ops->txrx_intr_attach(soc);
  1434. }
  1435. /**
  1436. * cdp_txrx_intr_detach(): function to detach interrupt
  1437. * @soc: soc handle
  1438. */
  1439. static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc)
  1440. {
  1441. if (!soc || !soc->ops) {
  1442. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1443. "%s: Invalid Instance:", __func__);
  1444. QDF_BUG(0);
  1445. return;
  1446. }
  1447. if (!soc->ops->cmn_drv_ops ||
  1448. !soc->ops->cmn_drv_ops->txrx_intr_detach)
  1449. return;
  1450. soc->ops->cmn_drv_ops->txrx_intr_detach(soc);
  1451. }
  1452. /**
  1453. * cdp_display_stats(): function to map to dump stats
  1454. * @soc: soc handle
  1455. * @value: statistics option
  1456. */
  1457. static inline QDF_STATUS
  1458. cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value,
  1459. enum qdf_stats_verbosity_level level)
  1460. {
  1461. if (!soc || !soc->ops) {
  1462. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1463. "%s: Invalid Instance:", __func__);
  1464. QDF_BUG(0);
  1465. return 0;
  1466. }
  1467. if (!soc->ops->cmn_drv_ops ||
  1468. !soc->ops->cmn_drv_ops->display_stats)
  1469. return 0;
  1470. return soc->ops->cmn_drv_ops->display_stats(soc, value, level);
  1471. }
  1472. /**
  1473. * cdp_set_pn_check(): function to set pn check
  1474. * @soc: soc handle
  1475. * @vdev_id: id of virtual device
  1476. * @peer_mac: mac address of peer
  1477. * @sec_type: security type
  1478. * @rx_pn: receive pn
  1479. */
  1480. static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
  1481. uint8_t vdev_id, uint8_t *peer_mac,
  1482. enum cdp_sec_type sec_type, uint32_t *rx_pn)
  1483. {
  1484. if (!soc || !soc->ops) {
  1485. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1486. "%s: Invalid Instance:", __func__);
  1487. QDF_BUG(0);
  1488. return 0;
  1489. }
  1490. if (!soc->ops->cmn_drv_ops ||
  1491. !soc->ops->cmn_drv_ops->set_pn_check)
  1492. return 0;
  1493. soc->ops->cmn_drv_ops->set_pn_check(soc, vdev_id, peer_mac,
  1494. sec_type, rx_pn);
  1495. return 0;
  1496. }
  1497. /**
  1498. * cdp_set_key_sec_type(): function to set sec mode of key
  1499. * @soc: soc handle
  1500. * @vdev_id: id of virtual device
  1501. * @peer_mac: mac address of peer
  1502. * @sec_type: security type
  1503. * #is_unicast: ucast or mcast
  1504. */
  1505. static inline int cdp_set_key_sec_type(ol_txrx_soc_handle soc,
  1506. uint8_t vdev_id,
  1507. uint8_t *peer_mac,
  1508. enum cdp_sec_type sec_type,
  1509. bool is_unicast)
  1510. {
  1511. if (!soc || !soc->ops) {
  1512. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1513. "%s: Invalid Instance:", __func__);
  1514. QDF_BUG(0);
  1515. return 0;
  1516. }
  1517. if (!soc->ops->cmn_drv_ops ||
  1518. !soc->ops->cmn_drv_ops->set_key_sec_type)
  1519. return 0;
  1520. soc->ops->cmn_drv_ops->set_key_sec_type(soc, vdev_id,
  1521. peer_mac, sec_type, is_unicast);
  1522. return 0;
  1523. }
  1524. static inline QDF_STATUS
  1525. cdp_set_key(ol_txrx_soc_handle soc,
  1526. uint8_t vdev_id,
  1527. uint8_t *mac,
  1528. bool is_unicast, uint32_t *key)
  1529. {
  1530. if (!soc || !soc->ops) {
  1531. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1532. "%s: Invalid Instance:", __func__);
  1533. QDF_BUG(0);
  1534. return QDF_STATUS_E_FAILURE;
  1535. }
  1536. if (!soc->ops->ctrl_ops ||
  1537. !soc->ops->ctrl_ops->set_key)
  1538. return QDF_STATUS_E_FAILURE;
  1539. return soc->ops->ctrl_ops->set_key(soc, vdev_id, mac,
  1540. is_unicast, key);
  1541. }
  1542. /**
  1543. * cdp_update_config_parameters(): function to propagate configuration
  1544. * parameters to datapath
  1545. * @soc: opaque soc handle
  1546. * @cfg: configuration handle
  1547. *
  1548. * Return: status: 0 - Success, non-zero: Failure
  1549. */
  1550. static inline
  1551. QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc,
  1552. struct cdp_config_params *cfg)
  1553. {
  1554. struct cdp_soc *psoc = (struct cdp_soc *)soc;
  1555. if (!soc || !soc->ops) {
  1556. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1557. "%s: Invalid Instance:", __func__);
  1558. QDF_BUG(0);
  1559. return 0;
  1560. }
  1561. if (!soc->ops->cmn_drv_ops ||
  1562. !soc->ops->cmn_drv_ops->update_config_parameters)
  1563. return QDF_STATUS_SUCCESS;
  1564. return soc->ops->cmn_drv_ops->update_config_parameters(psoc,
  1565. cfg);
  1566. }
  1567. /**
  1568. * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev
  1569. * @soc: opaque soc handle
  1570. * @pdev_id: id of data path pdev handle
  1571. *
  1572. * Return: opaque dp handle
  1573. */
  1574. static inline void *
  1575. cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id)
  1576. {
  1577. if (!soc || !soc->ops) {
  1578. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1579. "%s: Invalid Instance:", __func__);
  1580. QDF_BUG(0);
  1581. return 0;
  1582. }
  1583. if (soc->ops->cmn_drv_ops->get_dp_txrx_handle)
  1584. return soc->ops->cmn_drv_ops->get_dp_txrx_handle(soc, pdev_id);
  1585. return 0;
  1586. }
  1587. /**
  1588. * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev
  1589. * @soc: opaque soc handle
  1590. * @pdev_id: id of data path pdev handle
  1591. * @dp_hdl: opaque pointer for dp_txrx_handle
  1592. *
  1593. * Return: void
  1594. */
  1595. static inline void
  1596. cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1597. void *dp_hdl)
  1598. {
  1599. if (!soc || !soc->ops) {
  1600. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1601. "%s: Invalid Instance:", __func__);
  1602. QDF_BUG(0);
  1603. return;
  1604. }
  1605. if (!soc->ops->cmn_drv_ops ||
  1606. !soc->ops->cmn_drv_ops->set_dp_txrx_handle)
  1607. return;
  1608. soc->ops->cmn_drv_ops->set_dp_txrx_handle(soc, pdev_id, dp_hdl);
  1609. }
  1610. /**
  1611. * cdp_vdev_get_dp_ext_txrx_handle() - get extended dp handle from vdev
  1612. * @soc: opaque soc handle
  1613. * @vdev_id: vdev id
  1614. *
  1615. * Return: opaque dp handle
  1616. */
  1617. static inline void *
  1618. cdp_vdev_get_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id)
  1619. {
  1620. if (!soc || !soc->ops) {
  1621. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1622. "%s: Invalid Instance:", __func__);
  1623. QDF_BUG(0);
  1624. return 0;
  1625. }
  1626. if (soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle)
  1627. return soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle(
  1628. soc, vdev_id);
  1629. return 0;
  1630. }
  1631. /**
  1632. * cdp_vdev_set_dp_ext_txrx_handle() - set extended dp handle in vdev
  1633. * @soc: opaque soc handle
  1634. * @vdev_id: vdev id
  1635. * @size: size of the advance dp handle
  1636. *
  1637. * Return: QDF_STATUS
  1638. */
  1639. static inline QDF_STATUS
  1640. cdp_vdev_set_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1641. uint16_t size)
  1642. {
  1643. if (!soc || !soc->ops) {
  1644. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1645. "%s: Invalid Instance:", __func__);
  1646. QDF_BUG(0);
  1647. return QDF_STATUS_E_FAILURE;
  1648. }
  1649. if (!soc->ops->cmn_drv_ops ||
  1650. !soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle)
  1651. return QDF_STATUS_E_FAILURE;
  1652. return soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle(soc,
  1653. vdev_id,
  1654. size);
  1655. }
  1656. /*
  1657. * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc
  1658. * @soc: opaque soc handle
  1659. *
  1660. * Return: opaque extended dp handle
  1661. */
  1662. static inline void *
  1663. cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc)
  1664. {
  1665. if (!soc || !soc->ops) {
  1666. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1667. "%s: Invalid Instance:", __func__);
  1668. QDF_BUG(0);
  1669. return NULL;
  1670. }
  1671. if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle)
  1672. return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle(
  1673. (struct cdp_soc *) soc);
  1674. return NULL;
  1675. }
  1676. /**
  1677. * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc
  1678. * @soc: opaque soc handle
  1679. * @dp_hdl: opaque pointer for dp_txrx_handle
  1680. *
  1681. * Return: void
  1682. */
  1683. static inline void
  1684. cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle)
  1685. {
  1686. if (!soc || !soc->ops) {
  1687. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1688. "%s: Invalid Instance:", __func__);
  1689. QDF_BUG(0);
  1690. return;
  1691. }
  1692. if (!soc->ops->cmn_drv_ops ||
  1693. !soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle)
  1694. return;
  1695. soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc,
  1696. dp_handle);
  1697. }
  1698. /**
  1699. * cdp_soc_handle_mode_change() - Update pdev_id to lmac_id mapping
  1700. * @soc: opaque soc handle
  1701. * @pdev_id: id of data path pdev handle
  1702. * @lmac_id: lmac id
  1703. * Return: QDF_STATUS
  1704. */
  1705. static inline QDF_STATUS
  1706. cdp_soc_handle_mode_change(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1707. uint32_t lmac_id)
  1708. {
  1709. if (!soc || !soc->ops) {
  1710. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1711. "%s: Invalid Instance:", __func__);
  1712. QDF_BUG(0);
  1713. return QDF_STATUS_E_FAILURE;
  1714. }
  1715. if (!soc->ops->cmn_drv_ops ||
  1716. !soc->ops->cmn_drv_ops->handle_mode_change)
  1717. return QDF_STATUS_E_FAILURE;
  1718. return soc->ops->cmn_drv_ops->handle_mode_change(soc, pdev_id,
  1719. lmac_id);
  1720. }
  1721. /**
  1722. * cdp_soc_map_pdev_to_lmac() - Save pdev_id to lmac_id mapping
  1723. * @soc: opaque soc handle
  1724. * @pdev_id: id of data path pdev handle
  1725. * @lmac_id: lmac id
  1726. * Return: QDF_STATUS
  1727. */
  1728. static inline QDF_STATUS
  1729. cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1730. uint32_t lmac_id)
  1731. {
  1732. if (!soc || !soc->ops) {
  1733. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1734. "%s: Invalid Instance:", __func__);
  1735. QDF_BUG(0);
  1736. return QDF_STATUS_E_FAILURE;
  1737. }
  1738. if (!soc->ops->cmn_drv_ops ||
  1739. !soc->ops->cmn_drv_ops->map_pdev_to_lmac)
  1740. return QDF_STATUS_E_FAILURE;
  1741. return soc->ops->cmn_drv_ops->map_pdev_to_lmac(soc, pdev_id,
  1742. lmac_id);
  1743. }
  1744. /**
  1745. * cdp_txrx_set_pdev_status_down() - set pdev down/up status
  1746. * @soc: soc opaque handle
  1747. * @pdev_id: id of data path pdev handle
  1748. * @is_pdev_down: pdev down/up status
  1749. *
  1750. * return: QDF_STATUS
  1751. */
  1752. static inline QDF_STATUS
  1753. cdp_txrx_set_pdev_status_down(ol_txrx_soc_handle soc,
  1754. uint8_t pdev_id,
  1755. bool is_pdev_down)
  1756. {
  1757. if (!soc || !soc->ops) {
  1758. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1759. "%s: Invalid Instance:", __func__);
  1760. QDF_BUG(0);
  1761. return QDF_STATUS_E_FAILURE;
  1762. }
  1763. if (!soc->ops->cmn_drv_ops ||
  1764. !soc->ops->cmn_drv_ops->set_pdev_status_down)
  1765. return QDF_STATUS_E_FAILURE;
  1766. return soc->ops->cmn_drv_ops->set_pdev_status_down(soc, pdev_id,
  1767. is_pdev_down);
  1768. }
  1769. /**
  1770. * cdp_tx_send() - enqueue frame for transmission
  1771. * @soc: soc opaque handle
  1772. * @vdev_id: id of VAP device
  1773. * @nbuf: nbuf to be enqueued
  1774. *
  1775. * This API is used by Extended Datapath modules to enqueue frame for
  1776. * transmission
  1777. *
  1778. * Return: void
  1779. */
  1780. static inline void
  1781. cdp_tx_send(ol_txrx_soc_handle soc, uint8_t vdev_id, qdf_nbuf_t nbuf)
  1782. {
  1783. if (!soc || !soc->ops) {
  1784. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1785. "%s: Invalid Instance:", __func__);
  1786. QDF_BUG(0);
  1787. return;
  1788. }
  1789. if (!soc->ops->cmn_drv_ops ||
  1790. !soc->ops->cmn_drv_ops->tx_send)
  1791. return;
  1792. soc->ops->cmn_drv_ops->tx_send(soc, vdev_id, nbuf);
  1793. }
  1794. /**
  1795. * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map
  1796. * @soc: opaque soc handle
  1797. * @pdev_id: id of data path pdev handle
  1798. * @pcp: pcp value
  1799. * @tid: tid value
  1800. *
  1801. * This API is used to configure the pcp-to-tid mapping for a pdev.
  1802. *
  1803. * Return: QDF_STATUS_SUCCESS if value set successfully
  1804. * QDF_STATUS_E_INVAL false if error
  1805. */
  1806. static inline
  1807. QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc,
  1808. uint8_t pdev_id,
  1809. uint32_t pcp, uint32_t tid)
  1810. {
  1811. if (!soc || !soc->ops) {
  1812. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1813. "%s: Invalid Instance", __func__);
  1814. return QDF_STATUS_E_INVAL;
  1815. }
  1816. if (!soc->ops->cmn_drv_ops ||
  1817. !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map)
  1818. return QDF_STATUS_E_INVAL;
  1819. return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(soc, pdev_id,
  1820. pcp, tid);
  1821. }
  1822. /**
  1823. * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id
  1824. * @soc: opaque soc handle
  1825. * @pdev_id: id of data path pdev handle
  1826. * @peer_id: data path peer id
  1827. * @peer_mac: peer_mac
  1828. *
  1829. * Return: QDF_STATUS
  1830. */
  1831. static inline
  1832. QDF_STATUS cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc,
  1833. uint32_t peer_id, uint8_t *peer_mac)
  1834. {
  1835. if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id)
  1836. return soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id(
  1837. soc, peer_id, peer_mac);
  1838. return QDF_STATUS_E_INVAL;
  1839. }
  1840. /**
  1841. * cdp_vdev_tx_lock() - acquire lock
  1842. * @soc: opaque soc handle
  1843. * @vdev: data path vdev handle
  1844. *
  1845. * Return: void
  1846. */
  1847. static inline
  1848. void cdp_vdev_tx_lock(ol_txrx_soc_handle soc,
  1849. uint8_t vdev_id)
  1850. {
  1851. if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock)
  1852. soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(soc, vdev_id);
  1853. }
  1854. /**
  1855. * cdp_vdev_tx_unlock() - release lock
  1856. * @soc: opaque soc handle
  1857. * @vdev_id: id of data path vdev handle
  1858. *
  1859. * Return: void
  1860. */
  1861. static inline
  1862. void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc,
  1863. uint8_t vdev_id)
  1864. {
  1865. if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock)
  1866. soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(soc, vdev_id);
  1867. }
  1868. /**
  1869. * cdp_ath_getstats() - get updated athstats
  1870. * @soc: opaque soc handle
  1871. * @id: vdev_id/pdev_id based on type
  1872. * @stats: cdp network device stats structure
  1873. * @type: device type pdev/vdev
  1874. *
  1875. * Return: QDF_STATUS
  1876. */
  1877. static inline QDF_STATUS
  1878. cdp_ath_getstats(ol_txrx_soc_handle soc,
  1879. uint8_t id, struct cdp_dev_stats *stats,
  1880. uint8_t type)
  1881. {
  1882. if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats)
  1883. return soc->ops->cmn_drv_ops->txrx_ath_getstats(soc, id,
  1884. stats, type);
  1885. return QDF_STATUS_E_FAILURE;
  1886. }
  1887. /**
  1888. * cdp_set_gid_flag() - set groupid flag
  1889. * @soc: opaque soc handle
  1890. * @pdev_id: id of data path pdev handle
  1891. * @mem_status: member status from grp management frame
  1892. * @user_position: user position from grp management frame
  1893. *
  1894. * Return: QDF_STATUS
  1895. */
  1896. static inline QDF_STATUS
  1897. cdp_set_gid_flag(ol_txrx_soc_handle soc,
  1898. uint8_t pdev_id, u_int8_t *mem_status,
  1899. u_int8_t *user_position)
  1900. {
  1901. if (soc->ops->cmn_drv_ops->txrx_set_gid_flag)
  1902. return soc->ops->cmn_drv_ops->txrx_set_gid_flag(soc, pdev_id,
  1903. mem_status,
  1904. user_position);
  1905. return QDF_STATUS_E_FAILURE;
  1906. }
  1907. /**
  1908. * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version
  1909. * @soc: opaque soc handle
  1910. * @pdev_id: id of data path pdev handle
  1911. *
  1912. */
  1913. static inline
  1914. uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc,
  1915. uint8_t pdev_id)
  1916. {
  1917. if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version)
  1918. return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(soc, pdev_id);
  1919. return 0;
  1920. }
  1921. /**
  1922. * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev
  1923. * @soc: opaque soc handle
  1924. * @vdev_id: id of vdev device
  1925. * @force: number of frame in SW queue
  1926. * Return: void
  1927. */
  1928. static inline
  1929. void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
  1930. uint8_t vdev_id, int force)
  1931. {
  1932. if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain)
  1933. soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(soc, vdev_id, force);
  1934. }
  1935. /* cdp_peer_map_attach() - CDP API to allocate PEER map memory
  1936. * @soc: opaque soc handle
  1937. * @max_peers: number of peers created in FW
  1938. * @max_ast_index: max number of AST index supported in FW
  1939. * @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW
  1940. *
  1941. *
  1942. * Return: QDF_STATUS
  1943. */
  1944. static inline QDF_STATUS
  1945. cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers,
  1946. uint32_t max_ast_index, bool peer_map_unmap_v2)
  1947. {
  1948. if (soc && soc->ops && soc->ops->cmn_drv_ops &&
  1949. soc->ops->cmn_drv_ops->txrx_peer_map_attach)
  1950. return soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc,
  1951. max_peers,
  1952. max_ast_index,
  1953. peer_map_unmap_v2);
  1954. return QDF_STATUS_SUCCESS;
  1955. }
  1956. /* cdp_txrx_classify_and_update() - To classify the packet and update stats
  1957. * @soc: opaque soc handle
  1958. * @vdev: opaque dp vdev handle
  1959. * @skb: data
  1960. * @dir: rx or tx packet
  1961. * @nbuf_classify: packet classification object
  1962. *
  1963. * Return: 1 on success else return 0
  1964. */
  1965. static inline int
  1966. cdp_txrx_classify_and_update(ol_txrx_soc_handle soc,
  1967. uint8_t vdev_id, qdf_nbuf_t skb,
  1968. enum txrx_direction dir,
  1969. struct ol_txrx_nbuf_classify *nbuf_class)
  1970. {
  1971. if (!soc || !soc->ops) {
  1972. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1973. "%s: Invalid Instance", __func__);
  1974. QDF_BUG(0);
  1975. return 0;
  1976. }
  1977. if (!soc->ops->cmn_drv_ops ||
  1978. !soc->ops->cmn_drv_ops->txrx_classify_update)
  1979. return 0;
  1980. return soc->ops->cmn_drv_ops->txrx_classify_update(soc, vdev_id,
  1981. skb,
  1982. dir, nbuf_class);
  1983. }
  1984. /**
  1985. * cdp_get_dp_capabilities() - get DP capabilities
  1986. * @soc: opaque soc handle
  1987. * @dp_cap: enum of DP capabilities
  1988. *
  1989. * Return: bool
  1990. */
  1991. static inline bool
  1992. cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps)
  1993. {
  1994. if (soc && soc->ops && soc->ops->cmn_drv_ops &&
  1995. soc->ops->cmn_drv_ops->get_dp_capabilities)
  1996. return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps);
  1997. return false;
  1998. }
  1999. #ifdef RECEIVE_OFFLOAD
  2000. /**
  2001. * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer
  2002. * @soc - data path soc handle
  2003. * @pdev - device instance pointer
  2004. *
  2005. * register rx offload flush callback function pointer
  2006. *
  2007. * return none
  2008. */
  2009. static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc,
  2010. void (rx_ol_flush_cb)(void *))
  2011. {
  2012. if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
  2013. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  2014. "%s invalid instance", __func__);
  2015. return;
  2016. }
  2017. if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb)
  2018. return soc->ops->rx_offld_ops->register_rx_offld_flush_cb(
  2019. rx_ol_flush_cb);
  2020. }
  2021. /**
  2022. * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function
  2023. * @soc - data path soc handle
  2024. *
  2025. * deregister rx offload flush callback function pointer
  2026. *
  2027. * return none
  2028. */
  2029. static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc)
  2030. {
  2031. if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
  2032. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  2033. "%s invalid instance", __func__);
  2034. return;
  2035. }
  2036. if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb)
  2037. return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb();
  2038. }
  2039. #endif /* RECEIVE_OFFLOAD */
  2040. /**
  2041. * @cdp_set_ba_timeout() - set ba aging timeout per AC
  2042. *
  2043. * @soc - pointer to the soc
  2044. * @value - timeout value in millisec
  2045. * @ac - Access category
  2046. *
  2047. * @return - void
  2048. */
  2049. static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc,
  2050. uint8_t ac, uint32_t value)
  2051. {
  2052. if (!soc || !soc->ops) {
  2053. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2054. "%s: Invalid Instance", __func__);
  2055. QDF_BUG(0);
  2056. return;
  2057. }
  2058. if (!soc->ops->cmn_drv_ops ||
  2059. !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout)
  2060. return;
  2061. soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value);
  2062. }
  2063. /**
  2064. * @cdp_get_ba_timeout() - return ba aging timeout per AC
  2065. *
  2066. * @soc - pointer to the soc
  2067. * @ac - access category
  2068. * @value - timeout value in millisec
  2069. *
  2070. * @return - void
  2071. */
  2072. static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc,
  2073. uint8_t ac, uint32_t *value)
  2074. {
  2075. if (!soc || !soc->ops) {
  2076. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2077. "%s: Invalid Instance", __func__);
  2078. QDF_BUG(0);
  2079. return;
  2080. }
  2081. if (!soc->ops->cmn_drv_ops ||
  2082. !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout)
  2083. return;
  2084. soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value);
  2085. }
  2086. /**
  2087. * cdp_cfg_get() - get cfg for dp enum
  2088. *
  2089. * @soc: pointer to the soc
  2090. * @cfg: cfg enum
  2091. *
  2092. * Return - cfg value
  2093. */
  2094. static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg)
  2095. {
  2096. if (!soc || !soc->ops) {
  2097. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2098. "%s: Invalid Instance", __func__);
  2099. return 0;
  2100. }
  2101. if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg)
  2102. return 0;
  2103. return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg);
  2104. }
  2105. /**
  2106. * cdp_soc_set_rate_stats_ctx() - set rate stats context in soc
  2107. * @soc: opaque soc handle
  2108. * @ctx: rate stats context
  2109. *
  2110. * Return: void
  2111. */
  2112. static inline void
  2113. cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc,
  2114. void *ctx)
  2115. {
  2116. if (!soc || !soc->ops) {
  2117. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2118. "%s: Invalid Instance:", __func__);
  2119. QDF_BUG(0);
  2120. return;
  2121. }
  2122. if (!soc->ops->cmn_drv_ops ||
  2123. !soc->ops->cmn_drv_ops->set_rate_stats_ctx)
  2124. return;
  2125. soc->ops->cmn_drv_ops->set_rate_stats_ctx((struct cdp_soc_t *)soc,
  2126. ctx);
  2127. }
  2128. /**
  2129. * cdp_soc_get_rate_stats_ctx() - get rate stats context in soc
  2130. * @soc: opaque soc handle
  2131. *
  2132. * Return: void
  2133. */
  2134. static inline void*
  2135. cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc)
  2136. {
  2137. if (!soc || !soc->ops) {
  2138. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2139. "%s: Invalid Instance:", __func__);
  2140. QDF_BUG(0);
  2141. return NULL;
  2142. }
  2143. if (!soc->ops->cmn_drv_ops ||
  2144. !soc->ops->cmn_drv_ops->get_rate_stats_ctx)
  2145. return NULL;
  2146. return soc->ops->cmn_drv_ops->get_rate_stats_ctx(soc);
  2147. }
  2148. /**
  2149. * cdp_peer_flush_rate_stats() - flush peer rate statistics
  2150. * @soc: opaque soc handle
  2151. * @pdev_id: id of pdev handle
  2152. * @buf: stats buffer
  2153. */
  2154. static inline void
  2155. cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  2156. void *buf)
  2157. {
  2158. if (!soc || !soc->ops) {
  2159. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2160. "%s: Invalid Instance:", __func__);
  2161. QDF_BUG(0);
  2162. return;
  2163. }
  2164. if (!soc->ops->cmn_drv_ops ||
  2165. !soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats)
  2166. return;
  2167. soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats(soc, pdev_id, buf);
  2168. }
  2169. /**
  2170. * cdp_flush_rate_stats_request() - request flush rate statistics
  2171. * @soc: opaque soc handle
  2172. * @pdev_id: id of pdev handle
  2173. */
  2174. static inline QDF_STATUS
  2175. cdp_flush_rate_stats_request(struct cdp_soc_t *soc, uint8_t pdev_id)
  2176. {
  2177. if (!soc || !soc->ops) {
  2178. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2179. "%s: Invalid Instance:", __func__);
  2180. QDF_BUG(0);
  2181. return QDF_STATUS_E_FAILURE;
  2182. }
  2183. if (!soc->ops->cmn_drv_ops ||
  2184. !soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request)
  2185. return QDF_STATUS_E_FAILURE;
  2186. return soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc,
  2187. pdev_id);
  2188. }
  2189. /**
  2190. * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map
  2191. * @soc: opaque soc handle
  2192. * @vdev: id of data path vdev handle
  2193. * @pcp: pcp value
  2194. * @tid: tid value
  2195. *
  2196. * This API is used to configure the pcp-to-tid mapping for a pdev.
  2197. *
  2198. * Return: QDF_STATUS_SUCCESS if value set successfully
  2199. * QDF_STATUS_E_INVAL false if error
  2200. */
  2201. static inline
  2202. QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc,
  2203. uint8_t vdev_id,
  2204. uint8_t pcp, uint8_t tid)
  2205. {
  2206. if (!soc || !soc->ops) {
  2207. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2208. "%s: Invalid Instance", __func__);
  2209. return QDF_STATUS_E_INVAL;
  2210. }
  2211. if (!soc->ops->cmn_drv_ops ||
  2212. !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map)
  2213. return QDF_STATUS_E_INVAL;
  2214. return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(soc, vdev_id,
  2215. pcp, tid);
  2216. }
  2217. /**
  2218. * cdp_tx_send_exc() - Transmit a frame on a given vdev in exception path
  2219. *
  2220. * @soc: opaque soc handle
  2221. * @vdev_id: vdev id
  2222. * @nbuf: skb
  2223. * @tx_exc_metadata: Handle that holds exception path meta data
  2224. *
  2225. * Return: NULL on success
  2226. * nbuf when it fails to send
  2227. */
  2228. static inline qdf_nbuf_t
  2229. cdp_tx_send_exc(ol_txrx_soc_handle soc,
  2230. uint8_t vdev_id,
  2231. qdf_nbuf_t nbuf,
  2232. struct cdp_tx_exception_metadata *tx_exc_metadata)
  2233. {
  2234. if (!soc || !soc->ops) {
  2235. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2236. "%s: Invalid Instance", __func__);
  2237. QDF_BUG(0);
  2238. return 0;
  2239. }
  2240. if (!soc->ops->cmn_drv_ops ||
  2241. !soc->ops->cmn_drv_ops->tx_send_exc)
  2242. return 0;
  2243. return soc->ops->cmn_drv_ops->tx_send_exc
  2244. (soc, vdev_id, nbuf, tx_exc_metadata);
  2245. }
  2246. /**
  2247. * cdp_vdev_get_peer_mac_list(): function to get peer mac list of vdev
  2248. * @soc: Datapath soc handle
  2249. * @vdev_id: vdev id
  2250. * @newmac: Table of the clients mac
  2251. * @mac_cnt: No. of MACs required
  2252. *
  2253. * return: no of clients
  2254. */
  2255. static inline uint16_t
  2256. cdp_vdev_get_peer_mac_list(ol_txrx_soc_handle soc,
  2257. uint8_t vdev_id,
  2258. uint8_t newmac[][QDF_MAC_ADDR_SIZE],
  2259. uint16_t mac_cnt)
  2260. {
  2261. if (!soc || !soc->ops) {
  2262. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2263. "%s: Invalid Instance", __func__);
  2264. QDF_BUG(0);
  2265. return 0;
  2266. }
  2267. if (!soc->ops->cmn_drv_ops ||
  2268. !soc->ops->cmn_drv_ops->get_peer_mac_list)
  2269. return 0;
  2270. return soc->ops->cmn_drv_ops->get_peer_mac_list
  2271. (soc, vdev_id, newmac, mac_cnt);
  2272. }
  2273. /*
  2274. * cdp_soc_config_full_mon_mode () - Configure Full monitor mode
  2275. *
  2276. *@soc: dp soc handle
  2277. *@val: value to be configured val should be 0 or 1
  2278. *
  2279. * This API is used to enable/disable support for Full monitor mode feature
  2280. *
  2281. * Return: QDF_STATUS_SUCCESS if value set successfully
  2282. * QDF_STATUS_E_INVAL false if error
  2283. */
  2284. static inline QDF_STATUS
  2285. cdp_soc_config_full_mon_mode(ol_txrx_soc_handle soc, uint8_t val)
  2286. {
  2287. if (!soc || !soc->ops) {
  2288. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2289. "%s: Invalid Instance", __func__);
  2290. return QDF_STATUS_E_INVAL;
  2291. }
  2292. if (!soc->ops->mon_ops ||
  2293. !soc->ops->mon_ops->config_full_mon_mode)
  2294. return QDF_STATUS_E_INVAL;
  2295. return soc->ops->mon_ops->config_full_mon_mode(soc, val);
  2296. }
  2297. #endif /* _CDP_TXRX_CMN_H_ */