xref: /openbmc/linux/include/trace/events/rpcgss.h (revision 268bb038)
10c77668dSChuck Lever /* SPDX-License-Identifier: GPL-2.0 */
20c77668dSChuck Lever /*
30c77668dSChuck Lever  * Copyright (c) 2018 Oracle.  All rights reserved.
40c77668dSChuck Lever  *
50c77668dSChuck Lever  * Trace point definitions for the "rpcgss" subsystem.
60c77668dSChuck Lever  */
70c77668dSChuck Lever 
80c77668dSChuck Lever #undef TRACE_SYSTEM
90c77668dSChuck Lever #define TRACE_SYSTEM rpcgss
100c77668dSChuck Lever 
11*268bb038SThiago Rafael Becker #if !defined(_TRACE_RPCGSS_H) || defined(TRACE_HEADER_MULTI_READ)
120c77668dSChuck Lever #define _TRACE_RPCGSS_H
130c77668dSChuck Lever 
140c77668dSChuck Lever #include <linux/tracepoint.h>
150c77668dSChuck Lever 
16b4776a34SChuck Lever #include <trace/events/sunrpc_base.h>
17b4776a34SChuck Lever 
180c77668dSChuck Lever /**
190c77668dSChuck Lever  ** GSS-API related trace events
200c77668dSChuck Lever  **/
210c77668dSChuck Lever 
2274fb8fecSChuck Lever TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE);
2374fb8fecSChuck Lever TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY);
2474fb8fecSChuck Lever TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY);
2574fb8fecSChuck Lever 
2674fb8fecSChuck Lever #define show_gss_service(x)						\
2774fb8fecSChuck Lever 	__print_symbolic(x,						\
2874fb8fecSChuck Lever 		{ RPC_GSS_SVC_NONE,		"none" },		\
2974fb8fecSChuck Lever 		{ RPC_GSS_SVC_INTEGRITY,	"integrity" },		\
3074fb8fecSChuck Lever 		{ RPC_GSS_SVC_PRIVACY,		"privacy" })
3174fb8fecSChuck Lever 
320c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_MECH);
330c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_NAME);
340c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE);
350c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS);
360c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS);
370c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_SIG);
380c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NO_CRED);
390c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT);
400c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN);
410c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL);
420c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED);
430c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED);
440c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_FAILURE);
450c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_QOP);
460c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED);
470c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE);
480c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT);
490c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN);
500c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED);
510c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN);
520c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN);
530c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN);
540c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN);
550c77668dSChuck Lever 
560c77668dSChuck Lever #define show_gss_status(x)						\
570c77668dSChuck Lever 	__print_flags(x, "|",						\
580c77668dSChuck Lever 		{ GSS_S_BAD_MECH, "GSS_S_BAD_MECH" },			\
590c77668dSChuck Lever 		{ GSS_S_BAD_NAME, "GSS_S_BAD_NAME" },			\
600c77668dSChuck Lever 		{ GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" },		\
610c77668dSChuck Lever 		{ GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" },		\
620c77668dSChuck Lever 		{ GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" },		\
630c77668dSChuck Lever 		{ GSS_S_BAD_SIG, "GSS_S_BAD_SIG" },			\
640c77668dSChuck Lever 		{ GSS_S_NO_CRED, "GSS_S_NO_CRED" },			\
650c77668dSChuck Lever 		{ GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" },		\
660c77668dSChuck Lever 		{ GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" },	\
670c77668dSChuck Lever 		{ GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \
680c77668dSChuck Lever 		{ GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \
690c77668dSChuck Lever 		{ GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" },	\
700c77668dSChuck Lever 		{ GSS_S_FAILURE, "GSS_S_FAILURE" },			\
710c77668dSChuck Lever 		{ GSS_S_BAD_QOP, "GSS_S_BAD_QOP" },			\
720c77668dSChuck Lever 		{ GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" },		\
730c77668dSChuck Lever 		{ GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" },		\
740c77668dSChuck Lever 		{ GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" },	\
750c77668dSChuck Lever 		{ GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" },		\
760c77668dSChuck Lever 		{ GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" },	\
770c77668dSChuck Lever 		{ GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" },	\
780c77668dSChuck Lever 		{ GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" },			\
790c77668dSChuck Lever 		{ GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" },		\
800c77668dSChuck Lever 		{ GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" })
810c77668dSChuck Lever 
820c77668dSChuck Lever 
830c77668dSChuck Lever DECLARE_EVENT_CLASS(rpcgss_gssapi_event,
840c77668dSChuck Lever 	TP_PROTO(
850c77668dSChuck Lever 		const struct rpc_task *task,
860c77668dSChuck Lever 		u32 maj_stat
870c77668dSChuck Lever 	),
880c77668dSChuck Lever 
890c77668dSChuck Lever 	TP_ARGS(task, maj_stat),
900c77668dSChuck Lever 
910c77668dSChuck Lever 	TP_STRUCT__entry(
920c77668dSChuck Lever 		__field(unsigned int, task_id)
930c77668dSChuck Lever 		__field(unsigned int, client_id)
940c77668dSChuck Lever 		__field(u32, maj_stat)
950c77668dSChuck Lever 
960c77668dSChuck Lever 	),
970c77668dSChuck Lever 
980c77668dSChuck Lever 	TP_fast_assign(
990c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
1000c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
1010c77668dSChuck Lever 		__entry->maj_stat = maj_stat;
1020c77668dSChuck Lever 	),
1030c77668dSChuck Lever 
104b4776a34SChuck Lever 	TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " maj_stat=%s",
1050c77668dSChuck Lever 		__entry->task_id, __entry->client_id,
1060c77668dSChuck Lever 		__entry->maj_stat == 0 ?
1070c77668dSChuck Lever 		"GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
1080c77668dSChuck Lever );
1090c77668dSChuck Lever 
1100c77668dSChuck Lever #define DEFINE_GSSAPI_EVENT(name)					\
1110c77668dSChuck Lever 	DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name,		\
1120c77668dSChuck Lever 			TP_PROTO(					\
1130c77668dSChuck Lever 				const struct rpc_task *task,		\
1140c77668dSChuck Lever 				u32 maj_stat				\
1150c77668dSChuck Lever 			),						\
1160c77668dSChuck Lever 			TP_ARGS(task, maj_stat))
1170c77668dSChuck Lever 
1180c77668dSChuck Lever TRACE_EVENT(rpcgss_import_ctx,
1190c77668dSChuck Lever 	TP_PROTO(
1200c77668dSChuck Lever 		int status
1210c77668dSChuck Lever 	),
1220c77668dSChuck Lever 
1230c77668dSChuck Lever 	TP_ARGS(status),
1240c77668dSChuck Lever 
1250c77668dSChuck Lever 	TP_STRUCT__entry(
1260c77668dSChuck Lever 		__field(int, status)
1270c77668dSChuck Lever 	),
1280c77668dSChuck Lever 
1290c77668dSChuck Lever 	TP_fast_assign(
1300c77668dSChuck Lever 		__entry->status = status;
1310c77668dSChuck Lever 	),
1320c77668dSChuck Lever 
1330c77668dSChuck Lever 	TP_printk("status=%d", __entry->status)
1340c77668dSChuck Lever );
1350c77668dSChuck Lever 
1360c77668dSChuck Lever DEFINE_GSSAPI_EVENT(get_mic);
1370c77668dSChuck Lever DEFINE_GSSAPI_EVENT(verify_mic);
1380c77668dSChuck Lever DEFINE_GSSAPI_EVENT(wrap);
1390c77668dSChuck Lever DEFINE_GSSAPI_EVENT(unwrap);
1400c77668dSChuck Lever 
14174fb8fecSChuck Lever DECLARE_EVENT_CLASS(rpcgss_ctx_class,
14274fb8fecSChuck Lever 	TP_PROTO(
14374fb8fecSChuck Lever 		const struct gss_cred *gc
14474fb8fecSChuck Lever 	),
14574fb8fecSChuck Lever 
14674fb8fecSChuck Lever 	TP_ARGS(gc),
14774fb8fecSChuck Lever 
14874fb8fecSChuck Lever 	TP_STRUCT__entry(
14974fb8fecSChuck Lever 		__field(const void *, cred)
15074fb8fecSChuck Lever 		__field(unsigned long, service)
15174fb8fecSChuck Lever 		__string(principal, gc->gc_principal)
15274fb8fecSChuck Lever 	),
15374fb8fecSChuck Lever 
15474fb8fecSChuck Lever 	TP_fast_assign(
15574fb8fecSChuck Lever 		__entry->cred = gc;
15674fb8fecSChuck Lever 		__entry->service = gc->gc_service;
15778c14b38SJoe Perches 		__assign_str(principal, gc->gc_principal);
15874fb8fecSChuck Lever 	),
15974fb8fecSChuck Lever 
16074fb8fecSChuck Lever 	TP_printk("cred=%p service=%s principal='%s'",
16174fb8fecSChuck Lever 		__entry->cred, show_gss_service(__entry->service),
16274fb8fecSChuck Lever 		__get_str(principal))
16374fb8fecSChuck Lever );
16474fb8fecSChuck Lever 
16574fb8fecSChuck Lever #define DEFINE_CTX_EVENT(name)						\
16674fb8fecSChuck Lever 	DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name,		\
16774fb8fecSChuck Lever 			TP_PROTO(					\
16874fb8fecSChuck Lever 				const struct gss_cred *gc		\
16974fb8fecSChuck Lever 			),						\
17074fb8fecSChuck Lever 			TP_ARGS(gc))
17174fb8fecSChuck Lever 
17274fb8fecSChuck Lever DEFINE_CTX_EVENT(init);
17374fb8fecSChuck Lever DEFINE_CTX_EVENT(destroy);
17474fb8fecSChuck Lever 
17510b9d99aSChuck Lever DECLARE_EVENT_CLASS(rpcgss_svc_gssapi_class,
17610b9d99aSChuck Lever 	TP_PROTO(
17710b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
17810b9d99aSChuck Lever 		u32 maj_stat
17910b9d99aSChuck Lever 	),
18010b9d99aSChuck Lever 
18110b9d99aSChuck Lever 	TP_ARGS(rqstp, maj_stat),
18210b9d99aSChuck Lever 
18310b9d99aSChuck Lever 	TP_STRUCT__entry(
18410b9d99aSChuck Lever 		__field(u32, xid)
18510b9d99aSChuck Lever 		__field(u32, maj_stat)
18610b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
18710b9d99aSChuck Lever 	),
18810b9d99aSChuck Lever 
18910b9d99aSChuck Lever 	TP_fast_assign(
19010b9d99aSChuck Lever 		__entry->xid = __be32_to_cpu(rqstp->rq_xid);
19110b9d99aSChuck Lever 		__entry->maj_stat = maj_stat;
19210b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
19310b9d99aSChuck Lever 	),
19410b9d99aSChuck Lever 
19510b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x maj_stat=%s",
19610b9d99aSChuck Lever 		__get_str(addr), __entry->xid,
19710b9d99aSChuck Lever 		__entry->maj_stat == 0 ?
19810b9d99aSChuck Lever 		"GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
19910b9d99aSChuck Lever );
20010b9d99aSChuck Lever 
20110b9d99aSChuck Lever #define DEFINE_SVC_GSSAPI_EVENT(name)					\
20210b9d99aSChuck Lever 	DEFINE_EVENT(rpcgss_svc_gssapi_class, rpcgss_svc_##name,	\
20310b9d99aSChuck Lever 			TP_PROTO(					\
20410b9d99aSChuck Lever 				const struct svc_rqst *rqstp,		\
20510b9d99aSChuck Lever 				u32 maj_stat				\
20610b9d99aSChuck Lever 			),						\
20710b9d99aSChuck Lever 			TP_ARGS(rqstp, maj_stat))
20810b9d99aSChuck Lever 
20910b9d99aSChuck Lever DEFINE_SVC_GSSAPI_EVENT(unwrap);
21010b9d99aSChuck Lever DEFINE_SVC_GSSAPI_EVENT(mic);
21110b9d99aSChuck Lever 
21210b9d99aSChuck Lever TRACE_EVENT(rpcgss_svc_unwrap_failed,
21310b9d99aSChuck Lever 	TP_PROTO(
21410b9d99aSChuck Lever 		const struct svc_rqst *rqstp
21510b9d99aSChuck Lever 	),
21610b9d99aSChuck Lever 
21710b9d99aSChuck Lever 	TP_ARGS(rqstp),
21810b9d99aSChuck Lever 
21910b9d99aSChuck Lever 	TP_STRUCT__entry(
22010b9d99aSChuck Lever 		__field(u32, xid)
22110b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
22210b9d99aSChuck Lever 	),
22310b9d99aSChuck Lever 
22410b9d99aSChuck Lever 	TP_fast_assign(
22510b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
22610b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
22710b9d99aSChuck Lever 	),
22810b9d99aSChuck Lever 
22910b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
23010b9d99aSChuck Lever );
23110b9d99aSChuck Lever 
23210b9d99aSChuck Lever TRACE_EVENT(rpcgss_svc_seqno_bad,
23310b9d99aSChuck Lever 	TP_PROTO(
23410b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
23510b9d99aSChuck Lever 		u32 expected,
23610b9d99aSChuck Lever 		u32 received
23710b9d99aSChuck Lever 	),
23810b9d99aSChuck Lever 
23910b9d99aSChuck Lever 	TP_ARGS(rqstp, expected, received),
24010b9d99aSChuck Lever 
24110b9d99aSChuck Lever 	TP_STRUCT__entry(
24210b9d99aSChuck Lever 		__field(u32, expected)
24310b9d99aSChuck Lever 		__field(u32, received)
24410b9d99aSChuck Lever 		__field(u32, xid)
24510b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
24610b9d99aSChuck Lever 	),
24710b9d99aSChuck Lever 
24810b9d99aSChuck Lever 	TP_fast_assign(
24910b9d99aSChuck Lever 		__entry->expected = expected;
25010b9d99aSChuck Lever 		__entry->received = received;
25110b9d99aSChuck Lever 		__entry->xid = __be32_to_cpu(rqstp->rq_xid);
25210b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
25310b9d99aSChuck Lever 	),
25410b9d99aSChuck Lever 
25510b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x expected seqno %u, received seqno %u",
25610b9d99aSChuck Lever 		__get_str(addr), __entry->xid,
25710b9d99aSChuck Lever 		__entry->expected, __entry->received)
25810b9d99aSChuck Lever );
25910b9d99aSChuck Lever 
26028155524SChuck Lever TRACE_EVENT(rpcgss_svc_accept_upcall,
261ff27e9f7SChuck Lever 	TP_PROTO(
26210b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
263ff27e9f7SChuck Lever 		u32 major_status,
264ff27e9f7SChuck Lever 		u32 minor_status
265ff27e9f7SChuck Lever 	),
266ff27e9f7SChuck Lever 
26710b9d99aSChuck Lever 	TP_ARGS(rqstp, major_status, minor_status),
268ff27e9f7SChuck Lever 
269ff27e9f7SChuck Lever 	TP_STRUCT__entry(
270ff27e9f7SChuck Lever 		__field(u32, minor_status)
271ff27e9f7SChuck Lever 		__field(unsigned long, major_status)
27210b9d99aSChuck Lever 		__field(u32, xid)
27310b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
274ff27e9f7SChuck Lever 	),
275ff27e9f7SChuck Lever 
276ff27e9f7SChuck Lever 	TP_fast_assign(
277ff27e9f7SChuck Lever 		__entry->minor_status = minor_status;
278ff27e9f7SChuck Lever 		__entry->major_status = major_status;
27910b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
28010b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
281ff27e9f7SChuck Lever 	),
282ff27e9f7SChuck Lever 
28310b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x major_status=%s (0x%08lx) minor_status=%u",
28410b9d99aSChuck Lever 		__get_str(addr), __entry->xid,
28510b9d99aSChuck Lever 		(__entry->major_status == 0) ? "GSS_S_COMPLETE" :
286ff27e9f7SChuck Lever 			show_gss_status(__entry->major_status),
287ff27e9f7SChuck Lever 		__entry->major_status, __entry->minor_status
288ff27e9f7SChuck Lever 	)
289ff27e9f7SChuck Lever );
290ff27e9f7SChuck Lever 
29110b9d99aSChuck Lever TRACE_EVENT(rpcgss_svc_authenticate,
29228155524SChuck Lever 	TP_PROTO(
29310b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
29410b9d99aSChuck Lever 		const struct rpc_gss_wire_cred *gc
29528155524SChuck Lever 	),
29628155524SChuck Lever 
29710b9d99aSChuck Lever 	TP_ARGS(rqstp, gc),
29828155524SChuck Lever 
29928155524SChuck Lever 	TP_STRUCT__entry(
30010b9d99aSChuck Lever 		__field(u32, seqno)
30128155524SChuck Lever 		__field(u32, xid)
30210b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
30328155524SChuck Lever 	),
30428155524SChuck Lever 
30528155524SChuck Lever 	TP_fast_assign(
30610b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
30710b9d99aSChuck Lever 		__entry->seqno = gc->gc_seq;
30810b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
30928155524SChuck Lever 	),
31028155524SChuck Lever 
31110b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x seqno=%u", __get_str(addr),
31210b9d99aSChuck Lever 		__entry->xid, __entry->seqno)
31328155524SChuck Lever );
31428155524SChuck Lever 
3150c77668dSChuck Lever 
3160c77668dSChuck Lever /**
3170c77668dSChuck Lever  ** GSS auth unwrap failures
3180c77668dSChuck Lever  **/
3190c77668dSChuck Lever 
3200c77668dSChuck Lever TRACE_EVENT(rpcgss_unwrap_failed,
3210c77668dSChuck Lever 	TP_PROTO(
3220c77668dSChuck Lever 		const struct rpc_task *task
3230c77668dSChuck Lever 	),
3240c77668dSChuck Lever 
3250c77668dSChuck Lever 	TP_ARGS(task),
3260c77668dSChuck Lever 
3270c77668dSChuck Lever 	TP_STRUCT__entry(
3280c77668dSChuck Lever 		__field(unsigned int, task_id)
3290c77668dSChuck Lever 		__field(unsigned int, client_id)
3300c77668dSChuck Lever 	),
3310c77668dSChuck Lever 
3320c77668dSChuck Lever 	TP_fast_assign(
3330c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
3340c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
3350c77668dSChuck Lever 	),
3360c77668dSChuck Lever 
337b4776a34SChuck Lever 	TP_printk(SUNRPC_TRACE_TASK_SPECIFIER,
338b4776a34SChuck Lever 		__entry->task_id, __entry->client_id)
3390c77668dSChuck Lever );
3400c77668dSChuck Lever 
3410c77668dSChuck Lever TRACE_EVENT(rpcgss_bad_seqno,
3420c77668dSChuck Lever 	TP_PROTO(
3430c77668dSChuck Lever 		const struct rpc_task *task,
3440c77668dSChuck Lever 		u32 expected,
3450c77668dSChuck Lever 		u32 received
3460c77668dSChuck Lever 	),
3470c77668dSChuck Lever 
3480c77668dSChuck Lever 	TP_ARGS(task, expected, received),
3490c77668dSChuck Lever 
3500c77668dSChuck Lever 	TP_STRUCT__entry(
3510c77668dSChuck Lever 		__field(unsigned int, task_id)
3520c77668dSChuck Lever 		__field(unsigned int, client_id)
3530c77668dSChuck Lever 		__field(u32, expected)
3540c77668dSChuck Lever 		__field(u32, received)
3550c77668dSChuck Lever 	),
3560c77668dSChuck Lever 
3570c77668dSChuck Lever 	TP_fast_assign(
3580c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
3590c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
3600c77668dSChuck Lever 		__entry->expected = expected;
3610c77668dSChuck Lever 		__entry->received = received;
3620c77668dSChuck Lever 	),
3630c77668dSChuck Lever 
364b4776a34SChuck Lever 	TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
365b4776a34SChuck Lever 		  " expected seqno %u, received seqno %u",
3660c77668dSChuck Lever 		__entry->task_id, __entry->client_id,
3670c77668dSChuck Lever 		__entry->expected, __entry->received)
3680c77668dSChuck Lever );
3690c77668dSChuck Lever 
3700c77668dSChuck Lever TRACE_EVENT(rpcgss_seqno,
3710c77668dSChuck Lever 	TP_PROTO(
3720c77668dSChuck Lever 		const struct rpc_task *task
3730c77668dSChuck Lever 	),
3740c77668dSChuck Lever 
3750c77668dSChuck Lever 	TP_ARGS(task),
3760c77668dSChuck Lever 
3770c77668dSChuck Lever 	TP_STRUCT__entry(
3780c77668dSChuck Lever 		__field(unsigned int, task_id)
3790c77668dSChuck Lever 		__field(unsigned int, client_id)
3800c77668dSChuck Lever 		__field(u32, xid)
3810c77668dSChuck Lever 		__field(u32, seqno)
3820c77668dSChuck Lever 	),
3830c77668dSChuck Lever 
3840c77668dSChuck Lever 	TP_fast_assign(
3850c77668dSChuck Lever 		const struct rpc_rqst *rqst = task->tk_rqstp;
3860c77668dSChuck Lever 
3870c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
3880c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
3890c77668dSChuck Lever 		__entry->xid = be32_to_cpu(rqst->rq_xid);
3900c77668dSChuck Lever 		__entry->seqno = rqst->rq_seqno;
3910c77668dSChuck Lever 	),
3920c77668dSChuck Lever 
393b4776a34SChuck Lever 	TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x seqno=%u",
3940c77668dSChuck Lever 		__entry->task_id, __entry->client_id,
3950c77668dSChuck Lever 		__entry->xid, __entry->seqno)
3960c77668dSChuck Lever );
3970c77668dSChuck Lever 
3980c77668dSChuck Lever TRACE_EVENT(rpcgss_need_reencode,
3990c77668dSChuck Lever 	TP_PROTO(
4000c77668dSChuck Lever 		const struct rpc_task *task,
4010c77668dSChuck Lever 		u32 seq_xmit,
4020c77668dSChuck Lever 		bool ret
4030c77668dSChuck Lever 	),
4040c77668dSChuck Lever 
4050c77668dSChuck Lever 	TP_ARGS(task, seq_xmit, ret),
4060c77668dSChuck Lever 
4070c77668dSChuck Lever 	TP_STRUCT__entry(
4080c77668dSChuck Lever 		__field(unsigned int, task_id)
4090c77668dSChuck Lever 		__field(unsigned int, client_id)
4100c77668dSChuck Lever 		__field(u32, xid)
4110c77668dSChuck Lever 		__field(u32, seq_xmit)
4120c77668dSChuck Lever 		__field(u32, seqno)
4130c77668dSChuck Lever 		__field(bool, ret)
4140c77668dSChuck Lever 	),
4150c77668dSChuck Lever 
4160c77668dSChuck Lever 	TP_fast_assign(
4170c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
4180c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
4190c77668dSChuck Lever 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
4200c77668dSChuck Lever 		__entry->seq_xmit = seq_xmit;
4210c77668dSChuck Lever 		__entry->seqno = task->tk_rqstp->rq_seqno;
4220c77668dSChuck Lever 		__entry->ret = ret;
4230c77668dSChuck Lever 	),
4240c77668dSChuck Lever 
425b4776a34SChuck Lever 	TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
426b4776a34SChuck Lever 		  " xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
4270c77668dSChuck Lever 		__entry->task_id, __entry->client_id,
4280c77668dSChuck Lever 		__entry->xid, __entry->seqno, __entry->seq_xmit,
4290c77668dSChuck Lever 		__entry->ret ? "" : "un")
4300c77668dSChuck Lever );
4310c77668dSChuck Lever 
43253bc19f1SChuck Lever TRACE_EVENT(rpcgss_update_slack,
43353bc19f1SChuck Lever 	TP_PROTO(
43453bc19f1SChuck Lever 		const struct rpc_task *task,
43553bc19f1SChuck Lever 		const struct rpc_auth *auth
43653bc19f1SChuck Lever 	),
43753bc19f1SChuck Lever 
43853bc19f1SChuck Lever 	TP_ARGS(task, auth),
43953bc19f1SChuck Lever 
44053bc19f1SChuck Lever 	TP_STRUCT__entry(
44153bc19f1SChuck Lever 		__field(unsigned int, task_id)
44253bc19f1SChuck Lever 		__field(unsigned int, client_id)
44353bc19f1SChuck Lever 		__field(u32, xid)
44453bc19f1SChuck Lever 		__field(const void *, auth)
44553bc19f1SChuck Lever 		__field(unsigned int, rslack)
44653bc19f1SChuck Lever 		__field(unsigned int, ralign)
44753bc19f1SChuck Lever 		__field(unsigned int, verfsize)
44853bc19f1SChuck Lever 	),
44953bc19f1SChuck Lever 
45053bc19f1SChuck Lever 	TP_fast_assign(
45153bc19f1SChuck Lever 		__entry->task_id = task->tk_pid;
45253bc19f1SChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
45353bc19f1SChuck Lever 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
45453bc19f1SChuck Lever 		__entry->auth = auth;
45553bc19f1SChuck Lever 		__entry->rslack = auth->au_rslack;
45653bc19f1SChuck Lever 		__entry->ralign = auth->au_ralign;
45753bc19f1SChuck Lever 		__entry->verfsize = auth->au_verfsize;
45853bc19f1SChuck Lever 	),
45953bc19f1SChuck Lever 
460b4776a34SChuck Lever 	TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
461b4776a34SChuck Lever 		  " xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n",
46253bc19f1SChuck Lever 		__entry->task_id, __entry->client_id, __entry->xid,
46353bc19f1SChuck Lever 		__entry->auth, __entry->rslack, __entry->ralign,
46453bc19f1SChuck Lever 		__entry->verfsize)
46553bc19f1SChuck Lever );
46653bc19f1SChuck Lever 
46728155524SChuck Lever DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class,
46828155524SChuck Lever 	TP_PROTO(
46910b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
47028155524SChuck Lever 		u32 seqno
47128155524SChuck Lever 	),
47228155524SChuck Lever 
47310b9d99aSChuck Lever 	TP_ARGS(rqstp, seqno),
47428155524SChuck Lever 
47528155524SChuck Lever 	TP_STRUCT__entry(
47628155524SChuck Lever 		__field(u32, xid)
47728155524SChuck Lever 		__field(u32, seqno)
47828155524SChuck Lever 	),
47928155524SChuck Lever 
48028155524SChuck Lever 	TP_fast_assign(
48110b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
48228155524SChuck Lever 		__entry->seqno = seqno;
48328155524SChuck Lever 	),
48428155524SChuck Lever 
48510b9d99aSChuck Lever 	TP_printk("xid=0x%08x seqno=%u",
48628155524SChuck Lever 		__entry->xid, __entry->seqno)
48728155524SChuck Lever );
48828155524SChuck Lever 
48928155524SChuck Lever #define DEFINE_SVC_SEQNO_EVENT(name)					\
49010b9d99aSChuck Lever 	DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_seqno_##name,	\
49128155524SChuck Lever 			TP_PROTO(					\
49210b9d99aSChuck Lever 				const struct svc_rqst *rqstp,		\
49328155524SChuck Lever 				u32 seqno				\
49428155524SChuck Lever 			),						\
49510b9d99aSChuck Lever 			TP_ARGS(rqstp, seqno))
49628155524SChuck Lever 
49710b9d99aSChuck Lever DEFINE_SVC_SEQNO_EVENT(large);
49810b9d99aSChuck Lever DEFINE_SVC_SEQNO_EVENT(seen);
49928155524SChuck Lever 
50010b9d99aSChuck Lever TRACE_EVENT(rpcgss_svc_seqno_low,
50110b9d99aSChuck Lever 	TP_PROTO(
50210b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
50310b9d99aSChuck Lever 		u32 seqno,
50410b9d99aSChuck Lever 		u32 min,
50510b9d99aSChuck Lever 		u32 max
50610b9d99aSChuck Lever 	),
50710b9d99aSChuck Lever 
50810b9d99aSChuck Lever 	TP_ARGS(rqstp, seqno, min, max),
50910b9d99aSChuck Lever 
51010b9d99aSChuck Lever 	TP_STRUCT__entry(
51110b9d99aSChuck Lever 		__field(u32, xid)
51210b9d99aSChuck Lever 		__field(u32, seqno)
51310b9d99aSChuck Lever 		__field(u32, min)
51410b9d99aSChuck Lever 		__field(u32, max)
51510b9d99aSChuck Lever 	),
51610b9d99aSChuck Lever 
51710b9d99aSChuck Lever 	TP_fast_assign(
51810b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
51910b9d99aSChuck Lever 		__entry->seqno = seqno;
52010b9d99aSChuck Lever 		__entry->min = min;
52110b9d99aSChuck Lever 		__entry->max = max;
52210b9d99aSChuck Lever 	),
52310b9d99aSChuck Lever 
52410b9d99aSChuck Lever 	TP_printk("xid=0x%08x seqno=%u window=[%u..%u]",
52510b9d99aSChuck Lever 		__entry->xid, __entry->seqno, __entry->min, __entry->max)
52610b9d99aSChuck Lever );
52728155524SChuck Lever 
5280c77668dSChuck Lever /**
5290c77668dSChuck Lever  ** gssd upcall related trace events
5300c77668dSChuck Lever  **/
5310c77668dSChuck Lever 
5320c77668dSChuck Lever TRACE_EVENT(rpcgss_upcall_msg,
5330c77668dSChuck Lever 	TP_PROTO(
5340c77668dSChuck Lever 		const char *buf
5350c77668dSChuck Lever 	),
5360c77668dSChuck Lever 
5370c77668dSChuck Lever 	TP_ARGS(buf),
5380c77668dSChuck Lever 
5390c77668dSChuck Lever 	TP_STRUCT__entry(
5400c77668dSChuck Lever 		__string(msg, buf)
5410c77668dSChuck Lever 	),
5420c77668dSChuck Lever 
5430c77668dSChuck Lever 	TP_fast_assign(
54478c14b38SJoe Perches 		__assign_str(msg, buf);
5450c77668dSChuck Lever 	),
5460c77668dSChuck Lever 
5470c77668dSChuck Lever 	TP_printk("msg='%s'", __get_str(msg))
5480c77668dSChuck Lever );
5490c77668dSChuck Lever 
5500c77668dSChuck Lever TRACE_EVENT(rpcgss_upcall_result,
5510c77668dSChuck Lever 	TP_PROTO(
5520c77668dSChuck Lever 		u32 uid,
5530c77668dSChuck Lever 		int result
5540c77668dSChuck Lever 	),
5550c77668dSChuck Lever 
5560c77668dSChuck Lever 	TP_ARGS(uid, result),
5570c77668dSChuck Lever 
5580c77668dSChuck Lever 	TP_STRUCT__entry(
5590c77668dSChuck Lever 		__field(u32, uid)
5600c77668dSChuck Lever 		__field(int, result)
5610c77668dSChuck Lever 
5620c77668dSChuck Lever 	),
5630c77668dSChuck Lever 
5640c77668dSChuck Lever 	TP_fast_assign(
5650c77668dSChuck Lever 		__entry->uid = uid;
5660c77668dSChuck Lever 		__entry->result = result;
5670c77668dSChuck Lever 	),
5680c77668dSChuck Lever 
5690c77668dSChuck Lever 	TP_printk("for uid %u, result=%d", __entry->uid, __entry->result)
5700c77668dSChuck Lever );
5710c77668dSChuck Lever 
5720c77668dSChuck Lever TRACE_EVENT(rpcgss_context,
5730c77668dSChuck Lever 	TP_PROTO(
57474fb8fecSChuck Lever 		u32 window_size,
5750c77668dSChuck Lever 		unsigned long expiry,
5760c77668dSChuck Lever 		unsigned long now,
5770c77668dSChuck Lever 		unsigned int timeout,
5780c77668dSChuck Lever 		unsigned int len,
5790c77668dSChuck Lever 		const u8 *data
5800c77668dSChuck Lever 	),
5810c77668dSChuck Lever 
58274fb8fecSChuck Lever 	TP_ARGS(window_size, expiry, now, timeout, len, data),
5830c77668dSChuck Lever 
5840c77668dSChuck Lever 	TP_STRUCT__entry(
5850c77668dSChuck Lever 		__field(unsigned long, expiry)
5860c77668dSChuck Lever 		__field(unsigned long, now)
5870c77668dSChuck Lever 		__field(unsigned int, timeout)
58874fb8fecSChuck Lever 		__field(u32, window_size)
5890c77668dSChuck Lever 		__field(int, len)
5900c77668dSChuck Lever 		__string(acceptor, data)
5910c77668dSChuck Lever 	),
5920c77668dSChuck Lever 
5930c77668dSChuck Lever 	TP_fast_assign(
5940c77668dSChuck Lever 		__entry->expiry = expiry;
5950c77668dSChuck Lever 		__entry->now = now;
5960c77668dSChuck Lever 		__entry->timeout = timeout;
59774fb8fecSChuck Lever 		__entry->window_size = window_size;
5980c77668dSChuck Lever 		__entry->len = len;
5990c77668dSChuck Lever 		strncpy(__get_str(acceptor), data, len);
6000c77668dSChuck Lever 	),
6010c77668dSChuck Lever 
60274fb8fecSChuck Lever 	TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
60374fb8fecSChuck Lever 		__entry->window_size, __entry->expiry, __entry->now,
60474fb8fecSChuck Lever 		__entry->timeout, __entry->len, __get_str(acceptor))
6050c77668dSChuck Lever );
6060c77668dSChuck Lever 
6070c77668dSChuck Lever 
6080c77668dSChuck Lever /**
6090c77668dSChuck Lever  ** Miscellaneous events
6100c77668dSChuck Lever  */
6110c77668dSChuck Lever 
6120c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5);
6130c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I);
6140c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P);
6150c77668dSChuck Lever 
6160c77668dSChuck Lever #define show_pseudoflavor(x)						\
6170c77668dSChuck Lever 	__print_symbolic(x,						\
6180c77668dSChuck Lever 		{ RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" },		\
6190c77668dSChuck Lever 		{ RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" },		\
6200c77668dSChuck Lever 		{ RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" })
6210c77668dSChuck Lever 
6220c77668dSChuck Lever 
6230c77668dSChuck Lever TRACE_EVENT(rpcgss_createauth,
6240c77668dSChuck Lever 	TP_PROTO(
6250c77668dSChuck Lever 		unsigned int flavor,
6260c77668dSChuck Lever 		int error
6270c77668dSChuck Lever 	),
6280c77668dSChuck Lever 
6290c77668dSChuck Lever 	TP_ARGS(flavor, error),
6300c77668dSChuck Lever 
6310c77668dSChuck Lever 	TP_STRUCT__entry(
6320c77668dSChuck Lever 		__field(unsigned int, flavor)
6330c77668dSChuck Lever 		__field(int, error)
6340c77668dSChuck Lever 
6350c77668dSChuck Lever 	),
6360c77668dSChuck Lever 
6370c77668dSChuck Lever 	TP_fast_assign(
6380c77668dSChuck Lever 		__entry->flavor = flavor;
6390c77668dSChuck Lever 		__entry->error = error;
6400c77668dSChuck Lever 	),
6410c77668dSChuck Lever 
6420c77668dSChuck Lever 	TP_printk("flavor=%s error=%d",
6430c77668dSChuck Lever 		show_pseudoflavor(__entry->flavor), __entry->error)
6440c77668dSChuck Lever );
6450c77668dSChuck Lever 
646ff27e9f7SChuck Lever TRACE_EVENT(rpcgss_oid_to_mech,
647ff27e9f7SChuck Lever 	TP_PROTO(
648ff27e9f7SChuck Lever 		const char *oid
649ff27e9f7SChuck Lever 	),
650ff27e9f7SChuck Lever 
651ff27e9f7SChuck Lever 	TP_ARGS(oid),
652ff27e9f7SChuck Lever 
653ff27e9f7SChuck Lever 	TP_STRUCT__entry(
654ff27e9f7SChuck Lever 		__string(oid, oid)
655ff27e9f7SChuck Lever 	),
656ff27e9f7SChuck Lever 
657ff27e9f7SChuck Lever 	TP_fast_assign(
658ff27e9f7SChuck Lever 		__assign_str(oid, oid);
659ff27e9f7SChuck Lever 	),
660ff27e9f7SChuck Lever 
661ff27e9f7SChuck Lever 	TP_printk("mech for oid %s was not found", __get_str(oid))
662ff27e9f7SChuck Lever );
6630c77668dSChuck Lever 
6640c77668dSChuck Lever #endif	/* _TRACE_RPCGSS_H */
6650c77668dSChuck Lever 
6660c77668dSChuck Lever #include <trace/define_trace.h>
667