Commit 3872347e authored by Pedro Tammela's avatar Pedro Tammela Committed by Paolo Abeni

net/sched: act_api: use tcf_act_for_each_action

Use the auxiliary macro tcf_act_for_each_action in all the
functions that expect a contiguous action array
Suggested-by: default avatarMarcelo Ricardo Leitner <mleitner@redhat.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 030033d4
...@@ -1118,8 +1118,7 @@ int tcf_action_destroy(struct tc_action *actions[], int bind) ...@@ -1118,8 +1118,7 @@ int tcf_action_destroy(struct tc_action *actions[], int bind)
struct tc_action *a; struct tc_action *a;
int ret = 0, i; int ret = 0, i;
for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { tcf_act_for_each_action(i, a, actions) {
a = actions[i];
actions[i] = NULL; actions[i] = NULL;
ops = a->ops; ops = a->ops;
ret = __tcf_idr_release(a, bind, true); ret = __tcf_idr_release(a, bind, true);
...@@ -1211,8 +1210,7 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], ...@@ -1211,8 +1210,7 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[],
int err = -EINVAL, i; int err = -EINVAL, i;
struct nlattr *nest; struct nlattr *nest;
for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { tcf_act_for_each_action(i, a, actions) {
a = actions[i];
nest = nla_nest_start_noflag(skb, i + 1); nest = nla_nest_start_noflag(skb, i + 1);
if (nest == NULL) if (nest == NULL)
goto nla_put_failure; goto nla_put_failure;
...@@ -1753,10 +1751,10 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, ...@@ -1753,10 +1751,10 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
static int tcf_action_delete(struct net *net, struct tc_action *actions[]) static int tcf_action_delete(struct net *net, struct tc_action *actions[])
{ {
struct tc_action *a;
int i; int i;
for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { tcf_act_for_each_action(i, a, actions) {
struct tc_action *a = actions[i];
const struct tc_action_ops *ops = a->ops; const struct tc_action_ops *ops = a->ops;
/* Actions can be deleted concurrently so we must save their /* Actions can be deleted concurrently so we must save their
* type and id to search again after reference is released. * type and id to search again after reference is released.
...@@ -1768,7 +1766,7 @@ static int tcf_action_delete(struct net *net, struct tc_action *actions[]) ...@@ -1768,7 +1766,7 @@ static int tcf_action_delete(struct net *net, struct tc_action *actions[])
if (tcf_action_put(a)) { if (tcf_action_put(a)) {
/* last reference, action was deleted concurrently */ /* last reference, action was deleted concurrently */
module_put(ops->owner); module_put(ops->owner);
} else { } else {
int ret; int ret;
/* now do the delete */ /* now do the delete */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment