cdp_txrx_misc.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. /*
  2. * Copyright (c) 2016-2019 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_misc.h
  20. * @brief Define the host data path miscellaneous API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_MISC_H_
  24. #define _CDP_TXRX_MISC_H_
  25. #include "cdp_txrx_handle.h"
  26. /**
  27. * cdp_tx_non_std() - Allow the control-path SW to send data frames
  28. *
  29. * @soc - data path soc handle
  30. * @data_vdev - which vdev should transmit the tx data frames
  31. * @tx_spec - what non-standard handling to apply to the tx data frames
  32. * @msdu_list - NULL-terminated list of tx MSDUs
  33. *
  34. * Generally, all tx data frames come from the OS shim into the txrx layer.
  35. * However, there are rare cases such as TDLS messaging where the UMAC
  36. * control-path SW creates tx data frames.
  37. * This UMAC SW can call this function to provide the tx data frames to
  38. * the txrx layer.
  39. * The UMAC SW can request a callback for these data frames after their
  40. * transmission completes, by using the ol_txrx_data_tx_cb_set function
  41. * to register a tx completion callback, and by specifying
  42. * ol_tx_spec_no_free as the tx_spec arg when giving the frames to
  43. * ol_tx_non_std.
  44. * The MSDUs need to have the appropriate L2 header type (802.3 vs. 802.11),
  45. * as specified by ol_cfg_frame_type().
  46. *
  47. * Return: null - success, skb - failure
  48. */
  49. static inline qdf_nbuf_t
  50. cdp_tx_non_std(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  51. enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list)
  52. {
  53. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  54. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  55. "%s invalid instance", __func__);
  56. return NULL;
  57. }
  58. if (soc->ops->misc_ops->tx_non_std)
  59. return soc->ops->misc_ops->tx_non_std(
  60. vdev, tx_spec, msdu_list);
  61. return NULL;
  62. }
  63. /**
  64. * cdp_set_ibss_vdev_heart_beat_timer() - Update ibss vdev heart
  65. * beat timer
  66. * @soc - data path soc handle
  67. * @vdev - vdev handle
  68. * @timer_value_sec - new heart beat timer value
  69. *
  70. * Return: Old timer value set in vdev.
  71. */
  72. static inline uint16_t
  73. cdp_set_ibss_vdev_heart_beat_timer(ol_txrx_soc_handle soc,
  74. struct cdp_vdev *vdev, uint16_t timer_value_sec)
  75. {
  76. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  77. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  78. "%s invalid instance", __func__);
  79. return 0;
  80. }
  81. if (soc->ops->misc_ops->set_ibss_vdev_heart_beat_timer)
  82. return soc->ops->misc_ops->set_ibss_vdev_heart_beat_timer(
  83. vdev, timer_value_sec);
  84. return 0;
  85. }
  86. /**
  87. * cdp_set_wisa_mode() - set wisa mode
  88. * @soc - data path soc handle
  89. * @vdev - vdev handle
  90. * @enable - enable or disable
  91. *
  92. * Return: QDF_STATUS_SUCCESS mode enable success
  93. */
  94. static inline QDF_STATUS
  95. cdp_set_wisa_mode(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, bool enable)
  96. {
  97. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  98. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  99. "%s invalid instance", __func__);
  100. return QDF_STATUS_E_INVAL;
  101. }
  102. if (soc->ops->misc_ops->set_wisa_mode)
  103. return soc->ops->misc_ops->set_wisa_mode(vdev, enable);
  104. return QDF_STATUS_SUCCESS;
  105. }
  106. /**
  107. * cdp_data_stall_cb_register() - register data stall callback
  108. * @soc - data path soc handle
  109. * @cb - callback function
  110. *
  111. * Return: QDF_STATUS_SUCCESS register success
  112. */
  113. static inline QDF_STATUS cdp_data_stall_cb_register(ol_txrx_soc_handle soc,
  114. data_stall_detect_cb cb)
  115. {
  116. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  117. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  118. "%s invalid instance", __func__);
  119. return QDF_STATUS_E_INVAL;
  120. }
  121. if (soc->ops->misc_ops->txrx_data_stall_cb_register)
  122. return soc->ops->misc_ops->txrx_data_stall_cb_register(cb);
  123. return QDF_STATUS_SUCCESS;
  124. }
  125. /**
  126. * cdp_data_stall_cb_deregister() - de-register data stall callback
  127. * @soc - data path soc handle
  128. * @cb - callback function
  129. *
  130. * Return: QDF_STATUS_SUCCESS de-register success
  131. */
  132. static inline QDF_STATUS cdp_data_stall_cb_deregister(ol_txrx_soc_handle soc,
  133. data_stall_detect_cb cb)
  134. {
  135. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  136. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  137. "%s invalid instance", __func__);
  138. return QDF_STATUS_E_INVAL;
  139. }
  140. if (soc->ops->misc_ops->txrx_data_stall_cb_deregister)
  141. return soc->ops->misc_ops->txrx_data_stall_cb_deregister(cb);
  142. return QDF_STATUS_SUCCESS;
  143. }
  144. /**
  145. * cdp_post_data_stall_event() - post data stall event
  146. * @soc - data path soc handle
  147. * @indicator: Module triggering data stall
  148. * @data_stall_type: data stall event type
  149. * @pdev_id: pdev id
  150. * @vdev_id_bitmap: vdev id bitmap
  151. * @recovery_type: data stall recovery type
  152. *
  153. * Return: None
  154. */
  155. static inline void
  156. cdp_post_data_stall_event(ol_txrx_soc_handle soc,
  157. enum data_stall_log_event_indicator indicator,
  158. enum data_stall_log_event_type data_stall_type,
  159. uint32_t pdev_id, uint32_t vdev_id_bitmap,
  160. enum data_stall_log_recovery_type recovery_type)
  161. {
  162. if (!soc || !soc->ops) {
  163. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  164. "%s invalid instance", __func__);
  165. QDF_BUG(0);
  166. return;
  167. }
  168. if (!soc->ops->misc_ops ||
  169. !soc->ops->misc_ops->txrx_post_data_stall_event)
  170. return;
  171. soc->ops->misc_ops->txrx_post_data_stall_event(
  172. indicator, data_stall_type, pdev_id,
  173. vdev_id_bitmap, recovery_type);
  174. }
  175. /**
  176. * cdp_set_wmm_param() - set wmm parameter
  177. * @soc - data path soc handle
  178. * @pdev - device instance pointer
  179. * @wmm_param - wmm parameter
  180. *
  181. * Return: none
  182. */
  183. static inline void
  184. cdp_set_wmm_param(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  185. struct ol_tx_wmm_param_t wmm_param)
  186. {
  187. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  188. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  189. "%s invalid instance", __func__);
  190. return;
  191. }
  192. if (soc->ops->misc_ops->set_wmm_param)
  193. return soc->ops->misc_ops->set_wmm_param(
  194. pdev, wmm_param);
  195. return;
  196. }
  197. /**
  198. * cdp_runtime_suspend() - suspend
  199. * @soc - data path soc handle
  200. * @pdev - device instance pointer
  201. *
  202. * Return: QDF_STATUS_SUCCESS suspend success
  203. */
  204. static inline QDF_STATUS cdp_runtime_suspend(ol_txrx_soc_handle soc,
  205. struct cdp_pdev *pdev)
  206. {
  207. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  208. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  209. "%s invalid instance", __func__);
  210. return QDF_STATUS_E_INVAL;
  211. }
  212. if (soc->ops->misc_ops->runtime_suspend)
  213. return soc->ops->misc_ops->runtime_suspend(pdev);
  214. return QDF_STATUS_SUCCESS;
  215. }
  216. /**
  217. * cdp_runtime_resume() - resume
  218. * @soc - data path soc handle
  219. * @pdev - device instance pointer
  220. *
  221. * Return: QDF_STATUS_SUCCESS suspend success
  222. */
  223. static inline QDF_STATUS cdp_runtime_resume(ol_txrx_soc_handle soc,
  224. struct cdp_pdev *pdev)
  225. {
  226. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  227. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  228. "%s invalid instance", __func__);
  229. return QDF_STATUS_E_INVAL;
  230. }
  231. if (soc->ops->misc_ops->runtime_resume)
  232. return soc->ops->misc_ops->runtime_resume(pdev);
  233. return QDF_STATUS_SUCCESS;
  234. }
  235. /**
  236. * cdp_hl_tdls_flag_reset() - tdls flag reset
  237. * @soc - data path soc handle
  238. * @vdev - virtual interface handle pointer
  239. * @flag
  240. *
  241. * Return: none
  242. */
  243. static inline void
  244. cdp_hl_tdls_flag_reset(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, bool flag)
  245. {
  246. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  247. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  248. "%s invalid instance", __func__);
  249. return;
  250. }
  251. if (soc->ops->misc_ops->hl_tdls_flag_reset)
  252. return soc->ops->misc_ops->hl_tdls_flag_reset(vdev, flag);
  253. return;
  254. }
  255. /**
  256. * cdp_get_opmode() - get vdev operation mode
  257. * @soc - data path soc handle
  258. * @vdev - virtual interface instance
  259. *
  260. * Return virtual device operational mode
  261. * op_mode_ap,
  262. * op_mode_ibss,
  263. * op_mode_sta,
  264. * op_mode_monitor,
  265. * op_mode_ocb,
  266. *
  267. * return interface id
  268. * 0 unknown interface
  269. */
  270. static inline int
  271. cdp_get_opmode(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  272. {
  273. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  274. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  275. "%s invalid instance", __func__);
  276. return 0;
  277. }
  278. if (soc->ops->misc_ops->get_opmode)
  279. return soc->ops->misc_ops->get_opmode(vdev);
  280. return 0;
  281. }
  282. /**
  283. * cdp_get_vdev_id() - get vdev id
  284. * @soc - data path soc handle
  285. * @vdev - virtual interface instance
  286. *
  287. * get virtual interface id
  288. *
  289. * return interface id
  290. * 0 unknown interface
  291. */
  292. static inline uint16_t
  293. cdp_get_vdev_id(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  294. {
  295. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  296. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  297. "%s invalid instance", __func__);
  298. return 0;
  299. }
  300. if (soc->ops->misc_ops->get_vdev_id)
  301. return soc->ops->misc_ops->get_vdev_id(vdev);
  302. return 0;
  303. }
  304. /**
  305. * cdp_get_tx_ack_stats() - get tx ack count for vdev
  306. * @soc - data path soc handle
  307. * @pdev - data path device instance
  308. * @vdev_id - vdev id
  309. *
  310. * return tx ack count
  311. * 0 invalid count
  312. */
  313. static inline uint32_t
  314. cdp_get_tx_ack_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  315. uint8_t vdev_id)
  316. {
  317. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  318. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  319. "%s invalid instance", __func__);
  320. return 0;
  321. }
  322. if (soc->ops->misc_ops->get_tx_ack_stats)
  323. return soc->ops->misc_ops->get_tx_ack_stats(pdev, vdev_id);
  324. return 0;
  325. }
  326. /**
  327. * cdp_bad_peer_txctl_set_setting() - TBD
  328. * @soc - data path soc handle
  329. * @pdev - data path device instance
  330. * @enable -
  331. * @period -
  332. * @txq_limit -
  333. *
  334. * TBD
  335. *
  336. * Return: none
  337. */
  338. static inline void
  339. cdp_bad_peer_txctl_set_setting(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  340. int enable, int period, int txq_limit)
  341. {
  342. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  343. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  344. "%s invalid instance", __func__);
  345. return;
  346. }
  347. if (soc->ops->misc_ops->bad_peer_txctl_set_setting)
  348. return soc->ops->misc_ops->bad_peer_txctl_set_setting(pdev,
  349. enable, period, txq_limit);
  350. return;
  351. }
  352. /**
  353. * cdp_bad_peer_txctl_update_threshold() - TBD
  354. * @soc - data path soc handle
  355. * @pdev - data path device instance
  356. * @level -
  357. * @tput_thresh -
  358. * @tx_limit -
  359. *
  360. * TBD
  361. *
  362. * Return: none
  363. */
  364. static inline void
  365. cdp_bad_peer_txctl_update_threshold(ol_txrx_soc_handle soc,
  366. struct cdp_pdev *pdev,
  367. int level, int tput_thresh, int tx_limit)
  368. {
  369. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  370. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  371. "%s invalid instance", __func__);
  372. return;
  373. }
  374. if (soc->ops->misc_ops->bad_peer_txctl_update_threshold)
  375. return soc->ops->misc_ops->bad_peer_txctl_update_threshold(
  376. pdev, level, tput_thresh, tx_limit);
  377. return;
  378. }
  379. /**
  380. * cdp_mark_first_wakeup_packet() - set flag to indicate that
  381. * fw is compatible for marking first packet after wow wakeup
  382. * @soc - data path soc handle
  383. * @value: 1 for enabled/ 0 for disabled
  384. *
  385. * Return: None
  386. */
  387. static inline void cdp_mark_first_wakeup_packet(ol_txrx_soc_handle soc,
  388. uint8_t value)
  389. {
  390. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  391. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  392. "%s invalid instance", __func__);
  393. return;
  394. }
  395. if (soc->ops->misc_ops->mark_first_wakeup_packet)
  396. return soc->ops->misc_ops->mark_first_wakeup_packet(value);
  397. return;
  398. }
  399. /**
  400. * cds_update_mac_id() - update mac_id for vdev
  401. * @soc - data path soc handle
  402. * @vdev_id: vdev id
  403. * @mac_id: mac id
  404. *
  405. * Return: none
  406. */
  407. static inline void cdp_update_mac_id(void *psoc, uint8_t vdev_id,
  408. uint8_t mac_id)
  409. {
  410. ol_txrx_soc_handle soc = psoc;
  411. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  412. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  413. "%s invalid instance", __func__);
  414. return;
  415. }
  416. if (soc->ops->misc_ops->update_mac_id)
  417. return soc->ops->misc_ops->update_mac_id(vdev_id, mac_id);
  418. return;
  419. }
  420. /**
  421. * cdp_flush_rx_frames() - flush cached rx frames
  422. * @soc - data path soc handle
  423. * @peer: peer
  424. * @drop: set flag to drop frames
  425. *
  426. * Return: None
  427. */
  428. static inline void cdp_flush_rx_frames(ol_txrx_soc_handle soc, void *peer,
  429. bool drop)
  430. {
  431. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  432. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  433. "%s invalid instance", __func__);
  434. return;
  435. }
  436. if (soc->ops->misc_ops->flush_rx_frames)
  437. return soc->ops->misc_ops->flush_rx_frames(peer, drop);
  438. return;
  439. }
  440. /*
  441. * cdp_get_intra_bss_fwd_pkts_count() - to get the total tx and rx packets
  442. * that has been forwarded from txrx layer without going to upper layers.
  443. * @vdev_id: vdev id
  444. * @fwd_tx_packets: pointer to forwarded tx packets count parameter
  445. * @fwd_rx_packets: pointer to forwarded rx packets count parameter
  446. *
  447. * Return: status -> A_OK - success, A_ERROR - failure
  448. */
  449. static inline A_STATUS cdp_get_intra_bss_fwd_pkts_count(
  450. ol_txrx_soc_handle soc, uint8_t vdev_id,
  451. uint64_t *fwd_tx_packets, uint64_t *fwd_rx_packets)
  452. {
  453. if (!soc || !soc->ops || !soc->ops->misc_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->misc_ops->get_intra_bss_fwd_pkts_count)
  459. return soc->ops->misc_ops->get_intra_bss_fwd_pkts_count(
  460. vdev_id, fwd_tx_packets, fwd_rx_packets);
  461. return 0;
  462. }
  463. /**
  464. * cdp_pkt_log_init() - API to initialize packet log
  465. * @handle: pdev handle
  466. * @scn: HIF context
  467. *
  468. * Return: void
  469. */
  470. static inline void cdp_pkt_log_init(ol_txrx_soc_handle soc,
  471. struct cdp_pdev *pdev, void *scn)
  472. {
  473. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  474. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  475. "%s invalid instance", __func__);
  476. return;
  477. }
  478. if (soc->ops->misc_ops->pkt_log_init)
  479. return soc->ops->misc_ops->pkt_log_init(pdev, scn);
  480. return;
  481. }
  482. /**
  483. * cdp_pkt_log_con_service() - API to connect packet log service
  484. * @handle: pdev handle
  485. * @scn: HIF context
  486. *
  487. * Return: void
  488. */
  489. static inline void cdp_pkt_log_con_service(ol_txrx_soc_handle soc,
  490. struct cdp_pdev *pdev, void *scn)
  491. {
  492. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  493. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  494. "%s invalid instance", __func__);
  495. return;
  496. }
  497. if (soc->ops->misc_ops->pkt_log_con_service)
  498. return soc->ops->misc_ops->pkt_log_con_service(pdev, scn);
  499. return;
  500. }
  501. /**
  502. * cdp_get_num_rx_contexts() - API to get the number of RX contexts
  503. * @soc: soc handle
  504. *
  505. * Return: number of RX contexts
  506. */
  507. static inline int cdp_get_num_rx_contexts(ol_txrx_soc_handle soc)
  508. {
  509. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  510. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  511. "%s invalid instance", __func__);
  512. return 0;
  513. }
  514. if (soc->ops->misc_ops->get_num_rx_contexts)
  515. return soc->ops->misc_ops->get_num_rx_contexts(soc);
  516. return 0;
  517. }
  518. /**
  519. * cdp_register_packetdump_cb() - API to register packetdump callback
  520. *
  521. * Register TX/RX callback for data packets, during connection. And per packet
  522. * stats will be passed to user-space by @tx_cb/@rx_cb.
  523. *
  524. * @soc: soc handle
  525. * @tx_cb: tx packet callback
  526. * @rx_cb: rx packet callback
  527. *
  528. * Return: void
  529. */
  530. static inline void cdp_register_packetdump_cb(ol_txrx_soc_handle soc,
  531. ol_txrx_pktdump_cb tx_cb,
  532. ol_txrx_pktdump_cb rx_cb)
  533. {
  534. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  535. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  536. "%s invalid instance", __func__);
  537. return;
  538. }
  539. if (soc->ops->misc_ops->register_pktdump_cb)
  540. return soc->ops->misc_ops->register_pktdump_cb(tx_cb, rx_cb);
  541. }
  542. /**
  543. * cdp_deregister_packetdump_cb() - API to unregister packetdump callback
  544. *
  545. * Deregister callback for TX/RX data packets.
  546. *
  547. * @soc: soc handle
  548. *
  549. * Return: void
  550. */
  551. static inline void cdp_deregister_packetdump_cb(ol_txrx_soc_handle soc)
  552. {
  553. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  554. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  555. "%s invalid instance", __func__);
  556. return;
  557. }
  558. if (soc->ops->misc_ops->unregister_pktdump_cb)
  559. return soc->ops->misc_ops->unregister_pktdump_cb();
  560. }
  561. /**
  562. * cdp_pdev_reset_driver_del_ack() - reset driver TCP delayed ack flag
  563. * @soc - data path soc handle
  564. * @pdev - data path device instance
  565. *
  566. * Return: none
  567. */
  568. static inline void cdp_pdev_reset_driver_del_ack(void *psoc,
  569. struct cdp_pdev *pdev)
  570. {
  571. ol_txrx_soc_handle soc = psoc;
  572. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  573. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  574. "%s invalid instance", __func__);
  575. return;
  576. }
  577. if (soc->ops->misc_ops->pdev_reset_driver_del_ack)
  578. return soc->ops->misc_ops->pdev_reset_driver_del_ack(pdev);
  579. }
  580. /*
  581. * cdp_vdev_set_driver_del_ack_enable() - set driver delayed ack enabled flag
  582. * @soc - data path soc handle
  583. * @vdev_id: vdev id
  584. * @rx_packets: number of rx packets
  585. * @time_in_ms: time in ms
  586. * @high_th: high threshold
  587. * @low_th: low threshold
  588. *
  589. * Return: none
  590. */
  591. static inline void cdp_vdev_set_driver_del_ack_enable(ol_txrx_soc_handle soc,
  592. uint8_t vdev_id,
  593. unsigned long rx_packets,
  594. uint32_t time_in_ms,
  595. uint32_t high_th,
  596. uint32_t low_th)
  597. {
  598. if (!soc || !soc->ops || !soc->ops->misc_ops) {
  599. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  600. "%s invalid instance", __func__);
  601. return;
  602. }
  603. if (soc->ops->misc_ops->vdev_set_driver_del_ack_enable)
  604. return soc->ops->misc_ops->vdev_set_driver_del_ack_enable(
  605. vdev_id, rx_packets, time_in_ms, high_th, low_th);
  606. }
  607. #endif /* _CDP_TXRX_MISC_H_ */