mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
net: hibmcge: add support for tracepoint to dump some fields of rx_desc
add support for tracepoint to dump some fields of rx_desc Signed-off-by: Tao Lan <lantao5@huawei.com> Signed-off-by: Jijie Shao <shaojijie@huawei.com> Link: https://patch.msgid.link/20251122034657.3373143-2-shaojijie@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
# Makefile for the HISILICON BMC GE network device drivers.
|
||||
#
|
||||
|
||||
ccflags-y += -I$(src)
|
||||
obj-$(CONFIG_HIBMCGE) += hibmcge.o
|
||||
|
||||
hibmcge-objs = hbg_main.o hbg_hw.o hbg_mdio.o hbg_irq.o hbg_txrx.o hbg_ethtool.o \
|
||||
|
||||
@@ -252,6 +252,8 @@ struct hbg_rx_desc {
|
||||
|
||||
#define HBG_RX_DESC_W2_PKT_LEN_M GENMASK(31, 16)
|
||||
#define HBG_RX_DESC_W2_PORT_NUM_M GENMASK(15, 12)
|
||||
#define HBG_RX_DESC_W3_IP_OFFSET_M GENMASK(23, 16)
|
||||
#define HBG_RX_DESC_W3_VLAN_M GENMASK(15, 0)
|
||||
#define HBG_RX_DESC_W4_IP_TCP_UDP_M GENMASK(31, 30)
|
||||
#define HBG_RX_DESC_W4_IPSEC_B BIT(29)
|
||||
#define HBG_RX_DESC_W4_IP_VERSION_B BIT(28)
|
||||
@@ -269,6 +271,8 @@ struct hbg_rx_desc {
|
||||
#define HBG_RX_DESC_W4_L3_ERR_CODE_M GENMASK(12, 9)
|
||||
#define HBG_RX_DESC_W4_L2_ERR_B BIT(8)
|
||||
#define HBG_RX_DESC_W4_IDX_MATCH_B BIT(7)
|
||||
#define HBG_RX_DESC_W4_PARSE_MODE_M GENMASK(6, 5)
|
||||
#define HBG_RX_DESC_W5_VALID_SIZE_M GENMASK(15, 0)
|
||||
|
||||
enum hbg_l3_err_code {
|
||||
HBG_L3_OK = 0,
|
||||
|
||||
84
drivers/net/ethernet/hisilicon/hibmcge/hbg_trace.h
Normal file
84
drivers/net/ethernet/hisilicon/hibmcge/hbg_trace.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/* Copyright (c) 2025 Hisilicon Limited. */
|
||||
|
||||
/* This must be outside ifdef _HBG_TRACE_H */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM hibmcge
|
||||
|
||||
#if !defined(_HBG_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _HBG_TRACE_H_
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/tracepoint.h>
|
||||
#include <linux/types.h>
|
||||
#include "hbg_reg.h"
|
||||
|
||||
TRACE_EVENT(hbg_rx_desc,
|
||||
TP_PROTO(struct hbg_priv *priv, u32 index,
|
||||
struct hbg_rx_desc *rx_desc),
|
||||
TP_ARGS(priv, index, rx_desc),
|
||||
|
||||
TP_STRUCT__entry(__field(u32, index)
|
||||
__field(u8, port_num)
|
||||
__field(u8, ip_offset)
|
||||
__field(u8, parse_mode)
|
||||
__field(u8, l4_error_code)
|
||||
__field(u8, l3_error_code)
|
||||
__field(u8, l2_error_code)
|
||||
__field(u16, packet_len)
|
||||
__field(u16, valid_size)
|
||||
__field(u16, vlan)
|
||||
__string(pciname, pci_name(priv->pdev))
|
||||
__string(devname, priv->netdev->name)
|
||||
),
|
||||
|
||||
TP_fast_assign(__entry->index = index,
|
||||
__entry->packet_len =
|
||||
FIELD_GET(HBG_RX_DESC_W2_PKT_LEN_M,
|
||||
rx_desc->word2);
|
||||
__entry->port_num =
|
||||
FIELD_GET(HBG_RX_DESC_W2_PORT_NUM_M,
|
||||
rx_desc->word2);
|
||||
__entry->ip_offset =
|
||||
FIELD_GET(HBG_RX_DESC_W3_IP_OFFSET_M,
|
||||
rx_desc->word3);
|
||||
__entry->vlan =
|
||||
FIELD_GET(HBG_RX_DESC_W3_VLAN_M,
|
||||
rx_desc->word3);
|
||||
__entry->parse_mode =
|
||||
FIELD_GET(HBG_RX_DESC_W4_PARSE_MODE_M,
|
||||
rx_desc->word4);
|
||||
__entry->l4_error_code =
|
||||
FIELD_GET(HBG_RX_DESC_W4_L4_ERR_CODE_M,
|
||||
rx_desc->word4);
|
||||
__entry->l3_error_code =
|
||||
FIELD_GET(HBG_RX_DESC_W4_L3_ERR_CODE_M,
|
||||
rx_desc->word4);
|
||||
__entry->l2_error_code =
|
||||
FIELD_GET(HBG_RX_DESC_W4_L2_ERR_B,
|
||||
rx_desc->word4);
|
||||
__entry->valid_size =
|
||||
FIELD_GET(HBG_RX_DESC_W5_VALID_SIZE_M,
|
||||
rx_desc->word5);
|
||||
__assign_str(pciname);
|
||||
__assign_str(devname);
|
||||
),
|
||||
|
||||
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",
|
||||
__get_str(pciname), __get_str(devname), __entry->index,
|
||||
__entry->port_num, __entry->packet_len,
|
||||
__entry->valid_size, __entry->ip_offset, __entry->vlan,
|
||||
__entry->parse_mode, __entry->l4_error_code,
|
||||
__entry->l3_error_code, __entry->l2_error_code
|
||||
)
|
||||
);
|
||||
|
||||
#endif /* _HBG_TRACE_H_ */
|
||||
|
||||
/* This must be outside ifdef _HBG_TRACE_H */
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH .
|
||||
#undef TRACE_INCLUDE_FILE
|
||||
#define TRACE_INCLUDE_FILE hbg_trace
|
||||
#include <trace/define_trace.h>
|
||||
@@ -7,6 +7,9 @@
|
||||
#include "hbg_reg.h"
|
||||
#include "hbg_txrx.h"
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "hbg_trace.h"
|
||||
|
||||
#define netdev_get_tx_ring(netdev) \
|
||||
(&(((struct hbg_priv *)netdev_priv(netdev))->tx_ring))
|
||||
|
||||
@@ -429,6 +432,7 @@ static int hbg_napi_rx_poll(struct napi_struct *napi, int budget)
|
||||
break;
|
||||
rx_desc = (struct hbg_rx_desc *)buffer->skb->data;
|
||||
pkt_len = FIELD_GET(HBG_RX_DESC_W2_PKT_LEN_M, rx_desc->word2);
|
||||
trace_hbg_rx_desc(priv, ring->ntc, rx_desc);
|
||||
|
||||
if (unlikely(!hbg_rx_pkt_check(priv, rx_desc, buffer->skb))) {
|
||||
hbg_buffer_free(buffer);
|
||||
|
||||
Reference in New Issue
Block a user