Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / trace / events / rpcgss.h
blobb0b6300a0cabdbaf1c08460a474aaf092b548e53
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (c) 2018 Oracle. All rights reserved.
5 * Trace point definitions for the "rpcgss" subsystem.
6 */
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM rpcgss
11 #if !defined(_TRACE_RPCGSS_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_RPCGSS_H
14 #include <linux/tracepoint.h>
16 #include <trace/misc/sunrpc.h>
18 /**
19 ** GSS-API related trace events
20 **/
22 TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE);
23 TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY);
24 TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY);
26 #define show_gss_service(x) \
27 __print_symbolic(x, \
28 { RPC_GSS_SVC_NONE, "none" }, \
29 { RPC_GSS_SVC_INTEGRITY, "integrity" }, \
30 { RPC_GSS_SVC_PRIVACY, "privacy" })
32 TRACE_DEFINE_ENUM(GSS_S_BAD_MECH);
33 TRACE_DEFINE_ENUM(GSS_S_BAD_NAME);
34 TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE);
35 TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS);
36 TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS);
37 TRACE_DEFINE_ENUM(GSS_S_BAD_SIG);
38 TRACE_DEFINE_ENUM(GSS_S_NO_CRED);
39 TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT);
40 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN);
41 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL);
42 TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED);
43 TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED);
44 TRACE_DEFINE_ENUM(GSS_S_FAILURE);
45 TRACE_DEFINE_ENUM(GSS_S_BAD_QOP);
46 TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED);
47 TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE);
48 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT);
49 TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN);
50 TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED);
51 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN);
52 TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN);
53 TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN);
54 TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN);
56 #define show_gss_status(x) \
57 __print_symbolic(x, \
58 { GSS_S_BAD_MECH, "GSS_S_BAD_MECH" }, \
59 { GSS_S_BAD_NAME, "GSS_S_BAD_NAME" }, \
60 { GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" }, \
61 { GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" }, \
62 { GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" }, \
63 { GSS_S_BAD_SIG, "GSS_S_BAD_SIG" }, \
64 { GSS_S_NO_CRED, "GSS_S_NO_CRED" }, \
65 { GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" }, \
66 { GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" }, \
67 { GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \
68 { GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \
69 { GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" }, \
70 { GSS_S_FAILURE, "GSS_S_FAILURE" }, \
71 { GSS_S_BAD_QOP, "GSS_S_BAD_QOP" }, \
72 { GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" }, \
73 { GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" }, \
74 { GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" }, \
75 { GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" }, \
76 { GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" }, \
77 { GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" }, \
78 { GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" }, \
79 { GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" }, \
80 { GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" })
83 DECLARE_EVENT_CLASS(rpcgss_gssapi_event,
84 TP_PROTO(
85 const struct rpc_task *task,
86 u32 maj_stat
89 TP_ARGS(task, maj_stat),
91 TP_STRUCT__entry(
92 __field(unsigned int, task_id)
93 __field(unsigned int, client_id)
94 __field(u32, maj_stat)
98 TP_fast_assign(
99 __entry->task_id = task->tk_pid;
100 __entry->client_id = task->tk_client->cl_clid;
101 __entry->maj_stat = maj_stat;
104 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " maj_stat=%s",
105 __entry->task_id, __entry->client_id,
106 __entry->maj_stat == 0 ?
107 "GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
110 #define DEFINE_GSSAPI_EVENT(name) \
111 DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \
112 TP_PROTO( \
113 const struct rpc_task *task, \
114 u32 maj_stat \
115 ), \
116 TP_ARGS(task, maj_stat))
118 TRACE_EVENT(rpcgss_import_ctx,
119 TP_PROTO(
120 int status
123 TP_ARGS(status),
125 TP_STRUCT__entry(
126 __field(int, status)
129 TP_fast_assign(
130 __entry->status = status;
133 TP_printk("status=%d", __entry->status)
136 DEFINE_GSSAPI_EVENT(get_mic);
137 DEFINE_GSSAPI_EVENT(verify_mic);
138 DEFINE_GSSAPI_EVENT(wrap);
139 DEFINE_GSSAPI_EVENT(unwrap);
141 DECLARE_EVENT_CLASS(rpcgss_ctx_class,
142 TP_PROTO(
143 const struct gss_cred *gc
146 TP_ARGS(gc),
148 TP_STRUCT__entry(
149 __field(const void *, cred)
150 __field(unsigned long, service)
151 __string(principal, gc->gc_principal)
154 TP_fast_assign(
155 __entry->cred = gc;
156 __entry->service = gc->gc_service;
157 __assign_str(principal);
160 TP_printk("cred=%p service=%s principal='%s'",
161 __entry->cred, show_gss_service(__entry->service),
162 __get_str(principal))
165 #define DEFINE_CTX_EVENT(name) \
166 DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name, \
167 TP_PROTO( \
168 const struct gss_cred *gc \
169 ), \
170 TP_ARGS(gc))
172 DEFINE_CTX_EVENT(init);
173 DEFINE_CTX_EVENT(destroy);
175 DECLARE_EVENT_CLASS(rpcgss_svc_gssapi_class,
176 TP_PROTO(
177 const struct svc_rqst *rqstp,
178 u32 maj_stat
181 TP_ARGS(rqstp, maj_stat),
183 TP_STRUCT__entry(
184 __field(u32, xid)
185 __field(u32, maj_stat)
186 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
189 TP_fast_assign(
190 __entry->xid = __be32_to_cpu(rqstp->rq_xid);
191 __entry->maj_stat = maj_stat;
192 __assign_str(addr);
195 TP_printk("addr=%s xid=0x%08x maj_stat=%s",
196 __get_str(addr), __entry->xid,
197 __entry->maj_stat == 0 ?
198 "GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
201 #define DEFINE_SVC_GSSAPI_EVENT(name) \
202 DEFINE_EVENT(rpcgss_svc_gssapi_class, rpcgss_svc_##name, \
203 TP_PROTO( \
204 const struct svc_rqst *rqstp, \
205 u32 maj_stat \
206 ), \
207 TP_ARGS(rqstp, maj_stat))
209 DEFINE_SVC_GSSAPI_EVENT(wrap);
210 DEFINE_SVC_GSSAPI_EVENT(unwrap);
211 DEFINE_SVC_GSSAPI_EVENT(mic);
212 DEFINE_SVC_GSSAPI_EVENT(get_mic);
214 TRACE_EVENT(rpcgss_svc_wrap_failed,
215 TP_PROTO(
216 const struct svc_rqst *rqstp
219 TP_ARGS(rqstp),
221 TP_STRUCT__entry(
222 __field(u32, xid)
223 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
226 TP_fast_assign(
227 __entry->xid = be32_to_cpu(rqstp->rq_xid);
228 __assign_str(addr);
231 TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
234 TRACE_EVENT(rpcgss_svc_unwrap_failed,
235 TP_PROTO(
236 const struct svc_rqst *rqstp
239 TP_ARGS(rqstp),
241 TP_STRUCT__entry(
242 __field(u32, xid)
243 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
246 TP_fast_assign(
247 __entry->xid = be32_to_cpu(rqstp->rq_xid);
248 __assign_str(addr);
251 TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
254 TRACE_EVENT(rpcgss_svc_seqno_bad,
255 TP_PROTO(
256 const struct svc_rqst *rqstp,
257 u32 expected,
258 u32 received
261 TP_ARGS(rqstp, expected, received),
263 TP_STRUCT__entry(
264 __field(u32, expected)
265 __field(u32, received)
266 __field(u32, xid)
267 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
270 TP_fast_assign(
271 __entry->expected = expected;
272 __entry->received = received;
273 __entry->xid = __be32_to_cpu(rqstp->rq_xid);
274 __assign_str(addr);
277 TP_printk("addr=%s xid=0x%08x expected seqno %u, received seqno %u",
278 __get_str(addr), __entry->xid,
279 __entry->expected, __entry->received)
282 TRACE_EVENT(rpcgss_svc_accept_upcall,
283 TP_PROTO(
284 const struct svc_rqst *rqstp,
285 u32 major_status,
286 u32 minor_status
289 TP_ARGS(rqstp, major_status, minor_status),
291 TP_STRUCT__entry(
292 __field(u32, minor_status)
293 __field(unsigned long, major_status)
294 __field(u32, xid)
295 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
298 TP_fast_assign(
299 __entry->minor_status = minor_status;
300 __entry->major_status = major_status;
301 __entry->xid = be32_to_cpu(rqstp->rq_xid);
302 __assign_str(addr);
305 TP_printk("addr=%s xid=0x%08x major_status=%s (0x%08lx) minor_status=%u",
306 __get_str(addr), __entry->xid,
307 (__entry->major_status == 0) ? "GSS_S_COMPLETE" :
308 show_gss_status(__entry->major_status),
309 __entry->major_status, __entry->minor_status
313 TRACE_EVENT(rpcgss_svc_authenticate,
314 TP_PROTO(
315 const struct svc_rqst *rqstp,
316 const struct rpc_gss_wire_cred *gc
319 TP_ARGS(rqstp, gc),
321 TP_STRUCT__entry(
322 __field(u32, seqno)
323 __field(u32, xid)
324 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
327 TP_fast_assign(
328 __entry->xid = be32_to_cpu(rqstp->rq_xid);
329 __entry->seqno = gc->gc_seq;
330 __assign_str(addr);
333 TP_printk("addr=%s xid=0x%08x seqno=%u", __get_str(addr),
334 __entry->xid, __entry->seqno)
339 ** GSS auth unwrap failures
342 TRACE_EVENT(rpcgss_unwrap_failed,
343 TP_PROTO(
344 const struct rpc_task *task
347 TP_ARGS(task),
349 TP_STRUCT__entry(
350 __field(unsigned int, task_id)
351 __field(unsigned int, client_id)
354 TP_fast_assign(
355 __entry->task_id = task->tk_pid;
356 __entry->client_id = task->tk_client->cl_clid;
359 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER,
360 __entry->task_id, __entry->client_id)
363 TRACE_EVENT(rpcgss_bad_seqno,
364 TP_PROTO(
365 const struct rpc_task *task,
366 u32 expected,
367 u32 received
370 TP_ARGS(task, expected, received),
372 TP_STRUCT__entry(
373 __field(unsigned int, task_id)
374 __field(unsigned int, client_id)
375 __field(u32, expected)
376 __field(u32, received)
379 TP_fast_assign(
380 __entry->task_id = task->tk_pid;
381 __entry->client_id = task->tk_client->cl_clid;
382 __entry->expected = expected;
383 __entry->received = received;
386 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
387 " expected seqno %u, received seqno %u",
388 __entry->task_id, __entry->client_id,
389 __entry->expected, __entry->received)
392 TRACE_EVENT(rpcgss_seqno,
393 TP_PROTO(
394 const struct rpc_task *task
397 TP_ARGS(task),
399 TP_STRUCT__entry(
400 __field(unsigned int, task_id)
401 __field(unsigned int, client_id)
402 __field(u32, xid)
403 __field(u32, seqno)
406 TP_fast_assign(
407 const struct rpc_rqst *rqst = task->tk_rqstp;
409 __entry->task_id = task->tk_pid;
410 __entry->client_id = task->tk_client->cl_clid;
411 __entry->xid = be32_to_cpu(rqst->rq_xid);
412 __entry->seqno = rqst->rq_seqno;
415 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x seqno=%u",
416 __entry->task_id, __entry->client_id,
417 __entry->xid, __entry->seqno)
420 TRACE_EVENT(rpcgss_need_reencode,
421 TP_PROTO(
422 const struct rpc_task *task,
423 u32 seq_xmit,
424 bool ret
427 TP_ARGS(task, seq_xmit, ret),
429 TP_STRUCT__entry(
430 __field(unsigned int, task_id)
431 __field(unsigned int, client_id)
432 __field(u32, xid)
433 __field(u32, seq_xmit)
434 __field(u32, seqno)
435 __field(bool, ret)
438 TP_fast_assign(
439 __entry->task_id = task->tk_pid;
440 __entry->client_id = task->tk_client->cl_clid;
441 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
442 __entry->seq_xmit = seq_xmit;
443 __entry->seqno = task->tk_rqstp->rq_seqno;
444 __entry->ret = ret;
447 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
448 " xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
449 __entry->task_id, __entry->client_id,
450 __entry->xid, __entry->seqno, __entry->seq_xmit,
451 __entry->ret ? "" : "un")
454 TRACE_EVENT(rpcgss_update_slack,
455 TP_PROTO(
456 const struct rpc_task *task,
457 const struct rpc_auth *auth
460 TP_ARGS(task, auth),
462 TP_STRUCT__entry(
463 __field(unsigned int, task_id)
464 __field(unsigned int, client_id)
465 __field(u32, xid)
466 __field(const void *, auth)
467 __field(unsigned int, rslack)
468 __field(unsigned int, ralign)
469 __field(unsigned int, verfsize)
472 TP_fast_assign(
473 __entry->task_id = task->tk_pid;
474 __entry->client_id = task->tk_client->cl_clid;
475 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
476 __entry->auth = auth;
477 __entry->rslack = auth->au_rslack;
478 __entry->ralign = auth->au_ralign;
479 __entry->verfsize = auth->au_verfsize;
482 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
483 " xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n",
484 __entry->task_id, __entry->client_id, __entry->xid,
485 __entry->auth, __entry->rslack, __entry->ralign,
486 __entry->verfsize)
489 DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class,
490 TP_PROTO(
491 const struct svc_rqst *rqstp,
492 u32 seqno
495 TP_ARGS(rqstp, seqno),
497 TP_STRUCT__entry(
498 __field(u32, xid)
499 __field(u32, seqno)
502 TP_fast_assign(
503 __entry->xid = be32_to_cpu(rqstp->rq_xid);
504 __entry->seqno = seqno;
507 TP_printk("xid=0x%08x seqno=%u",
508 __entry->xid, __entry->seqno)
511 #define DEFINE_SVC_SEQNO_EVENT(name) \
512 DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_seqno_##name, \
513 TP_PROTO( \
514 const struct svc_rqst *rqstp, \
515 u32 seqno \
516 ), \
517 TP_ARGS(rqstp, seqno))
519 DEFINE_SVC_SEQNO_EVENT(large);
520 DEFINE_SVC_SEQNO_EVENT(seen);
522 TRACE_EVENT(rpcgss_svc_seqno_low,
523 TP_PROTO(
524 const struct svc_rqst *rqstp,
525 u32 seqno,
526 u32 min,
527 u32 max
530 TP_ARGS(rqstp, seqno, min, max),
532 TP_STRUCT__entry(
533 __field(u32, xid)
534 __field(u32, seqno)
535 __field(u32, min)
536 __field(u32, max)
539 TP_fast_assign(
540 __entry->xid = be32_to_cpu(rqstp->rq_xid);
541 __entry->seqno = seqno;
542 __entry->min = min;
543 __entry->max = max;
546 TP_printk("xid=0x%08x seqno=%u window=[%u..%u]",
547 __entry->xid, __entry->seqno, __entry->min, __entry->max)
551 ** gssd upcall related trace events
554 TRACE_EVENT(rpcgss_upcall_msg,
555 TP_PROTO(
556 const char *buf
559 TP_ARGS(buf),
561 TP_STRUCT__entry(
562 __string(msg, buf)
565 TP_fast_assign(
566 __assign_str(msg);
569 TP_printk("msg='%s'", __get_str(msg))
572 TRACE_EVENT(rpcgss_upcall_result,
573 TP_PROTO(
574 u32 uid,
575 int result
578 TP_ARGS(uid, result),
580 TP_STRUCT__entry(
581 __field(u32, uid)
582 __field(int, result)
586 TP_fast_assign(
587 __entry->uid = uid;
588 __entry->result = result;
591 TP_printk("for uid %u, result=%d", __entry->uid, __entry->result)
594 TRACE_EVENT(rpcgss_context,
595 TP_PROTO(
596 u32 window_size,
597 unsigned long expiry,
598 unsigned long now,
599 unsigned int timeout,
600 unsigned int len,
601 const u8 *data
604 TP_ARGS(window_size, expiry, now, timeout, len, data),
606 TP_STRUCT__entry(
607 __field(unsigned long, expiry)
608 __field(unsigned long, now)
609 __field(unsigned int, timeout)
610 __field(u32, window_size)
611 __field(int, len)
612 __string_len(acceptor, data, len)
615 TP_fast_assign(
616 __entry->expiry = expiry;
617 __entry->now = now;
618 __entry->timeout = timeout;
619 __entry->window_size = window_size;
620 __entry->len = len;
621 __assign_str(acceptor);
624 TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
625 __entry->window_size, __entry->expiry, __entry->now,
626 __entry->timeout, __entry->len, __get_str(acceptor))
631 ** Miscellaneous events
634 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5);
635 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I);
636 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P);
638 #define show_pseudoflavor(x) \
639 __print_symbolic(x, \
640 { RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" }, \
641 { RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" }, \
642 { RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" })
645 TRACE_EVENT(rpcgss_createauth,
646 TP_PROTO(
647 unsigned int flavor,
648 int error
651 TP_ARGS(flavor, error),
653 TP_STRUCT__entry(
654 __field(unsigned int, flavor)
655 __field(int, error)
659 TP_fast_assign(
660 __entry->flavor = flavor;
661 __entry->error = error;
664 TP_printk("flavor=%s error=%d",
665 show_pseudoflavor(__entry->flavor), __entry->error)
668 TRACE_EVENT(rpcgss_oid_to_mech,
669 TP_PROTO(
670 const char *oid
673 TP_ARGS(oid),
675 TP_STRUCT__entry(
676 __string(oid, oid)
679 TP_fast_assign(
680 __assign_str(oid);
683 TP_printk("mech for oid %s was not found", __get_str(oid))
686 #endif /* _TRACE_RPCGSS_H */
688 #include <trace/define_trace.h>