pktlog_ac_api.h 4.2 KB

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