From: David Marchand <david.marchand@redhat.com>
To: Rastislav Cernay <cernay@netcope.com>
Cc: dev@dpdk.org, "Yigit, Ferruh" <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3] net/nfb: new netcope driver
Date: Mon, 4 Mar 2019 12:34:48 +0100 [thread overview]
Message-ID: <CAJFAV8yD8dzps6vu7Twp54SvPF9wqd9vgWR9FAzJBhTLdAhWCw@mail.gmail.com> (raw)
In-Reply-To: <1551451054-111249-1-git-send-email-cernay@netcope.com>
On Fri, Mar 1, 2019 at 3:38 PM Rastislav Cernay <cernay@netcope.com> wrote:
> diff --git a/drivers/net/nfb/nfb_stats.c b/drivers/net/nfb/nfb_stats.c
> new file mode 100644
> index 0000000..ffc27a5
> --- /dev/null
> +++ b/drivers/net/nfb/nfb_stats.c
> @@ -0,0 +1,78 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2018 Cesnet
> + * Copyright(c) 2018 Netcope Technologies, a.s. <info@netcope.com>
> + * All rights reserved.
> + */
> +
> +#include "nfb_stats.h"
> +#include "nfb.h"
> +
> +int
> +nfb_eth_stats_get(struct rte_eth_dev *dev,
> + struct rte_eth_stats *stats)
> +{
> + uint16_t i;
> + uint16_t nb_rx = dev->data->nb_rx_queues;
> + uint16_t nb_tx = dev->data->nb_tx_queues;
> + uint64_t rx_total = 0;
> + uint64_t tx_total = 0;
> + uint64_t tx_err_total = 0;
> + uint64_t rx_total_bytes = 0;
> + uint64_t tx_total_bytes = 0;
> +
> + struct ndp_rx_queue *rx_queue = *((struct ndp_rx_queue **)
> + dev->data->rx_queues);
> + struct ndp_tx_queue *tx_queue = *((struct ndp_tx_queue **)
> + dev->data->tx_queues);
> +
> + for (i = 0; i < nb_rx; i++) {
> + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
> + stats->q_ipackets[i] = rx_queue[i].rx_pkts;
> + stats->q_ibytes[i] = rx_queue[i].rx_bytes;
> + }
> + rx_total += stats->q_ipackets[i];
> + rx_total_bytes += stats->q_ibytes[i];
> + }
>
What is the point of adding when i >= RTE_ETHDEV_QUEUE_STAT_CNTRS ?
Hopefully, ethdev passes a zero'd structure, but still I find it confusing.
> +
> + for (i = 0; i < nb_tx; i++) {
> + if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
> + stats->q_opackets[i] = tx_queue[i].tx_pkts;
> + stats->q_obytes[i] = tx_queue[i].tx_bytes;
> + stats->q_errors[i] = 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];
> + }
>
Idem.
Besides, q_errors[] is for reception errors.
+
> + stats->ipackets = rx_total;
> + stats->opackets = tx_total;
> + stats->ibytes = rx_total_bytes;
> + stats->obytes = tx_total_bytes;
> + stats->oerrors = tx_err_total;
> + return 0;
> +}
>
>
--
David Marchand
next prev parent reply other threads:[~2019-03-04 11:35 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-26 12:57 [dpdk-dev] [PATCH] net/nfb: new Netcope driver Rastislav Cernay
2019-02-26 12:57 ` [dpdk-dev] [PATCH] net/nfb: new netcope driver Rastislav Cernay
2019-02-26 14:20 ` Rami Rosen
2019-02-26 16:33 ` Rastislav Černay
2019-02-26 15:46 ` Stephen Hemminger
2019-02-27 11:43 ` [dpdk-dev] [PATCH v2] net/nfb: new Netcope driver Rastislav Cernay
2019-02-27 15:28 ` Ferruh Yigit
2019-03-01 14:37 ` [dpdk-dev] [PATCH v3] net/nfb: new netcope driver Rastislav Cernay
2019-03-01 18:47 ` Stephen Hemminger
2019-03-04 14:07 ` Rastislav Černay
2019-03-01 18:50 ` Stephen Hemminger
2019-03-04 9:53 ` David Marchand
2019-03-04 11:34 ` David Marchand [this message]
2019-03-04 14:33 ` Rastislav Černay
2019-03-04 12:35 ` David Marchand
2019-03-04 12:48 ` David Marchand
2019-03-04 15:15 ` Rastislav Černay
2019-03-05 20:31 ` Rami Rosen
2019-03-05 22:41 ` Luca Boccassi
2019-03-06 14:51 ` Rastislav Černay
2019-03-06 13:25 ` Luca Boccassi
2019-03-07 13:24 ` [dpdk-dev] [PATCH v4] " Rastislav Cernay
2019-03-07 13:46 ` Luca Boccassi
2019-03-07 14:14 ` Jan Remeš
2019-03-22 12:12 ` [dpdk-dev] [PATCH v5] " Rastislav Cernay
2019-03-22 12:12 ` Rastislav Cernay
2019-03-28 16:01 ` Ferruh Yigit
2019-03-28 16:01 ` Ferruh Yigit
2019-04-01 14:55 ` Rastislav Černay
2019-04-01 14:22 ` Ferruh Yigit
2019-04-01 14:22 ` Ferruh Yigit
2019-04-02 16:05 ` Rastislav Černay
2019-04-02 16:05 ` Rastislav Černay
2019-04-01 14:23 ` Luca Boccassi
2019-04-01 14:23 ` Luca Boccassi
2019-04-01 14:55 ` Rastislav Černay
2019-04-04 9:05 ` [dpdk-dev] [PATCH v6] " Rastislav Cernay
2019-04-04 9:05 ` Rastislav Cernay
2019-04-05 0:08 ` Ferruh Yigit
2019-04-05 0:08 ` Ferruh Yigit
2019-04-07 15:03 ` [dpdk-dev] [PATCH v7] " Rastislav Cernay
2019-04-07 15:03 ` Rastislav Cernay
2019-04-12 12:15 ` Ferruh Yigit
2019-04-12 12:15 ` Ferruh Yigit
2019-04-12 12:16 ` Ferruh Yigit
2019-04-12 12:16 ` Ferruh Yigit
2019-04-12 14:37 ` [dpdk-dev] [PATCH] net/nfb: remove redundant linking Rastislav Cernay
2019-04-12 14:37 ` Rastislav Cernay
2019-04-12 15:02 ` Ferruh Yigit
2019-04-12 15:02 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJFAV8yD8dzps6vu7Twp54SvPF9wqd9vgWR9FAzJBhTLdAhWCw@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=cernay@netcope.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).