cdp_txrx_flow_ctrl_v2.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_flow_ctrl_v2.h
  28. * @brief Define the host data path flow control version 2 API
  29. * functions
  30. */
  31. #ifndef _CDP_TXRX_FC_V2_H_
  32. #define _CDP_TXRX_FC_V2_H_
  33. #include <cdp_txrx_ops.h>
  34. /**
  35. * cdp_register_pause_cb() - Register flow control callback function pointer
  36. * @soc - data path soc handle
  37. * @pause_cb - Pause callback intend to register
  38. *
  39. * Register flow control callback function pointer and client context pointer
  40. *
  41. * return QDF_STATUS_SUCCESS success
  42. */
  43. static inline QDF_STATUS
  44. cdp_register_pause_cb(ol_txrx_soc_handle soc,
  45. tx_pause_callback pause_cb)
  46. {
  47. if (!soc || !soc->ops) {
  48. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  49. "%s invalid instance", __func__);
  50. QDF_BUG(0);
  51. return QDF_STATUS_E_INVAL;
  52. }
  53. if (!soc->ops->flowctl_ops ||
  54. !soc->ops->flowctl_ops->register_pause_cb)
  55. return QDF_STATUS_SUCCESS;
  56. return soc->ops->flowctl_ops->register_pause_cb(soc, pause_cb);
  57. }
  58. /**
  59. * cdp_set_desc_global_pool_size() - set global device pool size
  60. * @soc - data path soc handle
  61. * @num_msdu_desc - descriptor pool size
  62. *
  63. * set global device pool size
  64. *
  65. * return none
  66. */
  67. static inline void
  68. cdp_set_desc_global_pool_size(ol_txrx_soc_handle soc,
  69. uint32_t num_msdu_desc)
  70. {
  71. if (!soc || !soc->ops) {
  72. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  73. "%s invalid instance", __func__);
  74. QDF_BUG(0);
  75. return;
  76. }
  77. if (!soc->ops->flowctl_ops ||
  78. !soc->ops->flowctl_ops->set_desc_global_pool_size)
  79. return;
  80. soc->ops->flowctl_ops->set_desc_global_pool_size(
  81. num_msdu_desc);
  82. }
  83. /**
  84. * cdp_dump_flow_pool_info() - dump flow pool information
  85. * @soc - data path soc handle
  86. *
  87. * dump flow pool information
  88. *
  89. * return none
  90. */
  91. static inline void
  92. cdp_dump_flow_pool_info(struct cdp_soc_t *soc)
  93. {
  94. void *dp_soc = (void *)soc;
  95. if (!soc || !soc->ops) {
  96. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  97. "%s invalid instance", __func__);
  98. QDF_BUG(0);
  99. return;
  100. }
  101. if (!soc->ops->flowctl_ops ||
  102. !soc->ops->flowctl_ops->dump_flow_pool_info)
  103. return;
  104. soc->ops->flowctl_ops->dump_flow_pool_info(dp_soc);
  105. }
  106. #endif /* _CDP_TXRX_FC_V2_H_ */