Subject: kern/28547: add rnd hooks to rtl81x9 driver
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <dive@endersgame.net>
List: netbsd-bugs
Date: 12/05/2004 21:57:00
>Number: 28547
>Category: kern
>Synopsis: Add support for rtk(4) to be used by the rnd subsystem
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Dec 05 21:57:00 +0000 2004
>Originator: dive@endersgame.net
>Release: NetBSD 2.99.10
>Organization:
Paper Voices, Inc.
>Environment:
System: NetBSD jane.endersgame.net 2.99.10 NetBSD 2.99.10 (JANE) #21: Thu Dec 2 22:54:08 EST 2004 dive@jane.endersgame.net:/sys/arch/i386/compile/JANE i386
Architecture: i386
Machine: i386
>Description:
No problem; simply a patch to let rtk(4) be used by rnd(4).
>How-To-Repeat:
N/A
>Fix:
Index: rtl81x9.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtl81x9.c,v
retrieving revision 1.47
diff -u -r1.47 rtl81x9.c
--- rtl81x9.c 30 Oct 2004 18:08:37 -0000 1.47
+++ rtl81x9.c 5 Dec 2004 20:32:45 -0000
@@ -768,6 +768,12 @@
printf("%s: WARNING: unable to establish power hook\n",
sc->sc_dev.dv_xname);
+
+#if NRND > 0
+ rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
+ RND_TYPE_NET, 0);
+#endif
+
return;
fail_4:
for (i = 0; i < RTK_TX_LIST_CNT; i++) {
@@ -1265,6 +1271,11 @@
if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
rtk_start(ifp);
+#if NRND > 0
+ if (RND_ENABLED(&sc->rnd_source))
+ rnd_add_uint32(&sc->rnd_source, status);
+#endif
+
return (handled);
}
Index: rtl81x9var.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtl81x9var.h,v
retrieving revision 1.13
diff -u -r1.13 rtl81x9var.h
--- rtl81x9var.h 30 May 2004 03:43:26 -0000 1.13
+++ rtl81x9var.h 5 Dec 2004 20:32:45 -0000
@@ -34,6 +34,12 @@
* FreeBSD Id: if_rlreg.h,v 1.9 1999/06/20 18:56:09 wpaul Exp
*/
+#include "rnd.h"
+
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
+
#define RTK_ETHER_ALIGN 2
#define RTK_RXSTAT_LEN 4
@@ -140,6 +146,9 @@
int (*sc_enable) __P((struct rtk_softc *));
void (*sc_disable) __P((struct rtk_softc *));
void (*sc_power) __P((struct rtk_softc *, int));
+#if NRND > 0
+ rndsource_element_t rnd_source;
+#endif
};
#define RTK_ATTACHED 0x00000001 /* attach has succeeded */