Skip to content

Commit

Permalink
Merge branch 'support-some-enhances-features-for-the-hibmcge-driver'
Browse files Browse the repository at this point in the history
Jijie Shao says:

====================
Support some enhances features for the HIBMCGE driver

In this patch set, we mainly implement some enhanced features.
It mainly includes the statistics, diagnosis, and ioctl to
improve fault locating efficiency,
abnormal irq and MAC link exception handling feature
to enhance driver robustness,
and rx checksum offload feature to improve performance
(tx checksum feature has been implemented).

v3: https://lore.kernel.org/all/20250221115526.1082660-2-shaojijie@huawei.com/
v2: https://lore.kernel.org/all/20250218085829.3172126-1-shaojijie@huawei.com/
v1: https://lore.kernel.org/all/20250213035529.2402283-1-shaojijie@huawei.com/
====================

Link: https://patch.msgid.link/20250228115411.1750803-1-shaojijie@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Paolo Abeni committed Mar 4, 2025
2 parents d1352f7 + 615552c commit 188fa9b
Show file tree
Hide file tree
Showing 16 changed files with 1,304 additions and 26 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hibmcge/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
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 \
hbg_debugfs.o hbg_err.o
hbg_debugfs.o hbg_err.o hbg_diagnose.o
122 changes: 122 additions & 0 deletions drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ enum hbg_nic_state {
HBG_NIC_STATE_EVENT_HANDLING = 0,
HBG_NIC_STATE_RESETTING,
HBG_NIC_STATE_RESET_FAIL,
HBG_NIC_STATE_NEED_RESET, /* trigger a reset in scheduled task */
HBG_NIC_STATE_NP_LINK_FAIL,
};

enum hbg_reset_type {
Expand Down Expand Up @@ -81,6 +83,7 @@ enum hbg_hw_event_type {
HBG_HW_EVENT_NONE = 0,
HBG_HW_EVENT_INIT, /* driver is loading */
HBG_HW_EVENT_RESET,
HBG_HW_EVENT_CORE_RESET,
};

struct hbg_dev_specs {
Expand All @@ -104,6 +107,7 @@ struct hbg_irq_info {
u32 mask;
bool re_enable;
bool need_print;
bool need_reset;
u64 count;

void (*irq_handle)(struct hbg_priv *priv, struct hbg_irq_info *info);
Expand Down Expand Up @@ -142,6 +146,118 @@ struct hbg_user_def {
struct ethtool_pauseparam pause_param;
};

struct hbg_stats {
u64 rx_desc_drop;
u64 rx_desc_l2_err_cnt;
u64 rx_desc_pkt_len_err_cnt;
u64 rx_desc_l3l4_err_cnt;
u64 rx_desc_l3_wrong_head_cnt;
u64 rx_desc_l3_csum_err_cnt;
u64 rx_desc_l3_len_err_cnt;
u64 rx_desc_l3_zero_ttl_cnt;
u64 rx_desc_l3_other_cnt;
u64 rx_desc_l4_err_cnt;
u64 rx_desc_l4_wrong_head_cnt;
u64 rx_desc_l4_len_err_cnt;
u64 rx_desc_l4_csum_err_cnt;
u64 rx_desc_l4_zero_port_num_cnt;
u64 rx_desc_l4_other_cnt;
u64 rx_desc_frag_cnt;
u64 rx_desc_ip_ver_err_cnt;
u64 rx_desc_ipv4_pkt_cnt;
u64 rx_desc_ipv6_pkt_cnt;
u64 rx_desc_no_ip_pkt_cnt;
u64 rx_desc_ip_pkt_cnt;
u64 rx_desc_tcp_pkt_cnt;
u64 rx_desc_udp_pkt_cnt;
u64 rx_desc_vlan_pkt_cnt;
u64 rx_desc_icmp_pkt_cnt;
u64 rx_desc_arp_pkt_cnt;
u64 rx_desc_rarp_pkt_cnt;
u64 rx_desc_multicast_pkt_cnt;
u64 rx_desc_broadcast_pkt_cnt;
u64 rx_desc_ipsec_pkt_cnt;
u64 rx_desc_ip_opt_pkt_cnt;
u64 rx_desc_key_not_match_cnt;

u64 rx_octets_total_ok_cnt;
u64 rx_uc_pkt_cnt;
u64 rx_mc_pkt_cnt;
u64 rx_bc_pkt_cnt;
u64 rx_vlan_pkt_cnt;
u64 rx_octets_bad_cnt;
u64 rx_octets_total_filt_cnt;
u64 rx_filt_pkt_cnt;
u64 rx_trans_pkt_cnt;
u64 rx_framesize_64;
u64 rx_framesize_65_127;
u64 rx_framesize_128_255;
u64 rx_framesize_256_511;
u64 rx_framesize_512_1023;
u64 rx_framesize_1024_1518;
u64 rx_framesize_bt_1518;
u64 rx_fcs_error_cnt;
u64 rx_data_error_cnt;
u64 rx_align_error_cnt;
u64 rx_pause_macctl_frame_cnt;
u64 rx_unknown_macctl_frame_cnt;
/* crc ok, > max_frm_size, < 2max_frm_size */
u64 rx_frame_long_err_cnt;
/* crc fail, > max_frm_size, < 2max_frm_size */
u64 rx_jabber_err_cnt;
/* > 2max_frm_size */
u64 rx_frame_very_long_err_cnt;
/* < 64byte, >= short_runts_thr */
u64 rx_frame_runt_err_cnt;
/* < short_runts_thr */
u64 rx_frame_short_err_cnt;
/* PCU: dropped when the RX FIFO is full.*/
u64 rx_overflow_cnt;
/* GMAC: the count of overflows of the RX FIFO */
u64 rx_overrun_cnt;
/* PCU: the count of buffer alloc errors in RX */
u64 rx_bufrq_err_cnt;
/* PCU: the count of write descriptor errors in RX */
u64 rx_we_err_cnt;
/* GMAC: the count of pkts that contain PAD but length is not 64 */
u64 rx_lengthfield_err_cnt;
u64 rx_fail_comma_cnt;

u64 rx_dma_err_cnt;
u64 rx_fifo_less_empty_thrsld_cnt;

u64 tx_octets_total_ok_cnt;
u64 tx_uc_pkt_cnt;
u64 tx_mc_pkt_cnt;
u64 tx_bc_pkt_cnt;
u64 tx_vlan_pkt_cnt;
u64 tx_octets_bad_cnt;
u64 tx_trans_pkt_cnt;
u64 tx_pause_frame_cnt;
u64 tx_framesize_64;
u64 tx_framesize_65_127;
u64 tx_framesize_128_255;
u64 tx_framesize_256_511;
u64 tx_framesize_512_1023;
u64 tx_framesize_1024_1518;
u64 tx_framesize_bt_1518;
/* GMAC: the count of times that frames fail to be transmitted
* due to internal errors.
*/
u64 tx_underrun_err_cnt;
u64 tx_add_cs_fail_cnt;
/* PCU: the count of buffer free errors in TX */
u64 tx_bufrl_err_cnt;
u64 tx_crc_err_cnt;
u64 tx_drop_cnt;
u64 tx_excessive_length_drop_cnt;

u64 tx_timeout_cnt;
u64 tx_dma_err_cnt;

u64 np_link_fail_cnt;
};

struct hbg_priv {
struct net_device *netdev;
struct pci_dev *pdev;
Expand All @@ -155,6 +271,12 @@ struct hbg_priv {
struct hbg_mac_filter filter;
enum hbg_reset_type reset_type;
struct hbg_user_def user_def;
struct hbg_stats stats;
unsigned long last_update_stats_time;
struct delayed_work service_task;
};

void hbg_err_reset_task_schedule(struct hbg_priv *priv);
void hbg_np_link_fail_task_schedule(struct hbg_priv *priv);

#endif
7 changes: 6 additions & 1 deletion drivers/net/ethernet/hisilicon/hibmcge/hbg_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ static int hbg_dbg_irq_info(struct seq_file *s, void *unused)
for (i = 0; i < priv->vectors.info_array_len; i++) {
info = &priv->vectors.info_array[i];
seq_printf(s,
"%-20s: enabled: %-5s, logged: %-5s, count: %llu\n",
"%-20s: enabled: %-5s, reset: %-5s, logged: %-5s, count: %llu\n",
info->name,
str_true_false(hbg_hw_irq_is_enabled(priv,
info->mask)),
str_true_false(info->need_reset),
str_true_false(info->need_print),
info->count);
}
Expand Down Expand Up @@ -114,6 +115,10 @@ static int hbg_dbg_nic_state(struct seq_file *s, void *unused)
state_str_true_false(priv, HBG_NIC_STATE_RESET_FAIL));
seq_printf(s, "last reset type: %s\n",
reset_type_str[priv->reset_type]);
seq_printf(s, "need reset state: %s\n",
state_str_true_false(priv, HBG_NIC_STATE_NEED_RESET));
seq_printf(s, "np_link fail state: %s\n",
state_str_true_false(priv, HBG_NIC_STATE_NP_LINK_FAIL));

return 0;
}
Expand Down
Loading

0 comments on commit 188fa9b

Please sign in to comment.