[rtems-libbsd commit] if_cgem: Workaround for if_inc_counter()

Sebastian Huber sebh at rtems.org
Wed Jan 21 14:02:59 UTC 2015


Module:    rtems-libbsd
Branch:    master
Commit:    a09f00e7d68fea9c646ae2a2071b10cf28c466a1
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=a09f00e7d68fea9c646ae2a2071b10cf28c466a1

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 20 07:58:17 2014 +0100

if_cgem: Workaround for if_inc_counter()

---

 freebsd/sys/dev/cadence/if_cgem.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/freebsd/sys/dev/cadence/if_cgem.c b/freebsd/sys/dev/cadence/if_cgem.c
index bf14a9a..38d6a7d 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);



More information about the vc mailing list