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

IB/MAD: Add agent trace points

Trace agent details when agents are [un]registered. In addition, report
agent details on send/recv.

Reviewed-by: "Ruhl, Michael J" <michael.j.ruhl@intel.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
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
0e65bae2 821bf1de

+50
+4
drivers/infiniband/core/mad.c
··· 467 467 } 468 468 spin_unlock_irq(&port_priv->reg_lock); 469 469 470 + trace_ib_mad_create_agent(mad_agent_priv); 470 471 return &mad_agent_priv->agent; 471 472 error6: 472 473 spin_unlock_irq(&port_priv->reg_lock); ··· 623 622 struct ib_mad_port_private *port_priv; 624 623 625 624 /* Note that we could still be handling received MADs */ 625 + trace_ib_mad_unregister_agent(mad_agent_priv); 626 626 627 627 /* 628 628 * Canceling all sends results in dropping received response ··· 2356 2354 2357 2355 mad_agent = find_mad_agent(port_priv, (const struct ib_mad_hdr *)recv->mad); 2358 2356 if (mad_agent) { 2357 + trace_ib_mad_recv_done_agent(mad_agent); 2359 2358 ib_mad_complete_recv(mad_agent, &recv->header.recv_wc); 2360 2359 /* 2361 2360 * recv is freed up in error cases in ib_mad_complete_recv ··· 2521 2518 send_queue = mad_list->mad_queue; 2522 2519 qp_info = send_queue->qp_info; 2523 2520 2521 + trace_ib_mad_send_done_agent(mad_send_wr->mad_agent_priv); 2524 2522 trace_ib_mad_send_done_handler(mad_send_wr, wc); 2525 2523 2526 2524 retry:
+46
include/trace/events/ib_mad.h
··· 248 248 ) 249 249 ); 250 250 251 + DECLARE_EVENT_CLASS(ib_mad_agent_template, 252 + TP_PROTO(struct ib_mad_agent_private *agent), 253 + TP_ARGS(agent), 254 + 255 + TP_STRUCT__entry( 256 + __field(u32, dev_index) 257 + __field(u32, hi_tid) 258 + __field(u8, port_num) 259 + __field(u8, mgmt_class) 260 + __field(u8, mgmt_class_version) 261 + ), 262 + 263 + TP_fast_assign( 264 + __entry->dev_index = agent->agent.device->index; 265 + __entry->port_num = agent->agent.port_num; 266 + __entry->hi_tid = agent->agent.hi_tid; 267 + 268 + if (agent->reg_req) { 269 + __entry->mgmt_class = agent->reg_req->mgmt_class; 270 + __entry->mgmt_class_version = 271 + agent->reg_req->mgmt_class_version; 272 + } else { 273 + __entry->mgmt_class = 0; 274 + __entry->mgmt_class_version = 0; 275 + } 276 + ), 277 + 278 + TP_printk("%d:%d mad agent : hi_tid 0x%08x class 0x%02x class_ver 0x%02x", 279 + __entry->dev_index, __entry->port_num, 280 + __entry->hi_tid, __entry->mgmt_class, 281 + __entry->mgmt_class_version 282 + ) 283 + ); 284 + DEFINE_EVENT(ib_mad_agent_template, ib_mad_recv_done_agent, 285 + TP_PROTO(struct ib_mad_agent_private *agent), 286 + TP_ARGS(agent)); 287 + DEFINE_EVENT(ib_mad_agent_template, ib_mad_send_done_agent, 288 + TP_PROTO(struct ib_mad_agent_private *agent), 289 + TP_ARGS(agent)); 290 + DEFINE_EVENT(ib_mad_agent_template, ib_mad_create_agent, 291 + TP_PROTO(struct ib_mad_agent_private *agent), 292 + TP_ARGS(agent)); 293 + DEFINE_EVENT(ib_mad_agent_template, ib_mad_unregister_agent, 294 + TP_PROTO(struct ib_mad_agent_private *agent), 295 + TP_ARGS(agent)); 296 + 251 297 252 298 #endif /* _TRACE_IB_MAD_H */ 253 299