[rtems-libbsd commit] if_dwc: Workaround for if_inc_counter()
Sebastian Huber
sebh at rtems.org
Wed Apr 1 07:16:38 UTC 2015
Module: rtems-libbsd
Branch: master
Commit: 36a92dfe8e8d8a216fb2fbeeaae8d42575eae142
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=36a92dfe8e8d8a216fb2fbeeaae8d42575eae142
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Mar 26 15:08:36 2015 +0100
if_dwc: Workaround for if_inc_counter()
---
freebsd/sys/dev/dwc/if_dwc.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/freebsd/sys/dev/dwc/if_dwc.c b/freebsd/sys/dev/dwc/if_dwc.c
index 48711a3..ea08667 100644
--- a/freebsd/sys/dev/dwc/if_dwc.c
+++ b/freebsd/sys/dev/dwc/if_dwc.c
@@ -386,6 +386,7 @@ dwc_harvest_stats(struct dwc_softc *sc)
sc->stats_harvest_count = 0;
ifp = sc->ifp;
+#ifndef __rtems__
if_inc_counter(ifp, IFCOUNTER_IPACKETS, READ4(sc, RXFRAMECOUNT_GB));
if_inc_counter(ifp, IFCOUNTER_IMCASTS, READ4(sc, RXMULTICASTFRAMES_G));
if_inc_counter(ifp, IFCOUNTER_IERRORS,
@@ -402,6 +403,24 @@ dwc_harvest_stats(struct dwc_softc *sc)
if_inc_counter(ifp, IFCOUNTER_COLLISIONS,
READ4(sc, TXEXESSCOL) + READ4(sc, TXLATECOL));
+#else /* __rtems__ */
+ ifp->if_ipackets += READ4(sc, RXFRAMECOUNT_GB);
+ ifp->if_imcasts += READ4(sc, RXMULTICASTFRAMES_G);
+ ifp->if_ierrors +=
+ READ4(sc, RXOVERSIZE_G) + READ4(sc, RXUNDERSIZE_G) +
+ READ4(sc, RXCRCERROR) + READ4(sc, RXALIGNMENTERROR) +
+ READ4(sc, RXRUNTERROR) + READ4(sc, RXJABBERERROR) +
+ READ4(sc, RXLENGTHERROR);
+
+ ifp->if_opackets += READ4(sc, TXFRAMECOUNT_G);
+ ifp->if_omcasts += READ4(sc, TXMULTICASTFRAMES_G);
+ ifp->if_oerrors +=
+ READ4(sc, TXOVERSIZE_G) + READ4(sc, TXEXCESSDEF) +
+ READ4(sc, TXCARRIERERR) + READ4(sc, TXUNDERFLOWERROR);
+
+ ifp->if_collisions +=
+ READ4(sc, TXEXESSCOL) + READ4(sc, TXLATECOL);
+#endif /* __rtems__ */
dwc_clear_stats(sc);
}
@@ -798,7 +817,11 @@ dwc_rxfinish_locked(struct dwc_softc *sc)
m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = len;
m->m_len = len;
+#ifndef __rtems__
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
+#else /* __rtems__ */
+ ++ifp->if_ipackets;
+#endif /* __rtems__ */
DWC_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
@@ -815,7 +838,11 @@ dwc_rxfinish_locked(struct dwc_softc *sc)
*/
}
} else
+#ifndef __rtems__
if_inc_counter(sc->ifp, IFCOUNTER_IQDROPS, 1);
+#else /* __rtems__ */
+ ++ifp->if_iqdrops;
+#endif /* __rtems__ */
sc->rx_idx = next_rxidx(sc, sc->rx_idx);
}
More information about the vc
mailing list