Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen Actually mix samples into the kernel RNG pool. ...
details: https://anonhg.NetBSD.org/src/rev/df4d69144f3c
branches: trunk
changeset: 569976:df4d69144f3c
user: tls <tls%NetBSD.org@localhost>
date: Wed Sep 15 04:55:21 2004 +0000
description:
Actually mix samples into the kernel RNG pool. There's a buglet here: all
disk samples are reported as belonging to the first disk.
diffstat:
sys/arch/xen/include/if_xennetvar.h | 5 ++++-
sys/arch/xen/include/xbdvar.h | 5 ++++-
sys/arch/xen/xen/if_xennet.c | 14 +++++++++++---
sys/arch/xen/xen/xbd.c | 26 +++++++++++++++++++++++---
4 files changed, 42 insertions(+), 8 deletions(-)
diffs (165 lines):
diff -r c9c9675ca0a9 -r df4d69144f3c sys/arch/xen/include/if_xennetvar.h
--- a/sys/arch/xen/include/if_xennetvar.h Wed Sep 15 03:24:09 2004 +0000
+++ b/sys/arch/xen/include/if_xennetvar.h Wed Sep 15 04:55:21 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xennetvar.h,v 1.2 2004/04/24 17:35:27 cl Exp $ */
+/* $NetBSD: if_xennetvar.h,v 1.3 2004/09/15 04:55:21 tls Exp $ */
/*
*
@@ -82,6 +82,9 @@
union xennet_bufarray sc_rx_bufa[TX_RING_SIZE];
SLIST_HEAD(, xennet_txbuf) sc_tx_bufs;
+#if NRND > 0
+ rndsource_element_t sc_rnd_source;
+#endif
};
struct xennet_attach_args {
diff -r c9c9675ca0a9 -r df4d69144f3c sys/arch/xen/include/xbdvar.h
--- a/sys/arch/xen/include/xbdvar.h Wed Sep 15 03:24:09 2004 +0000
+++ b/sys/arch/xen/include/xbdvar.h Wed Sep 15 04:55:21 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xbdvar.h,v 1.5 2004/05/07 14:15:11 cl Exp $ */
+/* $NetBSD: xbdvar.h,v 1.6 2004/09/15 04:55:21 tls Exp $ */
/*
*
@@ -42,6 +42,9 @@
struct dk_intf *sc_di; /* pseudo-disk interface */
struct simplelock sc_slock; /* our lock */
int sc_shutdown; /* about to be removed */
+#if NRND > 0
+ rndsource_element_t rnd_source;
+#endif
};
struct xbd_attach_args {
diff -r c9c9675ca0a9 -r df4d69144f3c sys/arch/xen/xen/if_xennet.c
--- a/sys/arch/xen/xen/if_xennet.c Wed Sep 15 03:24:09 2004 +0000
+++ b/sys/arch/xen/xen/if_xennet.c Wed Sep 15 04:55:21 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xennet.c,v 1.10 2004/05/14 14:23:35 cl Exp $ */
+/* $NetBSD: if_xennet.c,v 1.11 2004/09/15 04:55:21 tls Exp $ */
/*
*
@@ -33,9 +33,10 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet.c,v 1.10 2004/05/14 14:23:35 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet.c,v 1.11 2004/09/15 04:55:21 tls Exp $");
#include "opt_inet.h"
+#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -257,7 +258,7 @@
ether_sprintf(sc->sc_enaddr));
#if NRND > 0
- rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
+ rnd_attach_source(&sc->sc_rnd_source, sc->sc_dev.dv_xname,
RND_TYPE_NET, 0);
#endif
@@ -333,6 +334,10 @@
network_tx_buf_gc(sc);
+#if NRND > 0
+ rnd_add_uint32(&sc->sc_rnd_source, sc->sc_rx_resp_cons);
+#endif
+
again:
for (ringidx = sc->sc_rx_resp_cons;
ringidx != sc->sc_net_idx->rx_resp_prod;
@@ -590,6 +595,9 @@
panic("%s: No packet to start", sc->sc_dev.dv_xname);
#endif
+#if NRND > 0
+ rnd_add_uint32(&sc->sc_rnd_source, sc->sc_net_idx->tx_req_prod);
+#endif
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
return;
diff -r c9c9675ca0a9 -r df4d69144f3c sys/arch/xen/xen/xbd.c
--- a/sys/arch/xen/xen/xbd.c Wed Sep 15 03:24:09 2004 +0000
+++ b/sys/arch/xen/xen/xbd.c Wed Sep 15 04:55:21 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xbd.c,v 1.9 2004/05/10 01:39:39 cl Exp $ */
+/* $NetBSD: xbd.c,v 1.10 2004/09/15 04:55:21 tls Exp $ */
/*
*
@@ -33,9 +33,10 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd.c,v 1.9 2004/05/10 01:39:39 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd.c,v 1.10 2004/09/15 04:55:21 tls Exp $");
#include "xbd.h"
+#include "rnd.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -61,6 +62,10 @@
#include <uvm/uvm.h>
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
+
#include <dev/dkvar.h>
#include <machine/xbdvar.h>
#include <machine/xen.h>
@@ -704,6 +709,10 @@
NULL, 0, &xs->sc_xd_device, 0,
CTL_CREATE, CTL_EOL);
}
+#if NRND > 0
+ rnd_attach_source(&xs->rnd_source, xs->sc_dev.dv_xname,
+ RND_TYPE_DISK, 0);
+#endif
}
static int
@@ -927,9 +936,15 @@
unmap_align(pxr);
PUT_XBDREQ(pxr);
if (xs)
+ {
disk_unbusy(&xs->sc_dksc.sc_dkdev,
(bp->b_bcount - bp->b_resid),
(bp->b_flags & B_READ));
+#if NRND > 0
+ rnd_add_uint32(&xs->rnd_source,
+ bp->b_blkno);
+#endif
+ }
biodone(bp);
}
continue;
@@ -1093,10 +1108,15 @@
unmap_align(pxr);
PUT_XBDREQ(pxr);
- if (xs)
+ if (xs) {
disk_unbusy(&xs->sc_dksc.sc_dkdev,
(bp->b_bcount - bp->b_resid),
(bp->b_flags & B_READ));
+#if NRND > 0
+ rnd_add_uint32(&xs->rnd_source,
+ bp->b_blkno);
+#endif
+ }
biodone(bp);
if (!SIMPLEQ_EMPTY(&xbdr_suspended))
xbdresume();
Home |
Main Index |
Thread Index |
Old Index