[RFC v3 3/6] random: keep PRNG state in lcore variable
    Morten Brørup 
    mb at smartsharesystems.com
       
    Tue Feb 20 16:31:14 CET 2024
    
    
  
> From: Mattias Rönnblom [mailto:mattias.ronnblom at ericsson.com]
> Sent: Tuesday, 20 February 2024 09.49
> 
[...]
> @@ -124,11 +129,10 @@ struct rte_rand_state *__rte_rand_get_state(void)
> 
>  	idx = rte_lcore_id();
> 
> -	/* last instance reserved for unregistered non-EAL threads */
>  	if (unlikely(idx == LCORE_ID_ANY))
idx is now only used here, so you could get rid of it by comparing directly to rte_lcore_id() instead.
Minor detail only; don't spin the patch for it.
> -		idx = RTE_MAX_LCORE;
> +		return &unregistered_rand_state;
> 
> -	return &rand_states[idx];
> +	return RTE_LCORE_VAR_PTR(rand_state);
>  }
    
    
More information about the dev
mailing list