netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com
Subject: Re: [PATCH net-next 2/2] net/sched: sch_qfq: use extack on errors messages
Date: Fri, 14 Apr 2023 18:15:37 -0700	[thread overview]
Message-ID: <20230414181537.4f477617@kernel.org> (raw)
In-Reply-To: <20230414185309.220286-3-pctammela@mojatatu.com>

On Fri, 14 Apr 2023 15:53:10 -0300 Pedro Tammela wrote:
>  	if (tca[TCA_OPTIONS] == NULL) {
> -		pr_notice("qfq: no options\n");
> +		NL_SET_ERR_MSG_MOD(extack, "missing options");

NL_REQ_ATTR_CHECK() (probably in addition to the string message)
since it's legacy netlink.

>  		return -EINVAL;
>  	}
>  
>  	err = nla_parse_nested_deprecated(tb, TCA_QFQ_MAX, tca[TCA_OPTIONS],
> -					  qfq_policy, NULL);
> +					  qfq_policy, extack);
>  	if (err < 0)
>  		return err;
>  
>  	if (tb[TCA_QFQ_WEIGHT]) {
>  		weight = nla_get_u32(tb[TCA_QFQ_WEIGHT]);
>  		if (!weight || weight > (1UL << QFQ_MAX_WSHIFT)) {
> -			pr_notice("qfq: invalid weight %u\n", weight);
> +			NL_SET_ERR_MSG_FMT_MOD(extack, "invalid weight %u\n",
> +					       weight);

The checks should be expressed as part of the policy and parsing will
take care of the extack

>  			return -EINVAL;
>  		}
>  	} else
> @@ -424,7 +425,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
>  	if (tb[TCA_QFQ_LMAX]) {
>  		lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);
>  		if (lmax < QFQ_MIN_LMAX || lmax > (1UL << QFQ_MTU_SHIFT)) {
> -			pr_notice("qfq: invalid max length %u\n", lmax);
> +			NL_SET_ERR_MSG_FMT_MOD(extack,
> +					       "invalid max length %u\n", lmax);
>  			return -EINVAL;

ditto

      reply	other threads:[~2023-04-15  1:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 18:53 [PATCH net-next 0/2] net/sched: cleanup parsing prints in htb and qfq Pedro Tammela
2023-04-14 18:53 ` [PATCH net-next 1/2] net/sched: sch_htb: use extack on errors messages Pedro Tammela
2023-04-15  1:13   ` Jakub Kicinski
2023-04-15 14:06     ` Jamal Hadi Salim
2023-04-17 15:52       ` Jakub Kicinski
2023-04-17 16:35         ` Pedro Tammela
2023-04-14 18:53 ` [PATCH net-next 2/2] net/sched: sch_qfq: " Pedro Tammela
2023-04-15  1:15   ` Jakub Kicinski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230414181537.4f477617@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@mojatatu.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).