From ca88e2b6bd37940c1d9f944e1362d0c7ab7ce9cc Mon Sep 17 00:00:00 2001 From: enami Date: Mon, 9 Oct 2000 12:54:28 +0000 Subject: [PATCH] Make tulip a random source. --- sys/dev/ic/tulip.c | 18 +++++++++++++++++- sys/dev/ic/tulipvar.h | 6 +++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/tulip.c b/sys/dev/ic/tulip.c index 065aa1ddb226..39b5edd723d5 100644 --- a/sys/dev/ic/tulip.c +++ b/sys/dev/ic/tulip.c @@ -1,4 +1,4 @@ -/* $NetBSD: tulip.c,v 1.75 2000/10/05 07:22:43 bouyer Exp $ */ +/* $NetBSD: tulip.c,v 1.76 2000/10/09 12:54:28 enami Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -45,6 +45,7 @@ #include "opt_inet.h" #include "opt_ns.h" #include "bpfilter.h" +#include "rnd.h" #include #include @@ -61,6 +62,10 @@ #include +#if NRND > 0 +#include +#endif + #include #include #include @@ -516,6 +521,10 @@ tlp_attach(sc, enaddr) bpfattach(&sc->sc_ethercom.ec_if.if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); #endif +#if NRND > 0 + rnd_attach_source(&sc->sc_rnd_source, sc->sc_dev.dv_xname, + RND_TYPE_NET, 0); +#endif /* * Make sure the interface is shutdown during reboot. @@ -626,6 +635,9 @@ tlp_detach(sc) /* Delete all remaining media. */ ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); +#if NRND > 0 + rnd_detach_source(&sc->sc_rnd_source); +#endif #if NBPFILTER > 0 bpfdetach(ifp); #endif @@ -1278,6 +1290,10 @@ tlp_intr(arg) /* Try to get more packets going. */ tlp_start(ifp); +#if NRND > 0 + if (handled) + rnd_add_uint32(&sc->sc_rnd_source, status); +#endif return (handled); } diff --git a/sys/dev/ic/tulipvar.h b/sys/dev/ic/tulipvar.h index 7c07864c56f0..92f7d4b143ea 100644 --- a/sys/dev/ic/tulipvar.h +++ b/sys/dev/ic/tulipvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: tulipvar.h,v 1.38 2000/10/03 04:32:01 thorpej Exp $ */ +/* $NetBSD: tulipvar.h,v 1.39 2000/10/09 12:54:28 enami Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -443,6 +443,10 @@ struct tulip_softc { struct tulip_txsq sc_txdirtyq; /* dirty Tx descsofts */ int sc_rxptr; /* next ready RX descriptor/descsoft */ + +#if NRND > 0 + rndsource_element_t sc_rnd_source; /* random source */ +#endif }; #endif