From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B93CA0C51; Tue, 13 Jul 2021 15:13:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3330410DF; Tue, 13 Jul 2021 15:13:15 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (lpdvsmtp10.broadcom.com [192.19.11.229]) by mails.dpdk.org (Postfix) with ESMTP id 73207406FF for ; Tue, 13 Jul 2021 15:13:14 +0200 (CEST) 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 A08E17DC2; Tue, 13 Jul 2021 06:13:11 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com A08E17DC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1626181992; bh=2kbRF0QH6y+Yl6RQXF3C7YJpOvXIbSDZN45KZ4W5pq0=; h=From:To:Cc:Subject:Date:From; b=AqKVq097rMBnl37m0ZSTX2+kQ1P+nEdCNqqhg6mFhCRMaAbQov2LWwXSX9dxSIdG9 KjWKkk84lGM93MTHPp4a7ftoTBXwLSyOYLKa4FOoNcb7yy4ZYB7OLGRqgv7Ki2Spsx jD+2LypnJVma7LiUT88mKEvA/mX8Kb74gN7s2yxQ= From: Kalesh A P To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com Date: Tue, 13 Jul 2021 19:04:13 +0530 Message-Id: <20210713133413.28729-1-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 Subject: [dpdk-dev] [PATCH] net/bnxt: fix to clear cached value of stats in clear stats 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 Sender: "dev" From: Kalesh AP As part of the workaround put in the commit "219842b9990c", driver caches the last read stats values from the hardware. But this is not cleared during the clear stats operation. This results in showing up stale stats values while reading the stats after the clear operation. Fixes: 219842b9990c ("net/bnxt: workaround spurious zero stats in Thor") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Lance Richardson Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_stats.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c index c7b23f4..991eafc 100644 --- a/drivers/net/bnxt/bnxt_stats.c +++ b/drivers/net/bnxt/bnxt_stats.c @@ -603,6 +603,16 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev, return rc; } +static void bnxt_clear_prev_stat(struct bnxt *bp) +{ + /* + * Clear the cached values of stats returned by HW in the previous + * get operation. + */ + memset(bp->prev_rx_ring_stats, 0, sizeof(struct bnxt_ring_stats) * bp->rx_cp_nr_rings); + memset(bp->prev_tx_ring_stats, 0, sizeof(struct bnxt_ring_stats) * bp->tx_cp_nr_rings); +} + int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev) { struct bnxt *bp = eth_dev->data->dev_private; @@ -625,6 +635,8 @@ int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev) rte_atomic64_clear(&rxq->rx_mbuf_alloc_fail); } + bnxt_clear_prev_stat(bp); + return ret; } @@ -933,6 +945,8 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev) PMD_DRV_LOG(ERR, "Failed to reset xstats: %s\n", strerror(-ret)); + bnxt_clear_prev_stat(bp); + return ret; } -- 2.10.1