@@ -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
4143enum 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
8689struct 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+
145261struct 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
0 commit comments