Subject: Re: [PATCH iproute2 net-next v1 5/6] tc: Add support for configuring the taprio scheduler

From: Vinicius Costa Gomes <[email-masked]>
Date: Wed, 03 Oct 2018 10:13:41 -0700

Hi David,

David Ahern <[email-masked]> writes:

> 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'?

It is the only command that works (for now): taprio is a software only
implementation now.

Just to give some background, 'H' (Set-And-Hold-MAC) and 'R'
(Set-And-Release-MAC) will be used when Frame Preemption is added, 'H'
means that any preemtible frame should have finished being transmitted
before this "entry" starts and frame preemption is disabled, 'R' means
preemptible frames may be transmitted during this entry's interval and
frame preemption is re-enabled.

Will remove these references for now. 

>
>> +
>> +	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.

Sure. WIll fix it for v2.

Cheers,