1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2018 Oracle. All rights reserved.
5 * Trace point definitions for the "rpcgss" subsystem.
9 #define TRACE_SYSTEM rpcgss
11 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_RPCGSS_H
14 #include <linux/tracepoint.h>
17 ** GSS-API related trace events
20 TRACE_DEFINE_ENUM(GSS_S_BAD_MECH
);
21 TRACE_DEFINE_ENUM(GSS_S_BAD_NAME
);
22 TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE
);
23 TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS
);
24 TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS
);
25 TRACE_DEFINE_ENUM(GSS_S_BAD_SIG
);
26 TRACE_DEFINE_ENUM(GSS_S_NO_CRED
);
27 TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT
);
28 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN
);
29 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL
);
30 TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED
);
31 TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED
);
32 TRACE_DEFINE_ENUM(GSS_S_FAILURE
);
33 TRACE_DEFINE_ENUM(GSS_S_BAD_QOP
);
34 TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED
);
35 TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE
);
36 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT
);
37 TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN
);
38 TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED
);
39 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN
);
40 TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN
);
41 TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN
);
42 TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN
);
44 #define show_gss_status(x) \
45 __print_flags(x, "|", \
46 { GSS_S_BAD_MECH, "GSS_S_BAD_MECH" }, \
47 { GSS_S_BAD_NAME, "GSS_S_BAD_NAME" }, \
48 { GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" }, \
49 { GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" }, \
50 { GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" }, \
51 { GSS_S_BAD_SIG, "GSS_S_BAD_SIG" }, \
52 { GSS_S_NO_CRED, "GSS_S_NO_CRED" }, \
53 { GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" }, \
54 { GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" }, \
55 { GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \
56 { GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \
57 { GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" }, \
58 { GSS_S_FAILURE, "GSS_S_FAILURE" }, \
59 { GSS_S_BAD_QOP, "GSS_S_BAD_QOP" }, \
60 { GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" }, \
61 { GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" }, \
62 { GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" }, \
63 { GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" }, \
64 { GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" }, \
65 { GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" }, \
66 { GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" }, \
67 { GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" }, \
68 { GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" })
71 DECLARE_EVENT_CLASS(rpcgss_gssapi_event
,
73 const struct rpc_task
*task
,
77 TP_ARGS(task
, maj_stat
),
80 __field(unsigned int, task_id
)
81 __field(unsigned int, client_id
)
82 __field(u32
, maj_stat
)
87 __entry
->task_id
= task
->tk_pid
;
88 __entry
->client_id
= task
->tk_client
->cl_clid
;
89 __entry
->maj_stat
= maj_stat
;
92 TP_printk("task:%u@%u maj_stat=%s",
93 __entry
->task_id
, __entry
->client_id
,
94 __entry
->maj_stat
== 0 ?
95 "GSS_S_COMPLETE" : show_gss_status(__entry
->maj_stat
))
98 #define DEFINE_GSSAPI_EVENT(name) \
99 DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \
101 const struct rpc_task *task, \
104 TP_ARGS(task, maj_stat))
106 TRACE_EVENT(rpcgss_import_ctx
,
118 __entry
->status
= status
;
121 TP_printk("status=%d", __entry
->status
)
124 DEFINE_GSSAPI_EVENT(get_mic
);
125 DEFINE_GSSAPI_EVENT(verify_mic
);
126 DEFINE_GSSAPI_EVENT(wrap
);
127 DEFINE_GSSAPI_EVENT(unwrap
);
129 TRACE_EVENT(rpcgss_accept_upcall
,
136 TP_ARGS(xid
, major_status
, minor_status
),
140 __field(u32
, minor_status
)
141 __field(unsigned long, major_status
)
145 __entry
->xid
= be32_to_cpu(xid
);
146 __entry
->minor_status
= minor_status
;
147 __entry
->major_status
= major_status
;
150 TP_printk("xid=0x%08x major_status=%s (0x%08lx) minor_status=%u",
151 __entry
->xid
, __entry
->major_status
== 0 ? "GSS_S_COMPLETE" :
152 show_gss_status(__entry
->major_status
),
153 __entry
->major_status
, __entry
->minor_status
159 ** GSS auth unwrap failures
162 TRACE_EVENT(rpcgss_unwrap_failed
,
164 const struct rpc_task
*task
170 __field(unsigned int, task_id
)
171 __field(unsigned int, client_id
)
175 __entry
->task_id
= task
->tk_pid
;
176 __entry
->client_id
= task
->tk_client
->cl_clid
;
179 TP_printk("task:%u@%u", __entry
->task_id
, __entry
->client_id
)
182 TRACE_EVENT(rpcgss_bad_seqno
,
184 const struct rpc_task
*task
,
189 TP_ARGS(task
, expected
, received
),
192 __field(unsigned int, task_id
)
193 __field(unsigned int, client_id
)
194 __field(u32
, expected
)
195 __field(u32
, received
)
199 __entry
->task_id
= task
->tk_pid
;
200 __entry
->client_id
= task
->tk_client
->cl_clid
;
201 __entry
->expected
= expected
;
202 __entry
->received
= received
;
205 TP_printk("task:%u@%u expected seqno %u, received seqno %u",
206 __entry
->task_id
, __entry
->client_id
,
207 __entry
->expected
, __entry
->received
)
210 TRACE_EVENT(rpcgss_seqno
,
212 const struct rpc_task
*task
218 __field(unsigned int, task_id
)
219 __field(unsigned int, client_id
)
225 const struct rpc_rqst
*rqst
= task
->tk_rqstp
;
227 __entry
->task_id
= task
->tk_pid
;
228 __entry
->client_id
= task
->tk_client
->cl_clid
;
229 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
230 __entry
->seqno
= rqst
->rq_seqno
;
233 TP_printk("task:%u@%u xid=0x%08x seqno=%u",
234 __entry
->task_id
, __entry
->client_id
,
235 __entry
->xid
, __entry
->seqno
)
238 TRACE_EVENT(rpcgss_need_reencode
,
240 const struct rpc_task
*task
,
245 TP_ARGS(task
, seq_xmit
, ret
),
248 __field(unsigned int, task_id
)
249 __field(unsigned int, client_id
)
251 __field(u32
, seq_xmit
)
257 __entry
->task_id
= task
->tk_pid
;
258 __entry
->client_id
= task
->tk_client
->cl_clid
;
259 __entry
->xid
= be32_to_cpu(task
->tk_rqstp
->rq_xid
);
260 __entry
->seq_xmit
= seq_xmit
;
261 __entry
->seqno
= task
->tk_rqstp
->rq_seqno
;
265 TP_printk("task:%u@%u xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
266 __entry
->task_id
, __entry
->client_id
,
267 __entry
->xid
, __entry
->seqno
, __entry
->seq_xmit
,
268 __entry
->ret
? "" : "un")
272 ** gssd upcall related trace events
275 TRACE_EVENT(rpcgss_upcall_msg
,
287 __assign_str(msg
, buf
)
290 TP_printk("msg='%s'", __get_str(msg
))
293 TRACE_EVENT(rpcgss_upcall_result
,
299 TP_ARGS(uid
, result
),
309 __entry
->result
= result
;
312 TP_printk("for uid %u, result=%d", __entry
->uid
, __entry
->result
)
315 TRACE_EVENT(rpcgss_context
,
317 unsigned long expiry
,
319 unsigned int timeout
,
324 TP_ARGS(expiry
, now
, timeout
, len
, data
),
327 __field(unsigned long, expiry
)
328 __field(unsigned long, now
)
329 __field(unsigned int, timeout
)
331 __string(acceptor
, data
)
335 __entry
->expiry
= expiry
;
337 __entry
->timeout
= timeout
;
339 strncpy(__get_str(acceptor
), data
, len
);
342 TP_printk("gc_expiry=%lu now=%lu timeout=%u acceptor=%.*s",
343 __entry
->expiry
, __entry
->now
, __entry
->timeout
,
344 __entry
->len
, __get_str(acceptor
))
349 ** Miscellaneous events
352 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5
);
353 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I
);
354 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P
);
356 #define show_pseudoflavor(x) \
357 __print_symbolic(x, \
358 { RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" }, \
359 { RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" }, \
360 { RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" })
363 TRACE_EVENT(rpcgss_createauth
,
369 TP_ARGS(flavor
, error
),
372 __field(unsigned int, flavor
)
378 __entry
->flavor
= flavor
;
379 __entry
->error
= error
;
382 TP_printk("flavor=%s error=%d",
383 show_pseudoflavor(__entry
->flavor
), __entry
->error
)
386 TRACE_EVENT(rpcgss_oid_to_mech
,
398 __assign_str(oid
, oid
);
401 TP_printk("mech for oid %s was not found", __get_str(oid
))
404 #endif /* _TRACE_RPCGSS_H */
406 #include <trace/define_trace.h>