1b2441318SGreg 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) 80*286c171bSDominique Martinet 81*286c171bSDominique Martinet #define P9_FID_REFTYPE \ 82*286c171bSDominique Martinet EM( P9_FID_REF_CREATE, "create " ) \ 83*286c171bSDominique Martinet EM( P9_FID_REF_GET, "get " ) \ 84*286c171bSDominique Martinet EM( P9_FID_REF_PUT, "put " ) \ 85*286c171bSDominique Martinet EMe(P9_FID_REF_DESTROY, "destroy" ) 86*286c171bSDominique Martinet 8756e1b226SSteven Rostedt (Red Hat) /* Define EM() to export the enums to userspace via TRACE_DEFINE_ENUM() */ 8856e1b226SSteven Rostedt (Red Hat) #undef EM 8956e1b226SSteven Rostedt (Red Hat) #undef EMe 9056e1b226SSteven Rostedt (Red Hat) #define EM(a, b) TRACE_DEFINE_ENUM(a); 9156e1b226SSteven Rostedt (Red Hat) #define EMe(a, b) TRACE_DEFINE_ENUM(a); 9256e1b226SSteven Rostedt (Red Hat) 9356e1b226SSteven Rostedt (Red Hat) P9_MSG_T 94*286c171bSDominique Martinet P9_FID_REFTYPE 95*286c171bSDominique Martinet 96*286c171bSDominique Martinet /* And also use EM/EMe to define helper enums -- once */ 97*286c171bSDominique Martinet #ifndef __9P_DECLARE_TRACE_ENUMS_ONLY_ONCE 98*286c171bSDominique Martinet #define __9P_DECLARE_TRACE_ENUMS_ONLY_ONCE 99*286c171bSDominique Martinet #undef EM 100*286c171bSDominique Martinet #undef EMe 101*286c171bSDominique Martinet #define EM(a, b) a, 102*286c171bSDominique Martinet #define EMe(a, b) a 103*286c171bSDominique Martinet 104*286c171bSDominique Martinet enum p9_fid_reftype { 105*286c171bSDominique Martinet P9_FID_REFTYPE 106*286c171bSDominique Martinet } __mode(byte); 107*286c171bSDominique Martinet 108*286c171bSDominique Martinet #endif 10956e1b226SSteven Rostedt (Red Hat) 11056e1b226SSteven Rostedt (Red Hat) /* 11156e1b226SSteven Rostedt (Red Hat) * Now redefine the EM() and EMe() macros to map the enums to the strings 11256e1b226SSteven Rostedt (Red Hat) * that will be printed in the output. 11356e1b226SSteven Rostedt (Red Hat) */ 11456e1b226SSteven Rostedt (Red Hat) #undef EM 11556e1b226SSteven Rostedt (Red Hat) #undef EMe 11656e1b226SSteven Rostedt (Red Hat) #define EM(a, b) { a, b }, 11756e1b226SSteven Rostedt (Red Hat) #define EMe(a, b) { a, b } 11856e1b226SSteven Rostedt (Red Hat) 119348b5901SAneesh Kumar K.V #define show_9p_op(type) \ 12056e1b226SSteven Rostedt (Red Hat) __print_symbolic(type, P9_MSG_T) 121*286c171bSDominique Martinet #define show_9p_fid_reftype(type) \ 122*286c171bSDominique Martinet __print_symbolic(type, P9_FID_REFTYPE) 123348b5901SAneesh Kumar K.V 124348b5901SAneesh Kumar K.V TRACE_EVENT(9p_client_req, 125348b5901SAneesh Kumar K.V TP_PROTO(struct p9_client *clnt, int8_t type, int tag), 126348b5901SAneesh Kumar K.V 127348b5901SAneesh Kumar K.V TP_ARGS(clnt, type, tag), 128348b5901SAneesh Kumar K.V 129348b5901SAneesh Kumar K.V TP_STRUCT__entry( 130348b5901SAneesh Kumar K.V __field( void *, clnt ) 131348b5901SAneesh Kumar K.V __field( __u8, type ) 132348b5901SAneesh Kumar K.V __field( __u32, tag ) 133348b5901SAneesh Kumar K.V ), 134348b5901SAneesh Kumar K.V 135348b5901SAneesh Kumar K.V TP_fast_assign( 136348b5901SAneesh Kumar K.V __entry->clnt = clnt; 137348b5901SAneesh Kumar K.V __entry->type = type; 138348b5901SAneesh Kumar K.V __entry->tag = tag; 139348b5901SAneesh Kumar K.V ), 140348b5901SAneesh Kumar K.V 141348b5901SAneesh Kumar K.V TP_printk("client %lu request %s tag %d", 142348b5901SAneesh Kumar K.V (long)__entry->clnt, show_9p_op(__entry->type), 143348b5901SAneesh Kumar K.V __entry->tag) 144348b5901SAneesh Kumar K.V ); 145348b5901SAneesh Kumar K.V 146348b5901SAneesh Kumar K.V TRACE_EVENT(9p_client_res, 147348b5901SAneesh Kumar K.V TP_PROTO(struct p9_client *clnt, int8_t type, int tag, int err), 148348b5901SAneesh Kumar K.V 149348b5901SAneesh Kumar K.V TP_ARGS(clnt, type, tag, err), 150348b5901SAneesh Kumar K.V 151348b5901SAneesh Kumar K.V TP_STRUCT__entry( 152348b5901SAneesh Kumar K.V __field( void *, clnt ) 153348b5901SAneesh Kumar K.V __field( __u8, type ) 154348b5901SAneesh Kumar K.V __field( __u32, tag ) 155348b5901SAneesh Kumar K.V __field( __u32, err ) 156348b5901SAneesh Kumar K.V ), 157348b5901SAneesh Kumar K.V 158348b5901SAneesh Kumar K.V TP_fast_assign( 159348b5901SAneesh Kumar K.V __entry->clnt = clnt; 160348b5901SAneesh Kumar K.V __entry->type = type; 161348b5901SAneesh Kumar K.V __entry->tag = tag; 162348b5901SAneesh Kumar K.V __entry->err = err; 163348b5901SAneesh Kumar K.V ), 164348b5901SAneesh Kumar K.V 165348b5901SAneesh Kumar K.V TP_printk("client %lu response %s tag %d err %d", 166348b5901SAneesh Kumar K.V (long)__entry->clnt, show_9p_op(__entry->type), 167348b5901SAneesh Kumar K.V __entry->tag, __entry->err) 168348b5901SAneesh Kumar K.V ); 169348b5901SAneesh Kumar K.V 170348b5901SAneesh Kumar K.V /* dump 32 bytes of protocol data */ 171348b5901SAneesh Kumar K.V #define P9_PROTO_DUMP_SZ 32 172348b5901SAneesh Kumar K.V TRACE_EVENT(9p_protocol_dump, 173348b5901SAneesh Kumar K.V TP_PROTO(struct p9_client *clnt, struct p9_fcall *pdu), 174348b5901SAneesh Kumar K.V 175348b5901SAneesh Kumar K.V TP_ARGS(clnt, pdu), 176348b5901SAneesh Kumar K.V 177348b5901SAneesh Kumar K.V TP_STRUCT__entry( 178348b5901SAneesh Kumar K.V __field( void *, clnt ) 179348b5901SAneesh Kumar K.V __field( __u8, type ) 180348b5901SAneesh Kumar K.V __field( __u16, tag ) 181348b5901SAneesh Kumar K.V __dynamic_array(unsigned char, line, 182348b5901SAneesh Kumar K.V min_t(size_t, pdu->capacity, P9_PROTO_DUMP_SZ)) 183348b5901SAneesh Kumar K.V ), 184348b5901SAneesh Kumar K.V 185348b5901SAneesh Kumar K.V TP_fast_assign( 186348b5901SAneesh Kumar K.V __entry->clnt = clnt; 187348b5901SAneesh Kumar K.V __entry->type = pdu->id; 188348b5901SAneesh Kumar K.V __entry->tag = pdu->tag; 189348b5901SAneesh Kumar K.V memcpy(__get_dynamic_array(line), pdu->sdata, 190cfdadef3SAndy Shevchenko __get_dynamic_array_len(line)); 191cfdadef3SAndy Shevchenko ), 192cfdadef3SAndy Shevchenko TP_printk("clnt %lu %s(tag = %d)\n%*ph\n", 193348b5901SAneesh Kumar K.V (unsigned long)__entry->clnt, show_9p_op(__entry->type), 194348b5901SAneesh Kumar K.V __entry->tag, __get_dynamic_array_len(line), 195*286c171bSDominique Martinet __get_dynamic_array(line)) 196*286c171bSDominique Martinet ); 197*286c171bSDominique Martinet 198*286c171bSDominique Martinet 199*286c171bSDominique Martinet TRACE_EVENT(9p_fid_ref, 200*286c171bSDominique Martinet TP_PROTO(struct p9_fid *fid, __u8 type), 201*286c171bSDominique Martinet 202*286c171bSDominique Martinet TP_ARGS(fid, type), 203*286c171bSDominique Martinet 204*286c171bSDominique Martinet TP_STRUCT__entry( 205*286c171bSDominique Martinet __field( int, fid ) 206*286c171bSDominique Martinet __field( int, refcount ) 207*286c171bSDominique Martinet __field( __u8, type ) 208*286c171bSDominique Martinet ), 209*286c171bSDominique Martinet 210*286c171bSDominique Martinet TP_fast_assign( 211*286c171bSDominique Martinet __entry->fid = fid->fid; 212*286c171bSDominique Martinet __entry->refcount = refcount_read(&fid->count); 213*286c171bSDominique Martinet __entry->type = type; 214*286c171bSDominique Martinet ), 215*286c171bSDominique Martinet 216*286c171bSDominique Martinet TP_printk("%s fid %d, refcount %d", 217*286c171bSDominique Martinet show_9p_fid_reftype(__entry->type), 218*286c171bSDominique Martinet __entry->fid, __entry->refcount) 219348b5901SAneesh Kumar K.V ); 220348b5901SAneesh Kumar K.V 221348b5901SAneesh Kumar K.V 222348b5901SAneesh Kumar K.V #endif /* _TRACE_9P_H */ 223 224 /* This part must be outside protection */ 225 #include <trace/define_trace.h> 226