All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: chia-yu.chang@nokia-bell-labs.com
Cc: netdev@vger.kernel.org, dsahern@gmail.com, davem@davemloft.net,
	jhs@mojatatu.com, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, dsahern@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 iproute2-next 1/1] tc: add dualpi2 scheduler module
Date: Mon, 21 Oct 2024 16:08:15 -0700	[thread overview]
Message-ID: <20241021160815.4516f322@hermes.local> (raw)
In-Reply-To: <20241021221559.60411-2-chia-yu.chang@nokia-bell-labs.com>

On Tue, 22 Oct 2024 00:15:59 +0200
chia-yu.chang@nokia-bell-labs.com wrote:

> static int dualpi2_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
> +{
> +	struct rtattr *tb[TCA_DUALPI2_MAX + 1];
> +	uint32_t tupdate;
> +	uint32_t target;
> +	uint32_t step_thresh;
> +	bool step_packets = false;
> +
> +	SPRINT_BUF(b1);
> +
> +	if (opt == NULL)
> +		return 0;
> +
> +	parse_rtattr_nested(tb, TCA_DUALPI2_MAX, opt);
> +
> +	if (tb[TCA_DUALPI2_LIMIT] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_LIMIT]) >= sizeof(__uint32_t))
> +		fprintf(f, "limit %up ",
> +			rta_getattr_u32(tb[TCA_DUALPI2_LIMIT]));
> +	if (tb[TCA_DUALPI2_TARGET] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_TARGET]) >= sizeof(__uint32_t)) {
> +		target = rta_getattr_u32(tb[TCA_DUALPI2_TARGET]);
> +		fprintf(f, "target %s ", sprint_time(target, b1));
> +	}
> +	if (tb[TCA_DUALPI2_TUPDATE] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_TUPDATE]) >= sizeof(__uint32_t)) {
> +		tupdate = rta_getattr_u32(tb[TCA_DUALPI2_TUPDATE]);
> +		fprintf(f, "tupdate %s ", sprint_time(tupdate, b1));
> +	}
> +	if (tb[TCA_DUALPI2_ALPHA] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_ALPHA]) >= sizeof(__uint32_t)) {
> +		fprintf(f, "alpha %f ",
> +			((float)rta_getattr_u32(tb[TCA_DUALPI2_ALPHA])) /
> +			ALPHA_BETA_SCALE);
> +	}
> +	if (tb[TCA_DUALPI2_BETA] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_BETA]) >= sizeof(__uint32_t)) {
> +		fprintf(f, "beta %f ",
> +			((float)rta_getattr_u32(tb[TCA_DUALPI2_BETA])) /
> +			ALPHA_BETA_SCALE);
> +	}
> +	if (tb[TCA_DUALPI2_ECN_MASK] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_ECN_MASK]) >= sizeof(__u8))
> +		fprintf(f, "%s ",
> +			get_ecn_type(rta_getattr_u8(tb[TCA_DUALPI2_ECN_MASK])));
> +	if (tb[TCA_DUALPI2_COUPLING] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_COUPLING]) >= sizeof(__u8))
> +		fprintf(f, "coupling_factor %u ",
> +			rta_getattr_u8(tb[TCA_DUALPI2_COUPLING]));
> +	if (tb[TCA_DUALPI2_DROP_OVERLOAD] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_DROP_OVERLOAD]) >= sizeof(__u8)) {
> +		if (rta_getattr_u8(tb[TCA_DUALPI2_DROP_OVERLOAD]))
> +			fprintf(f, "drop_on_overload ");
> +		else
> +			fprintf(f, "overflow ");
> +	}
> +	if (tb[TCA_DUALPI2_STEP_PACKETS] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_STEP_PACKETS]) >= sizeof(__u8) &&
> +	    rta_getattr_u8(tb[TCA_DUALPI2_STEP_PACKETS]))
> +		step_packets = true;
> +	if (tb[TCA_DUALPI2_STEP_THRESH] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_STEP_THRESH]) >= sizeof(__uint32_t)) {
> +		step_thresh = rta_getattr_u32(tb[TCA_DUALPI2_STEP_THRESH]);
> +		if (step_packets)
> +			fprintf(f, "step_thresh %upkt ", step_thresh);
> +		else
> +			fprintf(f, "step_thresh %s ",
> +				sprint_time(step_thresh, b1));
> +	}
> +	if (tb[TCA_DUALPI2_DROP_EARLY] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_DROP_EARLY]) >= sizeof(__u8)) {
> +		if (rta_getattr_u8(tb[TCA_DUALPI2_DROP_EARLY]))
> +			fprintf(f, "drop_enqueue ");
> +		else
> +			fprintf(f, "drop_dequeue ");
> +	}
> +	if (tb[TCA_DUALPI2_SPLIT_GSO] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_SPLIT_GSO]) >= sizeof(__u8)) {
> +		if (rta_getattr_u8(tb[TCA_DUALPI2_SPLIT_GSO]))
> +			fprintf(f, "split_gso ");
> +		else
> +			fprintf(f, "no_split_gso ");
> +	}
> +	if (tb[TCA_DUALPI2_C_PROTECTION] &&
> +	    RTA_PAYLOAD(tb[TCA_DUALPI2_C_PROTECTION]) >= sizeof(__u8))
> +		fprintf(f, "classic_protection %u%% ",
> +			rta_getattr_u8(tb[TCA_DUALPI2_C_PROTECTION]));
> +
> +	return 0;
> +}

Print function must use the JSON helpers

      parent reply	other threads:[~2024-10-21 23:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 22:15 [PATCH iproute2-next 0/1] DualPI2 iprtoue2 patch chia-yu.chang
2024-10-21 22:15 ` [PATCH iproute2-next 1/1] tc: add dualpi2 scheduler module chia-yu.chang
2024-10-21 23:08   ` Stephen Hemminger
2024-10-21 23:08   ` Stephen Hemminger [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=20241021160815.4516f322@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=Jason_Livingood@comcast.com \
    --cc=cheshire@apple.com \
    --cc=chia-yu.chang@nokia-bell-labs.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=g.white@CableLabs.com \
    --cc=henrist@henrist.net \
    --cc=ij@kernel.org \
    --cc=ingemar.s.johansson@ericsson.com \
    --cc=jhs@mojatatu.com \
    --cc=koen.de_schepper@nokia-bell-labs.com \
    --cc=kuba@kernel.org \
    --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=vidhi_goel@apple.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.