cdp_txrx_ctrl.h 35 KB

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