Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50a56190 authored by Alexander Aring's avatar Alexander Aring Committed by David S. Miller
Browse files

net: sched: cls: add extack support for tcf_exts_validate



The tcf_exts_validate function calls the act api change callback. For
preparing extack support for act api, this patch adds the extack as
parameter for this function which is common used in cls implementations.

Furthermore the tcf_exts_validate will call action init callback which
prepares the TC action subsystem for extack support.

Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: default avatarAlexander Aring <aring@mojatatu.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7306db38
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -376,7 +376,8 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,

int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
		      struct nlattr **tb, struct nlattr *rate_tlv,
		      struct tcf_exts *exts, bool ovr);
		      struct tcf_exts *exts, bool ovr,
		      struct netlink_ext_ack *extack);
void tcf_exts_destroy(struct tcf_exts *exts);
void tcf_exts_change(struct tcf_exts *dst, struct tcf_exts *src);
int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts);
+5 −2
Original line number Diff line number Diff line
@@ -1423,7 +1423,8 @@ void tcf_exts_destroy(struct tcf_exts *exts)
EXPORT_SYMBOL(tcf_exts_destroy);

int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
		      struct nlattr *rate_tlv, struct tcf_exts *exts, bool ovr)
		      struct nlattr *rate_tlv, struct tcf_exts *exts, bool ovr,
		      struct netlink_ext_ack *extack)
{
#ifdef CONFIG_NET_CLS_ACT
	{
@@ -1456,8 +1457,10 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
	}
#else
	if ((exts->action && tb[exts->action]) ||
	    (exts->police && tb[exts->police]))
	    (exts->police && tb[exts->police])) {
		NL_SET_ERR_MSG(extack, "Classifier actions are not supported per compile options (CONFIG_NET_CLS_ACT)");
		return -EOPNOTSUPP;
	}
#endif

	return 0;
+5 −3
Original line number Diff line number Diff line
@@ -152,11 +152,12 @@ static const struct nla_policy basic_policy[TCA_BASIC_MAX + 1] = {
static int basic_set_parms(struct net *net, struct tcf_proto *tp,
			   struct basic_filter *f, unsigned long base,
			   struct nlattr **tb,
			   struct nlattr *est, bool ovr)
			   struct nlattr *est, bool ovr,
			   struct netlink_ext_ack *extack)
{
	int err;

	err = tcf_exts_validate(net, tp, tb, est, &f->exts, ovr);
	err = tcf_exts_validate(net, tp, tb, est, &f->exts, ovr, extack);
	if (err < 0)
		return err;

@@ -222,7 +223,8 @@ static int basic_change(struct net *net, struct sk_buff *in_skb,
		fnew->handle = idr_index;
	}

	err = basic_set_parms(net, tp, fnew, base, tb, tca[TCA_RATE], ovr);
	err = basic_set_parms(net, tp, fnew, base, tb, tca[TCA_RATE], ovr,
			      extack);
	if (err < 0) {
		if (!fold)
			idr_remove_ext(&head->handle_idr, fnew->handle);
+5 −3
Original line number Diff line number Diff line
@@ -403,7 +403,8 @@ static int cls_bpf_prog_from_efd(struct nlattr **tb, struct cls_bpf_prog *prog,

static int cls_bpf_set_parms(struct net *net, struct tcf_proto *tp,
			     struct cls_bpf_prog *prog, unsigned long base,
			     struct nlattr **tb, struct nlattr *est, bool ovr)
			     struct nlattr **tb, struct nlattr *est, bool ovr,
			     struct netlink_ext_ack *extack)
{
	bool is_bpf, is_ebpf, have_exts = false;
	u32 gen_flags = 0;
@@ -414,7 +415,7 @@ static int cls_bpf_set_parms(struct net *net, struct tcf_proto *tp,
	if ((!is_bpf && !is_ebpf) || (is_bpf && is_ebpf))
		return -EINVAL;

	ret = tcf_exts_validate(net, tp, tb, est, &prog->exts, ovr);
	ret = tcf_exts_validate(net, tp, tb, est, &prog->exts, ovr, extack);
	if (ret < 0)
		return ret;

@@ -500,7 +501,8 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
		prog->handle = handle;
	}

	ret = cls_bpf_set_parms(net, tp, prog, base, tb, tca[TCA_RATE], ovr);
	ret = cls_bpf_set_parms(net, tp, prog, base, tb, tca[TCA_RATE], ovr,
				extack);
	if (ret < 0)
		goto errout_idr;

+2 −1
Original line number Diff line number Diff line
@@ -122,7 +122,8 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
	if (err < 0)
		goto errout;

	err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &new->exts, ovr);
	err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &new->exts, ovr,
				extack);
	if (err < 0)
		goto errout;

Loading