mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Various fixes to the stats in igb(4), ixgbe(4), and ixl(4).
- Use hardware counters for ifnet stats in igb(4) when possible. This ensures these stats include packets that bypass the regular stack via netmap. - Don't derefence values off the end of the igb(4) VF stats structure. Instead, add a dedicated if_get_counter method for igb(4) VF interfaces. - Report missed packets on igb(4) as input queue drops rather than an input error. - Report bug_ring drop counts as output queue drops for igb(4) and ixgbe(4). - Export the buf_ring drop stats for individual rings via sysctl on ixgbe(4). - Fix a typo that in ixl(4) that caused output queue drops to be reported as input queue drops and input queue drops to be unreported. Differential Revision: https://reviews.freebsd.org/D2402 Reviewed by: jfv, rstone (6) Sponsored by: Norse Corp, Inc.
This commit is contained in:
parent
59023e6ce2
commit
625d12c609
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282280
@ -1046,8 +1046,7 @@ igb_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr)
|
||||
}
|
||||
drbr_advance(ifp, txr->br);
|
||||
enq++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OBYTES, next->m_pkthdr.len);
|
||||
if (next->m_flags & M_MCAST)
|
||||
if (next->m_flags & M_MCAST && adapter->vf_ifp)
|
||||
if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
|
||||
ETHER_BPF_MTAP(ifp, next);
|
||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
|
||||
@ -4055,7 +4054,9 @@ static bool
|
||||
igb_txeof(struct tx_ring *txr)
|
||||
{
|
||||
struct adapter *adapter = txr->adapter;
|
||||
#ifdef DEV_NETMAP
|
||||
struct ifnet *ifp = adapter->ifp;
|
||||
#endif /* DEV_NETMAP */
|
||||
u32 work, processed = 0;
|
||||
u16 limit = txr->process_limit;
|
||||
struct igb_tx_buf *buf;
|
||||
@ -4130,7 +4131,6 @@ igb_txeof(struct tx_ring *txr)
|
||||
}
|
||||
++txr->packets;
|
||||
++processed;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
txr->watchdog_time = ticks;
|
||||
|
||||
/* Try the next packet */
|
||||
@ -5127,7 +5127,6 @@ igb_rxeof(struct igb_queue *que, int count, int *done)
|
||||
|
||||
if (eop) {
|
||||
rxr->fmp->m_pkthdr.rcvif = ifp;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
rxr->rx_packets++;
|
||||
/* capture data for AIM */
|
||||
rxr->packets++;
|
||||
@ -5559,25 +5558,95 @@ igb_led_func(void *arg, int onoff)
|
||||
IGB_CORE_UNLOCK(adapter);
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
igb_get_vf_counter(if_t ifp, ift_counter cnt)
|
||||
{
|
||||
struct adapter *adapter;
|
||||
struct e1000_vf_stats *stats;
|
||||
#ifndef IGB_LEGACY_TX
|
||||
struct tx_ring *txr;
|
||||
uint64_t rv;
|
||||
#endif
|
||||
|
||||
adapter = if_getsoftc(ifp);
|
||||
stats = (struct e1000_vf_stats *)adapter->stats;
|
||||
|
||||
switch (cnt) {
|
||||
case IFCOUNTER_IPACKETS:
|
||||
return (stats->gprc);
|
||||
case IFCOUNTER_OPACKETS:
|
||||
return (stats->gptc);
|
||||
case IFCOUNTER_IBYTES:
|
||||
return (stats->gorc);
|
||||
case IFCOUNTER_OBYTES:
|
||||
return (stats->gotc);
|
||||
case IFCOUNTER_IMCASTS:
|
||||
return (stats->mprc);
|
||||
case IFCOUNTER_IERRORS:
|
||||
return (adapter->dropped_pkts);
|
||||
case IFCOUNTER_OERRORS:
|
||||
return (adapter->watchdog_events);
|
||||
#ifndef IGB_LEGACY_TX
|
||||
case IFCOUNTER_OQDROPS:
|
||||
rv = 0;
|
||||
txr = adapter->tx_rings;
|
||||
for (int i = 0; i < adapter->num_queues; i++, txr++)
|
||||
rv += txr->br->br_drops;
|
||||
return (rv);
|
||||
#endif
|
||||
default:
|
||||
return (if_get_counter_default(ifp, cnt));
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
igb_get_counter(if_t ifp, ift_counter cnt)
|
||||
{
|
||||
struct adapter *adapter;
|
||||
struct e1000_hw_stats *stats;
|
||||
#ifndef IGB_LEGACY_TX
|
||||
struct tx_ring *txr;
|
||||
uint64_t rv;
|
||||
#endif
|
||||
|
||||
adapter = if_getsoftc(ifp);
|
||||
if (adapter->vf_ifp)
|
||||
return (igb_get_vf_counter(ifp, cnt));
|
||||
|
||||
stats = (struct e1000_hw_stats *)adapter->stats;
|
||||
|
||||
switch (cnt) {
|
||||
case IFCOUNTER_IPACKETS:
|
||||
return (stats->gprc);
|
||||
case IFCOUNTER_OPACKETS:
|
||||
return (stats->gptc);
|
||||
case IFCOUNTER_IBYTES:
|
||||
return (stats->gorc);
|
||||
case IFCOUNTER_OBYTES:
|
||||
return (stats->gotc);
|
||||
case IFCOUNTER_IMCASTS:
|
||||
return (stats->mprc);
|
||||
case IFCOUNTER_OMCASTS:
|
||||
return (stats->mptc);
|
||||
case IFCOUNTER_IERRORS:
|
||||
return (adapter->dropped_pkts + stats->rxerrc +
|
||||
stats->crcerrs + stats->algnerrc +
|
||||
stats->ruc + stats->roc + stats->mpc + stats->cexterr);
|
||||
stats->ruc + stats->roc + stats->cexterr);
|
||||
case IFCOUNTER_OERRORS:
|
||||
return (stats->ecol + stats->latecol +
|
||||
adapter->watchdog_events);
|
||||
case IFCOUNTER_COLLISIONS:
|
||||
return (stats->colc);
|
||||
case IFCOUNTER_IQDROPS:
|
||||
return (stats->mpc);
|
||||
#ifndef IGB_LEGACY_TX
|
||||
case IFCOUNTER_OQDROPS:
|
||||
rv = 0;
|
||||
txr = adapter->tx_rings;
|
||||
for (int i = 0; i < adapter->num_queues; i++, txr++)
|
||||
rv += txr->br->br_drops;
|
||||
return (rv);
|
||||
#endif
|
||||
default:
|
||||
return (if_get_counter_default(ifp, cnt));
|
||||
}
|
||||
|
@ -3592,6 +3592,8 @@ static uint64_t
|
||||
ixgbe_get_counter(struct ifnet *ifp, ift_counter cnt)
|
||||
{
|
||||
struct adapter *adapter;
|
||||
struct tx_ring *txr;
|
||||
uint64_t rv;
|
||||
|
||||
adapter = if_getsoftc(ifp);
|
||||
|
||||
@ -3612,6 +3614,12 @@ ixgbe_get_counter(struct ifnet *ifp, ift_counter cnt)
|
||||
return (0);
|
||||
case IFCOUNTER_IQDROPS:
|
||||
return (adapter->iqdrops);
|
||||
case IFCOUNTER_OQDROPS:
|
||||
rv = 0;
|
||||
txr = adapter->tx_rings;
|
||||
for (int i = 0; i < adapter->num_queues; i++, txr++)
|
||||
rv += txr->br->br_drops;
|
||||
return (rv);
|
||||
case IFCOUNTER_IERRORS:
|
||||
return (adapter->ierrors);
|
||||
default:
|
||||
@ -3790,6 +3798,9 @@ ixgbe_add_hw_stats(struct adapter *adapter)
|
||||
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "tx_packets",
|
||||
CTLFLAG_RD, &txr->total_packets,
|
||||
"Queue Packets Transmitted");
|
||||
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "br_drops",
|
||||
CTLFLAG_RD, &txr->br->br_drops,
|
||||
"Packets dropped in buf_ring");
|
||||
}
|
||||
|
||||
for (int i = 0; i < adapter->num_queues; i++, rxr++) {
|
||||
|
@ -324,7 +324,7 @@
|
||||
#define IXL_SET_IMCASTS(vsi, count) (vsi)->imcasts = (count)
|
||||
#define IXL_SET_OMCASTS(vsi, count) (vsi)->omcasts = (count)
|
||||
#define IXL_SET_IQDROPS(vsi, count) (vsi)->iqdrops = (count)
|
||||
#define IXL_SET_OQDROPS(vsi, count) (vsi)->iqdrops = (count)
|
||||
#define IXL_SET_OQDROPS(vsi, count) (vsi)->oqdrops = (count)
|
||||
#define IXL_SET_NOPROTO(vsi, count) (vsi)->noproto = (count)
|
||||
#else
|
||||
#define IXL_SET_IPACKETS(vsi, count) (vsi)->ifp->if_ipackets = (count)
|
||||
|
Loading…
Reference in New Issue
Block a user