Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Pass proper status values to rnd_add_uint32(9) as...



details:   https://anonhg.NetBSD.org/src/rev/a4a4394823c1
branches:  trunk
changeset: 368126:a4a4394823c1
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 25 02:46:15 2022 +0000

description:
Pass proper status values to rnd_add_uint32(9) as rnd(9) man page claims.

diffstat:

 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(-)

diffs (217 lines):

diff -r b190d7b6874b -r a4a4394823c1 sys/dev/ic/dp83932.c
--- a/sys/dev/ic/dp83932.c      Sat Jun 25 02:36:27 2022 +0000
+++ b/sys/dev/ic/dp83932.c      Sat Jun 25 02:46:15 2022 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
@@ -689,8 +689,8 @@
        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 -r b190d7b6874b -r a4a4394823c1 sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c       Sat Jun 25 02:36:27 2022 +0000
+++ b/sys/dev/ic/i82557.c       Sat Jun 25 02:46:15 2022 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -1074,7 +1074,7 @@
        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 @@
        }
 
        while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0) {
+               rndstat = statack;
                claimed = 1;
 
                /*
@@ -1146,7 +1147,7 @@
        }
 
        if (claimed)
-               rnd_add_uint32(&sc->rnd_source, statack);
+               rnd_add_uint32(&sc->rnd_source, rndstat);
        return (claimed);
 }
 
diff -r b190d7b6874b -r a4a4394823c1 sys/dev/ic/rtl8169.c
--- a/sys/dev/ic/rtl8169.c      Sat Jun 25 02:36:27 2022 +0000
+++ b/sys/dev/ic/rtl8169.c      Sat Jun 25 02:46:15 2022 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
 {
        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 @@
                /* 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 @@
        if (handled)
                if_schedule_deferred_start(ifp);
 
-       rnd_add_uint32(&sc->rnd_source, status);
+       rnd_add_uint32(&sc->rnd_source, rndstatus);
 
        return handled;
 }
diff -r b190d7b6874b -r a4a4394823c1 sys/dev/ic/rtl81x9.c
--- a/sys/dev/ic/rtl81x9.c      Sat Jun 25 02:36:27 2022 +0000
+++ b/sys/dev/ic/rtl81x9.c      Sat Jun 25 02:46:15 2022 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
@@ -1166,7 +1166,7 @@
 {
        struct rtk_softc *sc;
        struct ifnet *ifp;
-       uint16_t status;
+       uint16_t status, rndstatus = 0;
        int handled;
 
        sc = arg;
@@ -1186,8 +1186,10 @@
                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 @@
 
        if_schedule_deferred_start(ifp);
 
-       rnd_add_uint32(&sc->rnd_source, status);
+       rnd_add_uint32(&sc->rnd_source, rndstatus);
 
        return handled;
 }
diff -r b190d7b6874b -r a4a4394823c1 sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c        Sat Jun 25 02:36:27 2022 +0000
+++ b/sys/dev/ic/tulip.c        Sat Jun 25 02:46:15 2022 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
@@ -1010,7 +1010,7 @@
 {
        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 @@
 
        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 @@
        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;
 }



Home | Main Index | Thread Index | Old Index