Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63862b5b authored by Aruna-Hewapathirane's avatar Aruna-Hewapathirane Committed by David S. Miller
Browse files

net: replace macros net_random and net_srandom with direct calls to prandom



This patch removes the net_random and net_srandom macros and replaces
them with direct calls to the prandom ones. As new commits only seem to
use prandom_u32 there is no use to keep them around.
This change makes it easier to grep for users of prandom_u32.

Signed-off-by: default avatarAruna-Hewapathirane <aruna.hewapathirane@gmail.com>
Suggested-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 825edac4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2310,7 +2310,7 @@ static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv)

	inet_get_local_port_range(&init_net, &low, &high);
	remaining = (high - low) + 1;
	rover = net_random() % remaining + low;
	rover = prandom_u32() % remaining + low;
retry:
	if (last_used_port != rover &&
	    !idr_find(ps, (unsigned short) rover)) {
+0 −3
Original line number Diff line number Diff line
@@ -245,9 +245,6 @@ do { \
#define net_dbg_ratelimited(fmt, ...)				\
	net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)

#define net_random()		prandom_u32()
#define net_srandom(seed)	prandom_seed((__force u32)(seed))

bool __net_get_random_once(void *buf, int nbytes, bool *done,
			   struct static_key *done_key);

+1 −1
Original line number Diff line number Diff line
@@ -303,7 +303,7 @@ static inline unsigned long red_calc_qavg(const struct red_parms *p,

static inline u32 red_random(const struct red_parms *p)
{
	return reciprocal_divide(net_random(), p->max_P_reciprocal);
	return reciprocal_divide(prandom_u32(), p->max_P_reciprocal);
}

static inline int red_mark_probability(const struct red_parms *p,
+1 −1
Original line number Diff line number Diff line
@@ -397,7 +397,7 @@ static void garp_join_timer_arm(struct garp_applicant *app)
{
	unsigned long delay;

	delay = (u64)msecs_to_jiffies(garp_join_time) * net_random() >> 32;
	delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32;
	mod_timer(&app->join_timer, jiffies + delay);
}

+1 −1
Original line number Diff line number Diff line
@@ -583,7 +583,7 @@ static void mrp_join_timer_arm(struct mrp_applicant *app)
{
	unsigned long delay;

	delay = (u64)msecs_to_jiffies(mrp_join_time) * net_random() >> 32;
	delay = (u64)msecs_to_jiffies(mrp_join_time) * prandom_u32() >> 32;
	mod_timer(&app->join_timer, jiffies + delay);
}

Loading