[02/10] port: adjust the sink port counters

Message ID 20220805220029.1096212-3-cristian.dumitrescu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series port: implement output port non-blocking behavior |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Cristian Dumitrescu Aug. 5, 2022, 10 p.m. UTC
  The sink port is tasked to drop all packets, hence the packet and byte
counters should be named to reflect the drop operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/port/rte_swx_port_source_sink.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/lib/port/rte_swx_port_source_sink.c b/lib/port/rte_swx_port_source_sink.c
index d3cf42c30b..757a2c4a2e 100644
--- a/lib/port/rte_swx_port_source_sink.c
+++ b/lib/port/rte_swx_port_source_sink.c
@@ -299,8 +299,8 @@  sink_pkt_tx(void *port, struct rte_swx_pkt *pkt)
 	m->pkt_len = pkt->length;
 	m->data_off = (uint16_t)pkt->offset;
 
-	p->stats.n_pkts++;
-	p->stats.n_bytes += pkt->length;
+	p->stats.n_pkts_drop++;
+	p->stats.n_bytes_drop += pkt->length;
 
 #ifdef RTE_PORT_PCAP
 	if (p->f_dump) {
@@ -335,8 +335,8 @@  __sink_pkt_clone_tx(void *port, struct rte_swx_pkt *pkt, uint32_t truncation_len
 	m->pkt_len = pkt->length;
 	m->data_off = (uint16_t)pkt->offset;
 
-	p->stats.n_pkts++;
-	p->stats.n_bytes += pkt->length;
+	p->stats.n_pkts_drop++;
+	p->stats.n_bytes_drop += pkt->length;
 	p->stats.n_pkts_clone++;
 
 #ifdef RTE_PORT_PCAP