[dpdk-dev] [PATCH] rte_sched: don't count RED-drops as tail-drops

Alan Dewar alangordondewar at gmail.com
Thu Aug 24 14:00:11 CEST 2017


Everytime the rte_sched_port_update_subport_stats_on_drop or
rte_sched_port_update_queue_stats_on_drop functions are called the
n_pkts_dropped counter is incremented.

The n_pkts_red_dropped counter is only incremented when the function
argument red is non-zero.

Packets that are RED-dropped are not Tail-dropped, so the n_pkts_dropped
counter should not be incremented when the n_pkts_red_dropped counter is.

Signed-off-by: Alan Dewar <alan.dewar at att.com>
---
 lib/librte_sched/rte_sched.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index b7cba11..c10c266 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -1108,7 +1108,7 @@ rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port,
 	uint32_t tc_index = (qindex >> 2) & 0x3;
 	uint32_t pkt_len = pkt->pkt_len;
 
-	s->stats.n_pkts_tc_dropped[tc_index] += 1;
+	s->stats.n_pkts_tc_dropped[tc_index] += !red;
 	s->stats.n_bytes_tc_dropped[tc_index] += pkt_len;
 #ifdef RTE_SCHED_RED
 	s->stats.n_pkts_red_dropped[tc_index] += red;
@@ -1140,7 +1140,7 @@ rte_sched_port_update_queue_stats_on_drop(struct rte_sched_port *port,
 	struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
 	uint32_t pkt_len = pkt->pkt_len;
 
-	qe->stats.n_pkts_dropped += 1;
+	qe->stats.n_pkts_dropped += !red;
 	qe->stats.n_bytes_dropped += pkt_len;
 #ifdef RTE_SCHED_RED
 	qe->stats.n_pkts_red_dropped += red;
-- 
2.1.4



More information about the dev mailing list