aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/uart/uart_core.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-04-13 20:59:09 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-04-13 20:59:09 +0000
commit64c4dfcd2687461fb915236cc51a3c1b48db383b (patch)
treeb8ba74c988485107bf51637014d641a7532710e2 /sys/dev/uart/uart_core.c
parentb47c1eda0cacfacb85c3bed6d0c60bf241d04cf8 (diff)
downloadsrc-64c4dfcd2687461fb915236cc51a3c1b48db383b.tar.gz
src-64c4dfcd2687461fb915236cc51a3c1b48db383b.zip
Export a sysctl count of RX FIFO overrun events.
uart(4) backends currently detect RX FIFO overrun errors and report them to the uart(4) core layer. They are then reported to the generic TTY layer which promptly ignores them. As a result, there is currently no good way to determine if a uart is experiencing RX FIFO overruns. One could add a generic per-tty counter, but there did not appear to be a good way to export those. Instead, add a sysctl under the uart(4) sysctl tree to export the count of overruns. Reviewed by: brooks MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24368
Notes
Notes: svn path=/head/; revision=359900
Diffstat (limited to 'sys/dev/uart/uart_core.c')
-rw-r--r--sys/dev/uart/uart_core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index d664a823f701..89201f3d9463 100644
--- a/sys/dev/uart/uart_core.c
+++ b/sys/dev/uart/uart_core.c
@@ -333,6 +333,7 @@ uart_intr_overrun(void *arg)
sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN;
uart_sched_softih(sc, SER_INT_RXREADY);
}
+ sc->sc_rxoverruns++;
UART_FLUSH(sc, UART_FLUSH_RECEIVER);
return (0);
}
@@ -741,6 +742,12 @@ uart_bus_attach(device_t dev)
if (sc->sc_sysdev != NULL)
sc->sc_sysdev->hwmtx = sc->sc_hwmtx;
+ if (sc->sc_rxfifosz > 1)
+ SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+ "rx_overruns", CTLFLAG_RD, &sc->sc_rxoverruns, 0,
+ "Receive overruns");
+
return (0);
fail: