mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
net/sched: simplify tc_action_load_ops parameters
Instead of using two bools derived from a flags passed as arguments to the parent function of tc_action_load_ops, just pass the flags itself to tc_action_load_ops to simplify its parameters. Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
363096a27f
commit
405cd9fc6f
|
@ -208,8 +208,7 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
|
||||||
struct nlattr *est,
|
struct nlattr *est,
|
||||||
struct tc_action *actions[], int init_res[], size_t *attr_size,
|
struct tc_action *actions[], int init_res[], size_t *attr_size,
|
||||||
u32 flags, u32 fl_flags, struct netlink_ext_ack *extack);
|
u32 flags, u32 fl_flags, struct netlink_ext_ack *extack);
|
||||||
struct tc_action_ops *tc_action_load_ops(struct nlattr *nla, bool police,
|
struct tc_action_ops *tc_action_load_ops(struct nlattr *nla, u32 flags,
|
||||||
bool rtnl_held,
|
|
||||||
struct netlink_ext_ack *extack);
|
struct netlink_ext_ack *extack);
|
||||||
struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
||||||
struct nlattr *nla, struct nlattr *est,
|
struct nlattr *nla, struct nlattr *est,
|
||||||
|
|
|
@ -1324,10 +1324,10 @@ void tcf_idr_insert_many(struct tc_action *actions[], int init_res[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tc_action_ops *tc_action_load_ops(struct nlattr *nla, bool police,
|
struct tc_action_ops *tc_action_load_ops(struct nlattr *nla, u32 flags,
|
||||||
bool rtnl_held,
|
|
||||||
struct netlink_ext_ack *extack)
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
|
bool police = flags & TCA_ACT_FLAGS_POLICE;
|
||||||
struct nlattr *tb[TCA_ACT_MAX + 1];
|
struct nlattr *tb[TCA_ACT_MAX + 1];
|
||||||
struct tc_action_ops *a_o;
|
struct tc_action_ops *a_o;
|
||||||
char act_name[IFNAMSIZ];
|
char act_name[IFNAMSIZ];
|
||||||
|
@ -1359,6 +1359,8 @@ struct tc_action_ops *tc_action_load_ops(struct nlattr *nla, bool police,
|
||||||
a_o = tc_lookup_action_n(act_name);
|
a_o = tc_lookup_action_n(act_name);
|
||||||
if (a_o == NULL) {
|
if (a_o == NULL) {
|
||||||
#ifdef CONFIG_MODULES
|
#ifdef CONFIG_MODULES
|
||||||
|
bool rtnl_held = !(flags & TCA_ACT_FLAGS_NO_RTNL);
|
||||||
|
|
||||||
if (rtnl_held)
|
if (rtnl_held)
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
request_module("act_%s", act_name);
|
request_module("act_%s", act_name);
|
||||||
|
@ -1475,9 +1477,7 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
|
||||||
for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
|
for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
|
||||||
struct tc_action_ops *a_o;
|
struct tc_action_ops *a_o;
|
||||||
|
|
||||||
a_o = tc_action_load_ops(tb[i], flags & TCA_ACT_FLAGS_POLICE,
|
a_o = tc_action_load_ops(tb[i], flags, extack);
|
||||||
!(flags & TCA_ACT_FLAGS_NO_RTNL),
|
|
||||||
extack);
|
|
||||||
if (IS_ERR(a_o)) {
|
if (IS_ERR(a_o)) {
|
||||||
err = PTR_ERR(a_o);
|
err = PTR_ERR(a_o);
|
||||||
goto err_mod;
|
goto err_mod;
|
||||||
|
|
|
@ -3314,12 +3314,11 @@ int tcf_exts_validate_ex(struct net *net, struct tcf_proto *tp, struct nlattr **
|
||||||
if (exts->police && tb[exts->police]) {
|
if (exts->police && tb[exts->police]) {
|
||||||
struct tc_action_ops *a_o;
|
struct tc_action_ops *a_o;
|
||||||
|
|
||||||
a_o = tc_action_load_ops(tb[exts->police], true,
|
flags |= TCA_ACT_FLAGS_POLICE | TCA_ACT_FLAGS_BIND;
|
||||||
!(flags & TCA_ACT_FLAGS_NO_RTNL),
|
a_o = tc_action_load_ops(tb[exts->police], flags,
|
||||||
extack);
|
extack);
|
||||||
if (IS_ERR(a_o))
|
if (IS_ERR(a_o))
|
||||||
return PTR_ERR(a_o);
|
return PTR_ERR(a_o);
|
||||||
flags |= TCA_ACT_FLAGS_POLICE | TCA_ACT_FLAGS_BIND;
|
|
||||||
act = tcf_action_init_1(net, tp, tb[exts->police],
|
act = tcf_action_init_1(net, tp, tb[exts->police],
|
||||||
rate_tlv, a_o, init_res, flags,
|
rate_tlv, a_o, init_res, flags,
|
||||||
extack);
|
extack);
|
||||||
|
|
Loading…
Reference in a new issue