Provide ixgb_get_counter().
This commit is contained in:
parent
058a38660e
commit
fbc4ef4ca7
@ -97,6 +97,7 @@ static void ixgb_intr(void *);
|
||||
static void ixgb_start(struct ifnet *);
|
||||
static void ixgb_start_locked(struct ifnet *);
|
||||
static int ixgb_ioctl(struct ifnet *, IOCTL_CMD_TYPE, caddr_t);
|
||||
static uint64_t ixgb_get_counter(struct ifnet *, ift_counter);
|
||||
static void ixgb_watchdog(struct adapter *);
|
||||
static void ixgb_init(void *);
|
||||
static void ixgb_init_locked(struct adapter *);
|
||||
@ -643,7 +644,7 @@ ixgb_watchdog(struct adapter *adapter)
|
||||
ixgb_init_locked(adapter);
|
||||
|
||||
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1355,6 +1356,7 @@ ixgb_setup_interface(device_t dev, struct adapter * adapter)
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
ifp->if_ioctl = ixgb_ioctl;
|
||||
ifp->if_start = ixgb_start;
|
||||
ifp->if_get_counter = ixgb_get_counter;
|
||||
ifp->if_snd.ifq_maxlen = adapter->num_tx_desc - 1;
|
||||
|
||||
#if __FreeBSD_version < 500000
|
||||
@ -2326,7 +2328,6 @@ ixgb_write_pci_cfg(struct ixgb_hw * hw,
|
||||
static void
|
||||
ixgb_update_stats_counters(struct adapter * adapter)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
|
||||
adapter->stats.crcerrs += IXGB_READ_REG(&adapter->hw, CRCERRS);
|
||||
adapter->stats.gprcl += IXGB_READ_REG(&adapter->hw, GPRCL);
|
||||
@ -2389,28 +2390,36 @@ ixgb_update_stats_counters(struct adapter * adapter)
|
||||
adapter->stats.pfrc += IXGB_READ_REG(&adapter->hw, PFRC);
|
||||
adapter->stats.pftc += IXGB_READ_REG(&adapter->hw, PFTC);
|
||||
adapter->stats.mcfrc += IXGB_READ_REG(&adapter->hw, MCFRC);
|
||||
|
||||
ifp = adapter->ifp;
|
||||
|
||||
/* Fill out the OS statistics structure */
|
||||
ifp->if_ipackets = adapter->stats.gprcl;
|
||||
ifp->if_opackets = adapter->stats.gptcl;
|
||||
ifp->if_ibytes = adapter->stats.gorcl;
|
||||
ifp->if_obytes = adapter->stats.gotcl;
|
||||
ifp->if_imcasts = adapter->stats.mprcl;
|
||||
ifp->if_collisions = 0;
|
||||
|
||||
/* Rx Errors */
|
||||
ifp->if_ierrors =
|
||||
adapter->dropped_pkts +
|
||||
adapter->stats.crcerrs +
|
||||
adapter->stats.rnbc +
|
||||
adapter->stats.mpc +
|
||||
adapter->stats.rlec;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
ixgb_get_counter(struct ifnet *ifp, ift_counter cnt)
|
||||
{
|
||||
struct adapter *adapter;
|
||||
|
||||
adapter = if_getsoftc(ifp);
|
||||
|
||||
switch (cnt) {
|
||||
case IFCOUNTER_IPACKETS:
|
||||
return (adapter->stats.gprcl);
|
||||
case IFCOUNTER_OPACKETS:
|
||||
return ( adapter->stats.gptcl);
|
||||
case IFCOUNTER_IBYTES:
|
||||
return (adapter->stats.gorcl);
|
||||
case IFCOUNTER_OBYTES:
|
||||
return (adapter->stats.gotcl);
|
||||
case IFCOUNTER_IMCASTS:
|
||||
return ( adapter->stats.mprcl);
|
||||
case IFCOUNTER_COLLISIONS:
|
||||
return (0);
|
||||
case IFCOUNTER_IERRORS:
|
||||
return (adapter->dropped_pkts + adapter->stats.crcerrs +
|
||||
adapter->stats.rnbc + adapter->stats.mpc +
|
||||
adapter->stats.rlec);
|
||||
default:
|
||||
return (if_get_counter_default(ifp, cnt));
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user