dfs_debug.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (c) 2008-2011 Atheros Communications Inc.
  3. * Copyright (c) 2011 Neratec Solutions AG
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef ATH9K_DFS_DEBUG_H
  18. #define ATH9K_DFS_DEBUG_H
  19. #include "hw.h"
  20. /**
  21. * struct ath_dfs_stats - DFS Statistics per wiphy
  22. * @pulses_total: pulses reported by HW
  23. * @pulses_no_dfs: pulses wrongly reported as DFS
  24. * @pulses_detected: pulses detected so far
  25. * @datalen_discards: pulses discarded due to invalid datalen
  26. * @rssi_discards: pulses discarded due to invalid RSSI
  27. * @bwinfo_discards: pulses discarded due to invalid BW info
  28. * @pri_phy_errors: pulses reported for primary channel
  29. * @ext_phy_errors: pulses reported for extension channel
  30. * @dc_phy_errors: pulses reported for primary + extension channel
  31. * @pulses_processed: pulses forwarded to detector
  32. * @radar_detected: radars detected
  33. */
  34. struct ath_dfs_stats {
  35. /* pulse stats */
  36. u32 pulses_total;
  37. u32 pulses_no_dfs;
  38. u32 pulses_detected;
  39. u32 datalen_discards;
  40. u32 rssi_discards;
  41. u32 bwinfo_discards;
  42. u32 pri_phy_errors;
  43. u32 ext_phy_errors;
  44. u32 dc_phy_errors;
  45. /* pattern detection stats */
  46. u32 pulses_processed;
  47. u32 radar_detected;
  48. };
  49. /**
  50. * struct ath_dfs_pool_stats - DFS Statistics for global pools
  51. */
  52. struct ath_dfs_pool_stats {
  53. u32 pool_reference;
  54. u32 pulse_allocated;
  55. u32 pulse_alloc_error;
  56. u32 pulse_used;
  57. u32 pseq_allocated;
  58. u32 pseq_alloc_error;
  59. u32 pseq_used;
  60. };
  61. #if defined(CONFIG_ATH9K_DFS_DEBUGFS)
  62. #define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++)
  63. void ath9k_dfs_init_debug(struct ath_softc *sc);
  64. #define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++)
  65. #define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--)
  66. extern struct ath_dfs_pool_stats global_dfs_pool_stats;
  67. #else
  68. #define DFS_STAT_INC(sc, c) do { } while (0)
  69. static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { }
  70. #define DFS_POOL_STAT_INC(c) do { } while (0)
  71. #define DFS_POOL_STAT_DEC(c) do { } while (0)
  72. #endif /* CONFIG_ATH9K_DFS_DEBUGFS */
  73. #endif /* ATH9K_DFS_DEBUG_H */