pktlog_ac_api.h 4.1 KB

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