diff options
author | Kozlov Dmitry <dima@server> | 2010-11-07 17:28:17 +0300 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-11-07 17:28:17 +0300 |
commit | 0791b410d7465e2ef70345261d45340e3504381d (patch) | |
tree | d96435c998f5e3258007b7ed74ed87ed2eabd439 /accel-pptpd | |
parent | 1efd8533f1bc0630b0219b700265916d6f38ab01 (diff) | |
download | accel-ppp-0791b410d7465e2ef70345261d45340e3504381d.tar.gz accel-ppp-0791b410d7465e2ef70345261d45340e3504381d.zip |
shaper: separated burst factor configuration (down-burst-factor, up-burst-factor)
Diffstat (limited to 'accel-pptpd')
-rw-r--r-- | accel-pptpd/accel-pptp.conf | 3 | ||||
-rw-r--r-- | accel-pptpd/extra/shaper_tbf.c | 21 |
2 files changed, 18 insertions, 6 deletions
diff --git a/accel-pptpd/accel-pptp.conf b/accel-pptpd/accel-pptp.conf index 16a84feb..f6b43aac 100644 --- a/accel-pptpd/accel-pptp.conf +++ b/accel-pptpd/accel-pptp.conf @@ -99,5 +99,6 @@ verbose=1 [tbf] #attr=Filter-Id -#burst_factor=0.1 +#down-burst-factor=0.1 +#up-burst-factor=1.0 #latency=50 diff --git a/accel-pptpd/extra/shaper_tbf.c b/accel-pptpd/extra/shaper_tbf.c index 970a72b5..984d59c7 100644 --- a/accel-pptpd/extra/shaper_tbf.c +++ b/accel-pptpd/extra/shaper_tbf.c @@ -38,7 +38,8 @@ static int conf_attr_down = 11; //Filter-Id static int conf_attr_up = 11; //Filter-Id static int conf_vendor = 0; #endif -static double conf_burst_factor = 0.1; +static double conf_down_burst_factor = 0.1; +static double conf_up_burst_factor = 1; static int conf_latency = 50; static int conf_mpu = 0; @@ -109,7 +110,7 @@ static int install_tbf(struct nl_sock *h, int ifindex, int speed, int burst) struct nl_msg *pmsg = NULL; uint32_t rtab[RTNL_TC_RTABLE_SIZE]; double rate = speed * 1000 / 8; - double bucket = burst ? burst : rate * conf_burst_factor; + double bucket = burst ? burst : rate * conf_down_burst_factor; struct tcmsg tchdr = { .tcm_family = AF_UNSPEC, @@ -215,7 +216,7 @@ static int install_filter(struct nl_sock *h, int ifindex, int speed, int burst) //double rate = speed*1000/8; //double bucket = rate*conf_burst_factor; double rate = speed * 1000 / 8; - double bucket = burst ? burst : rate * conf_burst_factor; + double bucket = burst ? burst : rate * conf_up_burst_factor; struct nl_msg *pmsg = NULL; struct nl_msg *msg = NULL; struct nl_msg *msg1 = NULL; @@ -758,9 +759,19 @@ static void __init init(void) #endif opt = conf_get_opt("tbf", "burst-factor"); - if (opt) - conf_burst_factor = strtod(opt, NULL); + if (opt) { + conf_down_burst_factor = strtod(opt, NULL); + conf_up_burst_factor = conf_down_burst_factor * 10; + } + opt = conf_get_opt("tbf", "down-burst-factor"); + if (opt) + conf_down_burst_factor = strtod(opt, NULL); + + opt = conf_get_opt("tbf", "up-burst-factor"); + if (opt) + conf_up_burst_factor = strtod(opt, NULL); + opt = conf_get_opt("tbf", "latency"); if (opt && atoi(opt) > 0) conf_latency = atoi(opt); |