1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2018-2019 Hisilicon Limited. */
4 /* This must be outside ifdef _HCLGEVF_TRACE_H */
6 #define TRACE_SYSTEM hns3
8 #if !defined(_HCLGEVF_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
9 #define _HCLGEVF_TRACE_H_
11 #include <linux/tracepoint.h>
13 #define VF_GET_MBX_LEN (sizeof(struct hclge_mbx_pf_to_vf_cmd) / sizeof(u32))
14 #define VF_SEND_MBX_LEN (sizeof(struct hclge_mbx_vf_to_pf_cmd) / sizeof(u32))
16 TRACE_EVENT(hclge_vf_mbx_get
,
18 struct hclgevf_dev
*hdev
,
19 struct hclge_mbx_pf_to_vf_cmd
*req
),
25 __string(pciname
, pci_name(hdev
->pdev
))
26 __string(devname
, hdev
->nic
.kinfo
.netdev
->name
)
27 __array(u32
, mbx_data
, VF_GET_MBX_LEN
)
31 __entry
->vfid
= req
->dest_vfid
;
32 __entry
->code
= le16_to_cpu(req
->msg
.code
);
33 __assign_str(pciname
);
34 __assign_str(devname
);
35 memcpy(__entry
->mbx_data
, req
,
36 sizeof(struct hclge_mbx_pf_to_vf_cmd
));
40 "%s %s vfid:%u code:%u data:%s",
41 __get_str(pciname
), __get_str(devname
), __entry
->vfid
,
43 __print_array(__entry
->mbx_data
, VF_GET_MBX_LEN
, sizeof(u32
))
47 TRACE_EVENT(hclge_vf_mbx_send
,
49 struct hclgevf_dev
*hdev
,
50 struct hclge_mbx_vf_to_pf_cmd
*req
),
57 __string(pciname
, pci_name(hdev
->pdev
))
58 __string(devname
, hdev
->nic
.kinfo
.netdev
->name
)
59 __array(u32
, mbx_data
, VF_SEND_MBX_LEN
)
63 __entry
->vfid
= req
->mbx_src_vfid
;
64 __entry
->code
= req
->msg
.code
;
65 __entry
->subcode
= req
->msg
.subcode
;
66 __assign_str(pciname
);
67 __assign_str(devname
);
68 memcpy(__entry
->mbx_data
, req
,
69 sizeof(struct hclge_mbx_vf_to_pf_cmd
));
73 "%s %s vfid:%u code:%u subcode:%u data:%s",
74 __get_str(pciname
), __get_str(devname
), __entry
->vfid
,
75 __entry
->code
, __entry
->subcode
,
76 __print_array(__entry
->mbx_data
, VF_SEND_MBX_LEN
, sizeof(u32
))
80 DECLARE_EVENT_CLASS(hclge_vf_cmd_template
,
81 TP_PROTO(struct hclge_comm_hw
*hw
,
82 struct hclge_desc
*desc
,
86 TP_ARGS(hw
, desc
, index
, num
),
88 TP_STRUCT__entry(__field(u16
, opcode
)
94 __string(pciname
, pci_name(hw
->cmq
.csq
.pdev
))
95 __array(u32
, data
, HCLGE_DESC_DATA_LEN
)),
98 __entry
->opcode
= le16_to_cpu(desc
->opcode
);
99 __entry
->flag
= le16_to_cpu(desc
->flag
);
100 __entry
->retval
= le16_to_cpu(desc
->retval
);
101 __entry
->rsv
= le16_to_cpu(desc
->rsv
);
102 __entry
->index
= index
;
104 __assign_str(pciname
);
105 for (i
= 0; i
< HCLGE_DESC_DATA_LEN
; i
++)
106 __entry
->data
[i
] = le32_to_cpu(desc
->data
[i
]);),
108 TP_printk("%s opcode:0x%04x %d-%d flag:0x%04x retval:0x%04x rsv:0x%04x data:%s",
109 __get_str(pciname
), __entry
->opcode
,
110 __entry
->index
, __entry
->num
,
111 __entry
->flag
, __entry
->retval
, __entry
->rsv
,
112 __print_array(__entry
->data
,
113 HCLGE_DESC_DATA_LEN
, sizeof(u32
)))
116 DEFINE_EVENT(hclge_vf_cmd_template
, hclge_vf_cmd_send
,
117 TP_PROTO(struct hclge_comm_hw
*hw
,
118 struct hclge_desc
*desc
,
121 TP_ARGS(hw
, desc
, index
, num
));
123 DEFINE_EVENT(hclge_vf_cmd_template
, hclge_vf_cmd_get
,
124 TP_PROTO(struct hclge_comm_hw
*hw
,
125 struct hclge_desc
*desc
,
128 TP_ARGS(hw
, desc
, index
, num
));
130 #endif /* _HCLGEVF_TRACE_H_ */
132 /* This must be outside ifdef _HCLGEVF_TRACE_H */
133 #undef TRACE_INCLUDE_PATH
134 #define TRACE_INCLUDE_PATH .
135 #undef TRACE_INCLUDE_FILE
136 #define TRACE_INCLUDE_FILE hclgevf_trace
137 #include <trace/define_trace.h>