diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-10-21 17:47:14 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-10-21 17:47:14 (GMT) |
commit | b9d965b01b42103389b2a2c0cc3133293447a64d (patch) | |
tree | 37b6f9738a07b9be8ea9c09b62b14c3286ff61bb /lib | |
parent | 3a96527f24a8727a88d0b4e66bca42a7db059b25 (diff) | |
download | libnl-b9d965b01b42103389b2a2c0cc3133293447a64d.zip libnl-b9d965b01b42103389b2a2c0cc3133293447a64d.tar.gz libnl-b9d965b01b42103389b2a2c0cc3133293447a64d.tar.bz2 |
Update include/linux header copies
Adapts ratespec code taking into account that the kernel now takes
care of overhead calculations.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/route/sch/htb.c | 26 | ||||
-rw-r--r-- | lib/route/sch/tbf.c | 3 | ||||
-rw-r--r-- | lib/route/tc.c | 10 |
3 files changed, 13 insertions, 26 deletions
diff --git a/lib/route/sch/htb.c b/lib/route/sch/htb.c index f45c2cf..c1651e7 100644 --- a/lib/route/sch/htb.c +++ b/lib/route/sch/htb.c @@ -119,8 +119,6 @@ static int htb_class_msg_parser(struct rtnl_class *class) d->ch_rbuffer = rtnl_tc_calc_bufsize(opts.buffer, opts.rate.rate); d->ch_cbuffer = rtnl_tc_calc_bufsize(opts.cbuffer, opts.ceil.rate); d->ch_quantum = opts.quantum; - d->ch_overhead = (opts.rate.mpu >> 8) & 0xff; - d->ch_mpu = opts.rate.mpu & 0xff; d->ch_mask = (SCH_HTB_HAS_PRIO | SCH_HTB_HAS_RATE | SCH_HTB_HAS_CEIL | SCH_HTB_HAS_RBUFFER | @@ -220,10 +218,10 @@ static void htb_class_dump_details(struct rtnl_class *class, nl_dump(p, " quantum %u", d->ch_quantum); if (d->ch_mask & SCH_HTB_HAS_OVERHEAD) - nl_dump(p, " overhead %u", d->ch_overhead); + nl_dump(p, " overhead %u", d->ch_rate.rs_overhead); if (d->ch_mask & SCH_HTB_HAS_MPU) - nl_dump(p, " mpu %u", d->ch_mpu); + nl_dump(p, " mpu %u", d->ch_rate.rs_mpu); } static struct nl_msg *htb_qdisc_get_opts(struct rtnl_qdisc *qdisc) @@ -270,7 +268,6 @@ static struct nl_msg *htb_class_get_opts(struct rtnl_class *class) struct tc_htb_opt opts; struct nl_msg *msg; int buffer, cbuffer; - uint8_t overhead = 0, mpu = 0; if (d == NULL) return NULL; @@ -321,23 +318,14 @@ static struct nl_msg *htb_class_get_opts(struct rtnl_class *class) if (d->ch_mask & SCH_HTB_HAS_QUANTUM) opts.quantum = d->ch_quantum; - if (d->ch_mask & SCH_HTB_HAS_OVERHEAD) - overhead = d->ch_overhead; - - if (d->ch_mask & SCH_HTB_HAS_MPU) - mpu = d->ch_mpu; - - opts.rate.mpu = mpu | (overhead << 8); - opts.ceil.mpu = mpu | (overhead << 8); - nla_put(msg, TCA_HTB_PARMS, sizeof(opts), &opts); - rtnl_tc_build_rate_table(rtable, mpu, overhead, + rtnl_tc_build_rate_table(rtable, d->ch_rate.rs_mpu, 1 << opts.rate.cell_log, opts.rate.rate); nla_put(msg, TCA_HTB_RTAB, sizeof(rtable), &rtable); - rtnl_tc_build_rate_table(ctable, mpu, overhead, + rtnl_tc_build_rate_table(ctable, d->ch_ceil.rs_mpu, 1 << opts.ceil.cell_log, opts.ceil.rate); nla_put(msg, TCA_HTB_CTAB, sizeof(ctable), &ctable); @@ -491,7 +479,8 @@ void rtnl_htb_set_overhead(struct rtnl_class *class, uint8_t overhead) if (d == NULL) return; - d->ch_overhead = overhead; + d->ch_rate.rs_overhead = overhead; + d->ch_ceil.rs_overhead = overhead; d->ch_mask |= SCH_HTB_HAS_OVERHEAD; } @@ -506,7 +495,8 @@ void rtnl_htb_set_mpu(struct rtnl_class *class, uint8_t mpu) if (d == NULL) return; - d->ch_mpu = mpu; + d->ch_rate.rs_mpu = mpu; + d->ch_ceil.rs_mpu = mpu; d->ch_mask |= SCH_HTB_HAS_MPU; } diff --git a/lib/route/sch/tbf.c b/lib/route/sch/tbf.c index eccaf70..b749a36 100644 --- a/lib/route/sch/tbf.c +++ b/lib/route/sch/tbf.c @@ -174,7 +174,7 @@ static struct nl_msg *tbf_get_opts(struct rtnl_qdisc *qdisc) tbf->qt_rate.rs_mpu = tbf->qt_mpu; rtnl_rcopy_ratespec(&opts.rate, &tbf->qt_rate); - rtnl_tc_build_rate_table(rtab, tbf->qt_mpu & 0xff, tbf->qt_mpu >> 8, + rtnl_tc_build_rate_table(rtab, tbf->qt_mpu & 0xff, 1 << tbf->qt_rate.rs_cell_log, tbf->qt_rate.rs_rate); @@ -184,7 +184,6 @@ static struct nl_msg *tbf_get_opts(struct rtnl_qdisc *qdisc) rtnl_rcopy_ratespec(&opts.peakrate, &tbf->qt_peakrate); rtnl_tc_build_rate_table(ptab, tbf->qt_mpu & 0xff, - tbf->qt_mpu >> 8, 1 << tbf->qt_peakrate.rs_cell_log, tbf->qt_peakrate.rs_rate); } diff --git a/lib/route/tc.c b/lib/route/tc.c index 9d85801..1860c6f 100644 --- a/lib/route/tc.c +++ b/lib/route/tc.c @@ -191,7 +191,7 @@ void tca_dump_line(struct rtnl_tca *g, const char *type, link_cache = nl_cache_mngt_require("route/link"); - nl_dump_line(p, "%s %s ", g->tc_kind, type); + nl_dump_line(p, "%s %s ", type, g->tc_kind); if (link_cache) { char buf[32]; @@ -201,7 +201,7 @@ void tca_dump_line(struct rtnl_tca *g, const char *type, } else nl_dump(p, "dev %u ", g->tc_ifindex); - nl_dump(p, "handle %s parent %s", + nl_dump(p, "id %s parent %s", rtnl_tc_handle2str(g->tc_handle, handle, sizeof(handle)), rtnl_tc_handle2str(g->tc_parent, parent, sizeof(parent))); } @@ -432,7 +432,6 @@ int rtnl_tc_calc_cell_log(int cell_size) * Compute a transmission time lookup table * @arg dst Destination buffer of RTNL_TC_RTABLE_SIZE uint32_t[]. * @arg mpu Minimal size of a packet at all times. - * @arg overhead Overhead to be added to each packet. * @arg cell Size of cell, i.e. size of step between entries in bytes. * @arg rate Rate in bytes per second. * @@ -443,8 +442,7 @@ int rtnl_tc_calc_cell_log(int cell_size) * txtime = table[pktsize >> log2(cell)]; * @endcode */ -int rtnl_tc_build_rate_table(uint32_t *dst, uint8_t mpu, uint8_t overhead, - int cell, int rate) +int rtnl_tc_build_rate_table(uint32_t *dst, uint8_t mpu, int cell, int rate) { int i, size, cell_log; @@ -453,7 +451,7 @@ int rtnl_tc_build_rate_table(uint32_t *dst, uint8_t mpu, uint8_t overhead, return cell_log; for (i = 0; i < RTNL_TC_RTABLE_SIZE; i++) { - size = (i << cell_log) + overhead; + size = (i << cell_log); if (size < mpu) size = mpu; |