1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Trace point definitions for the RDMA Connect Manager. 4 * 5 * Author: Chuck Lever <chuck.lever@oracle.com> 6 * 7 * Copyright (c) 2020 Oracle and/or its affiliates. 8 */ 9 10 #undef TRACE_SYSTEM 11 #define TRACE_SYSTEM ib_cma 12 13 #if !defined(_TRACE_IB_CMA_H) || defined(TRACE_HEADER_MULTI_READ) 14 15 #define _TRACE_IB_CMA_H 16 17 #include <linux/tracepoint.h> 18 #include <rdma/ib_cm.h> 19 #include <trace/misc/rdma.h> 20 21 /* 22 * enum ib_cm_state, from include/rdma/ib_cm.h 23 */ 24 #define IB_CM_STATE_LIST \ 25 ib_cm_state(IDLE) \ 26 ib_cm_state(LISTEN) \ 27 ib_cm_state(REQ_SENT) \ 28 ib_cm_state(REQ_RCVD) \ 29 ib_cm_state(MRA_REQ_SENT) \ 30 ib_cm_state(MRA_REQ_RCVD) \ 31 ib_cm_state(REP_SENT) \ 32 ib_cm_state(REP_RCVD) \ 33 ib_cm_state(MRA_REP_SENT) \ 34 ib_cm_state(MRA_REP_RCVD) \ 35 ib_cm_state(ESTABLISHED) \ 36 ib_cm_state(DREQ_SENT) \ 37 ib_cm_state(DREQ_RCVD) \ 38 ib_cm_state(TIMEWAIT) \ 39 ib_cm_state(SIDR_REQ_SENT) \ 40 ib_cm_state_end(SIDR_REQ_RCVD) 41 42 #undef ib_cm_state 43 #undef ib_cm_state_end 44 #define ib_cm_state(x) TRACE_DEFINE_ENUM(IB_CM_##x); 45 #define ib_cm_state_end(x) TRACE_DEFINE_ENUM(IB_CM_##x); 46 47 IB_CM_STATE_LIST 48 49 #undef ib_cm_state 50 #undef ib_cm_state_end 51 #define ib_cm_state(x) { IB_CM_##x, #x }, 52 #define ib_cm_state_end(x) { IB_CM_##x, #x } 53 54 #define show_ib_cm_state(x) \ 55 __print_symbolic(x, IB_CM_STATE_LIST) 56 57 /* 58 * enum ib_cm_lap_state, from include/rdma/ib_cm.h 59 */ 60 #define IB_CM_LAP_STATE_LIST \ 61 ib_cm_lap_state(LAP_UNINIT) \ 62 ib_cm_lap_state(LAP_IDLE) \ 63 ib_cm_lap_state(LAP_SENT) \ 64 ib_cm_lap_state(LAP_RCVD) \ 65 ib_cm_lap_state(MRA_LAP_SENT) \ 66 ib_cm_lap_state_end(MRA_LAP_RCVD) 67 68 #undef ib_cm_lap_state 69 #undef ib_cm_lap_state_end 70 #define ib_cm_lap_state(x) TRACE_DEFINE_ENUM(IB_CM_##x); 71 #define ib_cm_lap_state_end(x) TRACE_DEFINE_ENUM(IB_CM_##x); 72 73 IB_CM_LAP_STATE_LIST 74 75 #undef ib_cm_lap_state 76 #undef ib_cm_lap_state_end 77 #define ib_cm_lap_state(x) { IB_CM_##x, #x }, 78 #define ib_cm_lap_state_end(x) { IB_CM_##x, #x } 79 80 #define show_ib_cm_lap_state(x) \ 81 __print_symbolic(x, IB_CM_LAP_STATE_LIST) 82 83 /* 84 * enum ib_cm_rej_reason, from include/rdma/ib_cm.h 85 */ 86 #define IB_CM_REJ_REASON_LIST \ 87 ib_cm_rej_reason(REJ_NO_QP) \ 88 ib_cm_rej_reason(REJ_NO_EEC) \ 89 ib_cm_rej_reason(REJ_NO_RESOURCES) \ 90 ib_cm_rej_reason(REJ_TIMEOUT) \ 91 ib_cm_rej_reason(REJ_UNSUPPORTED) \ 92 ib_cm_rej_reason(REJ_INVALID_COMM_ID) \ 93 ib_cm_rej_reason(REJ_INVALID_COMM_INSTANCE) \ 94 ib_cm_rej_reason(REJ_INVALID_SERVICE_ID) \ 95 ib_cm_rej_reason(REJ_INVALID_TRANSPORT_TYPE) \ 96 ib_cm_rej_reason(REJ_STALE_CONN) \ 97 ib_cm_rej_reason(REJ_RDC_NOT_EXIST) \ 98 ib_cm_rej_reason(REJ_INVALID_GID) \ 99 ib_cm_rej_reason(REJ_INVALID_LID) \ 100 ib_cm_rej_reason(REJ_INVALID_SL) \ 101 ib_cm_rej_reason(REJ_INVALID_TRAFFIC_CLASS) \ 102 ib_cm_rej_reason(REJ_INVALID_HOP_LIMIT) \ 103 ib_cm_rej_reason(REJ_INVALID_PACKET_RATE) \ 104 ib_cm_rej_reason(REJ_INVALID_ALT_GID) \ 105 ib_cm_rej_reason(REJ_INVALID_ALT_LID) \ 106 ib_cm_rej_reason(REJ_INVALID_ALT_SL) \ 107 ib_cm_rej_reason(REJ_INVALID_ALT_TRAFFIC_CLASS) \ 108 ib_cm_rej_reason(REJ_INVALID_ALT_HOP_LIMIT) \ 109 ib_cm_rej_reason(REJ_INVALID_ALT_PACKET_RATE) \ 110 ib_cm_rej_reason(REJ_PORT_CM_REDIRECT) \ 111 ib_cm_rej_reason(REJ_PORT_REDIRECT) \ 112 ib_cm_rej_reason(REJ_INVALID_MTU) \ 113 ib_cm_rej_reason(REJ_INSUFFICIENT_RESP_RESOURCES) \ 114 ib_cm_rej_reason(REJ_CONSUMER_DEFINED) \ 115 ib_cm_rej_reason(REJ_INVALID_RNR_RETRY) \ 116 ib_cm_rej_reason(REJ_DUPLICATE_LOCAL_COMM_ID) \ 117 ib_cm_rej_reason(REJ_INVALID_CLASS_VERSION) \ 118 ib_cm_rej_reason(REJ_INVALID_FLOW_LABEL) \ 119 ib_cm_rej_reason(REJ_INVALID_ALT_FLOW_LABEL) \ 120 ib_cm_rej_reason_end(REJ_VENDOR_OPTION_NOT_SUPPORTED) 121 122 #undef ib_cm_rej_reason 123 #undef ib_cm_rej_reason_end 124 #define ib_cm_rej_reason(x) TRACE_DEFINE_ENUM(IB_CM_##x); 125 #define ib_cm_rej_reason_end(x) TRACE_DEFINE_ENUM(IB_CM_##x); 126 127 IB_CM_REJ_REASON_LIST 128 129 #undef ib_cm_rej_reason 130 #undef ib_cm_rej_reason_end 131 #define ib_cm_rej_reason(x) { IB_CM_##x, #x }, 132 #define ib_cm_rej_reason_end(x) { IB_CM_##x, #x } 133 134 #define show_ib_cm_rej_reason(x) \ 135 __print_symbolic(x, IB_CM_REJ_REASON_LIST) 136 137 DECLARE_EVENT_CLASS(icm_id_class, 138 TP_PROTO( 139 const struct ib_cm_id *cm_id 140 ), 141 142 TP_ARGS(cm_id), 143 144 TP_STRUCT__entry( 145 __field(const void *, cm_id) /* for eBPF scripts */ 146 __field(unsigned int, local_id) 147 __field(unsigned int, remote_id) 148 __field(unsigned long, state) 149 __field(unsigned long, lap_state) 150 ), 151 152 TP_fast_assign( 153 __entry->cm_id = cm_id; 154 __entry->local_id = be32_to_cpu(cm_id->local_id); 155 __entry->remote_id = be32_to_cpu(cm_id->remote_id); 156 __entry->state = cm_id->state; 157 __entry->lap_state = cm_id->lap_state; 158 ), 159 160 TP_printk("local_id=%u remote_id=%u state=%s lap_state=%s", 161 __entry->local_id, __entry->remote_id, 162 show_ib_cm_state(__entry->state), 163 show_ib_cm_lap_state(__entry->lap_state) 164 ) 165 ); 166 167 #define DEFINE_CM_SEND_EVENT(name) \ 168 DEFINE_EVENT(icm_id_class, \ 169 icm_send_##name, \ 170 TP_PROTO( \ 171 const struct ib_cm_id *cm_id \ 172 ), \ 173 TP_ARGS(cm_id)) 174 175 DEFINE_CM_SEND_EVENT(req); 176 DEFINE_CM_SEND_EVENT(rep); 177 DEFINE_CM_SEND_EVENT(dup_req); 178 DEFINE_CM_SEND_EVENT(dup_rep); 179 DEFINE_CM_SEND_EVENT(rtu); 180 DEFINE_CM_SEND_EVENT(mra); 181 DEFINE_CM_SEND_EVENT(sidr_req); 182 DEFINE_CM_SEND_EVENT(sidr_rep); 183 DEFINE_CM_SEND_EVENT(dreq); 184 DEFINE_CM_SEND_EVENT(drep); 185 186 TRACE_EVENT(icm_send_rej, 187 TP_PROTO( 188 const struct ib_cm_id *cm_id, 189 enum ib_cm_rej_reason reason 190 ), 191 192 TP_ARGS(cm_id, reason), 193 194 TP_STRUCT__entry( 195 __field(const void *, cm_id) 196 __field(u32, local_id) 197 __field(u32, remote_id) 198 __field(unsigned long, state) 199 __field(unsigned long, reason) 200 ), 201 202 TP_fast_assign( 203 __entry->cm_id = cm_id; 204 __entry->local_id = be32_to_cpu(cm_id->local_id); 205 __entry->remote_id = be32_to_cpu(cm_id->remote_id); 206 __entry->state = cm_id->state; 207 __entry->reason = reason; 208 ), 209 210 TP_printk("local_id=%u remote_id=%u state=%s reason=%s", 211 __entry->local_id, __entry->remote_id, 212 show_ib_cm_state(__entry->state), 213 show_ib_cm_rej_reason(__entry->reason) 214 ) 215 ); 216 217 #define DEFINE_CM_ERR_EVENT(name) \ 218 DEFINE_EVENT(icm_id_class, \ 219 icm_##name##_err, \ 220 TP_PROTO( \ 221 const struct ib_cm_id *cm_id \ 222 ), \ 223 TP_ARGS(cm_id)) 224 225 DEFINE_CM_ERR_EVENT(send_cm_rtu); 226 DEFINE_CM_ERR_EVENT(establish); 227 DEFINE_CM_ERR_EVENT(no_listener); 228 DEFINE_CM_ERR_EVENT(send_drep); 229 DEFINE_CM_ERR_EVENT(dreq_unknown); 230 DEFINE_CM_ERR_EVENT(send_unknown_rej); 231 DEFINE_CM_ERR_EVENT(rej_unknown); 232 DEFINE_CM_ERR_EVENT(send_mra_unknown); 233 DEFINE_CM_ERR_EVENT(mra_unknown); 234 DEFINE_CM_ERR_EVENT(qp_init); 235 DEFINE_CM_ERR_EVENT(qp_rtr); 236 DEFINE_CM_ERR_EVENT(qp_rts); 237 238 DEFINE_EVENT(icm_id_class, \ 239 icm_dreq_skipped, \ 240 TP_PROTO( \ 241 const struct ib_cm_id *cm_id \ 242 ), \ 243 TP_ARGS(cm_id) \ 244 ); 245 246 DECLARE_EVENT_CLASS(icm_local_class, 247 TP_PROTO( 248 unsigned int local_id, 249 unsigned int remote_id 250 ), 251 252 TP_ARGS(local_id, remote_id), 253 254 TP_STRUCT__entry( 255 __field(unsigned int, local_id) 256 __field(unsigned int, remote_id) 257 ), 258 259 TP_fast_assign( 260 __entry->local_id = local_id; 261 __entry->remote_id = remote_id; 262 ), 263 264 TP_printk("local_id=%u remote_id=%u", 265 __entry->local_id, __entry->remote_id 266 ) 267 ); 268 269 #define DEFINE_CM_LOCAL_EVENT(name) \ 270 DEFINE_EVENT(icm_local_class, \ 271 icm_##name, \ 272 TP_PROTO( \ 273 unsigned int local_id, \ 274 unsigned int remote_id \ 275 ), \ 276 TP_ARGS(local_id, remote_id)) 277 278 DEFINE_CM_LOCAL_EVENT(issue_rej); 279 DEFINE_CM_LOCAL_EVENT(issue_drep); 280 DEFINE_CM_LOCAL_EVENT(staleconn_err); 281 DEFINE_CM_LOCAL_EVENT(no_priv_err); 282 283 DECLARE_EVENT_CLASS(icm_remote_class, 284 TP_PROTO( 285 u32 remote_id 286 ), 287 288 TP_ARGS(remote_id), 289 290 TP_STRUCT__entry( 291 __field(u32, remote_id) 292 ), 293 294 TP_fast_assign( 295 __entry->remote_id = remote_id; 296 ), 297 298 TP_printk("remote_id=%u", 299 __entry->remote_id 300 ) 301 ); 302 303 #define DEFINE_CM_REMOTE_EVENT(name) \ 304 DEFINE_EVENT(icm_remote_class, \ 305 icm_##name, \ 306 TP_PROTO( \ 307 u32 remote_id \ 308 ), \ 309 TP_ARGS(remote_id)) 310 311 DEFINE_CM_REMOTE_EVENT(remote_no_priv_err); 312 DEFINE_CM_REMOTE_EVENT(insert_failed_err); 313 314 TRACE_EVENT(icm_send_rep_err, 315 TP_PROTO( 316 __be32 local_id, 317 enum ib_cm_state state 318 ), 319 320 TP_ARGS(local_id, state), 321 322 TP_STRUCT__entry( 323 __field(unsigned int, local_id) 324 __field(unsigned long, state) 325 ), 326 327 TP_fast_assign( 328 __entry->local_id = be32_to_cpu(local_id); 329 __entry->state = state; 330 ), 331 332 TP_printk("local_id=%u state=%s", 333 __entry->local_id, show_ib_cm_state(__entry->state) 334 ) 335 ); 336 337 TRACE_EVENT(icm_rep_unknown_err, 338 TP_PROTO( 339 unsigned int local_id, 340 unsigned int remote_id, 341 enum ib_cm_state state 342 ), 343 344 TP_ARGS(local_id, remote_id, state), 345 346 TP_STRUCT__entry( 347 __field(unsigned int, local_id) 348 __field(unsigned int, remote_id) 349 __field(unsigned long, state) 350 ), 351 352 TP_fast_assign( 353 __entry->local_id = local_id; 354 __entry->remote_id = remote_id; 355 __entry->state = state; 356 ), 357 358 TP_printk("local_id=%u remote_id=%u state=%s", 359 __entry->local_id, __entry->remote_id, 360 show_ib_cm_state(__entry->state) 361 ) 362 ); 363 364 TRACE_EVENT(icm_handler_err, 365 TP_PROTO( 366 enum ib_cm_event_type event 367 ), 368 369 TP_ARGS(event), 370 371 TP_STRUCT__entry( 372 __field(unsigned long, event) 373 ), 374 375 TP_fast_assign( 376 __entry->event = event; 377 ), 378 379 TP_printk("unhandled event=%s", 380 rdma_show_ib_cm_event(__entry->event) 381 ) 382 ); 383 384 TRACE_EVENT(icm_mad_send_err, 385 TP_PROTO( 386 enum ib_cm_state state, 387 enum ib_wc_status wc_status 388 ), 389 390 TP_ARGS(state, wc_status), 391 392 TP_STRUCT__entry( 393 __field(unsigned long, state) 394 __field(unsigned long, wc_status) 395 ), 396 397 TP_fast_assign( 398 __entry->state = state; 399 __entry->wc_status = wc_status; 400 ), 401 402 TP_printk("state=%s completion status=%s", 403 show_ib_cm_state(__entry->state), 404 rdma_show_wc_status(__entry->wc_status) 405 ) 406 ); 407 408 #endif /* _TRACE_IB_CMA_H */ 409 410 #undef TRACE_INCLUDE_PATH 411 #define TRACE_INCLUDE_PATH ../../drivers/infiniband/core 412 #define TRACE_INCLUDE_FILE cm_trace 413 414 #include <trace/define_trace.h> 415