lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241021160815.4516f322@hermes.local>
Date: Mon, 21 Oct 2024 16:08:15 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: chia-yu.chang@...ia-bell-labs.com
Cc: netdev@...r.kernel.org, dsahern@...il.com, davem@...emloft.net,
 jhs@...atatu.com, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
 dsahern@...nel.org, ij@...nel.org, ncardwell@...gle.com,
 koen.de_schepper@...ia-bell-labs.com, g.white@...leLabs.com,
 ingemar.s.johansson@...csson.com, mirja.kuehlewind@...csson.com,
 cheshire@...le.com, rs.ietf@....at, Jason_Livingood@...cast.com,
 vidhi_goel@...le.com, Olga Albisser <olga@...isser.org>, Oliver Tilmans
 <olivier.tilmans@...ia.com>, Bob Briscoe <research@...briscoe.net>, Henrik
 Steen <henrist@...rist.net>
Subject: Re: [PATCH iproute2-next 1/1] tc: add dualpi2 scheduler module

On Tue, 22 Oct 2024 00:15:59 +0200
chia-yu.chang@...ia-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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ