| 1 |
/* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 |
/* Copyright (c) 2025 Hisilicon Limited. */ |
| 3 |
|
| 4 |
/* This must be outside ifdef _HBG_TRACE_H */ |
| 5 |
#undef TRACE_SYSTEM |
| 6 |
#define TRACE_SYSTEM hibmcge |
| 7 |
|
| 8 |
#if !defined(_HBG_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) |
| 9 |
#define _HBG_TRACE_H_ |
| 10 |
|
| 11 |
#include <linux/bitfield.h> |
| 12 |
#include <linux/pci.h> |
| 13 |
#include <linux/tracepoint.h> |
| 14 |
#include <linux/types.h> |
| 15 |
#include "hbg_reg.h" |
| 16 |
|
| 17 |
TRACE_EVENT(hbg_rx_desc, |
| 18 |
TP_PROTO(struct hbg_priv *priv, u32 index, |
| 19 |
struct hbg_rx_desc *rx_desc), |
| 20 |
TP_ARGS(priv, index, rx_desc), |
| 21 |
|
| 22 |
TP_STRUCT__entry(__field(u32, index) |
| 23 |
__field(u8, port_num) |
| 24 |
__field(u8, ip_offset) |
| 25 |
__field(u8, parse_mode) |
| 26 |
__field(u8, l4_error_code) |
| 27 |
__field(u8, l3_error_code) |
| 28 |
__field(u8, l2_error_code) |
| 29 |
__field(u16, packet_len) |
| 30 |
__field(u16, valid_size) |
| 31 |
__field(u16, vlan) |
| 32 |
__string(pciname, pci_name(priv->pdev)) |
| 33 |
__string(devname, priv->netdev->name) |
| 34 |
), |
| 35 |
|
| 36 |
TP_fast_assign(__entry->index = index, |
| 37 |
__entry->packet_len = |
| 38 |
FIELD_GET(HBG_RX_DESC_W2_PKT_LEN_M, |
| 39 |
rx_desc->word2); |
| 40 |
__entry->port_num = |
| 41 |
FIELD_GET(HBG_RX_DESC_W2_PORT_NUM_M, |
| 42 |
rx_desc->word2); |
| 43 |
__entry->ip_offset = |
| 44 |
FIELD_GET(HBG_RX_DESC_W3_IP_OFFSET_M, |
| 45 |
rx_desc->word3); |
| 46 |
__entry->vlan = |
| 47 |
FIELD_GET(HBG_RX_DESC_W3_VLAN_M, |
| 48 |
rx_desc->word3); |
| 49 |
__entry->parse_mode = |
| 50 |
FIELD_GET(HBG_RX_DESC_W4_PARSE_MODE_M, |
| 51 |
rx_desc->word4); |
| 52 |
__entry->l4_error_code = |
| 53 |
FIELD_GET(HBG_RX_DESC_W4_L4_ERR_CODE_M, |
| 54 |
rx_desc->word4); |
| 55 |
__entry->l3_error_code = |
| 56 |
FIELD_GET(HBG_RX_DESC_W4_L3_ERR_CODE_M, |
| 57 |
rx_desc->word4); |
| 58 |
__entry->l2_error_code = |
| 59 |
FIELD_GET(HBG_RX_DESC_W4_L2_ERR_B, |
| 60 |
rx_desc->word4); |
| 61 |
__entry->valid_size = |
| 62 |
FIELD_GET(HBG_RX_DESC_W5_VALID_SIZE_M, |
| 63 |
rx_desc->word5); |
| 64 |
__assign_str(pciname); |
| 65 |
__assign_str(devname); |
| 66 |
), |
| 67 |
|
| 68 |
TP_printk("%s %s index:%u, port num:%u, len:%u, valid size:%u, ip_offset:%u, vlan:0x%04x, parse mode:%u, l4_err:0x%x, l3_err:0x%x, l2_err:0x%x", |
| 69 |
__get_str(pciname), __get_str(devname), __entry->index, |
| 70 |
__entry->port_num, __entry->packet_len, |
| 71 |
__entry->valid_size, __entry->ip_offset, __entry->vlan, |
| 72 |
__entry->parse_mode, __entry->l4_error_code, |
| 73 |
__entry->l3_error_code, __entry->l2_error_code |
| 74 |
) |
| 75 |
); |
| 76 |
|
| 77 |
#endif /* _HBG_TRACE_H_ */ |
| 78 |
|
| 79 |
/* This must be outside ifdef _HBG_TRACE_H */ |
| 80 |
#undef TRACE_INCLUDE_PATH |
| 81 |
#define TRACE_INCLUDE_PATH . |
| 82 |
#undef TRACE_INCLUDE_FILE |
| 83 |
#define TRACE_INCLUDE_FILE hbg_trace |
| 84 |
#include <trace/define_trace.h> |