Module Name: src
Committed By: rin
Date: Sun Jan 24 05:16:57 UTC 2021
Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c
Log Message:
Add rnd(9) support.
To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/powerpc/booke/dev/pq3etsec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.51 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.52
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.51 Sun Jan 24 05:14:55 2021
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c Sun Jan 24 05:16:56 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pq3etsec.c,v 1.51 2021/01/24 05:14:55 rin Exp $ */
+/* $NetBSD: pq3etsec.c,v 1.52 2021/01/24 05:16:56 rin Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.51 2021/01/24 05:14:55 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.52 2021/01/24 05:16:56 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -58,6 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v
#include <sys/callout.h>
#include <sys/sysctl.h>
+#include <sys/rndsource.h>
+
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_ether.h>
@@ -237,6 +239,8 @@ struct pq3etsec_softc {
int sc_ic_rx_count;
int sc_ic_tx_time;
int sc_ic_tx_count;
+
+ krndsource_t rnd_source;
};
#define ETSEC_IC_RX_ENABLED(sc) \
@@ -808,6 +812,9 @@ pq3etsec_attach(device_t parent, device_
if_deferred_start_init(ifp, NULL);
ether_ifattach(ifp, enaddr);
+ rnd_attach_source(&sc->rnd_source, xname, RND_TYPE_NET,
+ RND_FLAG_DEFAULT);
+
pq3etsec_ifstop(ifp, true);
evcnt_attach_dynamic(&sc->sc_ev_rx_stall, EVCNT_TYPE_MISC,
@@ -1714,6 +1721,9 @@ pq3etsec_rxq_consume(
KASSERT(rxq->rxq_mbufs[consumer - rxq->rxq_first] == rxq->rxq_mconsumer);
#endif
}
+
+ if (rxconsumed != 0)
+ rnd_add_uint32(&sc->rnd_source, rxconsumed);
}
static void
@@ -2261,6 +2271,9 @@ pq3etsec_txq_consume(
KASSERT(consumer < txq->txq_last);
}
}
+
+ if (txfree != 0)
+ rnd_add_uint32(&sc->rnd_source, txfree);
}
static void