trace.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* SPDX-License-Identifier: ISC */
  2. /*
  3. * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
  4. */
  5. #if !defined(__MT76_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  6. #define __MT76_TRACE_H
  7. #include <linux/tracepoint.h>
  8. #include "mt76.h"
  9. #undef TRACE_SYSTEM
  10. #define TRACE_SYSTEM mt76
  11. #define MAXNAME 32
  12. #define DEV_ENTRY __array(char, wiphy_name, 32)
  13. #define DEVICE_ASSIGN strlcpy(__entry->wiphy_name, \
  14. wiphy_name(dev->hw->wiphy), MAXNAME)
  15. #define DEV_PR_FMT "%s"
  16. #define DEV_PR_ARG __entry->wiphy_name
  17. #define REG_ENTRY __field(u32, reg) __field(u32, val)
  18. #define REG_ASSIGN __entry->reg = reg; __entry->val = val
  19. #define REG_PR_FMT " %04x=%08x"
  20. #define REG_PR_ARG __entry->reg, __entry->val
  21. #define TXID_ENTRY __field(u8, wcid) __field(u8, pktid)
  22. #define TXID_ASSIGN __entry->wcid = wcid; __entry->pktid = pktid
  23. #define TXID_PR_FMT " [%d:%d]"
  24. #define TXID_PR_ARG __entry->wcid, __entry->pktid
  25. DECLARE_EVENT_CLASS(dev_reg_evt,
  26. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  27. TP_ARGS(dev, reg, val),
  28. TP_STRUCT__entry(
  29. DEV_ENTRY
  30. REG_ENTRY
  31. ),
  32. TP_fast_assign(
  33. DEVICE_ASSIGN;
  34. REG_ASSIGN;
  35. ),
  36. TP_printk(
  37. DEV_PR_FMT REG_PR_FMT,
  38. DEV_PR_ARG, REG_PR_ARG
  39. )
  40. );
  41. DEFINE_EVENT(dev_reg_evt, reg_rr,
  42. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  43. TP_ARGS(dev, reg, val)
  44. );
  45. DEFINE_EVENT(dev_reg_evt, reg_wr,
  46. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  47. TP_ARGS(dev, reg, val)
  48. );
  49. TRACE_EVENT(dev_irq,
  50. TP_PROTO(struct mt76_dev *dev, u32 val, u32 mask),
  51. TP_ARGS(dev, val, mask),
  52. TP_STRUCT__entry(
  53. DEV_ENTRY
  54. __field(u32, val)
  55. __field(u32, mask)
  56. ),
  57. TP_fast_assign(
  58. DEVICE_ASSIGN;
  59. __entry->val = val;
  60. __entry->mask = mask;
  61. ),
  62. TP_printk(
  63. DEV_PR_FMT " %08x & %08x",
  64. DEV_PR_ARG, __entry->val, __entry->mask
  65. )
  66. );
  67. DECLARE_EVENT_CLASS(dev_txid_evt,
  68. TP_PROTO(struct mt76_dev *dev, u8 wcid, u8 pktid),
  69. TP_ARGS(dev, wcid, pktid),
  70. TP_STRUCT__entry(
  71. DEV_ENTRY
  72. TXID_ENTRY
  73. ),
  74. TP_fast_assign(
  75. DEVICE_ASSIGN;
  76. TXID_ASSIGN;
  77. ),
  78. TP_printk(
  79. DEV_PR_FMT TXID_PR_FMT,
  80. DEV_PR_ARG, TXID_PR_ARG
  81. )
  82. );
  83. DEFINE_EVENT(dev_txid_evt, mac_txdone,
  84. TP_PROTO(struct mt76_dev *dev, u8 wcid, u8 pktid),
  85. TP_ARGS(dev, wcid, pktid)
  86. );
  87. #endif
  88. #undef TRACE_INCLUDE_PATH
  89. #define TRACE_INCLUDE_PATH .
  90. #undef TRACE_INCLUDE_FILE
  91. #define TRACE_INCLUDE_FILE trace
  92. #include <trace/define_trace.h>