cdp_txrx_ctrl.h 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: cdp_txrx_ctrl.h
  21. * Define the host data path control API functions
  22. * called by the host control SW and the OS interface module
  23. */
  24. #ifndef _CDP_TXRX_CTRL_H_
  25. #define _CDP_TXRX_CTRL_H_
  26. #include "cdp_txrx_handle.h"
  27. #include "cdp_txrx_cmn_struct.h"
  28. #include "cdp_txrx_cmn.h"
  29. #include "cdp_txrx_ops.h"
  30. static inline int cdp_is_target_ar900b
  31. (ol_txrx_soc_handle soc)
  32. {
  33. if (!soc || !soc->ops) {
  34. dp_cdp_debug("Invalid Instance:");
  35. QDF_BUG(0);
  36. return 0;
  37. }
  38. if (!soc->ops->ctrl_ops ||
  39. !soc->ops->ctrl_ops->txrx_is_target_ar900b)
  40. return 0;
  41. return soc->ops->ctrl_ops->txrx_is_target_ar900b(soc);
  42. }
  43. /* WIN */
  44. static inline int
  45. cdp_mempools_attach(ol_txrx_soc_handle soc)
  46. {
  47. if (!soc || !soc->ops) {
  48. dp_cdp_debug("Invalid Instance:");
  49. QDF_BUG(0);
  50. return 0;
  51. }
  52. if (!soc->ops->ctrl_ops ||
  53. !soc->ops->ctrl_ops->txrx_mempools_attach)
  54. return 0;
  55. return soc->ops->ctrl_ops->txrx_mempools_attach(soc);
  56. }
  57. #if defined(ATH_SUPPORT_NAC) || defined(ATH_SUPPORT_NAC_RSSI)
  58. /**
  59. * cdp_update_filter_neighbour_peers() - update the neighbour peer addresses
  60. * @soc: the pointer to soc object
  61. * @vdev_id: id of the pointer to vdev
  62. * @cmd: add/del entry into peer table
  63. * @macaddr: the address of neighbour peer
  64. *
  65. * This defines interface function to update neighbour peers addresses
  66. * which needs to be filtered
  67. *
  68. * Return: int
  69. */
  70. static inline int
  71. cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc,
  72. uint8_t vdev_id, uint32_t cmd, uint8_t *macaddr)
  73. {
  74. if (!soc || !soc->ops) {
  75. dp_cdp_debug("Invalid Instance:");
  76. QDF_BUG(0);
  77. return 0;
  78. }
  79. if (!soc->ops->mon_ops ||
  80. !soc->ops->mon_ops->txrx_update_filter_neighbour_peers)
  81. return 0;
  82. return soc->ops->mon_ops->txrx_update_filter_neighbour_peers
  83. (soc, vdev_id, cmd, macaddr);
  84. }
  85. #endif /* ATH_SUPPORT_NAC || ATH_SUPPORT_NAC_RSSI*/
  86. /**
  87. * cdp_update_mon_mac_filter() - update the monitor buffer and status filter
  88. * @soc: the pointer to soc object
  89. * @vdev_id: id of the pointer to vdev
  90. * @cmd: add/del entry into peer table
  91. *
  92. * This defines interface function to set/reset monitor filter
  93. * in case of special vap (scan radio)
  94. *
  95. * Return: QDF_STATUS
  96. */
  97. static inline QDF_STATUS
  98. cdp_update_mon_mac_filter(ol_txrx_soc_handle soc,
  99. uint8_t vdev_id, uint32_t cmd)
  100. {
  101. if (!soc || !soc->ops) {
  102. dp_cdp_debug("Invalid Instance:");
  103. QDF_BUG(0);
  104. return QDF_STATUS_E_FAILURE;
  105. }
  106. if (!soc->ops->mon_ops ||
  107. !soc->ops->mon_ops->txrx_update_mon_mac_filter)
  108. return QDF_STATUS_E_FAILURE;
  109. return soc->ops->mon_ops->txrx_update_mon_mac_filter
  110. (soc, vdev_id, cmd);
  111. }
  112. #ifdef WLAN_SUPPORT_MSCS
  113. /**
  114. * cdp_record_vdev_mscs_params() - record the MSCS data and send it to the
  115. * Data path
  116. * @soc: the pointer to soc object
  117. * @vdev_id: id of the pointer to vdev
  118. * @macaddr: the address of neighbour peer
  119. * @mscs_params: Structure having MSCS params obtained from handshake
  120. * @active: Flag to set MSCS active/inactive
  121. *
  122. * This defines interface function to record the MSCS procedure
  123. * based data parameters so that the data path layer can access it
  124. *
  125. * Return: QDF_STATUS
  126. */
  127. static inline QDF_STATUS
  128. cdp_record_vdev_mscs_params(ol_txrx_soc_handle soc, uint8_t
  129. *macaddr, uint8_t vdev_id, struct cdp_mscs_params *mscs_params,
  130. bool active)
  131. {
  132. if (!soc || !soc->ops) {
  133. dp_cdp_debug("Invalid Instance:");
  134. QDF_BUG(0);
  135. return QDF_STATUS_E_FAILURE;
  136. }
  137. if (!soc->ops->ctrl_ops ||
  138. !soc->ops->ctrl_ops->txrx_record_mscs_params)
  139. return QDF_STATUS_E_FAILURE;
  140. return soc->ops->ctrl_ops->txrx_record_mscs_params
  141. (soc, macaddr, vdev_id, mscs_params, active);
  142. }
  143. #endif
  144. /**
  145. * cdp_set_pdev_reo_dest() - set the Reo Destination ring for the pdev
  146. * @soc: pointer to the soc
  147. * @pdev_id: id of the data physical device object
  148. * @val: the Reo destination ring index (1 to 4)
  149. *
  150. * This will be used to configure the Reo Destination ring for this pdev.
  151. *
  152. * Return: QDF_STATUS
  153. */
  154. static inline QDF_STATUS
  155. cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc,
  156. uint8_t pdev_id, enum cdp_host_reo_dest_ring val)
  157. {
  158. if (!soc || !soc->ops) {
  159. dp_cdp_debug("Invalid Instance:");
  160. QDF_BUG(0);
  161. return QDF_STATUS_E_FAILURE;
  162. }
  163. if (!soc->ops->ctrl_ops ||
  164. !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest)
  165. return QDF_STATUS_E_FAILURE;
  166. return soc->ops->ctrl_ops->txrx_set_pdev_reo_dest
  167. (soc, pdev_id, val);
  168. }
  169. /**
  170. * cdp_get_pdev_reo_dest() - get the Reo Destination ring for the pdev
  171. * @soc: pointer to the soc
  172. * @pdev_id: id of physical device object
  173. *
  174. * Return: the Reo destination ring index (1 to 4), 0 if not supported.
  175. */
  176. static inline enum cdp_host_reo_dest_ring
  177. cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, uint8_t pdev_id)
  178. {
  179. if (!soc || !soc->ops) {
  180. dp_cdp_debug("Invalid Instance:");
  181. QDF_BUG(0);
  182. return cdp_host_reo_dest_ring_unknown;
  183. }
  184. if (!soc->ops->ctrl_ops ||
  185. !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest)
  186. return cdp_host_reo_dest_ring_unknown;
  187. return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(soc, pdev_id);
  188. }
  189. /* Is this similar to ol_txrx_peer_state_update() in MCL */
  190. /**
  191. * cdp_peer_authorize() - Update the authorize peer object at association time
  192. * @soc: pointer to the soc
  193. * @vdev_id: id of the pointer to vdev
  194. * @peer_mac: mac address of the node's object
  195. * @authorize: either to authorize or unauthorize peer
  196. *
  197. * For the host-based implementation of rate-control, it
  198. * updates the peer/node-related parameters within rate-control
  199. * context of the peer at association.
  200. *
  201. * Return: QDF_STATUS
  202. */
  203. static inline QDF_STATUS
  204. cdp_peer_authorize(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  205. u_int32_t authorize)
  206. {
  207. if (!soc || !soc->ops) {
  208. dp_cdp_debug("Invalid Instance:");
  209. QDF_BUG(0);
  210. return QDF_STATUS_E_FAILURE;
  211. }
  212. if (!soc->ops->ctrl_ops ||
  213. !soc->ops->ctrl_ops->txrx_peer_authorize)
  214. return QDF_STATUS_E_FAILURE;
  215. return soc->ops->ctrl_ops->txrx_peer_authorize
  216. (soc, vdev_id, peer_mac, authorize);
  217. }
  218. /**
  219. * cdp_peer_get_authorize() - Get per authorize status
  220. * @soc: pointer to the soc
  221. * @vdev_id: id of the pointer to vdev
  222. * @peer_mac: mac address of the node's object
  223. *
  224. * Return: true is peer is authorized, false otherwise
  225. */
  226. static inline bool
  227. cdp_peer_get_authorize(ol_txrx_soc_handle soc, uint8_t vdev_id,
  228. uint8_t *peer_mac)
  229. {
  230. if (!soc || !soc->ops) {
  231. dp_cdp_debug("Invalid Instance:");
  232. QDF_BUG(0);
  233. return false;
  234. }
  235. if (!soc->ops->ctrl_ops ||
  236. !soc->ops->ctrl_ops->txrx_peer_get_authorize)
  237. return false;
  238. return soc->ops->ctrl_ops->txrx_peer_get_authorize
  239. (soc, vdev_id, peer_mac);
  240. }
  241. static inline void cdp_tx_flush_buffers
  242. (ol_txrx_soc_handle soc, uint8_t vdev_id)
  243. {
  244. if (!soc || !soc->ops) {
  245. dp_cdp_debug("Invalid Instance:");
  246. QDF_BUG(0);
  247. return;
  248. }
  249. if (!soc->ops->ctrl_ops ||
  250. !soc->ops->ctrl_ops->tx_flush_buffers)
  251. return;
  252. soc->ops->ctrl_ops->tx_flush_buffers(soc, vdev_id);
  253. }
  254. static inline QDF_STATUS cdp_txrx_get_vdev_param(ol_txrx_soc_handle soc,
  255. uint8_t vdev_id,
  256. enum cdp_vdev_param_type type,
  257. cdp_config_param_type *val)
  258. {
  259. if (!soc || !soc->ops) {
  260. dp_cdp_debug("Invalid Instance:");
  261. QDF_BUG(0);
  262. return QDF_STATUS_E_FAILURE;
  263. }
  264. if (!soc->ops->ctrl_ops ||
  265. !soc->ops->ctrl_ops->txrx_get_vdev_param) {
  266. dp_cdp_debug("callback not registered:");
  267. return QDF_STATUS_E_FAILURE;
  268. }
  269. return soc->ops->ctrl_ops->txrx_get_vdev_param(soc, vdev_id,
  270. type, val);
  271. }
  272. static inline QDF_STATUS
  273. cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc,
  274. uint8_t vdev_id, enum cdp_vdev_param_type type,
  275. cdp_config_param_type val)
  276. {
  277. if (!soc || !soc->ops) {
  278. dp_cdp_debug("Invalid Instance:");
  279. QDF_BUG(0);
  280. return QDF_STATUS_E_FAILURE;
  281. }
  282. if (!soc->ops->ctrl_ops ||
  283. !soc->ops->ctrl_ops->txrx_set_vdev_param) {
  284. dp_cdp_nofl_debug("NULL vdev params callback");
  285. return QDF_STATUS_E_FAILURE;
  286. }
  287. return soc->ops->ctrl_ops->txrx_set_vdev_param(soc, vdev_id,
  288. type, val);
  289. }
  290. static inline QDF_STATUS
  291. cdp_txrx_set_psoc_param(ol_txrx_soc_handle soc,
  292. enum cdp_psoc_param_type type,
  293. cdp_config_param_type val)
  294. {
  295. if (!soc || !soc->ops) {
  296. dp_cdp_debug("Invalid Instance:");
  297. QDF_BUG(0);
  298. return QDF_STATUS_E_FAILURE;
  299. }
  300. if (!soc->ops->ctrl_ops ||
  301. !soc->ops->ctrl_ops->txrx_set_psoc_param)
  302. return QDF_STATUS_E_FAILURE;
  303. return soc->ops->ctrl_ops->txrx_set_psoc_param(soc, type, val);
  304. }
  305. static inline QDF_STATUS
  306. cdp_txrx_get_psoc_param(ol_txrx_soc_handle soc,
  307. enum cdp_psoc_param_type type,
  308. cdp_config_param_type *val)
  309. {
  310. if (!soc || !soc->ops) {
  311. dp_cdp_debug("Invalid Instance:");
  312. QDF_BUG(0);
  313. return QDF_STATUS_E_FAILURE;
  314. }
  315. if (!soc->ops->ctrl_ops ||
  316. !soc->ops->ctrl_ops->txrx_get_psoc_param)
  317. return QDF_STATUS_E_FAILURE;
  318. return soc->ops->ctrl_ops->txrx_get_psoc_param(soc, type, val);
  319. }
  320. static inline
  321. QDF_STATUS cdp_vdev_alloc_vdev_stats_id(ol_txrx_soc_handle soc,
  322. uint8_t *vdev_stats_id)
  323. {
  324. if (!soc || !soc->ops) {
  325. dp_cdp_debug("Invalid Instance:");
  326. QDF_BUG(0);
  327. return QDF_STATUS_E_FAILURE;
  328. }
  329. if (!soc->ops->host_stats_ops ||
  330. !soc->ops->host_stats_ops->txrx_alloc_vdev_stats_id)
  331. return QDF_STATUS_E_FAILURE;
  332. return soc->ops->host_stats_ops->txrx_alloc_vdev_stats_id
  333. (soc, vdev_stats_id);
  334. }
  335. static inline
  336. void cdp_vdev_reset_vdev_stats_id(ol_txrx_soc_handle soc,
  337. uint8_t vdev_stats_id)
  338. {
  339. if (!soc || !soc->ops) {
  340. dp_cdp_debug("Invalid Instance:");
  341. QDF_BUG(0);
  342. return;
  343. }
  344. if (!soc->ops->host_stats_ops ||
  345. !soc->ops->host_stats_ops->txrx_reset_vdev_stats_id)
  346. return;
  347. soc->ops->host_stats_ops->txrx_reset_vdev_stats_id(soc, vdev_stats_id);
  348. }
  349. #ifdef VDEV_PEER_PROTOCOL_COUNT
  350. /**
  351. * cdp_set_vdev_peer_protocol_count() - set per-peer protocol count tracking
  352. * @soc: pointer to the soc
  353. * @vdev_id: the data virtual device object
  354. * @enable: enable per-peer protocol count
  355. *
  356. * Set per-peer protocol count feature enable
  357. *
  358. * Return: void
  359. */
  360. static inline
  361. void cdp_set_vdev_peer_protocol_count(ol_txrx_soc_handle soc, int8_t vdev_id,
  362. bool enable)
  363. {
  364. if (!soc || !soc->ops) {
  365. dp_cdp_debug("Invalid Instance:");
  366. QDF_BUG(0);
  367. return;
  368. }
  369. if (!soc->ops->ctrl_ops ||
  370. !soc->ops->ctrl_ops->txrx_enable_peer_protocol_count)
  371. return;
  372. soc->ops->ctrl_ops->txrx_enable_peer_protocol_count(soc, vdev_id,
  373. enable);
  374. }
  375. /**
  376. * cdp_set_vdev_peer_protocol_drop_mask() - set per-peer protocol drop mask
  377. * @soc: pointer to the soc
  378. * @vdev_id: ID of the data virtual device object
  379. * @drop_mask: drop_mask
  380. *
  381. * Set per-peer protocol drop_mask
  382. *
  383. * Return: void
  384. */
  385. static inline
  386. void cdp_set_vdev_peer_protocol_drop_mask(ol_txrx_soc_handle soc,
  387. int8_t vdev_id, int drop_mask)
  388. {
  389. if (!soc || !soc->ops) {
  390. dp_cdp_debug("Invalid Instance:");
  391. QDF_BUG(0);
  392. return;
  393. }
  394. if (!soc->ops->ctrl_ops ||
  395. !soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask)
  396. return;
  397. soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask(soc, vdev_id,
  398. drop_mask);
  399. }
  400. /**
  401. * cdp_is_vdev_peer_protocol_count_enabled() - whether peer-protocol tracking
  402. * enabled
  403. * @soc: pointer to the soc
  404. * @vdev_id: ID of the data virtual device object
  405. *
  406. * Get whether peer protocol count feature enabled or not
  407. *
  408. * Return: whether feature enabled or not
  409. */
  410. static inline
  411. int cdp_is_vdev_peer_protocol_count_enabled(ol_txrx_soc_handle soc,
  412. int8_t vdev_id)
  413. {
  414. if (!soc || !soc->ops) {
  415. dp_cdp_debug("Invalid Instance:");
  416. QDF_BUG(0);
  417. return 0;
  418. }
  419. if (!soc->ops->ctrl_ops ||
  420. !soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled)
  421. return 0;
  422. return soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled(soc,
  423. vdev_id);
  424. }
  425. /**
  426. * cdp_get_peer_protocol_drop_mask() - get per-peer protocol count drop-mask
  427. * @soc: pointer to the soc
  428. * @vdev_id: ID of the data virtual device object
  429. *
  430. * Get peer-protocol-count drop-mask
  431. *
  432. * Return: peer-protocol-count drop-mask
  433. */
  434. static inline
  435. int cdp_get_peer_protocol_drop_mask(ol_txrx_soc_handle soc, int8_t vdev_id)
  436. {
  437. if (!soc || !soc->ops) {
  438. dp_cdp_debug("Invalid Instance:");
  439. QDF_BUG(0);
  440. return 0;
  441. }
  442. if (!soc->ops->ctrl_ops ||
  443. !soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask)
  444. return 0;
  445. return soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask(soc,
  446. vdev_id);
  447. }
  448. /*
  449. * Rx-Ingress and Tx-Egress are in the lower level DP layer
  450. * Rx-Egress and Tx-ingress are handled in osif layer for DP
  451. * So
  452. * Rx-Ingress and Tx-Egress definitions are in DP layer
  453. * Rx-Egress and Tx-ingress mask definitions are here below
  454. */
  455. #define VDEV_PEER_PROTOCOL_RX_INGRESS_MASK 1
  456. #define VDEV_PEER_PROTOCOL_TX_INGRESS_MASK 2
  457. #define VDEV_PEER_PROTOCOL_RX_EGRESS_MASK 4
  458. #define VDEV_PEER_PROTOCOL_TX_EGRESS_MASK 8
  459. #else
  460. #define cdp_set_vdev_peer_protocol_count(soc, vdev_id, enable)
  461. #define cdp_set_vdev_peer_protocol_drop_mask(soc, vdev_id, drop_mask)
  462. #define cdp_is_vdev_peer_protocol_count_enabled(soc, vdev_id) 0
  463. #define cdp_get_peer_protocol_drop_mask(soc, vdev_id) 0
  464. #endif
  465. /**
  466. * cdp_txrx_set_pdev_param() - set pdev parameter
  467. * @soc: opaque soc handle
  468. * @pdev_id: id of data path pdev handle
  469. * @type: param type
  470. * @val: value
  471. *
  472. * Return: status: 0 - Success, non-zero: Failure
  473. */
  474. static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
  475. uint8_t pdev_id,
  476. enum cdp_pdev_param_type type,
  477. cdp_config_param_type val)
  478. {
  479. if (!soc || !soc->ops) {
  480. dp_cdp_debug("Invalid Instance:");
  481. QDF_BUG(0);
  482. return QDF_STATUS_E_FAILURE;
  483. }
  484. if (!soc->ops->ctrl_ops ||
  485. !soc->ops->ctrl_ops->txrx_set_pdev_param)
  486. return QDF_STATUS_E_FAILURE;
  487. return soc->ops->ctrl_ops->txrx_set_pdev_param
  488. (soc, pdev_id, type, val);
  489. }
  490. /**
  491. * cdp_txrx_set_peer_param() - set pdev parameter
  492. * @soc: opaque soc handle
  493. * @vdev_id: id of data path vdev handle
  494. * @peer_mac: peer mac address
  495. * @type: param type
  496. * @val: value
  497. *
  498. * Return: status: 0 - Success, non-zero: Failure
  499. */
  500. static inline QDF_STATUS cdp_txrx_set_peer_param(ol_txrx_soc_handle soc,
  501. uint8_t vdev_id,
  502. uint8_t *peer_mac,
  503. enum cdp_peer_param_type type,
  504. cdp_config_param_type val)
  505. {
  506. if (!soc || !soc->ops) {
  507. dp_cdp_debug("Invalid Instance:");
  508. QDF_BUG(0);
  509. return QDF_STATUS_E_FAILURE;
  510. }
  511. if (!soc->ops->ctrl_ops ||
  512. !soc->ops->ctrl_ops->txrx_set_peer_param)
  513. return QDF_STATUS_E_FAILURE;
  514. return soc->ops->ctrl_ops->txrx_set_peer_param
  515. (soc, vdev_id, peer_mac, type, val);
  516. }
  517. /**
  518. * cdp_txrx_get_peer_param() - set pdev parameter
  519. * @soc: opaque soc handle
  520. * @vdev_id: id of data path vdev handle
  521. * @peer_mac: peer mac address
  522. * @type: param type
  523. * @val: address of buffer
  524. *
  525. * Return: status
  526. */
  527. static inline QDF_STATUS cdp_txrx_get_peer_param(ol_txrx_soc_handle soc,
  528. uint8_t vdev_id,
  529. uint8_t *peer_mac,
  530. enum cdp_peer_param_type type,
  531. cdp_config_param_type *val)
  532. {
  533. if (!soc || !soc->ops) {
  534. dp_cdp_debug("Invalid Instance:");
  535. QDF_BUG(0);
  536. return QDF_STATUS_E_FAILURE;
  537. }
  538. if (!soc->ops->ctrl_ops ||
  539. !soc->ops->ctrl_ops->txrx_get_peer_param)
  540. return QDF_STATUS_E_FAILURE;
  541. return soc->ops->ctrl_ops->txrx_get_peer_param
  542. (soc, vdev_id, peer_mac, type, val);
  543. }
  544. #ifdef QCA_MULTIPASS_SUPPORT
  545. static inline void
  546. cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, uint8_t vdev_id,
  547. uint8_t *peer_mac, uint16_t vlan_id)
  548. {
  549. if (!soc || !soc->ops) {
  550. dp_cdp_debug("Invalid Instance:");
  551. QDF_BUG(0);
  552. return;
  553. }
  554. if (!soc->ops->ctrl_ops ||
  555. !soc->ops->ctrl_ops->txrx_peer_set_vlan_id)
  556. return;
  557. soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev_id, peer_mac,
  558. vlan_id);
  559. }
  560. #endif
  561. /**
  562. * cdp_txrx_get_pdev_param() - get pdev parameter
  563. * @soc: opaque soc handle
  564. * @pdev_id: id of data path pdev handle
  565. * @type: param type
  566. * @value: address of value buffer
  567. *
  568. * Return: status
  569. */
  570. static inline QDF_STATUS cdp_txrx_get_pdev_param(ol_txrx_soc_handle soc,
  571. uint8_t pdev_id,
  572. enum cdp_pdev_param_type type,
  573. cdp_config_param_type *value)
  574. {
  575. if (!soc || !soc->ops) {
  576. dp_cdp_debug("Invalid Instance:");
  577. QDF_BUG(0);
  578. return QDF_STATUS_E_FAILURE;
  579. }
  580. if (!soc->ops->ctrl_ops ||
  581. !soc->ops->ctrl_ops->txrx_get_pdev_param)
  582. return QDF_STATUS_E_FAILURE;
  583. return soc->ops->ctrl_ops->txrx_get_pdev_param
  584. (soc, pdev_id, type, value);
  585. }
  586. /**
  587. * cdp_txrx_peer_protocol_cnt() - set peer protocol count
  588. * @soc: opaque soc handle
  589. * @vdev_id: vdev id
  590. * @nbuf: data packet
  591. * @is_egress: whether egress or ingress
  592. * @is_rx: whether tx or rx
  593. *
  594. * Return: void
  595. */
  596. #ifdef VDEV_PEER_PROTOCOL_COUNT
  597. static inline void
  598. cdp_txrx_peer_protocol_cnt(ol_txrx_soc_handle soc,
  599. int8_t vdev_id,
  600. qdf_nbuf_t nbuf,
  601. enum vdev_peer_protocol_enter_exit is_egress,
  602. enum vdev_peer_protocol_tx_rx is_rx)
  603. {
  604. if (!soc || !soc->ops) {
  605. dp_cdp_debug("Invalid Instance:");
  606. QDF_BUG(0);
  607. return;
  608. }
  609. if (!soc->ops->ctrl_ops ||
  610. !soc->ops->ctrl_ops->txrx_peer_protocol_cnt)
  611. return;
  612. soc->ops->ctrl_ops->txrx_peer_protocol_cnt(soc, vdev_id, nbuf,
  613. is_egress, is_rx);
  614. }
  615. #else
  616. #define cdp_txrx_peer_protocol_cnt(soc, vdev_id, nbuf, is_egress, is_rx)
  617. #endif
  618. /**
  619. * cdp_enable_peer_based_pktlog()- Set flag in peer structure
  620. * @soc: pointer to the soc
  621. * @pdev_id: id of the data physical device object
  622. * @enable: enable or disable peer based filter based pktlog
  623. * @peer_macaddr: Mac address of peer which needs to be
  624. * filtered
  625. *
  626. * This function will set flag in peer structure if peer based filtering
  627. * is enabled for pktlog
  628. *
  629. * Return: int
  630. */
  631. static inline int
  632. cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, uint8_t pdev_id,
  633. char *peer_macaddr,
  634. uint8_t enable)
  635. {
  636. if (!soc || !soc->ops) {
  637. QDF_TRACE_ERROR(QDF_MODULE_ID_DP,
  638. "%s invalid instance", __func__);
  639. QDF_BUG(0);
  640. return 0;
  641. }
  642. if (!soc->ops->ctrl_ops ||
  643. !soc->ops->ctrl_ops->enable_peer_based_pktlog)
  644. return 0;
  645. return soc->ops->ctrl_ops->enable_peer_based_pktlog
  646. (soc, pdev_id, peer_macaddr, enable);
  647. }
  648. /**
  649. * cdp_calculate_delay_stats()- get rx delay stats
  650. * @soc: pointer to the soc
  651. * @vdev_id: id of vdev handle
  652. * @nbuf: nbuf which is passed
  653. *
  654. * This function will calculate rx delay statistics.
  655. */
  656. static inline QDF_STATUS
  657. cdp_calculate_delay_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  658. qdf_nbuf_t nbuf)
  659. {
  660. if (!soc || !soc->ops) {
  661. dp_cdp_debug("Invalid Instance:");
  662. QDF_BUG(0);
  663. return QDF_STATUS_E_FAILURE;
  664. }
  665. if (!soc->ops->ctrl_ops ||
  666. !soc->ops->ctrl_ops->calculate_delay_stats) {
  667. dp_cdp_debug("callback not registered:");
  668. return QDF_STATUS_E_FAILURE;
  669. }
  670. return soc->ops->ctrl_ops->calculate_delay_stats(soc, vdev_id, nbuf);
  671. }
  672. /**
  673. * cdp_wdi_event_sub() - Subscribe to a specified WDI event.
  674. * @soc: pointer to the soc
  675. * @pdev_id: id of the data physical device object
  676. * @event_cb_sub: the callback and context for the event subscriber
  677. * @event: which event's notifications are being subscribed to
  678. *
  679. * This function adds the provided wdi_event_subscribe object to a list of
  680. * subscribers for the specified WDI event.
  681. * When the event in question happens, each subscriber for the event will
  682. * have their callback function invoked.
  683. * The order in which callback functions from multiple subscribers are
  684. * invoked is unspecified.
  685. *
  686. * Return: int
  687. */
  688. static inline int
  689. cdp_wdi_event_sub(ol_txrx_soc_handle soc, uint8_t pdev_id,
  690. wdi_event_subscribe *event_cb_sub, uint32_t event)
  691. {
  692. if (!soc || !soc->ops) {
  693. dp_cdp_debug("invalid instance");
  694. QDF_BUG(0);
  695. return 0;
  696. }
  697. if (!soc->ops->ctrl_ops ||
  698. !soc->ops->ctrl_ops->txrx_wdi_event_sub)
  699. return 0;
  700. return soc->ops->ctrl_ops->txrx_wdi_event_sub
  701. (soc, pdev_id, event_cb_sub, event);
  702. }
  703. /**
  704. * cdp_wdi_event_unsub() - Unsubscribe from a specified WDI event.
  705. * @soc: pointer to the soc
  706. * @pdev_id: id of the data physical device object
  707. * @event_cb_sub: the callback and context for the event subscriber
  708. * @event: which event's notifications are being subscribed to
  709. *
  710. * This function removes the provided event subscription object from the
  711. * list of subscribers for its event.
  712. * This function shall only be called if there was a successful prior call
  713. * to cdp_wdi_event_sub() on the same wdi_event_subscribe object.
  714. *
  715. * Return: int
  716. */
  717. static inline int
  718. cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
  719. uint8_t pdev_id, wdi_event_subscribe *event_cb_sub,
  720. uint32_t event)
  721. {
  722. if (!soc || !soc->ops) {
  723. dp_cdp_debug("invalid instance");
  724. QDF_BUG(0);
  725. return 0;
  726. }
  727. if (!soc->ops->ctrl_ops ||
  728. !soc->ops->ctrl_ops->txrx_wdi_event_unsub)
  729. return 0;
  730. return soc->ops->ctrl_ops->txrx_wdi_event_unsub
  731. (soc, pdev_id, event_cb_sub, event);
  732. }
  733. /**
  734. * cdp_get_sec_type() - Get security type from the from peer.
  735. * @soc: pointer to the soc
  736. * @vdev_id: id of vdev handle
  737. * @peer_mac: peer mac address
  738. * @sec_idx: mcast or ucast frame type.
  739. *
  740. * This function gets the Security information from the peer handler.
  741. * The security information is got from the rx descriptor and filled in
  742. * to the peer handler.
  743. *
  744. * Return: int
  745. */
  746. static inline int
  747. cdp_get_sec_type(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  748. uint8_t sec_idx)
  749. {
  750. if (!soc || !soc->ops) {
  751. dp_cdp_debug("invalid instance");
  752. QDF_BUG(0);
  753. return A_ERROR;
  754. }
  755. if (!soc->ops->ctrl_ops ||
  756. !soc->ops->ctrl_ops->txrx_get_sec_type)
  757. return A_ERROR;
  758. return soc->ops->ctrl_ops->txrx_get_sec_type
  759. (soc, vdev_id, peer_mac, sec_idx);
  760. }
  761. /**
  762. * cdp_set_mgmt_tx_power() - function to set tx power for mgmt frames
  763. * @soc: pointer to the soc
  764. * @vdev_id : id of vdev handle
  765. * @subtype: subtype
  766. * @tx_power: Tx power
  767. *
  768. * Return: QDF_STATUS
  769. */
  770. static inline QDF_STATUS
  771. cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
  772. uint8_t vdev_id, uint8_t subtype, uint8_t tx_power)
  773. {
  774. if (!soc || !soc->ops) {
  775. dp_cdp_debug("Invalid Instance:");
  776. QDF_BUG(0);
  777. return QDF_STATUS_E_FAILURE;
  778. }
  779. if (!soc->ops->ctrl_ops ||
  780. !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev)
  781. return QDF_STATUS_E_FAILURE;
  782. return soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(soc, vdev_id,
  783. subtype, tx_power);
  784. }
  785. /**
  786. * cdp_get_pldev() - function to get pktlog device handle
  787. * @soc: datapath soc handle
  788. * @pdev_id: physical device id
  789. *
  790. * Return: pktlog device handle or NULL
  791. */
  792. static inline void *
  793. cdp_get_pldev(ol_txrx_soc_handle soc, uint8_t pdev_id)
  794. {
  795. if (!soc || !soc->ops) {
  796. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  797. "%s invalid instance", __func__);
  798. QDF_BUG(0);
  799. return NULL;
  800. }
  801. if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev)
  802. return NULL;
  803. return soc->ops->ctrl_ops->txrx_get_pldev(soc, pdev_id);
  804. }
  805. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  806. /**
  807. * cdp_cfr_filter() - Configure Host RX monitor status ring for CFR
  808. * @soc: SOC TXRX handle
  809. * @pdev_id: ID of the physical device object
  810. * @enable: Enable or disable CFR
  811. * @filter_val: Flag to select filter for monitor mode
  812. * @cfr_enable_monitor_mode: Flag to be enabled when scan radio is brought up
  813. * in special vap mode
  814. */
  815. static inline void
  816. cdp_cfr_filter(ol_txrx_soc_handle soc,
  817. uint8_t pdev_id,
  818. bool enable, struct cdp_monitor_filter *filter_val,
  819. bool cfr_enable_monitor_mode)
  820. {
  821. if (!soc || !soc->ops) {
  822. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  823. "%s invalid instance", __func__);
  824. QDF_BUG(0);
  825. return;
  826. }
  827. if (!soc->ops->mon_ops || !soc->ops->mon_ops->txrx_cfr_filter)
  828. return;
  829. soc->ops->mon_ops->txrx_cfr_filter(soc, pdev_id, enable, filter_val,
  830. cfr_enable_monitor_mode);
  831. }
  832. /**
  833. * cdp_get_cfr_rcc() - get cfr rcc config
  834. * @soc: Datapath soc handle
  835. * @pdev_id: id of objmgr pdev
  836. *
  837. * Return: true/false based on cfr mode setting
  838. */
  839. static inline
  840. bool cdp_get_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id)
  841. {
  842. if (!soc || !soc->ops) {
  843. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  844. "%s invalid instance", __func__);
  845. QDF_BUG(0);
  846. return 0;
  847. }
  848. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_rcc)
  849. return 0;
  850. return soc->ops->cfr_ops->txrx_get_cfr_rcc(soc, pdev_id);
  851. }
  852. /**
  853. * cdp_set_cfr_rcc() - enable/disable cfr rcc config
  854. * @soc: Datapath soc handle
  855. * @pdev_id: id of objmgr pdev
  856. * @enable: Enable/Disable cfr rcc mode
  857. *
  858. * Return: none
  859. */
  860. static inline
  861. void cdp_set_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id, bool enable)
  862. {
  863. if (!soc || !soc->ops) {
  864. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  865. "%s invalid instance", __func__);
  866. QDF_BUG(0);
  867. return;
  868. }
  869. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_set_cfr_rcc)
  870. return;
  871. return soc->ops->cfr_ops->txrx_set_cfr_rcc(soc, pdev_id, enable);
  872. }
  873. /**
  874. * cdp_get_cfr_dbg_stats() - Get debug statistics for CFR
  875. * @soc: SOC TXRX handle
  876. * @pdev_id: ID of the physical device object
  877. * @buf: CFR RCC debug statistics buffer
  878. *
  879. * Return: None
  880. */
  881. static inline void
  882. cdp_get_cfr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  883. struct cdp_cfr_rcc_stats *buf)
  884. {
  885. if (!soc || !soc->ops) {
  886. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  887. "%s invalid instance", __func__);
  888. QDF_BUG(0);
  889. return;
  890. }
  891. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_dbg_stats)
  892. return;
  893. soc->ops->cfr_ops->txrx_get_cfr_dbg_stats(soc, pdev_id, buf);
  894. }
  895. /**
  896. * cdp_cfr_clr_dbg_stats() - Clear debug statistics for CFR
  897. * @soc: SOC TXRX handle
  898. * @pdev_id: ID of the physical device object
  899. */
  900. static inline void
  901. cdp_cfr_clr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
  902. {
  903. if (!soc || !soc->ops) {
  904. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  905. "%s invalid instance", __func__);
  906. QDF_BUG(0);
  907. return;
  908. }
  909. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats)
  910. return;
  911. soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats(soc, pdev_id);
  912. }
  913. #endif
  914. #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH)
  915. /**
  916. * cdp_update_peer_pkt_capture_params() - Sets Rx & Tx Capture params for a peer
  917. * @soc: SOC TXRX handle
  918. * @pdev_id: id of CDP pdev pointer
  919. * @is_rx_pkt_cap_enable: enable/disable rx pkt capture for this peer
  920. * @is_tx_pkt_cap_enable: enable/disable tx pkt capture for this peer
  921. * @peer_mac: MAC address of peer for which pkt_cap is to be enabled/disabled
  922. *
  923. * Return: Success when matching peer is found & flags are set, error otherwise
  924. */
  925. static inline QDF_STATUS
  926. cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc,
  927. uint8_t pdev_id,
  928. bool is_rx_pkt_cap_enable,
  929. uint8_t is_tx_pkt_cap_enable,
  930. uint8_t *peer_mac)
  931. {
  932. if (!soc || !soc->ops) {
  933. dp_err("Invalid SOC instance");
  934. QDF_BUG(0);
  935. return QDF_STATUS_E_FAILURE;
  936. }
  937. if (!soc->ops->ctrl_ops ||
  938. !soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params)
  939. return QDF_STATUS_E_FAILURE;
  940. return soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params
  941. (soc, pdev_id, is_rx_pkt_cap_enable,
  942. is_tx_pkt_cap_enable, peer_mac);
  943. }
  944. #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */
  945. #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
  946. /**
  947. * cdp_update_pdev_rx_protocol_tag() - wrapper function to set the protocol
  948. * tag in CDP layer from cfg layer
  949. * @soc: SOC TXRX handle
  950. * @pdev_id: id of CDP pdev pointer
  951. * @protocol_mask: Bitmap for protocol for which tagging is enabled
  952. * @protocol_type: Protocol type for which the tag should be update
  953. * @tag: Actual tag value for the given prototype
  954. * Return: Returns QDF_STATUS_SUCCESS/FAILURE
  955. */
  956. static inline QDF_STATUS
  957. cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc,
  958. uint8_t pdev_id, uint32_t protocol_mask,
  959. uint16_t protocol_type, uint16_t tag)
  960. {
  961. if (!soc || !soc->ops) {
  962. dp_err("Invalid SOC instance");
  963. QDF_BUG(0);
  964. return QDF_STATUS_E_FAILURE;
  965. }
  966. if (!soc->ops->ctrl_ops ||
  967. !soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag)
  968. return QDF_STATUS_E_FAILURE;
  969. return soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag
  970. (soc, pdev_id, protocol_mask, protocol_type, tag);
  971. }
  972. #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
  973. /**
  974. * cdp_dump_pdev_rx_protocol_tag_stats() - wrapper function to dump the protocol
  975. * tag statistics for given or all protocols
  976. * @soc: SOC TXRX handle
  977. * @pdev_id: id of CDP pdev pointer
  978. * @protocol_type: Protocol type for which the tag should be update
  979. *
  980. * Return: Returns QDF_STATUS_SUCCESS/FAILURE
  981. */
  982. static inline QDF_STATUS
  983. cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc,
  984. uint8_t pdev_id,
  985. uint16_t protocol_type)
  986. {
  987. if (!soc || !soc->ops) {
  988. dp_err("Invalid SOC instance");
  989. QDF_BUG(0);
  990. return QDF_STATUS_E_FAILURE;
  991. }
  992. if (!soc->ops->ctrl_ops ||
  993. !soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats)
  994. return QDF_STATUS_E_FAILURE;
  995. soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(soc, pdev_id,
  996. protocol_type);
  997. return QDF_STATUS_SUCCESS;
  998. }
  999. #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
  1000. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
  1001. #ifdef ATH_SUPPORT_NAC_RSSI
  1002. /**
  1003. * cdp_vdev_config_for_nac_rssi() - To invoke dp callback for nac rssi config
  1004. * @soc: soc pointer
  1005. * @vdev_id: id of vdev
  1006. * @nac_cmd: specifies nac_rss config action add, del, list
  1007. * @bssid: Neighbour bssid
  1008. * @client_macaddr: Non-Associated client MAC
  1009. * @chan_num: channel number to scan
  1010. *
  1011. * Return: QDF_STATUS
  1012. */
  1013. static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
  1014. uint8_t vdev_id, enum cdp_nac_param_cmd nac_cmd,
  1015. char *bssid, char *client_macaddr, uint8_t chan_num)
  1016. {
  1017. if (!soc || !soc->ops) {
  1018. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1019. "%s invalid instance", __func__);
  1020. QDF_BUG(0);
  1021. return QDF_STATUS_E_FAILURE;
  1022. }
  1023. if (!soc->ops->mon_ops ||
  1024. !soc->ops->mon_ops->txrx_vdev_config_for_nac_rssi)
  1025. return QDF_STATUS_E_FAILURE;
  1026. return soc->ops->mon_ops->txrx_vdev_config_for_nac_rssi(soc, vdev_id,
  1027. nac_cmd, bssid, client_macaddr, chan_num);
  1028. }
  1029. /**
  1030. * cdp_vdev_get_neighbour_rssi() - invoke dp callback to get rssi value of nac
  1031. * @soc: soc pointer
  1032. * @vdev_id: id of vdev
  1033. * @macaddr: Non-Associated client MAC
  1034. * @rssi: rssi
  1035. *
  1036. * Return: QDF_STATUS
  1037. */
  1038. static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
  1039. uint8_t vdev_id,
  1040. char *macaddr,
  1041. uint8_t *rssi)
  1042. {
  1043. if (!soc || !soc->ops) {
  1044. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1045. "%s invalid instance", __func__);
  1046. QDF_BUG(0);
  1047. return QDF_STATUS_E_FAILURE;
  1048. }
  1049. if (!soc->ops->mon_ops ||
  1050. !soc->ops->mon_ops->txrx_vdev_get_neighbour_rssi)
  1051. return QDF_STATUS_E_FAILURE;
  1052. return soc->ops->mon_ops->txrx_vdev_get_neighbour_rssi(soc, vdev_id,
  1053. macaddr,
  1054. rssi);
  1055. }
  1056. #endif
  1057. #ifdef WLAN_SUPPORT_RX_FLOW_TAG
  1058. /**
  1059. * cdp_set_rx_flow_tag() - wrapper function to set the flow
  1060. * tag in CDP layer from cfg layer
  1061. * @soc: SOC TXRX handle
  1062. * @pdev_id: id of CDP pdev pointer
  1063. * @flow_info: Flow 5-tuple, along with tag, if any, that needs to added/deleted
  1064. *
  1065. * Return: Success when add/del operation is successful, error otherwise
  1066. */
  1067. static inline QDF_STATUS
  1068. cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1069. struct cdp_rx_flow_info *flow_info)
  1070. {
  1071. if (!soc || !soc->ops) {
  1072. dp_err("Invalid SOC instance");
  1073. QDF_BUG(0);
  1074. return QDF_STATUS_E_FAILURE;
  1075. }
  1076. if (!soc->ops->ctrl_ops ||
  1077. !soc->ops->ctrl_ops->txrx_set_rx_flow_tag)
  1078. return QDF_STATUS_E_FAILURE;
  1079. return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(soc, pdev_id,
  1080. flow_info);
  1081. }
  1082. /**
  1083. * cdp_dump_rx_flow_tag_stats() - wrapper function to dump the flow
  1084. * tag statistics for given flow
  1085. * @soc: SOC TXRX handle
  1086. * @pdev_id: id of CDP pdev
  1087. * @flow_info: Flow tuple for which we want to print the statistics
  1088. *
  1089. * Return: Success when flow is found and stats are printed, error otherwise
  1090. */
  1091. static inline QDF_STATUS
  1092. cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1093. struct cdp_rx_flow_info *flow_info)
  1094. {
  1095. if (!soc || !soc->ops) {
  1096. dp_err("Invalid SOC instance");
  1097. QDF_BUG(0);
  1098. return QDF_STATUS_E_FAILURE;
  1099. }
  1100. if (!soc->ops->ctrl_ops ||
  1101. !soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats)
  1102. return QDF_STATUS_E_FAILURE;
  1103. return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(soc,
  1104. pdev_id,
  1105. flow_info);
  1106. }
  1107. #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
  1108. /**
  1109. * cdp_txrx_peer_flush_frags() - flush frags for peer
  1110. * @soc: pointer to the soc
  1111. * @vdev_id: vdev id
  1112. * @peer_mac: peer MAC address
  1113. *
  1114. * Get peer-protocol-count drop-mask
  1115. *
  1116. * Return: peer-protocol-count drop-mask
  1117. */
  1118. static inline
  1119. void cdp_txrx_peer_flush_frags(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1120. uint8_t *peer_mac)
  1121. {
  1122. if (!soc || !soc->ops) {
  1123. dp_cdp_err("Invalid Instance:");
  1124. QDF_BUG(0);
  1125. return;
  1126. }
  1127. if (!soc->ops->ctrl_ops ||
  1128. !soc->ops->ctrl_ops->txrx_peer_flush_frags)
  1129. return;
  1130. return soc->ops->ctrl_ops->txrx_peer_flush_frags(soc, vdev_id,
  1131. peer_mac);
  1132. }
  1133. #if defined(WLAN_FEATURE_TSF_AUTO_REPORT) || defined(WLAN_CONFIG_TX_DELAY)
  1134. /**
  1135. * cdp_set_delta_tsf() - wrapper function to set delta_tsf
  1136. * @soc: SOC TXRX handle
  1137. * @vdev_id: vdev id
  1138. * @delta_tsf: difference between TSF clock and qtimer
  1139. *
  1140. * Return: None
  1141. */
  1142. static inline void cdp_set_delta_tsf(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1143. uint32_t delta_tsf)
  1144. {
  1145. if (!soc || !soc->ops) {
  1146. dp_cdp_err("Invalid instance");
  1147. QDF_BUG(0);
  1148. return;
  1149. }
  1150. if (!soc->ops->ctrl_ops ||
  1151. !soc->ops->ctrl_ops->txrx_set_delta_tsf)
  1152. return;
  1153. soc->ops->ctrl_ops->txrx_set_delta_tsf(soc, vdev_id, delta_tsf);
  1154. }
  1155. #endif
  1156. #ifdef WLAN_FEATURE_TSF_UPLINK_DELAY
  1157. /**
  1158. * cdp_set_tsf_ul_delay_report() - Enable or disable reporting uplink delay
  1159. * @soc: SOC TXRX handle
  1160. * @vdev_id: vdev id
  1161. * @enable: true to enable and false to disable
  1162. *
  1163. * Return: QDF_STATUS
  1164. */
  1165. static inline QDF_STATUS cdp_set_tsf_ul_delay_report(ol_txrx_soc_handle soc,
  1166. uint8_t vdev_id,
  1167. bool enable)
  1168. {
  1169. if (!soc || !soc->ops) {
  1170. dp_cdp_err("Invalid SOC instance");
  1171. QDF_BUG(0);
  1172. return QDF_STATUS_E_FAILURE;
  1173. }
  1174. if (!soc->ops->ctrl_ops ||
  1175. !soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report)
  1176. return QDF_STATUS_E_FAILURE;
  1177. return soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report(soc, vdev_id,
  1178. enable);
  1179. }
  1180. /**
  1181. * cdp_get_uplink_delay() - Get uplink delay value
  1182. * @soc: SOC TXRX handle
  1183. * @vdev_id: vdev id
  1184. * @val: pointer to save uplink delay value
  1185. *
  1186. * Return: QDF_STATUS
  1187. */
  1188. static inline QDF_STATUS cdp_get_uplink_delay(ol_txrx_soc_handle soc,
  1189. uint32_t vdev_id, uint32_t *val)
  1190. {
  1191. if (!soc || !soc->ops) {
  1192. dp_cdp_err("Invalid SOC instance");
  1193. QDF_BUG(0);
  1194. return QDF_STATUS_E_FAILURE;
  1195. }
  1196. if (!val) {
  1197. dp_cdp_err("Invalid params val");
  1198. return QDF_STATUS_E_FAILURE;
  1199. }
  1200. if (!soc->ops->ctrl_ops ||
  1201. !soc->ops->ctrl_ops->txrx_get_uplink_delay)
  1202. return QDF_STATUS_E_FAILURE;
  1203. return soc->ops->ctrl_ops->txrx_get_uplink_delay(soc, vdev_id, val);
  1204. }
  1205. #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */
  1206. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  1207. /**
  1208. * cdp_txrx_set_pdev_phyrx_error_mask() - set phyrx error mask
  1209. * @soc: opaque soc handle
  1210. * @pdev_id: id of data path pdev handle
  1211. * @mask: mask to configure 0 to 31 phy error
  1212. * @mask_cont: mask to configure 32 to 63 phy error
  1213. *
  1214. * Return: status: 0 - Success, non-zero: Failure
  1215. */
  1216. static inline
  1217. QDF_STATUS cdp_txrx_set_pdev_phyrx_error_mask(ol_txrx_soc_handle soc,
  1218. uint8_t pdev_id, uint32_t mask,
  1219. uint32_t mask_cont)
  1220. {
  1221. if (!soc || !soc->ops) {
  1222. dp_cdp_debug("Invalid Instance:");
  1223. QDF_BUG(0);
  1224. return QDF_STATUS_E_FAILURE;
  1225. }
  1226. if (!soc->ops->ctrl_ops ||
  1227. !soc->ops->ctrl_ops->txrx_set_pdev_phyrx_error_mask)
  1228. return QDF_STATUS_E_FAILURE;
  1229. return soc->ops->ctrl_ops->txrx_set_pdev_phyrx_error_mask
  1230. (soc, pdev_id, mask, mask_cont);
  1231. }
  1232. static inline
  1233. QDF_STATUS cdp_txrx_get_pdev_phyrx_error_mask(ol_txrx_soc_handle soc,
  1234. uint8_t pdev_id, uint32_t *mask,
  1235. uint32_t *mask_cont)
  1236. {
  1237. if (!soc || !soc->ops) {
  1238. dp_cdp_debug("Invalid Instance:");
  1239. QDF_BUG(0);
  1240. return QDF_STATUS_E_FAILURE;
  1241. }
  1242. if (!soc->ops->ctrl_ops ||
  1243. !soc->ops->ctrl_ops->txrx_get_pdev_phyrx_error_mask)
  1244. return QDF_STATUS_E_FAILURE;
  1245. return soc->ops->ctrl_ops->txrx_get_pdev_phyrx_error_mask
  1246. (soc, pdev_id, mask, mask_cont);
  1247. }
  1248. #endif
  1249. #ifdef DP_UMAC_HW_RESET_SUPPORT
  1250. /**
  1251. * cdp_get_umac_reset_in_progress_state() - API to get the umac reset in
  1252. * progress state
  1253. * @soc: opaque soc handle
  1254. *
  1255. * Return: Umac reset in progress state
  1256. */
  1257. static inline enum cdp_umac_reset_state
  1258. cdp_get_umac_reset_in_progress_state(ol_txrx_soc_handle soc)
  1259. {
  1260. if (!soc || !soc->ops) {
  1261. dp_cdp_debug("Invalid soc or soc->ops:");
  1262. return CDP_UMAC_RESET_INVALID_STATE;
  1263. }
  1264. if (!soc->ops->ctrl_ops ||
  1265. !soc->ops->ctrl_ops->get_umac_reset_in_progress_state)
  1266. return CDP_UMAC_RESET_INVALID_STATE;
  1267. return soc->ops->ctrl_ops->get_umac_reset_in_progress_state(soc);
  1268. }
  1269. /**
  1270. * cdp_umac_reset_is_inprogress() - API to check if umac reset is in progress
  1271. * @soc: opaque soc handle
  1272. *
  1273. * Return: true if umac reset is in progress, else false.
  1274. */
  1275. static inline bool
  1276. cdp_umac_reset_is_inprogress(ol_txrx_soc_handle soc)
  1277. {
  1278. enum cdp_umac_reset_state state;
  1279. state = cdp_get_umac_reset_in_progress_state(soc);
  1280. if (state == CDP_UMAC_RESET_IN_PROGRESS ||
  1281. state == CDP_UMAC_RESET_IN_PROGRESS_DURING_BUFFER_WINDOW)
  1282. return true;
  1283. else
  1284. return false;
  1285. }
  1286. #else
  1287. static inline bool
  1288. cdp_umac_reset_is_inprogress(ol_txrx_soc_handle soc)
  1289. {
  1290. return false;
  1291. }
  1292. #endif
  1293. #ifdef WLAN_SUPPORT_RX_FISA
  1294. static inline
  1295. QDF_STATUS cdp_txrx_fisa_config(struct cdp_soc_t *soc, uint8_t pdev_id,
  1296. enum cdp_fisa_config_id config_id,
  1297. union cdp_fisa_config *cfg)
  1298. {
  1299. if (!soc || !soc->ops) {
  1300. dp_cdp_debug("Invalid Instance:");
  1301. QDF_BUG(0);
  1302. return QDF_STATUS_E_FAILURE;
  1303. }
  1304. if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_fisa_config)
  1305. return QDF_STATUS_E_FAILURE;
  1306. return soc->ops->ctrl_ops->txrx_fisa_config(soc, pdev_id, config_id,
  1307. cfg);
  1308. }
  1309. #endif
  1310. #endif /* _CDP_TXRX_CTRL_H_ */