1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019 - 2021 Intel Corporation */
3 #if !defined(__TRACE_CM_H) || defined(TRACE_HEADER_MULTI_READ)
6 #include <linux/tracepoint.h>
7 #include <linux/trace_seq.h>
11 const char *print_ip_addr(struct trace_seq
*p
, u32
*addr
, u16 port
, bool ivp4
);
12 const char *parse_iw_event_type(enum iw_cm_event_type iw_type
);
13 const char *parse_cm_event_type(enum irdma_cm_event_type cm_type
);
14 const char *parse_cm_state(enum irdma_cm_node_state
);
15 #define __print_ip_addr(addr, port, ipv4) print_ip_addr(p, addr, port, ipv4)
18 #define TRACE_SYSTEM irdma_cm
20 TRACE_EVENT(irdma_create_listen
,
21 TP_PROTO(struct irdma_device
*iwdev
, struct irdma_cm_info
*cm_info
),
22 TP_ARGS(iwdev
, cm_info
),
23 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
24 __dynamic_array(u32
, laddr
, 4)
28 TP_fast_assign(__entry
->iwdev
= iwdev
;
29 __entry
->lport
= cm_info
->loc_port
;
30 __entry
->ipv4
= cm_info
->ipv4
;
31 memcpy(__get_dynamic_array(laddr
),
32 cm_info
->loc_addr
, 4);
34 TP_printk("iwdev=%p loc: %s",
36 __print_ip_addr(__get_dynamic_array(laddr
),
37 __entry
->lport
, __entry
->ipv4
)
41 TRACE_EVENT(irdma_dec_refcnt_listen
,
42 TP_PROTO(struct irdma_cm_listener
*listener
, void *caller
),
43 TP_ARGS(listener
, caller
),
44 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
46 __dynamic_array(u32
, laddr
, 4)
49 __field(void *, caller
)
51 TP_fast_assign(__entry
->iwdev
= listener
->iwdev
;
52 __entry
->lport
= listener
->loc_port
;
53 __entry
->ipv4
= listener
->ipv4
;
54 memcpy(__get_dynamic_array(laddr
),
55 listener
->loc_addr
, 4);
57 TP_printk("iwdev=%p caller=%pS loc: %s",
60 __print_ip_addr(__get_dynamic_array(laddr
),
61 __entry
->lport
, __entry
->ipv4
)
65 DECLARE_EVENT_CLASS(listener_template
,
66 TP_PROTO(struct irdma_cm_listener
*listener
),
68 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
72 __field(enum irdma_cm_listener_state
,
74 __dynamic_array(u32
, laddr
, 4)
76 TP_fast_assign(__entry
->iwdev
= listener
->iwdev
;
77 __entry
->lport
= listener
->loc_port
;
78 __entry
->vlan_id
= listener
->vlan_id
;
79 __entry
->ipv4
= listener
->ipv4
;
80 __entry
->state
= listener
->listener_state
;
81 memcpy(__get_dynamic_array(laddr
),
82 listener
->loc_addr
, 4);
84 TP_printk("iwdev=%p vlan=%d loc: %s",
87 __print_ip_addr(__get_dynamic_array(laddr
),
88 __entry
->lport
, __entry
->ipv4
)
92 DEFINE_EVENT(listener_template
, irdma_find_listener
,
93 TP_PROTO(struct irdma_cm_listener
*listener
),
96 DEFINE_EVENT(listener_template
, irdma_del_multiple_qhash
,
97 TP_PROTO(struct irdma_cm_listener
*listener
),
100 TRACE_EVENT(irdma_negotiate_mpa_v2
,
101 TP_PROTO(struct irdma_cm_node
*cm_node
),
103 TP_STRUCT__entry(__field(struct irdma_cm_node
*, cm_node
)
104 __field(u16
, ord_size
)
105 __field(u16
, ird_size
)
107 TP_fast_assign(__entry
->cm_node
= cm_node
;
108 __entry
->ord_size
= cm_node
->ord_size
;
109 __entry
->ird_size
= cm_node
->ird_size
;
111 TP_printk("MPVA2 Negotiated cm_node=%p ORD:[%d], IRD:[%d]",
118 DECLARE_EVENT_CLASS(tos_template
,
119 TP_PROTO(struct irdma_device
*iwdev
, u8 tos
, u8 user_pri
),
120 TP_ARGS(iwdev
, tos
, user_pri
),
121 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
123 __field(u8
, user_pri
)
125 TP_fast_assign(__entry
->iwdev
= iwdev
;
127 __entry
->user_pri
= user_pri
;
129 TP_printk("iwdev=%p TOS:[%d] UP:[%d]",
136 DEFINE_EVENT(tos_template
, irdma_listener_tos
,
137 TP_PROTO(struct irdma_device
*iwdev
, u8 tos
, u8 user_pri
),
138 TP_ARGS(iwdev
, tos
, user_pri
));
140 DEFINE_EVENT(tos_template
, irdma_dcb_tos
,
141 TP_PROTO(struct irdma_device
*iwdev
, u8 tos
, u8 user_pri
),
142 TP_ARGS(iwdev
, tos
, user_pri
));
144 DECLARE_EVENT_CLASS(qhash_template
,
145 TP_PROTO(struct irdma_device
*iwdev
,
146 struct irdma_cm_listener
*listener
,
147 const char *dev_addr
),
148 TP_ARGS(iwdev
, listener
, dev_addr
),
149 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
151 __field(u16
, vlan_id
)
153 __dynamic_array(u32
, laddr
, 4)
154 __dynamic_array(u32
, mac
, ETH_ALEN
)
156 TP_fast_assign(__entry
->iwdev
= iwdev
;
157 __entry
->lport
= listener
->loc_port
;
158 __entry
->vlan_id
= listener
->vlan_id
;
159 __entry
->ipv4
= listener
->ipv4
;
160 memcpy(__get_dynamic_array(laddr
),
161 listener
->loc_addr
, 4);
162 ether_addr_copy(__get_dynamic_array(mac
),
165 TP_printk("iwdev=%p vlan=%d MAC=%6phC loc: %s",
168 __get_dynamic_array(mac
),
169 __print_ip_addr(__get_dynamic_array(laddr
),
170 __entry
->lport
, __entry
->ipv4
)
174 DEFINE_EVENT(qhash_template
, irdma_add_mqh_6
,
175 TP_PROTO(struct irdma_device
*iwdev
,
176 struct irdma_cm_listener
*listener
,
177 const char *dev_addr
),
178 TP_ARGS(iwdev
, listener
, dev_addr
));
180 DEFINE_EVENT(qhash_template
, irdma_add_mqh_4
,
181 TP_PROTO(struct irdma_device
*iwdev
,
182 struct irdma_cm_listener
*listener
,
183 const char *dev_addr
),
184 TP_ARGS(iwdev
, listener
, dev_addr
));
186 TRACE_EVENT(irdma_addr_resolve
,
187 TP_PROTO(struct irdma_device
*iwdev
, char *dev_addr
),
188 TP_ARGS(iwdev
, dev_addr
),
189 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
190 __dynamic_array(u8
, mac
, ETH_ALEN
)
192 TP_fast_assign(__entry
->iwdev
= iwdev
;
193 ether_addr_copy(__get_dynamic_array(mac
), dev_addr
);
195 TP_printk("iwdev=%p MAC=%6phC", __entry
->iwdev
,
196 __get_dynamic_array(mac
)
200 TRACE_EVENT(irdma_send_cm_event
,
201 TP_PROTO(struct irdma_cm_node
*cm_node
, struct iw_cm_id
*cm_id
,
202 enum iw_cm_event_type type
, int status
, void *caller
),
203 TP_ARGS(cm_node
, cm_id
, type
, status
, caller
),
204 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
205 __field(struct irdma_cm_node
*, cm_node
)
206 __field(struct iw_cm_id
*, cm_id
)
207 __field(u32
, refcount
)
210 __field(enum irdma_cm_node_state
, state
)
212 __field(u16
, vlan_id
)
214 __field(enum iw_cm_event_type
, type
)
216 __field(void *, caller
)
217 __dynamic_array(u32
, laddr
, 4)
218 __dynamic_array(u32
, raddr
, 4)
220 TP_fast_assign(__entry
->iwdev
= cm_node
->iwdev
;
221 __entry
->cm_node
= cm_node
;
222 __entry
->cm_id
= cm_id
;
223 __entry
->refcount
= refcount_read(&cm_node
->refcnt
);
224 __entry
->state
= cm_node
->state
;
225 __entry
->lport
= cm_node
->loc_port
;
226 __entry
->rport
= cm_node
->rem_port
;
227 __entry
->ipv4
= cm_node
->ipv4
;
228 __entry
->vlan_id
= cm_node
->vlan_id
;
229 __entry
->accel
= cm_node
->accelerated
;
230 __entry
->type
= type
;
231 __entry
->status
= status
;
232 __entry
->caller
= caller
;
233 memcpy(__get_dynamic_array(laddr
),
234 cm_node
->loc_addr
, 4);
235 memcpy(__get_dynamic_array(raddr
),
236 cm_node
->rem_addr
, 4);
238 TP_printk("iwdev=%p caller=%pS cm_id=%p node=%p refcnt=%d vlan_id=%d accel=%d state=%s event_type=%s status=%d loc: %s rem: %s",
246 parse_cm_state(__entry
->state
),
247 parse_iw_event_type(__entry
->type
),
249 __print_ip_addr(__get_dynamic_array(laddr
),
250 __entry
->lport
, __entry
->ipv4
),
251 __print_ip_addr(__get_dynamic_array(raddr
),
252 __entry
->rport
, __entry
->ipv4
)
256 TRACE_EVENT(irdma_send_cm_event_no_node
,
257 TP_PROTO(struct iw_cm_id
*cm_id
, enum iw_cm_event_type type
,
258 int status
, void *caller
),
259 TP_ARGS(cm_id
, type
, status
, caller
),
260 TP_STRUCT__entry(__field(struct iw_cm_id
*, cm_id
)
261 __field(enum iw_cm_event_type
, type
)
263 __field(void *, caller
)
265 TP_fast_assign(__entry
->cm_id
= cm_id
;
266 __entry
->type
= type
;
267 __entry
->status
= status
;
268 __entry
->caller
= caller
;
270 TP_printk("cm_id=%p caller=%pS event_type=%s status=%d",
273 parse_iw_event_type(__entry
->type
),
278 DECLARE_EVENT_CLASS(cm_node_template
,
279 TP_PROTO(struct irdma_cm_node
*cm_node
,
280 enum irdma_cm_event_type type
, void *caller
),
281 TP_ARGS(cm_node
, type
, caller
),
282 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
283 __field(struct irdma_cm_node
*, cm_node
)
284 __field(u32
, refcount
)
287 __field(enum irdma_cm_node_state
, state
)
289 __field(u16
, vlan_id
)
291 __field(enum irdma_cm_event_type
, type
)
292 __field(void *, caller
)
293 __dynamic_array(u32
, laddr
, 4)
294 __dynamic_array(u32
, raddr
, 4)
296 TP_fast_assign(__entry
->iwdev
= cm_node
->iwdev
;
297 __entry
->cm_node
= cm_node
;
298 __entry
->refcount
= refcount_read(&cm_node
->refcnt
);
299 __entry
->state
= cm_node
->state
;
300 __entry
->lport
= cm_node
->loc_port
;
301 __entry
->rport
= cm_node
->rem_port
;
302 __entry
->ipv4
= cm_node
->ipv4
;
303 __entry
->vlan_id
= cm_node
->vlan_id
;
304 __entry
->accel
= cm_node
->accelerated
;
305 __entry
->type
= type
;
306 __entry
->caller
= caller
;
307 memcpy(__get_dynamic_array(laddr
),
308 cm_node
->loc_addr
, 4);
309 memcpy(__get_dynamic_array(raddr
),
310 cm_node
->rem_addr
, 4);
312 TP_printk("iwdev=%p caller=%pS node=%p refcnt=%d vlan_id=%d accel=%d state=%s event_type=%s loc: %s rem: %s",
319 parse_cm_state(__entry
->state
),
320 parse_cm_event_type(__entry
->type
),
321 __print_ip_addr(__get_dynamic_array(laddr
),
322 __entry
->lport
, __entry
->ipv4
),
323 __print_ip_addr(__get_dynamic_array(raddr
),
324 __entry
->rport
, __entry
->ipv4
)
328 DEFINE_EVENT(cm_node_template
, irdma_create_event
,
329 TP_PROTO(struct irdma_cm_node
*cm_node
,
330 enum irdma_cm_event_type type
, void *caller
),
331 TP_ARGS(cm_node
, type
, caller
));
333 DEFINE_EVENT(cm_node_template
, irdma_accept
,
334 TP_PROTO(struct irdma_cm_node
*cm_node
,
335 enum irdma_cm_event_type type
, void *caller
),
336 TP_ARGS(cm_node
, type
, caller
));
338 DEFINE_EVENT(cm_node_template
, irdma_connect
,
339 TP_PROTO(struct irdma_cm_node
*cm_node
,
340 enum irdma_cm_event_type type
, void *caller
),
341 TP_ARGS(cm_node
, type
, caller
));
343 DEFINE_EVENT(cm_node_template
, irdma_reject
,
344 TP_PROTO(struct irdma_cm_node
*cm_node
,
345 enum irdma_cm_event_type type
, void *caller
),
346 TP_ARGS(cm_node
, type
, caller
));
348 DEFINE_EVENT(cm_node_template
, irdma_find_node
,
349 TP_PROTO(struct irdma_cm_node
*cm_node
,
350 enum irdma_cm_event_type type
, void *caller
),
351 TP_ARGS(cm_node
, type
, caller
));
353 DEFINE_EVENT(cm_node_template
, irdma_send_reset
,
354 TP_PROTO(struct irdma_cm_node
*cm_node
,
355 enum irdma_cm_event_type type
, void *caller
),
356 TP_ARGS(cm_node
, type
, caller
));
358 DEFINE_EVENT(cm_node_template
, irdma_rem_ref_cm_node
,
359 TP_PROTO(struct irdma_cm_node
*cm_node
,
360 enum irdma_cm_event_type type
, void *caller
),
361 TP_ARGS(cm_node
, type
, caller
));
363 DEFINE_EVENT(cm_node_template
, irdma_cm_event_handler
,
364 TP_PROTO(struct irdma_cm_node
*cm_node
,
365 enum irdma_cm_event_type type
, void *caller
),
366 TP_ARGS(cm_node
, type
, caller
));
368 TRACE_EVENT(open_err_template
,
369 TP_PROTO(struct irdma_cm_node
*cm_node
, bool reset
, void *caller
),
370 TP_ARGS(cm_node
, reset
, caller
),
371 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
372 __field(struct irdma_cm_node
*, cm_node
)
373 __field(enum irdma_cm_node_state
, state
)
375 __field(void *, caller
)
377 TP_fast_assign(__entry
->iwdev
= cm_node
->iwdev
;
378 __entry
->cm_node
= cm_node
;
379 __entry
->state
= cm_node
->state
;
380 __entry
->reset
= reset
;
381 __entry
->caller
= caller
;
383 TP_printk("iwdev=%p caller=%pS node%p reset=%d state=%s",
388 parse_cm_state(__entry
->state
)
392 DEFINE_EVENT(open_err_template
, irdma_active_open_err
,
393 TP_PROTO(struct irdma_cm_node
*cm_node
, bool reset
, void *caller
),
394 TP_ARGS(cm_node
, reset
, caller
));
396 DEFINE_EVENT(open_err_template
, irdma_passive_open_err
,
397 TP_PROTO(struct irdma_cm_node
*cm_node
, bool reset
, void *caller
),
398 TP_ARGS(cm_node
, reset
, caller
));
400 DECLARE_EVENT_CLASS(cm_node_ah_template
,
401 TP_PROTO(struct irdma_cm_node
*cm_node
),
403 TP_STRUCT__entry(__field(struct irdma_device
*, iwdev
)
404 __field(struct irdma_cm_node
*, cm_node
)
405 __field(struct irdma_sc_ah
*, ah
)
406 __field(u32
, refcount
)
409 __field(enum irdma_cm_node_state
, state
)
411 __field(u16
, vlan_id
)
413 __dynamic_array(u32
, laddr
, 4)
414 __dynamic_array(u32
, raddr
, 4)
416 TP_fast_assign(__entry
->iwdev
= cm_node
->iwdev
;
417 __entry
->cm_node
= cm_node
;
418 __entry
->ah
= cm_node
->ah
;
419 __entry
->refcount
= refcount_read(&cm_node
->refcnt
);
420 __entry
->lport
= cm_node
->loc_port
;
421 __entry
->rport
= cm_node
->rem_port
;
422 __entry
->state
= cm_node
->state
;
423 __entry
->ipv4
= cm_node
->ipv4
;
424 __entry
->vlan_id
= cm_node
->vlan_id
;
425 __entry
->accel
= cm_node
->accelerated
;
426 memcpy(__get_dynamic_array(laddr
),
427 cm_node
->loc_addr
, 4);
428 memcpy(__get_dynamic_array(raddr
),
429 cm_node
->rem_addr
, 4);
431 TP_printk("iwdev=%p node=%p ah=%p refcnt=%d vlan_id=%d accel=%d state=%s loc: %s rem: %s",
438 parse_cm_state(__entry
->state
),
439 __print_ip_addr(__get_dynamic_array(laddr
),
440 __entry
->lport
, __entry
->ipv4
),
441 __print_ip_addr(__get_dynamic_array(raddr
),
442 __entry
->rport
, __entry
->ipv4
)
446 DEFINE_EVENT(cm_node_ah_template
, irdma_cm_free_ah
,
447 TP_PROTO(struct irdma_cm_node
*cm_node
),
450 DEFINE_EVENT(cm_node_ah_template
, irdma_create_ah
,
451 TP_PROTO(struct irdma_cm_node
*cm_node
),
454 #endif /* __TRACE_CM_H */
456 #undef TRACE_INCLUDE_PATH
457 #undef TRACE_INCLUDE_FILE
458 #define TRACE_INCLUDE_PATH .
459 #define TRACE_INCLUDE_FILE trace_cm
460 #include <trace/define_trace.h>