From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 47D9BA034C;
	Mon, 30 May 2022 11:18:22 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id F2D2D42B78;
	Mon, 30 May 2022 11:18:21 +0200 (CEST)
Received: from mail-108-mta154.mxroute.com (mail-108-mta154.mxroute.com
 [136.175.108.154])
 by mails.dpdk.org (Postfix) with ESMTP id A487742B75
 for <dev@dpdk.org>; Mon, 30 May 2022 11:18:20 +0200 (CEST)
Received: from filter006.mxroute.com ([140.82.40.27]
 140.82.40.27.vultrusercontent.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta154.mxroute.com (ZoneMTA) with ESMTPSA id
 18114423f5b000c327.001 for <dev@dpdk.org>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Mon, 30 May 2022 09:18:14 +0000
X-Zone-Loop: 8a67c1514e01f2c6f024d1d48ade5d91370c2fd385c5
X-Originating-IP: [140.82.40.27]
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ashroe.eu; 
 s=x;
 h=Content-Type:MIME-Version:Message-ID:In-reply-to:Date:Subject:Cc:To:
 From:References:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=S8JJ4aAk4Fsgi6Is0fitREasQM+TWj7q+QQB2gcrVB8=; b=C6HudpYCI4DrLyyZCb+OWGkjTM
 q9IkWH2mD+7Gi7zArxtRx7Cf6/o34yBG862SYl1XpC/OQbMnWXt+3ZWCy5YEV9J8i0DmfuPoSac5W
 5u6y78WGQBnEvXMRY/HkXY5BPhUIXrN5NhoAyJjLf7CnsicYQ8JbF692yjhAxsw7lDljNE14yexyN
 Jmj9gdFu0ltHPlqG4ACnCVs7sRXCXm/TiJkXUt9YftuDHWVfLmRZKUK2UbWR1XTkxjf7ujPK1au/D
 ucDiW/AWX0enrm4hm9T8fFrInBkL7VBp6Ln2p7QAqK2nmQt65+FOObfxiIyTU76wjlvT8L9DMikjF
 t/+op0IA==;
References: <20220527023351.40577-1-humin29@huawei.com>
 <20220527023351.40577-2-humin29@huawei.com>
User-agent: mu4e 1.6.10; emacs 27.1
From: Ray Kinsella <mdr@ashroe.eu>
To: "Min Hu (Connor)" <humin29@huawei.com>
Cc: dev@dpdk.org, Thomas Monjalon <thomas@monjalon.net>, Ferruh Yigit
 <ferruh.yigit@xilinx.com>, Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [PATCH 1/4] ethdev: introduce ethdev HW desc dump PI
Date: Mon, 30 May 2022 10:17:39 +0100
In-reply-to: <20220527023351.40577-2-humin29@huawei.com>
Message-ID: <87fskrwf8r.fsf@mdr78.vserver.site>
MIME-Version: 1.0
Content-Type: text/plain
X-AuthUser: mdr@ashroe.eu
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org


"Min Hu (Connor)" <humin29@huawei.com> writes:

> Added the ethdev HW Rx desc dump API which provides functions for query
> HW descriptor from device. HW descriptor info differs in different NICs.
> The information demonstrates I/O process which is important for debug.
> As the information is different between NICs, the new API is introduced.
>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
>  doc/guides/rel_notes/release_22_07.rst |  6 ++++
>  lib/ethdev/ethdev_driver.h             | 42 ++++++++++++++++++++++++
>  lib/ethdev/rte_ethdev.c                | 44 ++++++++++++++++++++++++++
>  lib/ethdev/rte_ethdev.h                | 44 ++++++++++++++++++++++++++
>  lib/ethdev/version.map                 |  2 ++
>  5 files changed, 138 insertions(+)
>
> diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
> index 0ed4f92820..cfb9117dd3 100644
> --- a/doc/guides/rel_notes/release_22_07.rst
> +++ b/doc/guides/rel_notes/release_22_07.rst
> @@ -95,6 +95,12 @@ New Features
>    * Added AH mode support in lookaside protocol (IPsec) for CN9K & CN10K.
>    * Added AES-GMAC support in lookaside protocol (IPsec) for CN9K & CN10K.
>  
> +* **Added ethdev HW desc dump API, to dump Rx/Tx HW desc info from device.**
> +
> +  Added the ethdev HW Rx desc dump API which provides functions for query
> +  HW descriptor from device. HW descriptor info differs in different NICs.
> +  The information demonstrates I/O process which is important for debug.
> +  As the information is different between NICs, the new API is introduced.
>  
>  Removed Items
>  -------------
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 69d9dc21d8..89512ab360 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -1073,6 +1073,42 @@ typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev,
>   */
>  typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file);
>  
> +/**
> + * @internal
> + * Dump ethdev Rx descriptor info to a file.
> + *
> + * @param file
> + *   A pointer to a file for output.
> + * @param dev
> + *   Port (ethdev) handle.
> + * @param queue_id
> + *   The selected queue.
> + * @param desc_id
> + *   The selected descriptor.
> + * @return
> + *   Negative errno value on error, zero on success.
> + */
> +typedef int (*eth_rx_hw_desc_dump_t)(FILE *file, struct rte_eth_dev *dev,
> +				       uint16_t queue_id, uint16_t desc_id);
> +
> +/**
> + * @internal
> + * Dump ethdev Tx descriptor info to a file.
> + *
> + * @param file
> + *   A pointer to a file for output.
> + * @param dev
> + *   Port (ethdev) handle.
> + * @param queue_id
> + *   The selected queue.
> + * @param desc_id
> + *   The selected descriptor.
> + * @return
> + *   Negative errno value on error, zero on success.
> + */
> +typedef int (*eth_tx_hw_desc_dump_t)(FILE *file, struct rte_eth_dev *dev,
> +				       uint16_t queue_id, uint16_t desc_id);
> +
>  /**
>   * @internal A structure containing the functions exported by an Ethernet driver.
>   */
> @@ -1283,6 +1319,12 @@ struct eth_dev_ops {
>  
>  	/** Dump private info from device */
>  	eth_dev_priv_dump_t eth_dev_priv_dump;
> +
> +	/** Dump ethdev Rx descriptor info */
> +	eth_rx_hw_desc_dump_t eth_rx_hw_desc_dump;
> +
> +	/** Dump ethdev Tx descriptor info */
> +	eth_tx_hw_desc_dump_t eth_tx_hw_desc_dump;
>  };
>  
>  /**
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index a175867651..09abee6345 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -5874,6 +5874,50 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)
>  	return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file));
>  }
>  
> +int
> +rte_eth_rx_hw_desc_dump(FILE *file, uint16_t port_id, uint16_t queue_id,
> +			uint16_t desc_id)
> +{
> +	struct rte_eth_dev *dev;
> +	int ret;
> +
> +	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> +	dev = &rte_eth_devices[port_id];
> +
> +	if (queue_id >= dev->data->nb_rx_queues) {
> +		RTE_ETHDEV_LOG(ERR, "Invalid Rx queue_id=%u\n", queue_id);
> +		return -EINVAL;
> +	}
> +
> +	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_rx_hw_desc_dump, -ENOTSUP);
> +	ret = (*dev->dev_ops->eth_rx_hw_desc_dump)(file, dev, queue_id,
> +						   desc_id);
> +
> +	return ret;
> +}
> +
> +int
> +rte_eth_tx_hw_desc_dump(FILE *file, uint16_t port_id, uint16_t queue_id,
> +			uint16_t desc_id)
> +{
> +	struct rte_eth_dev *dev;
> +	int ret;
> +
> +	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> +	dev = &rte_eth_devices[port_id];
> +
> +	if (queue_id >= dev->data->nb_tx_queues) {
> +		RTE_ETHDEV_LOG(ERR, "Invalid Tx queue_id=%u\n", queue_id);
> +		return -EINVAL;
> +	}
> +
> +	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_tx_hw_desc_dump, -ENOTSUP);
> +	ret = (*dev->dev_ops->eth_tx_hw_desc_dump)(file, dev, queue_id,
> +						   desc_id);
> +
> +	return ret;
> +}
> +
>  RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO);
>  
>  RTE_INIT(ethdev_init_telemetry)
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 02df65d923..56ae630209 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -5456,6 +5456,50 @@ typedef struct {
>  __rte_experimental
>  int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file);
>  
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Dump ethdev Rx descriptor info to a file.
> + *
> + * @param file
> + *   A pointer to a file for output.
> + * @param dev
> + *   Port (ethdev) handle.
> + * @param queue_id
> + *   The selected queue.
> + * @param desc_id
> + *   The selected descriptor.
> + * @return
> + *   - On success, zero.
> + *   - On failure, a negative value.
> + */
> +__rte_experimental
> +int rte_eth_rx_hw_desc_dump(FILE *file, uint16_t port_id, uint16_t queue_id,
> +			    uint16_t desc_id);
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Dump ethdev Tx descriptor info to a file.
> + *
> + * @param file
> + *   A pointer to a file for output.
> + * @param dev
> + *   Port (ethdev) handle.
> + * @param queue_id
> + *   The selected queue.
> + * @param desc_id
> + *   The selected descriptor.
> + * @return
> + *   - On success, zero.
> + *   - On failure, a negative value.
> + */
> +__rte_experimental
> +int rte_eth_tx_hw_desc_dump(FILE *file, uint16_t port_id, uint16_t queue_id,
> +			    uint16_t desc_id);
> +
>  #include <rte_ethdev_core.h>
>  
>  /**
> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
> index daca7851f2..109f4ea818 100644
> --- a/lib/ethdev/version.map
> +++ b/lib/ethdev/version.map
> @@ -285,6 +285,8 @@ EXPERIMENTAL {
>  	rte_mtr_color_in_protocol_priority_get;
>  	rte_mtr_color_in_protocol_set;
>  	rte_mtr_meter_vlan_table_update;

Please annotate with a comment indicating in which release the symbols
have been added. 

> +	rte_eth_rx_hw_desc_dump;
> +	rte_eth_tx_hw_desc_dump;
>  };
>  
>  INTERNAL {


-- 
Regards, Ray K