Commit ce69978a authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-hibmcge-add-support-for-tracepoint-and-pagepool-on-hibmcge-driver'

Jijie Shao says:

====================
net: hibmcge: Add support for tracepoint and pagepool on hibmcge driver

In this patch set:
1: add support for tracepoint for rx descriptor
2: double the rx queue depth to reduce packet drop
3: add support for pagepool on rx
====================

Link: https://patch.msgid.link/20251122034657.3373143-1-shaojijie@huawei.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 37a96c20 c3059591
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ config HIBMCGE
	select FIXED_PHY
	select MOTORCOMM_PHY
	select REALTEK_PHY
	select PAGE_POOL
	help
	  If you wish to compile a kernel for a BMC with HIBMC-xx_gmac
	  then you should answer Y to this. This makes this driver suitable for use
+1 −0
Original line number Diff line number Diff line
@@ -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 \
+8 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#include <linux/ethtool.h>
#include <linux/netdevice.h>
#include <linux/pci.h>
#include <net/page_pool/helpers.h>
#include "hbg_reg.h"

#define HBG_STATUS_DISABLE		0x0
@@ -55,6 +56,12 @@ struct hbg_buffer {
	dma_addr_t skb_dma;
	u32 skb_len;

	struct page *page;
	void *page_addr;
	dma_addr_t page_dma;
	u32 page_size;
	u32 page_offset;

	enum hbg_dir dir;
	struct hbg_ring *ring;
	struct hbg_priv *priv;
@@ -78,6 +85,7 @@ struct hbg_ring {
	struct hbg_priv *priv;
	struct napi_struct napi;
	char *tout_log_buf; /* tx timeout log buffer */
	struct page_pool *page_pool; /* only for rx */
};

enum hbg_hw_event_type {
+4 −0
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
/* 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>
Loading