Count Bad SFD (Start Frame Delimiter). X550 and newer have this register.

This commit is contained in:
msaitoh 2017-05-26 08:36:41 +00:00
parent cafb33e1cd
commit eccb5e67a7
3 changed files with 15 additions and 3 deletions

View File

@ -59,7 +59,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/
/*$NetBSD: ixgbe.c,v 1.85 2017/05/26 07:42:15 msaitoh Exp $*/
/*$NetBSD: ixgbe.c,v 1.86 2017/05/26 08:36:41 msaitoh Exp $*/
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -896,6 +896,8 @@ ixgbe_detach(device_t dev, int flags)
evcnt_detach(&stats->illerrc);
evcnt_detach(&stats->errbc);
evcnt_detach(&stats->mspdc);
if (hw->mac.type >= ixgbe_mac_X550)
evcnt_detach(&stats->mbsdc);
evcnt_detach(&stats->mpctotal);
evcnt_detach(&stats->mlfc);
evcnt_detach(&stats->mrfc);
@ -4363,6 +4365,8 @@ ixgbe_update_stats_counters(struct adapter *adapter)
stats->illerrc.ev_count += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
stats->errbc.ev_count += IXGBE_READ_REG(hw, IXGBE_ERRBC);
stats->mspdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MSPDC);
if (hw->mac.type == ixgbe_mac_X550)
stats->mbsdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MBSDC);
for (int i = 0; i < __arraycount(stats->qprc); i++) {
int j = i % adapter->num_queues;
@ -4998,6 +5002,9 @@ ixgbe_add_hw_stats(struct adapter *adapter)
stats->namebuf, "Byte Errors");
evcnt_attach_dynamic(&stats->mspdc, EVCNT_TYPE_MISC, NULL,
stats->namebuf, "MAC Short Packets Discarded");
if (hw->mac.type >= ixgbe_mac_X550)
evcnt_attach_dynamic(&stats->mbsdc, EVCNT_TYPE_MISC, NULL,
stats->namebuf, "Bad SFD");
evcnt_attach_dynamic(&stats->mpctotal, EVCNT_TYPE_MISC, NULL,
stats->namebuf, "Total Packets Missed");
evcnt_attach_dynamic(&stats->mlfc, EVCNT_TYPE_MISC, NULL,
@ -5149,6 +5156,7 @@ ixgbe_clear_evcnt(struct adapter *adapter)
stats->illerrc.ev_count = 0;
stats->errbc.ev_count = 0;
stats->mspdc.ev_count = 0;
stats->mbsdc.ev_count = 0;
stats->mpctotal.ev_count = 0;
stats->mlfc.ev_count = 0;
stats->mrfc.ev_count = 0;

View File

@ -31,7 +31,7 @@
******************************************************************************/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.c 299200 2016-05-06 22:54:56Z pfg $*/
/*$NetBSD: ixgbe_common.c,v 1.12 2017/01/19 06:56:33 msaitoh Exp $*/
/*$NetBSD: ixgbe_common.c,v 1.13 2017/05/26 08:36:42 msaitoh Exp $*/
#include "ixgbe_common.h"
#include "ixgbe_phy.h"
@ -493,6 +493,8 @@ s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw)
IXGBE_READ_REG(hw, IXGBE_ILLERRC);
IXGBE_READ_REG(hw, IXGBE_ERRBC);
IXGBE_READ_REG(hw, IXGBE_MSPDC);
if (hw->mac.type >= ixgbe_mac_X550)
IXGBE_READ_REG(hw, IXGBE_MBSDC);
for (i = 0; i < 8; i++)
IXGBE_READ_REG(hw, IXGBE_MPC(i));

View File

@ -31,7 +31,7 @@
******************************************************************************/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_type.h 299200 2016-05-06 22:54:56Z pfg $*/
/*$NetBSD: ixgbe_type.h,v 1.20 2017/05/18 08:27:19 msaitoh Exp $*/
/*$NetBSD: ixgbe_type.h,v 1.21 2017/05/26 08:36:42 msaitoh Exp $*/
#ifndef _IXGBE_TYPE_H_
#define _IXGBE_TYPE_H_
@ -896,6 +896,7 @@ struct ixgbe_dmac_config {
#define IXGBE_ILLERRC 0x04004
#define IXGBE_ERRBC 0x04008
#define IXGBE_MSPDC 0x04010
#define IXGBE_MBSDC 0x04018 /* Bad SFD Count */
#define IXGBE_MPC(_i) (0x03FA0 + ((_i) * 4)) /* 8 of these 3FA0-3FBC*/
#define IXGBE_MLFC 0x04034
#define IXGBE_MRFC 0x04038
@ -3568,6 +3569,7 @@ struct ixgbe_hw_stats {
struct evcnt illerrc;
struct evcnt errbc;
struct evcnt mspdc;
struct evcnt mbsdc;
struct evcnt mpctotal;
struct evcnt mpc[8];
struct evcnt mlfc;