View | Details | Raw Unified | Return to bug 277655
Collapse All | Expand All

(-)b/sys/netinet/cc/cc_cdg.c (-4 / +5 lines)
Lines 58-63 Link Here
58
#include <sys/malloc.h>
58
#include <sys/malloc.h>
59
#include <sys/module.h>
59
#include <sys/module.h>
60
#include <sys/queue.h>
60
#include <sys/queue.h>
61
#include <sys/prng.h>
61
#include <sys/socket.h>
62
#include <sys/socket.h>
62
#include <sys/socketvar.h>
63
#include <sys/socketvar.h>
63
#include <sys/sysctl.h>
64
#include <sys/sysctl.h>
Lines 309-315 cdg_cb_init(struct cc_var *ccv, void *ptr) Link Here
309
	cdg_data->queue_state = CDG_Q_UNKNOWN;
310
	cdg_data->queue_state = CDG_Q_UNKNOWN;
310
	cdg_data->maxrtt_in_rtt = 0;
311
	cdg_data->maxrtt_in_rtt = 0;
311
	cdg_data->maxrtt_in_prevrtt = 0;
312
	cdg_data->maxrtt_in_prevrtt = 0;
312
	cdg_data->minrtt_in_rtt = INT_MAX;
313
	cdg_data->minrtt_in_rtt = UINT_MAX;
313
	cdg_data->minrtt_in_prevrtt = 0;
314
	cdg_data->minrtt_in_prevrtt = 0;
314
	cdg_data->window_incr = 0;
315
	cdg_data->window_incr = 0;
315
	cdg_data->rtt_count = 0;
316
	cdg_data->rtt_count = 0;
Lines 520-527 prob_backoff(long qtrend) Link Here
520
			idx = qtrend;
521
			idx = qtrend;
521
522
522
		/* Backoff probability proportional to rate of queue growth. */
523
		/* Backoff probability proportional to rate of queue growth. */
523
		p = (INT_MAX / (1 << EXP_PREC)) * probexp[idx];
524
		p = (UINT_MAX / (1 << EXP_PREC)) * probexp[idx];
524
		backoff = (random() < p);
525
		backoff = (prng32() < p);
525
	}
526
	}
526
527
527
	return (backoff);
528
	return (backoff);
Lines 638-644 cdg_ack_received(struct cc_var *ccv, uint16_t ack_type) Link Here
638
		}
639
		}
639
640
640
		cdg_data->minrtt_in_prevrtt = cdg_data->minrtt_in_rtt;
641
		cdg_data->minrtt_in_prevrtt = cdg_data->minrtt_in_rtt;
641
		cdg_data->minrtt_in_rtt = INT_MAX;
642
		cdg_data->minrtt_in_rtt = UINT_MAX;
642
		cdg_data->maxrtt_in_prevrtt = cdg_data->maxrtt_in_rtt;
643
		cdg_data->maxrtt_in_prevrtt = cdg_data->maxrtt_in_rtt;
643
		cdg_data->maxrtt_in_rtt = 0;
644
		cdg_data->maxrtt_in_rtt = 0;
644
		e_t->flags &= ~ERTT_NEW_MEASUREMENT;
645
		e_t->flags &= ~ERTT_NEW_MEASUREMENT;
(-)b/sys/netinet/cc/cc_chd.c (-3 / +4 lines)
Lines 59-64 Link Here
59
#include <sys/limits.h>
59
#include <sys/limits.h>
60
#include <sys/malloc.h>
60
#include <sys/malloc.h>
61
#include <sys/module.h>
61
#include <sys/module.h>
62
#include <sys/prng.h>
62
#include <sys/queue.h>
63
#include <sys/queue.h>
63
#include <sys/socket.h>
64
#include <sys/socket.h>
64
#include <sys/socketvar.h>
65
#include <sys/socketvar.h>
Lines 86-93 Link Here
86
 */
87
 */
87
#define	CC_CHD_DELAY	0x02000000
88
#define	CC_CHD_DELAY	0x02000000
88
89
89
/* Largest possible number returned by random(). */
90
/* Largest possible number returned by prng32(). */
90
#define	RANDOM_MAX	INT_MAX
91
#define	RANDOM_MAX	UINT_MAX
91
92
92
static void	chd_ack_received(struct cc_var *ccv, uint16_t ack_type);
93
static void	chd_ack_received(struct cc_var *ccv, uint16_t ack_type);
93
static void	chd_cb_destroy(struct cc_var *ccv);
94
static void	chd_cb_destroy(struct cc_var *ccv);
Lines 162-168 should_backoff(int qdly, int maxqdly, struct chd *chd_data) Link Here
162
{
163
{
163
	unsigned long p, rand;
164
	unsigned long p, rand;
164
165
165
	rand = random();
166
	rand = prng32();
166
167
167
	if (qdly < V_chd_qthresh) {
168
	if (qdly < V_chd_qthresh) {
168
		chd_data->loss_compete = 0;
169
		chd_data->loss_compete = 0;
(-)b/sys/netinet/cc/cc_hd.c (-3 / +4 lines)
Lines 60-65 Link Here
60
#include <sys/limits.h>
60
#include <sys/limits.h>
61
#include <sys/malloc.h>
61
#include <sys/malloc.h>
62
#include <sys/module.h>
62
#include <sys/module.h>
63
#include <sys/prng.h>
63
#include <sys/queue.h>
64
#include <sys/queue.h>
64
#include <sys/socket.h>
65
#include <sys/socket.h>
65
#include <sys/socketvar.h>
66
#include <sys/socketvar.h>
Lines 78-85 Link Here
78
79
79
#include <netinet/khelp/h_ertt.h>
80
#include <netinet/khelp/h_ertt.h>
80
81
81
/* Largest possible number returned by random(). */
82
/* Largest possible number returned by prng32(). */
82
#define	RANDOM_MAX	INT_MAX
83
#define	RANDOM_MAX	UINT_MAX
83
84
84
static void	hd_ack_received(struct cc_var *ccv, uint16_t ack_type);
85
static void	hd_ack_received(struct cc_var *ccv, uint16_t ack_type);
85
static int	hd_mod_init(void);
86
static int	hd_mod_init(void);
Lines 129-135 should_backoff(int qdly, int maxqdly) Link Here
129
			p = (RANDOM_MAX / 100) * V_hd_pmax;
130
			p = (RANDOM_MAX / 100) * V_hd_pmax;
130
	}
131
	}
131
132
132
	return (random() < p);
133
	return (prng32() < p);
133
}
134
}
134
135
135
/*
136
/*

Return to bug 277655