Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2013 - 2018 Intel Corporation. */
0003 
0004 /* Modeled on trace-events-sample.h */
0005 
0006 /* The trace subsystem name for i40e will be "i40e".
0007  *
0008  * This file is named i40e_trace.h.
0009  *
0010  * Since this include file's name is different from the trace
0011  * subsystem name, we'll have to define TRACE_INCLUDE_FILE at the end
0012  * of this file.
0013  */
0014 #undef TRACE_SYSTEM
0015 #define TRACE_SYSTEM i40e
0016 
0017 /* See trace-events-sample.h for a detailed description of why this
0018  * guard clause is different from most normal include files.
0019  */
0020 #if !defined(_I40E_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
0021 #define _I40E_TRACE_H_
0022 
0023 #include <linux/tracepoint.h>
0024 
0025 /*
0026  * i40e_trace() macro enables shared code to refer to trace points
0027  * like:
0028  *
0029  * trace_i40e{,vf}_example(args...)
0030  *
0031  * ... as:
0032  *
0033  * i40e_trace(example, args...)
0034  *
0035  * ... to resolve to the PF or VF version of the tracepoint without
0036  * ifdefs, and to allow tracepoints to be disabled entirely at build
0037  * time.
0038  *
0039  * Trace point should always be referred to in the driver via this
0040  * macro.
0041  *
0042  * Similarly, i40e_trace_enabled(trace_name) wraps references to
0043  * trace_i40e{,vf}_<trace_name>_enabled() functions.
0044  */
0045 #define _I40E_TRACE_NAME(trace_name) (trace_ ## i40e ## _ ## trace_name)
0046 #define I40E_TRACE_NAME(trace_name) _I40E_TRACE_NAME(trace_name)
0047 
0048 #define i40e_trace(trace_name, args...) I40E_TRACE_NAME(trace_name)(args)
0049 
0050 #define i40e_trace_enabled(trace_name) I40E_TRACE_NAME(trace_name##_enabled)()
0051 
0052 /* Events common to PF and VF. Corresponding versions will be defined
0053  * for both, named trace_i40e_* and trace_i40evf_*. The i40e_trace()
0054  * macro above will select the right trace point name for the driver
0055  * being built from shared code.
0056  */
0057 
0058 /* Events related to a vsi & ring */
0059 DECLARE_EVENT_CLASS(
0060     i40e_tx_template,
0061 
0062     TP_PROTO(struct i40e_ring *ring,
0063          struct i40e_tx_desc *desc,
0064          struct i40e_tx_buffer *buf),
0065 
0066     TP_ARGS(ring, desc, buf),
0067 
0068     /* The convention here is to make the first fields in the
0069      * TP_STRUCT match the TP_PROTO exactly. This enables the use
0070      * of the args struct generated by the tplist tool (from the
0071      * bcc-tools package) to be used for those fields. To access
0072      * fields other than the tracepoint args will require the
0073      * tplist output to be adjusted.
0074      */
0075     TP_STRUCT__entry(
0076         __field(void*, ring)
0077         __field(void*, desc)
0078         __field(void*, buf)
0079         __string(devname, ring->netdev->name)
0080     ),
0081 
0082     TP_fast_assign(
0083         __entry->ring = ring;
0084         __entry->desc = desc;
0085         __entry->buf = buf;
0086         __assign_str(devname, ring->netdev->name);
0087     ),
0088 
0089     TP_printk(
0090         "netdev: %s ring: %p desc: %p buf %p",
0091         __get_str(devname), __entry->ring,
0092         __entry->desc, __entry->buf)
0093 );
0094 
0095 DEFINE_EVENT(
0096     i40e_tx_template, i40e_clean_tx_irq,
0097     TP_PROTO(struct i40e_ring *ring,
0098          struct i40e_tx_desc *desc,
0099          struct i40e_tx_buffer *buf),
0100 
0101     TP_ARGS(ring, desc, buf));
0102 
0103 DEFINE_EVENT(
0104     i40e_tx_template, i40e_clean_tx_irq_unmap,
0105     TP_PROTO(struct i40e_ring *ring,
0106          struct i40e_tx_desc *desc,
0107          struct i40e_tx_buffer *buf),
0108 
0109     TP_ARGS(ring, desc, buf));
0110 
0111 DECLARE_EVENT_CLASS(
0112     i40e_rx_template,
0113 
0114     TP_PROTO(struct i40e_ring *ring,
0115          union i40e_16byte_rx_desc *desc,
0116          struct sk_buff *skb),
0117 
0118     TP_ARGS(ring, desc, skb),
0119 
0120     TP_STRUCT__entry(
0121         __field(void*, ring)
0122         __field(void*, desc)
0123         __field(void*, skb)
0124         __string(devname, ring->netdev->name)
0125     ),
0126 
0127     TP_fast_assign(
0128         __entry->ring = ring;
0129         __entry->desc = desc;
0130         __entry->skb = skb;
0131         __assign_str(devname, ring->netdev->name);
0132     ),
0133 
0134     TP_printk(
0135         "netdev: %s ring: %p desc: %p skb %p",
0136         __get_str(devname), __entry->ring,
0137         __entry->desc, __entry->skb)
0138 );
0139 
0140 DEFINE_EVENT(
0141     i40e_rx_template, i40e_clean_rx_irq,
0142     TP_PROTO(struct i40e_ring *ring,
0143          union i40e_16byte_rx_desc *desc,
0144          struct sk_buff *skb),
0145 
0146     TP_ARGS(ring, desc, skb));
0147 
0148 DEFINE_EVENT(
0149     i40e_rx_template, i40e_clean_rx_irq_rx,
0150     TP_PROTO(struct i40e_ring *ring,
0151          union i40e_16byte_rx_desc *desc,
0152          struct sk_buff *skb),
0153 
0154     TP_ARGS(ring, desc, skb));
0155 
0156 DECLARE_EVENT_CLASS(
0157     i40e_xmit_template,
0158 
0159     TP_PROTO(struct sk_buff *skb,
0160          struct i40e_ring *ring),
0161 
0162     TP_ARGS(skb, ring),
0163 
0164     TP_STRUCT__entry(
0165         __field(void*, skb)
0166         __field(void*, ring)
0167         __string(devname, ring->netdev->name)
0168     ),
0169 
0170     TP_fast_assign(
0171         __entry->skb = skb;
0172         __entry->ring = ring;
0173         __assign_str(devname, ring->netdev->name);
0174     ),
0175 
0176     TP_printk(
0177         "netdev: %s skb: %p ring: %p",
0178         __get_str(devname), __entry->skb,
0179         __entry->ring)
0180 );
0181 
0182 DEFINE_EVENT(
0183     i40e_xmit_template, i40e_xmit_frame_ring,
0184     TP_PROTO(struct sk_buff *skb,
0185          struct i40e_ring *ring),
0186 
0187     TP_ARGS(skb, ring));
0188 
0189 DEFINE_EVENT(
0190     i40e_xmit_template, i40e_xmit_frame_ring_drop,
0191     TP_PROTO(struct sk_buff *skb,
0192          struct i40e_ring *ring),
0193 
0194     TP_ARGS(skb, ring));
0195 
0196 /* Events unique to the PF. */
0197 
0198 #endif /* _I40E_TRACE_H_ */
0199 /* This must be outside ifdef _I40E_TRACE_H */
0200 
0201 /* This trace include file is not located in the .../include/trace
0202  * with the kernel tracepoint definitions, because we're a loadable
0203  * module.
0204  */
0205 #undef TRACE_INCLUDE_PATH
0206 #define TRACE_INCLUDE_PATH .
0207 #undef TRACE_INCLUDE_FILE
0208 #define TRACE_INCLUDE_FILE i40e_trace
0209 #include <trace/define_trace.h>