DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 08/32] net/ngbe: support basic statistics
Date: Thu, 14 Oct 2021 08:59:26 +0100
Message-ID: <f93d1c50-6e1c-1b9d-ed57-2696ad35d758@intel.com> (raw)
In-Reply-To: <000801d7c0a6$681045c0$3830d140$@trustnetic.com>

On 10/14/2021 3:51 AM, Jiawen Wu wrote:
> On September 16, 2021 12:51 AM, Ferruh Yigit wrote:
>> On 9/8/2021 9:37 AM, Jiawen Wu wrote:
>>> Support to read and clear basic statistics, and configure per-queue
>>> stats counter mapping.
>>>
>>> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
>>> ---
>>>   doc/guides/nics/features/ngbe.ini  |   2 +
>>>   doc/guides/nics/ngbe.rst           |   1 +
>>>   drivers/net/ngbe/base/ngbe_dummy.h |   5 +
>>>   drivers/net/ngbe/base/ngbe_hw.c    | 101 ++++++++++
>>>   drivers/net/ngbe/base/ngbe_hw.h    |   1 +
>>>   drivers/net/ngbe/base/ngbe_type.h  | 134 +++++++++++++
>>>   drivers/net/ngbe/ngbe_ethdev.c     | 300
>> +++++++++++++++++++++++++++++
>>>   drivers/net/ngbe/ngbe_ethdev.h     |  19 ++
>>>   8 files changed, 563 insertions(+)
>>>
>>
>> <...>
>>
>>> +static int
>>> +ngbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats
>>> +*stats) {
>>> +	struct ngbe_hw *hw = ngbe_dev_hw(dev);
>>> +	struct ngbe_hw_stats *hw_stats = NGBE_DEV_STATS(dev);
>>> +	struct ngbe_stat_mappings *stat_mappings =
>>> +			NGBE_DEV_STAT_MAPPINGS(dev);
>>> +	uint32_t i, j;
>>> +
>>> +	ngbe_read_stats_registers(hw, hw_stats);
>>> +
>>> +	if (stats == NULL)
>>> +		return -EINVAL;
>>> +
>>> +	/* Fill out the rte_eth_stats statistics structure */
>>> +	stats->ipackets = hw_stats->rx_packets;
>>> +	stats->ibytes = hw_stats->rx_bytes;
>>> +	stats->opackets = hw_stats->tx_packets;
>>> +	stats->obytes = hw_stats->tx_bytes;
>>> +
>>> +	memset(&stats->q_ipackets, 0, sizeof(stats->q_ipackets));
>>> +	memset(&stats->q_opackets, 0, sizeof(stats->q_opackets));
>>> +	memset(&stats->q_ibytes, 0, sizeof(stats->q_ibytes));
>>> +	memset(&stats->q_obytes, 0, sizeof(stats->q_obytes));
>>> +	memset(&stats->q_errors, 0, sizeof(stats->q_errors));
>>> +	for (i = 0; i < NGBE_MAX_QP; i++) {
>>> +		uint32_t n = i / NB_QMAP_FIELDS_PER_QSM_REG;
>>> +		uint32_t offset = (i % NB_QMAP_FIELDS_PER_QSM_REG) * 8;
>>> +		uint32_t q_map;
>>> +
>>> +		q_map = (stat_mappings->rqsm[n] >> offset)
>>> +				& QMAP_FIELD_RESERVED_BITS_MASK;
>>> +		j = (q_map < RTE_ETHDEV_QUEUE_STAT_CNTRS
>>> +		     ? q_map : q_map % RTE_ETHDEV_QUEUE_STAT_CNTRS);
>>> +		stats->q_ipackets[j] += hw_stats->qp[i].rx_qp_packets;
>>> +		stats->q_ibytes[j] += hw_stats->qp[i].rx_qp_bytes;
>>> +
>>> +		q_map = (stat_mappings->tqsm[n] >> offset)
>>> +				& QMAP_FIELD_RESERVED_BITS_MASK;
>>> +		j = (q_map < RTE_ETHDEV_QUEUE_STAT_CNTRS
>>> +		     ? q_map : q_map % RTE_ETHDEV_QUEUE_STAT_CNTRS);
>>> +		stats->q_opackets[j] += hw_stats->qp[i].tx_qp_packets;
>>> +		stats->q_obytes[j] += hw_stats->qp[i].tx_qp_bytes;
>>> +	}
>>> +
>>> +	/* Rx Errors */
>>> +	stats->imissed  = hw_stats->rx_total_missed_packets +
>>> +			  hw_stats->rx_dma_drop;
>>> +	stats->ierrors  = hw_stats->rx_crc_errors +
>>> +			  hw_stats->rx_mac_short_packet_dropped +
>>> +			  hw_stats->rx_length_errors +
>>> +			  hw_stats->rx_undersize_errors +
>>> +			  hw_stats->rx_oversize_errors +
>>> +			  hw_stats->rx_illegal_byte_errors +
>>> +			  hw_stats->rx_error_bytes +
>>> +			  hw_stats->rx_fragment_errors;
>>> +
>>> +	/* Tx Errors */
>>> +	stats->oerrors  = 0;
>>> +	return 0;
>>
>> You can consider keeping 'stats->rx_nombuf' stats too, this needs to be
>> calculated by driver.
>>
> 
> I see ' stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed' in the function rte_eth_stats_get, before calling stats_get ops.
> Should I write it again here?
> 

You are right, I missed it. Just updating 'rx_mbuf_alloc_failed' is
sufficient.

  reply	other threads:[~2021-10-14  7:59 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08  8:37 [dpdk-dev] [PATCH 00/32] net/ngbe: add many features Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 01/32] net/ngbe: add packet type Jiawen Wu
2021-09-15 16:47   ` Ferruh Yigit
2021-09-22  8:01     ` Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 02/32] net/ngbe: support scattered Rx Jiawen Wu
2021-09-15 13:22   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 03/32] net/ngbe: support Rx checksum offload Jiawen Wu
2021-09-15 16:48   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 04/32] net/ngbe: support TSO Jiawen Wu
2021-09-15 16:57   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 05/32] net/ngbe: support CRC offload Jiawen Wu
2021-09-15 16:48   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 06/32] net/ngbe: support jumbo frame Jiawen Wu
2021-09-15 16:48   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 07/32] net/ngbe: support VLAN and QinQ offload Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 08/32] net/ngbe: support basic statistics Jiawen Wu
2021-09-15 16:50   ` Ferruh Yigit
2021-10-14  2:51     ` Jiawen Wu
2021-10-14  7:59       ` Ferruh Yigit [this message]
2021-09-08  8:37 ` [dpdk-dev] [PATCH 09/32] net/ngbe: support device xstats Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 10/32] net/ngbe: support MTU set Jiawen Wu
2021-09-15 16:52   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 11/32] net/ngbe: add device promiscuous and allmulticast mode Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 12/32] net/ngbe: support getting FW version Jiawen Wu
2021-09-15 16:53   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 13/32] net/ngbe: add loopback mode Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 14/32] net/ngbe: support Rx interrupt Jiawen Wu
2021-09-15 16:53   ` Ferruh Yigit
2021-10-14 10:11     ` Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 15/32] net/ngbe: support MAC filters Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 16/32] net/ngbe: support VLAN filter Jiawen Wu
2021-09-15 16:54   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 17/32] net/ngbe: support RSS hash Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 18/32] net/ngbe: support SRIOV Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 19/32] net/ngbe: add mailbox process operations Jiawen Wu
2021-09-15 16:56   ` Ferruh Yigit
2021-09-08  8:37 ` [dpdk-dev] [PATCH 20/32] net/ngbe: support flow control Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 21/32] net/ngbe: support device LED on and off Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 22/32] net/ngbe: support EEPROM dump Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 23/32] net/ngbe: support register dump Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 24/32] net/ngbe: support timesync Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 25/32] net/ngbe: add Rx and Tx queue info get Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 26/32] net/ngbe: add Rx and Tx descriptor status Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 27/32] net/ngbe: add Tx done cleanup Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 28/32] net/ngbe: add IPsec context creation Jiawen Wu
2021-09-15 16:58   ` Ferruh Yigit
2021-09-16  9:00     ` Hemant Agrawal
2021-09-16 17:15       ` Ferruh Yigit
2021-09-16  9:04   ` Hemant Agrawal
2021-09-08  8:37 ` [dpdk-dev] [PATCH 29/32] net/ngbe: create and destroy security session Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 30/32] net/ngbe: support security operations Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 31/32] net/ngbe: add security offload in Rx and Tx Jiawen Wu
2021-09-08  8:37 ` [dpdk-dev] [PATCH 32/32] doc: update for ngbe Jiawen Wu
2021-09-15 16:58   ` 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=f93d1c50-6e1c-1b9d-ed57-2696ad35d758@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=jiawenwu@trustnetic.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git