xref: /linux/drivers/net/ethernet/marvell/octeontx2/af/rvu_trace.h (revision 23ca32e4ead48f68e37000f2552b973ef1439acb)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Marvell RVU Admin Function driver
3  *
4  * Copyright (C) 2020 Marvell.
5  *
6  */
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM rvu
10 
11 #if !defined(__RVU_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define __RVU_TRACE_H
13 
14 #include <linux/types.h>
15 #include <linux/tracepoint.h>
16 #include <linux/pci.h>
17 
18 #include "mbox.h"
19 
20 TRACE_EVENT(otx2_msg_alloc,
21 	    TP_PROTO(const struct pci_dev *pdev, u16 id, u64 size, u16 pcifunc),
22 	    TP_ARGS(pdev, id, size, pcifunc),
23 	    TP_STRUCT__entry(__string(dev, pci_name(pdev))
24 			     __field(u16, id)
25 			     __field(u64, size)
26 			     __field(u16, pcifunc)
27 	    ),
28 	    TP_fast_assign(__assign_str(dev);
29 			   __entry->id = id;
30 			   __entry->size = size;
31 			   __entry->pcifunc = pcifunc;
32 	    ),
33 	    TP_printk("[%s] msg:(%s) size:%lld pcifunc:0x%x\n", __get_str(dev),
34 		      otx2_mbox_id2name(__entry->id), __entry->size,
35 		      __entry->pcifunc)
36 );
37 
38 TRACE_EVENT(otx2_msg_send,
39 	    TP_PROTO(const struct pci_dev *pdev, u16 num_msgs, u64 msg_size,
40 		     u16 id, u16 pcifunc),
41 	    TP_ARGS(pdev, num_msgs, msg_size, id, pcifunc),
42 	    TP_STRUCT__entry(__string(dev, pci_name(pdev))
43 			     __field(u16, num_msgs)
44 			     __field(u64, msg_size)
45 			     __field(u16, id)
46 			     __field(u16, pcifunc)
47 	    ),
48 	    TP_fast_assign(__assign_str(dev);
49 			   __entry->num_msgs = num_msgs;
50 			   __entry->msg_size = msg_size;
51 			   __entry->id = id;
52 			   __entry->pcifunc = pcifunc;
53 	    ),
54 	    TP_printk("[%s] sent %d msg(s) of size:%lld msg:(%s) pcifunc:0x%x\n",
55 		      __get_str(dev), __entry->num_msgs, __entry->msg_size,
56 		      otx2_mbox_id2name(__entry->id), __entry->pcifunc)
57 );
58 
59 TRACE_EVENT(otx2_msg_check,
60 	    TP_PROTO(const struct pci_dev *pdev, u16 reqid, u16 rspid, int rc),
61 	    TP_ARGS(pdev, reqid, rspid, rc),
62 	    TP_STRUCT__entry(__string(dev, pci_name(pdev))
63 			     __field(u16, reqid)
64 			     __field(u16, rspid)
65 			     __field(int, rc)
66 	    ),
67 	    TP_fast_assign(__assign_str(dev);
68 			   __entry->reqid = reqid;
69 			   __entry->rspid = rspid;
70 			   __entry->rc = rc;
71 	    ),
72 	    TP_printk("[%s] req->id:0x%x rsp->id:0x%x resp_code:%d\n",
73 		      __get_str(dev), __entry->reqid,
74 		      __entry->rspid, __entry->rc)
75 );
76 
77 TRACE_EVENT(otx2_msg_interrupt,
78 	    TP_PROTO(const struct pci_dev *pdev, const char *msg, u64 intr),
79 	    TP_ARGS(pdev, msg, intr),
80 	    TP_STRUCT__entry(__string(dev, pci_name(pdev))
81 			     __string(str, msg)
82 			     __field(u64, intr)
83 	    ),
84 	    TP_fast_assign(__assign_str(dev);
85 			   __assign_str(str);
86 			   __entry->intr = intr;
87 	    ),
88 	    TP_printk("[%s] mbox interrupt %s (0x%llx)\n", __get_str(dev),
89 		      __get_str(str), __entry->intr)
90 );
91 
92 TRACE_EVENT(otx2_msg_process,
93 	    TP_PROTO(const struct pci_dev *pdev, u16 id, int err, u16 pcifunc),
94 	    TP_ARGS(pdev, id, err, pcifunc),
95 	    TP_STRUCT__entry(__string(dev, pci_name(pdev))
96 			     __field(u16, id)
97 			     __field(int, err)
98 			     __field(u16, pcifunc)
99 	    ),
100 	    TP_fast_assign(__assign_str(dev);
101 			   __entry->id = id;
102 			   __entry->err = err;
103 			   __entry->pcifunc = pcifunc;
104 	    ),
105 	    TP_printk("[%s] msg:(%s) error:%d pcifunc:0x%x\n", __get_str(dev),
106 		      otx2_mbox_id2name(__entry->id),
107 		      __entry->err, __entry->pcifunc)
108 );
109 
110 TRACE_EVENT(otx2_msg_wait_rsp,
111 	    TP_PROTO(const struct pci_dev *pdev),
112 	    TP_ARGS(pdev),
113 	    TP_STRUCT__entry(__string(dev, pci_name(pdev))
114 	    ),
115 	    TP_fast_assign(__assign_str(dev)
116 	    ),
117 	    TP_printk("[%s] timed out while waiting for response\n",
118 		      __get_str(dev))
119 );
120 
121 TRACE_EVENT(otx2_msg_status,
122 	    TP_PROTO(const struct pci_dev *pdev, const char *msg, u16 num_msgs),
123 	    TP_ARGS(pdev, msg, num_msgs),
124 	    TP_STRUCT__entry(__string(dev, pci_name(pdev))
125 			     __string(str, msg)
126 			     __field(u16, num_msgs)
127 	    ),
128 	    TP_fast_assign(__assign_str(dev);
129 			   __assign_str(str);
130 			   __entry->num_msgs = num_msgs;
131 	    ),
132 	    TP_printk("[%s] %s num_msgs:%d\n", __get_str(dev),
133 		      __get_str(str), __entry->num_msgs)
134 );
135 
136 TRACE_EVENT(otx2_parse_dump,
137 	    TP_PROTO(const struct pci_dev *pdev, char *msg, u64 *word),
138 	    TP_ARGS(pdev, msg, word),
139 	    TP_STRUCT__entry(__string(dev, pci_name(pdev))
140 			     __string(str, msg)
141 			     __field(u64, w0)
142 			     __field(u64, w1)
143 			     __field(u64, w2)
144 			     __field(u64, w3)
145 			     __field(u64, w4)
146 			     __field(u64, w5)
147 	    ),
148 	    TP_fast_assign(__assign_str(dev);
149 			   __assign_str(str);
150 			   __entry->w0 = *(word + 0);
151 			   __entry->w1 = *(word + 1);
152 			   __entry->w2 = *(word + 2);
153 			   __entry->w3 = *(word + 3);
154 			   __entry->w4 = *(word + 4);
155 			   __entry->w5 = *(word + 5);
156 	    ),
157 	    TP_printk("[%s] nix parse %s W0:%#llx W1:%#llx W2:%#llx W3:%#llx W4:%#llx W5:%#llx\n",
158 		      __get_str(dev), __get_str(str), __entry->w0, __entry->w1, __entry->w2,
159 		      __entry->w3, __entry->w4, __entry->w5)
160 );
161 
162 #endif /* __RVU_TRACE_H */
163 
164 #undef TRACE_INCLUDE_PATH
165 #define TRACE_INCLUDE_PATH .
166 
167 #undef TRACE_INCLUDE_FILE
168 #define TRACE_INCLUDE_FILE rvu_trace
169 
170 #include <trace/define_trace.h>
171