Skip to content

Commit 10defbd

Browse files
Alexander Aringdavem330
authored andcommitted
net: sched: act: add extack to init
This patch adds extack to tcf_action_init and tcf_action_init_1 functions. These are necessary to make individual extack handling in each act implementation. Based on work by David Ahern <[email protected]> Cc: David Ahern <[email protected]> Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b7b347f commit 10defbd

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

include/net/act_api.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions,
163163
int nr_actions, struct tcf_result *res);
164164
int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
165165
struct nlattr *est, char *name, int ovr, int bind,
166-
struct list_head *actions);
166+
struct list_head *actions, struct netlink_ext_ack *extack);
167167
struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
168168
struct nlattr *nla, struct nlattr *est,
169-
char *name, int ovr, int bind);
169+
char *name, int ovr, int bind,
170+
struct netlink_ext_ack *extack);
170171
int tcf_action_dump(struct sk_buff *skb, struct list_head *, int, int);
171172
int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
172173
int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);

net/sched/act_api.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,8 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb)
605605

606606
struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
607607
struct nlattr *nla, struct nlattr *est,
608-
char *name, int ovr, int bind)
608+
char *name, int ovr, int bind,
609+
struct netlink_ext_ack *extack)
609610
{
610611
struct tc_action *a;
611612
struct tc_action_ops *a_o;
@@ -726,7 +727,7 @@ static void cleanup_a(struct list_head *actions, int ovr)
726727

727728
int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
728729
struct nlattr *est, char *name, int ovr, int bind,
729-
struct list_head *actions)
730+
struct list_head *actions, struct netlink_ext_ack *extack)
730731
{
731732
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
732733
struct tc_action *act;
@@ -738,7 +739,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
738739
return err;
739740

740741
for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
741-
act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind);
742+
act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind,
743+
extack);
742744
if (IS_ERR(act)) {
743745
err = PTR_ERR(act);
744746
goto err;
@@ -1062,12 +1064,14 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions,
10621064
}
10631065

10641066
static int tcf_action_add(struct net *net, struct nlattr *nla,
1065-
struct nlmsghdr *n, u32 portid, int ovr)
1067+
struct nlmsghdr *n, u32 portid, int ovr,
1068+
struct netlink_ext_ack *extack)
10661069
{
10671070
int ret = 0;
10681071
LIST_HEAD(actions);
10691072

1070-
ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, &actions);
1073+
ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, &actions,
1074+
extack);
10711075
if (ret)
10721076
return ret;
10731077

@@ -1115,7 +1119,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n,
11151119
if (n->nlmsg_flags & NLM_F_REPLACE)
11161120
ovr = 1;
11171121
replay:
1118-
ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr);
1122+
ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr,
1123+
extack);
11191124
if (ret == -EAGAIN)
11201125
goto replay;
11211126
break;

net/sched/cls_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
14341434
if (exts->police && tb[exts->police]) {
14351435
act = tcf_action_init_1(net, tp, tb[exts->police],
14361436
rate_tlv, "police", ovr,
1437-
TCA_ACT_BIND);
1437+
TCA_ACT_BIND, extack);
14381438
if (IS_ERR(act))
14391439
return PTR_ERR(act);
14401440

@@ -1447,7 +1447,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
14471447

14481448
err = tcf_action_init(net, tp, tb[exts->action],
14491449
rate_tlv, NULL, ovr, TCA_ACT_BIND,
1450-
&actions);
1450+
&actions, extack);
14511451
if (err)
14521452
return err;
14531453
list_for_each_entry(act, &actions, list)

0 commit comments

Comments
 (0)