1ed999f82SChuck Lever /* SPDX-License-Identifier: GPL-2.0-only */ 2ed999f82SChuck Lever /* 3ed999f82SChuck Lever * Trace point definitions for the RDMA Connect Manager. 4ed999f82SChuck Lever * 5ed999f82SChuck Lever * Author: Chuck Lever <chuck.lever@oracle.com> 6ed999f82SChuck Lever * 7ed999f82SChuck Lever * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 8ed999f82SChuck Lever */ 9ed999f82SChuck Lever 10ed999f82SChuck Lever #undef TRACE_SYSTEM 11ed999f82SChuck Lever #define TRACE_SYSTEM rdma_cma 12ed999f82SChuck Lever 13ed999f82SChuck Lever #if !defined(_TRACE_RDMA_CMA_H) || defined(TRACE_HEADER_MULTI_READ) 14ed999f82SChuck Lever 15ed999f82SChuck Lever #define _TRACE_RDMA_CMA_H 16ed999f82SChuck Lever 17ed999f82SChuck Lever #include <linux/tracepoint.h> 18247c01ffSChuck Lever #include <trace/misc/rdma.h> 19ed999f82SChuck Lever 20ed999f82SChuck Lever 21ed999f82SChuck Lever DECLARE_EVENT_CLASS(cma_fsm_class, 22ed999f82SChuck Lever TP_PROTO( 23ed999f82SChuck Lever const struct rdma_id_private *id_priv 24ed999f82SChuck Lever ), 25ed999f82SChuck Lever 26ed999f82SChuck Lever TP_ARGS(id_priv), 27ed999f82SChuck Lever 28ed999f82SChuck Lever TP_STRUCT__entry( 29ed999f82SChuck Lever __field(u32, cm_id) 30ed999f82SChuck Lever __field(u32, tos) 31ed999f82SChuck Lever __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 32ed999f82SChuck Lever __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 33ed999f82SChuck Lever ), 34ed999f82SChuck Lever 35ed999f82SChuck Lever TP_fast_assign( 36ed999f82SChuck Lever __entry->cm_id = id_priv->res.id; 37ed999f82SChuck Lever __entry->tos = id_priv->tos; 38ed999f82SChuck Lever memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr, 39ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 40ed999f82SChuck Lever memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr, 41ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 42ed999f82SChuck Lever ), 43ed999f82SChuck Lever 44ed999f82SChuck Lever TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u", 45ed999f82SChuck Lever __entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos 46ed999f82SChuck Lever ) 47ed999f82SChuck Lever ); 48ed999f82SChuck Lever 49ed999f82SChuck Lever #define DEFINE_CMA_FSM_EVENT(name) \ 50ed999f82SChuck Lever DEFINE_EVENT(cma_fsm_class, cm_##name, \ 51ed999f82SChuck Lever TP_PROTO( \ 52ed999f82SChuck Lever const struct rdma_id_private *id_priv \ 53ed999f82SChuck Lever ), \ 54ed999f82SChuck Lever TP_ARGS(id_priv)) 55ed999f82SChuck Lever 56ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(send_rtu); 57ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(send_rej); 58ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(send_mra); 59ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(send_sidr_req); 60ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(send_sidr_rep); 61ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(disconnect); 62ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(sent_drep); 63ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(sent_dreq); 64ed999f82SChuck Lever DEFINE_CMA_FSM_EVENT(id_destroy); 65ed999f82SChuck Lever 66278f74b3SChuck Lever TRACE_EVENT(cm_id_attach, 67ed999f82SChuck Lever TP_PROTO( 68278f74b3SChuck Lever const struct rdma_id_private *id_priv, 69278f74b3SChuck Lever const struct ib_device *device 70ed999f82SChuck Lever ), 71ed999f82SChuck Lever 72278f74b3SChuck Lever TP_ARGS(id_priv, device), 73ed999f82SChuck Lever 74ed999f82SChuck Lever TP_STRUCT__entry( 75ed999f82SChuck Lever __field(u32, cm_id) 76278f74b3SChuck Lever __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 77278f74b3SChuck Lever __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 78278f74b3SChuck Lever __string(devname, device->name) 79ed999f82SChuck Lever ), 80ed999f82SChuck Lever 81ed999f82SChuck Lever TP_fast_assign( 82ed999f82SChuck Lever __entry->cm_id = id_priv->res.id; 83278f74b3SChuck Lever memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr, 84278f74b3SChuck Lever sizeof(struct sockaddr_in6)); 85278f74b3SChuck Lever memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr, 86278f74b3SChuck Lever sizeof(struct sockaddr_in6)); 87*2c92ca84SSteven Rostedt (Google) __assign_str(devname); 88ed999f82SChuck Lever ), 89ed999f82SChuck Lever 90278f74b3SChuck Lever TP_printk("cm.id=%u src=%pISpc dst=%pISpc device=%s", 91278f74b3SChuck Lever __entry->cm_id, __entry->srcaddr, __entry->dstaddr, 92278f74b3SChuck Lever __get_str(devname) 93ed999f82SChuck Lever ) 94ed999f82SChuck Lever ); 95ed999f82SChuck Lever 96ed999f82SChuck Lever DECLARE_EVENT_CLASS(cma_qp_class, 97ed999f82SChuck Lever TP_PROTO( 98ed999f82SChuck Lever const struct rdma_id_private *id_priv 99ed999f82SChuck Lever ), 100ed999f82SChuck Lever 101ed999f82SChuck Lever TP_ARGS(id_priv), 102ed999f82SChuck Lever 103ed999f82SChuck Lever TP_STRUCT__entry( 104ed999f82SChuck Lever __field(u32, cm_id) 105ed999f82SChuck Lever __field(u32, tos) 106ed999f82SChuck Lever __field(u32, qp_num) 107ed999f82SChuck Lever __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 108ed999f82SChuck Lever __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 109ed999f82SChuck Lever ), 110ed999f82SChuck Lever 111ed999f82SChuck Lever TP_fast_assign( 112ed999f82SChuck Lever __entry->cm_id = id_priv->res.id; 113ed999f82SChuck Lever __entry->tos = id_priv->tos; 114ed999f82SChuck Lever __entry->qp_num = id_priv->qp_num; 115ed999f82SChuck Lever memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr, 116ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 117ed999f82SChuck Lever memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr, 118ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 119ed999f82SChuck Lever ), 120ed999f82SChuck Lever 121ed999f82SChuck Lever TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u qp_num=%u", 122ed999f82SChuck Lever __entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos, 123ed999f82SChuck Lever __entry->qp_num 124ed999f82SChuck Lever ) 125ed999f82SChuck Lever ); 126ed999f82SChuck Lever 127ed999f82SChuck Lever #define DEFINE_CMA_QP_EVENT(name) \ 128ed999f82SChuck Lever DEFINE_EVENT(cma_qp_class, cm_##name, \ 129ed999f82SChuck Lever TP_PROTO( \ 130ed999f82SChuck Lever const struct rdma_id_private *id_priv \ 131ed999f82SChuck Lever ), \ 132ed999f82SChuck Lever TP_ARGS(id_priv)) 133ed999f82SChuck Lever 134ed999f82SChuck Lever DEFINE_CMA_QP_EVENT(send_req); 135ed999f82SChuck Lever DEFINE_CMA_QP_EVENT(send_rep); 136ed999f82SChuck Lever DEFINE_CMA_QP_EVENT(qp_destroy); 137ed999f82SChuck Lever 138ed999f82SChuck Lever /* 139ed999f82SChuck Lever * enum ib_wp_type, from include/rdma/ib_verbs.h 140ed999f82SChuck Lever */ 141ed999f82SChuck Lever #define IB_QP_TYPE_LIST \ 142ed999f82SChuck Lever ib_qp_type(SMI) \ 143ed999f82SChuck Lever ib_qp_type(GSI) \ 144ed999f82SChuck Lever ib_qp_type(RC) \ 145ed999f82SChuck Lever ib_qp_type(UC) \ 146ed999f82SChuck Lever ib_qp_type(UD) \ 147ed999f82SChuck Lever ib_qp_type(RAW_IPV6) \ 148ed999f82SChuck Lever ib_qp_type(RAW_ETHERTYPE) \ 149ed999f82SChuck Lever ib_qp_type(RAW_PACKET) \ 150ed999f82SChuck Lever ib_qp_type(XRC_INI) \ 151ed999f82SChuck Lever ib_qp_type_end(XRC_TGT) 152ed999f82SChuck Lever 153ed999f82SChuck Lever #undef ib_qp_type 154ed999f82SChuck Lever #undef ib_qp_type_end 155ed999f82SChuck Lever 156ed999f82SChuck Lever #define ib_qp_type(x) TRACE_DEFINE_ENUM(IB_QPT_##x); 157ed999f82SChuck Lever #define ib_qp_type_end(x) TRACE_DEFINE_ENUM(IB_QPT_##x); 158ed999f82SChuck Lever 159ed999f82SChuck Lever IB_QP_TYPE_LIST 160ed999f82SChuck Lever 161ed999f82SChuck Lever #undef ib_qp_type 162ed999f82SChuck Lever #undef ib_qp_type_end 163ed999f82SChuck Lever 164ed999f82SChuck Lever #define ib_qp_type(x) { IB_QPT_##x, #x }, 165ed999f82SChuck Lever #define ib_qp_type_end(x) { IB_QPT_##x, #x } 166ed999f82SChuck Lever 167ed999f82SChuck Lever #define rdma_show_qp_type(x) \ 168ed999f82SChuck Lever __print_symbolic(x, IB_QP_TYPE_LIST) 169ed999f82SChuck Lever 170ed999f82SChuck Lever 171ed999f82SChuck Lever TRACE_EVENT(cm_qp_create, 172ed999f82SChuck Lever TP_PROTO( 173ed999f82SChuck Lever const struct rdma_id_private *id_priv, 174ed999f82SChuck Lever const struct ib_pd *pd, 175ed999f82SChuck Lever const struct ib_qp_init_attr *qp_init_attr, 176ed999f82SChuck Lever int rc 177ed999f82SChuck Lever ), 178ed999f82SChuck Lever 179ed999f82SChuck Lever TP_ARGS(id_priv, pd, qp_init_attr, rc), 180ed999f82SChuck Lever 181ed999f82SChuck Lever TP_STRUCT__entry( 182ed999f82SChuck Lever __field(u32, cm_id) 183ed999f82SChuck Lever __field(u32, pd_id) 184ed999f82SChuck Lever __field(u32, tos) 185ed999f82SChuck Lever __field(u32, qp_num) 186ed999f82SChuck Lever __field(u32, send_wr) 187ed999f82SChuck Lever __field(u32, recv_wr) 188ed999f82SChuck Lever __field(int, rc) 189ed999f82SChuck Lever __field(unsigned long, qp_type) 190ed999f82SChuck Lever __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 191ed999f82SChuck Lever __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 192ed999f82SChuck Lever ), 193ed999f82SChuck Lever 194ed999f82SChuck Lever TP_fast_assign( 195ed999f82SChuck Lever __entry->cm_id = id_priv->res.id; 196ed999f82SChuck Lever __entry->pd_id = pd->res.id; 197ed999f82SChuck Lever __entry->tos = id_priv->tos; 198ed999f82SChuck Lever __entry->send_wr = qp_init_attr->cap.max_send_wr; 199ed999f82SChuck Lever __entry->recv_wr = qp_init_attr->cap.max_recv_wr; 200ed999f82SChuck Lever __entry->rc = rc; 201ed999f82SChuck Lever if (!rc) { 202ed999f82SChuck Lever __entry->qp_num = id_priv->qp_num; 203ed999f82SChuck Lever __entry->qp_type = id_priv->id.qp_type; 204ed999f82SChuck Lever } else { 205ed999f82SChuck Lever __entry->qp_num = 0; 206ed999f82SChuck Lever __entry->qp_type = 0; 207ed999f82SChuck Lever } 208ed999f82SChuck Lever memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr, 209ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 210ed999f82SChuck Lever memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr, 211ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 212ed999f82SChuck Lever ), 213ed999f82SChuck Lever 214ed999f82SChuck Lever TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u pd.id=%u qp_type=%s" 215ed999f82SChuck Lever " send_wr=%u recv_wr=%u qp_num=%u rc=%d", 216ed999f82SChuck Lever __entry->cm_id, __entry->srcaddr, __entry->dstaddr, 217ed999f82SChuck Lever __entry->tos, __entry->pd_id, 218ed999f82SChuck Lever rdma_show_qp_type(__entry->qp_type), __entry->send_wr, 219ed999f82SChuck Lever __entry->recv_wr, __entry->qp_num, __entry->rc 220ed999f82SChuck Lever ) 221ed999f82SChuck Lever ); 222ed999f82SChuck Lever 223ed999f82SChuck Lever TRACE_EVENT(cm_req_handler, 224ed999f82SChuck Lever TP_PROTO( 225ed999f82SChuck Lever const struct rdma_id_private *id_priv, 226ed999f82SChuck Lever int event 227ed999f82SChuck Lever ), 228ed999f82SChuck Lever 229ed999f82SChuck Lever TP_ARGS(id_priv, event), 230ed999f82SChuck Lever 231ed999f82SChuck Lever TP_STRUCT__entry( 232ed999f82SChuck Lever __field(u32, cm_id) 233ed999f82SChuck Lever __field(u32, tos) 234ed999f82SChuck Lever __field(unsigned long, event) 235ed999f82SChuck Lever __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 236ed999f82SChuck Lever __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 237ed999f82SChuck Lever ), 238ed999f82SChuck Lever 239ed999f82SChuck Lever TP_fast_assign( 240ed999f82SChuck Lever __entry->cm_id = id_priv->res.id; 241ed999f82SChuck Lever __entry->tos = id_priv->tos; 242ed999f82SChuck Lever __entry->event = event; 243ed999f82SChuck Lever memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr, 244ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 245ed999f82SChuck Lever memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr, 246ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 247ed999f82SChuck Lever ), 248ed999f82SChuck Lever 249ed999f82SChuck Lever TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s (%lu)", 250ed999f82SChuck Lever __entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos, 251ed999f82SChuck Lever rdma_show_ib_cm_event(__entry->event), __entry->event 252ed999f82SChuck Lever ) 253ed999f82SChuck Lever ); 254ed999f82SChuck Lever 255ed999f82SChuck Lever TRACE_EVENT(cm_event_handler, 256ed999f82SChuck Lever TP_PROTO( 257ed999f82SChuck Lever const struct rdma_id_private *id_priv, 258ed999f82SChuck Lever const struct rdma_cm_event *event 259ed999f82SChuck Lever ), 260ed999f82SChuck Lever 261ed999f82SChuck Lever TP_ARGS(id_priv, event), 262ed999f82SChuck Lever 263ed999f82SChuck Lever TP_STRUCT__entry( 264ed999f82SChuck Lever __field(u32, cm_id) 265ed999f82SChuck Lever __field(u32, tos) 266ed999f82SChuck Lever __field(unsigned long, event) 267ed999f82SChuck Lever __field(int, status) 268ed999f82SChuck Lever __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 269ed999f82SChuck Lever __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 270ed999f82SChuck Lever ), 271ed999f82SChuck Lever 272ed999f82SChuck Lever TP_fast_assign( 273ed999f82SChuck Lever __entry->cm_id = id_priv->res.id; 274ed999f82SChuck Lever __entry->tos = id_priv->tos; 275ed999f82SChuck Lever __entry->event = event->event; 276ed999f82SChuck Lever __entry->status = event->status; 277ed999f82SChuck Lever memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr, 278ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 279ed999f82SChuck Lever memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr, 280ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 281ed999f82SChuck Lever ), 282ed999f82SChuck Lever 283ed999f82SChuck Lever TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s (%lu/%d)", 284ed999f82SChuck Lever __entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos, 285ed999f82SChuck Lever rdma_show_cm_event(__entry->event), __entry->event, 286ed999f82SChuck Lever __entry->status 287ed999f82SChuck Lever ) 288ed999f82SChuck Lever ); 289ed999f82SChuck Lever 290ed999f82SChuck Lever TRACE_EVENT(cm_event_done, 291ed999f82SChuck Lever TP_PROTO( 292ed999f82SChuck Lever const struct rdma_id_private *id_priv, 293ed999f82SChuck Lever const struct rdma_cm_event *event, 294ed999f82SChuck Lever int result 295ed999f82SChuck Lever ), 296ed999f82SChuck Lever 297ed999f82SChuck Lever TP_ARGS(id_priv, event, result), 298ed999f82SChuck Lever 299ed999f82SChuck Lever TP_STRUCT__entry( 300ed999f82SChuck Lever __field(u32, cm_id) 301ed999f82SChuck Lever __field(u32, tos) 302ed999f82SChuck Lever __field(unsigned long, event) 303ed999f82SChuck Lever __field(int, result) 304ed999f82SChuck Lever __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 305ed999f82SChuck Lever __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 306ed999f82SChuck Lever ), 307ed999f82SChuck Lever 308ed999f82SChuck Lever TP_fast_assign( 309ed999f82SChuck Lever __entry->cm_id = id_priv->res.id; 310ed999f82SChuck Lever __entry->tos = id_priv->tos; 311ed999f82SChuck Lever __entry->event = event->event; 312ed999f82SChuck Lever __entry->result = result; 313ed999f82SChuck Lever memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr, 314ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 315ed999f82SChuck Lever memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr, 316ed999f82SChuck Lever sizeof(struct sockaddr_in6)); 317ed999f82SChuck Lever ), 318ed999f82SChuck Lever 319ed999f82SChuck Lever TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s consumer returns %d", 320ed999f82SChuck Lever __entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos, 321ed999f82SChuck Lever rdma_show_cm_event(__entry->event), __entry->result 322ed999f82SChuck Lever ) 323ed999f82SChuck Lever ); 324ed999f82SChuck Lever 325ed999f82SChuck Lever DECLARE_EVENT_CLASS(cma_client_class, 326ed999f82SChuck Lever TP_PROTO( 327ed999f82SChuck Lever const struct ib_device *device 328ed999f82SChuck Lever ), 329ed999f82SChuck Lever 330ed999f82SChuck Lever TP_ARGS(device), 331ed999f82SChuck Lever 332ed999f82SChuck Lever TP_STRUCT__entry( 333ed999f82SChuck Lever __string(name, device->name) 334ed999f82SChuck Lever ), 335ed999f82SChuck Lever 336ed999f82SChuck Lever TP_fast_assign( 337*2c92ca84SSteven Rostedt (Google) __assign_str(name); 338ed999f82SChuck Lever ), 339ed999f82SChuck Lever 340ed999f82SChuck Lever TP_printk("device name=%s", 341ed999f82SChuck Lever __get_str(name) 342ed999f82SChuck Lever ) 343ed999f82SChuck Lever ); 344ed999f82SChuck Lever 345ed999f82SChuck Lever #define DEFINE_CMA_CLIENT_EVENT(name) \ 346ed999f82SChuck Lever DEFINE_EVENT(cma_client_class, cm_##name, \ 347ed999f82SChuck Lever TP_PROTO( \ 348ed999f82SChuck Lever const struct ib_device *device \ 349ed999f82SChuck Lever ), \ 350ed999f82SChuck Lever TP_ARGS(device)) 351ed999f82SChuck Lever 352ed999f82SChuck Lever DEFINE_CMA_CLIENT_EVENT(add_one); 353ed999f82SChuck Lever DEFINE_CMA_CLIENT_EVENT(remove_one); 354ed999f82SChuck Lever 355ed999f82SChuck Lever #endif /* _TRACE_RDMA_CMA_H */ 356ed999f82SChuck Lever 357ed999f82SChuck Lever #undef TRACE_INCLUDE_PATH 358ed999f82SChuck Lever #define TRACE_INCLUDE_PATH . 359ed999f82SChuck Lever #define TRACE_INCLUDE_FILE cma_trace 360ed999f82SChuck Lever 361ed999f82SChuck Lever #include <trace/define_trace.h> 362