From 0ccb73a32354d200cc7d10de55ff6044370f8d44 Mon Sep 17 00:00:00 2001 From: gallatin Date: Tue, 2 Jun 2009 16:52:33 +0000 Subject: Buf-ring fixes for mxge - always maintain byte/mcast/drop stats via drbr - move #define of IFNET_BUF_RING so that its picked up by all files in the driver - conditionalize IFNET_BUF_RING on the FreeBSD_version bump just after it appeared in the tree. Sponsored by: Myricom Inc. --- sys/dev/mxge/if_mxge.c | 29 ++++------------------------- sys/dev/mxge/if_mxge_var.h | 6 ++++-- 2 files changed, 8 insertions(+), 27 deletions(-) (limited to 'sys/dev/mxge') diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c index 22b5ce2..765b4d9 100644 --- a/sys/dev/mxge/if_mxge.c +++ b/sys/dev/mxge/if_mxge.c @@ -30,8 +30,6 @@ POSSIBILITY OF SUCH DAMAGE. #include __FBSDID("$FreeBSD$"); -#define IFNET_BUF_RING - #include #include #include @@ -68,9 +66,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef IFNET_BUF_RING -#include -#endif #include #include #include @@ -90,6 +85,9 @@ __FBSDID("$FreeBSD$"); #include /*#define MXGE_FAKE_IFP*/ #include +#ifdef IFNET_BUF_RING +#include +#endif /* tunable params */ static int mxge_nvidia_ecrc_enable = 1; @@ -2200,6 +2198,7 @@ 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); } @@ -2656,11 +2655,6 @@ 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) { -#ifdef IFNET_BUF_RING - ss->obytes += m->m_pkthdr.len; - if (m->m_flags & M_MCAST) - ss->omcasts++; -#endif ss->opackets++; tx->info[idx].m = NULL; map = tx->info[idx].map; @@ -3787,11 +3781,6 @@ 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; @@ -3799,20 +3788,10 @@ 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; } diff --git a/sys/dev/mxge/if_mxge_var.h b/sys/dev/mxge/if_mxge_var.h index b17faf2..8240b62 100644 --- a/sys/dev/mxge/if_mxge_var.h +++ b/sys/dev/mxge/if_mxge_var.h @@ -46,6 +46,10 @@ $FreeBSD$ #define MXGE_VIRT_JUMBOS 0 #endif +#if (__FreeBSD_version > 800082) +#define IFNET_BUF_RING 1 +#endif + #ifndef VLAN_CAPABILITIES #define VLAN_CAPABILITIES(ifp) #define mxge_vlans_active(sc) (sc)->ifp->if_nvlans @@ -192,8 +196,6 @@ 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; -- cgit v1.1