pktlog_ac_api.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*
  2. * Copyright (c) 2012-2014, 2016-2018, 2020 The Linux Foundation.
  3. * All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /*
  20. * The file is used to define structures that are shared between
  21. * kernel space and user space pktlog application.
  22. */
  23. #ifndef _PKTLOG_AC_API_
  24. #define _PKTLOG_AC_API_
  25. #ifndef REMOVE_PKT_LOG
  26. /**
  27. * @typedef ol_pktlog_dev_handle
  28. * @brief opaque handle for pktlog device object
  29. */
  30. struct ol_pktlog_dev_t;
  31. /**
  32. * @typedef hif_opaque_softc_handle
  33. * @brief opaque handle for hif_opaque_softc
  34. */
  35. struct hif_opaque_softc;
  36. typedef struct hif_opaque_softc *hif_opaque_softc_handle;
  37. enum pktlog_callback_regtype {
  38. PKTLOG_DEFAULT_CALLBACK_REGISTRATION,
  39. PKTLOG_LITE_CALLBACK_REGISTRATION
  40. };
  41. /**
  42. * @typedef net_device_handle
  43. * @brief opaque handle linux phy device object
  44. */
  45. struct net_device;
  46. typedef struct net_device *net_device_handle;
  47. struct pktlog_dev_t;
  48. void pktlog_sethandle(struct pktlog_dev_t **pl_handle,
  49. hif_opaque_softc_handle scn);
  50. void pktlog_set_pdev_id(struct pktlog_dev_t *pl_dev, uint8_t pdev_id);
  51. void *get_txrx_context(void);
  52. struct pktlog_dev_t *get_pktlog_handle(void);
  53. void pktlog_set_callback_regtype(enum pktlog_callback_regtype callback_type);
  54. /* Packet log state information */
  55. #ifndef _PKTLOG_INFO
  56. #define _PKTLOG_INFO
  57. /**
  58. * enum ath_pktlog_state - pktlog status
  59. * @PKTLOG_OPR_IN_PROGRESS : pktlog command in progress
  60. * @PKTLOG_OPR_IN_PROGRESS_READ_START: pktlog read is issued
  61. * @PKTLOG_OPR_IN_PROGRESS_READ_START_PKTLOG_DISABLED:
  62. * as part of pktlog read, pktlog is disabled
  63. * @PKTLOG_OPR_IN_PROGRESS_READ_COMPLETE:
  64. * as part of read, till pktlog read is complete
  65. * @PKTLOG_OPR_IN_PROGRESS_CLEARBUFF_COMPLETE:
  66. * as part of read, pktlog clear buffer is done
  67. * @PKTLOG_OPR_NOT_IN_PROGRESS: no pktlog command in progress
  68. */
  69. enum ath_pktlog_state {
  70. PKTLOG_OPR_IN_PROGRESS = 0,
  71. PKTLOG_OPR_IN_PROGRESS_READ_START,
  72. PKTLOG_OPR_IN_PROGRESS_READ_START_PKTLOG_DISABLED,
  73. PKTLOG_OPR_IN_PROGRESS_READ_COMPLETE,
  74. PKTLOG_OPR_IN_PROGRESS_CLEARBUFF_COMPLETE,
  75. PKTLOG_OPR_NOT_IN_PROGRESS
  76. };
  77. struct ath_pktlog_info {
  78. struct ath_pktlog_buf *buf;
  79. uint32_t log_state;
  80. uint32_t saved_state;
  81. uint32_t options;
  82. /* Initial saved state: It will save the log state in pktlog
  83. * open and used in pktlog release after
  84. * pktlog read is complete.
  85. */
  86. uint32_t init_saved_state;
  87. enum ath_pktlog_state curr_pkt_state;
  88. /* Size of buffer in bytes */
  89. int32_t buf_size;
  90. qdf_spinlock_t log_lock;
  91. struct mutex pktlog_mutex;
  92. /* Threshold of TCP SACK packets for triggered stop */
  93. int sack_thr;
  94. /* # of tail packets to log after triggered stop */
  95. int tail_length;
  96. /* throuput threshold in bytes for triggered stop */
  97. uint32_t thruput_thresh;
  98. /* (aggregated or single) packet size in bytes */
  99. uint32_t pktlen;
  100. /* a temporary variable for counting TX throughput only */
  101. /* PER threshold for triggered stop, 10 for 10%, range [1, 99] */
  102. uint32_t per_thresh;
  103. /* Phyerr threshold for triggered stop */
  104. uint32_t phyerr_thresh;
  105. /* time period for counting trigger parameters, in milisecond */
  106. uint32_t trigger_interval;
  107. uint32_t start_time_thruput;
  108. uint32_t start_time_per;
  109. };
  110. #endif /* _PKTLOG_INFO */
  111. #else /* REMOVE_PKT_LOG */
  112. typedef void *pktlog_dev_handle;
  113. #define pktlog_set_pdev_id(pl_dev, pdev_id) \
  114. do { \
  115. (void)pl_dev; \
  116. (void)pdev_id; \
  117. } while (0)
  118. #define pktlog_sethandle(pl_handle, scn) \
  119. do { \
  120. (void)pl_handle; \
  121. (void)scn; \
  122. } while (0)
  123. #define ol_pl_set_name(dev) \
  124. do { \
  125. (void)scn; \
  126. (void)dev; \
  127. } while (0)
  128. #endif /* REMOVE_PKT_LOG */
  129. #endif /* _PKTLOG_AC_API_ */