WIP FPC-III support
[linux/fpc-iii.git] / include / trace / events / rpcgss.h
blobffdbe6f85da8ba6cccd346642f8f5e0bfaab2517
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_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_RPCGSS_H
14 #include <linux/tracepoint.h>
16 /**
17 ** GSS-API related trace events
18 **/
20 TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE);
21 TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY);
22 TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY);
24 #define show_gss_service(x) \
25 __print_symbolic(x, \
26 { RPC_GSS_SVC_NONE, "none" }, \
27 { RPC_GSS_SVC_INTEGRITY, "integrity" }, \
28 { RPC_GSS_SVC_PRIVACY, "privacy" })
30 TRACE_DEFINE_ENUM(GSS_S_BAD_MECH);
31 TRACE_DEFINE_ENUM(GSS_S_BAD_NAME);
32 TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE);
33 TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS);
34 TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS);
35 TRACE_DEFINE_ENUM(GSS_S_BAD_SIG);
36 TRACE_DEFINE_ENUM(GSS_S_NO_CRED);
37 TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT);
38 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN);
39 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL);
40 TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED);
41 TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED);
42 TRACE_DEFINE_ENUM(GSS_S_FAILURE);
43 TRACE_DEFINE_ENUM(GSS_S_BAD_QOP);
44 TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED);
45 TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE);
46 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT);
47 TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN);
48 TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED);
49 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN);
50 TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN);
51 TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN);
52 TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN);
54 #define show_gss_status(x) \
55 __print_flags(x, "|", \
56 { GSS_S_BAD_MECH, "GSS_S_BAD_MECH" }, \
57 { GSS_S_BAD_NAME, "GSS_S_BAD_NAME" }, \
58 { GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" }, \
59 { GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" }, \
60 { GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" }, \
61 { GSS_S_BAD_SIG, "GSS_S_BAD_SIG" }, \
62 { GSS_S_NO_CRED, "GSS_S_NO_CRED" }, \
63 { GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" }, \
64 { GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" }, \
65 { GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \
66 { GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \
67 { GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" }, \
68 { GSS_S_FAILURE, "GSS_S_FAILURE" }, \
69 { GSS_S_BAD_QOP, "GSS_S_BAD_QOP" }, \
70 { GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" }, \
71 { GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" }, \
72 { GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" }, \
73 { GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" }, \
74 { GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" }, \
75 { GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" }, \
76 { GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" }, \
77 { GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" }, \
78 { GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" })
81 DECLARE_EVENT_CLASS(rpcgss_gssapi_event,
82 TP_PROTO(
83 const struct rpc_task *task,
84 u32 maj_stat
87 TP_ARGS(task, maj_stat),
89 TP_STRUCT__entry(
90 __field(unsigned int, task_id)
91 __field(unsigned int, client_id)
92 __field(u32, maj_stat)
96 TP_fast_assign(
97 __entry->task_id = task->tk_pid;
98 __entry->client_id = task->tk_client->cl_clid;
99 __entry->maj_stat = maj_stat;
102 TP_printk("task:%u@%u maj_stat=%s",
103 __entry->task_id, __entry->client_id,
104 __entry->maj_stat == 0 ?
105 "GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
108 #define DEFINE_GSSAPI_EVENT(name) \
109 DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \
110 TP_PROTO( \
111 const struct rpc_task *task, \
112 u32 maj_stat \
113 ), \
114 TP_ARGS(task, maj_stat))
116 TRACE_EVENT(rpcgss_import_ctx,
117 TP_PROTO(
118 int status
121 TP_ARGS(status),
123 TP_STRUCT__entry(
124 __field(int, status)
127 TP_fast_assign(
128 __entry->status = status;
131 TP_printk("status=%d", __entry->status)
134 DEFINE_GSSAPI_EVENT(get_mic);
135 DEFINE_GSSAPI_EVENT(verify_mic);
136 DEFINE_GSSAPI_EVENT(wrap);
137 DEFINE_GSSAPI_EVENT(unwrap);
139 DECLARE_EVENT_CLASS(rpcgss_ctx_class,
140 TP_PROTO(
141 const struct gss_cred *gc
144 TP_ARGS(gc),
146 TP_STRUCT__entry(
147 __field(const void *, cred)
148 __field(unsigned long, service)
149 __string(principal, gc->gc_principal)
152 TP_fast_assign(
153 __entry->cred = gc;
154 __entry->service = gc->gc_service;
155 __assign_str(principal, gc->gc_principal)
158 TP_printk("cred=%p service=%s principal='%s'",
159 __entry->cred, show_gss_service(__entry->service),
160 __get_str(principal))
163 #define DEFINE_CTX_EVENT(name) \
164 DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name, \
165 TP_PROTO( \
166 const struct gss_cred *gc \
167 ), \
168 TP_ARGS(gc))
170 DEFINE_CTX_EVENT(init);
171 DEFINE_CTX_EVENT(destroy);
173 DECLARE_EVENT_CLASS(rpcgss_svc_gssapi_class,
174 TP_PROTO(
175 const struct svc_rqst *rqstp,
176 u32 maj_stat
179 TP_ARGS(rqstp, maj_stat),
181 TP_STRUCT__entry(
182 __field(u32, xid)
183 __field(u32, maj_stat)
184 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
187 TP_fast_assign(
188 __entry->xid = __be32_to_cpu(rqstp->rq_xid);
189 __entry->maj_stat = maj_stat;
190 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
193 TP_printk("addr=%s xid=0x%08x maj_stat=%s",
194 __get_str(addr), __entry->xid,
195 __entry->maj_stat == 0 ?
196 "GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
199 #define DEFINE_SVC_GSSAPI_EVENT(name) \
200 DEFINE_EVENT(rpcgss_svc_gssapi_class, rpcgss_svc_##name, \
201 TP_PROTO( \
202 const struct svc_rqst *rqstp, \
203 u32 maj_stat \
204 ), \
205 TP_ARGS(rqstp, maj_stat))
207 DEFINE_SVC_GSSAPI_EVENT(unwrap);
208 DEFINE_SVC_GSSAPI_EVENT(mic);
210 TRACE_EVENT(rpcgss_svc_unwrap_failed,
211 TP_PROTO(
212 const struct svc_rqst *rqstp
215 TP_ARGS(rqstp),
217 TP_STRUCT__entry(
218 __field(u32, xid)
219 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
222 TP_fast_assign(
223 __entry->xid = be32_to_cpu(rqstp->rq_xid);
224 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
227 TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
230 TRACE_EVENT(rpcgss_svc_seqno_bad,
231 TP_PROTO(
232 const struct svc_rqst *rqstp,
233 u32 expected,
234 u32 received
237 TP_ARGS(rqstp, expected, received),
239 TP_STRUCT__entry(
240 __field(u32, expected)
241 __field(u32, received)
242 __field(u32, xid)
243 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
246 TP_fast_assign(
247 __entry->expected = expected;
248 __entry->received = received;
249 __entry->xid = __be32_to_cpu(rqstp->rq_xid);
250 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
253 TP_printk("addr=%s xid=0x%08x expected seqno %u, received seqno %u",
254 __get_str(addr), __entry->xid,
255 __entry->expected, __entry->received)
258 TRACE_EVENT(rpcgss_svc_accept_upcall,
259 TP_PROTO(
260 const struct svc_rqst *rqstp,
261 u32 major_status,
262 u32 minor_status
265 TP_ARGS(rqstp, major_status, minor_status),
267 TP_STRUCT__entry(
268 __field(u32, minor_status)
269 __field(unsigned long, major_status)
270 __field(u32, xid)
271 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
274 TP_fast_assign(
275 __entry->minor_status = minor_status;
276 __entry->major_status = major_status;
277 __entry->xid = be32_to_cpu(rqstp->rq_xid);
278 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
281 TP_printk("addr=%s xid=0x%08x major_status=%s (0x%08lx) minor_status=%u",
282 __get_str(addr), __entry->xid,
283 (__entry->major_status == 0) ? "GSS_S_COMPLETE" :
284 show_gss_status(__entry->major_status),
285 __entry->major_status, __entry->minor_status
289 TRACE_EVENT(rpcgss_svc_authenticate,
290 TP_PROTO(
291 const struct svc_rqst *rqstp,
292 const struct rpc_gss_wire_cred *gc
295 TP_ARGS(rqstp, gc),
297 TP_STRUCT__entry(
298 __field(u32, seqno)
299 __field(u32, xid)
300 __string(addr, rqstp->rq_xprt->xpt_remotebuf)
303 TP_fast_assign(
304 __entry->xid = be32_to_cpu(rqstp->rq_xid);
305 __entry->seqno = gc->gc_seq;
306 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
309 TP_printk("addr=%s xid=0x%08x seqno=%u", __get_str(addr),
310 __entry->xid, __entry->seqno)
315 ** GSS auth unwrap failures
318 TRACE_EVENT(rpcgss_unwrap_failed,
319 TP_PROTO(
320 const struct rpc_task *task
323 TP_ARGS(task),
325 TP_STRUCT__entry(
326 __field(unsigned int, task_id)
327 __field(unsigned int, client_id)
330 TP_fast_assign(
331 __entry->task_id = task->tk_pid;
332 __entry->client_id = task->tk_client->cl_clid;
335 TP_printk("task:%u@%u", __entry->task_id, __entry->client_id)
338 TRACE_EVENT(rpcgss_bad_seqno,
339 TP_PROTO(
340 const struct rpc_task *task,
341 u32 expected,
342 u32 received
345 TP_ARGS(task, expected, received),
347 TP_STRUCT__entry(
348 __field(unsigned int, task_id)
349 __field(unsigned int, client_id)
350 __field(u32, expected)
351 __field(u32, received)
354 TP_fast_assign(
355 __entry->task_id = task->tk_pid;
356 __entry->client_id = task->tk_client->cl_clid;
357 __entry->expected = expected;
358 __entry->received = received;
361 TP_printk("task:%u@%u expected seqno %u, received seqno %u",
362 __entry->task_id, __entry->client_id,
363 __entry->expected, __entry->received)
366 TRACE_EVENT(rpcgss_seqno,
367 TP_PROTO(
368 const struct rpc_task *task
371 TP_ARGS(task),
373 TP_STRUCT__entry(
374 __field(unsigned int, task_id)
375 __field(unsigned int, client_id)
376 __field(u32, xid)
377 __field(u32, seqno)
380 TP_fast_assign(
381 const struct rpc_rqst *rqst = task->tk_rqstp;
383 __entry->task_id = task->tk_pid;
384 __entry->client_id = task->tk_client->cl_clid;
385 __entry->xid = be32_to_cpu(rqst->rq_xid);
386 __entry->seqno = rqst->rq_seqno;
389 TP_printk("task:%u@%u xid=0x%08x seqno=%u",
390 __entry->task_id, __entry->client_id,
391 __entry->xid, __entry->seqno)
394 TRACE_EVENT(rpcgss_need_reencode,
395 TP_PROTO(
396 const struct rpc_task *task,
397 u32 seq_xmit,
398 bool ret
401 TP_ARGS(task, seq_xmit, ret),
403 TP_STRUCT__entry(
404 __field(unsigned int, task_id)
405 __field(unsigned int, client_id)
406 __field(u32, xid)
407 __field(u32, seq_xmit)
408 __field(u32, seqno)
409 __field(bool, ret)
412 TP_fast_assign(
413 __entry->task_id = task->tk_pid;
414 __entry->client_id = task->tk_client->cl_clid;
415 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
416 __entry->seq_xmit = seq_xmit;
417 __entry->seqno = task->tk_rqstp->rq_seqno;
418 __entry->ret = ret;
421 TP_printk("task:%u@%u xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
422 __entry->task_id, __entry->client_id,
423 __entry->xid, __entry->seqno, __entry->seq_xmit,
424 __entry->ret ? "" : "un")
427 TRACE_EVENT(rpcgss_update_slack,
428 TP_PROTO(
429 const struct rpc_task *task,
430 const struct rpc_auth *auth
433 TP_ARGS(task, auth),
435 TP_STRUCT__entry(
436 __field(unsigned int, task_id)
437 __field(unsigned int, client_id)
438 __field(u32, xid)
439 __field(const void *, auth)
440 __field(unsigned int, rslack)
441 __field(unsigned int, ralign)
442 __field(unsigned int, verfsize)
445 TP_fast_assign(
446 __entry->task_id = task->tk_pid;
447 __entry->client_id = task->tk_client->cl_clid;
448 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
449 __entry->auth = auth;
450 __entry->rslack = auth->au_rslack;
451 __entry->ralign = auth->au_ralign;
452 __entry->verfsize = auth->au_verfsize;
455 TP_printk("task:%u@%u xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n",
456 __entry->task_id, __entry->client_id, __entry->xid,
457 __entry->auth, __entry->rslack, __entry->ralign,
458 __entry->verfsize)
461 DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class,
462 TP_PROTO(
463 const struct svc_rqst *rqstp,
464 u32 seqno
467 TP_ARGS(rqstp, seqno),
469 TP_STRUCT__entry(
470 __field(u32, xid)
471 __field(u32, seqno)
474 TP_fast_assign(
475 __entry->xid = be32_to_cpu(rqstp->rq_xid);
476 __entry->seqno = seqno;
479 TP_printk("xid=0x%08x seqno=%u",
480 __entry->xid, __entry->seqno)
483 #define DEFINE_SVC_SEQNO_EVENT(name) \
484 DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_seqno_##name, \
485 TP_PROTO( \
486 const struct svc_rqst *rqstp, \
487 u32 seqno \
488 ), \
489 TP_ARGS(rqstp, seqno))
491 DEFINE_SVC_SEQNO_EVENT(large);
492 DEFINE_SVC_SEQNO_EVENT(seen);
494 TRACE_EVENT(rpcgss_svc_seqno_low,
495 TP_PROTO(
496 const struct svc_rqst *rqstp,
497 u32 seqno,
498 u32 min,
499 u32 max
502 TP_ARGS(rqstp, seqno, min, max),
504 TP_STRUCT__entry(
505 __field(u32, xid)
506 __field(u32, seqno)
507 __field(u32, min)
508 __field(u32, max)
511 TP_fast_assign(
512 __entry->xid = be32_to_cpu(rqstp->rq_xid);
513 __entry->seqno = seqno;
514 __entry->min = min;
515 __entry->max = max;
518 TP_printk("xid=0x%08x seqno=%u window=[%u..%u]",
519 __entry->xid, __entry->seqno, __entry->min, __entry->max)
523 ** gssd upcall related trace events
526 TRACE_EVENT(rpcgss_upcall_msg,
527 TP_PROTO(
528 const char *buf
531 TP_ARGS(buf),
533 TP_STRUCT__entry(
534 __string(msg, buf)
537 TP_fast_assign(
538 __assign_str(msg, buf)
541 TP_printk("msg='%s'", __get_str(msg))
544 TRACE_EVENT(rpcgss_upcall_result,
545 TP_PROTO(
546 u32 uid,
547 int result
550 TP_ARGS(uid, result),
552 TP_STRUCT__entry(
553 __field(u32, uid)
554 __field(int, result)
558 TP_fast_assign(
559 __entry->uid = uid;
560 __entry->result = result;
563 TP_printk("for uid %u, result=%d", __entry->uid, __entry->result)
566 TRACE_EVENT(rpcgss_context,
567 TP_PROTO(
568 u32 window_size,
569 unsigned long expiry,
570 unsigned long now,
571 unsigned int timeout,
572 unsigned int len,
573 const u8 *data
576 TP_ARGS(window_size, expiry, now, timeout, len, data),
578 TP_STRUCT__entry(
579 __field(unsigned long, expiry)
580 __field(unsigned long, now)
581 __field(unsigned int, timeout)
582 __field(u32, window_size)
583 __field(int, len)
584 __string(acceptor, data)
587 TP_fast_assign(
588 __entry->expiry = expiry;
589 __entry->now = now;
590 __entry->timeout = timeout;
591 __entry->window_size = window_size;
592 __entry->len = len;
593 strncpy(__get_str(acceptor), data, len);
596 TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
597 __entry->window_size, __entry->expiry, __entry->now,
598 __entry->timeout, __entry->len, __get_str(acceptor))
603 ** Miscellaneous events
606 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5);
607 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I);
608 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P);
610 #define show_pseudoflavor(x) \
611 __print_symbolic(x, \
612 { RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" }, \
613 { RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" }, \
614 { RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" })
617 TRACE_EVENT(rpcgss_createauth,
618 TP_PROTO(
619 unsigned int flavor,
620 int error
623 TP_ARGS(flavor, error),
625 TP_STRUCT__entry(
626 __field(unsigned int, flavor)
627 __field(int, error)
631 TP_fast_assign(
632 __entry->flavor = flavor;
633 __entry->error = error;
636 TP_printk("flavor=%s error=%d",
637 show_pseudoflavor(__entry->flavor), __entry->error)
640 TRACE_EVENT(rpcgss_oid_to_mech,
641 TP_PROTO(
642 const char *oid
645 TP_ARGS(oid),
647 TP_STRUCT__entry(
648 __string(oid, oid)
651 TP_fast_assign(
652 __assign_str(oid, oid);
655 TP_printk("mech for oid %s was not found", __get_str(oid))
658 #endif /* _TRACE_RPCGSS_H */
660 #include <trace/define_trace.h>