Lines Matching defs:state
48 * @state: pointer to state structure holding seeded state.
53 u32 prandom_u32_state(struct rnd_state *state)
56 state->s1 = TAUSWORTHE(state->s1, 6U, 13U, 4294967294U, 18U);
57 state->s2 = TAUSWORTHE(state->s2, 2U, 27U, 4294967288U, 2U);
58 state->s3 = TAUSWORTHE(state->s3, 13U, 21U, 4294967280U, 7U);
59 state->s4 = TAUSWORTHE(state->s4, 3U, 12U, 4294967168U, 13U);
61 return (state->s1 ^ state->s2 ^ state->s3 ^ state->s4);
68 * @state: pointer to state structure holding seeded state.
75 void prandom_bytes_state(struct rnd_state *state, void *buf, size_t bytes)
80 put_unaligned(prandom_u32_state(state), (u32 *) ptr);
86 u32 rem = prandom_u32_state(state);
96 static void prandom_warmup(struct rnd_state *state)
99 prandom_u32_state(state);
100 prandom_u32_state(state);
101 prandom_u32_state(state);
102 prandom_u32_state(state);
103 prandom_u32_state(state);
104 prandom_u32_state(state);
105 prandom_u32_state(state);
106 prandom_u32_state(state);
107 prandom_u32_state(state);
108 prandom_u32_state(state);
116 struct rnd_state *state = per_cpu_ptr(pcpu_state, i);
120 state->s1 = __seed(seeds[0], 2U);
121 state->s2 = __seed(seeds[1], 8U);
122 state->s3 = __seed(seeds[2], 16U);
123 state->s4 = __seed(seeds[3], 128U);
125 prandom_warmup(state);
259 static void prandom_seed_early(struct rnd_state *state, u32 seed,
264 state->s1 = __seed(HWSEED() ^ LCG(seed), 2U);
265 state->s2 = __seed(HWSEED() ^ LCG(state->s1), 8U);
266 state->s3 = __seed(HWSEED() ^ LCG(state->s2), 16U);
267 state->s4 = __seed(HWSEED() ^ LCG(state->s3), 128U);
276 struct rnd_state state;
278 prandom_seed_early(&state, test1[i].seed, false);
279 prandom_warmup(&state);
281 if (test1[i].result != prandom_u32_state(&state))
291 struct rnd_state state;
293 prandom_seed_early(&state, test2[i].seed, false);
294 prandom_warmup(&state);
297 prandom_u32_state(&state);
299 if (test2[i].result != prandom_u32_state(&state))
387 struct siprand_state *state = get_cpu_ptr(&net_rand_state);
388 u32 res = siprand_u32(state);
402 struct siprand_state *state = get_cpu_ptr(&net_rand_state);
406 put_unaligned(siprand_u32(state), (u32 *)ptr);
412 u32 rem = siprand_u32(state);
439 struct siprand_state *state = per_cpu_ptr(&net_rand_state, i);
440 unsigned long v0 = state->v0, v1 = state->v1;
441 unsigned long v2 = state->v2, v3 = state->v3;
450 WRITE_ONCE(state->v0, v0);
451 WRITE_ONCE(state->v1, v1);
452 WRITE_ONCE(state->v2, v2);
453 WRITE_ONCE(state->v3, v3);
475 struct siprand_state *state;
482 state = per_cpu_ptr(&net_rand_state, i);
483 state->v0 = v0; state->v1 = v1;
484 state->v2 = v2; state->v3 = v3;
508 struct siprand_state *state;
532 * and the target CPU writing its state back could
535 * To ensure that never happens, ensure the state
538 state = per_cpu_ptr(&net_rand_state, i);
539 WRITE_ONCE(state->v0, v0 ? v0 : -1ul);
540 WRITE_ONCE(state->v1, v1 ? v1 : -1ul);
541 WRITE_ONCE(state->v2, v2 ? v2 : -1ul);
542 WRITE_ONCE(state->v3, v3 ? v3 : -1ul);