trace.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #if !defined(__MT76_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  17. #define __MT76_TRACE_H
  18. #include <linux/tracepoint.h>
  19. #include "mt76.h"
  20. #undef TRACE_SYSTEM
  21. #define TRACE_SYSTEM mt76
  22. #define MAXNAME 32
  23. #define DEV_ENTRY __array(char, wiphy_name, 32)
  24. #define DEV_ASSIGN strlcpy(__entry->wiphy_name, wiphy_name(dev->hw->wiphy), MAXNAME)
  25. #define DEV_PR_FMT "%s"
  26. #define DEV_PR_ARG __entry->wiphy_name
  27. #define REG_ENTRY __field(u32, reg) __field(u32, val)
  28. #define REG_ASSIGN __entry->reg = reg; __entry->val = val
  29. #define REG_PR_FMT " %04x=%08x"
  30. #define REG_PR_ARG __entry->reg, __entry->val
  31. DECLARE_EVENT_CLASS(dev_reg_evt,
  32. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  33. TP_ARGS(dev, reg, val),
  34. TP_STRUCT__entry(
  35. DEV_ENTRY
  36. REG_ENTRY
  37. ),
  38. TP_fast_assign(
  39. DEV_ASSIGN;
  40. REG_ASSIGN;
  41. ),
  42. TP_printk(
  43. DEV_PR_FMT REG_PR_FMT,
  44. DEV_PR_ARG, REG_PR_ARG
  45. )
  46. );
  47. DEFINE_EVENT(dev_reg_evt, reg_rr,
  48. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  49. TP_ARGS(dev, reg, val)
  50. );
  51. DEFINE_EVENT(dev_reg_evt, reg_wr,
  52. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  53. TP_ARGS(dev, reg, val)
  54. );
  55. #endif
  56. #undef TRACE_INCLUDE_PATH
  57. #define TRACE_INCLUDE_PATH .
  58. #undef TRACE_INCLUDE_FILE
  59. #define TRACE_INCLUDE_FILE trace
  60. #include <trace/define_trace.h>