Revert most of 193311 so as to track mxge transmit stats

on a per-ring basis and avoid racy (and costly) updates
to the ifp stats via drbr by defining NO_SLOW_STATS

Discussed with: kmacy
This commit is contained in:
Andrew Gallatin 2009-06-23 19:04:25 +00:00
parent 9d53036ff1
commit 710328322a
2 changed files with 22 additions and 1 deletions

View File

@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/sx.h>
/* count xmits ourselves, rather than via drbr */
#define NO_SLOW_STATS
#include <net/if.h>
#include <net/if_arp.h>
#include <net/ethernet.h>
@ -2200,7 +2202,6 @@ mxge_transmit_locked(struct mxge_slice_state *ss, struct mbuf *m)
BPF_MTAP(ifp, m);
/* give it to the nic */
mxge_encap(ss, m);
drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags);
} else if ((err = drbr_enqueue(ifp, tx->br, m)) != 0) {
return (err);
}
@ -2661,6 +2662,9 @@ mxge_tx_done(struct mxge_slice_state *ss, uint32_t mcp_idx)
/* mbuf and DMA map only attached to the first
segment per-mbuf */
if (m != NULL) {
ss->obytes += m->m_pkthdr.len;
if (m->m_flags & M_MCAST)
ss->omcasts++;
ss->opackets++;
tx->info[idx].m = NULL;
map = tx->info[idx].map;
@ -3787,6 +3791,11 @@ mxge_update_stats(mxge_softc_t *sc)
struct mxge_slice_state *ss;
u_long ipackets = 0;
u_long opackets = 0;
#ifdef IFNET_BUF_RING
u_long obytes = 0;
u_long omcasts = 0;
u_long odrops = 0;
#endif
u_long oerrors = 0;
int slice;
@ -3794,10 +3803,20 @@ mxge_update_stats(mxge_softc_t *sc)
ss = &sc->ss[slice];
ipackets += ss->ipackets;
opackets += ss->opackets;
#ifdef IFNET_BUF_RING
obytes += ss->obytes;
omcasts += ss->omcasts;
odrops += ss->tx.br->br_drops;
#endif
oerrors += ss->oerrors;
}
sc->ifp->if_ipackets = ipackets;
sc->ifp->if_opackets = opackets;
#ifdef IFNET_BUF_RING
sc->ifp->if_obytes = obytes;
sc->ifp->if_omcasts = omcasts;
sc->ifp->if_snd.ifq_drops = odrops;
#endif
sc->ifp->if_oerrors = oerrors;
}

View File

@ -196,6 +196,8 @@ struct mxge_slice_state {
volatile uint32_t *irq_claim;
u_long ipackets;
u_long opackets;
u_long obytes;
u_long omcasts;
u_long oerrors;
int if_drv_flags;
struct lro_head lro_active;