62#include <sys/kernel.h>
63#include <sys/malloc.h>
64#include <sys/module.h>
65#include <sys/socket.h>
68#include <sys/socketvar.h>
69#include <sys/sysctl.h>
75#include <net/route/nhop.h>
101#define V_newreno_beta VNET(newreno_beta)
103#define V_newreno_beta_ecn VNET(newreno_beta_ecn)
146 memset(&log, 0,
sizeof(log));
166 0, &log,
false, &tv);
173 return (
sizeof(
struct newreno));
183 ccv->
cc_data = malloc(
sizeof(
struct newreno), M_CC_MEM, M_NOWAIT);
225 u_int cw =
CCV(ccv, snd_cwnd);
226 u_int incr =
CCV(ccv, t_maxseg);
255 if (cw >
CCV(ccv, snd_ssthresh)) {
269 ccv->
flags &= ~CCF_ABC_SENTAWND;
273 incr = max((incr * incr / cw), 1);
328 if (
CCV(ccv, snd_nxt) ==
CCV(ccv, snd_max))
330 ccv->
nsegs * abc_val *
343 CCV(ccv, snd_cwnd) = min(cw + incr,
344 TCP_MAXWIN <<
CCV(ccv, snd_scale));
375 cwin =
CCV(ccv, snd_cwnd);
395 (
"%s: congestion signal type 0x%08x is private\n", __func__, type));
397 cwin = max(((uint64_t)cwin * (uint64_t)factor) / (100ULL * (uint64_t)mss),
411 CCV(ccv, snd_ssthresh) =
412 ((uint64_t)
CCV(ccv, snd_ssthresh) *
416 CCV(ccv, snd_ssthresh) = cwin;
428 CCV(ccv, snd_ssthresh) = cwin;
429 CCV(ccv, snd_cwnd) = cwin;
434 CCV(ccv, snd_ssthresh) = max(min(
CCV(ccv, snd_wnd),
435 CCV(ccv, snd_cwnd)) / 2 / mss,
437 CCV(ccv, snd_cwnd) = mss;
452 return (ENOPROTOOPT);
456 switch (sopt->sopt_dir) {
469 return (ENOPROTOOPT);
475 opt->
val = (nreno == NULL) ?
479 opt->
val = (nreno == NULL) ?
483 return (ENOPROTOOPT);
500 error = sysctl_handle_int(oidp, &
new, 0, req);
501 if (error == 0 && req->newptr != NULL ) {
502 if (arg1 == &VNET_NAME(newreno_beta_ecn) && !
V_cc_do_abe)
504 else if (
new == 0 ||
new > 100)
542 CCV(ccv, snd_ssthresh) =
CCV(ccv, snd_cwnd);
589 CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
590 "New Reno related settings");
593 CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
595 "New Reno beta, specified as number between 1 and 100");
598 CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
600 "New Reno beta ecn, specified as number between 1 and 100");
uint32_t hystart_css_growth_div
uint32_t hystart_maxrtt_thresh
uint32_t hystart_css_rounds
void newreno_cc_post_recovery(struct cc_var *ccv)
uint32_t hystart_minrtt_thresh
uint32_t hystart_n_rttsamples
void newreno_cc_after_idle(struct cc_var *ccv)
#define V_cc_abe_frlossreduce
#define CCF_USE_LOCAL_ABC
#define CCF_HYSTART_CAN_SH_CWND
#define CCF_HYSTART_ALLOWED
#define CCF_HYSTART_CONS_SSTH
static void newreno_log_hystart_event(struct cc_var *ccv, struct newreno *nreno, uint8_t mod, uint32_t flex1)
static int newreno_cb_init(struct cc_var *ccv, void *)
static void newreno_ack_received(struct cc_var *ccv, uint16_t type)
static int newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf)
VNET_DECLARE(uint32_t, newreno_beta)
SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, &VNET_NAME(newreno_beta), 3, &newreno_beta_handler, "IU", "New Reno beta, specified as number between 1 and 100")
struct cc_algo newreno_cc_algo
static void newreno_cb_destroy(struct cc_var *ccv)
static size_t newreno_data_sz(void)
DECLARE_CC_MODULE(newreno, &newreno_cc_algo)
SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, newreno, CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, "New Reno related settings")
static void newreno_rttsample(struct cc_var *ccv, uint32_t usec_rtt, uint32_t rxtcnt, uint32_t fas)
static void newreno_newround(struct cc_var *ccv, uint32_t round_cnt)
VNET_DEFINE(uint32_t, newreno_beta_ecn)
SYSCTL_DECL(_net_inet_tcp_cc_newreno)
static void newreno_after_idle(struct cc_var *ccv)
static int newreno_beta_handler(SYSCTL_HANDLER_ARGS)
#define V_newreno_beta_ecn
static void newreno_cong_signal(struct cc_var *ccv, uint32_t type)
MODULE_VERSION(newreno, 2)
#define CC_NEWRENO_HYSTART_ENABLED
#define CC_NEWRENO_HYSTART_IN_CSS
#define CC_NEWRENO_BETA_ECN
#define CC_NEWRENO_BETA_ECN_ENABLED
#define INP_WLOCK_ASSERT(inp)
char name[TCP_CA_NAME_MAX]
union cc_var::ccv_container ccvc
struct socket * inp_socket
uint32_t css_current_round
uint32_t css_lastround_minrtt
uint32_t css_baseline_minrtt
uint32_t css_fas_at_css_entry
uint32_t css_current_round_minrtt
uint32_t css_rttsample_count
uint32_t css_entered_at_round
static __inline uint32_t tcp_get_usecs(struct timeval *tv)
#define TCP_LOG_EVENTP(tp, th, rxbuf, txbuf, eventid, errornum, len, stackinfo, th_hostorder, tv)
u_int tcp_fixed_maxseg(const struct tcpcb *tp)
#define IN_CONGRECOVERY(t_flags)
#define IN_FASTRECOVERY(t_flags)
#define IN_RECOVERY(t_flags)
#define ENTER_RECOVERY(t_flags)
#define ENTER_CONGRECOVERY(t_flags)