pktlog_ac_api.h 4.4 KB

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