summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authortsutsui <tsutsui@NetBSD.org>2013-05-10 14:55:08 +0000
committertsutsui <tsutsui@NetBSD.org>2013-05-10 14:55:08 +0000
commitda36fa5985a12733a89dbd076b9dcfe21fa9264d (patch)
treeef1afab989cca971aebab279a65f7199676c2bf7 /sys/dev
parent410f074f26c40693bb5673f39ac3554220f9f84b (diff)
Add RNG entropy collection support of rnd(9) to re(4).
Taken from rtk(4), and briefly checked by rndctl(8).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/rtl8169.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/ic/rtl8169.c b/sys/dev/ic/rtl8169.c
index bdfb624393d..e03e972d481 100644
--- a/sys/dev/ic/rtl8169.c
+++ b/sys/dev/ic/rtl8169.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl8169.c,v 1.138 2013/05/10 14:05:57 tsutsui Exp $ */
+/* $NetBSD: rtl8169.c,v 1.139 2013/05/10 14:55:08 tsutsui Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.138 2013/05/10 14:05:57 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.139 2013/05/10 14:55:08 tsutsui Exp $");
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
/*
@@ -134,6 +134,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.138 2013/05/10 14:05:57 tsutsui Exp $"
#include <netinet/ip.h> /* XXX for IP_MAXPACKET */
#include <net/bpf.h>
+#include <sys/rnd.h>
#include <sys/bus.h>
@@ -860,6 +861,9 @@ re_attach(struct rtk_softc *sc)
if_attach(ifp);
ether_ifattach(ifp, eaddr);
+ rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
+ RND_TYPE_NET, 0);
+
if (pmf_device_register(sc->sc_dev, NULL, NULL))
pmf_class_network_register(sc->sc_dev, ifp);
else
@@ -951,6 +955,7 @@ re_detach(struct rtk_softc *sc)
/* Delete all remaining media. */
ifmedia_delete_instance(&sc->mii.mii_media, IFM_INST_ANY);
+ rnd_detach_source(&sc->rnd_source);
ether_ifdetach(ifp);
if_detach(ifp);
@@ -1476,6 +1481,8 @@ re_intr(void *arg)
if (handled && !IFQ_IS_EMPTY(&ifp->if_snd))
re_start(ifp);
+ rnd_add_uint32(&sc->rnd_source, status);
+
return handled;
}