Module Name:    src
Committed By:   msaitoh
Date:           Sat Jun 15 04:00:17 UTC 2019

Modified Files:
        src/sys/dev/usb: if_urtwn.c if_urtwnvar.h

Log Message:
 Add rnd(9) support.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/usb/if_urtwnvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.69 src/sys/dev/usb/if_urtwn.c:1.70
--- src/sys/dev/usb/if_urtwn.c:1.69	Thu Mar  7 14:55:49 2019
+++ src/sys/dev/usb/if_urtwn.c	Sat Jun 15 04:00:17 2019
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v
 #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 @@ urtwn_attach(device_t parent, device_t s
 
 	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 @@ urtwn_detach(device_t self, int flags)
 	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 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
 	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))) {

Index: src/sys/dev/usb/if_urtwnvar.h
diff -u src/sys/dev/usb/if_urtwnvar.h:1.12 src/sys/dev/usb/if_urtwnvar.h:1.13
--- src/sys/dev/usb/if_urtwnvar.h:1.12	Fri Feb  1 03:20:35 2019
+++ src/sys/dev/usb/if_urtwnvar.h	Sat Jun 15 04:00:17 2019
@@ -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 @@ struct urtwn_softc {
 	bool				sc_running;
 
 	struct ieee80211_beacon_offsets sc_bo;
+	krndsource_t rnd_source;	/* random source */
 };
 
 #endif /* _IF_URTWNVAR_H_ */

Reply via email to