From ccb3112a198be460ca31cd0f306118b06a6f0703 Mon Sep 17 00:00:00 2001 From: Damien Bergamini Date: Wed, 23 Mar 2005 14:14:32 +0000 Subject: do packet accounting (opackets/oerrors/ierrors). --- sys/dev/usb/if_ral.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sys/dev/usb') diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index 23d912205ba..da25537e450 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.16 2005/03/23 13:07:35 dlg Exp $ */ +/* $OpenBSD: if_ral.c,v 1.17 2005/03/23 14:14:31 damien Exp $ */ /*- * Copyright (c) 2005 @@ -788,6 +788,8 @@ ural_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (status == USBD_STALLED) usbd_clear_endpoint_stall(sc->sc_rx_pipeh); + + ifp->if_oerrors++; return; } @@ -799,6 +801,7 @@ ural_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) data->ni = NULL; sc->tx_queued--; + ifp->if_opackets++; DPRINTFN(10, ("tx done\n")); @@ -835,6 +838,7 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (len < RAL_RX_DESC_SIZE) { printf("%s: xfer too short %d\n", USBDEVNAME(sc->sc_dev), len); + ifp->if_ierrors++; goto skip; } @@ -848,6 +852,7 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) * those frames when we filled RAL_TXRX_CSR2. */ DPRINTFN(5, ("PHY or CRC error\n")); + ifp->if_ierrors++; goto skip; } @@ -1364,6 +1369,7 @@ ural_watchdog(struct ifnet *ifp) if (--sc->sc_tx_timer == 0) { printf("%s: device timeout\n", USBDEVNAME(sc->sc_dev)); /*ural_init(ifp); XXX needs a process context! */ + ifp->if_oerrors++; return; } ifp->if_timer = 1; -- cgit v1.2.3