[Devel] [PATCH rh7] net_sched: restore "mpu xxx" handling

Kirill Tkhai ktkhai at odin.com
Wed Jul 29 08:55:24 PDT 2015


commit 56b765b79 ("htb: improved accuracy at high rates")
broke the "mpu xxx" handling.

This patch restores the "mpu xxx" handling for htb:

# tc class add dev eth0 classid 1:2 parent 1: htb rate 1mbit mpu 0
# ping -f -c 1000 10.30.22.52
rtt min/avg/max/mdev = 0.156/1.881/2.454/0.175 ms, ipg/ewma 1.908/1.925 ms

# tc class change dev eth0 classid 1:2 parent 1: htb rate 1mbit mpu 1000
# ping -f -c 1000 10.30.22.52
rtt min/avg/max/mdev = 15.352/22.229/38.646/2.212 ms, pipe 3, ipg/ewma 15.999/22.609 ms

https://jira.sw.ru/browse/PSBM-34874

Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
---
 include/net/sch_generic.h |    4 ++++
 net/sched/sch_htb.c       |    4 ++++
 2 files changed, 8 insertions(+)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f4eb365..afa899a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -688,11 +688,15 @@ struct psched_ratecfg {
 	u16	overhead;
 	u8	linklayer;
 	u8	shift;
+	u32	mpu;
 };
 
 static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
 				unsigned int len)
 {
+	if (len < r->mpu)
+		len = r->mpu;
+
 	len += r->overhead;
 
 	if (unlikely(r->linklayer == TC_LINKLAYER_ATM))
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 863846c..b8e22ef 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1109,6 +1109,8 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
 	opt.buffer = PSCHED_NS2TICKS(cl->buffer);
 	psched_ratecfg_getrate(&opt.ceil, &cl->ceil);
 	opt.cbuffer = PSCHED_NS2TICKS(cl->cbuffer);
+	opt.rate.mpu = cl->rate.mpu;
+	opt.ceil.mpu = cl->ceil.mpu;
 	opt.quantum = cl->quantum;
 	opt.prio = cl->prio;
 	opt.level = cl->level;
@@ -1493,6 +1495,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
 
 	psched_ratecfg_precompute(&cl->rate, &hopt->rate);
 	psched_ratecfg_precompute(&cl->ceil, &hopt->ceil);
+	cl->rate.mpu = hopt->rate.mpu;
+	cl->ceil.mpu = hopt->ceil.mpu;
 
 	cl->buffer = PSCHED_TICKS2NS(hopt->buffer);
 	cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer);




More information about the Devel mailing list