cdp_txrx_peer_ops.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. /*
  2. * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /**
  27. * @file cdp_txrx_peer.h
  28. * @brief Define the host data path peer API functions
  29. * called by the host control SW and the OS interface module
  30. */
  31. #ifndef _CDP_TXRX_PEER_H_
  32. #define _CDP_TXRX_PEER_H_
  33. #include <cdp_txrx_ops.h>
  34. #include "cdp_txrx_handle.h"
  35. /**
  36. * cdp_peer_register() - Register peer into physical device
  37. * @soc - data path soc handle
  38. * @pdev - data path device instance
  39. * @sta_desc - peer description
  40. *
  41. * Register peer into physical device
  42. *
  43. * Return: QDF_STATUS_SUCCESS registration success
  44. * QDF_STATUS_E_NOSUPPORT not support this feature
  45. */
  46. static inline QDF_STATUS
  47. cdp_peer_register(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  48. struct ol_txrx_desc_type *sta_desc)
  49. {
  50. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  51. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  52. "%s invalid instance", __func__);
  53. return QDF_STATUS_E_INVAL;
  54. }
  55. if (soc->ops->peer_ops->register_peer)
  56. return soc->ops->peer_ops->register_peer(pdev, sta_desc);
  57. return QDF_STATUS_E_NOSUPPORT;
  58. }
  59. /**
  60. * cdp_clear_peer() - remove peer from physical device
  61. * @soc - data path soc handle
  62. * @pdev - data path device instance
  63. * @sta_id - local peer id
  64. *
  65. * remove peer from physical device
  66. *
  67. * Return: QDF_STATUS_SUCCESS registration success
  68. * QDF_STATUS_E_NOSUPPORT not support this feature
  69. */
  70. static inline QDF_STATUS
  71. cdp_clear_peer(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, uint8_t sta_id)
  72. {
  73. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  74. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  75. "%s invalid instance", __func__);
  76. return QDF_STATUS_E_INVAL;
  77. }
  78. if (soc->ops->peer_ops->clear_peer)
  79. return soc->ops->peer_ops->clear_peer(pdev, sta_id);
  80. return QDF_STATUS_E_NOSUPPORT;
  81. }
  82. /**
  83. * cdp_peer_register_ocb_peer() - register ocb peer from physical device
  84. * @soc - data path soc handle
  85. * @cds_ctx - cds void context
  86. * @mac_addr - mac address for ocb self peer
  87. * @peer_id - local peer id
  88. *
  89. * register ocb peer from physical device
  90. *
  91. * Return: QDF_STATUS_SUCCESS registration success
  92. * QDF_STATUS_E_NOSUPPORT not support this feature
  93. */
  94. static inline QDF_STATUS
  95. cdp_peer_register_ocb_peer(ol_txrx_soc_handle soc,
  96. uint8_t *mac_addr, uint8_t *peer_id)
  97. {
  98. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  99. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  100. "%s invalid instance", __func__);
  101. return QDF_STATUS_E_INVAL;
  102. }
  103. if (soc->ops->peer_ops->register_ocb_peer)
  104. return soc->ops->peer_ops->register_ocb_peer(mac_addr, peer_id);
  105. return QDF_STATUS_E_NOSUPPORT;
  106. }
  107. /**
  108. * cdp_peer_remove_for_vdev() - remove peer instance from virtual interface
  109. * @soc - data path soc handle
  110. * @vdev - virtual interface instance
  111. * @callback - remove done notification callback function pointer
  112. * @callback_context - callback caller context
  113. * @remove_last_peer - removed peer is last peer or not
  114. *
  115. * remove peer instance from virtual interface
  116. *
  117. * Return: NONE
  118. */
  119. static inline void
  120. cdp_peer_remove_for_vdev(ol_txrx_soc_handle soc,
  121. struct cdp_vdev *vdev, ol_txrx_vdev_peer_remove_cb callback,
  122. void *callback_context, bool remove_last_peer)
  123. {
  124. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  125. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  126. "%s invalid instance", __func__);
  127. return;
  128. }
  129. if (soc->ops->peer_ops->remove_peers_for_vdev)
  130. return soc->ops->peer_ops->remove_peers_for_vdev(
  131. vdev, callback, callback_context, remove_last_peer);
  132. return;
  133. }
  134. /**
  135. * cdp_peer_get_ref_by_addr() - Find peer by peer mac address and inc peer ref
  136. * @soc - data path soc handle
  137. * @pdev - data path device instance
  138. * @peer_addr - peer mac address
  139. * @peer_id - local peer id with target mac address
  140. * @debug_id - debug_id to track caller
  141. *
  142. * To release the peer ref, cdp_peer_release_ref needs to be called.
  143. *
  144. * Return: peer instance void pointer
  145. * NULL cannot find target peer
  146. */
  147. static inline void
  148. *cdp_peer_get_ref_by_addr(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  149. u8 *peer_addr, u8 *peer_id,
  150. enum peer_debug_id_type debug_id)
  151. {
  152. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  153. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  154. "%s invalid instance", __func__);
  155. return NULL;
  156. }
  157. if (soc->ops->peer_ops->peer_get_ref_by_addr)
  158. return soc->ops->peer_ops->peer_get_ref_by_addr(
  159. pdev, peer_addr, peer_id, debug_id);
  160. return NULL;
  161. }
  162. /**
  163. * cdp_peer_release_ref() - Release peer reference
  164. * @soc - data path soc handle
  165. * @peer - peer pointer
  166. * @debug_id - debug_id to track caller
  167. *
  168. * Return:void
  169. */
  170. static inline void
  171. cdp_peer_release_ref(ol_txrx_soc_handle soc, void *peer,
  172. enum peer_debug_id_type debug_id)
  173. {
  174. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  175. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  176. "%s invalid instance", __func__);
  177. return;
  178. }
  179. if (soc->ops->peer_ops->peer_release_ref)
  180. soc->ops->peer_ops->peer_release_ref(peer, debug_id);
  181. }
  182. /**
  183. * cdp_peer_find_by_addr() - Find peer by peer mac address
  184. * @soc - data path soc handle
  185. * @pdev - data path device instance
  186. * @peer_addr - peer mac address
  187. * @peer_id - local peer id with target mac address
  188. *
  189. * Find peer and local peer id by peer mac address
  190. *
  191. * Return: peer instance void pointer
  192. * NULL cannot find target peer
  193. */
  194. static inline void
  195. *cdp_peer_find_by_addr(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  196. uint8_t *peer_addr, uint8_t *peer_id)
  197. {
  198. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  199. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  200. "%s invalid instance", __func__);
  201. return NULL;
  202. }
  203. if (soc->ops->peer_ops->find_peer_by_addr)
  204. return soc->ops->peer_ops->find_peer_by_addr(
  205. pdev, peer_addr, peer_id);
  206. return NULL;
  207. }
  208. /**
  209. * cdp_peer_find_by_addr_and_vdev() - Find peer by peer mac address within vdev
  210. * @soc - data path soc handle
  211. * @pdev - data path device instance
  212. * @vdev - virtual interface instance
  213. * @peer_addr - peer mac address
  214. * @peer_id - local peer id with target mac address
  215. *
  216. * Find peer by peer mac address within vdev
  217. *
  218. * Return: peer instance void pointer
  219. * NULL cannot find target peer
  220. */
  221. static inline void
  222. *cdp_peer_find_by_addr_and_vdev(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  223. struct cdp_vdev *vdev, uint8_t *peer_addr, uint8_t *peer_id)
  224. {
  225. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  226. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  227. "%s invalid instance", __func__);
  228. return NULL;
  229. }
  230. if (soc->ops->peer_ops->find_peer_by_addr_and_vdev)
  231. return soc->ops->peer_ops->find_peer_by_addr_and_vdev(
  232. pdev, vdev, peer_addr, peer_id);
  233. return NULL;
  234. }
  235. /**
  236. * cdp_peer_find_by_local_id() - Find peer by local peer id
  237. * @soc - data path soc handle
  238. * @pdev - data path device instance
  239. * @local_peer_id - local peer id want to find
  240. *
  241. * Find peer by local peer id within physical device
  242. *
  243. * Return: peer instance void pointer
  244. * NULL cannot find target peer
  245. */
  246. static inline void
  247. *cdp_peer_find_by_local_id(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  248. uint8_t local_peer_id)
  249. {
  250. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  251. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  252. "%s invalid instance", __func__);
  253. return NULL;
  254. }
  255. if (soc->ops->peer_ops->peer_find_by_local_id)
  256. return soc->ops->peer_ops->peer_find_by_local_id(
  257. pdev, local_peer_id);
  258. return NULL;
  259. }
  260. /**
  261. * cdp_peer_state_update() - update peer local state
  262. * @soc - data path soc handle
  263. * @pdev - data path device instance
  264. * @peer_addr - peer mac address
  265. * @state - new peer local state
  266. *
  267. * update peer local state
  268. *
  269. * Return: QDF_STATUS_SUCCESS registration success
  270. * QDF_STATUS_E_NOSUPPORT not support this feature
  271. */
  272. static inline QDF_STATUS
  273. cdp_peer_state_update(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  274. uint8_t *peer_addr, enum ol_txrx_peer_state state)
  275. {
  276. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  277. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  278. "%s invalid instance", __func__);
  279. return QDF_STATUS_E_INVAL;
  280. }
  281. if (soc->ops->peer_ops->peer_state_update)
  282. return soc->ops->peer_ops->peer_state_update(
  283. pdev, peer_addr, state);
  284. return QDF_STATUS_E_NOSUPPORT;
  285. }
  286. /**
  287. * cdp_peer_state_get() - Get local peer state
  288. * @soc - data path soc handle
  289. * @peer - peer instance
  290. *
  291. * Get local peer state
  292. *
  293. * Return: peer status
  294. */
  295. static inline int
  296. cdp_peer_state_get(ol_txrx_soc_handle soc, void *peer)
  297. {
  298. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  299. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  300. "%s invalid instance", __func__);
  301. return 0;
  302. }
  303. if (soc->ops->peer_ops->get_peer_state)
  304. return soc->ops->peer_ops->get_peer_state(peer);
  305. return 0;
  306. }
  307. /**
  308. * cdp_peer_get_local_peer_id() - Find local peer id within peer instance
  309. * @soc - data path soc handle
  310. * @peer - peer instance
  311. *
  312. * Find local peer id within peer instance
  313. *
  314. * Return: local peer id
  315. * HTT_INVALID_PEER Invalid peer
  316. */
  317. static inline uint16_t
  318. cdp_peer_get_local_peer_id(ol_txrx_soc_handle soc, void *peer)
  319. {
  320. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  321. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  322. "%s invalid instance", __func__);
  323. return HTT_INVALID_PEER;
  324. }
  325. if (soc->ops->peer_ops->local_peer_id)
  326. return soc->ops->peer_ops->local_peer_id(peer);
  327. return HTT_INVALID_PEER;
  328. }
  329. /**
  330. * cdp_peer_get_vdevid() - Get virtaul interface id which peer registered
  331. * @soc - data path soc handle
  332. * @peer - peer instance
  333. * @vdev_id - virtaul interface id which peer registered
  334. *
  335. * Get virtaul interface id which peer registered
  336. *
  337. * Return: QDF_STATUS_SUCCESS registration success
  338. * QDF_STATUS_E_NOSUPPORT not support this feature
  339. */
  340. static inline QDF_STATUS
  341. cdp_peer_get_vdevid(ol_txrx_soc_handle soc, void *peer, uint8_t *vdev_id)
  342. {
  343. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  344. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  345. "%s invalid instance", __func__);
  346. return QDF_STATUS_E_INVAL;
  347. }
  348. if (soc->ops->peer_ops->get_vdevid)
  349. return soc->ops->peer_ops->get_vdevid(peer, vdev_id);
  350. return QDF_STATUS_E_NOSUPPORT;
  351. }
  352. /**
  353. * cdp_peer_get_vdev_by_sta_id() - Get vdev instance by local peer id
  354. * @soc - data path soc handle
  355. * @pdev - data path device instance
  356. * @sta_id - local peer id
  357. *
  358. * Get virtaul interface id by local peer id
  359. *
  360. * Return: Virtual interface instance
  361. * NULL in case cannot find
  362. */
  363. static inline struct cdp_vdev
  364. *cdp_peer_get_vdev_by_sta_id(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  365. uint8_t sta_id)
  366. {
  367. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  368. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  369. "%s invalid instance", __func__);
  370. return NULL;
  371. }
  372. if (soc->ops->peer_ops->get_vdev_by_sta_id)
  373. return soc->ops->peer_ops->get_vdev_by_sta_id(pdev, sta_id);
  374. return NULL;
  375. }
  376. /**
  377. * cdp_peer_get_peer_mac_addr() - Get peer mac address
  378. * @soc - data path soc handle
  379. * @peer - peer instance
  380. *
  381. * Get peer mac address
  382. *
  383. * Return: peer mac address pointer
  384. * NULL in case cannot find
  385. */
  386. static inline uint8_t
  387. *cdp_peer_get_peer_mac_addr(ol_txrx_soc_handle soc, void *peer)
  388. {
  389. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  390. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  391. "%s invalid instance", __func__);
  392. return NULL;
  393. }
  394. if (soc->ops->peer_ops->peer_get_peer_mac_addr)
  395. return soc->ops->peer_ops->peer_get_peer_mac_addr(peer);
  396. return NULL;
  397. }
  398. /**
  399. * cdp_peer_get_vdev() - Get virtual interface instance which peer belongs
  400. * @soc - data path soc handle
  401. * @peer - peer instance
  402. *
  403. * Get virtual interface instance which peer belongs
  404. *
  405. * Return: virtual interface instance pointer
  406. * NULL in case cannot find
  407. */
  408. static inline struct cdp_vdev
  409. *cdp_peer_get_vdev(ol_txrx_soc_handle soc, void *peer)
  410. {
  411. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  412. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  413. "%s invalid instance", __func__);
  414. return NULL;
  415. }
  416. if (soc->ops->peer_ops->get_vdev_for_peer)
  417. return soc->ops->peer_ops->get_vdev_for_peer(peer);
  418. return NULL;
  419. }
  420. /**
  421. * cdp_peer_update_ibss_add_peer_num_of_vdev() - update number of peer
  422. * @soc - data path soc handle
  423. * @vdev - virtual interface instance
  424. * @peer_num_delta - number of peer should be updated
  425. *
  426. * update number of peer
  427. *
  428. * Return: updated number of peer
  429. * 0 fail
  430. */
  431. static inline int16_t
  432. cdp_peer_update_ibss_add_peer_num_of_vdev(ol_txrx_soc_handle soc,
  433. struct cdp_vdev *vdev, int16_t peer_num_delta)
  434. {
  435. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  436. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  437. "%s invalid instance", __func__);
  438. return 0;
  439. }
  440. if (soc->ops->peer_ops->update_ibss_add_peer_num_of_vdev)
  441. return soc->ops->peer_ops->update_ibss_add_peer_num_of_vdev(
  442. vdev, peer_num_delta);
  443. return 0;
  444. }
  445. /**
  446. * cdp_peer_copy_mac_addr_raw() - copy peer mac address
  447. * @soc - data path soc handle
  448. * @vdev - virtual interface instance
  449. * @bss_addr - mac address should be copied
  450. *
  451. * copy peer mac address
  452. *
  453. * Return: none
  454. */
  455. static inline void
  456. cdp_peer_copy_mac_addr_raw(ol_txrx_soc_handle soc,
  457. struct cdp_vdev *vdev, uint8_t *bss_addr)
  458. {
  459. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  460. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  461. "%s invalid instance", __func__);
  462. return;
  463. }
  464. if (soc->ops->peer_ops->copy_mac_addr_raw)
  465. return soc->ops->peer_ops->copy_mac_addr_raw(vdev, bss_addr);
  466. return;
  467. }
  468. /**
  469. * cdp_peer_add_last_real_peer() - Add peer with last peer marking
  470. * @soc - data path soc handle
  471. * @pdev - data path device instance
  472. * @vdev - virtual interface instance
  473. * @peer_id - local peer id
  474. *
  475. * copy peer mac address
  476. *
  477. * Return: none
  478. */
  479. static inline void
  480. cdp_peer_add_last_real_peer(ol_txrx_soc_handle soc,
  481. struct cdp_pdev *pdev, struct cdp_vdev *vdev, uint8_t *peer_id)
  482. {
  483. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  484. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  485. "%s invalid instance", __func__);
  486. return;
  487. }
  488. if (soc->ops->peer_ops->add_last_real_peer)
  489. return soc->ops->peer_ops->add_last_real_peer(
  490. pdev, vdev, peer_id);
  491. return;
  492. }
  493. /**
  494. * cdp_peer_last_assoc_received() - last assoc received peer
  495. * @soc - data path soc handle
  496. * @peer - peer instance pointer
  497. *
  498. * !!! This should be implemented on legacy also
  499. * last assoc received peer
  500. *
  501. * Return: pointer
  502. */
  503. static inline qdf_time_t *
  504. cdp_peer_last_assoc_received(ol_txrx_soc_handle soc, void *peer)
  505. {
  506. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  507. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  508. "%s invalid instance", __func__);
  509. return NULL;
  510. }
  511. if (soc->ops->peer_ops->last_assoc_received)
  512. return soc->ops->peer_ops->last_assoc_received(peer);
  513. return NULL;
  514. }
  515. /**
  516. * cdp_peer_last_disassoc_received() - last disassoc received peer
  517. * @soc - data path soc handle
  518. * @peer - peer instance pointer
  519. *
  520. * !!! This should be implemented on legacy also
  521. * last disassoc received peer
  522. *
  523. * Return: pointer
  524. */
  525. static inline qdf_time_t *
  526. cdp_peer_last_disassoc_received(ol_txrx_soc_handle soc, void *peer)
  527. {
  528. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  529. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  530. "%s invalid instance", __func__);
  531. return NULL;
  532. }
  533. if (soc->ops->peer_ops->last_disassoc_received)
  534. return soc->ops->peer_ops->last_disassoc_received(peer);
  535. return NULL;
  536. }
  537. /**
  538. * cdp_peer_last_deauth_received() - last deauth received peer
  539. * @soc - data path soc handle
  540. * @peer - peer instance pointer
  541. *
  542. * !!! This should be implemented on legacy also
  543. * last deauth received peer
  544. *
  545. * Return: pointer
  546. */
  547. static inline qdf_time_t *
  548. cdp_peer_last_deauth_received(ol_txrx_soc_handle soc, void *peer)
  549. {
  550. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  551. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  552. "%s invalid instance", __func__);
  553. return NULL;
  554. }
  555. if (soc->ops->peer_ops->last_deauth_received)
  556. return soc->ops->peer_ops->last_deauth_received(peer);
  557. return NULL;
  558. }
  559. /**
  560. * cdp_peer_is_vdev_restore_last_peer() - restore last peer
  561. * @soc - data path soc handle
  562. * @peer - peer instance pointer
  563. *
  564. * restore last peer
  565. *
  566. * Return: true, restore success
  567. * fasle, restore fail
  568. */
  569. static inline bool
  570. cdp_peer_is_vdev_restore_last_peer(ol_txrx_soc_handle soc, void *peer)
  571. {
  572. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  573. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  574. "%s invalid instance", __func__);
  575. return false;
  576. }
  577. if (soc->ops->peer_ops->is_vdev_restore_last_peer)
  578. return soc->ops->peer_ops->is_vdev_restore_last_peer(peer);
  579. return false;
  580. }
  581. /**
  582. * cdp_peer_update_last_real_peer() - update last real peer
  583. * @soc - data path soc handle
  584. * @pdev - data path device instance
  585. * @peer - peer instance pointer
  586. * @peer_id - local peer id
  587. * @restore_last_peer - restore last peer or not
  588. *
  589. * update last real peer
  590. *
  591. * Return: none
  592. */
  593. static inline void
  594. cdp_peer_update_last_real_peer(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  595. void *peer, uint8_t *peer_id, bool restore_last_peer)
  596. {
  597. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  598. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  599. "%s invalid instance", __func__);
  600. return;
  601. }
  602. if (soc->ops->peer_ops->update_last_real_peer)
  603. return soc->ops->peer_ops->update_last_real_peer(pdev, peer,
  604. peer_id, restore_last_peer);
  605. return;
  606. }
  607. /**
  608. * ol_txrx_peer_detach_force_delete() - Detach and delete a peer's data object
  609. * @peer - the object to detach
  610. *
  611. * Detach a peer and force the peer object to be removed. It is called during
  612. * roaming scenario when the firmware has already deleted a peer.
  613. * Peer object is freed immediately to avoid duplicate peers during roam sync
  614. * indication processing.
  615. *
  616. * Return: None
  617. */
  618. static inline void cdp_peer_detach_force_delete(ol_txrx_soc_handle soc,
  619. void *peer)
  620. {
  621. if (!soc || !soc->ops || !soc->ops->peer_ops) {
  622. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  623. "%s invalid instance", __func__);
  624. return;
  625. }
  626. if (soc->ops->peer_ops->peer_detach_force_delete)
  627. return soc->ops->peer_ops->peer_detach_force_delete(peer);
  628. return;
  629. }
  630. #endif /* _CDP_TXRX_PEER_H_ */