From patchwork Wed Feb 1 04:20:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh A P X-Patchwork-Id: 122772 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C642641B96; Wed, 1 Feb 2023 05:23:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EAF92427E9; Wed, 1 Feb 2023 05:23:16 +0100 (CET) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.205]) by mails.dpdk.org (Postfix) with ESMTP id 734BC4021F for ; Wed, 1 Feb 2023 05:23:15 +0100 (CET) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 1C9C9C0000EC; Tue, 31 Jan 2023 20:23:13 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 1C9C9C0000EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1675225395; bh=t0gaA2r6HBpfUIYCYw977BsRAqj2kRiMQH1s9ArKfo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iY7n7pitd7iYFXOy5uVMRJkqq5mFrE7CadSUU5cxK0OVE6v89POYIulSe4S9UjuiG Pg83FXbb073YiZ7P8e9qVWXEsCN2V68EMNb6zrMrUJVGSBevvJJeU3PDBiQCiE61qV SgVLmvh/lTq446Wv9Z/y7+ofXHdGmpabNoialpd4= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@amd.com, ajit.khaparde@broadcom.com Subject: [dpdk-dev] [PATCH 1/3] net/bnxt: fix Tx queue stats after queue stop and start Date: Wed, 1 Feb 2023 09:50:12 +0530 Message-Id: <20230201042014.23526-2-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20230201042014.23526-1-kalesh-anakkur.purayil@broadcom.com> References: <20230201042014.23526-1-kalesh-anakkur.purayil@broadcom.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Kalesh AP The Tx queue stats are being reported incorrectly due to a workaround for ring counters sometimes being reported as zero. When a queue is stopped and started, the ring counter is reset to zero. The workaround interprets the zero as incorrect, and sets the reported ring count as the previously read value (from before the queue being restared). This shows up as negative counters in testpmd's "show fwd stats" command. The fix clears the prev counter for the queue when the queue is started. Fixes: 219842b9990c ("net/bnxt: workaround spurious zero stats in Thor") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_txr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c index 67e0167..21c2217 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -560,6 +560,12 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) if (rc) return rc; + /* reset the previous stats for the tx_queue since the counters + * will be cleared when the queue is started. + */ + memset(&bp->prev_tx_ring_stats[tx_queue_id], 0, + sizeof(struct bnxt_ring_stats)); + bnxt_free_hwrm_tx_ring(bp, tx_queue_id); rc = bnxt_alloc_hwrm_tx_ring(bp, tx_queue_id); if (rc)