From: Alan Dewar Subject: [PATCH] rte_sched: don't count RED-drops as tail-drops Date: Thu, 24 Aug 2017 13:00:11 +0100 Message-ID: <1503576011-11389-1-git-send-email-alan.dewar@att.com> Cc: dev@dpdk.org To: cristian.dumitrescu@intel.com Return-path: Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by dpdk.org (Postfix) with ESMTP id 3B4A27D24 for ; Thu, 24 Aug 2017 14:00:33 +0200 (CEST) Received: by mail-pg0-f68.google.com with SMTP id 189so3618100pgj.0 for ; Thu, 24 Aug 2017 05:00:33 -0700 (PDT) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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