| 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* Copyright (c) 2018-2019 Hisilicon Limited. */ |
| 3 | |
| 4 | /* This must be outside ifdef _HCLGEVF_TRACE_H */ |
| 5 | #undef TRACE_SYSTEM |
| 6 | #define TRACE_SYSTEM hns3 |
| 7 | |
| 8 | #if !defined(_HCLGEVF_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) |
| 9 | #define _HCLGEVF_TRACE_H_ |
| 10 | |
| 11 | #include <linux/tracepoint.h> |
| 12 | |
| 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)) |
| 15 | |
| 16 | TRACE_EVENT(hclge_vf_mbx_get, |
| 17 | TP_PROTO( |
| 18 | struct hclgevf_dev *hdev, |
| 19 | struct hclge_mbx_pf_to_vf_cmd *req), |
| 20 | TP_ARGS(hdev, req), |
| 21 | |
| 22 | TP_STRUCT__entry( |
| 23 | __field(u8, vfid) |
| 24 | __field(u16, code) |
| 25 | __string(pciname, pci_name(hdev->pdev)) |
| 26 | __string(devname, hdev->nic.kinfo.netdev->name) |
| 27 | __array(u32, mbx_data, VF_GET_MBX_LEN) |
| 28 | ), |
| 29 | |
| 30 | TP_fast_assign( |
| 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)); |
| 37 | ), |
| 38 | |
| 39 | TP_printk( |
| 40 | "%s %s vfid:%u code:%u data:%s", |
| 41 | __get_str(pciname), __get_str(devname), __entry->vfid, |
| 42 | __entry->code, |
| 43 | __print_array(__entry->mbx_data, VF_GET_MBX_LEN, sizeof(u32)) |
| 44 | ) |
| 45 | ); |
| 46 | |
| 47 | TRACE_EVENT(hclge_vf_mbx_send, |
| 48 | TP_PROTO( |
| 49 | struct hclgevf_dev *hdev, |
| 50 | struct hclge_mbx_vf_to_pf_cmd *req), |
| 51 | TP_ARGS(hdev, req), |
| 52 | |
| 53 | TP_STRUCT__entry( |
| 54 | __field(u8, vfid) |
| 55 | __field(u8, code) |
| 56 | __field(u8, subcode) |
| 57 | __string(pciname, pci_name(hdev->pdev)) |
| 58 | __string(devname, hdev->nic.kinfo.netdev->name) |
| 59 | __array(u32, mbx_data, VF_SEND_MBX_LEN) |
| 60 | ), |
| 61 | |
| 62 | TP_fast_assign( |
| 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)); |
| 70 | ), |
| 71 | |
| 72 | TP_printk( |
| 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)) |
| 77 | ) |
| 78 | ); |
| 79 | |
| 80 | DECLARE_EVENT_CLASS(hclge_vf_cmd_template, |
| 81 | TP_PROTO(struct hclge_comm_hw *hw, |
| 82 | struct hclge_desc *desc, |
| 83 | int index, |
| 84 | int num), |
| 85 | |
| 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 | |
| 116 | DEFINE_EVENT(hclge_vf_cmd_template, hclge_vf_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 | DEFINE_EVENT(hclge_vf_cmd_template, hclge_vf_cmd_get, |
| 124 | TP_PROTO(struct hclge_comm_hw *hw, |
| 125 | struct hclge_desc *desc, |
| 126 | int index, |
| 127 | int num), |
| 128 | TP_ARGS(hw, desc, index, num)); |
| 129 | |
| 130 | #endif /* _HCLGEVF_TRACE_H_ */ |
| 131 | |
| 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> |