Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci attach random number source.



details:   https://anonhg.NetBSD.org/src/rev/c3d39694e7fc
branches:  trunk
changeset: 535469:c3d39694e7fc
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Aug 20 00:35:46 2002 +0000

description:
attach random number source.

diffstat:

 sys/dev/pci/if_sip.c |  21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diffs (65 lines):

diff -r a2798946b8c6 -r c3d39694e7fc sys/dev/pci/if_sip.c
--- a/sys/dev/pci/if_sip.c      Tue Aug 20 00:27:59 2002 +0000
+++ b/sys/dev/pci/if_sip.c      Tue Aug 20 00:35:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sip.c,v 1.64 2002/08/16 07:10:56 thorpej Exp $      */
+/*     $NetBSD: if_sip.c,v 1.65 2002/08/20 00:35:46 itojun Exp $       */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -80,9 +80,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.64 2002/08/16 07:10:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.65 2002/08/20 00:35:46 itojun Exp $");
 
 #include "bpfilter.h"
+#include "rnd.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,6 +99,10 @@
 
 #include <uvm/uvm_extern.h>            /* for PAGE_SIZE */
 
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
+
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
@@ -300,6 +305,10 @@
        struct mbuf *sc_rxtail;
        struct mbuf **sc_rxtailp;
 #endif /* DP83820 */
+
+#if NRND > 0
+       rndsource_element_t rnd_source; /* random source */
+#endif
 };
 
 /* sc_flags */
@@ -967,6 +976,10 @@
         */
        if_attach(ifp);
        ether_ifattach(ifp, enaddr);
+#if NRND > 0
+       rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
+           RND_TYPE_NET, 0);
+#endif
 
        /*
         * The number of bytes that must be available in
@@ -1485,6 +1498,10 @@
                if ((isr & sc->sc_imr) == 0)
                        break;
 
+#if NRND > 0
+               rnd_add_uint32(&sc->rnd_source, isr);
+#endif
+
                handled = 1;
 
                if (isr & (ISR_RXORN|ISR_RXIDLE|ISR_RXDESC)) {



Home | Main Index | Thread Index | Old Index