* [PATCH] net_sched: restore "mpu xxx" handling
@ 2015-07-29 11:24 Kirill Tkhai
2015-07-29 13:04 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Kirill Tkhai @ 2015-07-29 11:24 UTC (permalink / raw)
To: netdev; +Cc: Jesper Dangaard Brouer, Eric Dumazet, David S. Miller, tkhai
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
Signed-off-by: Kirill Tkhai <ktkhai@odin.com>
CC: Jesper Dangaard Brouer <brouer@redhat.com>
CC: Eric Dumazet <edumazet@google.com>
CC: David S. Miller <davem@davemloft.net>
---
include/net/sch_generic.h | 1 +
net/sched/sch_htb.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 2eab08c..0add26a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -756,6 +756,7 @@ struct psched_ratecfg {
u16 overhead;
u8 linklayer;
u8 shift;
+ u32 mpu;
};
static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index f1acb0f..7b9f283 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -608,6 +608,9 @@ static inline void htb_accnt_tokens(struct htb_class *cl, int bytes, s64 diff)
{
s64 toks = diff + cl->tokens;
+ if (bytes < cl->rate.mpu)
+ bytes = cl->rate.mpu;
+
if (toks > cl->buffer)
toks = cl->buffer;
toks -= (s64) psched_l2t_ns(&cl->rate, bytes);
@@ -621,6 +624,9 @@ static inline void htb_accnt_ctokens(struct htb_class *cl, int bytes, s64 diff)
{
s64 toks = diff + cl->ctokens;
+ if (bytes < cl->ceil.mpu)
+ bytes = cl->ceil.mpu;
+
if (toks > cl->cbuffer)
toks = cl->cbuffer;
toks -= (s64) psched_l2t_ns(&cl->ceil, bytes);
@@ -1112,8 +1118,10 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
memset(&opt, 0, sizeof(opt));
psched_ratecfg_getrate(&opt.rate, &cl->rate);
+ opt.rate.mpu = cl->rate.mpu;
opt.buffer = PSCHED_NS2TICKS(cl->buffer);
psched_ratecfg_getrate(&opt.ceil, &cl->ceil);
+ opt.ceil.mpu = cl->ceil.mpu;
opt.cbuffer = PSCHED_NS2TICKS(cl->cbuffer);
opt.quantum = cl->quantum;
opt.prio = cl->prio;
@@ -1484,6 +1492,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
psched_ratecfg_precompute(&cl->rate, &hopt->rate, rate64);
psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, ceil64);
+ cl->rate.mpu = hopt->rate.mpu;
+ cl->ceil.mpu = hopt->ceil.mpu;
/* it used to be a nasty bug here, we have to check that node
* is really leaf before changing cl->un.leaf !
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net_sched: restore "mpu xxx" handling
2015-07-29 11:24 [PATCH] net_sched: restore "mpu xxx" handling Kirill Tkhai
@ 2015-07-29 13:04 ` Eric Dumazet
2015-07-29 14:39 ` Kirill Tkhai
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2015-07-29 13:04 UTC (permalink / raw)
To: Kirill Tkhai
Cc: netdev, Jesper Dangaard Brouer, Eric Dumazet, David S. Miller,
tkhai
On Wed, 2015-07-29 at 14:24 +0300, Kirill Tkhai wrote:
> 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
Note this mpu option was completely broken a long time ago with GSO /
TSO anyway.
Note sure we really want it in this state ?
What is your use case ?
In any case, correct fix would be in psched_l2t_ns(), otherwise you fix
htb but not the other qdisc (tbf for that matter)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] net_sched: restore "mpu xxx" handling
2015-07-29 13:04 ` Eric Dumazet
@ 2015-07-29 14:39 ` Kirill Tkhai
0 siblings, 0 replies; 3+ messages in thread
From: Kirill Tkhai @ 2015-07-29 14:39 UTC (permalink / raw)
To: Eric Dumazet
Cc: netdev, Jesper Dangaard Brouer, Eric Dumazet, David S. Miller,
tkhai
On 29.07.2015 16:04, Eric Dumazet wrote:
> On Wed, 2015-07-29 at 14:24 +0300, Kirill Tkhai wrote:
>> 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
>
> Note this mpu option was completely broken a long time ago with GSO /
> TSO anyway.
>
> Note sure we really want it in this state ?
>
> What is your use case ?
It's a way to limit a number of small packets sent from inside container
(virtual enviroment).
Its ethernet card is virtual and it's possible to control the things like TSO,
and to turn it off.
We use that in 2.6.32. Now I'm working with 3.10 and found, that the interface
has been changed. The patch is similar the functionality, which we had before
commit 56b765b79.
Are there another alternatives?
> In any case, correct fix would be in psched_l2t_ns(), otherwise you fix
> htb but not the other qdisc (tbf for that matter)
Sure, I'm agree.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-29 14:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-29 11:24 [PATCH] net_sched: restore "mpu xxx" handling Kirill Tkhai
2015-07-29 13:04 ` Eric Dumazet
2015-07-29 14:39 ` Kirill Tkhai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).