cdp_txrx_hist_struct.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (c) 2020 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. 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. * DOC: cdp_txrx_hist_struct.h
  21. * Define the host data path histogram data types
  22. */
  23. #ifndef _CDP_TXRX_HIST_STRUCT_H_
  24. #define _CDP_TXRX_HIST_STRUCT_H_
  25. #define CDP_RSSI_CHAIN_LEN 8
  26. /**
  27. * enum cdp_hist_bucket_index - Histogram Bucket
  28. * @CDP_HIST_BUCKET_0: Bucket Index 0
  29. * @CDP_HIST_BUCKET_1: Bucket Index 1
  30. * @CDP_HIST_BUCKET_2: Bucket Index 2
  31. * @CDP_HIST_BUCKET_3: Bucket Index 3
  32. * @CDP_HIST_BUCKET_4: Bucket Index 4
  33. * @CDP_HIST_BUCKET_5: Bucket Index 5
  34. * @CDP_HIST_BUCKET_6: Bucket Index 6
  35. * @CDP_HIST_BUCKET_7: Bucket Index 7
  36. * @CDP_HIST_BUCKET_8: Bucket Index 8
  37. * @CDP_HIST_BUCKET_9: Bucket Index 9
  38. * @CDP_HIST_BUCKET_10: Bucket Index 10
  39. * @CDP_HIST_BUCKET_11: Bucket Index 11
  40. * @CDP_HIST_BUCKET_12: Bucket Index 12
  41. * @CDP_HIST_BUCKET_MAX: Max enumeration
  42. */
  43. enum cdp_hist_bucket_index {
  44. CDP_HIST_BUCKET_0,
  45. CDP_HIST_BUCKET_1,
  46. CDP_HIST_BUCKET_2,
  47. CDP_HIST_BUCKET_3,
  48. CDP_HIST_BUCKET_4,
  49. CDP_HIST_BUCKET_5,
  50. CDP_HIST_BUCKET_6,
  51. CDP_HIST_BUCKET_7,
  52. CDP_HIST_BUCKET_8,
  53. CDP_HIST_BUCKET_9,
  54. CDP_HIST_BUCKET_10,
  55. CDP_HIST_BUCKET_11,
  56. CDP_HIST_BUCKET_12,
  57. CDP_HIST_BUCKET_MAX,
  58. };
  59. /**
  60. * enum cdp_hist_types - Histogram Types
  61. * @CDP_HIST_TYPE_SW_ENQEUE_DELAY: From stack to HW enqueue delay
  62. * @CDP_HIST_TYPE_HW_COMP_DELAY: From HW enqueue to completion delay
  63. * @CDP_HIST_TYPE_REAP_STACK: Rx HW reap to stack deliver delay
  64. * @CDP_HIST_TYPE_HW_TX_COMP_DELAY: Tx completion delay based on the timestamp
  65. * provided by HW
  66. * @CDP_HIST_TYPE_DELAY_PERCENTILE: Tx completion delay based on the perctile
  67. * @CDP_HIST_TYPE_MAX: Max enumeration
  68. */
  69. enum cdp_hist_types {
  70. CDP_HIST_TYPE_SW_ENQEUE_DELAY,
  71. CDP_HIST_TYPE_HW_COMP_DELAY,
  72. CDP_HIST_TYPE_REAP_STACK,
  73. CDP_HIST_TYPE_HW_TX_COMP_DELAY,
  74. CDP_HIST_TYPE_DELAY_PERCENTILE,
  75. CDP_HIST_TYPE_MAX,
  76. };
  77. /**
  78. * struct cdp_hist_bucket - Histogram Bucket
  79. * @hist_type: Histogram type
  80. * @freq: Frequency
  81. */
  82. struct cdp_hist_bucket {
  83. enum cdp_hist_types hist_type;
  84. uint64_t freq[CDP_HIST_BUCKET_MAX];
  85. };
  86. /**
  87. * struct cdp_hist_stats - Histogram of a stats type
  88. * @hist: Frequency distribution
  89. * @max: Max frequency
  90. * @min: Minimum frequency
  91. * @avg: Average frequency
  92. */
  93. struct cdp_hist_stats {
  94. struct cdp_hist_bucket hist;
  95. int max;
  96. int min;
  97. int avg;
  98. };
  99. #endif /* _CDP_TXRX_HIST_STRUCT_H_ */