Browse Source

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>
Jiri Pirko 8 years ago
parent
commit
4ebc1e3cfc
4 changed files with 7 additions and 34 deletions
  1. 0 21
      include/net/pkt_cls.h
  2. 1 3
      net/sched/cls_basic.c
  3. 1 3
      net/sched/cls_cgroup.c
  4. 5 7
      net/sched/cls_flow.c

+ 0 - 21
include/net/pkt_cls.h

@@ -332,26 +332,6 @@ int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int);
 int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *,
 int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *,
 			struct tcf_pkt_info *);
 			struct tcf_pkt_info *);
 
 
-/**
- * tcf_em_tree_change - replace ematch tree of a running classifier
- *
- * @tp: classifier kind handle
- * @dst: destination ematch tree variable
- * @src: source ematch tree (temporary tree from tcf_em_tree_validate)
- *
- * This functions replaces the ematch tree in @dst with the ematch
- * tree in @src. The classifier in charge of the ematch tree may be
- * running.
- */
-static inline void tcf_em_tree_change(struct tcf_proto *tp,
-				      struct tcf_ematch_tree *dst,
-				      struct tcf_ematch_tree *src)
-{
-	tcf_tree_lock(tp);
-	memcpy(dst, src, sizeof(*dst));
-	tcf_tree_unlock(tp);
-}
-
 /**
 /**
  * tcf_em_tree_match - evaulate an ematch tree
  * tcf_em_tree_match - evaulate an ematch tree
  *
  *
@@ -386,7 +366,6 @@ struct tcf_ematch_tree {
 #define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)
 #define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)
 #define tcf_em_tree_destroy(t) do { (void)(t); } while(0)
 #define tcf_em_tree_destroy(t) do { (void)(t); } while(0)
 #define tcf_em_tree_dump(skb, t, tlv) (0)
 #define tcf_em_tree_dump(skb, t, tlv) (0)
-#define tcf_em_tree_change(tp, dst, src) do { } while(0)
 #define tcf_em_tree_match(skb, t, info) ((void)(info), 1)
 #define tcf_em_tree_match(skb, t, info) ((void)(info), 1)
 
 
 #endif /* CONFIG_NET_EMATCH */
 #endif /* CONFIG_NET_EMATCH */

+ 1 - 3
net/sched/cls_basic.c

@@ -130,7 +130,6 @@ static int basic_set_parms(struct net *net, struct tcf_proto *tp,
 {
 {
 	int err;
 	int err;
 	struct tcf_exts e;
 	struct tcf_exts e;
-	struct tcf_ematch_tree t;
 
 
 	err = tcf_exts_init(&e, TCA_BASIC_ACT, TCA_BASIC_POLICE);
 	err = tcf_exts_init(&e, TCA_BASIC_ACT, TCA_BASIC_POLICE);
 	if (err < 0)
 	if (err < 0)
@@ -139,7 +138,7 @@ static int basic_set_parms(struct net *net, struct tcf_proto *tp,
 	if (err < 0)
 	if (err < 0)
 		goto errout;
 		goto errout;
 
 
-	err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES], &t);
+	err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES], &f->ematches);
 	if (err < 0)
 	if (err < 0)
 		goto errout;
 		goto errout;
 
 
@@ -149,7 +148,6 @@ static int basic_set_parms(struct net *net, struct tcf_proto *tp,
 	}
 	}
 
 
 	tcf_exts_change(tp, &f->exts, &e);
 	tcf_exts_change(tp, &f->exts, &e);
-	tcf_em_tree_change(tp, &f->ematches, &t);
 	f->tp = tp;
 	f->tp = tp;
 
 
 	return 0;
 	return 0;

+ 1 - 3
net/sched/cls_cgroup.c

@@ -76,7 +76,6 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
 	struct nlattr *tb[TCA_CGROUP_MAX + 1];
 	struct nlattr *tb[TCA_CGROUP_MAX + 1];
 	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
 	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
 	struct cls_cgroup_head *new;
 	struct cls_cgroup_head *new;
-	struct tcf_ematch_tree t;
 	struct tcf_exts e;
 	struct tcf_exts e;
 	int err;
 	int err;
 
 
@@ -112,14 +111,13 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
 		goto errout;
 		goto errout;
 	}
 	}
 
 
-	err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &t);
+	err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &new->ematches);
 	if (err < 0) {
 	if (err < 0) {
 		tcf_exts_destroy(&e);
 		tcf_exts_destroy(&e);
 		goto errout;
 		goto errout;
 	}
 	}
 
 
 	tcf_exts_change(tp, &new->exts, &e);
 	tcf_exts_change(tp, &new->exts, &e);
-	tcf_em_tree_change(tp, &new->ematches, &t);
 
 
 	rcu_assign_pointer(tp->root, new);
 	rcu_assign_pointer(tp->root, new);
 	if (head)
 	if (head)

+ 5 - 7
net/sched/cls_flow.c

@@ -389,7 +389,6 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
 	struct nlattr *opt = tca[TCA_OPTIONS];
 	struct nlattr *opt = tca[TCA_OPTIONS];
 	struct nlattr *tb[TCA_FLOW_MAX + 1];
 	struct nlattr *tb[TCA_FLOW_MAX + 1];
 	struct tcf_exts e;
 	struct tcf_exts e;
-	struct tcf_ematch_tree t;
 	unsigned int nkeys = 0;
 	unsigned int nkeys = 0;
 	unsigned int perturb_period = 0;
 	unsigned int perturb_period = 0;
 	u32 baseclass = 0;
 	u32 baseclass = 0;
@@ -432,13 +431,13 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
 	if (err < 0)
 	if (err < 0)
 		goto err1;
 		goto err1;
 
 
-	err = tcf_em_tree_validate(tp, tb[TCA_FLOW_EMATCHES], &t);
-	if (err < 0)
-		goto err1;
-
 	err = -ENOBUFS;
 	err = -ENOBUFS;
 	fnew = kzalloc(sizeof(*fnew), GFP_KERNEL);
 	fnew = kzalloc(sizeof(*fnew), GFP_KERNEL);
 	if (!fnew)
 	if (!fnew)
+		goto err1;
+
+	err = tcf_em_tree_validate(tp, tb[TCA_FLOW_EMATCHES], &fnew->ematches);
+	if (err < 0)
 		goto err2;
 		goto err2;
 
 
 	err = tcf_exts_init(&fnew->exts, TCA_FLOW_ACT, TCA_FLOW_POLICE);
 	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,
 			       (unsigned long)fnew);
 			       (unsigned long)fnew);
 
 
 	tcf_exts_change(tp, &fnew->exts, &e);
 	tcf_exts_change(tp, &fnew->exts, &e);
-	tcf_em_tree_change(tp, &fnew->ematches, &t);
 
 
 	netif_keep_dst(qdisc_dev(tp->q));
 	netif_keep_dst(qdisc_dev(tp->q));
 
 
@@ -554,8 +552,8 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
 
 
 err3:
 err3:
 	tcf_exts_destroy(&fnew->exts);
 	tcf_exts_destroy(&fnew->exts);
+	tcf_em_tree_destroy(&fnew->ematches);
 err2:
 err2:
-	tcf_em_tree_destroy(&t);
 	kfree(fnew);
 	kfree(fnew);
 err1:
 err1:
 	tcf_exts_destroy(&e);
 	tcf_exts_destroy(&e);