rte_sched: don't count RED-drops as tail-drops
PATCH 1/1 rte_sched: don't count RED-drops as tail-drops
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.
--- lib/librte_sched/rte_sched.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_sched/rte_sched.c +2 -2
@@ -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;
Signature · 1 line
2.1.4
Quoted 5 lines
Packets that are RED-dropped are not Tail-dropped, so the
n_pkts_droppedcounter should not be incremented when then_pkts_red_droppedcounter is.
Hi Alan,
Not really:
* The n_pkts_dropped counter is intended to be incremented every time a packet is dropped, regardless of the drop cause (either tail drop or RED), so it is cumulative of all drop causes.
* The n_pkts_red_dropped counter is only incremented when the drop cause is RED, so it represents a slice of n_pkts_dropped. Therefore, the number of packets dropped due to tail drop is (n_pkts_dropped - n_pkts_red_dropped).
So NAK.
Thanks,
Cristian