[v3,4/9] app/testpmd: fix packet transmission in noisy VNF engine

Message ID 20230220183502.3348368-5-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Testpmd code cleanup |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Feb. 20, 2023, 6:34 p.m. UTC
  nb_rx relates to the number of packets received from the driver.
nb_tx is the total number of packets transmitted by this forward engine.

Fix the retry stage, for dequeued packets, as it was incorrectly
passing nb_rx / nb_tx as bounds of the tmp_pkts[] array, and fix tx stats
accordingly.

Fixes: 3c156061b938 ("app/testpmd: add noisy neighbour forwarding mode")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/noisy_vnf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Feb. 28, 2023, 6:51 p.m. UTC | #1
On 2/20/2023 6:34 PM, David Marchand wrote:
> nb_rx relates to the number of packets received from the driver.
> nb_tx is the total number of packets transmitted by this forward engine.
> 
> Fix the retry stage, for dequeued packets, as it was incorrectly
> passing nb_rx / nb_tx as bounds of the tmp_pkts[] array, and fix tx stats
> accordingly.
> 
> Fixes: 3c156061b938 ("app/testpmd: add noisy neighbour forwarding mode")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
  

Patch

diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c
index ce5a3e5e69..0e72dc034f 100644
--- a/app/test-pmd/noisy_vnf.c
+++ b/app/test-pmd/noisy_vnf.c
@@ -217,9 +217,10 @@  pkt_burst_noisy_vnf(struct fwd_stream *fs)
 		sent = rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
 					 tmp_pkts, nb_deqd);
 		if (unlikely(sent < nb_deqd) && fs->retry_enabled)
-			nb_tx += do_retry(nb_rx, nb_tx, tmp_pkts, fs);
-		inc_tx_burst_stats(fs, nb_tx);
+			sent += do_retry(nb_deqd, sent, tmp_pkts, fs);
+		inc_tx_burst_stats(fs, sent);
 		fs->fwd_dropped += drop_pkts(tmp_pkts, nb_deqd, sent);
+		nb_tx += sent;
 		ncf->prev_time = rte_get_timer_cycles();
 	}
 end: