pktlog_ac_api.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. /**
  46. * @typedef net_device_handle
  47. * @brief opaque handle linux phy device object
  48. */
  49. struct net_device;
  50. typedef struct net_device *net_device_handle;
  51. void ol_pl_sethandle(ol_pktlog_dev_handle *pl_handle,
  52. hif_opaque_softc_handle scn);
  53. /* Packet log state information */
  54. #ifndef _PKTLOG_INFO
  55. #define _PKTLOG_INFO
  56. /**
  57. * enum ath_pktlog_state - pktlog status
  58. * @PKTLOG_OPR_IN_PROGRESS : pktlog command in progress
  59. * @PKTLOG_OPR_IN_PROGRESS_READ_START: pktlog read is issued
  60. * @PKTLOG_OPR_IN_PROGRESS_READ_START_PKTLOG_DISABLED:
  61. * as part of pktlog read, pktlog is disabled
  62. * @PKTLOG_OPR_IN_PROGRESS_READ_COMPLETE:
  63. * as part of read, till pktlog read is complete
  64. * @PKTLOG_OPR_IN_PROGRESS_CLEARBUFF_COMPLETE:
  65. * as part of read, pktlog clear buffer is done
  66. * @PKTLOG_OPR_NOT_IN_PROGRESS: no pktlog command in progress
  67. */
  68. enum ath_pktlog_state {
  69. PKTLOG_OPR_IN_PROGRESS = 0,
  70. PKTLOG_OPR_IN_PROGRESS_READ_START,
  71. PKTLOG_OPR_IN_PROGRESS_READ_START_PKTLOG_DISABLED,
  72. PKTLOG_OPR_IN_PROGRESS_READ_COMPLETE,
  73. PKTLOG_OPR_IN_PROGRESS_CLEARBUFF_COMPLETE,
  74. PKTLOG_OPR_NOT_IN_PROGRESS
  75. };
  76. struct ath_pktlog_info {
  77. struct ath_pktlog_buf *buf;
  78. uint32_t log_state;
  79. uint32_t saved_state;
  80. uint32_t options;
  81. /* Initial saved state: It will save the log state in pktlog
  82. * open and used in pktlog release after
  83. * pktlog read is complete.
  84. */
  85. uint32_t init_saved_state;
  86. enum ath_pktlog_state curr_pkt_state;
  87. /* Size of buffer in bytes */
  88. int32_t buf_size;
  89. spinlock_t log_lock;
  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 *ol_pktlog_dev_handle;
  111. #define ol_pl_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_ */