net: sched: extend TCA_ACT space with TCA_ACT_FLAGS
Extend TCA_ACT space with nla_bitfield32 flags. Add TCA_ACT_FLAGS_NO_PERCPU_STATS as the only allowed flag. Parse the flags in tcf_action_init_1() and pass resulting value as additional argument to a_o->init(). Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
5e174d5e73
commit
abbb0d3363
@@ -831,12 +831,15 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb)
|
||||
return c;
|
||||
}
|
||||
|
||||
static const u32 tca_act_flags_allowed = TCA_ACT_FLAGS_NO_PERCPU_STATS;
|
||||
static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = {
|
||||
[TCA_ACT_KIND] = { .type = NLA_STRING },
|
||||
[TCA_ACT_INDEX] = { .type = NLA_U32 },
|
||||
[TCA_ACT_COOKIE] = { .type = NLA_BINARY,
|
||||
.len = TC_COOKIE_MAX_SIZE },
|
||||
[TCA_ACT_OPTIONS] = { .type = NLA_NESTED },
|
||||
[TCA_ACT_FLAGS] = { .type = NLA_BITFIELD32,
|
||||
.validation_data = &tca_act_flags_allowed },
|
||||
};
|
||||
|
||||
struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
||||
@@ -845,6 +848,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
||||
bool rtnl_held,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct nla_bitfield32 flags = { 0, 0 };
|
||||
struct tc_action *a;
|
||||
struct tc_action_ops *a_o;
|
||||
struct tc_cookie *cookie = NULL;
|
||||
@@ -876,6 +880,8 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
if (tb[TCA_ACT_FLAGS])
|
||||
flags = nla_get_bitfield32(tb[TCA_ACT_FLAGS]);
|
||||
} else {
|
||||
if (strlcpy(act_name, name, IFNAMSIZ) >= IFNAMSIZ) {
|
||||
NL_SET_ERR_MSG(extack, "TC action name too long");
|
||||
@@ -914,10 +920,10 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
||||
/* backward compatibility for policer */
|
||||
if (name == NULL)
|
||||
err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, &a, ovr, bind,
|
||||
rtnl_held, tp, extack);
|
||||
rtnl_held, tp, flags.value, extack);
|
||||
else
|
||||
err = a_o->init(net, nla, est, &a, ovr, bind, rtnl_held,
|
||||
tp, extack);
|
||||
tp, flags.value, extack);
|
||||
if (err < 0)
|
||||
goto err_mod;
|
||||
|
||||
|
Reference in New Issue
Block a user