NetBSD-Bugs archive

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

Re: kern/34507: bge(4) doesn't contribute to the rnd pool



The following reply was made to PR kern/34507; it has been noted by GNATS.

From: Michael van Elst <mlelstv%serpens.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/34507: bge(4) doesn't contribute to the rnd pool
Date: Sat, 23 Feb 2008 11:38:26 +0100

 The same is true for wm(4) where the code was explicitely disabled
 until some performance measurement could be done.
 
 I also don't know what data in the driver could be considered
 random. The status word, which is used by other drivers, is almost
 always a constant when an interrupt occurs.
 
 Maybe this:
 
 
 Index: if_bge.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/if_bge.c,v
 retrieving revision 1.145
 diff -u -r1.145 if_bge.c
 --- if_bge.c   7 Feb 2008 01:21:55 -0000       1.145
 +++ if_bge.c   23 Feb 2008 10:37:12 -0000
 @@ -83,6 +83,7 @@
  
  #include "bpfilter.h"
  #include "vlan.h"
 +#include "rnd.h"
  
  #include <sys/param.h>
  #include <sys/systm.h>
 @@ -100,6 +101,10 @@
  #include <net/if_media.h>
  #include <net/if_ether.h>
  
 +#if NRND > 0
 +#include <sys/rnd.h>
 +#endif
 +
  #ifdef INET
  #include <netinet/in.h>
  #include <netinet/in_systm.h>
 @@ -2745,6 +2750,10 @@
        if_attach(ifp);
        DPRINTFN(5, ("ether_ifattach\n"));
        ether_ifattach(ifp, eaddr);
 +#if NRND > 0
 +      rnd_attach_source(&sc->rnd_source, device_xname(sc->bge_dev),
 +              RND_TYPE_NET, 0);
 +#endif
  #ifdef BGE_EVENT_COUNTERS
        /*
         * Attach event counters.
 @@ -2971,6 +2980,11 @@
        tosync = sc->bge_rdata->bge_status_block.bge_idx[0].bge_rx_prod_idx -
            sc->bge_rx_saved_considx;
  
 +#if NRND > 0
 +      if (RND_ENABLED(&sc->rnd_source))
 +              rnd_add_uint32(&sc->rnd_source, tosync);
 +#endif
 +
        toff = offset + (sc->bge_rx_saved_considx * sizeof (struct bge_rx_bd));
  
        if (tosync < 0) {
 @@ -3124,6 +3138,11 @@
        tosync = sc->bge_rdata->bge_status_block.bge_idx[0].bge_tx_cons_idx -
            sc->bge_tx_saved_considx;
  
 +#if NRND > 0
 +      if (RND_ENABLED(&sc->rnd_source))
 +              rnd_add_uint32(&sc->rnd_source, tosync);
 +#endif
 +
        toff = offset + (sc->bge_tx_saved_considx * sizeof (struct bge_tx_bd));
  
        if (tosync < 0) {
 Index: if_bgereg.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/if_bgereg.h,v
 retrieving revision 1.45
 diff -u -r1.45 if_bgereg.h
 --- if_bgereg.h        9 Dec 2007 20:28:08 -0000       1.45
 +++ if_bgereg.h        23 Feb 2008 10:37:12 -0000
 @@ -2439,4 +2439,8 @@
        int                     bge_pending_rxintr_change;
        SLIST_HEAD(, txdmamap_pool_entry) txdma_list;
        struct txdmamap_pool_entry *txdma[BGE_TX_RING_CNT];
 +
 +#if NRND > 0
 +      rndsource_element_t     rnd_source;     /* random source */
 +#endif
  };
 -- 
                                 Michael van Elst
 Internet: mlelstv%serpens.de@localhost
                                 "A potential Snark may lurk in every tree."
 


Home | Main Index | Thread Index | Old Index