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