cdp_txrx_ctrl.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  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. /* Should be ol_txrx_ctrl_api.h */
  310. static inline void cdp_set_mesh_mode
  311. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, u_int32_t val)
  312. {
  313. if (!soc || !soc->ops) {
  314. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  315. "%s: Invalid Instance:", __func__);
  316. QDF_BUG(0);
  317. return;
  318. }
  319. if (!soc->ops->ctrl_ops ||
  320. !soc->ops->ctrl_ops->txrx_set_mesh_mode)
  321. return;
  322. soc->ops->ctrl_ops->txrx_set_mesh_mode(vdev, val);
  323. }
  324. /**
  325. * @brief set mesh rx filter
  326. * @details based on the bits enabled in the filter packets has to be dropped.
  327. *
  328. * @param soc - pointer to the soc
  329. * @param vdev - the data virtual device object
  330. * @param val - value to be set
  331. * @return - void
  332. */
  333. static inline
  334. void cdp_set_mesh_rx_filter(ol_txrx_soc_handle soc,
  335. struct cdp_vdev *vdev, uint32_t val)
  336. {
  337. if (!soc || !soc->ops) {
  338. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  339. "%s: Invalid Instance:", __func__);
  340. QDF_BUG(0);
  341. return;
  342. }
  343. if (!soc->ops->ctrl_ops ||
  344. !soc->ops->ctrl_ops->txrx_set_mesh_rx_filter)
  345. return;
  346. soc->ops->ctrl_ops->txrx_set_mesh_rx_filter(vdev, val);
  347. }
  348. static inline void cdp_tx_flush_buffers
  349. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  350. {
  351. if (!soc || !soc->ops) {
  352. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  353. "%s: Invalid Instance:", __func__);
  354. QDF_BUG(0);
  355. return;
  356. }
  357. if (!soc->ops->ctrl_ops ||
  358. !soc->ops->ctrl_ops->tx_flush_buffers)
  359. return;
  360. soc->ops->ctrl_ops->tx_flush_buffers(vdev);
  361. }
  362. static inline uint32_t cdp_txrx_get_vdev_param(ol_txrx_soc_handle soc,
  363. struct cdp_vdev *vdev,
  364. enum cdp_vdev_param_type type)
  365. {
  366. if (!soc || !soc->ops) {
  367. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  368. "%s: Invalid Instance:", __func__);
  369. QDF_BUG(0);
  370. return -1;
  371. }
  372. if (!soc->ops->ctrl_ops ||
  373. !soc->ops->ctrl_ops->txrx_get_vdev_param) {
  374. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  375. "%s: callback not registered:", __func__);
  376. return -1;
  377. }
  378. return soc->ops->ctrl_ops->txrx_get_vdev_param(vdev, type);
  379. }
  380. static inline void cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc,
  381. struct cdp_vdev *vdev, enum cdp_vdev_param_type type,
  382. uint32_t val)
  383. {
  384. if (!soc || !soc->ops) {
  385. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  386. "%s: Invalid Instance:", __func__);
  387. QDF_BUG(0);
  388. return;
  389. }
  390. if (!soc->ops->ctrl_ops ||
  391. !soc->ops->ctrl_ops->txrx_set_vdev_param)
  392. return;
  393. soc->ops->ctrl_ops->txrx_set_vdev_param(vdev, type, val);
  394. }
  395. static inline void
  396. cdp_peer_set_nawds(ol_txrx_soc_handle soc,
  397. struct cdp_peer *peer, uint8_t value)
  398. {
  399. if (!soc || !soc->ops) {
  400. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  401. "%s: Invalid Instance:", __func__);
  402. QDF_BUG(0);
  403. return;
  404. }
  405. if (!soc->ops->ctrl_ops ||
  406. !soc->ops->ctrl_ops->txrx_peer_set_nawds)
  407. return;
  408. soc->ops->ctrl_ops->txrx_peer_set_nawds
  409. (peer, value);
  410. }
  411. static inline void cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
  412. struct cdp_pdev *pdev, enum cdp_pdev_param_type type,
  413. uint8_t val)
  414. {
  415. if (!soc || !soc->ops) {
  416. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  417. "%s: Invalid Instance:", __func__);
  418. QDF_BUG(0);
  419. return;
  420. }
  421. if (!soc->ops->ctrl_ops ||
  422. !soc->ops->ctrl_ops->txrx_set_pdev_param)
  423. return;
  424. soc->ops->ctrl_ops->txrx_set_pdev_param
  425. (pdev, type, val);
  426. }
  427. /**
  428. * @brief Subscribe to a specified WDI event.
  429. * @details
  430. * This function adds the provided wdi_event_subscribe object to a list of
  431. * subscribers for the specified WDI event.
  432. * When the event in question happens, each subscriber for the event will
  433. * have their callback function invoked.
  434. * The order in which callback functions from multiple subscribers are
  435. * invoked is unspecified.
  436. *
  437. * @param soc - pointer to the soc
  438. * @param pdev - the data physical device object
  439. * @param event_cb_sub - the callback and context for the event subscriber
  440. * @param event - which event's notifications are being subscribed to
  441. * @return - int
  442. */
  443. static inline int
  444. cdp_wdi_event_sub(ol_txrx_soc_handle soc,
  445. struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
  446. {
  447. if (!soc || !soc->ops) {
  448. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  449. "%s invalid instance", __func__);
  450. QDF_BUG(0);
  451. return 0;
  452. }
  453. if (!soc->ops->ctrl_ops ||
  454. !soc->ops->ctrl_ops->txrx_wdi_event_sub)
  455. return 0;
  456. return soc->ops->ctrl_ops->txrx_wdi_event_sub
  457. (pdev, event_cb_sub, event);
  458. }
  459. /**
  460. * @brief Unsubscribe from a specified WDI event.
  461. * @details
  462. * This function removes the provided event subscription object from the
  463. * list of subscribers for its event.
  464. * This function shall only be called if there was a successful prior call
  465. * to event_sub() on the same wdi_event_subscribe object.
  466. *
  467. * @param soc - pointer to the soc
  468. * @param pdev - the data physical device object
  469. * @param event_cb_sub - the callback and context for the event subscriber
  470. * @param event - which event's notifications are being subscribed to
  471. * @return - int
  472. */
  473. static inline int
  474. cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
  475. struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
  476. {
  477. if (!soc || !soc->ops) {
  478. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  479. "%s invalid instance", __func__);
  480. QDF_BUG(0);
  481. return 0;
  482. }
  483. if (!soc->ops->ctrl_ops ||
  484. !soc->ops->ctrl_ops->txrx_wdi_event_unsub)
  485. return 0;
  486. return soc->ops->ctrl_ops->txrx_wdi_event_unsub
  487. (pdev, event_cb_sub, event);
  488. }
  489. /**
  490. * @brief Get security type from the from peer.
  491. * @details
  492. * This function gets the Security information from the peer handler.
  493. * The security information is got from the rx descriptor and filled in
  494. * to the peer handler.
  495. *
  496. * @param soc - pointer to the soc
  497. * @param peer - peer handler
  498. * @param sec_idx - mcast or ucast frame type.
  499. * @return - int
  500. */
  501. static inline int
  502. cdp_get_sec_type(ol_txrx_soc_handle soc, struct cdp_peer *peer, uint8_t sec_idx)
  503. {
  504. if (!soc || !soc->ops) {
  505. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  506. "%s invalid instance", __func__);
  507. QDF_BUG(0);
  508. return A_ERROR;
  509. }
  510. if (!soc->ops->ctrl_ops ||
  511. !soc->ops->ctrl_ops->txrx_get_sec_type)
  512. return A_ERROR;
  513. return soc->ops->ctrl_ops->txrx_get_sec_type
  514. (peer, sec_idx);
  515. }
  516. /**
  517. * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames
  518. * @vdev_handle: vdev handle
  519. * @subtype_index: subtype
  520. * @tx_power: Tx power
  521. * Return: None
  522. */
  523. static inline int cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
  524. struct cdp_vdev *vdev, uint8_t subtype, uint8_t tx_power)
  525. {
  526. if (!soc || !soc->ops) {
  527. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  528. "%s: Invalid Instance:", __func__);
  529. QDF_BUG(0);
  530. return 0;
  531. }
  532. if (!soc->ops->ctrl_ops ||
  533. !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev)
  534. return 0;
  535. soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(vdev,
  536. subtype, tx_power);
  537. return 0;
  538. }
  539. static inline void *
  540. cdp_get_pldev(ol_txrx_soc_handle soc,
  541. struct cdp_pdev *pdev)
  542. {
  543. if (!soc || !soc->ops) {
  544. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  545. "%s invalid instance", __func__);
  546. QDF_BUG(0);
  547. return NULL;
  548. }
  549. if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev)
  550. return NULL;
  551. return soc->ops->ctrl_ops->txrx_get_pldev(pdev);
  552. }
  553. #ifdef ATH_SUPPORT_NAC_RSSI
  554. /**
  555. * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config
  556. * @soc: soc pointer
  557. * @vdev: vdev pointer
  558. * @nac_cmd: specfies nac_rss config action add, del, list
  559. * @bssid: Neighbour bssid
  560. * @client_macaddr: Non-Associated client MAC
  561. * @chan_num: channel number to scan
  562. *
  563. * Return: QDF_STATUS
  564. */
  565. static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
  566. struct cdp_vdev *vdev, enum cdp_nac_param_cmd nac_cmd,
  567. char *bssid, char *client_macaddr, uint8_t chan_num)
  568. {
  569. if (!soc || !soc->ops) {
  570. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  571. "%s invalid instance", __func__);
  572. QDF_BUG(0);
  573. return QDF_STATUS_E_FAILURE;
  574. }
  575. if (!soc->ops->ctrl_ops ||
  576. !soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi)
  577. return QDF_STATUS_E_FAILURE;
  578. return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(vdev,
  579. nac_cmd, bssid, client_macaddr, chan_num);
  580. }
  581. /*
  582. * cdp_vdev_get_neighbour_rssi(): To invoke dp callback to get rssi value of nac
  583. * @soc: soc pointer
  584. * @vdev: vdev pointer
  585. * @macaddr: Non-Associated client MAC
  586. * @rssi: rssi
  587. *
  588. * Return: QDF_STATUS
  589. */
  590. static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
  591. struct cdp_vdev *vdev,
  592. char *macaddr,
  593. uint8_t *rssi)
  594. {
  595. if (!soc || !soc->ops) {
  596. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  597. "%s invalid instance", __func__);
  598. QDF_BUG(0);
  599. return QDF_STATUS_E_FAILURE;
  600. }
  601. if (!soc->ops->ctrl_ops ||
  602. !soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi)
  603. return QDF_STATUS_E_FAILURE;
  604. return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(vdev, macaddr,
  605. rssi);
  606. }
  607. #endif
  608. #endif