Subject: Re: [PATCH v3 iproute2 2/3] tc: Add support for the ETF Qdisc

From: Stephen Hemminger <[email-masked]>
Date: Fri, 6 Jul 2018 14:32:37 -0700

> diff --git a/tc/q_etf.c b/tc/q_etf.c
> new file mode 100644
> index 00000000..5db1dd6f
> --- /dev/null
> +++ b/tc/q_etf.c
> @@ -0,0 +1,168 @@
> +/*
> + * q_etf.c		Earliest TxTime First (ETF).
> + *
> + *		This program is free software; you can redistribute it and/or
> + *		modify it under the terms of the GNU General Public License
> + *		as published by the Free Software Foundation; either version
> + *		2 of the License, or (at your option) any later version.
> + *
> + * Authors:	Vinicius Costa Gomes <[email-masked]>
> + *		Jesus Sanchez-Palencia <[email-masked]>
> + *
> + */

Please use SPDX tag rather than GPL boilerplate when adding new code.

> +static int get_clockid(__s32 *val, const char *arg)
> +{
> +	const struct static_clockid {
> +		const char *name;
> +		clockid_t clockid;
> +	} clockids_sysv[] = {
> +		{ "CLOCK_REALTIME", CLOCK_REALTIME },
> +		{ "CLOCK_TAI", CLOCK_TAI },
> +		{ "CLOCK_BOOTTIME", CLOCK_BOOTTIME },
> +		{ "CLOCK_MONOTONIC", CLOCK_MONOTONIC },
> +		{ NULL }
> +	};
> +
> +	const struct static_clockid *c;
> +
> +	for (c = clockids_sysv; c->name; c++) {
> +		if (strncasecmp(c->name, arg, 25) == 0) {
> +			*val = c->clockid;
> +
> +			return 0;
> +		}
> +	}
> +
> +	return -1;
> +}

Internally, kernel must use ktime. For the userspace part the TC standard
is to use USER HZ of 100.

Please change user kernel API of this module to match other existing modules.
Doing something unique for this module is not necessary.