Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/cc/cc_hd.c
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
#include <netinet/tcp_var.h> | #include <netinet/tcp_var.h> | ||||
#include <netinet/cc/cc.h> | #include <netinet/cc/cc.h> | ||||
#include <netinet/cc/cc_module.h> | #include <netinet/cc/cc_module.h> | ||||
#include <netinet/khelp/h_ertt.h> | #include <netinet/khelp/h_ertt.h> | ||||
#define CAST_PTR_INT(X) (*((int*)(X))) | #define CAST_PTR_INT(X) (*((int*)(X))) | ||||
/* Largest possible number returned by random(). */ | /* Largest possible number returned by arc4random(). */ | ||||
#define RANDOM_MAX INT_MAX | #define RANDOM_MAX UINT_MAX | ||||
cem: Ditto earlier | |||||
static void hd_ack_received(struct cc_var *ccv, uint16_t ack_type); | static void hd_ack_received(struct cc_var *ccv, uint16_t ack_type); | ||||
static int hd_mod_init(void); | static int hd_mod_init(void); | ||||
static int ertt_id; | static int ertt_id; | ||||
static VNET_DEFINE(uint32_t, hd_qthresh) = 20; | static VNET_DEFINE(uint32_t, hd_qthresh) = 20; | ||||
static VNET_DEFINE(uint32_t, hd_qmin) = 5; | static VNET_DEFINE(uint32_t, hd_qmin) = 5; | ||||
Show All 22 Lines | should_backoff(int qdly, int maxqdly) | ||||
} else { | } else { | ||||
if (qdly > V_hd_qthresh) | if (qdly > V_hd_qthresh) | ||||
p = (((RANDOM_MAX / 100) * V_hd_pmax) / | p = (((RANDOM_MAX / 100) * V_hd_pmax) / | ||||
(maxqdly - V_hd_qthresh)) * (maxqdly - qdly); | (maxqdly - V_hd_qthresh)) * (maxqdly - qdly); | ||||
else | else | ||||
p = (RANDOM_MAX / 100) * V_hd_pmax; | p = (RANDOM_MAX / 100) * V_hd_pmax; | ||||
} | } | ||||
return (random() < p); | return (arc4random() < p); | ||||
Not Done Inline ActionsDitto cem: Ditto | |||||
} | } | ||||
/* | /* | ||||
* If the ack type is CC_ACK, and the inferred queueing delay is greater than | * If the ack type is CC_ACK, and the inferred queueing delay is greater than | ||||
* the Qmin threshold, cwnd is reduced probabilistically. When backing off due | * the Qmin threshold, cwnd is reduced probabilistically. When backing off due | ||||
* to delay, HD behaves like NewReno when an ECN signal is received. HD behaves | * to delay, HD behaves like NewReno when an ECN signal is received. HD behaves | ||||
* as NewReno in all other circumstances. | * as NewReno in all other circumstances. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |
Ditto earlier