Skip to content

Commit 188fa9b

Browse files
author
Paolo Abeni
committed
Merge branch 'support-some-enhances-features-for-the-hibmcge-driver'
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/[email protected]/ v2: https://lore.kernel.org/all/[email protected]/ v1: https://lore.kernel.org/all/[email protected]/ ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents d1352f7 + 615552c commit 188fa9b

File tree

16 files changed

+1304
-26
lines changed

16 files changed

+1304
-26
lines changed

drivers/net/ethernet/hisilicon/hibmcge/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
obj-$(CONFIG_HIBMCGE) += hibmcge.o
77

88
hibmcge-objs = hbg_main.o hbg_hw.o hbg_mdio.o hbg_irq.o hbg_txrx.o hbg_ethtool.o \
9-
hbg_debugfs.o hbg_err.o
9+
hbg_debugfs.o hbg_err.o hbg_diagnose.o

drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ enum hbg_nic_state {
3636
HBG_NIC_STATE_EVENT_HANDLING = 0,
3737
HBG_NIC_STATE_RESETTING,
3838
HBG_NIC_STATE_RESET_FAIL,
39+
HBG_NIC_STATE_NEED_RESET, /* trigger a reset in scheduled task */
40+
HBG_NIC_STATE_NP_LINK_FAIL,
3941
};
4042

4143
enum hbg_reset_type {
@@ -81,6 +83,7 @@ enum hbg_hw_event_type {
8183
HBG_HW_EVENT_NONE = 0,
8284
HBG_HW_EVENT_INIT, /* driver is loading */
8385
HBG_HW_EVENT_RESET,
86+
HBG_HW_EVENT_CORE_RESET,
8487
};
8588

8689
struct hbg_dev_specs {
@@ -104,6 +107,7 @@ struct hbg_irq_info {
104107
u32 mask;
105108
bool re_enable;
106109
bool need_print;
110+
bool need_reset;
107111
u64 count;
108112

109113
void (*irq_handle)(struct hbg_priv *priv, struct hbg_irq_info *info);
@@ -142,6 +146,118 @@ struct hbg_user_def {
142146
struct ethtool_pauseparam pause_param;
143147
};
144148

149+
struct hbg_stats {
150+
u64 rx_desc_drop;
151+
u64 rx_desc_l2_err_cnt;
152+
u64 rx_desc_pkt_len_err_cnt;
153+
u64 rx_desc_l3l4_err_cnt;
154+
u64 rx_desc_l3_wrong_head_cnt;
155+
u64 rx_desc_l3_csum_err_cnt;
156+
u64 rx_desc_l3_len_err_cnt;
157+
u64 rx_desc_l3_zero_ttl_cnt;
158+
u64 rx_desc_l3_other_cnt;
159+
u64 rx_desc_l4_err_cnt;
160+
u64 rx_desc_l4_wrong_head_cnt;
161+
u64 rx_desc_l4_len_err_cnt;
162+
u64 rx_desc_l4_csum_err_cnt;
163+
u64 rx_desc_l4_zero_port_num_cnt;
164+
u64 rx_desc_l4_other_cnt;
165+
u64 rx_desc_frag_cnt;
166+
u64 rx_desc_ip_ver_err_cnt;
167+
u64 rx_desc_ipv4_pkt_cnt;
168+
u64 rx_desc_ipv6_pkt_cnt;
169+
u64 rx_desc_no_ip_pkt_cnt;
170+
u64 rx_desc_ip_pkt_cnt;
171+
u64 rx_desc_tcp_pkt_cnt;
172+
u64 rx_desc_udp_pkt_cnt;
173+
u64 rx_desc_vlan_pkt_cnt;
174+
u64 rx_desc_icmp_pkt_cnt;
175+
u64 rx_desc_arp_pkt_cnt;
176+
u64 rx_desc_rarp_pkt_cnt;
177+
u64 rx_desc_multicast_pkt_cnt;
178+
u64 rx_desc_broadcast_pkt_cnt;
179+
u64 rx_desc_ipsec_pkt_cnt;
180+
u64 rx_desc_ip_opt_pkt_cnt;
181+
u64 rx_desc_key_not_match_cnt;
182+
183+
u64 rx_octets_total_ok_cnt;
184+
u64 rx_uc_pkt_cnt;
185+
u64 rx_mc_pkt_cnt;
186+
u64 rx_bc_pkt_cnt;
187+
u64 rx_vlan_pkt_cnt;
188+
u64 rx_octets_bad_cnt;
189+
u64 rx_octets_total_filt_cnt;
190+
u64 rx_filt_pkt_cnt;
191+
u64 rx_trans_pkt_cnt;
192+
u64 rx_framesize_64;
193+
u64 rx_framesize_65_127;
194+
u64 rx_framesize_128_255;
195+
u64 rx_framesize_256_511;
196+
u64 rx_framesize_512_1023;
197+
u64 rx_framesize_1024_1518;
198+
u64 rx_framesize_bt_1518;
199+
u64 rx_fcs_error_cnt;
200+
u64 rx_data_error_cnt;
201+
u64 rx_align_error_cnt;
202+
u64 rx_pause_macctl_frame_cnt;
203+
u64 rx_unknown_macctl_frame_cnt;
204+
/* crc ok, > max_frm_size, < 2max_frm_size */
205+
u64 rx_frame_long_err_cnt;
206+
/* crc fail, > max_frm_size, < 2max_frm_size */
207+
u64 rx_jabber_err_cnt;
208+
/* > 2max_frm_size */
209+
u64 rx_frame_very_long_err_cnt;
210+
/* < 64byte, >= short_runts_thr */
211+
u64 rx_frame_runt_err_cnt;
212+
/* < short_runts_thr */
213+
u64 rx_frame_short_err_cnt;
214+
/* PCU: dropped when the RX FIFO is full.*/
215+
u64 rx_overflow_cnt;
216+
/* GMAC: the count of overflows of the RX FIFO */
217+
u64 rx_overrun_cnt;
218+
/* PCU: the count of buffer alloc errors in RX */
219+
u64 rx_bufrq_err_cnt;
220+
/* PCU: the count of write descriptor errors in RX */
221+
u64 rx_we_err_cnt;
222+
/* GMAC: the count of pkts that contain PAD but length is not 64 */
223+
u64 rx_lengthfield_err_cnt;
224+
u64 rx_fail_comma_cnt;
225+
226+
u64 rx_dma_err_cnt;
227+
u64 rx_fifo_less_empty_thrsld_cnt;
228+
229+
u64 tx_octets_total_ok_cnt;
230+
u64 tx_uc_pkt_cnt;
231+
u64 tx_mc_pkt_cnt;
232+
u64 tx_bc_pkt_cnt;
233+
u64 tx_vlan_pkt_cnt;
234+
u64 tx_octets_bad_cnt;
235+
u64 tx_trans_pkt_cnt;
236+
u64 tx_pause_frame_cnt;
237+
u64 tx_framesize_64;
238+
u64 tx_framesize_65_127;
239+
u64 tx_framesize_128_255;
240+
u64 tx_framesize_256_511;
241+
u64 tx_framesize_512_1023;
242+
u64 tx_framesize_1024_1518;
243+
u64 tx_framesize_bt_1518;
244+
/* GMAC: the count of times that frames fail to be transmitted
245+
* due to internal errors.
246+
*/
247+
u64 tx_underrun_err_cnt;
248+
u64 tx_add_cs_fail_cnt;
249+
/* PCU: the count of buffer free errors in TX */
250+
u64 tx_bufrl_err_cnt;
251+
u64 tx_crc_err_cnt;
252+
u64 tx_drop_cnt;
253+
u64 tx_excessive_length_drop_cnt;
254+
255+
u64 tx_timeout_cnt;
256+
u64 tx_dma_err_cnt;
257+
258+
u64 np_link_fail_cnt;
259+
};
260+
145261
struct hbg_priv {
146262
struct net_device *netdev;
147263
struct pci_dev *pdev;
@@ -155,6 +271,12 @@ struct hbg_priv {
155271
struct hbg_mac_filter filter;
156272
enum hbg_reset_type reset_type;
157273
struct hbg_user_def user_def;
274+
struct hbg_stats stats;
275+
unsigned long last_update_stats_time;
276+
struct delayed_work service_task;
158277
};
159278

279+
void hbg_err_reset_task_schedule(struct hbg_priv *priv);
280+
void hbg_np_link_fail_task_schedule(struct hbg_priv *priv);
281+
160282
#endif

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ static int hbg_dbg_irq_info(struct seq_file *s, void *unused)
6767
for (i = 0; i < priv->vectors.info_array_len; i++) {
6868
info = &priv->vectors.info_array[i];
6969
seq_printf(s,
70-
"%-20s: enabled: %-5s, logged: %-5s, count: %llu\n",
70+
"%-20s: enabled: %-5s, reset: %-5s, logged: %-5s, count: %llu\n",
7171
info->name,
7272
str_true_false(hbg_hw_irq_is_enabled(priv,
7373
info->mask)),
74+
str_true_false(info->need_reset),
7475
str_true_false(info->need_print),
7576
info->count);
7677
}
@@ -114,6 +115,10 @@ static int hbg_dbg_nic_state(struct seq_file *s, void *unused)
114115
state_str_true_false(priv, HBG_NIC_STATE_RESET_FAIL));
115116
seq_printf(s, "last reset type: %s\n",
116117
reset_type_str[priv->reset_type]);
118+
seq_printf(s, "need reset state: %s\n",
119+
state_str_true_false(priv, HBG_NIC_STATE_NEED_RESET));
120+
seq_printf(s, "np_link fail state: %s\n",
121+
state_str_true_false(priv, HBG_NIC_STATE_NP_LINK_FAIL));
117122

118123
return 0;
119124
}

0 commit comments

Comments
 (0)