[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1392366970-11592-7-git-send-email-yangyingliang@huawei.com>
Date: Fri, 14 Feb 2014 16:36:09 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <netdev@...r.kernel.org>
CC: <davem@...emloft.net>, <stephen@...workplumber.org>
Subject: [PATCH net-next 6/7] sch_netem: clear old rate when old qdisc's replaced
If we set a netem qdisc with rate option, while we
use "#tc qdisc replace ..." that without rate option
to replace the old qdisc, the old rate is still there.
We need clear old rate after qdisc's replaced.
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
net/sched/sch_netem.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 2f630e9..92f6ba6 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -752,6 +752,15 @@ static void get_rate(struct netem_sched_data *q, const struct nlattr *attr)
q->cell_size_reciprocal = (struct reciprocal_value) { 0 };
}
+static void rate_reset(struct netem_sched_data *q)
+{
+ q->rate = 0;
+ q->packet_overhead = 0;
+ q->cell_size = 0;
+ q->cell_size_reciprocal = (struct reciprocal_value) { 0 };
+ q->cell_overhead = 0;
+}
+
static int get_loss_clg(struct netem_sched_data *q, const struct nlattr *attr)
{
const struct nlattr *la;
@@ -918,6 +927,8 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt)
if (tb[TCA_NETEM_RATE])
get_rate(q, tb[TCA_NETEM_RATE]);
+ else
+ rate_reset(q);
if (tb[TCA_NETEM_RATE64])
q->rate = max_t(u64, q->rate,
--
1.8.0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists