File Index
Files and directories
Sign in
FILE

hclge_trace.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_trace.h C
  1/* SPDX-License-Identifier: GPL-2.0+ */
  2/* Copyright (c) 2018-2020 Hisilicon Limited. */
  3
  4/* This must be outside ifdef _HCLGE_TRACE_H */
  5#undef TRACE_SYSTEM
  6#define TRACE_SYSTEM hns3
  7
  8#if !defined(_HCLGE_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
  9#define _HCLGE_TRACE_H_
 10
 11#include <linux/tracepoint.h>
 12
 13#define PF_DESC_LEN	(sizeof(struct hclge_desc) / sizeof(u32))
 14#define PF_GET_MBX_LEN	(sizeof(struct hclge_mbx_vf_to_pf_cmd) / sizeof(u32))
 15#define PF_SEND_MBX_LEN	(sizeof(struct hclge_mbx_pf_to_vf_cmd) / sizeof(u32))
 16
 17TRACE_EVENT(hclge_pf_mbx_get,
 18	TP_PROTO(
 19		struct hclge_dev *hdev,
 20		struct hclge_mbx_vf_to_pf_cmd *req),
 21	TP_ARGS(hdev, req),
 22
 23	TP_STRUCT__entry(
 24		__field(u8, vfid)
 25		__field(u8, code)
 26		__field(u8, subcode)
 27		__string(pciname, pci_name(hdev->pdev))
 28		__string(devname, hdev->vport[0].nic.kinfo.netdev->name)
 29		__array(u32, mbx_data, PF_GET_MBX_LEN)
 30	),
 31
 32	TP_fast_assign(
 33		__entry->vfid = req->mbx_src_vfid;
 34		__entry->code = req->msg.code;
 35		__entry->subcode = req->msg.subcode;
 36		__assign_str(pciname);
 37		__assign_str(devname);
 38		memcpy(__entry->mbx_data, req,
 39		       sizeof(struct hclge_mbx_vf_to_pf_cmd));
 40	),
 41
 42	TP_printk(
 43		"%s %s vfid:%u code:%u subcode:%u data:%s",
 44		__get_str(pciname), __get_str(devname), __entry->vfid,
 45		__entry->code, __entry->subcode,
 46		__print_array(__entry->mbx_data, PF_GET_MBX_LEN, sizeof(u32))
 47	)
 48);
 49
 50TRACE_EVENT(hclge_pf_mbx_send,
 51	TP_PROTO(
 52		struct hclge_dev *hdev,
 53		struct hclge_mbx_pf_to_vf_cmd *req),
 54	TP_ARGS(hdev, req),
 55
 56	TP_STRUCT__entry(
 57		__field(u8, vfid)
 58		__field(u16, code)
 59		__string(pciname, pci_name(hdev->pdev))
 60		__string(devname, hdev->vport[0].nic.kinfo.netdev->name)
 61		__array(u32, mbx_data, PF_SEND_MBX_LEN)
 62	),
 63
 64	TP_fast_assign(
 65		__entry->vfid = req->dest_vfid;
 66		__entry->code = le16_to_cpu(req->msg.code);
 67		__assign_str(pciname);
 68		__assign_str(devname);
 69		memcpy(__entry->mbx_data, req,
 70		       sizeof(struct hclge_mbx_pf_to_vf_cmd));
 71	),
 72
 73	TP_printk(
 74		"%s %s vfid:%u code:%u data:%s",
 75		__get_str(pciname), __get_str(devname), __entry->vfid,
 76		__entry->code,
 77		__print_array(__entry->mbx_data, PF_SEND_MBX_LEN, sizeof(u32))
 78	)
 79);
 80
 81DECLARE_EVENT_CLASS(hclge_pf_cmd_template,
 82		    TP_PROTO(struct hclge_comm_hw *hw,
 83			     struct hclge_desc *desc,
 84			     int index,
 85			     int num),
 86		    TP_ARGS(hw, desc, index, num),
 87
 88		    TP_STRUCT__entry(__field(u16, opcode)
 89			__field(u16, flag)
 90			__field(u16, retval)
 91			__field(u16, rsv)
 92			__field(int, index)
 93			__field(int, num)
 94			__string(pciname, pci_name(hw->cmq.csq.pdev))
 95			__array(u32, data, HCLGE_DESC_DATA_LEN)),
 96
 97		    TP_fast_assign(int i;
 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;
103			__entry->num = num;
104			__assign_str(pciname);
105			for (i = 0; i < HCLGE_DESC_DATA_LEN; i++)
106				__entry->data[i] = le32_to_cpu(desc->data[i]);),
107
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)))
114);
115
116DEFINE_EVENT(hclge_pf_cmd_template, hclge_pf_cmd_send,
117	     TP_PROTO(struct hclge_comm_hw *hw,
118		      struct hclge_desc *desc,
119		      int index,
120		      int num),
121	     TP_ARGS(hw, desc, index, num)
122);
123
124DEFINE_EVENT(hclge_pf_cmd_template, hclge_pf_cmd_get,
125	     TP_PROTO(struct hclge_comm_hw *hw,
126		      struct hclge_desc *desc,
127		      int index,
128		      int num),
129	     TP_ARGS(hw, desc, index, num)
130);
131
132DECLARE_EVENT_CLASS(hclge_pf_special_cmd_template,
133		    TP_PROTO(struct hclge_comm_hw *hw,
134			     __le32 *data,
135			     int index,
136			     int num),
137		    TP_ARGS(hw, data, index, num),
138
139		    TP_STRUCT__entry(__field(int, index)
140			__field(int, num)
141			__string(pciname, pci_name(hw->cmq.csq.pdev))
142			__array(u32, data, PF_DESC_LEN)),
143
144		    TP_fast_assign(int i;
145			__entry->index = index;
146			__entry->num = num;
147			__assign_str(pciname);
148			for (i = 0; i < PF_DESC_LEN; i++)
149				__entry->data[i] = le32_to_cpu(data[i]);
150		),
151
152		    TP_printk("%s %d-%d data:%s",
153			      __get_str(pciname),
154			      __entry->index, __entry->num,
155			      __print_array(__entry->data,
156					    PF_DESC_LEN, sizeof(u32)))
157);
158
159DEFINE_EVENT(hclge_pf_special_cmd_template, hclge_pf_special_cmd_send,
160	     TP_PROTO(struct hclge_comm_hw *hw,
161		      __le32 *desc,
162		      int index,
163		      int num),
164	     TP_ARGS(hw, desc, index, num));
165
166DEFINE_EVENT(hclge_pf_special_cmd_template, hclge_pf_special_cmd_get,
167	     TP_PROTO(struct hclge_comm_hw *hw,
168		      __le32 *desc,
169		      int index,
170		      int num),
171	     TP_ARGS(hw, desc, index, num)
172);
173
174#endif /* _HCLGE_TRACE_H_ */
175
176/* This must be outside ifdef _HCLGE_TRACE_H */
177#undef TRACE_INCLUDE_PATH
178#define TRACE_INCLUDE_PATH .
179#undef TRACE_INCLUDE_FILE
180#define TRACE_INCLUDE_FILE hclge_trace
181#include <trace/define_trace.h>
~/ Read-only file preview.