From owner-svn-src-stable@freebsd.org Tue Sep 8 22:50:25 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5C383DADDC; Tue, 8 Sep 2020 22:50:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BmL2n5rPlz4Zkc; Tue, 8 Sep 2020 22:50:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABF8D18104; Tue, 8 Sep 2020 22:50:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 088MoP4e040315; Tue, 8 Sep 2020 22:50:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 088MoP6T040314; Tue, 8 Sep 2020 22:50:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202009082250.088MoP6T040314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 8 Sep 2020 22:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r365480 - in stable: 11/sys/dev/uart 12/sys/dev/uart X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/uart 12/sys/dev/uart X-SVN-Commit-Revision: 365480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2020 22:50:26 -0000 Author: jhb Date: Tue Sep 8 22:50:24 2020 New Revision: 365480 URL: https://svnweb.freebsd.org/changeset/base/365480 Log: MFC 359900: 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. Modified: stable/11/sys/dev/uart/uart_bus.h stable/11/sys/dev/uart/uart_core.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/uart/uart_bus.h stable/12/sys/dev/uart/uart_core.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/uart/uart_bus.h ============================================================================== --- stable/11/sys/dev/uart/uart_bus.h Tue Sep 8 22:42:41 2020 (r365479) +++ stable/11/sys/dev/uart/uart_bus.h Tue Sep 8 22:50:24 2020 (r365480) @@ -108,6 +108,7 @@ struct uart_softc { int sc_rxput; int sc_rxget; int sc_rxfifosz; /* Size of RX FIFO. */ + int sc_rxoverruns; /* Transmitter data. */ uint8_t *sc_txbuf; Modified: stable/11/sys/dev/uart/uart_core.c ============================================================================== --- stable/11/sys/dev/uart/uart_core.c Tue Sep 8 22:42:41 2020 (r365479) +++ stable/11/sys/dev/uart/uart_core.c Tue Sep 8 22:50:24 2020 (r365480) @@ -327,6 +327,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); } @@ -735,6 +736,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);