Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/net/lib/libshmif shmif: reduce the number of calls ...



details:   https://anonhg.NetBSD.org/src/rev/cfc774afa94e
branches:  trunk
changeset: 745201:cfc774afa94e
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Feb 25 03:26:18 2020 +0000

description:
shmif: reduce the number of calls of cprng(9)

diffstat:

 sys/rump/net/lib/libshmif/if_shmem.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 9d4c59d66708 -r cfc774afa94e sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c      Tue Feb 25 03:25:36 2020 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c      Tue Feb 25 03:26:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_shmem.c,v 1.80 2020/02/25 03:25:36 ozaki-r Exp $    */
+/*     $NetBSD: if_shmem.c,v 1.81 2020/02/25 03:26:18 ozaki-r Exp $    */
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.80 2020/02/25 03:25:36 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.81 2020/02/25 03:26:18 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -163,16 +163,16 @@
        uint8_t enaddr[ETHER_ADDR_LEN] = { 0xb2, 0xa0, 0x00, 0x00, 0x00, 0x00 };
        struct shmif_sc *sc;
        struct ifnet *ifp;
-       uint32_t randnum;
+       uint64_t randnum;
        int error;
 
-       randnum = cprng_strong32();
-       memcpy(&enaddr[2], &randnum, sizeof(randnum));
+       randnum = cprng_strong64();
+       memcpy(&enaddr[2], &randnum, 4);
 
        sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
        sc->sc_memfd = -1;
        sc->sc_unit = unit;
-       sc->sc_uid = cprng_strong64();
+       sc->sc_uid = randnum;
 
        ifp = &sc->sc_ec.ec_if;
 



Home | Main Index | Thread Index | Old Index