Skip to content

Commit 4ebc1e3

Browse files
jpirkodavem330
authored andcommitted
net: sched: remove unneeded tcf_em_tree_change
Since tcf_em_tree_validate could be always called on a newly created filter, there is no need for this change function. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f7ebdff commit 4ebc1e3

4 files changed

Lines changed: 7 additions & 34 deletions

File tree

‎include/net/pkt_cls.h‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -332,26 +332,6 @@ int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int);
332332
int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *,
333333
struct tcf_pkt_info *);
334334

335-
/**
336-
* tcf_em_tree_change - replace ematch tree of a running classifier
337-
*
338-
* @tp: classifier kind handle
339-
* @dst: destination ematch tree variable
340-
* @src: source ematch tree (temporary tree from tcf_em_tree_validate)
341-
*
342-
* This functions replaces the ematch tree in @dst with the ematch
343-
* tree in @src. The classifier in charge of the ematch tree may be
344-
* running.
345-
*/
346-
static inline void tcf_em_tree_change(struct tcf_proto *tp,
347-
struct tcf_ematch_tree *dst,
348-
struct tcf_ematch_tree *src)
349-
{
350-
tcf_tree_lock(tp);
351-
memcpy(dst, src, sizeof(*dst));
352-
tcf_tree_unlock(tp);
353-
}
354-
355335
/**
356336
* tcf_em_tree_match - evaulate an ematch tree
357337
*
@@ -386,7 +366,6 @@ struct tcf_ematch_tree {
386366
#define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)
387367
#define tcf_em_tree_destroy(t) do { (void)(t); } while(0)
388368
#define tcf_em_tree_dump(skb, t, tlv) (0)
389-
#define tcf_em_tree_change(tp, dst, src) do { } while(0)
390369
#define tcf_em_tree_match(skb, t, info) ((void)(info), 1)
391370

392371
#endif /* CONFIG_NET_EMATCH */

‎net/sched/cls_basic.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ static int basic_set_parms(struct net *net, struct tcf_proto *tp,
130130
{
131131
int err;
132132
struct tcf_exts e;
133-
struct tcf_ematch_tree t;
134133

135134
err = tcf_exts_init(&e, TCA_BASIC_ACT, TCA_BASIC_POLICE);
136135
if (err < 0)
@@ -139,7 +138,7 @@ static int basic_set_parms(struct net *net, struct tcf_proto *tp,
139138
if (err < 0)
140139
goto errout;
141140

142-
err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES], &t);
141+
err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES], &f->ematches);
143142
if (err < 0)
144143
goto errout;
145144

@@ -149,7 +148,6 @@ static int basic_set_parms(struct net *net, struct tcf_proto *tp,
149148
}
150149

151150
tcf_exts_change(tp, &f->exts, &e);
152-
tcf_em_tree_change(tp, &f->ematches, &t);
153151
f->tp = tp;
154152

155153
return 0;

‎net/sched/cls_cgroup.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
7676
struct nlattr *tb[TCA_CGROUP_MAX + 1];
7777
struct cls_cgroup_head *head = rtnl_dereference(tp->root);
7878
struct cls_cgroup_head *new;
79-
struct tcf_ematch_tree t;
8079
struct tcf_exts e;
8180
int err;
8281

@@ -112,14 +111,13 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
112111
goto errout;
113112
}
114113

115-
err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &t);
114+
err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &new->ematches);
116115
if (err < 0) {
117116
tcf_exts_destroy(&e);
118117
goto errout;
119118
}
120119

121120
tcf_exts_change(tp, &new->exts, &e);
122-
tcf_em_tree_change(tp, &new->ematches, &t);
123121

124122
rcu_assign_pointer(tp->root, new);
125123
if (head)

‎net/sched/cls_flow.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
389389
struct nlattr *opt = tca[TCA_OPTIONS];
390390
struct nlattr *tb[TCA_FLOW_MAX + 1];
391391
struct tcf_exts e;
392-
struct tcf_ematch_tree t;
393392
unsigned int nkeys = 0;
394393
unsigned int perturb_period = 0;
395394
u32 baseclass = 0;
@@ -432,13 +431,13 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
432431
if (err < 0)
433432
goto err1;
434433

435-
err = tcf_em_tree_validate(tp, tb[TCA_FLOW_EMATCHES], &t);
436-
if (err < 0)
437-
goto err1;
438-
439434
err = -ENOBUFS;
440435
fnew = kzalloc(sizeof(*fnew), GFP_KERNEL);
441436
if (!fnew)
437+
goto err1;
438+
439+
err = tcf_em_tree_validate(tp, tb[TCA_FLOW_EMATCHES], &fnew->ematches);
440+
if (err < 0)
442441
goto err2;
443442

444443
err = tcf_exts_init(&fnew->exts, TCA_FLOW_ACT, TCA_FLOW_POLICE);
@@ -512,7 +511,6 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
512511
(unsigned long)fnew);
513512

514513
tcf_exts_change(tp, &fnew->exts, &e);
515-
tcf_em_tree_change(tp, &fnew->ematches, &t);
516514

517515
netif_keep_dst(qdisc_dev(tp->q));
518516

@@ -554,8 +552,8 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
554552

555553
err3:
556554
tcf_exts_destroy(&fnew->exts);
555+
tcf_em_tree_destroy(&fnew->ematches);
557556
err2:
558-
tcf_em_tree_destroy(&t);
559557
kfree(fnew);
560558
err1:
561559
tcf_exts_destroy(&e);

0 commit comments

Comments
 (0)