cdp_txrx_ctrl.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. /*
  2. * Copyright (c) 2016-2018 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_ops.h"
  28. static inline int cdp_is_target_ar900b
  29. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  30. {
  31. if (!soc || !soc->ops) {
  32. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  33. "%s: Invalid Instance:", __func__);
  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(vdev);
  41. }
  42. /* WIN */
  43. static inline int
  44. cdp_mempools_attach(ol_txrx_soc_handle soc, void *ctrl_pdev)
  45. {
  46. if (!soc || !soc->ops) {
  47. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  48. "%s: Invalid Instance:", __func__);
  49. QDF_BUG(0);
  50. return 0;
  51. }
  52. if (!soc->ops->ctrl_ops ||
  53. !soc->ops->ctrl_ops->txrx_mempools_attach)
  54. return 0;
  55. return soc->ops->ctrl_ops->txrx_mempools_attach(ctrl_pdev);
  56. }
  57. /**
  58. * @brief set filter neighbour peers
  59. * @details
  60. * This defines interface function to set neighbour peer filtering.
  61. *
  62. * @param soc - the pointer to soc object
  63. * @param pdev - the pointer physical device object
  64. * @param val - the enable/disable value
  65. * @return - int
  66. */
  67. static inline int
  68. cdp_set_filter_neighbour_peers(ol_txrx_soc_handle soc,
  69. struct cdp_pdev *pdev, u_int32_t val)
  70. {
  71. if (!soc || !soc->ops) {
  72. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  73. "%s: Invalid Instance:", __func__);
  74. QDF_BUG(0);
  75. return 0;
  76. }
  77. if (!soc->ops->ctrl_ops ||
  78. !soc->ops->ctrl_ops->txrx_set_filter_neighbour_peers)
  79. return 0;
  80. return soc->ops->ctrl_ops->txrx_set_filter_neighbour_peers
  81. (pdev, val);
  82. }
  83. /**
  84. * @brief update the neighbour peer addresses
  85. * @details
  86. * This defines interface function to update neighbour peers addresses
  87. * which needs to be filtered
  88. *
  89. * @param soc - the pointer to soc object
  90. * @param vdev - the pointer to vdev
  91. * @param cmd - add/del entry into peer table
  92. * @param macaddr - the address of neighbour peer
  93. * @return - int
  94. */
  95. static inline int
  96. cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc,
  97. struct cdp_vdev *vdev, uint32_t cmd, uint8_t *macaddr)
  98. {
  99. if (!soc || !soc->ops) {
  100. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  101. "%s: Invalid Instance:", __func__);
  102. QDF_BUG(0);
  103. return 0;
  104. }
  105. if (!soc->ops->ctrl_ops ||
  106. !soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers)
  107. return 0;
  108. return soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers
  109. (vdev, cmd, macaddr);
  110. }
  111. /**
  112. * @brief set the safemode of the device
  113. * @details
  114. * This flag is used to bypass the encrypt and decrypt processes when send and
  115. * receive packets. It works like open AUTH mode, HW will treate all packets
  116. * as non-encrypt frames because no key installed. For rx fragmented frames,
  117. * it bypasses all the rx defragmentaion.
  118. *
  119. * @param vdev - the data virtual device object
  120. * @param val - the safemode state
  121. * @return - void
  122. */
  123. static inline void
  124. cdp_set_safemode(ol_txrx_soc_handle soc,
  125. struct cdp_vdev *vdev, u_int32_t val)
  126. {
  127. if (!soc || !soc->ops) {
  128. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  129. "%s: Invalid Instance:", __func__);
  130. QDF_BUG(0);
  131. return;
  132. }
  133. if (!soc->ops->ctrl_ops ||
  134. !soc->ops->ctrl_ops->txrx_set_safemode)
  135. return;
  136. soc->ops->ctrl_ops->txrx_set_safemode(vdev, val);
  137. }
  138. /**
  139. * @brief configure the drop unencrypted frame flag
  140. * @details
  141. * Rx related. When set this flag, all the unencrypted frames
  142. * received over a secure connection will be discarded
  143. *
  144. * @param vdev - the data virtual device object
  145. * @param val - flag
  146. * @return - void
  147. */
  148. static inline void
  149. cdp_set_drop_unenc(ol_txrx_soc_handle soc,
  150. struct cdp_vdev *vdev, u_int32_t val)
  151. {
  152. if (!soc || !soc->ops) {
  153. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  154. "%s: Invalid Instance:", __func__);
  155. QDF_BUG(0);
  156. return;
  157. }
  158. if (!soc->ops->ctrl_ops ||
  159. !soc->ops->ctrl_ops->txrx_set_drop_unenc)
  160. return;
  161. soc->ops->ctrl_ops->txrx_set_drop_unenc(vdev, val);
  162. }
  163. /**
  164. * @brief set the Tx encapsulation type of the VDEV
  165. * @details
  166. * This will be used to populate the HTT desc packet type field during Tx
  167. *
  168. * @param vdev - the data virtual device object
  169. * @param val - the Tx encap type (htt_cmn_pkt_type)
  170. * @return - void
  171. */
  172. static inline void
  173. cdp_set_tx_encap_type(ol_txrx_soc_handle soc,
  174. struct cdp_vdev *vdev, enum htt_cmn_pkt_type val)
  175. {
  176. if (!soc || !soc->ops) {
  177. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  178. "%s: Invalid Instance:", __func__);
  179. QDF_BUG(0);
  180. return;
  181. }
  182. if (!soc->ops->ctrl_ops ||
  183. !soc->ops->ctrl_ops->txrx_set_tx_encap_type)
  184. return;
  185. soc->ops->ctrl_ops->txrx_set_tx_encap_type(vdev, val);
  186. }
  187. /**
  188. * @brief set the Rx decapsulation type of the VDEV
  189. * @details
  190. * This will be used to configure into firmware and hardware which format to
  191. * decap all Rx packets into, for all peers under the VDEV.
  192. *
  193. * @param vdev - the data virtual device object
  194. * @param val - the Rx decap mode (htt_cmn_pkt_type)
  195. * @return - void
  196. */
  197. static inline void
  198. cdp_set_vdev_rx_decap_type(ol_txrx_soc_handle soc,
  199. struct cdp_vdev *vdev, enum htt_cmn_pkt_type val)
  200. {
  201. if (!soc || !soc->ops) {
  202. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  203. "%s: Invalid Instance:", __func__);
  204. QDF_BUG(0);
  205. return;
  206. }
  207. if (!soc->ops->ctrl_ops ||
  208. !soc->ops->ctrl_ops->txrx_set_vdev_rx_decap_type)
  209. return;
  210. soc->ops->ctrl_ops->txrx_set_vdev_rx_decap_type
  211. (vdev, val);
  212. }
  213. /**
  214. * @brief get the Rx decapsulation type of the VDEV
  215. *
  216. * @param vdev - the data virtual device object
  217. * @return - the Rx decap type (htt_cmn_pkt_type)
  218. */
  219. static inline enum htt_cmn_pkt_type
  220. cdp_get_vdev_rx_decap_type(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  221. {
  222. if (!soc || !soc->ops) {
  223. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  224. "%s: Invalid Instance:", __func__);
  225. QDF_BUG(0);
  226. return 0;
  227. }
  228. if (!soc->ops->ctrl_ops ||
  229. !soc->ops->ctrl_ops->txrx_get_vdev_rx_decap_type)
  230. return 0;
  231. return soc->ops->ctrl_ops->txrx_get_vdev_rx_decap_type(vdev);
  232. }
  233. /**
  234. * @brief set the Reo Destination ring for the pdev
  235. * @details
  236. * This will be used to configure the Reo Destination ring for this pdev.
  237. *
  238. * @param soc - pointer to the soc
  239. * @param pdev - the data physical device object
  240. * @param val - the Reo destination ring index (1 to 4)
  241. * @return - void
  242. */
  243. static inline void
  244. cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc,
  245. struct cdp_pdev *pdev, enum cdp_host_reo_dest_ring val)
  246. {
  247. if (!soc || !soc->ops) {
  248. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  249. "%s: Invalid Instance:", __func__);
  250. QDF_BUG(0);
  251. return;
  252. }
  253. if (!soc->ops->ctrl_ops ||
  254. !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest)
  255. return;
  256. soc->ops->ctrl_ops->txrx_set_pdev_reo_dest
  257. (pdev, val);
  258. }
  259. /**
  260. * @brief get the Reo Destination ring for the pdev
  261. *
  262. * @param soc - pointer to the soc
  263. * @param pdev - the data physical device object
  264. * @return - the Reo destination ring index (1 to 4), 0 if not supported.
  265. */
  266. static inline enum cdp_host_reo_dest_ring
  267. cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  268. {
  269. if (!soc || !soc->ops) {
  270. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  271. "%s: Invalid Instance:", __func__);
  272. QDF_BUG(0);
  273. return cdp_host_reo_dest_ring_unknown;
  274. }
  275. if (!soc->ops->ctrl_ops ||
  276. !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest)
  277. return cdp_host_reo_dest_ring_unknown;
  278. return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(pdev);
  279. }
  280. /* Is this similar to ol_txrx_peer_state_update() in MCL */
  281. /**
  282. * @brief Update the authorize peer object at association time
  283. * @details
  284. * For the host-based implementation of rate-control, it
  285. * updates the peer/node-related parameters within rate-control
  286. * context of the peer at association.
  287. *
  288. * @param peer - pointer to the node's object
  289. * @authorize - either to authorize or unauthorize peer
  290. *
  291. * @return none
  292. */
  293. static inline void
  294. cdp_peer_authorize(ol_txrx_soc_handle soc,
  295. struct cdp_peer *peer, u_int32_t authorize)
  296. {
  297. if (!soc || !soc->ops) {
  298. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  299. "%s: Invalid Instance:", __func__);
  300. QDF_BUG(0);
  301. return;
  302. }
  303. if (!soc->ops->ctrl_ops ||
  304. !soc->ops->ctrl_ops->txrx_peer_authorize)
  305. return;
  306. soc->ops->ctrl_ops->txrx_peer_authorize
  307. (peer, authorize);
  308. }
  309. static inline bool
  310. cdp_set_inact_params(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  311. u_int16_t inact_check_interval,
  312. u_int16_t inact_normal,
  313. u_int16_t inact_overload)
  314. {
  315. if (!soc || !pdev || !soc->ops) {
  316. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  317. "%s: Invalid Instance:", __func__);
  318. QDF_BUG(0);
  319. return false;
  320. }
  321. if (!soc->ops->ctrl_ops ||
  322. !soc->ops->ctrl_ops->txrx_set_inact_params)
  323. return false;
  324. return soc->ops->ctrl_ops->txrx_set_inact_params
  325. (pdev, inact_check_interval, inact_normal,
  326. inact_overload);
  327. }
  328. static inline bool
  329. cdp_start_inact_timer(ol_txrx_soc_handle soc,
  330. struct cdp_pdev *pdev,
  331. bool enable)
  332. {
  333. if (!soc || !pdev || !soc->ops) {
  334. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  335. "%s: Invalid Instance:", __func__);
  336. QDF_BUG(0);
  337. return false;
  338. }
  339. if (!soc->ops->ctrl_ops ||
  340. !soc->ops->ctrl_ops->txrx_start_inact_timer)
  341. return false;
  342. return soc->ops->ctrl_ops->txrx_start_inact_timer
  343. (pdev, enable);
  344. }
  345. /**
  346. * @brief Set the overload status of the radio
  347. * @details
  348. * Set the overload status of the radio, updating the inactivity
  349. * threshold and inactivity count for each node.
  350. *
  351. * @param pdev - the data physical device object
  352. * @param overload - whether the radio is overloaded or not
  353. */
  354. static inline void
  355. cdp_set_overload(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  356. bool overload)
  357. {
  358. if (!soc || !pdev || !soc->ops) {
  359. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  360. "%s: Invalid Instance:", __func__);
  361. QDF_BUG(0);
  362. return;
  363. }
  364. if (!soc->ops->ctrl_ops ||
  365. !soc->ops->ctrl_ops->txrx_set_overload)
  366. return;
  367. soc->ops->ctrl_ops->txrx_set_overload(pdev, overload);
  368. }
  369. /**
  370. * @brief Check the inactivity status of the peer/node
  371. *
  372. * @param peer - pointer to the node's object
  373. * @return true if the node is inactive; otherwise return false
  374. */
  375. static inline bool
  376. cdp_peer_is_inact(ol_txrx_soc_handle soc, void *peer)
  377. {
  378. if (!soc || !peer || !soc->ops) {
  379. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  380. "%s: Invalid Instance:", __func__);
  381. QDF_BUG(0);
  382. return false;
  383. }
  384. if (!soc->ops->ctrl_ops ||
  385. !soc->ops->ctrl_ops->txrx_peer_is_inact)
  386. return false;
  387. return soc->ops->ctrl_ops->txrx_peer_is_inact(peer);
  388. }
  389. /**
  390. * @brief Mark inactivity status of the peer/node
  391. * @details
  392. * If it becomes active, reset inactivity count to reload value;
  393. * if the inactivity status changed, notify umac band steering.
  394. *
  395. * @param peer - pointer to the node's object
  396. * @param inactive - whether the node is inactive or not
  397. */
  398. static inline void
  399. cdp_mark_peer_inact(ol_txrx_soc_handle soc,
  400. void *peer,
  401. bool inactive)
  402. {
  403. if (!soc || !soc->ops) {
  404. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  405. "%s: Invalid Instance:", __func__);
  406. QDF_BUG(0);
  407. return;
  408. }
  409. if (!soc->ops->ctrl_ops ||
  410. !soc->ops->ctrl_ops->txrx_mark_peer_inact)
  411. return;
  412. soc->ops->ctrl_ops->txrx_mark_peer_inact
  413. (peer, inactive);
  414. }
  415. /* Should be ol_txrx_ctrl_api.h */
  416. static inline void cdp_set_mesh_mode
  417. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, u_int32_t val)
  418. {
  419. if (!soc || !soc->ops) {
  420. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  421. "%s: Invalid Instance:", __func__);
  422. QDF_BUG(0);
  423. return;
  424. }
  425. if (!soc->ops->ctrl_ops ||
  426. !soc->ops->ctrl_ops->txrx_set_mesh_mode)
  427. return;
  428. soc->ops->ctrl_ops->txrx_set_mesh_mode(vdev, val);
  429. }
  430. /**
  431. * @brief set mesh rx filter
  432. * @details based on the bits enabled in the filter packets has to be dropped.
  433. *
  434. * @param soc - pointer to the soc
  435. * @param vdev - the data virtual device object
  436. * @param val - value to be set
  437. * @return - void
  438. */
  439. static inline
  440. void cdp_set_mesh_rx_filter(ol_txrx_soc_handle soc,
  441. struct cdp_vdev *vdev, uint32_t val)
  442. {
  443. if (!soc || !soc->ops) {
  444. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  445. "%s: Invalid Instance:", __func__);
  446. QDF_BUG(0);
  447. return;
  448. }
  449. if (!soc->ops->ctrl_ops ||
  450. !soc->ops->ctrl_ops->txrx_set_mesh_rx_filter)
  451. return;
  452. soc->ops->ctrl_ops->txrx_set_mesh_rx_filter(vdev, val);
  453. }
  454. static inline void cdp_tx_flush_buffers
  455. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  456. {
  457. if (!soc || !soc->ops) {
  458. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  459. "%s: Invalid Instance:", __func__);
  460. QDF_BUG(0);
  461. return;
  462. }
  463. if (!soc->ops->ctrl_ops ||
  464. !soc->ops->ctrl_ops->tx_flush_buffers)
  465. return;
  466. soc->ops->ctrl_ops->tx_flush_buffers(vdev);
  467. }
  468. static inline void cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc,
  469. struct cdp_vdev *vdev, enum cdp_vdev_param_type type,
  470. uint32_t val)
  471. {
  472. if (!soc || !soc->ops) {
  473. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  474. "%s: Invalid Instance:", __func__);
  475. QDF_BUG(0);
  476. return;
  477. }
  478. if (!soc->ops->ctrl_ops ||
  479. !soc->ops->ctrl_ops->txrx_set_vdev_param)
  480. return;
  481. soc->ops->ctrl_ops->txrx_set_vdev_param(vdev, type, val);
  482. }
  483. static inline void
  484. cdp_peer_set_nawds(ol_txrx_soc_handle soc,
  485. struct cdp_peer *peer, uint8_t value)
  486. {
  487. if (!soc || !soc->ops) {
  488. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  489. "%s: Invalid Instance:", __func__);
  490. QDF_BUG(0);
  491. return;
  492. }
  493. if (!soc->ops->ctrl_ops ||
  494. !soc->ops->ctrl_ops->txrx_peer_set_nawds)
  495. return;
  496. soc->ops->ctrl_ops->txrx_peer_set_nawds
  497. (peer, value);
  498. }
  499. static inline void cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
  500. struct cdp_pdev *pdev, enum cdp_pdev_param_type type,
  501. uint8_t val)
  502. {
  503. if (!soc || !soc->ops) {
  504. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  505. "%s: Invalid Instance:", __func__);
  506. QDF_BUG(0);
  507. return;
  508. }
  509. if (!soc->ops->ctrl_ops ||
  510. !soc->ops->ctrl_ops->txrx_set_pdev_param)
  511. return;
  512. soc->ops->ctrl_ops->txrx_set_pdev_param
  513. (pdev, type, val);
  514. }
  515. /**
  516. * @brief Subscribe to a specified WDI event.
  517. * @details
  518. * This function adds the provided wdi_event_subscribe object to a list of
  519. * subscribers for the specified WDI event.
  520. * When the event in question happens, each subscriber for the event will
  521. * have their callback function invoked.
  522. * The order in which callback functions from multiple subscribers are
  523. * invoked is unspecified.
  524. *
  525. * @param soc - pointer to the soc
  526. * @param pdev - the data physical device object
  527. * @param event_cb_sub - the callback and context for the event subscriber
  528. * @param event - which event's notifications are being subscribed to
  529. * @return - int
  530. */
  531. static inline int
  532. cdp_wdi_event_sub(ol_txrx_soc_handle soc,
  533. struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
  534. {
  535. if (!soc || !soc->ops) {
  536. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  537. "%s invalid instance", __func__);
  538. QDF_BUG(0);
  539. return 0;
  540. }
  541. if (!soc->ops->ctrl_ops ||
  542. !soc->ops->ctrl_ops->txrx_wdi_event_sub)
  543. return 0;
  544. return soc->ops->ctrl_ops->txrx_wdi_event_sub
  545. (pdev, event_cb_sub, event);
  546. }
  547. /**
  548. * @brief Unsubscribe from a specified WDI event.
  549. * @details
  550. * This function removes the provided event subscription object from the
  551. * list of subscribers for its event.
  552. * This function shall only be called if there was a successful prior call
  553. * to event_sub() on the same wdi_event_subscribe object.
  554. *
  555. * @param soc - pointer to the soc
  556. * @param pdev - the data physical device object
  557. * @param event_cb_sub - the callback and context for the event subscriber
  558. * @param event - which event's notifications are being subscribed to
  559. * @return - int
  560. */
  561. static inline int
  562. cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
  563. struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
  564. {
  565. if (!soc || !soc->ops) {
  566. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  567. "%s invalid instance", __func__);
  568. QDF_BUG(0);
  569. return 0;
  570. }
  571. if (!soc->ops->ctrl_ops ||
  572. !soc->ops->ctrl_ops->txrx_wdi_event_unsub)
  573. return 0;
  574. return soc->ops->ctrl_ops->txrx_wdi_event_unsub
  575. (pdev, event_cb_sub, event);
  576. }
  577. /**
  578. * @brief Get security type from the from peer.
  579. * @details
  580. * This function gets the Security information from the peer handler.
  581. * The security information is got from the rx descriptor and filled in
  582. * to the peer handler.
  583. *
  584. * @param soc - pointer to the soc
  585. * @param peer - peer handler
  586. * @param sec_idx - mcast or ucast frame type.
  587. * @return - int
  588. */
  589. static inline int
  590. cdp_get_sec_type(ol_txrx_soc_handle soc, struct cdp_peer *peer, uint8_t sec_idx)
  591. {
  592. if (!soc || !soc->ops) {
  593. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  594. "%s invalid instance", __func__);
  595. QDF_BUG(0);
  596. return A_ERROR;
  597. }
  598. if (!soc->ops->ctrl_ops ||
  599. !soc->ops->ctrl_ops->txrx_get_sec_type)
  600. return A_ERROR;
  601. return soc->ops->ctrl_ops->txrx_get_sec_type
  602. (peer, sec_idx);
  603. }
  604. /**
  605. * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames
  606. * @vdev_handle: vdev handle
  607. * @subtype_index: subtype
  608. * @tx_power: Tx power
  609. * Return: None
  610. */
  611. static inline int cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
  612. struct cdp_vdev *vdev, uint8_t subtype, uint8_t tx_power)
  613. {
  614. if (!soc || !soc->ops) {
  615. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  616. "%s: Invalid Instance:", __func__);
  617. QDF_BUG(0);
  618. return 0;
  619. }
  620. if (!soc->ops->ctrl_ops ||
  621. !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev)
  622. return 0;
  623. soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(vdev,
  624. subtype, tx_power);
  625. return 0;
  626. }
  627. static inline void *
  628. cdp_get_pldev(ol_txrx_soc_handle soc,
  629. struct cdp_pdev *pdev)
  630. {
  631. if (!soc || !soc->ops) {
  632. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  633. "%s invalid instance", __func__);
  634. QDF_BUG(0);
  635. return NULL;
  636. }
  637. if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev)
  638. return NULL;
  639. return soc->ops->ctrl_ops->txrx_get_pldev(pdev);
  640. }
  641. #ifdef ATH_SUPPORT_NAC_RSSI
  642. /**
  643. * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config
  644. * @soc: soc pointer
  645. * @vdev: vdev pointer
  646. * @nac_cmd: specfies nac_rss config action add, del, list
  647. * @bssid: Neighbour bssid
  648. * @client_macaddr: Non-Associated client MAC
  649. * @chan_num: channel number to scan
  650. *
  651. * Return: QDF_STATUS
  652. */
  653. static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
  654. struct cdp_vdev *vdev, enum cdp_nac_param_cmd nac_cmd,
  655. char *bssid, char *client_macaddr, uint8_t chan_num)
  656. {
  657. if (!soc || !soc->ops) {
  658. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  659. "%s invalid instance", __func__);
  660. QDF_BUG(0);
  661. return QDF_STATUS_E_FAILURE;
  662. }
  663. if (!soc->ops->ctrl_ops ||
  664. !soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi)
  665. return QDF_STATUS_E_FAILURE;
  666. return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(vdev,
  667. nac_cmd, bssid, client_macaddr, chan_num);
  668. }
  669. /*
  670. * cdp_vdev_get_neighbour_rssi(): To invoke dp callback to get rssi value of nac
  671. * @soc: soc pointer
  672. * @vdev: vdev pointer
  673. * @macaddr: Non-Associated client MAC
  674. * @rssi: rssi
  675. *
  676. * Return: QDF_STATUS
  677. */
  678. static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
  679. struct cdp_vdev *vdev,
  680. char *macaddr,
  681. uint8_t *rssi)
  682. {
  683. if (!soc || !soc->ops) {
  684. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  685. "%s invalid instance", __func__);
  686. QDF_BUG(0);
  687. return QDF_STATUS_E_FAILURE;
  688. }
  689. if (!soc->ops->ctrl_ops ||
  690. !soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi)
  691. return QDF_STATUS_E_FAILURE;
  692. return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(vdev, macaddr,
  693. rssi);
  694. }
  695. #endif
  696. #endif