xref: /openbmc/linux/include/trace/events/rpcgss.h (revision 78c14b38)
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 
110c77668dSChuck Lever #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
120c77668dSChuck Lever #define _TRACE_RPCGSS_H
130c77668dSChuck Lever 
140c77668dSChuck Lever #include <linux/tracepoint.h>
150c77668dSChuck Lever 
160c77668dSChuck Lever /**
170c77668dSChuck Lever  ** GSS-API related trace events
180c77668dSChuck Lever  **/
190c77668dSChuck Lever 
2074fb8fecSChuck Lever TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE);
2174fb8fecSChuck Lever TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY);
2274fb8fecSChuck Lever TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY);
2374fb8fecSChuck Lever 
2474fb8fecSChuck Lever #define show_gss_service(x)						\
2574fb8fecSChuck Lever 	__print_symbolic(x,						\
2674fb8fecSChuck Lever 		{ RPC_GSS_SVC_NONE,		"none" },		\
2774fb8fecSChuck Lever 		{ RPC_GSS_SVC_INTEGRITY,	"integrity" },		\
2874fb8fecSChuck Lever 		{ RPC_GSS_SVC_PRIVACY,		"privacy" })
2974fb8fecSChuck Lever 
300c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_MECH);
310c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_NAME);
320c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE);
330c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS);
340c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS);
350c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_SIG);
360c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NO_CRED);
370c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT);
380c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN);
390c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL);
400c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED);
410c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED);
420c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_FAILURE);
430c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_QOP);
440c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED);
450c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE);
460c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT);
470c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN);
480c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED);
490c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN);
500c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN);
510c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN);
520c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN);
530c77668dSChuck Lever 
540c77668dSChuck Lever #define show_gss_status(x)						\
550c77668dSChuck Lever 	__print_flags(x, "|",						\
560c77668dSChuck Lever 		{ GSS_S_BAD_MECH, "GSS_S_BAD_MECH" },			\
570c77668dSChuck Lever 		{ GSS_S_BAD_NAME, "GSS_S_BAD_NAME" },			\
580c77668dSChuck Lever 		{ GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" },		\
590c77668dSChuck Lever 		{ GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" },		\
600c77668dSChuck Lever 		{ GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" },		\
610c77668dSChuck Lever 		{ GSS_S_BAD_SIG, "GSS_S_BAD_SIG" },			\
620c77668dSChuck Lever 		{ GSS_S_NO_CRED, "GSS_S_NO_CRED" },			\
630c77668dSChuck Lever 		{ GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" },		\
640c77668dSChuck Lever 		{ GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" },	\
650c77668dSChuck Lever 		{ GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \
660c77668dSChuck Lever 		{ GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \
670c77668dSChuck Lever 		{ GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" },	\
680c77668dSChuck Lever 		{ GSS_S_FAILURE, "GSS_S_FAILURE" },			\
690c77668dSChuck Lever 		{ GSS_S_BAD_QOP, "GSS_S_BAD_QOP" },			\
700c77668dSChuck Lever 		{ GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" },		\
710c77668dSChuck Lever 		{ GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" },		\
720c77668dSChuck Lever 		{ GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" },	\
730c77668dSChuck Lever 		{ GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" },		\
740c77668dSChuck Lever 		{ GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" },	\
750c77668dSChuck Lever 		{ GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" },	\
760c77668dSChuck Lever 		{ GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" },			\
770c77668dSChuck Lever 		{ GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" },		\
780c77668dSChuck Lever 		{ GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" })
790c77668dSChuck Lever 
800c77668dSChuck Lever 
810c77668dSChuck Lever DECLARE_EVENT_CLASS(rpcgss_gssapi_event,
820c77668dSChuck Lever 	TP_PROTO(
830c77668dSChuck Lever 		const struct rpc_task *task,
840c77668dSChuck Lever 		u32 maj_stat
850c77668dSChuck Lever 	),
860c77668dSChuck Lever 
870c77668dSChuck Lever 	TP_ARGS(task, maj_stat),
880c77668dSChuck Lever 
890c77668dSChuck Lever 	TP_STRUCT__entry(
900c77668dSChuck Lever 		__field(unsigned int, task_id)
910c77668dSChuck Lever 		__field(unsigned int, client_id)
920c77668dSChuck Lever 		__field(u32, maj_stat)
930c77668dSChuck Lever 
940c77668dSChuck Lever 	),
950c77668dSChuck Lever 
960c77668dSChuck Lever 	TP_fast_assign(
970c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
980c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
990c77668dSChuck Lever 		__entry->maj_stat = maj_stat;
1000c77668dSChuck Lever 	),
1010c77668dSChuck Lever 
1020c77668dSChuck Lever 	TP_printk("task:%u@%u maj_stat=%s",
1030c77668dSChuck Lever 		__entry->task_id, __entry->client_id,
1040c77668dSChuck Lever 		__entry->maj_stat == 0 ?
1050c77668dSChuck Lever 		"GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
1060c77668dSChuck Lever );
1070c77668dSChuck Lever 
1080c77668dSChuck Lever #define DEFINE_GSSAPI_EVENT(name)					\
1090c77668dSChuck Lever 	DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name,		\
1100c77668dSChuck Lever 			TP_PROTO(					\
1110c77668dSChuck Lever 				const struct rpc_task *task,		\
1120c77668dSChuck Lever 				u32 maj_stat				\
1130c77668dSChuck Lever 			),						\
1140c77668dSChuck Lever 			TP_ARGS(task, maj_stat))
1150c77668dSChuck Lever 
1160c77668dSChuck Lever TRACE_EVENT(rpcgss_import_ctx,
1170c77668dSChuck Lever 	TP_PROTO(
1180c77668dSChuck Lever 		int status
1190c77668dSChuck Lever 	),
1200c77668dSChuck Lever 
1210c77668dSChuck Lever 	TP_ARGS(status),
1220c77668dSChuck Lever 
1230c77668dSChuck Lever 	TP_STRUCT__entry(
1240c77668dSChuck Lever 		__field(int, status)
1250c77668dSChuck Lever 	),
1260c77668dSChuck Lever 
1270c77668dSChuck Lever 	TP_fast_assign(
1280c77668dSChuck Lever 		__entry->status = status;
1290c77668dSChuck Lever 	),
1300c77668dSChuck Lever 
1310c77668dSChuck Lever 	TP_printk("status=%d", __entry->status)
1320c77668dSChuck Lever );
1330c77668dSChuck Lever 
1340c77668dSChuck Lever DEFINE_GSSAPI_EVENT(get_mic);
1350c77668dSChuck Lever DEFINE_GSSAPI_EVENT(verify_mic);
1360c77668dSChuck Lever DEFINE_GSSAPI_EVENT(wrap);
1370c77668dSChuck Lever DEFINE_GSSAPI_EVENT(unwrap);
1380c77668dSChuck Lever 
13974fb8fecSChuck Lever DECLARE_EVENT_CLASS(rpcgss_ctx_class,
14074fb8fecSChuck Lever 	TP_PROTO(
14174fb8fecSChuck Lever 		const struct gss_cred *gc
14274fb8fecSChuck Lever 	),
14374fb8fecSChuck Lever 
14474fb8fecSChuck Lever 	TP_ARGS(gc),
14574fb8fecSChuck Lever 
14674fb8fecSChuck Lever 	TP_STRUCT__entry(
14774fb8fecSChuck Lever 		__field(const void *, cred)
14874fb8fecSChuck Lever 		__field(unsigned long, service)
14974fb8fecSChuck Lever 		__string(principal, gc->gc_principal)
15074fb8fecSChuck Lever 	),
15174fb8fecSChuck Lever 
15274fb8fecSChuck Lever 	TP_fast_assign(
15374fb8fecSChuck Lever 		__entry->cred = gc;
15474fb8fecSChuck Lever 		__entry->service = gc->gc_service;
155*78c14b38SJoe Perches 		__assign_str(principal, gc->gc_principal);
15674fb8fecSChuck Lever 	),
15774fb8fecSChuck Lever 
15874fb8fecSChuck Lever 	TP_printk("cred=%p service=%s principal='%s'",
15974fb8fecSChuck Lever 		__entry->cred, show_gss_service(__entry->service),
16074fb8fecSChuck Lever 		__get_str(principal))
16174fb8fecSChuck Lever );
16274fb8fecSChuck Lever 
16374fb8fecSChuck Lever #define DEFINE_CTX_EVENT(name)						\
16474fb8fecSChuck Lever 	DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name,		\
16574fb8fecSChuck Lever 			TP_PROTO(					\
16674fb8fecSChuck Lever 				const struct gss_cred *gc		\
16774fb8fecSChuck Lever 			),						\
16874fb8fecSChuck Lever 			TP_ARGS(gc))
16974fb8fecSChuck Lever 
17074fb8fecSChuck Lever DEFINE_CTX_EVENT(init);
17174fb8fecSChuck Lever DEFINE_CTX_EVENT(destroy);
17274fb8fecSChuck Lever 
17310b9d99aSChuck Lever DECLARE_EVENT_CLASS(rpcgss_svc_gssapi_class,
17410b9d99aSChuck Lever 	TP_PROTO(
17510b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
17610b9d99aSChuck Lever 		u32 maj_stat
17710b9d99aSChuck Lever 	),
17810b9d99aSChuck Lever 
17910b9d99aSChuck Lever 	TP_ARGS(rqstp, maj_stat),
18010b9d99aSChuck Lever 
18110b9d99aSChuck Lever 	TP_STRUCT__entry(
18210b9d99aSChuck Lever 		__field(u32, xid)
18310b9d99aSChuck Lever 		__field(u32, maj_stat)
18410b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
18510b9d99aSChuck Lever 	),
18610b9d99aSChuck Lever 
18710b9d99aSChuck Lever 	TP_fast_assign(
18810b9d99aSChuck Lever 		__entry->xid = __be32_to_cpu(rqstp->rq_xid);
18910b9d99aSChuck Lever 		__entry->maj_stat = maj_stat;
19010b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
19110b9d99aSChuck Lever 	),
19210b9d99aSChuck Lever 
19310b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x maj_stat=%s",
19410b9d99aSChuck Lever 		__get_str(addr), __entry->xid,
19510b9d99aSChuck Lever 		__entry->maj_stat == 0 ?
19610b9d99aSChuck Lever 		"GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
19710b9d99aSChuck Lever );
19810b9d99aSChuck Lever 
19910b9d99aSChuck Lever #define DEFINE_SVC_GSSAPI_EVENT(name)					\
20010b9d99aSChuck Lever 	DEFINE_EVENT(rpcgss_svc_gssapi_class, rpcgss_svc_##name,	\
20110b9d99aSChuck Lever 			TP_PROTO(					\
20210b9d99aSChuck Lever 				const struct svc_rqst *rqstp,		\
20310b9d99aSChuck Lever 				u32 maj_stat				\
20410b9d99aSChuck Lever 			),						\
20510b9d99aSChuck Lever 			TP_ARGS(rqstp, maj_stat))
20610b9d99aSChuck Lever 
20710b9d99aSChuck Lever DEFINE_SVC_GSSAPI_EVENT(unwrap);
20810b9d99aSChuck Lever DEFINE_SVC_GSSAPI_EVENT(mic);
20910b9d99aSChuck Lever 
21010b9d99aSChuck Lever TRACE_EVENT(rpcgss_svc_unwrap_failed,
21110b9d99aSChuck Lever 	TP_PROTO(
21210b9d99aSChuck Lever 		const struct svc_rqst *rqstp
21310b9d99aSChuck Lever 	),
21410b9d99aSChuck Lever 
21510b9d99aSChuck Lever 	TP_ARGS(rqstp),
21610b9d99aSChuck Lever 
21710b9d99aSChuck Lever 	TP_STRUCT__entry(
21810b9d99aSChuck Lever 		__field(u32, xid)
21910b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
22010b9d99aSChuck Lever 	),
22110b9d99aSChuck Lever 
22210b9d99aSChuck Lever 	TP_fast_assign(
22310b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
22410b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
22510b9d99aSChuck Lever 	),
22610b9d99aSChuck Lever 
22710b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
22810b9d99aSChuck Lever );
22910b9d99aSChuck Lever 
23010b9d99aSChuck Lever TRACE_EVENT(rpcgss_svc_seqno_bad,
23110b9d99aSChuck Lever 	TP_PROTO(
23210b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
23310b9d99aSChuck Lever 		u32 expected,
23410b9d99aSChuck Lever 		u32 received
23510b9d99aSChuck Lever 	),
23610b9d99aSChuck Lever 
23710b9d99aSChuck Lever 	TP_ARGS(rqstp, expected, received),
23810b9d99aSChuck Lever 
23910b9d99aSChuck Lever 	TP_STRUCT__entry(
24010b9d99aSChuck Lever 		__field(u32, expected)
24110b9d99aSChuck Lever 		__field(u32, received)
24210b9d99aSChuck Lever 		__field(u32, xid)
24310b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
24410b9d99aSChuck Lever 	),
24510b9d99aSChuck Lever 
24610b9d99aSChuck Lever 	TP_fast_assign(
24710b9d99aSChuck Lever 		__entry->expected = expected;
24810b9d99aSChuck Lever 		__entry->received = received;
24910b9d99aSChuck Lever 		__entry->xid = __be32_to_cpu(rqstp->rq_xid);
25010b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
25110b9d99aSChuck Lever 	),
25210b9d99aSChuck Lever 
25310b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x expected seqno %u, received seqno %u",
25410b9d99aSChuck Lever 		__get_str(addr), __entry->xid,
25510b9d99aSChuck Lever 		__entry->expected, __entry->received)
25610b9d99aSChuck Lever );
25710b9d99aSChuck Lever 
25828155524SChuck Lever TRACE_EVENT(rpcgss_svc_accept_upcall,
259ff27e9f7SChuck Lever 	TP_PROTO(
26010b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
261ff27e9f7SChuck Lever 		u32 major_status,
262ff27e9f7SChuck Lever 		u32 minor_status
263ff27e9f7SChuck Lever 	),
264ff27e9f7SChuck Lever 
26510b9d99aSChuck Lever 	TP_ARGS(rqstp, major_status, minor_status),
266ff27e9f7SChuck Lever 
267ff27e9f7SChuck Lever 	TP_STRUCT__entry(
268ff27e9f7SChuck Lever 		__field(u32, minor_status)
269ff27e9f7SChuck Lever 		__field(unsigned long, major_status)
27010b9d99aSChuck Lever 		__field(u32, xid)
27110b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
272ff27e9f7SChuck Lever 	),
273ff27e9f7SChuck Lever 
274ff27e9f7SChuck Lever 	TP_fast_assign(
275ff27e9f7SChuck Lever 		__entry->minor_status = minor_status;
276ff27e9f7SChuck Lever 		__entry->major_status = major_status;
27710b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
27810b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
279ff27e9f7SChuck Lever 	),
280ff27e9f7SChuck Lever 
28110b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x major_status=%s (0x%08lx) minor_status=%u",
28210b9d99aSChuck Lever 		__get_str(addr), __entry->xid,
28310b9d99aSChuck Lever 		(__entry->major_status == 0) ? "GSS_S_COMPLETE" :
284ff27e9f7SChuck Lever 			show_gss_status(__entry->major_status),
285ff27e9f7SChuck Lever 		__entry->major_status, __entry->minor_status
286ff27e9f7SChuck Lever 	)
287ff27e9f7SChuck Lever );
288ff27e9f7SChuck Lever 
28910b9d99aSChuck Lever TRACE_EVENT(rpcgss_svc_authenticate,
29028155524SChuck Lever 	TP_PROTO(
29110b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
29210b9d99aSChuck Lever 		const struct rpc_gss_wire_cred *gc
29328155524SChuck Lever 	),
29428155524SChuck Lever 
29510b9d99aSChuck Lever 	TP_ARGS(rqstp, gc),
29628155524SChuck Lever 
29728155524SChuck Lever 	TP_STRUCT__entry(
29810b9d99aSChuck Lever 		__field(u32, seqno)
29928155524SChuck Lever 		__field(u32, xid)
30010b9d99aSChuck Lever 		__string(addr, rqstp->rq_xprt->xpt_remotebuf)
30128155524SChuck Lever 	),
30228155524SChuck Lever 
30328155524SChuck Lever 	TP_fast_assign(
30410b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
30510b9d99aSChuck Lever 		__entry->seqno = gc->gc_seq;
30610b9d99aSChuck Lever 		__assign_str(addr, rqstp->rq_xprt->xpt_remotebuf);
30728155524SChuck Lever 	),
30828155524SChuck Lever 
30910b9d99aSChuck Lever 	TP_printk("addr=%s xid=0x%08x seqno=%u", __get_str(addr),
31010b9d99aSChuck Lever 		__entry->xid, __entry->seqno)
31128155524SChuck Lever );
31228155524SChuck Lever 
3130c77668dSChuck Lever 
3140c77668dSChuck Lever /**
3150c77668dSChuck Lever  ** GSS auth unwrap failures
3160c77668dSChuck Lever  **/
3170c77668dSChuck Lever 
3180c77668dSChuck Lever TRACE_EVENT(rpcgss_unwrap_failed,
3190c77668dSChuck Lever 	TP_PROTO(
3200c77668dSChuck Lever 		const struct rpc_task *task
3210c77668dSChuck Lever 	),
3220c77668dSChuck Lever 
3230c77668dSChuck Lever 	TP_ARGS(task),
3240c77668dSChuck Lever 
3250c77668dSChuck Lever 	TP_STRUCT__entry(
3260c77668dSChuck Lever 		__field(unsigned int, task_id)
3270c77668dSChuck Lever 		__field(unsigned int, client_id)
3280c77668dSChuck Lever 	),
3290c77668dSChuck Lever 
3300c77668dSChuck Lever 	TP_fast_assign(
3310c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
3320c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
3330c77668dSChuck Lever 	),
3340c77668dSChuck Lever 
3350c77668dSChuck Lever 	TP_printk("task:%u@%u", __entry->task_id, __entry->client_id)
3360c77668dSChuck Lever );
3370c77668dSChuck Lever 
3380c77668dSChuck Lever TRACE_EVENT(rpcgss_bad_seqno,
3390c77668dSChuck Lever 	TP_PROTO(
3400c77668dSChuck Lever 		const struct rpc_task *task,
3410c77668dSChuck Lever 		u32 expected,
3420c77668dSChuck Lever 		u32 received
3430c77668dSChuck Lever 	),
3440c77668dSChuck Lever 
3450c77668dSChuck Lever 	TP_ARGS(task, expected, received),
3460c77668dSChuck Lever 
3470c77668dSChuck Lever 	TP_STRUCT__entry(
3480c77668dSChuck Lever 		__field(unsigned int, task_id)
3490c77668dSChuck Lever 		__field(unsigned int, client_id)
3500c77668dSChuck Lever 		__field(u32, expected)
3510c77668dSChuck Lever 		__field(u32, received)
3520c77668dSChuck Lever 	),
3530c77668dSChuck Lever 
3540c77668dSChuck Lever 	TP_fast_assign(
3550c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
3560c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
3570c77668dSChuck Lever 		__entry->expected = expected;
3580c77668dSChuck Lever 		__entry->received = received;
3590c77668dSChuck Lever 	),
3600c77668dSChuck Lever 
3610c77668dSChuck Lever 	TP_printk("task:%u@%u expected seqno %u, received seqno %u",
3620c77668dSChuck Lever 		__entry->task_id, __entry->client_id,
3630c77668dSChuck Lever 		__entry->expected, __entry->received)
3640c77668dSChuck Lever );
3650c77668dSChuck Lever 
3660c77668dSChuck Lever TRACE_EVENT(rpcgss_seqno,
3670c77668dSChuck Lever 	TP_PROTO(
3680c77668dSChuck Lever 		const struct rpc_task *task
3690c77668dSChuck Lever 	),
3700c77668dSChuck Lever 
3710c77668dSChuck Lever 	TP_ARGS(task),
3720c77668dSChuck Lever 
3730c77668dSChuck Lever 	TP_STRUCT__entry(
3740c77668dSChuck Lever 		__field(unsigned int, task_id)
3750c77668dSChuck Lever 		__field(unsigned int, client_id)
3760c77668dSChuck Lever 		__field(u32, xid)
3770c77668dSChuck Lever 		__field(u32, seqno)
3780c77668dSChuck Lever 	),
3790c77668dSChuck Lever 
3800c77668dSChuck Lever 	TP_fast_assign(
3810c77668dSChuck Lever 		const struct rpc_rqst *rqst = task->tk_rqstp;
3820c77668dSChuck Lever 
3830c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
3840c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
3850c77668dSChuck Lever 		__entry->xid = be32_to_cpu(rqst->rq_xid);
3860c77668dSChuck Lever 		__entry->seqno = rqst->rq_seqno;
3870c77668dSChuck Lever 	),
3880c77668dSChuck Lever 
3890c77668dSChuck Lever 	TP_printk("task:%u@%u xid=0x%08x seqno=%u",
3900c77668dSChuck Lever 		__entry->task_id, __entry->client_id,
3910c77668dSChuck Lever 		__entry->xid, __entry->seqno)
3920c77668dSChuck Lever );
3930c77668dSChuck Lever 
3940c77668dSChuck Lever TRACE_EVENT(rpcgss_need_reencode,
3950c77668dSChuck Lever 	TP_PROTO(
3960c77668dSChuck Lever 		const struct rpc_task *task,
3970c77668dSChuck Lever 		u32 seq_xmit,
3980c77668dSChuck Lever 		bool ret
3990c77668dSChuck Lever 	),
4000c77668dSChuck Lever 
4010c77668dSChuck Lever 	TP_ARGS(task, seq_xmit, ret),
4020c77668dSChuck Lever 
4030c77668dSChuck Lever 	TP_STRUCT__entry(
4040c77668dSChuck Lever 		__field(unsigned int, task_id)
4050c77668dSChuck Lever 		__field(unsigned int, client_id)
4060c77668dSChuck Lever 		__field(u32, xid)
4070c77668dSChuck Lever 		__field(u32, seq_xmit)
4080c77668dSChuck Lever 		__field(u32, seqno)
4090c77668dSChuck Lever 		__field(bool, ret)
4100c77668dSChuck Lever 	),
4110c77668dSChuck Lever 
4120c77668dSChuck Lever 	TP_fast_assign(
4130c77668dSChuck Lever 		__entry->task_id = task->tk_pid;
4140c77668dSChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
4150c77668dSChuck Lever 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
4160c77668dSChuck Lever 		__entry->seq_xmit = seq_xmit;
4170c77668dSChuck Lever 		__entry->seqno = task->tk_rqstp->rq_seqno;
4180c77668dSChuck Lever 		__entry->ret = ret;
4190c77668dSChuck Lever 	),
4200c77668dSChuck Lever 
4210c77668dSChuck Lever 	TP_printk("task:%u@%u xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
4220c77668dSChuck Lever 		__entry->task_id, __entry->client_id,
4230c77668dSChuck Lever 		__entry->xid, __entry->seqno, __entry->seq_xmit,
4240c77668dSChuck Lever 		__entry->ret ? "" : "un")
4250c77668dSChuck Lever );
4260c77668dSChuck Lever 
42753bc19f1SChuck Lever TRACE_EVENT(rpcgss_update_slack,
42853bc19f1SChuck Lever 	TP_PROTO(
42953bc19f1SChuck Lever 		const struct rpc_task *task,
43053bc19f1SChuck Lever 		const struct rpc_auth *auth
43153bc19f1SChuck Lever 	),
43253bc19f1SChuck Lever 
43353bc19f1SChuck Lever 	TP_ARGS(task, auth),
43453bc19f1SChuck Lever 
43553bc19f1SChuck Lever 	TP_STRUCT__entry(
43653bc19f1SChuck Lever 		__field(unsigned int, task_id)
43753bc19f1SChuck Lever 		__field(unsigned int, client_id)
43853bc19f1SChuck Lever 		__field(u32, xid)
43953bc19f1SChuck Lever 		__field(const void *, auth)
44053bc19f1SChuck Lever 		__field(unsigned int, rslack)
44153bc19f1SChuck Lever 		__field(unsigned int, ralign)
44253bc19f1SChuck Lever 		__field(unsigned int, verfsize)
44353bc19f1SChuck Lever 	),
44453bc19f1SChuck Lever 
44553bc19f1SChuck Lever 	TP_fast_assign(
44653bc19f1SChuck Lever 		__entry->task_id = task->tk_pid;
44753bc19f1SChuck Lever 		__entry->client_id = task->tk_client->cl_clid;
44853bc19f1SChuck Lever 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
44953bc19f1SChuck Lever 		__entry->auth = auth;
45053bc19f1SChuck Lever 		__entry->rslack = auth->au_rslack;
45153bc19f1SChuck Lever 		__entry->ralign = auth->au_ralign;
45253bc19f1SChuck Lever 		__entry->verfsize = auth->au_verfsize;
45353bc19f1SChuck Lever 	),
45453bc19f1SChuck Lever 
45553bc19f1SChuck Lever 	TP_printk("task:%u@%u xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n",
45653bc19f1SChuck Lever 		__entry->task_id, __entry->client_id, __entry->xid,
45753bc19f1SChuck Lever 		__entry->auth, __entry->rslack, __entry->ralign,
45853bc19f1SChuck Lever 		__entry->verfsize)
45953bc19f1SChuck Lever );
46053bc19f1SChuck Lever 
46128155524SChuck Lever DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class,
46228155524SChuck Lever 	TP_PROTO(
46310b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
46428155524SChuck Lever 		u32 seqno
46528155524SChuck Lever 	),
46628155524SChuck Lever 
46710b9d99aSChuck Lever 	TP_ARGS(rqstp, seqno),
46828155524SChuck Lever 
46928155524SChuck Lever 	TP_STRUCT__entry(
47028155524SChuck Lever 		__field(u32, xid)
47128155524SChuck Lever 		__field(u32, seqno)
47228155524SChuck Lever 	),
47328155524SChuck Lever 
47428155524SChuck Lever 	TP_fast_assign(
47510b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
47628155524SChuck Lever 		__entry->seqno = seqno;
47728155524SChuck Lever 	),
47828155524SChuck Lever 
47910b9d99aSChuck Lever 	TP_printk("xid=0x%08x seqno=%u",
48028155524SChuck Lever 		__entry->xid, __entry->seqno)
48128155524SChuck Lever );
48228155524SChuck Lever 
48328155524SChuck Lever #define DEFINE_SVC_SEQNO_EVENT(name)					\
48410b9d99aSChuck Lever 	DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_seqno_##name,	\
48528155524SChuck Lever 			TP_PROTO(					\
48610b9d99aSChuck Lever 				const struct svc_rqst *rqstp,		\
48728155524SChuck Lever 				u32 seqno				\
48828155524SChuck Lever 			),						\
48910b9d99aSChuck Lever 			TP_ARGS(rqstp, seqno))
49028155524SChuck Lever 
49110b9d99aSChuck Lever DEFINE_SVC_SEQNO_EVENT(large);
49210b9d99aSChuck Lever DEFINE_SVC_SEQNO_EVENT(seen);
49328155524SChuck Lever 
49410b9d99aSChuck Lever TRACE_EVENT(rpcgss_svc_seqno_low,
49510b9d99aSChuck Lever 	TP_PROTO(
49610b9d99aSChuck Lever 		const struct svc_rqst *rqstp,
49710b9d99aSChuck Lever 		u32 seqno,
49810b9d99aSChuck Lever 		u32 min,
49910b9d99aSChuck Lever 		u32 max
50010b9d99aSChuck Lever 	),
50110b9d99aSChuck Lever 
50210b9d99aSChuck Lever 	TP_ARGS(rqstp, seqno, min, max),
50310b9d99aSChuck Lever 
50410b9d99aSChuck Lever 	TP_STRUCT__entry(
50510b9d99aSChuck Lever 		__field(u32, xid)
50610b9d99aSChuck Lever 		__field(u32, seqno)
50710b9d99aSChuck Lever 		__field(u32, min)
50810b9d99aSChuck Lever 		__field(u32, max)
50910b9d99aSChuck Lever 	),
51010b9d99aSChuck Lever 
51110b9d99aSChuck Lever 	TP_fast_assign(
51210b9d99aSChuck Lever 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
51310b9d99aSChuck Lever 		__entry->seqno = seqno;
51410b9d99aSChuck Lever 		__entry->min = min;
51510b9d99aSChuck Lever 		__entry->max = max;
51610b9d99aSChuck Lever 	),
51710b9d99aSChuck Lever 
51810b9d99aSChuck Lever 	TP_printk("xid=0x%08x seqno=%u window=[%u..%u]",
51910b9d99aSChuck Lever 		__entry->xid, __entry->seqno, __entry->min, __entry->max)
52010b9d99aSChuck Lever );
52128155524SChuck Lever 
5220c77668dSChuck Lever /**
5230c77668dSChuck Lever  ** gssd upcall related trace events
5240c77668dSChuck Lever  **/
5250c77668dSChuck Lever 
5260c77668dSChuck Lever TRACE_EVENT(rpcgss_upcall_msg,
5270c77668dSChuck Lever 	TP_PROTO(
5280c77668dSChuck Lever 		const char *buf
5290c77668dSChuck Lever 	),
5300c77668dSChuck Lever 
5310c77668dSChuck Lever 	TP_ARGS(buf),
5320c77668dSChuck Lever 
5330c77668dSChuck Lever 	TP_STRUCT__entry(
5340c77668dSChuck Lever 		__string(msg, buf)
5350c77668dSChuck Lever 	),
5360c77668dSChuck Lever 
5370c77668dSChuck Lever 	TP_fast_assign(
538*78c14b38SJoe Perches 		__assign_str(msg, buf);
5390c77668dSChuck Lever 	),
5400c77668dSChuck Lever 
5410c77668dSChuck Lever 	TP_printk("msg='%s'", __get_str(msg))
5420c77668dSChuck Lever );
5430c77668dSChuck Lever 
5440c77668dSChuck Lever TRACE_EVENT(rpcgss_upcall_result,
5450c77668dSChuck Lever 	TP_PROTO(
5460c77668dSChuck Lever 		u32 uid,
5470c77668dSChuck Lever 		int result
5480c77668dSChuck Lever 	),
5490c77668dSChuck Lever 
5500c77668dSChuck Lever 	TP_ARGS(uid, result),
5510c77668dSChuck Lever 
5520c77668dSChuck Lever 	TP_STRUCT__entry(
5530c77668dSChuck Lever 		__field(u32, uid)
5540c77668dSChuck Lever 		__field(int, result)
5550c77668dSChuck Lever 
5560c77668dSChuck Lever 	),
5570c77668dSChuck Lever 
5580c77668dSChuck Lever 	TP_fast_assign(
5590c77668dSChuck Lever 		__entry->uid = uid;
5600c77668dSChuck Lever 		__entry->result = result;
5610c77668dSChuck Lever 	),
5620c77668dSChuck Lever 
5630c77668dSChuck Lever 	TP_printk("for uid %u, result=%d", __entry->uid, __entry->result)
5640c77668dSChuck Lever );
5650c77668dSChuck Lever 
5660c77668dSChuck Lever TRACE_EVENT(rpcgss_context,
5670c77668dSChuck Lever 	TP_PROTO(
56874fb8fecSChuck Lever 		u32 window_size,
5690c77668dSChuck Lever 		unsigned long expiry,
5700c77668dSChuck Lever 		unsigned long now,
5710c77668dSChuck Lever 		unsigned int timeout,
5720c77668dSChuck Lever 		unsigned int len,
5730c77668dSChuck Lever 		const u8 *data
5740c77668dSChuck Lever 	),
5750c77668dSChuck Lever 
57674fb8fecSChuck Lever 	TP_ARGS(window_size, expiry, now, timeout, len, data),
5770c77668dSChuck Lever 
5780c77668dSChuck Lever 	TP_STRUCT__entry(
5790c77668dSChuck Lever 		__field(unsigned long, expiry)
5800c77668dSChuck Lever 		__field(unsigned long, now)
5810c77668dSChuck Lever 		__field(unsigned int, timeout)
58274fb8fecSChuck Lever 		__field(u32, window_size)
5830c77668dSChuck Lever 		__field(int, len)
5840c77668dSChuck Lever 		__string(acceptor, data)
5850c77668dSChuck Lever 	),
5860c77668dSChuck Lever 
5870c77668dSChuck Lever 	TP_fast_assign(
5880c77668dSChuck Lever 		__entry->expiry = expiry;
5890c77668dSChuck Lever 		__entry->now = now;
5900c77668dSChuck Lever 		__entry->timeout = timeout;
59174fb8fecSChuck Lever 		__entry->window_size = window_size;
5920c77668dSChuck Lever 		__entry->len = len;
5930c77668dSChuck Lever 		strncpy(__get_str(acceptor), data, len);
5940c77668dSChuck Lever 	),
5950c77668dSChuck Lever 
59674fb8fecSChuck Lever 	TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
59774fb8fecSChuck Lever 		__entry->window_size, __entry->expiry, __entry->now,
59874fb8fecSChuck Lever 		__entry->timeout, __entry->len, __get_str(acceptor))
5990c77668dSChuck Lever );
6000c77668dSChuck Lever 
6010c77668dSChuck Lever 
6020c77668dSChuck Lever /**
6030c77668dSChuck Lever  ** Miscellaneous events
6040c77668dSChuck Lever  */
6050c77668dSChuck Lever 
6060c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5);
6070c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I);
6080c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P);
6090c77668dSChuck Lever 
6100c77668dSChuck Lever #define show_pseudoflavor(x)						\
6110c77668dSChuck Lever 	__print_symbolic(x,						\
6120c77668dSChuck Lever 		{ RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" },		\
6130c77668dSChuck Lever 		{ RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" },		\
6140c77668dSChuck Lever 		{ RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" })
6150c77668dSChuck Lever 
6160c77668dSChuck Lever 
6170c77668dSChuck Lever TRACE_EVENT(rpcgss_createauth,
6180c77668dSChuck Lever 	TP_PROTO(
6190c77668dSChuck Lever 		unsigned int flavor,
6200c77668dSChuck Lever 		int error
6210c77668dSChuck Lever 	),
6220c77668dSChuck Lever 
6230c77668dSChuck Lever 	TP_ARGS(flavor, error),
6240c77668dSChuck Lever 
6250c77668dSChuck Lever 	TP_STRUCT__entry(
6260c77668dSChuck Lever 		__field(unsigned int, flavor)
6270c77668dSChuck Lever 		__field(int, error)
6280c77668dSChuck Lever 
6290c77668dSChuck Lever 	),
6300c77668dSChuck Lever 
6310c77668dSChuck Lever 	TP_fast_assign(
6320c77668dSChuck Lever 		__entry->flavor = flavor;
6330c77668dSChuck Lever 		__entry->error = error;
6340c77668dSChuck Lever 	),
6350c77668dSChuck Lever 
6360c77668dSChuck Lever 	TP_printk("flavor=%s error=%d",
6370c77668dSChuck Lever 		show_pseudoflavor(__entry->flavor), __entry->error)
6380c77668dSChuck Lever );
6390c77668dSChuck Lever 
640ff27e9f7SChuck Lever TRACE_EVENT(rpcgss_oid_to_mech,
641ff27e9f7SChuck Lever 	TP_PROTO(
642ff27e9f7SChuck Lever 		const char *oid
643ff27e9f7SChuck Lever 	),
644ff27e9f7SChuck Lever 
645ff27e9f7SChuck Lever 	TP_ARGS(oid),
646ff27e9f7SChuck Lever 
647ff27e9f7SChuck Lever 	TP_STRUCT__entry(
648ff27e9f7SChuck Lever 		__string(oid, oid)
649ff27e9f7SChuck Lever 	),
650ff27e9f7SChuck Lever 
651ff27e9f7SChuck Lever 	TP_fast_assign(
652ff27e9f7SChuck Lever 		__assign_str(oid, oid);
653ff27e9f7SChuck Lever 	),
654ff27e9f7SChuck Lever 
655ff27e9f7SChuck Lever 	TP_printk("mech for oid %s was not found", __get_str(oid))
656ff27e9f7SChuck Lever );
6570c77668dSChuck Lever 
6580c77668dSChuck Lever #endif	/* _TRACE_RPCGSS_H */
6590c77668dSChuck Lever 
6600c77668dSChuck Lever #include <trace/define_trace.h>
661