Lines 68-78
__FBSDID("$FreeBSD$");
Link Here
|
68 |
#include <netinet/cc/cc.h> |
68 |
#include <netinet/cc/cc.h> |
69 |
#include <netinet/cc/cc_module.h> |
69 |
#include <netinet/cc/cc_module.h> |
70 |
|
70 |
|
|
|
71 |
#define CAST_PTR_INT(X) (*((int*)(X))) |
72 |
|
73 |
#ifndef VIMAGE |
74 |
#define vnet_sysctl_handle_uint(oidp, arg1, arg2, req) \ |
75 |
sysctl_handle_int(oidp, arg1, arg2, req) |
76 |
#endif |
77 |
|
71 |
static void newreno_ack_received(struct cc_var *ccv, uint16_t type); |
78 |
static void newreno_ack_received(struct cc_var *ccv, uint16_t type); |
72 |
static void newreno_after_idle(struct cc_var *ccv); |
79 |
static void newreno_after_idle(struct cc_var *ccv); |
73 |
static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); |
80 |
static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); |
74 |
static void newreno_post_recovery(struct cc_var *ccv); |
81 |
static void newreno_post_recovery(struct cc_var *ccv); |
75 |
|
82 |
|
|
|
83 |
static VNET_DEFINE(uint32_t, newreno_beta_loss) = 50; |
84 |
static VNET_DEFINE(uint32_t, newreno_beta_ecn) = 80; |
85 |
#define V_newreno_beta_loss VNET(newreno_beta_loss) |
86 |
#define V_newreno_beta_ecn VNET(newreno_beta_ecn) |
87 |
|
76 |
struct cc_algo newreno_cc_algo = { |
88 |
struct cc_algo newreno_cc_algo = { |
77 |
.name = "newreno", |
89 |
.name = "newreno", |
78 |
.ack_received = newreno_ack_received, |
90 |
.ack_received = newreno_ack_received, |
Lines 195-204
newreno_cong_signal(struct cc_var *ccv, uint32_t type)
Link Here
|
195 |
KASSERT((type & CC_SIGPRIVMASK) == 0, |
207 |
KASSERT((type & CC_SIGPRIVMASK) == 0, |
196 |
("%s: congestion signal type 0x%08x is private\n", __func__, type)); |
208 |
("%s: congestion signal type 0x%08x is private\n", __func__, type)); |
197 |
|
209 |
|
198 |
cwin = max(cwin / 2 / mss, 2) * mss; |
|
|
199 |
|
210 |
|
200 |
switch (type) { |
211 |
switch (type) { |
201 |
case CC_NDUPACK: |
212 |
case CC_NDUPACK: |
|
|
213 |
if (V_tcp_do_abe) |
214 |
cwin = max((cwin * V_newreno_beta_loss)/100 / mss, 2) * mss; |
215 |
else |
216 |
cwin = max(cwin / 2 / mss, 2) * mss; |
217 |
|
202 |
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { |
218 |
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { |
203 |
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { |
219 |
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { |
204 |
CCV(ccv, snd_ssthresh) = ssthresh_on_loss; |
220 |
CCV(ccv, snd_ssthresh) = ssthresh_on_loss; |
Lines 208-213
newreno_cong_signal(struct cc_var *ccv, uint32_t type)
Link Here
|
208 |
} |
224 |
} |
209 |
break; |
225 |
break; |
210 |
case CC_ECN: |
226 |
case CC_ECN: |
|
|
227 |
if (V_tcp_do_abe) |
228 |
cwin = max((cwin * V_newreno_beta_ecn)/100 / mss, 2) * mss; |
229 |
else |
230 |
cwin = max(cwin / 2 / mss, 2) * mss; |
231 |
|
211 |
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { |
232 |
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { |
212 |
CCV(ccv, snd_ssthresh) = ssthresh_on_loss; |
233 |
CCV(ccv, snd_ssthresh) = ssthresh_on_loss; |
213 |
CCV(ccv, snd_cwnd) = cwin; |
234 |
CCV(ccv, snd_cwnd) = cwin; |
Lines 252-256
newreno_post_recovery(struct cc_var *ccv)
Link Here
|
252 |
} |
273 |
} |
253 |
} |
274 |
} |
254 |
|
275 |
|
|
|
276 |
static int |
277 |
newreno_beta_handler(SYSCTL_HANDLER_ARGS) |
278 |
{ |
279 |
if (req->newptr != NULL && |
280 |
(CAST_PTR_INT(req->newptr) <= 0 || CAST_PTR_INT(req->newptr) > 100)) |
281 |
return (EINVAL); |
282 |
|
283 |
return (vnet_sysctl_handle_uint(oidp, arg1, arg2, req)); |
284 |
} |
285 |
|
286 |
SYSCTL_DECL(_net_inet_tcp_cc_newreno); |
287 |
SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, newreno, CTLFLAG_RW, NULL, |
288 |
"New Reno related settings"); |
289 |
|
290 |
SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_loss, |
291 |
CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, |
292 |
&VNET_NAME(newreno_beta_loss), 3, &newreno_beta_handler, "IU", |
293 |
"newreno beta loss, specified as number between 0 and 100"); |
294 |
|
295 |
SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_ecn, |
296 |
CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, |
297 |
&VNET_NAME(newreno_beta_ecn), 3, &newreno_beta_handler, "IU", |
298 |
"newreno beta ecn, specified as number between 0 and 100"); |
255 |
|
299 |
|
256 |
DECLARE_CC_MODULE(newreno, &newreno_cc_algo); |
300 |
DECLARE_CC_MODULE(newreno, &newreno_cc_algo); |