From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from office2.cesnet.cz (office2.cesnet.cz [195.113.144.244]) by dpdk.org (Postfix) with ESMTP id 944311C5D5; Wed, 4 Apr 2018 15:42:41 +0200 (CEST) Received: from emilion.liberouter.org (emilion.liberouter.org [195.113.172.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id 2C2C940004E; Wed, 4 Apr 2018 15:42:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2; t=1522849361; bh=TZQ+8B31BjbMhqtF97HZihrJcn218G9nQ9FZxFxDs0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WnQ/CnO0BN8vwmShtGdEzxdcH7dmcn3N/eMmd/vf07en/C8JQt/x9934fDWZuPzoy md78KkoeAKqWLshnUQ4Tz8k6pIwpzAPavSuqmUWyfdvDLOTwhMl7KDlgu2okVHSqZK kUNXm3Qsr7ASZlcjB4lVr8fVOmv0oXTjWPbrWjc0= From: Matej Vido To: dev@dpdk.org Cc: remes@netcope.com, stable@dpdk.org Date: Wed, 4 Apr 2018 15:42:18 +0200 Message-Id: <1522849341-49049-2-git-send-email-vido@cesnet.cz> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522849341-49049-1-git-send-email-vido@cesnet.cz> References: <1522849341-49049-1-git-send-email-vido@cesnet.cz> Subject: [dpdk-dev] [PATCH 1/4] net/szedata2: fix total stats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 13:42:42 -0000 Counters from all queues have to be summed up for total stats even though the number of queue stats counters is not sufficient. Fixes: 83556fd2c0fc ("szedata2: change to physical device type") Cc: stable@dpdk.org Signed-off-by: Matej Vido --- drivers/net/szedata2/rte_eth_szedata2.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 3cfe388..fc11d68 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1058,22 +1058,29 @@ struct pmd_internals { uint64_t tx_err_total = 0; uint64_t rx_total_bytes = 0; uint64_t tx_total_bytes = 0; - const struct pmd_internals *internals = dev->data->dev_private; - for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < nb_rx; i++) { - stats->q_ipackets[i] = internals->rx_queue[i].rx_pkts; - stats->q_ibytes[i] = internals->rx_queue[i].rx_bytes; - rx_total += stats->q_ipackets[i]; - rx_total_bytes += stats->q_ibytes[i]; + for (i = 0; i < nb_rx; i++) { + struct szedata2_rx_queue *rxq = dev->data->rx_queues[i]; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_ipackets[i] = rxq->rx_pkts; + stats->q_ibytes[i] = rxq->rx_bytes; + } + rx_total += rxq->rx_pkts; + rx_total_bytes += rxq->rx_bytes; } - for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < nb_tx; i++) { - stats->q_opackets[i] = internals->tx_queue[i].tx_pkts; - stats->q_obytes[i] = internals->tx_queue[i].tx_bytes; - stats->q_errors[i] = internals->tx_queue[i].err_pkts; - tx_total += stats->q_opackets[i]; - tx_total_bytes += stats->q_obytes[i]; - tx_err_total += stats->q_errors[i]; + for (i = 0; i < nb_tx; i++) { + struct szedata2_tx_queue *txq = dev->data->tx_queues[i]; + + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) { + stats->q_opackets[i] = txq->tx_pkts; + stats->q_obytes[i] = txq->tx_bytes; + stats->q_errors[i] = txq->err_pkts; + } + tx_total += txq->tx_pkts; + tx_total_bytes += txq->tx_bytes; + tx_err_total += txq->err_pkts; } stats->ipackets = rx_total; -- 1.8.3.1