Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/MAD: Add SMP details to MAD tracing

Decode more information from the packet and include it in the trace.

Reviewed-by: "Ruhl, Michael J" <michael.j.ruhl@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Ira Weiny and committed by
Jason Gunthorpe
2ccfbb70 05653319

+98
+8
drivers/infiniband/core/mad.c
··· 841 841 if (opa && smp->class_version == OPA_SM_CLASS_VERSION) { 842 842 u32 opa_drslid; 843 843 844 + trace_ib_mad_handle_out_opa_smi(opa_smp); 845 + 844 846 if ((opa_get_smp_direction(opa_smp) 845 847 ? opa_smp->route.dr.dr_dlid : opa_smp->route.dr.dr_slid) == 846 848 OPA_LID_PERMISSIVE && ··· 868 866 opa_smi_check_local_returning_smp(opa_smp, device) == IB_SMI_DISCARD) 869 867 goto out; 870 868 } else { 869 + trace_ib_mad_handle_out_ib_smi(smp); 870 + 871 871 if ((ib_get_smp_direction(smp) ? smp->dr_dlid : smp->dr_slid) == 872 872 IB_LID_PERMISSIVE && 873 873 smi_handle_dr_smp_send(smp, rdma_cap_ib_switch(device), port_num) == ··· 2102 2098 enum smi_forward_action retsmi; 2103 2099 struct ib_smp *smp = (struct ib_smp *)recv->mad; 2104 2100 2101 + trace_ib_mad_handle_ib_smi(smp); 2102 + 2105 2103 if (smi_handle_dr_smp_recv(smp, 2106 2104 rdma_cap_ib_switch(port_priv->device), 2107 2105 port_num, ··· 2188 2182 { 2189 2183 enum smi_forward_action retsmi; 2190 2184 struct opa_smp *smp = (struct opa_smp *)recv->mad; 2185 + 2186 + trace_ib_mad_handle_opa_smi(smp); 2191 2187 2192 2188 if (opa_smi_handle_dr_smp_recv(smp, 2193 2189 rdma_cap_ib_switch(port_priv->device),
+90
include/trace/events/ib_mad.h
··· 295 295 TP_ARGS(agent)); 296 296 297 297 298 + 299 + DECLARE_EVENT_CLASS(ib_mad_opa_smi_template, 300 + TP_PROTO(struct opa_smp *smp), 301 + TP_ARGS(smp), 302 + 303 + TP_STRUCT__entry( 304 + __field(u64, mkey) 305 + __field(u32, dr_slid) 306 + __field(u32, dr_dlid) 307 + __field(u8, hop_ptr) 308 + __field(u8, hop_cnt) 309 + __array(u8, initial_path, OPA_SMP_MAX_PATH_HOPS) 310 + __array(u8, return_path, OPA_SMP_MAX_PATH_HOPS) 311 + ), 312 + 313 + TP_fast_assign( 314 + __entry->hop_ptr = smp->hop_ptr; 315 + __entry->hop_cnt = smp->hop_cnt; 316 + __entry->mkey = smp->mkey; 317 + __entry->dr_slid = smp->route.dr.dr_slid; 318 + __entry->dr_dlid = smp->route.dr.dr_dlid; 319 + memcpy(__entry->initial_path, smp->route.dr.initial_path, 320 + OPA_SMP_MAX_PATH_HOPS); 321 + memcpy(__entry->return_path, smp->route.dr.return_path, 322 + OPA_SMP_MAX_PATH_HOPS); 323 + ), 324 + 325 + TP_printk("OPA SMP: hop_ptr %d hop_cnt %d " \ 326 + "mkey 0x%016llx dr_slid 0x%08x dr_dlid 0x%08x " \ 327 + "initial_path %*ph return_path %*ph ", 328 + __entry->hop_ptr, __entry->hop_cnt, 329 + be64_to_cpu(__entry->mkey), be32_to_cpu(__entry->dr_slid), 330 + be32_to_cpu(__entry->dr_dlid), 331 + OPA_SMP_MAX_PATH_HOPS, __entry->initial_path, 332 + OPA_SMP_MAX_PATH_HOPS, __entry->return_path 333 + ) 334 + ); 335 + 336 + DEFINE_EVENT(ib_mad_opa_smi_template, ib_mad_handle_opa_smi, 337 + TP_PROTO(struct opa_smp *smp), 338 + TP_ARGS(smp)); 339 + DEFINE_EVENT(ib_mad_opa_smi_template, ib_mad_handle_out_opa_smi, 340 + TP_PROTO(struct opa_smp *smp), 341 + TP_ARGS(smp)); 342 + 343 + 344 + DECLARE_EVENT_CLASS(ib_mad_opa_ib_template, 345 + TP_PROTO(struct ib_smp *smp), 346 + TP_ARGS(smp), 347 + 348 + TP_STRUCT__entry( 349 + __field(u64, mkey) 350 + __field(u32, dr_slid) 351 + __field(u32, dr_dlid) 352 + __field(u8, hop_ptr) 353 + __field(u8, hop_cnt) 354 + __array(u8, initial_path, IB_SMP_MAX_PATH_HOPS) 355 + __array(u8, return_path, IB_SMP_MAX_PATH_HOPS) 356 + ), 357 + 358 + TP_fast_assign( 359 + __entry->hop_ptr = smp->hop_ptr; 360 + __entry->hop_cnt = smp->hop_cnt; 361 + __entry->mkey = smp->mkey; 362 + __entry->dr_slid = smp->dr_slid; 363 + __entry->dr_dlid = smp->dr_dlid; 364 + memcpy(__entry->initial_path, smp->initial_path, 365 + IB_SMP_MAX_PATH_HOPS); 366 + memcpy(__entry->return_path, smp->return_path, 367 + IB_SMP_MAX_PATH_HOPS); 368 + ), 369 + 370 + TP_printk("OPA SMP: hop_ptr %d hop_cnt %d " \ 371 + "mkey 0x%016llx dr_slid 0x%04x dr_dlid 0x%04x " \ 372 + "initial_path %*ph return_path %*ph ", 373 + __entry->hop_ptr, __entry->hop_cnt, 374 + be64_to_cpu(__entry->mkey), be16_to_cpu(__entry->dr_slid), 375 + be16_to_cpu(__entry->dr_dlid), 376 + IB_SMP_MAX_PATH_HOPS, __entry->initial_path, 377 + IB_SMP_MAX_PATH_HOPS, __entry->return_path 378 + ) 379 + ); 380 + 381 + DEFINE_EVENT(ib_mad_opa_ib_template, ib_mad_handle_ib_smi, 382 + TP_PROTO(struct ib_smp *smp), 383 + TP_ARGS(smp)); 384 + DEFINE_EVENT(ib_mad_opa_ib_template, ib_mad_handle_out_ib_smi, 385 + TP_PROTO(struct ib_smp *smp), 386 + TP_ARGS(smp)); 387 + 298 388 #endif /* _TRACE_IB_MAD_H */ 299 389 300 390 #include <trace/define_trace.h>