diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-05-15 23:49:48 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-05-15 23:49:48 +0400 |
commit | d669038e70d2e3690423792e63b8179e44a7a340 (patch) | |
tree | 18dfc9e4ddcc9d11f0ff0b8cb9a82e4bb795af52 /accel-pppd/shaper/limiter.c | |
parent | 6efad618371915bf0b402f26117a02ad53aaeb20 (diff) | |
download | accel-ppp-d669038e70d2e3690423792e63b8179e44a7a340.tar.gz accel-ppp-d669038e70d2e3690423792e63b8179e44a7a340.zip |
shaper: implemented leaf qdisc attachment
Diffstat (limited to 'accel-pppd/shaper/limiter.c')
-rw-r--r-- | accel-pppd/shaper/limiter.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/accel-pppd/shaper/limiter.c b/accel-pppd/shaper/limiter.c index f368b331..92e343b7 100644 --- a/accel-pppd/shaper/limiter.c +++ b/accel-pppd/shaper/limiter.c @@ -21,22 +21,6 @@ #include "tc_core.h" #include "libnetlink.h" -#define TCA_BUF_MAX 64*1024 -#define MAX_MSG 16384 - -struct qdisc_opt -{ - char *kind; - int handle; - int parent; - double latency; - int rate; - int buffer; - int quantum; - int defcls; - int (*qdisc)(struct qdisc_opt *opt, struct nlmsghdr *n); -}; - static int qdisc_tbf(struct qdisc_opt *qopt, struct nlmsghdr *n) { struct tc_tbf_qopt opt; @@ -121,7 +105,7 @@ static int qdisc_htb_class(struct qdisc_opt *qopt, struct nlmsghdr *n) return 0; } -static int tc_qdisc_modify(struct rtnl_handle *rth, int ifindex, int cmd, unsigned flags, struct qdisc_opt *opt) +int tc_qdisc_modify(struct rtnl_handle *rth, int ifindex, int cmd, unsigned flags, struct qdisc_opt *opt) { struct { struct nlmsghdr n; @@ -446,13 +430,19 @@ int install_limiter(struct ppp_t *ppp, int down_speed, int down_burst, int up_sp if (conf_down_limiter == LIM_TBF) r = install_tbf(&rth, ppp->ifindex, down_speed, down_burst); - else + else { r = install_htb(&rth, ppp->ifindex, down_speed, down_burst); + if (r == 0) + r = install_leaf_qdisc(&rth, ppp->ifindex, 0x00010001, 0x00020000); + } if (conf_up_limiter == LIM_POLICE) r = install_police(&rth, ppp->ifindex, up_speed, up_burst); - else + else { r = install_htb_ifb(&rth, ppp->ifindex, ppp->unit_idx + 1, up_speed, up_burst); + if (r == 0) + r = install_leaf_qdisc(&rth, conf_ifb_ifindex, 0x00010001 + ppp->unit_idx + 1, (1 + ppp->unit_idx + 1) << 16); + } rtnl_close(&rth); |