DPDK patches and discussions
 help / color / mirror / Atom feed
From: "lihuisong (C)" <lihuisong@huawei.com>
To: Jie Hai <haijie1@huawei.com>
Cc: <fengchengwen@huawei.com>, Thomas Monjalon <thomas@monjalon.net>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Ferruh Yigit <ferruh.yigit@amd.com>, <dev@dpdk.org>
Subject: Re: [PATCH v5 1/7] ethdev: support report register names and filter
Date: Fri, 8 Mar 2024 16:09:39 +0800	[thread overview]
Message-ID: <7f7b79d7-593a-9cfc-dd78-e1f48ee88d01@huawei.com> (raw)
In-Reply-To: <20240307030247.599394-2-haijie1@huawei.com>

Hi Jie,

With belows to changes,
Acked-by: Huisong Li <lihuisong@huawei.com>

在 2024/3/7 11:02, Jie Hai 写道:
> This patch adds "filter" and "names" fields to "rte_dev_reg_info"
> structure. Names of registers in data fields can be reported and
> the registers can be filtered by their names.
>
> The new API rte_eth_dev_get_reg_info_ext() is added to support
> reporting names and filtering by names. And the original API
> rte_eth_dev_get_reg_info() does not use the names and filter fields.
> A local variable is used in rte_eth_dev_get_reg_info for
> compatibility. If the drivers does not report the names, set them
> to "offset_XXX".
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
>   doc/guides/rel_notes/release_24_03.rst |  9 ++++++
>   lib/ethdev/rte_dev_info.h              | 11 ++++++++
>   lib/ethdev/rte_ethdev.c                | 38 ++++++++++++++++++++++++++
>   lib/ethdev/rte_ethdev.h                | 29 ++++++++++++++++++++
>   lib/ethdev/version.map                 |  1 +
>   5 files changed, 88 insertions(+)
>
> diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
> index 78590c047b2e..e491579ca984 100644
> --- a/doc/guides/rel_notes/release_24_03.rst
> +++ b/doc/guides/rel_notes/release_24_03.rst
> @@ -161,6 +161,12 @@ New Features
>     * Added power-saving during polling within the ``rte_event_dequeue_burst()`` API.
>     * Added support for DMA adapter.
>   
<...>
> +int
> +rte_eth_dev_get_reg_info_ext(uint16_t port_id, struct rte_dev_reg_info *info)
>   {
>   	struct rte_eth_dev *dev;
> +	uint32_t i;
>   	int ret;
>   
>   	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> @@ -6402,12 +6431,21 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
>   		return -EINVAL;
>   	}
>   
> +	if (info->names != NULL && info->length != 0)
> +		memset(info->names, 0,
> +			sizeof(struct rte_eth_reg_name) * info->length);
> +
>   	if (*dev->dev_ops->get_reg == NULL)
>   		return -ENOTSUP;
>   	ret = eth_err(port_id, (*dev->dev_ops->get_reg)(dev, info));
>   
>   	rte_ethdev_trace_get_reg_info(port_id, info, ret);

The trace interface in lib/ethdev/ethdev_trace.h should be added these 
new fields?

>   
Below code shouldn't be executed when ret != 0, right?
> +	/* Report the default names if drivers not report. */
> +	if (info->names != NULL && strlen(info->names[0].name) == 0)
> +		for (i = 0; i < info->length; i++)
> +			snprintf(info->names[i].name, RTE_ETH_REG_NAME_SIZE,
> +				"offset_%u", info->offset + i * info->width);
>   	return ret;
>   }
>   
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index ed27360447a3..cd95a0d51038 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -5066,6 +5066,35 @@ __rte_experimental
>   int rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,
>   		struct rte_power_monitor_cond *pmc);
>   
> +/**
> + * Retrieve the filtered device registers (values and names) and
> + * register attributes (number of registers and register size)
> + *
> + * @param port_id
> + *   The port identifier of the Ethernet device.
> + * @param info
> + *   Pointer to rte_dev_reg_info structure to fill in.
> + *   - If info->filter is NULL, return info for all registers (seen as filter
> + *     none).
> + *   - If info->filter is not NULL, return error if the driver does not support
> + *     names or filter.
> + *   - If info->data is NULL, the function fills in the width and length fields.
> + *   - If info->data is not NULL, ethdev considers there are enough spaces to
> + *     store the registers, and the values of registers whose name contains the
> + *     filter string are put into the buffer pointed at by info->data.
> + *   - If info->names is not NULL, drivers should fill it or the ethdev fills it
> + *     with default names.
> + * @return
> + *   - (0) if successful.
> + *   - (-ENOTSUP) if hardware doesn't support.
> + *   - (-EINVAL) if bad parameter.
> + *   - (-ENODEV) if *port_id* invalid.
> + *   - (-EIO) if device is removed.
> + *   - others depends on the specific operations implementation.
> + */
> +__rte_experimental
> +int rte_eth_dev_get_reg_info_ext(uint16_t port_id, struct rte_dev_reg_info *info);
> +
>   /**
>    * Retrieve device registers and register attributes (number of registers and
>    * register size)
> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
> index 79f6f5293b5c..e5ec2a2a9741 100644
> --- a/lib/ethdev/version.map
> +++ b/lib/ethdev/version.map
> @@ -319,6 +319,7 @@ EXPERIMENTAL {
>   
>   	# added in 24.03
>   	__rte_eth_trace_tx_queue_count;
> +	rte_eth_dev_get_reg_info_ext;
>   	rte_eth_find_rss_algo;
>   	rte_flow_async_update_resized;
>   	rte_flow_calc_encap_hash;

  reply	other threads:[~2024-03-08  8:09 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14  1:56 [PATCH] ethdev: add dump regs for telemetry Jie Hai
2023-12-14 12:49 ` Ferruh Yigit
2024-01-09  2:19   ` Jie Hai
2024-01-09  2:41     ` Jie Hai
2024-01-09 18:06     ` Ferruh Yigit
2024-01-10  1:38       ` fengchengwen
2024-01-10 12:15         ` Ferruh Yigit
2024-01-10 14:09           ` Thomas Monjalon
2024-01-10 15:48             ` Ferruh Yigit
2024-01-11  1:55           ` fengchengwen
2024-01-11 11:11             ` Ferruh Yigit
2024-01-11 12:43               ` fengchengwen
2024-02-05 10:51 ` [PATCH v2 0/7] support dump reigser names and filter them Jie Hai
2024-02-05 10:51   ` [PATCH v2 1/7] ethdev: support report register names and filter Jie Hai
2024-02-07 17:00     ` Ferruh Yigit
2024-02-20  8:43       ` Jie Hai
2024-02-05 10:51   ` [PATCH v2 2/7] ethdev: add telemetry cmd for registers Jie Hai
2024-02-07 17:03     ` Ferruh Yigit
2024-02-22  9:01       ` Jie Hai
2024-02-05 10:51   ` [PATCH v2 3/7] net/hns3: fix dump counter of registers Jie Hai
2024-02-05 10:51   ` [PATCH v2 4/7] net/hns3: remove dump format " Jie Hai
2024-02-05 10:51   ` [PATCH v2 5/7] net/hns3: add names for registers Jie Hai
2024-02-05 10:51   ` [PATCH v2 6/7] net/hns3: support filter directly accessed registers Jie Hai
2024-02-05 10:51   ` [PATCH v2 7/7] net/hns3: support filter dump of registers Jie Hai
2024-02-20 10:58 ` [PATCH v3 0/7] support dump reigser names and filter them Jie Hai
2024-02-20 10:58   ` [PATCH v3 1/7] ethdev: support report register names and filter Jie Hai
2024-02-20 15:09     ` Stephen Hemminger
2024-02-26  2:33       ` Jie Hai
2024-02-20 15:13     ` Stephen Hemminger
2024-02-26  2:41       ` Jie Hai
2024-02-20 15:14     ` Stephen Hemminger
2024-02-26  2:57       ` Jie Hai
2024-02-20 15:14     ` Stephen Hemminger
2024-02-26  2:33       ` Jie Hai
2024-02-20 10:58   ` [PATCH v3 2/7] ethdev: add telemetry cmd for registers Jie Hai
2024-02-20 10:58   ` [PATCH v3 3/7] net/hns3: fix dump counter of registers Jie Hai
2024-02-20 10:58   ` [PATCH v3 4/7] net/hns3: remove dump format " Jie Hai
2024-02-20 10:58   ` [PATCH v3 5/7] net/hns3: add names for registers Jie Hai
2024-02-20 10:58   ` [PATCH v3 6/7] net/hns3: support filter directly accessed registers Jie Hai
2024-02-20 10:58   ` [PATCH v3 7/7] net/hns3: support filter dump of registers Jie Hai
2024-02-26  3:07 ` [PATCH v4 0/7] support dump reigser names and filter them Jie Hai
2024-02-26  3:07   ` [PATCH v4 1/7] ethdev: support report register names and filter Jie Hai
2024-02-26  8:01     ` fengchengwen
2024-03-06  7:22       ` Jie Hai
2024-02-29  9:52     ` Thomas Monjalon
2024-03-05  7:45       ` Jie Hai
2024-02-26  3:07   ` [PATCH v4 2/7] ethdev: add telemetry cmd for registers Jie Hai
2024-02-26  9:09     ` fengchengwen
2024-03-06  7:18       ` Jie Hai
2024-02-26  3:07   ` [PATCH v4 3/7] net/hns3: fix dump counter of registers Jie Hai
2024-02-26  3:07   ` [PATCH v4 4/7] net/hns3: remove dump format " Jie Hai
2024-02-26  3:07   ` [PATCH v4 5/7] net/hns3: add names for registers Jie Hai
2024-02-26  3:07   ` [PATCH v4 6/7] net/hns3: support filter directly accessed registers Jie Hai
2024-02-26  3:07   ` [PATCH v4 7/7] net/hns3: support filter dump of registers Jie Hai
2024-03-07  3:02 ` [PATCH v5 0/7] support dump reigser names and filter them Jie Hai
2024-03-07  3:02   ` [PATCH v5 1/7] ethdev: support report register names and filter Jie Hai
2024-03-08  8:09     ` lihuisong (C) [this message]
2024-03-07  3:02   ` [PATCH v5 2/7] ethdev: add telemetry cmd for registers Jie Hai
2024-03-08  8:48     ` lihuisong (C)
2024-03-07  3:02   ` [PATCH v5 3/7] net/hns3: fix dump counter of registers Jie Hai
2024-03-08  8:49     ` lihuisong (C)
2024-03-07  3:02   ` [PATCH v5 4/7] net/hns3: remove dump format " Jie Hai
2024-03-08  9:17     ` lihuisong (C)
2024-03-07  3:02   ` [PATCH v5 5/7] net/hns3: add names for registers Jie Hai
2024-03-08  9:41     ` lihuisong (C)
2024-03-08 10:24     ` lihuisong (C)
2024-03-07  3:02   ` [PATCH v5 6/7] net/hns3: support filter directly accessed registers Jie Hai
2024-03-08  9:41     ` lihuisong (C)
2024-03-07  3:02   ` [PATCH v5 7/7] net/hns3: support filter dump of registers Jie Hai

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=7f7b79d7-593a-9cfc-dd78-e1f48ee88d01@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@amd.com \
    --cc=haijie1@huawei.com \
    --cc=thomas@monjalon.net \
    /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).