Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Add rnd(9) support.



details:   https://anonhg.NetBSD.org/src/rev/735fe1f48474
branches:  trunk
changeset: 842076:735fe1f48474
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sat Jun 15 04:00:17 2019 +0000

description:
Add rnd(9) support.

diffstat:

 sys/dev/usb/if_urtwn.c    |  12 ++++++++++--
 sys/dev/usb/if_urtwnvar.h |   3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diffs (71 lines):

diff -r da0fd08aefa4 -r 735fe1f48474 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Sat Jun 15 02:00:21 2019 +0000
+++ b/sys/dev/usb/if_urtwn.c    Sat Jun 15 04:00:17 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwn.c,v 1.69 2019/03/07 14:55:49 christos Exp $   */
+/*     $NetBSD: if_urtwn.c,v 1.70 2019/06/15 04:00:17 msaitoh Exp $    */
 /*     $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $       */
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.69 2019/03/07 14:55:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.70 2019/06/15 04:00:17 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -42,6 +42,7 @@
 #include <sys/module.h>
 #include <sys/conf.h>
 #include <sys/device.h>
+#include <sys/rndsource.h>
 
 #include <sys/bus.h>
 #include <machine/endian.h>
@@ -512,6 +513,8 @@
 
        ifp->if_percpuq = if_percpuq_create(ifp);
        if_register(ifp);
+       rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
+           RND_TYPE_NET, RND_FLAG_DEFAULT);
 
        ieee80211_announce(ic);
 
@@ -546,6 +549,8 @@
        callout_halt(&sc->sc_scan_to, NULL);
        callout_halt(&sc->sc_calib_to, NULL);
 
+       pmf_device_deregister(self);
+
        if (ISSET(sc->sc_flags, URTWN_FLAG_ATTACHED)) {
                urtwn_stop(ifp, 0);
                usb_rem_task_wait(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER,
@@ -2505,6 +2510,9 @@
        DPRINTFN(DBG_RX, ("%s: %s: Rx %d frames in one chunk\n",
            device_xname(sc->sc_dev), __func__, npkts));
 
+       if (npkts != 0)
+               rnd_add_uint32(&sc->rnd_source, npkts);
+
        /* Process all of them. */
        while (npkts-- > 0) {
                if (__predict_false(len < (int)sizeof(*stat))) {
diff -r da0fd08aefa4 -r 735fe1f48474 sys/dev/usb/if_urtwnvar.h
--- a/sys/dev/usb/if_urtwnvar.h Sat Jun 15 02:00:21 2019 +0000
+++ b/sys/dev/usb/if_urtwnvar.h Sat Jun 15 04:00:17 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwnvar.h,v 1.12 2019/02/01 03:20:35 christos Exp $        */
+/*     $NetBSD: if_urtwnvar.h,v 1.13 2019/06/15 04:00:17 msaitoh Exp $ */
 /*     $OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $  */
 
 /*-
@@ -198,6 +198,7 @@
        bool                            sc_running;
 
        struct ieee80211_beacon_offsets sc_bo;
+       krndsource_t rnd_source;        /* random source */
 };
 
 #endif /* _IF_URTWNVAR_H_ */



Home | Main Index | Thread Index | Old Index