1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
3 
4 #undef TRACE_SYSTEM
5 #define TRACE_SYSTEM mlx5
6 
7 #if !defined(_MLX5_SF_VHCA_TP_) || defined(TRACE_HEADER_MULTI_READ)
8 #define _MLX5_SF_VHCA_TP_
9 
10 #include <linux/tracepoint.h>
11 #include <linux/mlx5/driver.h>
12 #include "sf/vhca_event.h"
13 
14 TRACE_EVENT(mlx5_sf_vhca_event,
15 	    TP_PROTO(const struct mlx5_core_dev *dev,
16 		     const struct mlx5_vhca_state_event *event),
17 	    TP_ARGS(dev, event),
18 	    TP_STRUCT__entry(__string(devname, dev_name(dev->device))
19 			     __field(u16, hw_fn_id)
20 			     __field(u32, sfnum)
21 			     __field(u8, vhca_state)
22 			    ),
23 	    TP_fast_assign(__assign_str(devname, dev_name(dev->device));
24 		    __entry->hw_fn_id = event->function_id;
25 		    __entry->sfnum = event->sw_function_id;
26 		    __entry->vhca_state = event->new_vhca_state;
27 	    ),
28 	    TP_printk("(%s) hw_id=0x%x sfnum=%u vhca_state=%d\n",
29 		      __get_str(devname), __entry->hw_fn_id,
30 		      __entry->sfnum, __entry->vhca_state)
31 );
32 
33 #endif /* _MLX5_SF_VHCA_TP_ */
34 
35 /* This part must be outside protection */
36 #undef TRACE_INCLUDE_PATH
37 #define TRACE_INCLUDE_PATH sf/diag
38 #undef TRACE_INCLUDE_FILE
39 #define TRACE_INCLUDE_FILE vhca_tracepoint
40 #include <trace/define_trace.h>
41