drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c
Extension
.c
Size
10355 bytes
Lines
350
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct hbg_diagnose_message {
	u32 opcode;
	u32 status;
	u32 data_num;
	struct hbg_priv *priv;

	u32 data[HBG_MSG_DATA_MAX_NUM];
};

#define HBG_HW_PUSH_WAIT_TIMEOUT_US	(2 * 1000 * 1000)
#define HBG_HW_PUSH_WAIT_INTERVAL_US	(1 * 1000)

enum hbg_push_cmd {
	HBG_PUSH_CMD_IRQ = 0,
	HBG_PUSH_CMD_STATS,
	HBG_PUSH_CMD_LINK,
};

struct hbg_push_stats_info {
	/* id is used to match the name of the current stats item.
	 * and is used for pretty print on BMC
	 */
	u32 id;
	u64 offset;
};

struct hbg_push_irq_info {
	/* id is used to match the name of the current irq.
	 * and is used for pretty print on BMC
	 */
	u32 id;
	u32 mask;
};

#define HBG_PUSH_IRQ_I(name, id) {id, HBG_INT_MSK_##name##_B}
static const struct hbg_push_irq_info hbg_push_irq_list[] = {
	HBG_PUSH_IRQ_I(RX, 0),
	HBG_PUSH_IRQ_I(TX, 1),
	HBG_PUSH_IRQ_I(TX_PKT_CPL, 2),
	HBG_PUSH_IRQ_I(MAC_MII_FIFO_ERR, 3),
	HBG_PUSH_IRQ_I(MAC_PCS_RX_FIFO_ERR, 4),
	HBG_PUSH_IRQ_I(MAC_PCS_TX_FIFO_ERR, 5),
	HBG_PUSH_IRQ_I(MAC_APP_RX_FIFO_ERR, 6),
	HBG_PUSH_IRQ_I(MAC_APP_TX_FIFO_ERR, 7),
	HBG_PUSH_IRQ_I(SRAM_PARITY_ERR, 8),
	HBG_PUSH_IRQ_I(TX_AHB_ERR, 9),
	HBG_PUSH_IRQ_I(RX_BUF_AVL, 10),
	HBG_PUSH_IRQ_I(REL_BUF_ERR, 11),
	HBG_PUSH_IRQ_I(TXCFG_AVL, 12),
	HBG_PUSH_IRQ_I(TX_DROP, 13),
	HBG_PUSH_IRQ_I(RX_DROP, 14),
	HBG_PUSH_IRQ_I(RX_AHB_ERR, 15),
	HBG_PUSH_IRQ_I(MAC_FIFO_ERR, 16),
	HBG_PUSH_IRQ_I(RBREQ_ERR, 17),
	HBG_PUSH_IRQ_I(WE_ERR, 18),
};

#define HBG_PUSH_STATS_I(name, id) {id, HBG_STATS_FIELD_OFF(name)}
static const struct hbg_push_stats_info hbg_push_stats_list[] = {
	HBG_PUSH_STATS_I(rx_desc_drop, 0),
	HBG_PUSH_STATS_I(rx_desc_l2_err_cnt, 1),
	HBG_PUSH_STATS_I(rx_desc_pkt_len_err_cnt, 2),
	HBG_PUSH_STATS_I(rx_desc_l3_wrong_head_cnt, 3),
	HBG_PUSH_STATS_I(rx_desc_l3_csum_err_cnt, 4),
	HBG_PUSH_STATS_I(rx_desc_l3_len_err_cnt, 5),
	HBG_PUSH_STATS_I(rx_desc_l3_zero_ttl_cnt, 6),
	HBG_PUSH_STATS_I(rx_desc_l3_other_cnt, 7),
	HBG_PUSH_STATS_I(rx_desc_l4_err_cnt, 8),
	HBG_PUSH_STATS_I(rx_desc_l4_wrong_head_cnt, 9),
	HBG_PUSH_STATS_I(rx_desc_l4_len_err_cnt, 10),
	HBG_PUSH_STATS_I(rx_desc_l4_csum_err_cnt, 11),
	HBG_PUSH_STATS_I(rx_desc_l4_zero_port_num_cnt, 12),
	HBG_PUSH_STATS_I(rx_desc_l4_other_cnt, 13),
	HBG_PUSH_STATS_I(rx_desc_frag_cnt, 14),
	HBG_PUSH_STATS_I(rx_desc_ip_ver_err_cnt, 15),
	HBG_PUSH_STATS_I(rx_desc_ipv4_pkt_cnt, 16),
	HBG_PUSH_STATS_I(rx_desc_ipv6_pkt_cnt, 17),
	HBG_PUSH_STATS_I(rx_desc_no_ip_pkt_cnt, 18),
	HBG_PUSH_STATS_I(rx_desc_ip_pkt_cnt, 19),
	HBG_PUSH_STATS_I(rx_desc_tcp_pkt_cnt, 20),
	HBG_PUSH_STATS_I(rx_desc_udp_pkt_cnt, 21),
	HBG_PUSH_STATS_I(rx_desc_vlan_pkt_cnt, 22),
	HBG_PUSH_STATS_I(rx_desc_icmp_pkt_cnt, 23),
	HBG_PUSH_STATS_I(rx_desc_arp_pkt_cnt, 24),
	HBG_PUSH_STATS_I(rx_desc_rarp_pkt_cnt, 25),
	HBG_PUSH_STATS_I(rx_desc_multicast_pkt_cnt, 26),
	HBG_PUSH_STATS_I(rx_desc_broadcast_pkt_cnt, 27),
	HBG_PUSH_STATS_I(rx_desc_ipsec_pkt_cnt, 28),
	HBG_PUSH_STATS_I(rx_desc_ip_opt_pkt_cnt, 29),
	HBG_PUSH_STATS_I(rx_desc_key_not_match_cnt, 30),

Annotation

Implementation Notes