Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Sample # of RX packets as entropy source.



details:   https://anonhg.NetBSD.org/src/rev/b65441b46b43
branches:  trunk
changeset: 961902:b65441b46b43
user:      rin <rin%NetBSD.org@localhost>
date:      Sun Apr 25 05:16:26 2021 +0000

description:
Sample # of RX packets as entropy source.

diffstat:

 sys/dev/usb/if_smsc.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r 87fbc15215d8 -r b65441b46b43 sys/dev/usb/if_smsc.c
--- a/sys/dev/usb/if_smsc.c     Sun Apr 25 05:15:20 2021 +0000
+++ b/sys/dev/usb/if_smsc.c     Sun Apr 25 05:16:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_smsc.c,v 1.69 2020/06/27 13:33:26 jmcneill Exp $    */
+/*     $NetBSD: if_smsc.c,v 1.70 2021/04/25 05:16:26 rin Exp $ */
 
 /*     $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */
 /*     $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.69 2020/06/27 13:33:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.70 2021/04/25 05:16:26 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -918,13 +918,15 @@
 }
 
 static void
-smsc_uno_rx_loop(struct usbnet * un, struct usbnet_chain *c, uint32_t total_len)
+smsc_uno_rx_loop(struct usbnet *un, struct usbnet_chain *c, uint32_t total_len)
 {
        USMSCHIST_FUNC(); USMSCHIST_CALLED();
        struct smsc_softc * const sc = usbnet_softc(un);
        struct ifnet *ifp = usbnet_ifp(un);
        uint8_t *buf = c->unc_buf;
+       int count;
 
+       count = 0;
        DPRINTF("total_len %jd/%#jx", total_len, total_len, 0, 0);
        while (total_len != 0) {
                uint32_t rxhdr;
@@ -1045,7 +1047,12 @@
                /* push the packet up */
                usbnet_enqueue(un, pktbuf, buflen, csum_flags, csum_data,
                    mbuf_flags);
+
+               count++;
        }
+
+       if (count != 0)
+               rnd_add_uint32(usbnet_rndsrc(un), count);
 }
 
 static unsigned



Home | Main Index | Thread Index | Old Index