dp_rate_stats_pub.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright (c) 2019 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * @file: dp_rate_stats_pub.h
  20. * @breief: Define peer rate statistics related objects and APIs
  21. * accessed required for user space tools
  22. */
  23. #ifndef _DP_RATE_STATS_UAPI_
  24. #define _DP_RATE_STATS_UAPI_
  25. #define WLANSTATS_CACHE_SIZE 10
  26. #define MAX_RSSI_ANT 4
  27. #define MAX_RSSI_HT 4
  28. #define WLAN_DATA_TID_MAX 8
  29. #define WLAN_MAC_ADDR_LEN 6
  30. #define WLANSTATS_RSSI_OFFSET 8
  31. #define WLANSTATS_RSSI_MASK 0xff
  32. #define WLANSTATS_RSSI_MAX 0x80
  33. #ifndef __KERNEL__
  34. #define qdf_ewma_tx_lag int
  35. #define qdf_ewma_rx_rssi int
  36. #else
  37. #include <cdp_txrx_cmn_struct.h>
  38. QDF_DECLARE_EWMA(rx_rssi, 1024, 8)
  39. #endif
  40. /**
  41. * enum cdp_peer_rate_stats_cmd -
  42. * used by app to get specific stats
  43. */
  44. enum wlan_peer_rate_stats_cmd {
  45. DP_PEER_RX_RATE_STATS,
  46. DP_PEER_TX_RATE_STATS,
  47. DP_PEER_SOJOURN_STATS,
  48. };
  49. /** struct wlan_tx_rate_stats - Tx packet rate info
  50. * @rix: Rate index derived from nss, mcs, preamble, ht, sgi
  51. * @rate: Data rate in kbps
  52. * @mpdu_success: success mpdus count
  53. * @mpdu_attempts: attempt mpdus count
  54. * @num_ppdus: ppdu count
  55. */
  56. struct wlan_tx_rate_stats {
  57. uint32_t rix;
  58. uint32_t rate;
  59. uint32_t mpdu_success;
  60. uint32_t mpdu_attempts;
  61. uint32_t num_ppdus;
  62. };
  63. /** struct wlan_rx_rate_stats - Rx rate packet info
  64. * @rix: Rate index derived from nss, mcs, preamble, ht, sgi
  65. * @rate: Data rate in kbps
  66. * @num_bytes: num of bytes
  67. * @num_msdus: num of msdus
  68. * @num_mpdus: num of mpdus
  69. * @num_ppdus: num of ppdus
  70. * @num_retries: num of retries
  71. * @num_sgi: num of short guard interval
  72. */
  73. struct wlan_rx_rate_stats {
  74. uint32_t rix;
  75. uint32_t rate;
  76. uint32_t num_bytes;
  77. uint32_t num_msdus;
  78. uint32_t num_mpdus;
  79. uint32_t num_ppdus;
  80. uint32_t num_retries;
  81. uint32_t num_sgi;
  82. qdf_ewma_rx_rssi avg_rssi;
  83. qdf_ewma_rx_rssi avg_rssi_ant[MAX_RSSI_ANT][MAX_RSSI_HT];
  84. };
  85. /*
  86. * struct wlan_tx_sojourn_stats - Tx sojourn stats
  87. * @ppdu_seq_id: ppdu_seq_id from tx completion
  88. * @avg_sojourn_msdu: average sojourn msdu time
  89. * @sum_sojourn_msdu: sum sojourn msdu time
  90. * @num_msdu: number of msdus per ppdu
  91. * @cookie: cookie to be used by upper layer
  92. */
  93. struct wlan_tx_sojourn_stats {
  94. uint32_t ppdu_seq_id;
  95. qdf_ewma_tx_lag avg_sojourn_msdu[WLAN_DATA_TID_MAX];
  96. uint32_t sum_sojourn_msdu[WLAN_DATA_TID_MAX];
  97. uint32_t num_msdus[WLAN_DATA_TID_MAX];
  98. void *cookie;
  99. };
  100. /**
  101. * struct wlan_peer_rate_stats_intf - Interface structure to
  102. * flush stats to user spave entity
  103. * @stats: statistics buffer
  104. * @buf_len: buffer len
  105. * @peer_mac: peer mac address
  106. * @stats_type: statistics type
  107. * @cookie: peer cookie
  108. */
  109. struct wlan_peer_rate_stats_intf {
  110. void *stats;
  111. uint32_t buf_len;
  112. uint8_t peer_mac[WLAN_MAC_ADDR_LEN];
  113. uint8_t stats_type;
  114. uint64_t cookie;
  115. };
  116. #endif /* _DP_RATE_STATS_UAPI_ */