diff options
author | Jamal Hadi Salim <jhs@mojatatu.com> | 2016-05-23 21:07:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-24 19:23:23 -0400 |
commit | 3d3ed18151172c845a11b7c184f2120220ae19fc (patch) | |
tree | ca17b8df54dc42069d3e6db143e6479d98439759 /net | |
parent | a9efad8b24bd22616f6c749a6c029957dc76542b (diff) |
net sched actions: policer missing timestamp processing
Policer was not dumping or updating timestamps
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/act_police.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 330f14e302e8..b884dae692a1 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -239,6 +239,8 @@ override: | |||
239 | police->tcfp_t_c = ktime_get_ns(); | 239 | police->tcfp_t_c = ktime_get_ns(); |
240 | police->tcf_index = parm->index ? parm->index : | 240 | police->tcf_index = parm->index ? parm->index : |
241 | tcf_hash_new_index(tn); | 241 | tcf_hash_new_index(tn); |
242 | police->tcf_tm.install = jiffies; | ||
243 | police->tcf_tm.lastuse = jiffies; | ||
242 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); | 244 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); |
243 | spin_lock_bh(&hinfo->lock); | 245 | spin_lock_bh(&hinfo->lock); |
244 | hlist_add_head(&police->tcf_head, &hinfo->htab[h]); | 246 | hlist_add_head(&police->tcf_head, &hinfo->htab[h]); |
@@ -268,6 +270,7 @@ static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a, | |||
268 | spin_lock(&police->tcf_lock); | 270 | spin_lock(&police->tcf_lock); |
269 | 271 | ||
270 | bstats_update(&police->tcf_bstats, skb); | 272 | bstats_update(&police->tcf_bstats, skb); |
273 | tcf_lastuse_update(&police->tcf_tm); | ||
271 | 274 | ||
272 | if (police->tcfp_ewma_rate && | 275 | if (police->tcfp_ewma_rate && |
273 | police->tcf_rate_est.bps >= police->tcfp_ewma_rate) { | 276 | police->tcf_rate_est.bps >= police->tcfp_ewma_rate) { |
@@ -327,6 +330,7 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
327 | .refcnt = police->tcf_refcnt - ref, | 330 | .refcnt = police->tcf_refcnt - ref, |
328 | .bindcnt = police->tcf_bindcnt - bind, | 331 | .bindcnt = police->tcf_bindcnt - bind, |
329 | }; | 332 | }; |
333 | struct tcf_t t; | ||
330 | 334 | ||
331 | if (police->rate_present) | 335 | if (police->rate_present) |
332 | psched_ratecfg_getrate(&opt.rate, &police->rate); | 336 | psched_ratecfg_getrate(&opt.rate, &police->rate); |
@@ -340,6 +344,13 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
340 | if (police->tcfp_ewma_rate && | 344 | if (police->tcfp_ewma_rate && |
341 | nla_put_u32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate)) | 345 | nla_put_u32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate)) |
342 | goto nla_put_failure; | 346 | goto nla_put_failure; |
347 | |||
348 | t.install = jiffies_to_clock_t(jiffies - police->tcf_tm.install); | ||
349 | t.lastuse = jiffies_to_clock_t(jiffies - police->tcf_tm.lastuse); | ||
350 | t.expires = jiffies_to_clock_t(police->tcf_tm.expires); | ||
351 | if (nla_put_64bit(skb, TCA_POLICE_TM, sizeof(t), &t, TCA_POLICE_PAD)) | ||
352 | goto nla_put_failure; | ||
353 | |||
343 | return skb->len; | 354 | return skb->len; |
344 | 355 | ||
345 | nla_put_failure: | 356 | nla_put_failure: |