On Thu, 29 Jun 2017 16:35:42 +0200
Olivier Chirossel <[email protected]> wrote:
> /* Subport TCs */
> if (unlikely(port->time >= subport->tc_time)) {
> - subport->tc_credits[0] = subport->tc_credits_per_period[0];
> - subport->tc_credits[1] = subport->tc_credits_per_period[1];
> - subport->tc_credits[2] = subport->tc_credits_per_period[2];
> - subport->tc_credits[3] = subport->tc_credits_per_period[3];
> + for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) {
> + if ((subport->tc_credits[j] +
> subport->tc_credits_per_period[j]) < subport->tc_rate[j]) {
> + subport->tc_credits[j] +=
> subport->tc_credits_per_period[j];
> + }
> + else {
> + subport->tc_credits[j] = subport->tc_rate[j];
> + }
> + }
The loop was manually unrolled for speed.