cdp_txrx_peer_ops.h 19 KB

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