netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: chia-yu.chang@nokia-bell-labs.com
Cc: netdev@vger.kernel.org, dave.taht@gmail.com, pabeni@redhat.com,
	jhs@mojatatu.com, kuba@kernel.org, xiyou.wangcong@gmail.com,
	jiri@resnulli.us, davem@davemloft.net, edumazet@google.com,
	horms@kernel.org, andrew+netdev@lunn.ch, donald.hunter@gmail.com,
	ast@fiberby.net, liuhangbin@gmail.com, shuah@kernel.org,
	linux-kselftest@vger.kernel.org, ij@kernel.org,
	ncardwell@google.com, koen.de_schepper@nokia-bell-labs.com,
	g.white@cablelabs.com, ingemar.s.johansson@ericsson.com,
	mirja.kuehlewind@ericsson.com, cheshire@apple.com,
	rs.ietf@gmx.at, Jason_Livingood@comcast.com,
	vidhi_goel@apple.com, Olga Albisser <olga@albisser.org>,
	Oliver Tilmans <olivier.tilmans@nokia.com>,
	Bob Briscoe <research@bobbriscoe.net>,
	Henrik Steen <henrist@henrist.net>
Subject: Re: [PATCH v4 iproute2-next 1/1] tc: add dualpi2 scheduler module
Date: Mon, 17 Mar 2025 06:40:53 -0700	[thread overview]
Message-ID: <20250317064053.4fe8425b@hermes.local> (raw)
In-Reply-To: <20250316153917.21005-2-chia-yu.chang@nokia-bell-labs.com>

On Sun, 16 Mar 2025 16:39:17 +0100
chia-yu.chang@nokia-bell-labs.com wrote:

> +static int try_get_percentage(int *val, const char *arg, int base)
> +{
> +	long res;
> +	char *ptr;
> +
> +	if (!arg || !*arg)
> +		return -1;
> +	res = strtol(arg, &ptr, base);
> +	if (!ptr || ptr == arg || (*ptr && strcmp(ptr, "%")))
> +		return -1;
> +	if (res == ULONG_MAX && errno == ERANGE)
> +		return -1;
> +	if (res < 0 || res > 100)
> +		return -1;
> +
> +	*val = res;
> +	return 0;
> +}
> +

I wonder if dualpi2 and netem could share some code on handling
scaled percentage values.

  parent reply	other threads:[~2025-03-17 13:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-16 15:39 [PATCH v4 iproute2-next 0/1] DualPI2 iproute2 patch chia-yu.chang
2025-03-16 15:39 ` [PATCH v4 iproute2-next 1/1] tc: add dualpi2 scheduler module chia-yu.chang
2025-03-17 13:33   ` Stephen Hemminger
2025-03-18 12:55     ` Chia-Yu Chang (Nokia)
2025-03-17 13:36   ` Stephen Hemminger
2025-03-18 12:55     ` Chia-Yu Chang (Nokia)
2025-03-17 13:40   ` Stephen Hemminger [this message]
2025-03-18 12:51     ` Chia-Yu Chang (Nokia)

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=20250317064053.4fe8425b@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=Jason_Livingood@comcast.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@fiberby.net \
    --cc=cheshire@apple.com \
    --cc=chia-yu.chang@nokia-bell-labs.com \
    --cc=dave.taht@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=g.white@cablelabs.com \
    --cc=henrist@henrist.net \
    --cc=horms@kernel.org \
    --cc=ij@kernel.org \
    --cc=ingemar.s.johansson@ericsson.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=koen.de_schepper@nokia-bell-labs.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=mirja.kuehlewind@ericsson.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=olga@albisser.org \
    --cc=olivier.tilmans@nokia.com \
    --cc=pabeni@redhat.com \
    --cc=research@bobbriscoe.net \
    --cc=rs.ietf@gmx.at \
    --cc=shuah@kernel.org \
    --cc=vidhi_goel@apple.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).