FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/hhook.h>
#include <sys/kernel.h>
#include <sys/khelp.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <net/vnet.h>
#include <net/route.h>
#include <net/route/nhop.h>
#include <netinet/in_pcb.h>
#include <netinet/tcp.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/cc/cc.h>
#include <netinet/cc/cc_module.h>
#include <netinet/khelp/h_ertt.h>
#include <vm/uma.h>
Go to the source code of this file.
Data Structures | |
struct | qdiff_sample |
struct | cdg |
Macros | |
#define | CDG_VERSION "0.1" |
#define | CC_CDG_DELAY 0x01000000 |
#define | RENO_BETA 50 |
#define | CDG_Q_EMPTY 1 |
#define | CDG_Q_RISING 2 |
#define | CDG_Q_FALLING 3 |
#define | CDG_Q_FULL 4 |
#define | CDG_Q_UNKNOWN 9999 |
#define | EXP_PREC 15 |
#define | MAXGRAD 5 |
#define | D_P_E 7 |
#define | V_cdg_alpha_inc VNET(cdg_alpha_inc) |
#define | V_cdg_beta_delay VNET(cdg_beta_delay) |
#define | V_cdg_beta_loss VNET(cdg_beta_loss) |
#define | V_cdg_smoothing_factor VNET(cdg_smoothing_factor) |
#define | V_cdg_exp_backoff_scale VNET(cdg_exp_backoff_scale) |
#define | V_cdg_consec_cong VNET(cdg_consec_cong) |
#define | V_cdg_hold_backoff VNET(cdg_hold_backoff) |
Functions | |
__FBSDID ("$FreeBSD$") | |
VNET_DEFINE_STATIC (uint32_t, cdg_alpha_inc) | |
VNET_DEFINE_STATIC (uint32_t, cdg_beta_delay) | |
VNET_DEFINE_STATIC (uint32_t, cdg_beta_loss) | |
VNET_DEFINE_STATIC (uint32_t, cdg_smoothing_factor) | |
VNET_DEFINE_STATIC (uint32_t, cdg_exp_backoff_scale) | |
VNET_DEFINE_STATIC (uint32_t, cdg_consec_cong) | |
VNET_DEFINE_STATIC (uint32_t, cdg_hold_backoff) | |
static int | cdg_mod_init (void) |
static int | cdg_mod_destroy (void) |
static void | cdg_conn_init (struct cc_var *ccv) |
static int | cdg_cb_init (struct cc_var *ccv, void *ptr) |
static void | cdg_cb_destroy (struct cc_var *ccv) |
static void | cdg_cong_signal (struct cc_var *ccv, uint32_t signal_type) |
static void | cdg_ack_received (struct cc_var *ccv, uint16_t ack_type) |
static size_t | cdg_data_sz (void) |
static void | cdg_init_vnet (const void *unused __unused) |
static int | cdg_beta_handler (SYSCTL_HANDLER_ARGS) |
static int | cdg_exp_backoff_scale_handler (SYSCTL_HANDLER_ARGS) |
static uint32_t | cdg_window_decrease (struct cc_var *ccv, unsigned long owin, unsigned int beta) |
static void | cdg_window_increase (struct cc_var *ccv, int new_measurement) |
static int | prob_backoff (long qtrend) |
static void | calc_moving_average (struct cdg *cdg_data, long qdiff_max, long qdiff_min) |
VNET_SYSINIT (cdg_init_vnet, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, cdg_init_vnet, NULL) | |
SYSCTL_DECL (_net_inet_tcp_cc_cdg) | |
SYSCTL_NODE (_net_inet_tcp_cc, OID_AUTO, cdg, CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, "CAIA delay-gradient congestion control related settings") | |
SYSCTL_STRING (_net_inet_tcp_cc_cdg, OID_AUTO, version, CTLFLAG_RD, CDG_VERSION, sizeof(CDG_VERSION) - 1, "Current algorithm/implementation version number") | |
SYSCTL_UINT (_net_inet_tcp_cc_cdg, OID_AUTO, alpha_inc, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(cdg_alpha_inc), 0, "Increment the window increase factor alpha by 1 MSS segment every " "alpha_inc RTTs during congestion avoidance mode.") | |
SYSCTL_PROC (_net_inet_tcp_cc_cdg, OID_AUTO, beta_delay, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, &VNET_NAME(cdg_beta_delay), 70, &cdg_beta_handler, "IU", "Delay-based window decrease factor as a percentage " "(on delay-based backoff, w = w * beta_delay / 100)") | |
SYSCTL_PROC (_net_inet_tcp_cc_cdg, OID_AUTO, beta_loss, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, &VNET_NAME(cdg_beta_loss), 50, &cdg_beta_handler, "IU", "Loss-based window decrease factor as a percentage " "(on loss-based backoff, w = w * beta_loss / 100)") | |
SYSCTL_PROC (_net_inet_tcp_cc_cdg, OID_AUTO, exp_backoff_scale, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, &VNET_NAME(cdg_exp_backoff_scale), 2, &cdg_exp_backoff_scale_handler, "IU", "Scaling parameter for the probabilistic exponential backoff") | |
SYSCTL_UINT (_net_inet_tcp_cc_cdg, OID_AUTO, smoothing_factor, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(cdg_smoothing_factor), 8, "Number of samples used for moving average smoothing (0 = no smoothing)") | |
SYSCTL_UINT (_net_inet_tcp_cc_cdg, OID_AUTO, loss_compete_consec_cong, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(cdg_consec_cong), 5, "Number of consecutive delay-gradient based congestion episodes which will " "trigger loss based CC compatibility") | |
SYSCTL_UINT (_net_inet_tcp_cc_cdg, OID_AUTO, loss_compete_hold_backoff, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(cdg_hold_backoff), 5, "Number of consecutive delay-gradient based congestion episodes to hold " "the window backoff for loss based CC compatibility") | |
DECLARE_CC_MODULE (cdg, &cdg_cc_algo) | |
MODULE_VERSION (cdg, 2) | |
MODULE_DEPEND (cdg, ertt, 1, 1, 1) | |
Variables | |
static const int | probexp [641] |
static uma_zone_t | qdiffsample_zone |
static int | ertt_id |
struct cc_algo | cdg_cc_algo |
#define V_cdg_exp_backoff_scale VNET(cdg_exp_backoff_scale) |
__FBSDID | ( | "$FreeBSD$" | ) |
|
inlinestatic |
Definition at line 533 of file cc_cdg.c.
References cdg::max_qtrend, cdg::min_qtrend, qdiff_sample::qdiff, and qdiffsample_zone.
Referenced by cdg_ack_received().
Definition at line 577 of file cc_cdg.c.
References calc_moving_average(), CC_ACK, CC_CDG_DELAY, cc_var::cc_data, CCV, cdg_cong_signal(), CDG_Q_EMPTY, CDG_Q_FALLING, CDG_Q_FULL, CDG_Q_RISING, cdg_window_increase(), D_P_E, ertt_id, ERTT_NEW_MEASUREMENT, ertt::flags, IN_RECOVERY, cdg::max_qtrend, cdg::min_qtrend, prob_backoff(), ertt::rtt, V_cdg_consec_cong, and V_cdg_hold_backoff.
|
static |
Definition at line 342 of file cc_cdg.c.
References cc_var::cc_data, and qdiffsample_zone.
|
static |
Definition at line 296 of file cc_cdg.c.
References cc_var::cc_data, cc_var::ccvc, CDG_Q_UNKNOWN, INP_WLOCK_ASSERT, cdg::max_qtrend, cdg::min_qtrend, tcpcb::t_inpcb, cc_var::ccv_container::tcp, and V_cdg_smoothing_factor.
Definition at line 456 of file cc_cdg.c.
References CC_CDG_DELAY, cc_var::cc_data, CC_NDUPACK, CCV, CDG_Q_FULL, cdg_window_decrease(), ENTER_CONGRECOVERY, ENTER_RECOVERY, IN_CONGRECOVERY, newreno_cc_cong_signal(), RENO_BETA, V_cdg_beta_delay, and V_cdg_beta_loss.
Referenced by cdg_ack_received().
|
static |
Definition at line 330 of file cc_cdg.c.
References cc_var::cc_data, and CCV.
|
static |
|
static |
Definition at line 247 of file cc_cdg.c.
References V_cdg_alpha_inc, V_cdg_beta_delay, V_cdg_beta_loss, V_cdg_consec_cong, V_cdg_exp_backoff_scale, V_cdg_hold_backoff, and V_cdg_smoothing_factor.
Referenced by cdg_mod_init().
|
static |
Definition at line 282 of file cc_cdg.c.
References qdiffsample_zone.
|
static |
Definition at line 260 of file cc_cdg.c.
References cdg_init_vnet(), ertt_id, and qdiffsample_zone.
|
inlinestatic |
Definition at line 403 of file cc_cdg.c.
References CCV.
Referenced by cdg_cong_signal().
|
static |
Definition at line 417 of file cc_cdg.c.
References cc_var::cc_data, CCV, and V_cdg_alpha_inc.
Referenced by cdg_ack_received().
DECLARE_CC_MODULE | ( | cdg | , |
& | cdg_cc_algo | ||
) |
MODULE_VERSION | ( | cdg | , |
2 | |||
) |
|
inlinestatic |
Definition at line 511 of file cc_cdg.c.
References D_P_E, EXP_PREC, MAXGRAD, probexp, and V_cdg_exp_backoff_scale.
Referenced by cdg_ack_received().
SYSCTL_DECL | ( | _net_inet_tcp_cc_cdg | ) |
SYSCTL_NODE | ( | _net_inet_tcp_cc | , |
OID_AUTO | , | ||
cdg | , | ||
CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
"CAIA delay-gradient congestion control related settings" | |||
) |
SYSCTL_PROC | ( | _net_inet_tcp_cc_cdg | , |
OID_AUTO | , | ||
beta_delay | , | ||
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW| | CTLFLAG_NEEDGIANT, | ||
& | VNET_NAMEcdg_beta_delay, | ||
70 | , | ||
& | cdg_beta_handler, | ||
"IU" | , | ||
"Delay-based window decrease factor as a percentage " "(on delay-based backoff, w = w * beta_delay / 100)" | |||
) |
SYSCTL_PROC | ( | _net_inet_tcp_cc_cdg | , |
OID_AUTO | , | ||
beta_loss | , | ||
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW| | CTLFLAG_NEEDGIANT, | ||
& | VNET_NAMEcdg_beta_loss, | ||
50 | , | ||
& | cdg_beta_handler, | ||
"IU" | , | ||
"Loss-based window decrease factor as a percentage " "(on loss-based backoff, w = w * beta_loss / 100)" | |||
) |
SYSCTL_PROC | ( | _net_inet_tcp_cc_cdg | , |
OID_AUTO | , | ||
exp_backoff_scale | , | ||
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW| | CTLFLAG_NEEDGIANT, | ||
& | VNET_NAMEcdg_exp_backoff_scale, | ||
2 | , | ||
& | cdg_exp_backoff_scale_handler, | ||
"IU" | , | ||
"Scaling parameter for the probabilistic exponential backoff" | |||
) |
SYSCTL_STRING | ( | _net_inet_tcp_cc_cdg | , |
OID_AUTO | , | ||
version | , | ||
CTLFLAG_RD | , | ||
CDG_VERSION | , | ||
sizeof(CDG_VERSION) - | 1, | ||
"Current algorithm/implementation version number" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_cdg | , |
OID_AUTO | , | ||
alpha_inc | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEcdg_alpha_inc, | ||
0 | , | ||
"Increment the window increase factor alpha by 1 MSS segment every " "alpha_inc RTTs during congestion avoidance mode." | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_cdg | , |
OID_AUTO | , | ||
loss_compete_consec_cong | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEcdg_consec_cong, | ||
5 | , | ||
"Number of consecutive delay-gradient based congestion episodes which will " "trigger loss based CC compatibility" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_cdg | , |
OID_AUTO | , | ||
loss_compete_hold_backoff | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEcdg_hold_backoff, | ||
5 | , | ||
"Number of consecutive delay-gradient based congestion episodes to hold " "the window backoff for loss based CC compatibility" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_cc_cdg | , |
OID_AUTO | , | ||
smoothing_factor | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEcdg_smoothing_factor, | ||
8 | , | ||
"Number of samples used for moving average smoothing (0 = no smoothing)" | |||
) |
VNET_DEFINE_STATIC | ( | uint32_t | , |
cdg_alpha_inc | |||
) |
VNET_DEFINE_STATIC | ( | uint32_t | , |
cdg_beta_delay | |||
) |
VNET_DEFINE_STATIC | ( | uint32_t | , |
cdg_beta_loss | |||
) |
VNET_DEFINE_STATIC | ( | uint32_t | , |
cdg_consec_cong | |||
) |
VNET_DEFINE_STATIC | ( | uint32_t | , |
cdg_exp_backoff_scale | |||
) |
VNET_DEFINE_STATIC | ( | uint32_t | , |
cdg_hold_backoff | |||
) |
VNET_DEFINE_STATIC | ( | uint32_t | , |
cdg_smoothing_factor | |||
) |
VNET_SYSINIT | ( | cdg_init_vnet | , |
SI_SUB_PROTO_BEGIN | , | ||
SI_ORDER_FIRST | , | ||
cdg_init_vnet | , | ||
NULL | |||
) |
struct cc_algo cdg_cc_algo |
|
static |
Definition at line 204 of file cc_cdg.c.
Referenced by cdg_ack_received(), and cdg_mod_init().
|
static |
Definition at line 152 of file cc_cdg.c.
Referenced by prob_backoff().
|
static |
Definition at line 203 of file cc_cdg.c.
Referenced by calc_moving_average(), cdg_cb_destroy(), cdg_mod_destroy(), and cdg_mod_init().