dpaa_eth_trace.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
  2. /*
  3. * Copyright 2013-2015 Freescale Semiconductor Inc.
  4. */
  5. #undef TRACE_SYSTEM
  6. #define TRACE_SYSTEM dpaa_eth
  7. #if !defined(_DPAA_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  8. #define _DPAA_ETH_TRACE_H
  9. #include <linux/skbuff.h>
  10. #include <linux/netdevice.h>
  11. #include "dpaa_eth.h"
  12. #include <linux/tracepoint.h>
  13. #define fd_format_name(format) { qm_fd_##format, #format }
  14. #define fd_format_list \
  15. fd_format_name(contig), \
  16. fd_format_name(sg)
  17. /* This is used to declare a class of events.
  18. * individual events of this type will be defined below.
  19. */
  20. /* Store details about a frame descriptor and the FQ on which it was
  21. * transmitted/received.
  22. */
  23. DECLARE_EVENT_CLASS(dpaa_eth_fd,
  24. /* Trace function prototype */
  25. TP_PROTO(struct net_device *netdev,
  26. struct qman_fq *fq,
  27. const struct qm_fd *fd),
  28. /* Repeat argument list here */
  29. TP_ARGS(netdev, fq, fd),
  30. /* A structure containing the relevant information we want to record.
  31. * Declare name and type for each normal element, name, type and size
  32. * for arrays. Use __string for variable length strings.
  33. */
  34. TP_STRUCT__entry(
  35. __field(u32, fqid)
  36. __field(u64, fd_addr)
  37. __field(u8, fd_format)
  38. __field(u16, fd_offset)
  39. __field(u32, fd_length)
  40. __field(u32, fd_status)
  41. __string(name, netdev->name)
  42. ),
  43. /* The function that assigns values to the above declared fields */
  44. TP_fast_assign(
  45. __entry->fqid = fq->fqid;
  46. __entry->fd_addr = qm_fd_addr_get64(fd);
  47. __entry->fd_format = qm_fd_get_format(fd);
  48. __entry->fd_offset = qm_fd_get_offset(fd);
  49. __entry->fd_length = qm_fd_get_length(fd);
  50. __entry->fd_status = __be32_to_cpu(fd->status);
  51. __assign_str(name);
  52. ),
  53. /* This is what gets printed when the trace event is triggered */
  54. TP_printk("[%s] fqid=%d, fd: addr=0x%llx, format=%s, off=%u, len=%u, status=0x%08x",
  55. __get_str(name), __entry->fqid, __entry->fd_addr,
  56. __print_symbolic(__entry->fd_format, fd_format_list),
  57. __entry->fd_offset, __entry->fd_length, __entry->fd_status)
  58. );
  59. /* Now declare events of the above type. Format is:
  60. * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class
  61. */
  62. /* Tx (egress) fd */
  63. DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_fd,
  64. TP_PROTO(struct net_device *netdev,
  65. struct qman_fq *fq,
  66. const struct qm_fd *fd),
  67. TP_ARGS(netdev, fq, fd)
  68. );
  69. /* Rx fd */
  70. DEFINE_EVENT(dpaa_eth_fd, dpaa_rx_fd,
  71. TP_PROTO(struct net_device *netdev,
  72. struct qman_fq *fq,
  73. const struct qm_fd *fd),
  74. TP_ARGS(netdev, fq, fd)
  75. );
  76. /* Tx confirmation fd */
  77. DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_conf_fd,
  78. TP_PROTO(struct net_device *netdev,
  79. struct qman_fq *fq,
  80. const struct qm_fd *fd),
  81. TP_ARGS(netdev, fq, fd)
  82. );
  83. /* If only one event of a certain type needs to be declared, use TRACE_EVENT().
  84. * The syntax is the same as for DECLARE_EVENT_CLASS().
  85. */
  86. #endif /* _DPAA_ETH_TRACE_H */
  87. /* This must be outside ifdef _DPAA_ETH_TRACE_H */
  88. #undef TRACE_INCLUDE_PATH
  89. #define TRACE_INCLUDE_PATH .
  90. #undef TRACE_INCLUDE_FILE
  91. #define TRACE_INCLUDE_FILE dpaa_eth_trace
  92. #include <trace/define_trace.h>