htc_credit_history.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) 2018,2020-2021, 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. #ifndef _HTC_CREDIT_HISTORY_H_
  19. #define _HTC_CREDIT_HISTORY_H_
  20. #include "htc_internal.h"
  21. #ifdef FEATURE_HTC_CREDIT_HISTORY
  22. /**
  23. * htc_credit_history_init() - Init helper function
  24. *
  25. * The htc_credit_history_init() function, helps to initialize
  26. * HTC credit history buffers and variable.
  27. *
  28. * Return: None
  29. */
  30. void htc_credit_history_init(void);
  31. /**
  32. * htc_credit_history_deinit() - Deinit helper function
  33. *
  34. * The htc_credit_history_deinit() function, helps to remove
  35. * the HTC credit history buffers from minidump.
  36. *
  37. * Return: None
  38. */
  39. void htc_credit_history_deinit(void);
  40. void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
  41. uint32_t htc_tx_queue_depth);
  42. #ifdef WLAN_HANG_EVENT
  43. /**
  44. * htc_log_hang_credit_history() - Log the credit history into a buffer
  45. * @block: Notifier block
  46. * @data: Private data of the block.
  47. *
  48. * HTC hang event notifier callback inovked when the recovery is triggered
  49. * to log the credit information to understand the reason for recovery.
  50. *
  51. * Return: None
  52. */
  53. void htc_log_hang_credit_history(struct notifier_block *block, void *data);
  54. #else
  55. static inline
  56. void htc_log_hang_credit_history(struct notifier_block *block, void *data)
  57. {
  58. }
  59. #endif
  60. #else /* FEATURE_HTC_CREDIT_HISTORY */
  61. static inline
  62. void htc_credit_history_init(void)
  63. {
  64. }
  65. static inline
  66. void htc_credit_history_deinit(void)
  67. {
  68. }
  69. static inline
  70. void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
  71. uint32_t htc_tx_queue_depth)
  72. { }
  73. #endif /* FEATURE_HTC_CREDIT_HISTORY */
  74. #endif /* _HTC_CREDIT_HISTORY_H_ */