1*0c77668dSChuck Lever /* SPDX-License-Identifier: GPL-2.0 */ 2*0c77668dSChuck Lever /* 3*0c77668dSChuck Lever * Copyright (c) 2018 Oracle. All rights reserved. 4*0c77668dSChuck Lever * 5*0c77668dSChuck Lever * Trace point definitions for the "rpcgss" subsystem. 6*0c77668dSChuck Lever */ 7*0c77668dSChuck Lever 8*0c77668dSChuck Lever #undef TRACE_SYSTEM 9*0c77668dSChuck Lever #define TRACE_SYSTEM rpcgss 10*0c77668dSChuck Lever 11*0c77668dSChuck Lever #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ) 12*0c77668dSChuck Lever #define _TRACE_RPCGSS_H 13*0c77668dSChuck Lever 14*0c77668dSChuck Lever #include <linux/tracepoint.h> 15*0c77668dSChuck Lever 16*0c77668dSChuck Lever /** 17*0c77668dSChuck Lever ** GSS-API related trace events 18*0c77668dSChuck Lever **/ 19*0c77668dSChuck Lever 20*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_MECH); 21*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_NAME); 22*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE); 23*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS); 24*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS); 25*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_SIG); 26*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NO_CRED); 27*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT); 28*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN); 29*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL); 30*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED); 31*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED); 32*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_FAILURE); 33*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_BAD_QOP); 34*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED); 35*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE); 36*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT); 37*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN); 38*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED); 39*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN); 40*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN); 41*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN); 42*0c77668dSChuck Lever TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN); 43*0c77668dSChuck Lever 44*0c77668dSChuck Lever #define show_gss_status(x) \ 45*0c77668dSChuck Lever __print_flags(x, "|", \ 46*0c77668dSChuck Lever { GSS_S_BAD_MECH, "GSS_S_BAD_MECH" }, \ 47*0c77668dSChuck Lever { GSS_S_BAD_NAME, "GSS_S_BAD_NAME" }, \ 48*0c77668dSChuck Lever { GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" }, \ 49*0c77668dSChuck Lever { GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" }, \ 50*0c77668dSChuck Lever { GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" }, \ 51*0c77668dSChuck Lever { GSS_S_BAD_SIG, "GSS_S_BAD_SIG" }, \ 52*0c77668dSChuck Lever { GSS_S_NO_CRED, "GSS_S_NO_CRED" }, \ 53*0c77668dSChuck Lever { GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" }, \ 54*0c77668dSChuck Lever { GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" }, \ 55*0c77668dSChuck Lever { GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \ 56*0c77668dSChuck Lever { GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \ 57*0c77668dSChuck Lever { GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" }, \ 58*0c77668dSChuck Lever { GSS_S_FAILURE, "GSS_S_FAILURE" }, \ 59*0c77668dSChuck Lever { GSS_S_BAD_QOP, "GSS_S_BAD_QOP" }, \ 60*0c77668dSChuck Lever { GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" }, \ 61*0c77668dSChuck Lever { GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" }, \ 62*0c77668dSChuck Lever { GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" }, \ 63*0c77668dSChuck Lever { GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" }, \ 64*0c77668dSChuck Lever { GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" }, \ 65*0c77668dSChuck Lever { GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" }, \ 66*0c77668dSChuck Lever { GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" }, \ 67*0c77668dSChuck Lever { GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" }, \ 68*0c77668dSChuck Lever { GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" }) 69*0c77668dSChuck Lever 70*0c77668dSChuck Lever 71*0c77668dSChuck Lever DECLARE_EVENT_CLASS(rpcgss_gssapi_event, 72*0c77668dSChuck Lever TP_PROTO( 73*0c77668dSChuck Lever const struct rpc_task *task, 74*0c77668dSChuck Lever u32 maj_stat 75*0c77668dSChuck Lever ), 76*0c77668dSChuck Lever 77*0c77668dSChuck Lever TP_ARGS(task, maj_stat), 78*0c77668dSChuck Lever 79*0c77668dSChuck Lever TP_STRUCT__entry( 80*0c77668dSChuck Lever __field(unsigned int, task_id) 81*0c77668dSChuck Lever __field(unsigned int, client_id) 82*0c77668dSChuck Lever __field(u32, maj_stat) 83*0c77668dSChuck Lever 84*0c77668dSChuck Lever ), 85*0c77668dSChuck Lever 86*0c77668dSChuck Lever TP_fast_assign( 87*0c77668dSChuck Lever __entry->task_id = task->tk_pid; 88*0c77668dSChuck Lever __entry->client_id = task->tk_client->cl_clid; 89*0c77668dSChuck Lever __entry->maj_stat = maj_stat; 90*0c77668dSChuck Lever ), 91*0c77668dSChuck Lever 92*0c77668dSChuck Lever TP_printk("task:%u@%u maj_stat=%s", 93*0c77668dSChuck Lever __entry->task_id, __entry->client_id, 94*0c77668dSChuck Lever __entry->maj_stat == 0 ? 95*0c77668dSChuck Lever "GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat)) 96*0c77668dSChuck Lever ); 97*0c77668dSChuck Lever 98*0c77668dSChuck Lever #define DEFINE_GSSAPI_EVENT(name) \ 99*0c77668dSChuck Lever DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \ 100*0c77668dSChuck Lever TP_PROTO( \ 101*0c77668dSChuck Lever const struct rpc_task *task, \ 102*0c77668dSChuck Lever u32 maj_stat \ 103*0c77668dSChuck Lever ), \ 104*0c77668dSChuck Lever TP_ARGS(task, maj_stat)) 105*0c77668dSChuck Lever 106*0c77668dSChuck Lever TRACE_EVENT(rpcgss_import_ctx, 107*0c77668dSChuck Lever TP_PROTO( 108*0c77668dSChuck Lever int status 109*0c77668dSChuck Lever ), 110*0c77668dSChuck Lever 111*0c77668dSChuck Lever TP_ARGS(status), 112*0c77668dSChuck Lever 113*0c77668dSChuck Lever TP_STRUCT__entry( 114*0c77668dSChuck Lever __field(int, status) 115*0c77668dSChuck Lever ), 116*0c77668dSChuck Lever 117*0c77668dSChuck Lever TP_fast_assign( 118*0c77668dSChuck Lever __entry->status = status; 119*0c77668dSChuck Lever ), 120*0c77668dSChuck Lever 121*0c77668dSChuck Lever TP_printk("status=%d", __entry->status) 122*0c77668dSChuck Lever ); 123*0c77668dSChuck Lever 124*0c77668dSChuck Lever DEFINE_GSSAPI_EVENT(get_mic); 125*0c77668dSChuck Lever DEFINE_GSSAPI_EVENT(verify_mic); 126*0c77668dSChuck Lever DEFINE_GSSAPI_EVENT(wrap); 127*0c77668dSChuck Lever DEFINE_GSSAPI_EVENT(unwrap); 128*0c77668dSChuck Lever 129*0c77668dSChuck Lever 130*0c77668dSChuck Lever /** 131*0c77668dSChuck Lever ** GSS auth unwrap failures 132*0c77668dSChuck Lever **/ 133*0c77668dSChuck Lever 134*0c77668dSChuck Lever TRACE_EVENT(rpcgss_unwrap_failed, 135*0c77668dSChuck Lever TP_PROTO( 136*0c77668dSChuck Lever const struct rpc_task *task 137*0c77668dSChuck Lever ), 138*0c77668dSChuck Lever 139*0c77668dSChuck Lever TP_ARGS(task), 140*0c77668dSChuck Lever 141*0c77668dSChuck Lever TP_STRUCT__entry( 142*0c77668dSChuck Lever __field(unsigned int, task_id) 143*0c77668dSChuck Lever __field(unsigned int, client_id) 144*0c77668dSChuck Lever ), 145*0c77668dSChuck Lever 146*0c77668dSChuck Lever TP_fast_assign( 147*0c77668dSChuck Lever __entry->task_id = task->tk_pid; 148*0c77668dSChuck Lever __entry->client_id = task->tk_client->cl_clid; 149*0c77668dSChuck Lever ), 150*0c77668dSChuck Lever 151*0c77668dSChuck Lever TP_printk("task:%u@%u", __entry->task_id, __entry->client_id) 152*0c77668dSChuck Lever ); 153*0c77668dSChuck Lever 154*0c77668dSChuck Lever TRACE_EVENT(rpcgss_bad_seqno, 155*0c77668dSChuck Lever TP_PROTO( 156*0c77668dSChuck Lever const struct rpc_task *task, 157*0c77668dSChuck Lever u32 expected, 158*0c77668dSChuck Lever u32 received 159*0c77668dSChuck Lever ), 160*0c77668dSChuck Lever 161*0c77668dSChuck Lever TP_ARGS(task, expected, received), 162*0c77668dSChuck Lever 163*0c77668dSChuck Lever TP_STRUCT__entry( 164*0c77668dSChuck Lever __field(unsigned int, task_id) 165*0c77668dSChuck Lever __field(unsigned int, client_id) 166*0c77668dSChuck Lever __field(u32, expected) 167*0c77668dSChuck Lever __field(u32, received) 168*0c77668dSChuck Lever ), 169*0c77668dSChuck Lever 170*0c77668dSChuck Lever TP_fast_assign( 171*0c77668dSChuck Lever __entry->task_id = task->tk_pid; 172*0c77668dSChuck Lever __entry->client_id = task->tk_client->cl_clid; 173*0c77668dSChuck Lever __entry->expected = expected; 174*0c77668dSChuck Lever __entry->received = received; 175*0c77668dSChuck Lever ), 176*0c77668dSChuck Lever 177*0c77668dSChuck Lever TP_printk("task:%u@%u expected seqno %u, received seqno %u", 178*0c77668dSChuck Lever __entry->task_id, __entry->client_id, 179*0c77668dSChuck Lever __entry->expected, __entry->received) 180*0c77668dSChuck Lever ); 181*0c77668dSChuck Lever 182*0c77668dSChuck Lever TRACE_EVENT(rpcgss_seqno, 183*0c77668dSChuck Lever TP_PROTO( 184*0c77668dSChuck Lever const struct rpc_task *task 185*0c77668dSChuck Lever ), 186*0c77668dSChuck Lever 187*0c77668dSChuck Lever TP_ARGS(task), 188*0c77668dSChuck Lever 189*0c77668dSChuck Lever TP_STRUCT__entry( 190*0c77668dSChuck Lever __field(unsigned int, task_id) 191*0c77668dSChuck Lever __field(unsigned int, client_id) 192*0c77668dSChuck Lever __field(u32, xid) 193*0c77668dSChuck Lever __field(u32, seqno) 194*0c77668dSChuck Lever ), 195*0c77668dSChuck Lever 196*0c77668dSChuck Lever TP_fast_assign( 197*0c77668dSChuck Lever const struct rpc_rqst *rqst = task->tk_rqstp; 198*0c77668dSChuck Lever 199*0c77668dSChuck Lever __entry->task_id = task->tk_pid; 200*0c77668dSChuck Lever __entry->client_id = task->tk_client->cl_clid; 201*0c77668dSChuck Lever __entry->xid = be32_to_cpu(rqst->rq_xid); 202*0c77668dSChuck Lever __entry->seqno = rqst->rq_seqno; 203*0c77668dSChuck Lever ), 204*0c77668dSChuck Lever 205*0c77668dSChuck Lever TP_printk("task:%u@%u xid=0x%08x seqno=%u", 206*0c77668dSChuck Lever __entry->task_id, __entry->client_id, 207*0c77668dSChuck Lever __entry->xid, __entry->seqno) 208*0c77668dSChuck Lever ); 209*0c77668dSChuck Lever 210*0c77668dSChuck Lever TRACE_EVENT(rpcgss_need_reencode, 211*0c77668dSChuck Lever TP_PROTO( 212*0c77668dSChuck Lever const struct rpc_task *task, 213*0c77668dSChuck Lever u32 seq_xmit, 214*0c77668dSChuck Lever bool ret 215*0c77668dSChuck Lever ), 216*0c77668dSChuck Lever 217*0c77668dSChuck Lever TP_ARGS(task, seq_xmit, ret), 218*0c77668dSChuck Lever 219*0c77668dSChuck Lever TP_STRUCT__entry( 220*0c77668dSChuck Lever __field(unsigned int, task_id) 221*0c77668dSChuck Lever __field(unsigned int, client_id) 222*0c77668dSChuck Lever __field(u32, xid) 223*0c77668dSChuck Lever __field(u32, seq_xmit) 224*0c77668dSChuck Lever __field(u32, seqno) 225*0c77668dSChuck Lever __field(bool, ret) 226*0c77668dSChuck Lever ), 227*0c77668dSChuck Lever 228*0c77668dSChuck Lever TP_fast_assign( 229*0c77668dSChuck Lever __entry->task_id = task->tk_pid; 230*0c77668dSChuck Lever __entry->client_id = task->tk_client->cl_clid; 231*0c77668dSChuck Lever __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 232*0c77668dSChuck Lever __entry->seq_xmit = seq_xmit; 233*0c77668dSChuck Lever __entry->seqno = task->tk_rqstp->rq_seqno; 234*0c77668dSChuck Lever __entry->ret = ret; 235*0c77668dSChuck Lever ), 236*0c77668dSChuck Lever 237*0c77668dSChuck Lever TP_printk("task:%u@%u xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded", 238*0c77668dSChuck Lever __entry->task_id, __entry->client_id, 239*0c77668dSChuck Lever __entry->xid, __entry->seqno, __entry->seq_xmit, 240*0c77668dSChuck Lever __entry->ret ? "" : "un") 241*0c77668dSChuck Lever ); 242*0c77668dSChuck Lever 243*0c77668dSChuck Lever /** 244*0c77668dSChuck Lever ** gssd upcall related trace events 245*0c77668dSChuck Lever **/ 246*0c77668dSChuck Lever 247*0c77668dSChuck Lever TRACE_EVENT(rpcgss_upcall_msg, 248*0c77668dSChuck Lever TP_PROTO( 249*0c77668dSChuck Lever const char *buf 250*0c77668dSChuck Lever ), 251*0c77668dSChuck Lever 252*0c77668dSChuck Lever TP_ARGS(buf), 253*0c77668dSChuck Lever 254*0c77668dSChuck Lever TP_STRUCT__entry( 255*0c77668dSChuck Lever __string(msg, buf) 256*0c77668dSChuck Lever ), 257*0c77668dSChuck Lever 258*0c77668dSChuck Lever TP_fast_assign( 259*0c77668dSChuck Lever __assign_str(msg, buf) 260*0c77668dSChuck Lever ), 261*0c77668dSChuck Lever 262*0c77668dSChuck Lever TP_printk("msg='%s'", __get_str(msg)) 263*0c77668dSChuck Lever ); 264*0c77668dSChuck Lever 265*0c77668dSChuck Lever TRACE_EVENT(rpcgss_upcall_result, 266*0c77668dSChuck Lever TP_PROTO( 267*0c77668dSChuck Lever u32 uid, 268*0c77668dSChuck Lever int result 269*0c77668dSChuck Lever ), 270*0c77668dSChuck Lever 271*0c77668dSChuck Lever TP_ARGS(uid, result), 272*0c77668dSChuck Lever 273*0c77668dSChuck Lever TP_STRUCT__entry( 274*0c77668dSChuck Lever __field(u32, uid) 275*0c77668dSChuck Lever __field(int, result) 276*0c77668dSChuck Lever 277*0c77668dSChuck Lever ), 278*0c77668dSChuck Lever 279*0c77668dSChuck Lever TP_fast_assign( 280*0c77668dSChuck Lever __entry->uid = uid; 281*0c77668dSChuck Lever __entry->result = result; 282*0c77668dSChuck Lever ), 283*0c77668dSChuck Lever 284*0c77668dSChuck Lever TP_printk("for uid %u, result=%d", __entry->uid, __entry->result) 285*0c77668dSChuck Lever ); 286*0c77668dSChuck Lever 287*0c77668dSChuck Lever TRACE_EVENT(rpcgss_context, 288*0c77668dSChuck Lever TP_PROTO( 289*0c77668dSChuck Lever unsigned long expiry, 290*0c77668dSChuck Lever unsigned long now, 291*0c77668dSChuck Lever unsigned int timeout, 292*0c77668dSChuck Lever unsigned int len, 293*0c77668dSChuck Lever const u8 *data 294*0c77668dSChuck Lever ), 295*0c77668dSChuck Lever 296*0c77668dSChuck Lever TP_ARGS(expiry, now, timeout, len, data), 297*0c77668dSChuck Lever 298*0c77668dSChuck Lever TP_STRUCT__entry( 299*0c77668dSChuck Lever __field(unsigned long, expiry) 300*0c77668dSChuck Lever __field(unsigned long, now) 301*0c77668dSChuck Lever __field(unsigned int, timeout) 302*0c77668dSChuck Lever __field(int, len) 303*0c77668dSChuck Lever __string(acceptor, data) 304*0c77668dSChuck Lever ), 305*0c77668dSChuck Lever 306*0c77668dSChuck Lever TP_fast_assign( 307*0c77668dSChuck Lever __entry->expiry = expiry; 308*0c77668dSChuck Lever __entry->now = now; 309*0c77668dSChuck Lever __entry->timeout = timeout; 310*0c77668dSChuck Lever __entry->len = len; 311*0c77668dSChuck Lever strncpy(__get_str(acceptor), data, len); 312*0c77668dSChuck Lever ), 313*0c77668dSChuck Lever 314*0c77668dSChuck Lever TP_printk("gc_expiry=%lu now=%lu timeout=%u acceptor=%.*s", 315*0c77668dSChuck Lever __entry->expiry, __entry->now, __entry->timeout, 316*0c77668dSChuck Lever __entry->len, __get_str(acceptor)) 317*0c77668dSChuck Lever ); 318*0c77668dSChuck Lever 319*0c77668dSChuck Lever 320*0c77668dSChuck Lever /** 321*0c77668dSChuck Lever ** Miscellaneous events 322*0c77668dSChuck Lever */ 323*0c77668dSChuck Lever 324*0c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 325*0c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 326*0c77668dSChuck Lever TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 327*0c77668dSChuck Lever 328*0c77668dSChuck Lever #define show_pseudoflavor(x) \ 329*0c77668dSChuck Lever __print_symbolic(x, \ 330*0c77668dSChuck Lever { RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" }, \ 331*0c77668dSChuck Lever { RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" }, \ 332*0c77668dSChuck Lever { RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" }) 333*0c77668dSChuck Lever 334*0c77668dSChuck Lever 335*0c77668dSChuck Lever TRACE_EVENT(rpcgss_createauth, 336*0c77668dSChuck Lever TP_PROTO( 337*0c77668dSChuck Lever unsigned int flavor, 338*0c77668dSChuck Lever int error 339*0c77668dSChuck Lever ), 340*0c77668dSChuck Lever 341*0c77668dSChuck Lever TP_ARGS(flavor, error), 342*0c77668dSChuck Lever 343*0c77668dSChuck Lever TP_STRUCT__entry( 344*0c77668dSChuck Lever __field(unsigned int, flavor) 345*0c77668dSChuck Lever __field(int, error) 346*0c77668dSChuck Lever 347*0c77668dSChuck Lever ), 348*0c77668dSChuck Lever 349*0c77668dSChuck Lever TP_fast_assign( 350*0c77668dSChuck Lever __entry->flavor = flavor; 351*0c77668dSChuck Lever __entry->error = error; 352*0c77668dSChuck Lever ), 353*0c77668dSChuck Lever 354*0c77668dSChuck Lever TP_printk("flavor=%s error=%d", 355*0c77668dSChuck Lever show_pseudoflavor(__entry->flavor), __entry->error) 356*0c77668dSChuck Lever ); 357*0c77668dSChuck Lever 358*0c77668dSChuck Lever 359*0c77668dSChuck Lever #endif /* _TRACE_RPCGSS_H */ 360*0c77668dSChuck Lever 361*0c77668dSChuck Lever #include <trace/define_trace.h> 362