View | Details | Raw Unified | Return to bug 220677 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/netinet/cc/cc_newreno.c (-1 / +45 lines)
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);
(-)b/sys/netinet/tcp_input.c (+5 lines)
Lines 181-186 SYSCTL_INT(_net_inet_tcp, OID_AUTO, abc_l_var, CTLFLAG_VNET | CTLFLAG_RW, Link Here
181
    &VNET_NAME(tcp_abc_l_var), 2,
181
    &VNET_NAME(tcp_abc_l_var), 2,
182
    "Cap the max cwnd increment during slow-start to this number of segments");
182
    "Cap the max cwnd increment during slow-start to this number of segments");
183
183
184
VNET_DEFINE(int, tcp_do_abe) = 0;
185
SYSCTL_INT(_net_inet_tcp, OID_AUTO, abe, CTLFLAG_VNET | CTLFLAG_RW,
186
    &VNET_NAME(tcp_do_abe), 0,
187
    "Enable ABE for NewReno (Alternative Backoff with ECN)");
188
184
static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, ecn, CTLFLAG_RW, 0, "TCP ECN");
189
static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, ecn, CTLFLAG_RW, 0, "TCP ECN");
185
190
186
VNET_DEFINE(int, tcp_do_ecn) = 2;
191
VNET_DEFINE(int, tcp_do_ecn) = 2;
(-)b/sys/netinet/tcp_var.h (+2 lines)
Lines 708-713 VNET_DECLARE(int, tcp_recvspace); Link Here
708
VNET_DECLARE(int, path_mtu_discovery);
708
VNET_DECLARE(int, path_mtu_discovery);
709
VNET_DECLARE(int, tcp_do_rfc3465);
709
VNET_DECLARE(int, tcp_do_rfc3465);
710
VNET_DECLARE(int, tcp_abc_l_var);
710
VNET_DECLARE(int, tcp_abc_l_var);
711
VNET_DECLARE(int, tcp_do_abe);
711
#define	V_tcb			VNET(tcb)
712
#define	V_tcb			VNET(tcb)
712
#define	V_tcbinfo		VNET(tcbinfo)
713
#define	V_tcbinfo		VNET(tcbinfo)
713
#define	V_tcp_mssdflt		VNET(tcp_mssdflt)
714
#define	V_tcp_mssdflt		VNET(tcp_mssdflt)
Lines 720-725 VNET_DECLARE(int, tcp_abc_l_var); Link Here
720
#define	V_path_mtu_discovery	VNET(path_mtu_discovery)
721
#define	V_path_mtu_discovery	VNET(path_mtu_discovery)
721
#define	V_tcp_do_rfc3465	VNET(tcp_do_rfc3465)
722
#define	V_tcp_do_rfc3465	VNET(tcp_do_rfc3465)
722
#define	V_tcp_abc_l_var		VNET(tcp_abc_l_var)
723
#define	V_tcp_abc_l_var		VNET(tcp_abc_l_var)
724
#define	V_tcp_do_abe		VNET(tcp_do_abe)
723
725
724
VNET_DECLARE(int, tcp_do_sack);			/* SACK enabled/disabled */
726
VNET_DECLARE(int, tcp_do_sack);			/* SACK enabled/disabled */
725
VNET_DECLARE(int, tcp_sc_rst_sock_fail);	/* RST on sock alloc failure */
727
VNET_DECLARE(int, tcp_sc_rst_sock_fail);	/* RST on sock alloc failure */

Return to bug 220677