summaryrefslogtreecommitdiff
path: root/sys/dev/marvell
diff options
context:
space:
mode:
authortls <tls@NetBSD.org>2012-02-02 19:42:57 +0000
committertls <tls@NetBSD.org>2012-02-02 19:42:57 +0000
commitcc9ee3de3e25ef31d3a97dc35bedc36945e35d2a (patch)
tree06a2889eb6b4b02bc8b8bba6b5cc3f9b1938d18b /sys/dev/marvell
parentf622122a62827e27b444c2f95632d61f73357ced (diff)
Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code to sys/kern from sys/dev. 2) Remove use of NRND as test for presence of entropy-pool code throughout source tree. 3) Remove use of RND_ENABLED in device drivers as microoptimization to avoid expensive operations on disabled entropy sources; make the rnd_add calls do this directly so all callers benefit. 4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might have lead to slight entropy overestimation for some sources. 5) Add new source types for environmental sensors, power sensors, VM system events, and skew between clocks, with a sample implementation for each. ok releng to go in before the branch due to the difficulty of later pullup (widespread #ifdef removal and moved files). Tested with release builds on amd64 and evbarm and live testing on amd64.
Diffstat (limited to 'sys/dev/marvell')
-rw-r--r--sys/dev/marvell/if_gfe.c9
-rw-r--r--sys/dev/marvell/if_gfevar.h4
-rw-r--r--sys/dev/marvell/if_mvgbe.c17
3 files changed, 6 insertions, 24 deletions
diff --git a/sys/dev/marvell/if_gfe.c b/sys/dev/marvell/if_gfe.c
index 7d026220925..48f6c4751c2 100644
--- a/sys/dev/marvell/if_gfe.c
+++ b/sys/dev/marvell/if_gfe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gfe.c,v 1.39 2010/11/13 13:52:04 uebayasi Exp $ */
+/* $NetBSD: if_gfe.c,v 1.40 2012/02/02 19:43:04 tls Exp $ */
/*
* Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,10 +42,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.39 2010/11/13 13:52:04 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.40 2012/02/02 19:43:04 tls Exp $");
#include "opt_inet.h"
-#include "rnd.h"
#include <sys/param.h>
#include <sys/bus.h>
@@ -68,9 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.39 2010/11/13 13:52:04 uebayasi Exp $")
#include <netinet/if_inarp.h>
#endif
#include <net/bpf.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
@@ -539,10 +536,8 @@ gfe_attach(device_t parent, device_t self, void *aux)
if_attach(ifp);
ether_ifattach(ifp, enaddr);
bpf_attach(ifp, DLT_EN10MB, sizeof(struct ether_header));
-#if NRND > 0
rnd_attach_source(&sc->sc_rnd_source, device_xname(self), RND_TYPE_NET,
0);
-#endif
marvell_intr_establish(mva->mva_irq, IPL_NET, gfe_intr, sc);
}
diff --git a/sys/dev/marvell/if_gfevar.h b/sys/dev/marvell/if_gfevar.h
index f3e1478515e..d0e30fc508c 100644
--- a/sys/dev/marvell/if_gfevar.h
+++ b/sys/dev/marvell/if_gfevar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gfevar.h,v 1.11 2011/11/19 22:51:23 tls Exp $ */
+/* $NetBSD: if_gfevar.h,v 1.12 2012/02/02 19:43:04 tls Exp $ */
/*
* Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -167,8 +167,6 @@ struct gfe_softc {
*/
struct gfe_rxqueue sc_rxq[4]; /* Hi/MedHi/MedLo/Lo receive queues */
-#if NRND > 0
krndsource_t sc_rnd_source;
-#endif
};
#endif /* _IF_GFEVAR_H_ */
diff --git a/sys/dev/marvell/if_mvgbe.c b/sys/dev/marvell/if_mvgbe.c
index 0679be5661d..b4b82c7f940 100644
--- a/sys/dev/marvell/if_mvgbe.c
+++ b/sys/dev/marvell/if_mvgbe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mvgbe.c,v 1.15 2011/11/19 22:51:23 tls Exp $ */
+/* $NetBSD: if_mvgbe.c,v 1.16 2012/02/02 19:43:04 tls Exp $ */
/*
* Copyright (c) 2007, 2008 KIYOHARA Takashi
* All rights reserved.
@@ -25,9 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.15 2011/11/19 22:51:23 tls Exp $");
-
-#include "rnd.h"
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.16 2012/02/02 19:43:04 tls Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -51,9 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.15 2011/11/19 22:51:23 tls Exp $");
#include <netinet/ip.h>
#include <net/bpf.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
@@ -215,9 +211,7 @@ struct mvgbe_softc {
LIST_HEAD(__mvgbe_jinusehead, mvgbe_jpool_entry) sc_jinuse_listhead;
SIMPLEQ_HEAD(__mvgbe_txmaphead, mvgbe_txmap_entry) sc_txmap_head;
-#if NRND > 0
krndsource_t sc_rnd_source;
-#endif
};
@@ -784,10 +778,8 @@ mvgbe_attach(device_t parent, device_t self, void *aux)
ether_ifattach(ifp, sc->sc_enaddr);
ether_set_ifflags_cb(&sc->sc_ethercom, mvgbe_ifflags_cb);
-#if NRND > 0
rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
RND_TYPE_NET, 0);
-#endif
return;
@@ -851,10 +843,7 @@ mvgbe_intr(void *arg)
if (!IFQ_IS_EMPTY(&ifp->if_snd))
mvgbe_start(ifp);
-#if NRND > 0
- if (RND_ENABLED(&sc->sc_rnd_source))
- rnd_add_uint32(&sc->sc_rnd_source, datum);
-#endif
+ rnd_add_uint32(&sc->sc_rnd_source, datum);
return claimed;
}