svn commit: r193311 - head/sys/dev/mxge
Andrew Gallatin
gallatin at FreeBSD.org
Tue Jun 2 16:52:34 UTC 2009
Author: gallatin
Date: Tue Jun 2 16:52:33 2009
New Revision: 193311
URL: http://svn.freebsd.org/changeset/base/193311
Log:
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.
Modified:
head/sys/dev/mxge/if_mxge.c
head/sys/dev/mxge/if_mxge_var.h
Modified: head/sys/dev/mxge/if_mxge.c
==============================================================================
--- head/sys/dev/mxge/if_mxge.c Tue Jun 2 16:48:10 2009 (r193310)
+++ head/sys/dev/mxge/if_mxge.c Tue Jun 2 16:52:33 2009 (r193311)
@@ -30,8 +30,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define IFNET_BUF_RING
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/linker.h>
@@ -68,9 +66,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/in_cksum.h>
#include <machine/resource.h>
-#ifdef IFNET_BUF_RING
-#include <sys/buf_ring.h>
-#endif
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/smp.h>
@@ -90,6 +85,9 @@ __FBSDID("$FreeBSD$");
#include <dev/mxge/mcp_gen_header.h>
/*#define MXGE_FAKE_IFP*/
#include <dev/mxge/if_mxge_var.h>
+#ifdef IFNET_BUF_RING
+#include <sys/buf_ring.h>
+#endif
/* tunable params */
static int mxge_nvidia_ecrc_enable = 1;
@@ -2200,6 +2198,7 @@ mxge_transmit_locked(struct mxge_slice_s
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
/* 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;
}
Modified: head/sys/dev/mxge/if_mxge_var.h
==============================================================================
--- head/sys/dev/mxge/if_mxge_var.h Tue Jun 2 16:48:10 2009 (r193310)
+++ head/sys/dev/mxge/if_mxge_var.h Tue Jun 2 16:52:33 2009 (r193311)
@@ -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;
More information about the svn-src-head
mailing list