X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fqos_sched%2Fstats.c;h=161f086f155dccf96a563a5ba7317723025ff6c2;hb=ef853f1fd97937e6a873bcb47aa71c9ece46f140;hp=b4db7b5423e4947651648e9c3717e2e08069eb02;hpb=3031749c2df04a63cdcef186dcce3781e61436e8;p=dpdk.git diff --git a/examples/qos_sched/stats.c b/examples/qos_sched/stats.c index b4db7b5423..161f086f15 100644 --- a/examples/qos_sched/stats.c +++ b/examples/qos_sched/stats.c @@ -1,35 +1,6 @@ -/*- - * * BSD LICENSE - * * - * * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * * All rights reserved. - * * - * * Redistribution and use in source and binary forms, with or without - * * modification, are permitted provided that the following conditions - * * are met: - * * - * * * Redistributions of source code must retain the above copyright - * * notice, this list of conditions and the following disclaimer. - * * * Redistributions in binary form must reproduce the above copyright - * * notice, this list of conditions and the following disclaimer in - * * the documentation and/or other materials provided with the - * * distribution. - * * * Neither the name of Intel Corporation nor the names of its - * * contributors may be used to endorse or promote products derived - * * from this software without specific prior written permission. - * * - * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation + */ #include #include @@ -37,280 +8,365 @@ #include "main.h" int -qavg_q(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc, uint8_t q) +qavg_q(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc, + uint8_t q) { - struct rte_sched_queue_stats stats; - struct rte_sched_port *port; - uint16_t qlen; - uint32_t queue_id, count, i; - uint32_t average; - - for (i = 0; i < nb_pfc; i++) { - if (qos_conf[i].tx_port == port_id) - break; - } - if (i == nb_pfc || subport_id >= port_params.n_subports_per_port || pipe_id >= port_params.n_pipes_per_subport - || tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE || q >= RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS) - return -1; - - port = qos_conf[i].sched_port; - - queue_id = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS * (subport_id * port_params.n_pipes_per_subport + pipe_id); - queue_id = queue_id + (tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + q); - - average = 0; - - for (count = 0; count < qavg_ntimes; count++) { - rte_sched_queue_read_stats(port, queue_id, &stats, &qlen); - average += qlen; - usleep(qavg_period); - } - - average /= qavg_ntimes; - - printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); - - return 0; + struct rte_sched_queue_stats stats; + struct rte_sched_port *port; + uint16_t qlen; + uint32_t count, i, queue_id = 0; + uint32_t average; + + for (i = 0; i < nb_pfc; i++) { + if (qos_conf[i].tx_port == port_id) + break; + } + + if (i == nb_pfc || + subport_id >= port_params.n_subports_per_port || + pipe_id >= subport_params[subport_id].n_pipes_per_subport_enabled || + tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE || + q >= RTE_SCHED_BE_QUEUES_PER_PIPE || + (tc < RTE_SCHED_TRAFFIC_CLASS_BE && q > 0)) + return -1; + + port = qos_conf[i].sched_port; + for (i = 0; i < subport_id; i++) + queue_id += subport_params[i].n_pipes_per_subport_enabled * + RTE_SCHED_QUEUES_PER_PIPE; + if (tc < RTE_SCHED_TRAFFIC_CLASS_BE) + queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE + tc; + else + queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE + tc + q; + + average = 0; + for (count = 0; count < qavg_ntimes; count++) { + rte_sched_queue_read_stats(port, queue_id, &stats, &qlen); + average += qlen; + usleep(qavg_period); + } + + average /= qavg_ntimes; + + printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); + + return 0; } int -qavg_tcpipe(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc) +qavg_tcpipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id, + uint8_t tc) { - struct rte_sched_queue_stats stats; - struct rte_sched_port *port; - uint16_t qlen; - uint32_t queue_id, count, i; - uint32_t average, part_average; - - for (i = 0; i < nb_pfc; i++) { - if (qos_conf[i].tx_port == port_id) - break; - } - if (i == nb_pfc || subport_id >= port_params.n_subports_per_port || pipe_id >= port_params.n_pipes_per_subport - || tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE) - return -1; - - port = qos_conf[i].sched_port; - - queue_id = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS * (subport_id * port_params.n_pipes_per_subport + pipe_id); - - average = 0; - - for (count = 0; count < qavg_ntimes; count++) { - part_average = 0; - for (i = 0; i < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; i++) { - rte_sched_queue_read_stats(port, queue_id + (tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + i), &stats, &qlen); - part_average += qlen; - } - average += part_average / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; - usleep(qavg_period); - } - - average /= qavg_ntimes; - - printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); - - return 0; + struct rte_sched_queue_stats stats; + struct rte_sched_port *port; + uint16_t qlen; + uint32_t count, i, queue_id = 0; + uint32_t average, part_average; + + for (i = 0; i < nb_pfc; i++) { + if (qos_conf[i].tx_port == port_id) + break; + } + + if (i == nb_pfc || subport_id >= port_params.n_subports_per_port || + pipe_id >= subport_params[subport_id].n_pipes_per_subport_enabled || + tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE) + return -1; + + port = qos_conf[i].sched_port; + + for (i = 0; i < subport_id; i++) + queue_id += + subport_params[i].n_pipes_per_subport_enabled * + RTE_SCHED_QUEUES_PER_PIPE; + + queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE + tc; + + average = 0; + + for (count = 0; count < qavg_ntimes; count++) { + part_average = 0; + + if (tc < RTE_SCHED_TRAFFIC_CLASS_BE) { + rte_sched_queue_read_stats(port, queue_id, + &stats, &qlen); + part_average += qlen; + } else { + for (i = 0; i < RTE_SCHED_BE_QUEUES_PER_PIPE; i++) { + rte_sched_queue_read_stats(port, queue_id + i, + &stats, &qlen); + part_average += qlen; + } + average += part_average / RTE_SCHED_BE_QUEUES_PER_PIPE; + } + usleep(qavg_period); + } + + average /= qavg_ntimes; + + printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); + + return 0; } int -qavg_pipe(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id) +qavg_pipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id) { - struct rte_sched_queue_stats stats; - struct rte_sched_port *port; - uint16_t qlen; - uint32_t queue_id, count, i; - uint32_t average, part_average; + struct rte_sched_queue_stats stats; + struct rte_sched_port *port; + uint16_t qlen; + uint32_t count, i, queue_id = 0; + uint32_t average, part_average; - for (i = 0; i < nb_pfc; i++) { - if (qos_conf[i].tx_port == port_id) - break; - } - if (i == nb_pfc || subport_id >= port_params.n_subports_per_port || pipe_id >= port_params.n_pipes_per_subport) - return -1; + for (i = 0; i < nb_pfc; i++) { + if (qos_conf[i].tx_port == port_id) + break; + } - port = qos_conf[i].sched_port; + if (i == nb_pfc || + subport_id >= port_params.n_subports_per_port || + pipe_id >= subport_params[subport_id].n_pipes_per_subport_enabled) + return -1; - queue_id = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS * (subport_id * port_params.n_pipes_per_subport + pipe_id); + port = qos_conf[i].sched_port; - average = 0; + for (i = 0; i < subport_id; i++) + queue_id += subport_params[i].n_pipes_per_subport_enabled * + RTE_SCHED_QUEUES_PER_PIPE; - for (count = 0; count < qavg_ntimes; count++) { - part_average = 0; - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; i++) { - rte_sched_queue_read_stats(port, queue_id + i, &stats, &qlen); - part_average += qlen; - } - average += part_average / (RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS); - usleep(qavg_period); - } + queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE; - average /= qavg_ntimes; + average = 0; - printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); + for (count = 0; count < qavg_ntimes; count++) { + part_average = 0; + for (i = 0; i < RTE_SCHED_QUEUES_PER_PIPE; i++) { + rte_sched_queue_read_stats(port, queue_id + i, + &stats, &qlen); + part_average += qlen; + } + average += part_average / RTE_SCHED_QUEUES_PER_PIPE; + usleep(qavg_period); + } - return 0; + average /= qavg_ntimes; + + printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); + + return 0; } int -qavg_tcsubport(uint8_t port_id, uint32_t subport_id, uint8_t tc) +qavg_tcsubport(uint16_t port_id, uint32_t subport_id, uint8_t tc) { - struct rte_sched_queue_stats stats; - struct rte_sched_port *port; - uint16_t qlen; - uint32_t queue_id, count, i, j; - uint32_t average, part_average; - - for (i = 0; i < nb_pfc; i++) { - if (qos_conf[i].tx_port == port_id) - break; - } - if (i == nb_pfc || subport_id >= port_params.n_subports_per_port || tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE) - return -1; - - port = qos_conf[i].sched_port; - - average = 0; - - for (count = 0; count < qavg_ntimes; count++) { - part_average = 0; - for (i = 0; i < port_params.n_pipes_per_subport; i++) { - queue_id = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS * (subport_id * port_params.n_pipes_per_subport + i); - - for (j = 0; j < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; j++) { - rte_sched_queue_read_stats(port, queue_id + (tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + j), &stats, &qlen); - part_average += qlen; - } - } - - average += part_average / (port_params.n_pipes_per_subport * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS); - usleep(qavg_period); - } - - average /= qavg_ntimes; - - printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); - - return 0; + struct rte_sched_queue_stats stats; + struct rte_sched_port *port; + uint16_t qlen; + uint32_t queue_id, count, i, j, subport_queue_id = 0; + uint32_t average, part_average; + + for (i = 0; i < nb_pfc; i++) { + if (qos_conf[i].tx_port == port_id) + break; + } + + if (i == nb_pfc || + subport_id >= port_params.n_subports_per_port || + tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE) + return -1; + + port = qos_conf[i].sched_port; + + for (i = 0; i < subport_id; i++) + subport_queue_id += + subport_params[i].n_pipes_per_subport_enabled * + RTE_SCHED_QUEUES_PER_PIPE; + + average = 0; + + for (count = 0; count < qavg_ntimes; count++) { + uint32_t n_pipes_per_subport = + subport_params[subport_id].n_pipes_per_subport_enabled; + + part_average = 0; + for (i = 0; i < n_pipes_per_subport; i++) { + if (tc < RTE_SCHED_TRAFFIC_CLASS_BE) { + queue_id = subport_queue_id + + i * RTE_SCHED_QUEUES_PER_PIPE + tc; + rte_sched_queue_read_stats(port, queue_id, + &stats, &qlen); + part_average += qlen; + } else { + for (j = 0; j < RTE_SCHED_BE_QUEUES_PER_PIPE; j++) { + queue_id = subport_queue_id + + i * RTE_SCHED_QUEUES_PER_PIPE + + tc + j; + rte_sched_queue_read_stats(port, queue_id, + &stats, &qlen); + part_average += qlen; + } + } + } + + if (tc < RTE_SCHED_TRAFFIC_CLASS_BE) + average += part_average / + (subport_params[subport_id].n_pipes_per_subport_enabled); + else + average += part_average / + (subport_params[subport_id].n_pipes_per_subport_enabled) * + RTE_SCHED_BE_QUEUES_PER_PIPE; + + usleep(qavg_period); + } + + average /= qavg_ntimes; + + printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); + + return 0; } int -qavg_subport(uint8_t port_id, uint32_t subport_id) +qavg_subport(uint16_t port_id, uint32_t subport_id) { - struct rte_sched_queue_stats stats; - struct rte_sched_port *port; - uint16_t qlen; - uint32_t queue_id, count, i, j; - uint32_t average, part_average; + struct rte_sched_queue_stats stats; + struct rte_sched_port *port; + uint16_t qlen; + uint32_t queue_id, count, i, j, subport_queue_id = 0; + uint32_t average, part_average; + + for (i = 0; i < nb_pfc; i++) { + if (qos_conf[i].tx_port == port_id) + break; + } - for (i = 0; i < nb_pfc; i++) { - if (qos_conf[i].tx_port == port_id) - break; - } - if (i == nb_pfc || subport_id >= port_params.n_subports_per_port) - return -1; + if (i == nb_pfc || + subport_id >= port_params.n_subports_per_port) + return -1; - port = qos_conf[i].sched_port; + port = qos_conf[i].sched_port; - average = 0; + for (i = 0; i < subport_id; i++) + subport_queue_id += subport_params[i].n_pipes_per_subport_enabled * + RTE_SCHED_QUEUES_PER_PIPE; - for (count = 0; count < qavg_ntimes; count++) { - part_average = 0; - for (i = 0; i < port_params.n_pipes_per_subport; i++) { - queue_id = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS * (subport_id * port_params.n_pipes_per_subport + i); + average = 0; - for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; j++) { - rte_sched_queue_read_stats(port, queue_id + j, &stats, &qlen); - part_average += qlen; - } - } + for (count = 0; count < qavg_ntimes; count++) { + uint32_t n_pipes_per_subport = + subport_params[subport_id].n_pipes_per_subport_enabled; - average += part_average / (port_params.n_pipes_per_subport * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS); - usleep(qavg_period); - } + part_average = 0; + for (i = 0; i < n_pipes_per_subport; i++) { + queue_id = subport_queue_id + i * RTE_SCHED_QUEUES_PER_PIPE; - average /= qavg_ntimes; + for (j = 0; j < RTE_SCHED_QUEUES_PER_PIPE; j++) { + rte_sched_queue_read_stats(port, queue_id + j, + &stats, &qlen); + part_average += qlen; + } + } - printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); + average += part_average / + (subport_params[subport_id].n_pipes_per_subport_enabled * + RTE_SCHED_QUEUES_PER_PIPE); + usleep(qavg_period); + } - return 0; + average /= qavg_ntimes; + + printf("\nAverage queue size: %" PRIu32 " bytes.\n\n", average); + + return 0; } int -subport_stat(uint8_t port_id, uint32_t subport_id) +subport_stat(uint16_t port_id, uint32_t subport_id) { - struct rte_sched_subport_stats stats; - struct rte_sched_port *port; - uint32_t tc_ov[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; - uint8_t i; - - for (i = 0; i < nb_pfc; i++) { - if (qos_conf[i].tx_port == port_id) - break; - } - if (i == nb_pfc || subport_id >= port_params.n_subports_per_port) - return -1; - - port = qos_conf[i].sched_port; - memset (tc_ov, 0, sizeof(tc_ov)); - - rte_sched_subport_read_stats(port, subport_id, &stats, tc_ov); - - printf("\n"); - printf("+----+-------------+-------------+-------------+-------------+-------------+\n"); - printf("| TC | Pkts OK |Pkts Dropped | Bytes OK |Bytes Dropped| OV Status |\n"); - printf("+----+-------------+-------------+-------------+-------------+-------------+\n"); - - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { - printf("| %d | %11" PRIu32 " | %11" PRIu32 " | %11" PRIu32 " | %11" PRIu32 " | %11" PRIu32 " |\n", i, - stats.n_pkts_tc[i], stats.n_pkts_tc_dropped[i], - stats.n_bytes_tc[i], stats.n_bytes_tc_dropped[i], tc_ov[i]); - printf("+----+-------------+-------------+-------------+-------------+-------------+\n"); - } - printf("\n"); - - return 0; + struct rte_sched_subport_stats stats; + struct rte_sched_port *port; + uint32_t tc_ov[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; + uint8_t i; + + for (i = 0; i < nb_pfc; i++) { + if (qos_conf[i].tx_port == port_id) + break; + } + + if (i == nb_pfc || subport_id >= port_params.n_subports_per_port) + return -1; + + port = qos_conf[i].sched_port; + memset(tc_ov, 0, sizeof(tc_ov)); + + rte_sched_subport_read_stats(port, subport_id, &stats, tc_ov); + + printf("\n"); + printf("+----+-------------+-------------+-------------+-------------+-------------+\n"); + printf("| TC | Pkts OK |Pkts Dropped | Bytes OK |Bytes Dropped| OV Status |\n"); + printf("+----+-------------+-------------+-------------+-------------+-------------+\n"); + + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { + printf("| %d | %11" PRIu64 " | %11" PRIu64 " | %11" PRIu64 " | %11" PRIu64 " | %11" PRIu32 " |\n", + i, stats.n_pkts_tc[i], stats.n_pkts_tc_dropped[i], + stats.n_bytes_tc[i], stats.n_bytes_tc_dropped[i], tc_ov[i]); + printf("+----+-------------+-------------+-------------+-------------+-------------+\n"); + } + printf("\n"); + + return 0; } int -pipe_stat(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id) +pipe_stat(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id) { - struct rte_sched_queue_stats stats; - struct rte_sched_port *port; - uint16_t qlen; - uint8_t i, j; - uint32_t queue_id; - - for (i = 0; i < nb_pfc; i++) { - if (qos_conf[i].tx_port == port_id) - break; - } - if (i == nb_pfc || subport_id >= port_params.n_subports_per_port || pipe_id >= port_params.n_pipes_per_subport) - return -1; - - port = qos_conf[i].sched_port; - - queue_id = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS * (subport_id * port_params.n_pipes_per_subport + pipe_id); - - printf("\n"); - printf("+----+-------+-------------+-------------+-------------+-------------+-------------+\n"); - printf("| TC | Queue | Pkts OK |Pkts Dropped | Bytes OK |Bytes Dropped| Length |\n"); - printf("+----+-------+-------------+-------------+-------------+-------------+-------------+\n"); - - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { - for (j = 0; j < RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS; j++) { - - rte_sched_queue_read_stats(port, queue_id + (i * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + j), &stats, &qlen); - - printf("| %d | %d | %11" PRIu32 " | %11" PRIu32 " | %11" PRIu32 " | %11" PRIu32 " | %11i |\n", i, j, - stats.n_pkts, stats.n_pkts_dropped, stats.n_bytes, stats.n_bytes_dropped, qlen); - printf("+----+-------+-------------+-------------+-------------+-------------+-------------+\n"); - } - if (i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1) - printf("+----+-------+-------------+-------------+-------------+-------------+-------------+\n"); - } - printf("\n"); - - return 0; + struct rte_sched_queue_stats stats; + struct rte_sched_port *port; + uint16_t qlen; + uint8_t i, j; + uint32_t queue_id = 0; + + for (i = 0; i < nb_pfc; i++) { + if (qos_conf[i].tx_port == port_id) + break; + } + + if (i == nb_pfc || + subport_id >= port_params.n_subports_per_port || + pipe_id >= subport_params[subport_id].n_pipes_per_subport_enabled) + return -1; + + port = qos_conf[i].sched_port; + for (i = 0; i < subport_id; i++) + queue_id += subport_params[i].n_pipes_per_subport_enabled * + RTE_SCHED_QUEUES_PER_PIPE; + + queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE; + + printf("\n"); + printf("+----+-------+-------------+-------------+-------------+-------------+-------------+\n"); + printf("| TC | Queue | Pkts OK |Pkts Dropped | Bytes OK |Bytes Dropped| Length |\n"); + printf("+----+-------+-------------+-------------+-------------+-------------+-------------+\n"); + + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) { + if (i < RTE_SCHED_TRAFFIC_CLASS_BE) { + rte_sched_queue_read_stats(port, queue_id + i, &stats, &qlen); + printf("| %d | %d | %11" PRIu64 " | %11" PRIu64 " | %11" PRIu64 " | %11" PRIu64 " | %11i |\n", + i, 0, stats.n_pkts, stats.n_pkts_dropped, stats.n_bytes, + stats.n_bytes_dropped, qlen); + printf("+----+-------+-------------+-------------+-------------+-------------+-------------+\n"); + } else { + for (j = 0; j < RTE_SCHED_BE_QUEUES_PER_PIPE; j++) { + rte_sched_queue_read_stats(port, queue_id + i + j, + &stats, &qlen); + printf("| %d | %d | %11" PRIu64 " | %11" PRIu64 " | %11" PRIu64 " | %11" PRIu64 " | %11i |\n", + i, j, stats.n_pkts, stats.n_pkts_dropped, stats.n_bytes, + stats.n_bytes_dropped, qlen); + printf("+----+-------+-------------+-------------+-------------+-------------+-------------+\n"); + } + } + } + printf("\n"); + + return 0; } -