[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eff804f8-a415-637a-94bd-e4ce8d7e7b9f@gmail.com>
Date: Wed, 3 Oct 2018 10:36:11 -0600
From: David Ahern <dsahern@...il.com>
To: Vinicius Costa Gomes <vinicius.gomes@...el.com>,
netdev@...r.kernel.org
Cc: jhs@...atatu.com, xiyou.wangcong@...il.com, jiri@...nulli.us,
jesus.sanchez-palencia@...el.com, ilias.apalodimas@...aro.org,
simon.fok@...systems.com
Subject: Re: [PATCH iproute2 net-next v1 5/6] tc: Add support for configuring
the taprio scheduler
On 9/28/18 7:10 PM, Vinicius Costa Gomes wrote:
> This traffic scheduler allows traffic classes states (transmission
> allowed/not allowed, in the simplest case) to be scheduled, according
> to a pre-generated time sequence. This is the basis of the IEEE
> 802.1Qbv specification.
>
> Example configuration:
>
> tc qdisc replace dev enp3s0 parent root handle 100 taprio \
> num_tc 3 \
> map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
> queues 1@0 1@1 2@2 \
> base-time 1528743495910289987 \
> sched-entry S 01 300000 \
> sched-entry S 02 300000 \
> sched-entry S 04 300000 \
> clockid CLOCK_TAI
>
> The configuration format is similar to mqprio. The main difference is
> the presence of a schedule, built by multiple "sched-entry"
> definitions, each entry has the following format:
>
> sched-entry <CMD> <GATE MASK> <INTERVAL>
>
> The only supported <CMD> is "S", which means "SetGateStates",
...
> +static int str_to_entry_cmd(const char *str)
> +{
> + if (strcmp(str, "S") == 0)
> + return TC_TAPRIO_CMD_SET_GATES;
> +
> + if (strcmp(str, "H") == 0)
> + return TC_TAPRIO_CMD_SET_AND_HOLD;
> +
> + if (strcmp(str, "R") == 0)
> + return TC_TAPRIO_CMD_SET_AND_RELEASE;
If 'S' is the only supported command, what are 'H' and 'R'?
> +
> + return -1;
> +}
> +
> +
> +static const char *command_to_str(__u8 cmd)
> +{
> + switch (cmd) {
> + case TC_TAPRIO_CMD_SET_GATES:
> + return "S";
> + case TC_TAPRIO_CMD_SET_AND_HOLD:
> + return "H";
> + case TC_TAPRIO_CMD_SET_AND_RELEASE:
> + return "R";
> + default:
> + return "Invalid";
> + }
> +}
And can you keep str-to-command and command-to-str helpers close
together in the code.
Powered by blists - more mailing lists