netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
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, kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net-next v2 3/4] net/sched: sch_qfq: refactor parsing of netlink parameters
Date: Wed, 19 Apr 2023 14:53:50 +0200	[thread overview]
Message-ID: <ZD/kXkvqB9ovOFqk@corigine.com> (raw)
In-Reply-To: <20230417171218.333567-4-pctammela@mojatatu.com>

On Mon, Apr 17, 2023 at 02:12:17PM -0300, Pedro Tammela wrote:
> Two parameters can be transformed into netlink policies and
> validated while parsing the netlink message.
> 
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

> ---
>  net/sched/sch_qfq.c | 28 +++++++++++++---------------
>  1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
> index 323609cfbc67..151102ac8cce 100644
> --- a/net/sched/sch_qfq.c
> +++ b/net/sched/sch_qfq.c
> @@ -214,9 +214,15 @@ static struct qfq_class *qfq_find_class(struct Qdisc *sch, u32 classid)
>  	return container_of(clc, struct qfq_class, common);
>  }
>  
> +static struct netlink_range_validation lmax_range = {
> +	.min = QFQ_MIN_LMAX,
> +	.max = (1UL << QFQ_MTU_SHIFT),
> +};
> +
>  static const struct nla_policy qfq_policy[TCA_QFQ_MAX + 1] = {
> -	[TCA_QFQ_WEIGHT] = { .type = NLA_U32 },
> -	[TCA_QFQ_LMAX] = { .type = NLA_U32 },
> +	[TCA_QFQ_WEIGHT] =
> +		NLA_POLICY_RANGE(NLA_U32, 1, (1UL << QFQ_MAX_WSHIFT)),
> +	[TCA_QFQ_LMAX] = NLA_POLICY_FULL_RANGE(NLA_U32, &lmax_range),
>  };

Maybe someday we can teach this file about the BIT macro.

...

  reply	other threads:[~2023-04-19 12:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 17:12 [PATCH net-next v2 0/4] net/sched: cleanup parsing prints in htb and qfq Pedro Tammela
2023-04-17 17:12 ` [PATCH net-next v2 1/4] net/sched: sch_htb: use extack on errors messages Pedro Tammela
2023-04-19 12:51   ` Simon Horman
2023-04-20  1:08   ` Jakub Kicinski
2023-04-20  2:14     ` Pedro Tammela
2023-04-20 14:17       ` Jakub Kicinski
2023-04-17 17:12 ` [PATCH net-next v2 2/4] net/sched: sch_qfq: " Pedro Tammela
2023-04-17 21:33   ` Jamal Hadi Salim
2023-04-19 12:52   ` Simon Horman
2023-04-17 17:12 ` [PATCH net-next v2 3/4] net/sched: sch_qfq: refactor parsing of netlink parameters Pedro Tammela
2023-04-19 12:53   ` Simon Horman [this message]
2023-04-17 17:12 ` [PATCH net-next v2 4/4] selftests: tc-testing: add more tests for sch_qfq Pedro Tammela

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=ZD/kXkvqB9ovOFqk@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --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).