dp_internal.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Copyright (c) 2016-2017 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. #ifndef _DP_INTERNAL_H_
  19. #define _DP_INTERNAL_H_
  20. #if DP_PRINT_ENABLE
  21. #include <stdarg.h> /* va_list */
  22. #include <qdf_types.h> /* qdf_vprint */
  23. #include <cdp_txrx_handle.h>
  24. enum {
  25. /* FATAL_ERR - print only irrecoverable error messages */
  26. DP_PRINT_LEVEL_FATAL_ERR,
  27. /* ERR - include non-fatal err messages */
  28. DP_PRINT_LEVEL_ERR,
  29. /* WARN - include warnings */
  30. DP_PRINT_LEVEL_WARN,
  31. /* INFO1 - include fundamental, infrequent events */
  32. DP_PRINT_LEVEL_INFO1,
  33. /* INFO2 - include non-fundamental but infrequent events */
  34. DP_PRINT_LEVEL_INFO2,
  35. };
  36. #define dp_print(level, fmt, ...) do { \
  37. if (level <= g_txrx_print_level) \
  38. qdf_print(fmt, ## __VA_ARGS__); \
  39. while (0)
  40. #define DP_PRINT(level, fmt, ...) do { \
  41. dp_print(level, "DP: " fmt, ## __VA_ARGS__); \
  42. while (0)
  43. #else
  44. #define DP_PRINT(level, fmt, ...)
  45. #endif /* DP_PRINT_ENABLE */
  46. #define DP_TRACE(LVL, fmt, args ...) \
  47. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \
  48. "%s:%d: "fmt, __func__, __LINE__, ## args)
  49. #define DP_STATS_INIT(_handle) \
  50. qdf_mem_set(&((_handle)->stats), sizeof((_handle)->stats), 0x0)
  51. #define DP_STATS_CLR(_handle) \
  52. qdf_mem_set(&((_handle)->stats), sizeof((_handle)->stats), 0x0)
  53. #ifndef DISABLE_DP_STATS
  54. #define DP_STATS_INC(_handle, _field, _delta) \
  55. { \
  56. _handle->stats._field += _delta; \
  57. }
  58. #define DP_STATS_INCC(_handle, _field, _delta, _cond) \
  59. { \
  60. if (_cond) { \
  61. _handle->stats._field += _delta; \
  62. } \
  63. }
  64. #define DP_STATS_DEC(_handle, _field, _delta) \
  65. { \
  66. _handle->stats._field -= _delta; \
  67. }
  68. #define DP_STATS_UPD(_handle, _field, _delta) \
  69. { \
  70. _handle->stats._field = _delta \
  71. }
  72. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes) \
  73. { \
  74. DP_STATS_INC(_handle, _field.num, _count); \
  75. DP_STATS_INC(_handle, _field.bytes, _bytes) \
  76. }
  77. #else
  78. #define DP_STATS_INC(_handle, _field, _delta)
  79. #define DP_STATS_INCC(_handle, _field, _delta, _cond)
  80. #define DP_STATS_DEC(_handle, _field, _delta)
  81. #define DP_STATS_UPD(_handle, _field, _delta)
  82. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes)
  83. #endif
  84. extern int dp_peer_find_attach(struct dp_soc *soc);
  85. extern void dp_peer_find_detach(struct dp_soc *soc);
  86. extern void dp_peer_find_hash_add(struct dp_soc *soc, struct dp_peer *peer);
  87. extern void dp_peer_find_hash_remove(struct dp_soc *soc, struct dp_peer *peer);
  88. extern void dp_peer_find_hash_erase(struct dp_soc *soc);
  89. extern void dp_peer_rx_init(struct dp_pdev *pdev, struct dp_peer *peer);
  90. extern void dp_peer_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  91. extern void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  92. extern void dp_peer_unref_delete(void *peer_handle);
  93. extern void dp_rx_discard(struct dp_vdev *vdev, struct dp_peer *peer,
  94. unsigned tid, qdf_nbuf_t msdu_list);
  95. extern void *dp_find_peer_by_addr(struct cdp_pdev *dev,
  96. uint8_t *peer_mac_addr, uint8_t *peer_id);
  97. #ifndef CONFIG_WIN
  98. QDF_STATUS dp_register_peer(struct cdp_pdev *pdev_handle,
  99. struct ol_txrx_desc_type *sta_desc);
  100. QDF_STATUS dp_clear_peer(struct cdp_pdev *pdev_handle, uint8_t local_id);
  101. void *dp_find_peer_by_addr_and_vdev(struct cdp_pdev *pdev_handle,
  102. struct cdp_vdev *vdev,
  103. uint8_t *peer_addr, uint8_t *local_id);
  104. uint16_t dp_local_peer_id(void *peer);
  105. void *dp_peer_find_by_local_id(struct cdp_pdev *pdev_handle, uint8_t local_id);
  106. QDF_STATUS dp_peer_state_update(struct cdp_pdev *pdev_handle, uint8_t *peer_mac,
  107. enum ol_txrx_peer_state state);
  108. QDF_STATUS dp_get_vdevid(void *peer_handle, uint8_t *vdev_id);
  109. struct cdp_vdev *dp_get_vdev_for_peer(void *peer);
  110. uint8_t *dp_peer_get_peer_mac_addr(void *peer);
  111. int dp_get_peer_state(void *peer_handle);
  112. void dp_local_peer_id_pool_init(struct dp_pdev *pdev);
  113. void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer);
  114. void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer);
  115. qdf_time_t *dp_get_last_assoc_received(void *peer_handle);
  116. qdf_time_t *dp_get_last_disassoc_received(void *peer_handle);
  117. qdf_time_t *dp_get_last_deauth_received(void *peer_handle);
  118. #endif
  119. extern int dp_addba_requestprocess_wifi3(void *peer_handle,
  120. uint8_t dialogtoken, uint16_t tid, uint16_t batimeout,
  121. uint16_t buffersize, uint16_t startseqnum);
  122. extern void dp_addba_responsesetup_wifi3(void *peer_handle, uint8_t tid,
  123. uint8_t *dialogtoken, uint16_t *statuscode,
  124. uint16_t *buffersize, uint16_t *batimeout);
  125. extern int dp_delba_process_wifi3(void *peer_handle,
  126. int tid, uint16_t reasoncode);
  127. extern int dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid,
  128. uint32_t ba_window_size, uint32_t start_seq);
  129. extern QDF_STATUS dp_reo_send_cmd(struct dp_soc *soc,
  130. enum hal_reo_cmd_type type, struct hal_reo_cmd_params *params,
  131. void (*callback_fn), void *data);
  132. extern void dp_reo_status_ring_handler(struct dp_soc *soc);
  133. int dp_print_host_stats(struct cdp_vdev *vdev_handle,
  134. struct ol_txrx_stats_req *req, enum cdp_host_txrx_stats type);
  135. void dp_print_pdev_tx_stats(struct dp_pdev *pdev);
  136. void dp_print_pdev_rx_stats(struct dp_pdev *pdev);
  137. void dp_print_soc_tx_stats(struct dp_soc *soc);
  138. void dp_print_soc_rx_stats(struct dp_soc *soc);
  139. void dp_txrx_host_stats_clr(struct dp_vdev *vdev);
  140. void dp_print_rx_rates(struct dp_vdev *vdev);
  141. void dp_print_tx_rates(struct dp_vdev *vdev);
  142. #endif /* #ifndef _DP_INTERNAL_H_ */