From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 7CD1D41CEC;
	Mon, 20 Feb 2023 17:41:54 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 937C3430A7;
	Mon, 20 Feb 2023 17:41:49 +0100 (CET)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id 6DEB8430B6
 for <dev@dpdk.org>; Mon, 20 Feb 2023 17:41:47 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1676911307;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=1Dji4/wCD978V1OBVX9B/v0EzSSjtqEv2rPwixNvdhc=;
 b=ZoAF7NW9JtUF08sV9IwC98TpOCaQJZcQtEzGTO3nwPhss8iKfdo1bBXH260cjdEF3nCYWI
 M+yFpIxopjIkgF9xVrt85j8vgc5/XTp/5VsAYdjPDof6jasgHNaMQR3oKdjhzniHaxkfEO
 Mq/oVaeQRvxMRuwsdvPou10ceyld+IY=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-602-b0_EqwZQOvm3bwoC57C7Uw-1; Mon, 20 Feb 2023 11:41:43 -0500
X-MC-Unique: b0_EqwZQOvm3bwoC57C7Uw-1
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com
 [10.11.54.7])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6DC03802C16;
 Mon, 20 Feb 2023 16:41:43 +0000 (UTC)
Received: from dmarchan.redhat.com (unknown [10.45.224.55])
 by smtp.corp.redhat.com (Postfix) with ESMTP id C9799140EBF6;
 Mon, 20 Feb 2023 16:41:41 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@amd.com>,
 Aman Singh <aman.deep.singh@intel.com>,
 Yuying Zhang <yuying.zhang@intel.com>, Robin Jarry <rjarry@redhat.com>,
 stable@dpdk.org, Jens Freimann <jfreimann@redhat.com>,
 Kevin Traynor <ktraynor@redhat.com>,
 Bernard Iremonger <bernard.iremonger@intel.com>
Subject: [PATCH v2 4/9] app/testpmd: fix packet transmission in noisy VNF
 engine
Date: Mon, 20 Feb 2023 17:40:58 +0100
Message-Id: <20230220164103.3041538-5-david.marchand@redhat.com>
In-Reply-To: <20230220164103.3041538-1-david.marchand@redhat.com>
References: <20230124104742.1265439-1-david.marchand@redhat.com>
 <20230220164103.3041538-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"; x-default=true
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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(-)

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:
-- 
2.39.2