summaryrefslogtreecommitdiffstats
path: root/sys/dev/mxge
diff options
context:
space:
mode:
authorgallatin <gallatin@FreeBSD.org>2009-06-02 16:52:33 +0000
committergallatin <gallatin@FreeBSD.org>2009-06-02 16:52:33 +0000
commit0ccb73a32354d200cc7d10de55ff6044370f8d44 (patch)
tree82a1f800cac06180b8c61350f70cc983daa37b8c /sys/dev/mxge
parent2f4849a20fcbe8d9274d9ccb3430aaf60dac8da6 (diff)
downloadFreeBSD-src-0ccb73a32354d200cc7d10de55ff6044370f8d44.zip
FreeBSD-src-0ccb73a32354d200cc7d10de55ff6044370f8d44.tar.gz
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.
Diffstat (limited to 'sys/dev/mxge')
-rw-r--r--sys/dev/mxge/if_mxge.c29
-rw-r--r--sys/dev/mxge/if_mxge_var.h6
2 files changed, 8 insertions, 27 deletions
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 <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_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;
OpenPOWER on IntegriCloud