From 2d39e9ce1699b90f729441d1188bb2d90d60fce3 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sat, 25 Jun 2022 02:46:15 +0000 Subject: [PATCH] Pass proper status values to rnd_add_uint32(9) as rnd(9) man page claims. --- sys/dev/ic/dp83932.c | 8 ++++---- sys/dev/ic/i82557.c | 9 +++++---- sys/dev/ic/rtl8169.c | 11 ++++++----- sys/dev/ic/rtl81x9.c | 12 +++++++----- sys/dev/ic/tulip.c | 12 +++++++----- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/sys/dev/ic/dp83932.c b/sys/dev/ic/dp83932.c index 1097be88e716..0c78937b04a7 100644 --- a/sys/dev/ic/dp83932.c +++ b/sys/dev/ic/dp83932.c @@ -1,4 +1,4 @@ -/* $NetBSD: dp83932.c,v 1.47 2021/02/20 09:36:31 rin Exp $ */ +/* $NetBSD: dp83932.c,v 1.48 2022/06/25 02:46:15 tsutsui Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.47 2021/02/20 09:36:31 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.48 2022/06/25 02:46:15 tsutsui Exp $"); #include @@ -689,8 +689,8 @@ sonic_txintr(struct sonic_softc *sc) if (sc->sc_txpending == 0) ifp->if_timer = 0; - if (count != 0) - rnd_add_uint32(&sc->sc_rndsource, count); + if (totstat != 0) + rnd_add_uint32(&sc->sc_rndsource, totstat); return totstat; } diff --git a/sys/dev/ic/i82557.c b/sys/dev/ic/i82557.c index 9e671c1fbc76..abf388fda857 100644 --- a/sys/dev/ic/i82557.c +++ b/sys/dev/ic/i82557.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82557.c,v 1.159 2020/02/07 00:56:48 thorpej Exp $ */ +/* $NetBSD: i82557.c,v 1.160 2022/06/25 02:46:15 tsutsui Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.159 2020/02/07 00:56:48 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.160 2022/06/25 02:46:15 tsutsui Exp $"); #include #include @@ -1074,7 +1074,7 @@ fxp_intr(void *arg) struct ifnet *ifp = &sc->sc_ethercom.ec_if; bus_dmamap_t rxmap; int claimed = 0, rnr; - uint8_t statack; + uint8_t statack, rndstat = 0; if (!device_is_active(sc->sc_dev) || sc->sc_enabled == 0) return (0); @@ -1092,6 +1092,7 @@ fxp_intr(void *arg) } while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0) { + rndstat = statack; claimed = 1; /* @@ -1146,7 +1147,7 @@ fxp_intr(void *arg) } if (claimed) - rnd_add_uint32(&sc->rnd_source, statack); + rnd_add_uint32(&sc->rnd_source, rndstat); return (claimed); } diff --git a/sys/dev/ic/rtl8169.c b/sys/dev/ic/rtl8169.c index b5b53f978583..56888eb2a0ea 100644 --- a/sys/dev/ic/rtl8169.c +++ b/sys/dev/ic/rtl8169.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtl8169.c,v 1.171 2022/05/24 20:50:19 andvar Exp $ */ +/* $NetBSD: rtl8169.c,v 1.172 2022/06/25 02:46:15 tsutsui Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.171 2022/05/24 20:50:19 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.172 2022/06/25 02:46:15 tsutsui Exp $"); /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */ /* @@ -1530,7 +1530,7 @@ re_intr(void *arg) { struct rtk_softc *sc = arg; struct ifnet *ifp; - uint16_t status; + uint16_t status, rndstatus = 0; int handled = 0; if (!device_has_power(sc->sc_dev)) @@ -1550,9 +1550,10 @@ re_intr(void *arg) /* If the card has gone away the read returns 0xffff. */ if (status == 0xffff) break; - if (status) { + if (status != 0) { handled = 1; CSR_WRITE_2(sc, RTK_ISR, status); + rndstatus = status; } if ((status & status_mask) == 0) @@ -1578,7 +1579,7 @@ re_intr(void *arg) if (handled) if_schedule_deferred_start(ifp); - rnd_add_uint32(&sc->rnd_source, status); + rnd_add_uint32(&sc->rnd_source, rndstatus); return handled; } diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index 8fc833cc7ab2..a849e328035e 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtl81x9.c,v 1.111 2020/03/12 03:01:46 thorpej Exp $ */ +/* $NetBSD: rtl81x9.c,v 1.112 2022/06/25 02:46:15 tsutsui Exp $ */ /* * Copyright (c) 1997, 1998 @@ -86,7 +86,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.111 2020/03/12 03:01:46 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.112 2022/06/25 02:46:15 tsutsui Exp $"); #include @@ -1166,7 +1166,7 @@ rtk_intr(void *arg) { struct rtk_softc *sc; struct ifnet *ifp; - uint16_t status; + uint16_t status, rndstatus = 0; int handled; sc = arg; @@ -1186,8 +1186,10 @@ rtk_intr(void *arg) if (status == 0xffff) break; /* Card is gone... */ - if (status) + if (status) { CSR_WRITE_2(sc, RTK_ISR, status); + rndstatus = status; + } if ((status & RTK_INTRS) == 0) break; @@ -1214,7 +1216,7 @@ rtk_intr(void *arg) if_schedule_deferred_start(ifp); - rnd_add_uint32(&sc->rnd_source, status); + rnd_add_uint32(&sc->rnd_source, rndstatus); return handled; } diff --git a/sys/dev/ic/tulip.c b/sys/dev/ic/tulip.c index 4650d5ca861b..fc5d08c35780 100644 --- a/sys/dev/ic/tulip.c +++ b/sys/dev/ic/tulip.c @@ -1,4 +1,4 @@ -/* $NetBSD: tulip.c,v 1.204 2020/03/15 22:19:00 thorpej Exp $ */ +/* $NetBSD: tulip.c,v 1.205 2022/06/25 02:46:15 tsutsui Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.204 2020/03/15 22:19:00 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.205 2022/06/25 02:46:15 tsutsui Exp $"); #include @@ -1010,7 +1010,7 @@ tlp_intr(void *arg) { struct tulip_softc *sc = arg; struct ifnet *ifp = &sc->sc_ethercom.ec_if; - uint32_t status, rxstatus, txstatus; + uint32_t status, rxstatus, txstatus, rndstatus = 0; int handled = 0, txthresh; DPRINTF(sc, ("%s: tlp_intr\n", device_xname(sc->sc_dev))); @@ -1042,8 +1042,10 @@ tlp_intr(void *arg) for (;;) { status = TULIP_READ(sc, CSR_STATUS); - if (status) + if (status) { TULIP_WRITE(sc, CSR_STATUS, status); + rndstatus = status; + } if ((status & sc->sc_inten) == 0) break; @@ -1186,7 +1188,7 @@ tlp_intr(void *arg) if_schedule_deferred_start(ifp); if (handled) - rnd_add_uint32(&sc->sc_rnd_source, status); + rnd_add_uint32(&sc->sc_rnd_source, rndstatus); return handled; }