diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2013-11-07 23:33:11 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-11-07 23:33:11 +0400 |
commit | bc536e14dc0334340d69e486ff1574b1d86fe3b8 (patch) | |
tree | f36fdc76266c05ca47eca3a759b370eec4516863 /accel-pppd/shaper | |
parent | 5ee3cf66bbe9b7f6197aab39417269ce95c3c95c (diff) | |
download | accel-ppp-bc536e14dc0334340d69e486ff1574b1d86fe3b8.tar.gz accel-ppp-bc536e14dc0334340d69e486ff1574b1d86fe3b8.zip |
shaper: add mtu option
Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
Diffstat (limited to 'accel-pppd/shaper')
-rw-r--r-- | accel-pppd/shaper/limiter.c | 7 | ||||
-rw-r--r-- | accel-pppd/shaper/shaper.c | 7 | ||||
-rw-r--r-- | accel-pppd/shaper/shaper.h | 1 |
3 files changed, 11 insertions, 4 deletions
diff --git a/accel-pppd/shaper/limiter.c b/accel-pppd/shaper/limiter.c index 9f89ba7..af1e3ba 100644 --- a/accel-pppd/shaper/limiter.c +++ b/accel-pppd/shaper/limiter.c @@ -25,7 +25,6 @@ static int qdisc_tbf(struct qdisc_opt *qopt, struct nlmsghdr *n) { struct tc_tbf_qopt opt; __u32 rtab[256]; - int mtu = 0; int Rcell_log = -1; unsigned int linklayer = LINKLAYER_ETHERNET; /* Assume ethernet */ struct rtattr *tail; @@ -35,7 +34,7 @@ static int qdisc_tbf(struct qdisc_opt *qopt, struct nlmsghdr *n) opt.rate.rate = qopt->rate; opt.limit = (double)qopt->rate * qopt->latency + qopt->buffer; opt.rate.mpu = conf_mpu; - if (tc_calc_rtable(&opt.rate, rtab, Rcell_log, mtu, linklayer) < 0) { + if (tc_calc_rtable(&opt.rate, rtab, Rcell_log, conf_mtu, linklayer) < 0) { log_ppp_error("shaper: failed to calculate rate table.\n"); return -1; } @@ -73,7 +72,7 @@ static int qdisc_htb_class(struct qdisc_opt *qopt, struct nlmsghdr *n) struct tc_htb_opt opt; __u32 rtab[256],ctab[256]; int cell_log=-1,ccell_log = -1; - unsigned mtu = 1600; + unsigned mtu = conf_mtu ? conf_mtu : 1600; unsigned int linklayer = LINKLAYER_ETHERNET; /* Assume ethernet */ struct rtattr *tail; @@ -190,7 +189,7 @@ static int install_police(struct rtnl_handle *rth, int ifindex, int rate, int bu __u32 rtab[256]; struct rtattr *tail, *tail1, *tail2, *tail3; int Rcell_log = -1; - int mtu = 0, flowid = 1; + int mtu = conf_mtu, flowid = 1; unsigned int linklayer = LINKLAYER_ETHERNET; /* Assume ethernet */ struct { diff --git a/accel-pppd/shaper/shaper.c b/accel-pppd/shaper/shaper.c index 7219d72..9594caf 100644 --- a/accel-pppd/shaper/shaper.c +++ b/accel-pppd/shaper/shaper.c @@ -36,6 +36,7 @@ double conf_down_burst_factor = 0.1; double conf_up_burst_factor = 1; double conf_latency = 0.05; int conf_mpu = 0; +int conf_mtu = 0; int conf_quantum = 1500; int conf_r2q = 10; int conf_cburst = 1534; @@ -898,6 +899,12 @@ static void load_config(void) if (opt && atoi(opt) >= 0) conf_mpu = atoi(opt); + opt = conf_get_opt("shaper", "mtu"); + if (opt) + conf_mtu = atoi(opt); + else + conf_mtu = 0; + opt = conf_get_opt("shaper", "r2q"); if (opt && atoi(opt) >= 0) conf_r2q = atoi(opt); diff --git a/accel-pppd/shaper/shaper.h b/accel-pppd/shaper/shaper.h index 6322a6b..4e6b9ff 100644 --- a/accel-pppd/shaper/shaper.h +++ b/accel-pppd/shaper/shaper.h @@ -30,6 +30,7 @@ extern double conf_down_burst_factor; extern double conf_up_burst_factor; extern double conf_latency; extern int conf_mpu; +extern int conf_mtu; extern int conf_quantum; extern int conf_r2q; extern int conf_cburst; |