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.

Reply via email to