cdp_txrx_ctrl.h 17 KB

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