teach bce(4) about being an rnd(4) source

This commit is contained in:
dan 2007-03-21 04:56:39 +00:00
parent ad0dc10411
commit ce901237e7

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bce.c,v 1.14 2007/03/04 06:02:19 christos Exp $ */
/* $NetBSD: if_bce.c,v 1.15 2007/03/21 04:56:39 dan Exp $ */
/*
* Copyright (c) 2003 Clifford Wright. All rights reserved.
@ -36,6 +36,7 @@
#include "bpfilter.h"
#include "vlan.h"
#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -55,6 +56,9 @@
#if NBPFILTER > 0
#include <net/bpf.h>
#endif
#if NRND > 0
#include <sys/rnd.h>
#endif
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@ -136,6 +140,9 @@ struct bce_softc {
int bce_txsfree; /* no. tx slots available */
int bce_txsnext; /* next available tx slot */
struct callout bce_timeout;
#if NRND > 0
rndsource_element_t rnd_source;
#endif
};
/* for ring descriptors */
@ -500,6 +507,10 @@ bce_attach(struct device *parent, struct device *self, void *aux)
printf("%s: Ethernet address %s\n", sc->bce_dev.dv_xname,
ether_sprintf(sc->enaddr));
ether_ifattach(ifp, sc->enaddr);
#if NRND > 0
rnd_attach_source(&sc->rnd_source, sc->bce_dev.dv_xname,
RND_TYPE_NET, 0);
#endif
callout_init(&sc->bce_timeout);
}
@ -745,6 +756,10 @@ bce_intr(void *xsc)
if (handled) {
if (wantinit)
bce_init(ifp);
#if NRND > 0
if (RND_ENABLED(&sc->rnd_source))
rnd_add_uint32(&sc->rnd_source, intstatus);
#endif
/* Try to get more packets going. */
bce_start(ifp);
}