pktlog_ac_api.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (c) 2012-2014, 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. * The file is used to define structures that are shared between
  28. * kernel space and user space pktlog application.
  29. */
  30. #ifndef _PKTLOG_AC_API_
  31. #define _PKTLOG_AC_API_
  32. #ifndef REMOVE_PKT_LOG
  33. /**
  34. * @typedef ol_pktlog_dev_handle
  35. * @brief opaque handle for pktlog device object
  36. */
  37. struct ol_pktlog_dev_t;
  38. typedef struct ol_pktlog_dev_t *ol_pktlog_dev_handle;
  39. /**
  40. * @typedef hif_opaque_softc_handle
  41. * @brief opaque handle for hif_opaque_softc
  42. */
  43. struct hif_opaque_softc;
  44. typedef struct hif_opaque_softc *hif_opaque_softc_handle;
  45. enum pktlog_callback_regtype {
  46. PKTLOG_DEFAULT_CALLBACK_REGISTRATION,
  47. PKTLOG_LITE_CALLBACK_REGISTRATION
  48. };
  49. /**
  50. * @typedef net_device_handle
  51. * @brief opaque handle linux phy device object
  52. */
  53. struct net_device;
  54. typedef struct net_device *net_device_handle;
  55. struct pktlog_dev_t;
  56. void pktlog_sethandle(struct pktlog_dev_t **pl_handle,
  57. hif_opaque_softc_handle scn);
  58. void *get_txrx_context(void);
  59. struct pktlog_dev_t *get_pktlog_handle(void);
  60. void pktlog_set_callback_regtype(enum pktlog_callback_regtype callback_type);
  61. /* Packet log state information */
  62. #ifndef _PKTLOG_INFO
  63. #define _PKTLOG_INFO
  64. /**
  65. * enum ath_pktlog_state - pktlog status
  66. * @PKTLOG_OPR_IN_PROGRESS : pktlog command in progress
  67. * @PKTLOG_OPR_IN_PROGRESS_READ_START: pktlog read is issued
  68. * @PKTLOG_OPR_IN_PROGRESS_READ_START_PKTLOG_DISABLED:
  69. * as part of pktlog read, pktlog is disabled
  70. * @PKTLOG_OPR_IN_PROGRESS_READ_COMPLETE:
  71. * as part of read, till pktlog read is complete
  72. * @PKTLOG_OPR_IN_PROGRESS_CLEARBUFF_COMPLETE:
  73. * as part of read, pktlog clear buffer is done
  74. * @PKTLOG_OPR_NOT_IN_PROGRESS: no pktlog command in progress
  75. */
  76. enum ath_pktlog_state {
  77. PKTLOG_OPR_IN_PROGRESS = 0,
  78. PKTLOG_OPR_IN_PROGRESS_READ_START,
  79. PKTLOG_OPR_IN_PROGRESS_READ_START_PKTLOG_DISABLED,
  80. PKTLOG_OPR_IN_PROGRESS_READ_COMPLETE,
  81. PKTLOG_OPR_IN_PROGRESS_CLEARBUFF_COMPLETE,
  82. PKTLOG_OPR_NOT_IN_PROGRESS
  83. };
  84. struct ath_pktlog_info {
  85. struct ath_pktlog_buf *buf;
  86. uint32_t log_state;
  87. uint32_t saved_state;
  88. uint32_t options;
  89. /* Initial saved state: It will save the log state in pktlog
  90. * open and used in pktlog release after
  91. * pktlog read is complete.
  92. */
  93. uint32_t init_saved_state;
  94. enum ath_pktlog_state curr_pkt_state;
  95. /* Size of buffer in bytes */
  96. int32_t buf_size;
  97. spinlock_t log_lock;
  98. struct mutex pktlog_mutex;
  99. /* Threshold of TCP SACK packets for triggered stop */
  100. int sack_thr;
  101. /* # of tail packets to log after triggered stop */
  102. int tail_length;
  103. /* throuput threshold in bytes for triggered stop */
  104. uint32_t thruput_thresh;
  105. /* (aggregated or single) packet size in bytes */
  106. uint32_t pktlen;
  107. /* a temporary variable for counting TX throughput only */
  108. /* PER threshold for triggered stop, 10 for 10%, range [1, 99] */
  109. uint32_t per_thresh;
  110. /* Phyerr threshold for triggered stop */
  111. uint32_t phyerr_thresh;
  112. /* time period for counting trigger parameters, in milisecond */
  113. uint32_t trigger_interval;
  114. uint32_t start_time_thruput;
  115. uint32_t start_time_per;
  116. };
  117. #endif /* _PKTLOG_INFO */
  118. #else /* REMOVE_PKT_LOG */
  119. typedef void *pktlog_dev_handle;
  120. #define pktlog_sethandle(pl_handle, scn) \
  121. do { \
  122. (void)pl_handle; \
  123. (void)scn; \
  124. } while (0)
  125. #define ol_pl_set_name(dev) \
  126. do { \
  127. (void)scn; \
  128. (void)dev; \
  129. } while (0)
  130. #endif /* REMOVE_PKT_LOG */
  131. #endif /* _PKTLOG_AC_API_ */