Skip to content

Commit b5ac851

Browse files
Roman Mashakdavem330
authored andcommitted
net_sched: allow flushing tc police actions
The act_police uses its own code to walk the action hashtable, which leads to that we could not flush standalone tc police actions, so just switch to tcf_generic_walker() like other actions. (Joint work from Roman and Cong.) Signed-off-by: Roman Mashak <mrv@mojatatu.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0852e45 commit b5ac851

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

net/sched/act_police.c

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -63,49 +63,8 @@ static int tcf_act_police_walker(struct net *net, struct sk_buff *skb,
6363
const struct tc_action_ops *ops)
6464
{
6565
struct tc_action_net *tn = net_generic(net, police_net_id);
66-
struct tcf_hashinfo *hinfo = tn->hinfo;
67-
int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;
68-
struct nlattr *nest;
69-
70-
spin_lock_bh(&hinfo->lock);
71-
72-
s_i = cb->args[0];
73-
74-
for (i = 0; i < (POL_TAB_MASK + 1); i++) {
75-
struct hlist_head *head;
76-
struct tc_action *p;
77-
78-
head = &hinfo->htab[tcf_hash(i, POL_TAB_MASK)];
79-
80-
hlist_for_each_entry_rcu(p, head, tcfa_head) {
81-
index++;
82-
if (index < s_i)
83-
continue;
84-
nest = nla_nest_start(skb, index);
85-
if (nest == NULL)
86-
goto nla_put_failure;
87-
if (type == RTM_DELACTION)
88-
err = tcf_action_dump_1(skb, p, 0, 1);
89-
else
90-
err = tcf_action_dump_1(skb, p, 0, 0);
91-
if (err < 0) {
92-
index--;
93-
nla_nest_cancel(skb, nest);
94-
goto done;
95-
}
96-
nla_nest_end(skb, nest);
97-
n_i++;
98-
}
99-
}
100-
done:
101-
spin_unlock_bh(&hinfo->lock);
102-
if (n_i)
103-
cb->args[0] += n_i;
104-
return n_i;
10566

106-
nla_put_failure:
107-
nla_nest_cancel(skb, nest);
108-
goto done;
67+
return tcf_generic_walker(tn, skb, cb, type, ops);
10968
}
11069

11170
static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = {

0 commit comments

Comments
 (0)