usb_trace.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* SPDX-License-Identifier: ISC */
  2. /*
  3. * Copyright (C) 2018 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  4. */
  5. #if !defined(__MT76_USB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  6. #define __MT76_USB_TRACE_H
  7. #include <linux/tracepoint.h>
  8. #include "mt76.h"
  9. #undef TRACE_SYSTEM
  10. #define TRACE_SYSTEM mt76_usb
  11. #define MAXNAME 32
  12. #define DEV_ENTRY __array(char, wiphy_name, 32)
  13. #define DEV_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 "reg:0x%04x=0x%08x"
  20. #define REG_PR_ARG __entry->reg, __entry->val
  21. DECLARE_EVENT_CLASS(dev_reg_evt,
  22. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  23. TP_ARGS(dev, reg, val),
  24. TP_STRUCT__entry(
  25. DEV_ENTRY
  26. REG_ENTRY
  27. ),
  28. TP_fast_assign(
  29. DEV_ASSIGN;
  30. REG_ASSIGN;
  31. ),
  32. TP_printk(
  33. DEV_PR_FMT REG_PR_FMT,
  34. DEV_PR_ARG, REG_PR_ARG
  35. )
  36. );
  37. DEFINE_EVENT(dev_reg_evt, usb_reg_rr,
  38. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  39. TP_ARGS(dev, reg, val)
  40. );
  41. DEFINE_EVENT(dev_reg_evt, usb_reg_wr,
  42. TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
  43. TP_ARGS(dev, reg, val)
  44. );
  45. DECLARE_EVENT_CLASS(urb_transfer,
  46. TP_PROTO(struct mt76_dev *dev, struct urb *u),
  47. TP_ARGS(dev, u),
  48. TP_STRUCT__entry(
  49. DEV_ENTRY __field(unsigned int, pipe) __field(u32, len)
  50. ),
  51. TP_fast_assign(
  52. DEV_ASSIGN;
  53. __entry->pipe = u->pipe;
  54. __entry->len = u->transfer_buffer_length;
  55. ),
  56. TP_printk(DEV_PR_FMT "p:%08x len:%u",
  57. DEV_PR_ARG, __entry->pipe, __entry->len)
  58. );
  59. DEFINE_EVENT(urb_transfer, submit_urb,
  60. TP_PROTO(struct mt76_dev *dev, struct urb *u),
  61. TP_ARGS(dev, u)
  62. );
  63. DEFINE_EVENT(urb_transfer, rx_urb,
  64. TP_PROTO(struct mt76_dev *dev, struct urb *u),
  65. TP_ARGS(dev, u)
  66. );
  67. #endif
  68. #undef TRACE_INCLUDE_PATH
  69. #define TRACE_INCLUDE_PATH .
  70. #undef TRACE_INCLUDE_FILE
  71. #define TRACE_INCLUDE_FILE usb_trace
  72. #include <trace/define_trace.h>