diff options
author | Jiri Pirko <jiri@mellanox.com> | 2017-08-04 15:29:07 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-04 21:21:24 +0300 |
commit | 94611bff6e1e57c4a74a9242f3fe749aa4a31678 (patch) | |
tree | fa03660e12e6bd403bf7437925ff3b81bbd52977 /net/sched/cls_fw.c | |
parent | 455075292b0d58f708c1afe7011a8b9223b2c9c8 (diff) | |
download | linux-94611bff6e1e57c4a74a9242f3fe749aa4a31678.tar.xz |
net: sched: cls_fw: no need to call tcf_exts_change for newly allocated struct
As the f struct was allocated right before fw_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_fw.c')
-rw-r--r-- | net/sched/cls_fw.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 358bf34f0dd0..11f178f1b2be 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c @@ -195,16 +195,12 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp, struct nlattr **tca, unsigned long base, bool ovr) { struct fw_head *head = rtnl_dereference(tp->root); - struct tcf_exts e; u32 mask; int err; - err = tcf_exts_init(&e, TCA_FW_ACT, TCA_FW_POLICE); + err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &f->exts, ovr); if (err < 0) return err; - err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, ovr); - if (err < 0) - goto errout; if (tb[TCA_FW_CLASSID]) { f->res.classid = nla_get_u32(tb[TCA_FW_CLASSID]); @@ -215,10 +211,8 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp, if (tb[TCA_FW_INDEV]) { int ret; ret = tcf_change_indev(net, tb[TCA_FW_INDEV]); - if (ret < 0) { - err = ret; - goto errout; - } + if (ret < 0) + return ret; f->ifindex = ret; } #endif /* CONFIG_NET_CLS_IND */ @@ -227,16 +221,11 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp, if (tb[TCA_FW_MASK]) { mask = nla_get_u32(tb[TCA_FW_MASK]); if (mask != head->mask) - goto errout; + return err; } else if (head->mask != 0xFFFFFFFF) - goto errout; - - tcf_exts_change(tp, &f->exts, &e); + return err; return 0; -errout: - tcf_exts_destroy(&e); - return err; } static int fw_change(struct net *net, struct sk_buff *in_skb, |