Skip to content
  • Michael S. Tsirkin's avatar
    hwrng: core - document the quality field · fae29f13
    Michael S. Tsirkin authored
    quality field is currently documented as being 'per mill'.  In fact the
    math involved is:
    
                    add_hwgenerator_randomness((void *)rng_fillbuf, rc,
                                               rc * current_quality * 8 >> 10);
    
    thus the actual definition is "bits of entropy per 1024 bits of input".
    
    The current documentation seems to have confused multiple people
    in the past, let's fix the documentation to match code.
    
    An alternative is to change core to match driver expectations, replacing
    	rc * current_quality * 8 >> 10
    with
    	rc * current_quality / 1000
    but that has performance costs, so probably isn't a good option.
    
    Fixes: 0f734e6e
    
     ("hwrng: add per-device entropy derating")
    Reported-by: default avatar"Dr. David Alan Gilbert" <dgilbert@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    fae29f13