cdp_txrx_cmn.h 67 KB

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