dpaa_eth_trace.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* Copyright 2013-2015 Freescale Semiconductor Inc.
  2. *
  3. * Redistribution and use in source and binary forms, with or without
  4. * modification, are permitted provided that the following conditions are met:
  5. * * Redistributions of source code must retain the above copyright
  6. * notice, this list of conditions and the following disclaimer.
  7. * * Redistributions in binary form must reproduce the above copyright
  8. * notice, this list of conditions and the following disclaimer in the
  9. * documentation and/or other materials provided with the distribution.
  10. * * Neither the name of Freescale Semiconductor nor the
  11. * names of its contributors may be used to endorse or promote products
  12. * derived from this software without specific prior written permission.
  13. *
  14. *
  15. * ALTERNATIVELY, this software may be distributed under the terms of the
  16. * GNU General Public License ("GPL") as published by the Free Software
  17. * Foundation, either version 2 of that License or (at your option) any
  18. * later version.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
  21. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  22. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23. * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
  24. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  25. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  26. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  27. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. #undef TRACE_SYSTEM
  32. #define TRACE_SYSTEM dpaa_eth
  33. #if !defined(_DPAA_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  34. #define _DPAA_ETH_TRACE_H
  35. #include <linux/skbuff.h>
  36. #include <linux/netdevice.h>
  37. #include "dpaa_eth.h"
  38. #include <linux/tracepoint.h>
  39. #define fd_format_name(format) { qm_fd_##format, #format }
  40. #define fd_format_list \
  41. fd_format_name(contig), \
  42. fd_format_name(sg)
  43. /* This is used to declare a class of events.
  44. * individual events of this type will be defined below.
  45. */
  46. /* Store details about a frame descriptor and the FQ on which it was
  47. * transmitted/received.
  48. */
  49. DECLARE_EVENT_CLASS(dpaa_eth_fd,
  50. /* Trace function prototype */
  51. TP_PROTO(struct net_device *netdev,
  52. struct qman_fq *fq,
  53. const struct qm_fd *fd),
  54. /* Repeat argument list here */
  55. TP_ARGS(netdev, fq, fd),
  56. /* A structure containing the relevant information we want to record.
  57. * Declare name and type for each normal element, name, type and size
  58. * for arrays. Use __string for variable length strings.
  59. */
  60. TP_STRUCT__entry(
  61. __field(u32, fqid)
  62. __field(u64, fd_addr)
  63. __field(u8, fd_format)
  64. __field(u16, fd_offset)
  65. __field(u32, fd_length)
  66. __field(u32, fd_status)
  67. __string(name, netdev->name)
  68. ),
  69. /* The function that assigns values to the above declared fields */
  70. TP_fast_assign(
  71. __entry->fqid = fq->fqid;
  72. __entry->fd_addr = qm_fd_addr_get64(fd);
  73. __entry->fd_format = qm_fd_get_format(fd);
  74. __entry->fd_offset = qm_fd_get_offset(fd);
  75. __entry->fd_length = qm_fd_get_length(fd);
  76. __entry->fd_status = fd->status;
  77. __assign_str(name, netdev->name);
  78. ),
  79. /* This is what gets printed when the trace event is triggered */
  80. TP_printk("[%s] fqid=%d, fd: addr=0x%llx, format=%s, off=%u, len=%u, status=0x%08x",
  81. __get_str(name), __entry->fqid, __entry->fd_addr,
  82. __print_symbolic(__entry->fd_format, fd_format_list),
  83. __entry->fd_offset, __entry->fd_length, __entry->fd_status)
  84. );
  85. /* Now declare events of the above type. Format is:
  86. * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class
  87. */
  88. /* Tx (egress) fd */
  89. DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_fd,
  90. TP_PROTO(struct net_device *netdev,
  91. struct qman_fq *fq,
  92. const struct qm_fd *fd),
  93. TP_ARGS(netdev, fq, fd)
  94. );
  95. /* Rx fd */
  96. DEFINE_EVENT(dpaa_eth_fd, dpaa_rx_fd,
  97. TP_PROTO(struct net_device *netdev,
  98. struct qman_fq *fq,
  99. const struct qm_fd *fd),
  100. TP_ARGS(netdev, fq, fd)
  101. );
  102. /* Tx confirmation fd */
  103. DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_conf_fd,
  104. TP_PROTO(struct net_device *netdev,
  105. struct qman_fq *fq,
  106. const struct qm_fd *fd),
  107. TP_ARGS(netdev, fq, fd)
  108. );
  109. /* If only one event of a certain type needs to be declared, use TRACE_EVENT().
  110. * The syntax is the same as for DECLARE_EVENT_CLASS().
  111. */
  112. #endif /* _DPAA_ETH_TRACE_H */
  113. /* This must be outside ifdef _DPAA_ETH_TRACE_H */
  114. #undef TRACE_INCLUDE_PATH
  115. #define TRACE_INCLUDE_PATH .
  116. #undef TRACE_INCLUDE_FILE
  117. #define TRACE_INCLUDE_FILE dpaa_eth_trace
  118. #include <trace/define_trace.h>