aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_police.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/act_police.c')
-rw-r--r--net/sched/act_police.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 7ebf7439b478..b3b9b32f4e00 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -22,8 +22,8 @@
22#include <net/act_api.h> 22#include <net/act_api.h>
23#include <net/netlink.h> 23#include <net/netlink.h>
24 24
25#define L2T(p,L) qdisc_l2t((p)->tcfp_R_tab, L) 25#define L2T(p, L) qdisc_l2t((p)->tcfp_R_tab, L)
26#define L2T_P(p,L) qdisc_l2t((p)->tcfp_P_tab, L) 26#define L2T_P(p, L) qdisc_l2t((p)->tcfp_P_tab, L)
27 27
28#define POL_TAB_MASK 15 28#define POL_TAB_MASK 15
29static struct tcf_common *tcf_police_ht[POL_TAB_MASK + 1]; 29static struct tcf_common *tcf_police_ht[POL_TAB_MASK + 1];
@@ -37,8 +37,7 @@ static struct tcf_hashinfo police_hash_info = {
37}; 37};
38 38
39/* old policer structure from before tc actions */ 39/* old policer structure from before tc actions */
40struct tc_police_compat 40struct tc_police_compat {
41{
42 u32 index; 41 u32 index;
43 int action; 42 int action;
44 u32 limit; 43 u32 limit;
@@ -97,11 +96,6 @@ nla_put_failure:
97 goto done; 96 goto done;
98} 97}
99 98
100static void tcf_police_free_rcu(struct rcu_head *head)
101{
102 kfree(container_of(head, struct tcf_police, tcf_rcu));
103}
104
105static void tcf_police_destroy(struct tcf_police *p) 99static void tcf_police_destroy(struct tcf_police *p)
106{ 100{
107 unsigned int h = tcf_hash(p->tcf_index, POL_TAB_MASK); 101 unsigned int h = tcf_hash(p->tcf_index, POL_TAB_MASK);
@@ -122,7 +116,7 @@ static void tcf_police_destroy(struct tcf_police *p)
122 * gen_estimator est_timer() might access p->tcf_lock 116 * gen_estimator est_timer() might access p->tcf_lock
123 * or bstats, wait a RCU grace period before freeing p 117 * or bstats, wait a RCU grace period before freeing p
124 */ 118 */
125 call_rcu(&p->tcf_rcu, tcf_police_free_rcu); 119 kfree_rcu(p, tcf_rcu);
126 return; 120 return;
127 } 121 }
128 } 122 }
@@ -139,7 +133,7 @@ static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = {
139static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est, 133static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est,
140 struct tc_action *a, int ovr, int bind) 134 struct tc_action *a, int ovr, int bind)
141{ 135{
142 unsigned h; 136 unsigned int h;
143 int ret = 0, err; 137 int ret = 0, err;
144 struct nlattr *tb[TCA_POLICE_MAX + 1]; 138 struct nlattr *tb[TCA_POLICE_MAX + 1];
145 struct tc_police *parm; 139 struct tc_police *parm;
@@ -298,8 +292,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
298 292
299 spin_lock(&police->tcf_lock); 293 spin_lock(&police->tcf_lock);
300 294
301 police->tcf_bstats.bytes += qdisc_pkt_len(skb); 295 bstats_update(&police->tcf_bstats, skb);
302 police->tcf_bstats.packets++;
303 296
304 if (police->tcfp_ewma_rate && 297 if (police->tcfp_ewma_rate &&
305 police->tcf_rate_est.bps >= police->tcfp_ewma_rate) { 298 police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
@@ -403,7 +396,6 @@ static void __exit
403police_cleanup_module(void) 396police_cleanup_module(void)
404{ 397{
405 tcf_unregister_action(&act_police_ops); 398 tcf_unregister_action(&act_police_ops);
406 rcu_barrier(); /* Wait for completion of call_rcu()'s (tcf_police_free_rcu) */
407} 399}
408 400
409module_init(police_init_module); 401module_init(police_init_module);