aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_basic.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2017-08-04 08:29:09 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-04 14:21:24 -0400
commitff1f8ca0805ab03c31e14a9356aa2ac81d65c338 (patch)
tree017eceade4f7cdffaf3c61f3150b8de68e5e44f8 /net/sched/cls_basic.c
parenta74cb36980c3676c888a87dd66bcd410f7e75c08 (diff)
net: sched: cls_basic: no need to call tcf_exts_change for newly allocated struct
As the f struct was allocated right before basic_set_parms call, no need to use tcf_exts_change to do atomic change, and we can just fill-up the unused exts struct directly by tcf_exts_validate. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_basic.c')
-rw-r--r--net/sched/cls_basic.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 979cd2683b46..7c7a82138f76 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -129,31 +129,22 @@ static int basic_set_parms(struct net *net, struct tcf_proto *tp,
129 struct nlattr *est, bool ovr) 129 struct nlattr *est, bool ovr)
130{ 130{
131 int err; 131 int err;
132 struct tcf_exts e;
133 132
134 err = tcf_exts_init(&e, TCA_BASIC_ACT, TCA_BASIC_POLICE); 133 err = tcf_exts_validate(net, tp, tb, est, &f->exts, ovr);
135 if (err < 0) 134 if (err < 0)
136 return err; 135 return err;
137 err = tcf_exts_validate(net, tp, tb, est, &e, ovr);
138 if (err < 0)
139 goto errout;
140 136
141 err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES], &f->ematches); 137 err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES], &f->ematches);
142 if (err < 0) 138 if (err < 0)
143 goto errout; 139 return err;
144 140
145 if (tb[TCA_BASIC_CLASSID]) { 141 if (tb[TCA_BASIC_CLASSID]) {
146 f->res.classid = nla_get_u32(tb[TCA_BASIC_CLASSID]); 142 f->res.classid = nla_get_u32(tb[TCA_BASIC_CLASSID]);
147 tcf_bind_filter(tp, &f->res, base); 143 tcf_bind_filter(tp, &f->res, base);
148 } 144 }
149 145
150 tcf_exts_change(tp, &f->exts, &e);
151 f->tp = tp; 146 f->tp = tp;
152
153 return 0; 147 return 0;
154errout:
155 tcf_exts_destroy(&e);
156 return err;
157} 148}
158 149
159static int basic_change(struct net *net, struct sk_buff *in_skb, 150static int basic_change(struct net *net, struct sk_buff *in_skb,