Lines 48-53
Link Here
|
48 |
* http://caia.swin.edu.au/urp/newtcp/ |
48 |
* http://caia.swin.edu.au/urp/newtcp/ |
49 |
*/ |
49 |
*/ |
50 |
|
50 |
|
|
|
51 |
/* |
52 |
* Dec 2014 garmitage@swin.edu.au |
53 |
* Borrowed code fragments from cc_cdg.c to add modifiable beta |
54 |
* via sysctls. |
55 |
* |
56 |
*/ |
57 |
|
51 |
#include <sys/cdefs.h> |
58 |
#include <sys/cdefs.h> |
52 |
__FBSDID("$FreeBSD$"); |
59 |
__FBSDID("$FreeBSD$"); |
53 |
|
60 |
|
Lines 68-78
__FBSDID("$FreeBSD$");
Link Here
|
68 |
#include <netinet/cc/cc.h> |
75 |
#include <netinet/cc/cc.h> |
69 |
#include <netinet/cc/cc_module.h> |
76 |
#include <netinet/cc/cc_module.h> |
70 |
|
77 |
|
|
|
78 |
#define CAST_PTR_INT(X) (*((int*)(X))) |
79 |
|
80 |
#ifndef VIMAGE |
81 |
#define vnet_sysctl_handle_uint(oidp, arg1, arg2, req) \ |
82 |
sysctl_handle_int(oidp, arg1, arg2, req) |
83 |
#endif |
84 |
|
71 |
static void newreno_ack_received(struct cc_var *ccv, uint16_t type); |
85 |
static void newreno_ack_received(struct cc_var *ccv, uint16_t type); |
72 |
static void newreno_after_idle(struct cc_var *ccv); |
86 |
static void newreno_after_idle(struct cc_var *ccv); |
73 |
static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); |
87 |
static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); |
74 |
static void newreno_post_recovery(struct cc_var *ccv); |
88 |
static void newreno_post_recovery(struct cc_var *ccv); |
75 |
|
89 |
|
|
|
90 |
static VNET_DEFINE(uint32_t, newreno_beta_loss) = 50; |
91 |
static VNET_DEFINE(uint32_t, newreno_beta_ecn) = 80; |
92 |
#define V_newreno_beta_loss VNET(newreno_beta_loss) |
93 |
#define V_newreno_beta_ecn VNET(newreno_beta_ecn) |
94 |
|
76 |
struct cc_algo newreno_cc_algo = { |
95 |
struct cc_algo newreno_cc_algo = { |
77 |
.name = "newreno", |
96 |
.name = "newreno", |
78 |
.ack_received = newreno_ack_received, |
97 |
.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, |
214 |
KASSERT((type & CC_SIGPRIVMASK) == 0, |
196 |
("%s: congestion signal type 0x%08x is private\n", __func__, type)); |
215 |
("%s: congestion signal type 0x%08x is private\n", __func__, type)); |
197 |
|
216 |
|
198 |
cwin = max(cwin / 2 / mss, 2) * mss; |
|
|
199 |
|
217 |
|
200 |
switch (type) { |
218 |
switch (type) { |
201 |
case CC_NDUPACK: |
219 |
case CC_NDUPACK: |
|
|
220 |
if (V_tcp_do_abe) |
221 |
cwin = max((cwin * V_newreno_beta_loss)/100 / mss, 2) * mss; |
222 |
else |
223 |
cwin = max(cwin / 2 / mss, 2) * mss; |
224 |
|
202 |
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { |
225 |
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { |
203 |
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { |
226 |
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { |
204 |
CCV(ccv, snd_ssthresh) = ssthresh_on_loss; |
227 |
CCV(ccv, snd_ssthresh) = ssthresh_on_loss; |
Lines 208-213
newreno_cong_signal(struct cc_var *ccv, uint32_t type)
Link Here
|
208 |
} |
231 |
} |
209 |
break; |
232 |
break; |
210 |
case CC_ECN: |
233 |
case CC_ECN: |
|
|
234 |
if (V_tcp_do_abe) |
235 |
cwin = max((cwin * V_newreno_beta_ecn)/100 / mss, 2) * mss; |
236 |
else |
237 |
cwin = max(cwin / 2 / mss, 2) * mss; |
238 |
|
211 |
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { |
239 |
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { |
212 |
CCV(ccv, snd_ssthresh) = ssthresh_on_loss; |
240 |
CCV(ccv, snd_ssthresh) = ssthresh_on_loss; |
213 |
CCV(ccv, snd_cwnd) = cwin; |
241 |
CCV(ccv, snd_cwnd) = cwin; |
Lines 252-256
newreno_post_recovery(struct cc_var *ccv)
Link Here
|
252 |
} |
280 |
} |
253 |
} |
281 |
} |
254 |
|
282 |
|
|
|
283 |
static int |
284 |
newreno_beta_handler(SYSCTL_HANDLER_ARGS) |
285 |
{ |
286 |
if (req->newptr != NULL && |
287 |
(CAST_PTR_INT(req->newptr) <= 0 || CAST_PTR_INT(req->newptr) > 100)) |
288 |
return (EINVAL); |
289 |
|
290 |
return (vnet_sysctl_handle_uint(oidp, arg1, arg2, req)); |
291 |
} |
292 |
|
293 |
SYSCTL_DECL(_net_inet_tcp_cc_newreno); |
294 |
SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, newreno, CTLFLAG_RW, NULL, |
295 |
"New Reno related settings"); |
296 |
|
297 |
SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_loss, |
298 |
CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, |
299 |
&VNET_NAME(newreno_beta_loss), 3, &newreno_beta_handler, "IU", |
300 |
"newreno beta loss, specified as number between 0 and 100"); |
301 |
|
302 |
SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_ecn, |
303 |
CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, |
304 |
&VNET_NAME(newreno_beta_ecn), 3, &newreno_beta_handler, "IU", |
305 |
"newreno beta ecn, specified as number between 0 and 100"); |
255 |
|
306 |
|
256 |
DECLARE_CC_MODULE(newreno, &newreno_cc_algo); |
307 |
DECLARE_CC_MODULE(newreno, &newreno_cc_algo); |