提交 a883bf56 编写于 作者: J Jarek Poplawski 提交者: David S. Miller

pkt_sched: act_police: Fix a rate estimator test.

A commit c1b56878 "tc: policing requires
a rate estimator" introduced a test which invalidates previously working
configs, based on examples from iproute2: doc/actions/actions-general.
This is too rigorous: a rate estimator is needed only when police's
"avrate" option is used.
Reported-by: NJoao Correia <joaomiguelcorreia@gmail.com>
Diagnosed-by: NJohn Dykstra <john.dykstra1@gmail.com>
Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9f8ac0b7
......@@ -183,13 +183,6 @@ static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est,
if (R_tab == NULL)
goto failure;
if (!est && (ret == ACT_P_CREATED ||
!gen_estimator_active(&police->tcf_bstats,
&police->tcf_rate_est))) {
err = -EINVAL;
goto failure;
}
if (parm->peakrate.rate) {
P_tab = qdisc_get_rtab(&parm->peakrate,
tb[TCA_POLICE_PEAKRATE]);
......@@ -205,6 +198,12 @@ static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est,
&police->tcf_lock, est);
if (err)
goto failure_unlock;
} else if (tb[TCA_POLICE_AVRATE] &&
(ret == ACT_P_CREATED ||
!gen_estimator_active(&police->tcf_bstats,
&police->tcf_rate_est))) {
err = -EINVAL;
goto failure_unlock;
}
/* No failure allowed after this point */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册