attach rtk(4) as an event source to rnd(4)
patches from Sean Davis in PR/28547 (also added a detach hook)
This commit is contained in:
parent
145a9f0bea
commit
724df7bd2e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rtl81x9.c,v 1.47 2004/10/30 18:08:37 thorpej Exp $ */
|
||||
/* $NetBSD: rtl81x9.c,v 1.48 2005/01/23 10:26:06 dan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998
|
||||
|
@ -86,7 +86,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.47 2004/10/30 18:08:37 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.48 2005/01/23 10:26:06 dan Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
|
@ -768,6 +768,12 @@ rtk_attach(sc)
|
|||
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++) {
|
||||
|
@ -863,6 +869,10 @@ rtk_detach(sc)
|
|||
/* Delete all remaining media. */
|
||||
ifmedia_delete_instance(&sc->mii.mii_media, IFM_INST_ANY);
|
||||
|
||||
#if NRND > 0
|
||||
rnd_detach_source(&sc->rnd_source);
|
||||
#endif
|
||||
|
||||
ether_ifdetach(ifp);
|
||||
if_detach(ifp);
|
||||
|
||||
|
@ -1265,6 +1275,11 @@ int rtk_intr(arg)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rtl81x9var.h,v 1.15 2005/01/09 12:25:25 kanaoka Exp $ */
|
||||
/* $NetBSD: rtl81x9var.h,v 1.16 2005/01/23 10:26:06 dan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998
|
||||
|
@ -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
|
||||
|
||||
|
@ -143,6 +149,9 @@ struct rtk_softc {
|
|||
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 */
|
||||
|
|
Loading…
Reference in New Issue