cdp_txrx_ctrl.h 36 KB

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