提交 94611bff 编写于 作者: J Jiri Pirko 提交者: David S. Miller

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: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 45507529
...@@ -195,16 +195,12 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp, ...@@ -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 nlattr **tca, unsigned long base, bool ovr)
{ {
struct fw_head *head = rtnl_dereference(tp->root); struct fw_head *head = rtnl_dereference(tp->root);
struct tcf_exts e;
u32 mask; u32 mask;
int err; 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) if (err < 0)
return err; return err;
err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, ovr);
if (err < 0)
goto errout;
if (tb[TCA_FW_CLASSID]) { if (tb[TCA_FW_CLASSID]) {
f->res.classid = nla_get_u32(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, ...@@ -215,10 +211,8 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp,
if (tb[TCA_FW_INDEV]) { if (tb[TCA_FW_INDEV]) {
int ret; int ret;
ret = tcf_change_indev(net, tb[TCA_FW_INDEV]); ret = tcf_change_indev(net, tb[TCA_FW_INDEV]);
if (ret < 0) { if (ret < 0)
err = ret; return ret;
goto errout;
}
f->ifindex = ret; f->ifindex = ret;
} }
#endif /* CONFIG_NET_CLS_IND */ #endif /* CONFIG_NET_CLS_IND */
...@@ -227,16 +221,11 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp, ...@@ -227,16 +221,11 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp,
if (tb[TCA_FW_MASK]) { if (tb[TCA_FW_MASK]) {
mask = nla_get_u32(tb[TCA_FW_MASK]); mask = nla_get_u32(tb[TCA_FW_MASK]);
if (mask != head->mask) if (mask != head->mask)
goto errout; return err;
} else if (head->mask != 0xFFFFFFFF) } else if (head->mask != 0xFFFFFFFF)
goto errout; return err;
tcf_exts_change(tp, &f->exts, &e);
return 0; return 0;
errout:
tcf_exts_destroy(&e);
return err;
} }
static int fw_change(struct net *net, struct sk_buff *in_skb, static int fw_change(struct net *net, struct sk_buff *in_skb,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册