aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-06-02 09:55:05 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-03 01:22:35 -0400
commit01cb71d2d47b78354358e4bb938bb06323e17498 (patch)
tree76aee7a59adb57237616a87a6c23102f90eacd8f /net
parentc87a124a5d5e8cf8e21c4363c3372bcaf53ea190 (diff)
net_sched: restore "overhead xxx" handling
commit 56b765b79 ("htb: improved accuracy at high rates") broke the "overhead xxx" handling, as well as the "linklayer atm" attribute. tc class add ... htb rate X ceil Y linklayer atm overhead 10 This patch restores the "overhead xxx" handling, for htb, tbf and act_police The "linklayer atm" thing needs a separate fix. Reported-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Vimalkumar <j.vimal@gmail.com> Cc: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/act_police.c8
-rw-r--r--net/sched/sch_generic.c8
-rw-r--r--net/sched/sch_htb.c8
-rw-r--r--net/sched/sch_tbf.c8
4 files changed, 17 insertions, 15 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 823463adbd21..189e3c5b3d09 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -231,14 +231,14 @@ override:
231 } 231 }
232 if (R_tab) { 232 if (R_tab) {
233 police->rate_present = true; 233 police->rate_present = true;
234 psched_ratecfg_precompute(&police->rate, R_tab->rate.rate); 234 psched_ratecfg_precompute(&police->rate, &R_tab->rate);
235 qdisc_put_rtab(R_tab); 235 qdisc_put_rtab(R_tab);
236 } else { 236 } else {
237 police->rate_present = false; 237 police->rate_present = false;
238 } 238 }
239 if (P_tab) { 239 if (P_tab) {
240 police->peak_present = true; 240 police->peak_present = true;
241 psched_ratecfg_precompute(&police->peak, P_tab->rate.rate); 241 psched_ratecfg_precompute(&police->peak, &P_tab->rate);
242 qdisc_put_rtab(P_tab); 242 qdisc_put_rtab(P_tab);
243 } else { 243 } else {
244 police->peak_present = false; 244 police->peak_present = false;
@@ -376,9 +376,9 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
376 }; 376 };
377 377
378 if (police->rate_present) 378 if (police->rate_present)
379 opt.rate.rate = psched_ratecfg_getrate(&police->rate); 379 psched_ratecfg_getrate(&opt.rate, &police->rate);
380 if (police->peak_present) 380 if (police->peak_present)
381 opt.peakrate.rate = psched_ratecfg_getrate(&police->peak); 381 psched_ratecfg_getrate(&opt.peakrate, &police->peak);
382 if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt)) 382 if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt))
383 goto nla_put_failure; 383 goto nla_put_failure;
384 if (police->tcfp_result && 384 if (police->tcfp_result &&
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index eac7e0ee23c1..20224086cc28 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -898,14 +898,16 @@ void dev_shutdown(struct net_device *dev)
898 WARN_ON(timer_pending(&dev->watchdog_timer)); 898 WARN_ON(timer_pending(&dev->watchdog_timer));
899} 899}
900 900
901void psched_ratecfg_precompute(struct psched_ratecfg *r, u32 rate) 901void psched_ratecfg_precompute(struct psched_ratecfg *r,
902 const struct tc_ratespec *conf)
902{ 903{
903 u64 factor; 904 u64 factor;
904 u64 mult; 905 u64 mult;
905 int shift; 906 int shift;
906 907
907 r->rate_bps = (u64)rate << 3; 908 memset(r, 0, sizeof(*r));
908 r->shift = 0; 909 r->overhead = conf->overhead;
910 r->rate_bps = (u64)conf->rate << 3;
909 r->mult = 1; 911 r->mult = 1;
910 /* 912 /*
911 * Calibrate mult, shift so that token counting is accurate 913 * Calibrate mult, shift so that token counting is accurate
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 79b1876b6cd2..f87fb850b7ef 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1090,9 +1090,9 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
1090 1090
1091 memset(&opt, 0, sizeof(opt)); 1091 memset(&opt, 0, sizeof(opt));
1092 1092
1093 opt.rate.rate = psched_ratecfg_getrate(&cl->rate); 1093 psched_ratecfg_getrate(&opt.rate, &cl->rate);
1094 opt.buffer = PSCHED_NS2TICKS(cl->buffer); 1094 opt.buffer = PSCHED_NS2TICKS(cl->buffer);
1095 opt.ceil.rate = psched_ratecfg_getrate(&cl->ceil); 1095 psched_ratecfg_getrate(&opt.ceil, &cl->ceil);
1096 opt.cbuffer = PSCHED_NS2TICKS(cl->cbuffer); 1096 opt.cbuffer = PSCHED_NS2TICKS(cl->cbuffer);
1097 opt.quantum = cl->quantum; 1097 opt.quantum = cl->quantum;
1098 opt.prio = cl->prio; 1098 opt.prio = cl->prio;
@@ -1459,8 +1459,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1459 cl->prio = TC_HTB_NUMPRIO - 1; 1459 cl->prio = TC_HTB_NUMPRIO - 1;
1460 } 1460 }
1461 1461
1462 psched_ratecfg_precompute(&cl->rate, hopt->rate.rate); 1462 psched_ratecfg_precompute(&cl->rate, &hopt->rate);
1463 psched_ratecfg_precompute(&cl->ceil, hopt->ceil.rate); 1463 psched_ratecfg_precompute(&cl->ceil, &hopt->ceil);
1464 1464
1465 cl->buffer = PSCHED_TICKS2NS(hopt->buffer); 1465 cl->buffer = PSCHED_TICKS2NS(hopt->buffer);
1466 cl->cbuffer = PSCHED_TICKS2NS(hopt->buffer); 1466 cl->cbuffer = PSCHED_TICKS2NS(hopt->buffer);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index c8388f3c3426..e478d316602b 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -298,9 +298,9 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
298 q->tokens = q->buffer; 298 q->tokens = q->buffer;
299 q->ptokens = q->mtu; 299 q->ptokens = q->mtu;
300 300
301 psched_ratecfg_precompute(&q->rate, rtab->rate.rate); 301 psched_ratecfg_precompute(&q->rate, &rtab->rate);
302 if (ptab) { 302 if (ptab) {
303 psched_ratecfg_precompute(&q->peak, ptab->rate.rate); 303 psched_ratecfg_precompute(&q->peak, &ptab->rate);
304 q->peak_present = true; 304 q->peak_present = true;
305 } else { 305 } else {
306 q->peak_present = false; 306 q->peak_present = false;
@@ -350,9 +350,9 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
350 goto nla_put_failure; 350 goto nla_put_failure;
351 351
352 opt.limit = q->limit; 352 opt.limit = q->limit;
353 opt.rate.rate = psched_ratecfg_getrate(&q->rate); 353 psched_ratecfg_getrate(&opt.rate, &q->rate);
354 if (q->peak_present) 354 if (q->peak_present)
355 opt.peakrate.rate = psched_ratecfg_getrate(&q->peak); 355 psched_ratecfg_getrate(&opt.peakrate, &q->peak);
356 else 356 else
357 memset(&opt.peakrate, 0, sizeof(opt.peakrate)); 357 memset(&opt.peakrate, 0, sizeof(opt.peakrate));
358 opt.mtu = PSCHED_NS2TICKS(q->mtu); 358 opt.mtu = PSCHED_NS2TICKS(q->mtu);