cdp_txrx_ctrl.h 36 KB

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