1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2348b5901SAneesh Kumar K.V #undef TRACE_SYSTEM 3348b5901SAneesh Kumar K.V #define TRACE_SYSTEM 9p 4348b5901SAneesh Kumar K.V 5348b5901SAneesh Kumar K.V #if !defined(_TRACE_9P_H) || defined(TRACE_HEADER_MULTI_READ) 6348b5901SAneesh Kumar K.V #define _TRACE_9P_H 7348b5901SAneesh Kumar K.V 8348b5901SAneesh Kumar K.V #include <linux/tracepoint.h> 9348b5901SAneesh Kumar K.V 1056e1b226SSteven Rostedt (Red Hat) #define P9_MSG_T \ 1156e1b226SSteven Rostedt (Red Hat) EM( P9_TLERROR, "P9_TLERROR" ) \ 1256e1b226SSteven Rostedt (Red Hat) EM( P9_RLERROR, "P9_RLERROR" ) \ 1356e1b226SSteven Rostedt (Red Hat) EM( P9_TSTATFS, "P9_TSTATFS" ) \ 1456e1b226SSteven Rostedt (Red Hat) EM( P9_RSTATFS, "P9_RSTATFS" ) \ 1556e1b226SSteven Rostedt (Red Hat) EM( P9_TLOPEN, "P9_TLOPEN" ) \ 1656e1b226SSteven Rostedt (Red Hat) EM( P9_RLOPEN, "P9_RLOPEN" ) \ 1756e1b226SSteven Rostedt (Red Hat) EM( P9_TLCREATE, "P9_TLCREATE" ) \ 1856e1b226SSteven Rostedt (Red Hat) EM( P9_RLCREATE, "P9_RLCREATE" ) \ 1956e1b226SSteven Rostedt (Red Hat) EM( P9_TSYMLINK, "P9_TSYMLINK" ) \ 2056e1b226SSteven Rostedt (Red Hat) EM( P9_RSYMLINK, "P9_RSYMLINK" ) \ 2156e1b226SSteven Rostedt (Red Hat) EM( P9_TMKNOD, "P9_TMKNOD" ) \ 2256e1b226SSteven Rostedt (Red Hat) EM( P9_RMKNOD, "P9_RMKNOD" ) \ 2356e1b226SSteven Rostedt (Red Hat) EM( P9_TRENAME, "P9_TRENAME" ) \ 2456e1b226SSteven Rostedt (Red Hat) EM( P9_RRENAME, "P9_RRENAME" ) \ 2556e1b226SSteven Rostedt (Red Hat) EM( P9_TREADLINK, "P9_TREADLINK" ) \ 2656e1b226SSteven Rostedt (Red Hat) EM( P9_RREADLINK, "P9_RREADLINK" ) \ 2756e1b226SSteven Rostedt (Red Hat) EM( P9_TGETATTR, "P9_TGETATTR" ) \ 2856e1b226SSteven Rostedt (Red Hat) EM( P9_RGETATTR, "P9_RGETATTR" ) \ 2956e1b226SSteven Rostedt (Red Hat) EM( P9_TSETATTR, "P9_TSETATTR" ) \ 3056e1b226SSteven Rostedt (Red Hat) EM( P9_RSETATTR, "P9_RSETATTR" ) \ 3156e1b226SSteven Rostedt (Red Hat) EM( P9_TXATTRWALK, "P9_TXATTRWALK" ) \ 3256e1b226SSteven Rostedt (Red Hat) EM( P9_RXATTRWALK, "P9_RXATTRWALK" ) \ 3356e1b226SSteven Rostedt (Red Hat) EM( P9_TXATTRCREATE, "P9_TXATTRCREATE" ) \ 3456e1b226SSteven Rostedt (Red Hat) EM( P9_RXATTRCREATE, "P9_RXATTRCREATE" ) \ 3556e1b226SSteven Rostedt (Red Hat) EM( P9_TREADDIR, "P9_TREADDIR" ) \ 3656e1b226SSteven Rostedt (Red Hat) EM( P9_RREADDIR, "P9_RREADDIR" ) \ 3756e1b226SSteven Rostedt (Red Hat) EM( P9_TFSYNC, "P9_TFSYNC" ) \ 3856e1b226SSteven Rostedt (Red Hat) EM( P9_RFSYNC, "P9_RFSYNC" ) \ 3956e1b226SSteven Rostedt (Red Hat) EM( P9_TLOCK, "P9_TLOCK" ) \ 4056e1b226SSteven Rostedt (Red Hat) EM( P9_RLOCK, "P9_RLOCK" ) \ 4156e1b226SSteven Rostedt (Red Hat) EM( P9_TGETLOCK, "P9_TGETLOCK" ) \ 4256e1b226SSteven Rostedt (Red Hat) EM( P9_RGETLOCK, "P9_RGETLOCK" ) \ 4356e1b226SSteven Rostedt (Red Hat) EM( P9_TLINK, "P9_TLINK" ) \ 4456e1b226SSteven Rostedt (Red Hat) EM( P9_RLINK, "P9_RLINK" ) \ 4556e1b226SSteven Rostedt (Red Hat) EM( P9_TMKDIR, "P9_TMKDIR" ) \ 4656e1b226SSteven Rostedt (Red Hat) EM( P9_RMKDIR, "P9_RMKDIR" ) \ 4756e1b226SSteven Rostedt (Red Hat) EM( P9_TRENAMEAT, "P9_TRENAMEAT" ) \ 4856e1b226SSteven Rostedt (Red Hat) EM( P9_RRENAMEAT, "P9_RRENAMEAT" ) \ 4956e1b226SSteven Rostedt (Red Hat) EM( P9_TUNLINKAT, "P9_TUNLINKAT" ) \ 5056e1b226SSteven Rostedt (Red Hat) EM( P9_RUNLINKAT, "P9_RUNLINKAT" ) \ 5156e1b226SSteven Rostedt (Red Hat) EM( P9_TVERSION, "P9_TVERSION" ) \ 5256e1b226SSteven Rostedt (Red Hat) EM( P9_RVERSION, "P9_RVERSION" ) \ 5356e1b226SSteven Rostedt (Red Hat) EM( P9_TAUTH, "P9_TAUTH" ) \ 5456e1b226SSteven Rostedt (Red Hat) EM( P9_RAUTH, "P9_RAUTH" ) \ 5556e1b226SSteven Rostedt (Red Hat) EM( P9_TATTACH, "P9_TATTACH" ) \ 5656e1b226SSteven Rostedt (Red Hat) EM( P9_RATTACH, "P9_RATTACH" ) \ 5756e1b226SSteven Rostedt (Red Hat) EM( P9_TERROR, "P9_TERROR" ) \ 5856e1b226SSteven Rostedt (Red Hat) EM( P9_RERROR, "P9_RERROR" ) \ 5956e1b226SSteven Rostedt (Red Hat) EM( P9_TFLUSH, "P9_TFLUSH" ) \ 6056e1b226SSteven Rostedt (Red Hat) EM( P9_RFLUSH, "P9_RFLUSH" ) \ 6156e1b226SSteven Rostedt (Red Hat) EM( P9_TWALK, "P9_TWALK" ) \ 6256e1b226SSteven Rostedt (Red Hat) EM( P9_RWALK, "P9_RWALK" ) \ 6356e1b226SSteven Rostedt (Red Hat) EM( P9_TOPEN, "P9_TOPEN" ) \ 6456e1b226SSteven Rostedt (Red Hat) EM( P9_ROPEN, "P9_ROPEN" ) \ 6556e1b226SSteven Rostedt (Red Hat) EM( P9_TCREATE, "P9_TCREATE" ) \ 6656e1b226SSteven Rostedt (Red Hat) EM( P9_RCREATE, "P9_RCREATE" ) \ 6756e1b226SSteven Rostedt (Red Hat) EM( P9_TREAD, "P9_TREAD" ) \ 6856e1b226SSteven Rostedt (Red Hat) EM( P9_RREAD, "P9_RREAD" ) \ 6956e1b226SSteven Rostedt (Red Hat) EM( P9_TWRITE, "P9_TWRITE" ) \ 7056e1b226SSteven Rostedt (Red Hat) EM( P9_RWRITE, "P9_RWRITE" ) \ 7156e1b226SSteven Rostedt (Red Hat) EM( P9_TCLUNK, "P9_TCLUNK" ) \ 7256e1b226SSteven Rostedt (Red Hat) EM( P9_RCLUNK, "P9_RCLUNK" ) \ 7356e1b226SSteven Rostedt (Red Hat) EM( P9_TREMOVE, "P9_TREMOVE" ) \ 7456e1b226SSteven Rostedt (Red Hat) EM( P9_RREMOVE, "P9_RREMOVE" ) \ 7556e1b226SSteven Rostedt (Red Hat) EM( P9_TSTAT, "P9_TSTAT" ) \ 7656e1b226SSteven Rostedt (Red Hat) EM( P9_RSTAT, "P9_RSTAT" ) \ 7756e1b226SSteven Rostedt (Red Hat) EM( P9_TWSTAT, "P9_TWSTAT" ) \ 7856e1b226SSteven Rostedt (Red Hat) EMe(P9_RWSTAT, "P9_RWSTAT" ) 7956e1b226SSteven Rostedt (Red Hat) 8056e1b226SSteven Rostedt (Red Hat) /* Define EM() to export the enums to userspace via TRACE_DEFINE_ENUM() */ 8156e1b226SSteven Rostedt (Red Hat) #undef EM 8256e1b226SSteven Rostedt (Red Hat) #undef EMe 8356e1b226SSteven Rostedt (Red Hat) #define EM(a, b) TRACE_DEFINE_ENUM(a); 8456e1b226SSteven Rostedt (Red Hat) #define EMe(a, b) TRACE_DEFINE_ENUM(a); 8556e1b226SSteven Rostedt (Red Hat) 8656e1b226SSteven Rostedt (Red Hat) P9_MSG_T 8756e1b226SSteven Rostedt (Red Hat) 8856e1b226SSteven Rostedt (Red Hat) /* 8956e1b226SSteven Rostedt (Red Hat) * Now redefine the EM() and EMe() macros to map the enums to the strings 9056e1b226SSteven Rostedt (Red Hat) * that will be printed in the output. 9156e1b226SSteven Rostedt (Red Hat) */ 9256e1b226SSteven Rostedt (Red Hat) #undef EM 9356e1b226SSteven Rostedt (Red Hat) #undef EMe 9456e1b226SSteven Rostedt (Red Hat) #define EM(a, b) { a, b }, 9556e1b226SSteven Rostedt (Red Hat) #define EMe(a, b) { a, b } 9656e1b226SSteven Rostedt (Red Hat) 97348b5901SAneesh Kumar K.V #define show_9p_op(type) \ 9856e1b226SSteven Rostedt (Red Hat) __print_symbolic(type, P9_MSG_T) 99348b5901SAneesh Kumar K.V 100348b5901SAneesh Kumar K.V TRACE_EVENT(9p_client_req, 101348b5901SAneesh Kumar K.V TP_PROTO(struct p9_client *clnt, int8_t type, int tag), 102348b5901SAneesh Kumar K.V 103348b5901SAneesh Kumar K.V TP_ARGS(clnt, type, tag), 104348b5901SAneesh Kumar K.V 105348b5901SAneesh Kumar K.V TP_STRUCT__entry( 106348b5901SAneesh Kumar K.V __field( void *, clnt ) 107348b5901SAneesh Kumar K.V __field( __u8, type ) 108348b5901SAneesh Kumar K.V __field( __u32, tag ) 109348b5901SAneesh Kumar K.V ), 110348b5901SAneesh Kumar K.V 111348b5901SAneesh Kumar K.V TP_fast_assign( 112348b5901SAneesh Kumar K.V __entry->clnt = clnt; 113348b5901SAneesh Kumar K.V __entry->type = type; 114348b5901SAneesh Kumar K.V __entry->tag = tag; 115348b5901SAneesh Kumar K.V ), 116348b5901SAneesh Kumar K.V 117348b5901SAneesh Kumar K.V TP_printk("client %lu request %s tag %d", 118348b5901SAneesh Kumar K.V (long)__entry->clnt, show_9p_op(__entry->type), 119348b5901SAneesh Kumar K.V __entry->tag) 120348b5901SAneesh Kumar K.V ); 121348b5901SAneesh Kumar K.V 122348b5901SAneesh Kumar K.V TRACE_EVENT(9p_client_res, 123348b5901SAneesh Kumar K.V TP_PROTO(struct p9_client *clnt, int8_t type, int tag, int err), 124348b5901SAneesh Kumar K.V 125348b5901SAneesh Kumar K.V TP_ARGS(clnt, type, tag, err), 126348b5901SAneesh Kumar K.V 127348b5901SAneesh Kumar K.V TP_STRUCT__entry( 128348b5901SAneesh Kumar K.V __field( void *, clnt ) 129348b5901SAneesh Kumar K.V __field( __u8, type ) 130348b5901SAneesh Kumar K.V __field( __u32, tag ) 131348b5901SAneesh Kumar K.V __field( __u32, err ) 132348b5901SAneesh Kumar K.V ), 133348b5901SAneesh Kumar K.V 134348b5901SAneesh Kumar K.V TP_fast_assign( 135348b5901SAneesh Kumar K.V __entry->clnt = clnt; 136348b5901SAneesh Kumar K.V __entry->type = type; 137348b5901SAneesh Kumar K.V __entry->tag = tag; 138348b5901SAneesh Kumar K.V __entry->err = err; 139348b5901SAneesh Kumar K.V ), 140348b5901SAneesh Kumar K.V 141348b5901SAneesh Kumar K.V TP_printk("client %lu response %s tag %d err %d", 142348b5901SAneesh Kumar K.V (long)__entry->clnt, show_9p_op(__entry->type), 143348b5901SAneesh Kumar K.V __entry->tag, __entry->err) 144348b5901SAneesh Kumar K.V ); 145348b5901SAneesh Kumar K.V 146348b5901SAneesh Kumar K.V /* dump 32 bytes of protocol data */ 147348b5901SAneesh Kumar K.V #define P9_PROTO_DUMP_SZ 32 148348b5901SAneesh Kumar K.V TRACE_EVENT(9p_protocol_dump, 149348b5901SAneesh Kumar K.V TP_PROTO(struct p9_client *clnt, struct p9_fcall *pdu), 150348b5901SAneesh Kumar K.V 151348b5901SAneesh Kumar K.V TP_ARGS(clnt, pdu), 152348b5901SAneesh Kumar K.V 153348b5901SAneesh Kumar K.V TP_STRUCT__entry( 154348b5901SAneesh Kumar K.V __field( void *, clnt ) 155348b5901SAneesh Kumar K.V __field( __u8, type ) 156348b5901SAneesh Kumar K.V __field( __u16, tag ) 157348b5901SAneesh Kumar K.V __array( unsigned char, line, P9_PROTO_DUMP_SZ ) 158348b5901SAneesh Kumar K.V ), 159348b5901SAneesh Kumar K.V 160348b5901SAneesh Kumar K.V TP_fast_assign( 161348b5901SAneesh Kumar K.V __entry->clnt = clnt; 162348b5901SAneesh Kumar K.V __entry->type = pdu->id; 163348b5901SAneesh Kumar K.V __entry->tag = pdu->tag; 164348b5901SAneesh Kumar K.V memcpy(__entry->line, pdu->sdata, P9_PROTO_DUMP_SZ); 165348b5901SAneesh Kumar K.V ), 166cfdadef3SAndy Shevchenko TP_printk("clnt %lu %s(tag = %d)\n%.3x: %16ph\n%.3x: %16ph\n", 167cfdadef3SAndy Shevchenko (unsigned long)__entry->clnt, show_9p_op(__entry->type), 168cfdadef3SAndy Shevchenko __entry->tag, 0, __entry->line, 16, __entry->line + 16) 169348b5901SAneesh Kumar K.V ); 170348b5901SAneesh Kumar K.V 171348b5901SAneesh Kumar K.V #endif /* _TRACE_9P_H */ 172348b5901SAneesh Kumar K.V 173348b5901SAneesh Kumar K.V /* This part must be outside protection */ 174348b5901SAneesh Kumar K.V #include <trace/define_trace.h> 175