summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-11-20 07:58:17 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-01-21 15:00:20 +0100
commita09f00e7d68fea9c646ae2a2071b10cf28c466a1 (patch)
tree60e3decd287752331b4344bd0d56fcf133d62239
parentif_cgem: Import from FreeBSD (diff)
downloadrtems-libbsd-a09f00e7d68fea9c646ae2a2071b10cf28c466a1.tar.bz2
if_cgem: Workaround for if_inc_counter()
-rw-r--r--freebsd/sys/dev/cadence/if_cgem.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/freebsd/sys/dev/cadence/if_cgem.c b/freebsd/sys/dev/cadence/if_cgem.c
index bf14a9a6..38d6a7d7 100644
--- a/freebsd/sys/dev/cadence/if_cgem.c
+++ b/freebsd/sys/dev/cadence/if_cgem.c
@@ -560,7 +560,11 @@ cgem_recv(struct cgem_softc *sc)
(CGEM_RXDESC_SOF | CGEM_RXDESC_EOF)) {
/* discard. */
m_free(m);
+#ifndef __rtems__
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
+#else /* __rtems__ */
+ ifp->if_ierrors++;
+#endif /* __rtems__ */
continue;
}
@@ -606,7 +610,11 @@ cgem_recv(struct cgem_softc *sc)
m = m_hd;
m_hd = m_hd->m_next;
m->m_next = NULL;
+#ifndef __rtems__
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
+#else /* __rtems__ */
+ ifp->if_ipackets++;
+#endif /* __rtems__ */
(*ifp->if_input)(ifp, m);
}
CGEM_LOCK(sc);
@@ -648,9 +656,17 @@ cgem_clean_tx(struct cgem_softc *sc)
sc->txring[sc->txring_tl_ptr].addr);
} else if ((ctl & (CGEM_TXDESC_RETRY_ERR |
CGEM_TXDESC_LATE_COLL)) != 0) {
+#ifndef __rtems__
if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);
+#else /* __rtems__ */
+ sc->ifp->if_oerrors++;
+#endif /* __rtems__ */
} else
+#ifndef __rtems__
if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1);
+#else /* __rtems__ */
+ sc->ifp->if_opackets++;
+#endif /* __rtems__ */
/* If the packet spanned more than one tx descriptor,
* skip descriptors until we find the end so that only
@@ -823,16 +839,32 @@ cgem_poll_hw_stats(struct cgem_softc *sc)
n = RD4(sc, CGEM_SINGLE_COLL_FRAMES);
sc->stats.tx_single_collisn += n;
+#ifndef __rtems__
if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, n);
+#else /* __rtems__ */
+ sc->ifp->if_collisions += n;
+#endif /* __rtems__ */
n = RD4(sc, CGEM_MULTI_COLL_FRAMES);
sc->stats.tx_multi_collisn += n;
+#ifndef __rtems__
if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, n);
+#else /* __rtems__ */
+ sc->ifp->if_collisions += n;
+#endif /* __rtems__ */
n = RD4(sc, CGEM_EXCESSIVE_COLL_FRAMES);
sc->stats.tx_excsv_collisn += n;
+#ifndef __rtems__
if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, n);
+#else /* __rtems__ */
+ sc->ifp->if_collisions += n;
+#endif /* __rtems__ */
n = RD4(sc, CGEM_LATE_COLL);
sc->stats.tx_late_collisn += n;
+#ifndef __rtems__
if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, n);
+#else /* __rtems__ */
+ sc->ifp->if_collisions += n;
+#endif /* __rtems__ */
sc->stats.tx_deferred_frames += RD4(sc, CGEM_DEFERRED_TX_FRAMES);
sc->stats.tx_carrier_sense_errs += RD4(sc, CGEM_CARRIER_SENSE_ERRS);