cdp_txrx_ctrl.h 32 KB

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