From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2AF81A04A2; Fri, 4 Mar 2022 02:26:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B2E1406A2; Fri, 4 Mar 2022 02:26:43 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 0746040150 for ; Fri, 4 Mar 2022 02:26:41 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4K8qqD0dl6zrRx7; Fri, 4 Mar 2022 09:23:04 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Fri, 4 Mar 2022 09:26:38 +0800 Subject: Re: [PATCH v4] ethdev: introduce dump API To: CC: =?UTF-8?Q?Morten_Br=c3=b8rup?= , Ray Kinsella , Ajit Khaparde , Ferruh Yigit , Thomas Monjalon , Andrew Rybchenko References: <20220228032617.46618-1-humin29@huawei.com> <20220304012257.39247-1-humin29@huawei.com> <20220304012257.39247-4-humin29@huawei.com> From: "Min Hu (Connor)" Message-ID: <9088d517-f514-adc6-93dd-7e12033674b2@huawei.com> Date: Fri, 4 Mar 2022 09:26:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20220304012257.39247-4-humin29@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sorry, this patch should be skipped. 在 2022/3/4 9:22, Min Hu (Connor) 写道: > Added the ethdev dump API which provides querying private info from device. > There exists many private properties in different PMD drivers, such as > adapter state, Rx/Tx func algorithm in hns3 PMD. The information of these > properties is important for debug. As the information is private, the new > API is introduced. > > Signed-off-by: Min Hu (Connor) > Acked-by: Morten Brørup > Acked-by: Ray Kinsella > Acked-by: Ajit Khaparde > Acked-by: Ferruh Yigit > --- > v4: > * fix comments for API. > v3: > * change 'ethdev' to 'device'. > v2: > * fixed comments from Ferruh. > --- > doc/guides/rel_notes/release_22_03.rst | 7 +++++++ > lib/ethdev/ethdev_driver.h | 22 ++++++++++++++++++++++ > lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++ > lib/ethdev/rte_ethdev.h | 20 ++++++++++++++++++++ > lib/ethdev/version.map | 1 + > 5 files changed, 67 insertions(+) > > diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst > index 0f1d3adaf2..10ac807e1c 100644 > --- a/doc/guides/rel_notes/release_22_03.rst > +++ b/doc/guides/rel_notes/release_22_03.rst > @@ -80,6 +80,13 @@ New Features > New APIs, ``rte_eth_dev_priority_flow_ctrl_queue_info_get()`` and > ``rte_eth_dev_priority_flow_ctrl_queue_configure()``, was added. > > +* **Added the private dump API, for query private info from device.** > + > + Added the private dump API which provides querying private info from device. > + There exists many private properties in different PMD drivers. The > + information of these properties is important for debug. As the information > + is private, the new API is introduced. > + > * **Updated AF_XDP PMD** > > * Added support for libxdp >=v1.2.2. > diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h > index 76a3975c1b..617b450d57 100644 > --- a/lib/ethdev/ethdev_driver.h > +++ b/lib/ethdev/ethdev_driver.h > @@ -1045,6 +1045,25 @@ typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev, > typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev, > const struct rte_eth_ip_reassembly_params *conf); > > +/** > + * @internal > + * Dump private info from device to a file. > + * > + * @param dev > + * Port (ethdev) handle. > + * @param file > + * A pointer to a file for output. > + * > + * @return > + * Negative value on error, 0 on success. > + * > + * @retval 0 > + * Success > + * @retval -EINVAL > + * Invalid file > + */ > +typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file); > + > /** > * @internal A structure containing the functions exported by an Ethernet driver. > */ > @@ -1252,6 +1271,9 @@ struct eth_dev_ops { > eth_ip_reassembly_conf_get_t ip_reassembly_conf_get; > /** Set IP reassembly configuration */ > eth_ip_reassembly_conf_set_t ip_reassembly_conf_set; > + > + /** Dump private info from device */ > + eth_dev_priv_dump_t eth_dev_priv_dump; > }; > > /** > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index c95b3cd3db..2a479bea21 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -6750,6 +6750,23 @@ rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag_offset) > return 0; > } > > +int > +rte_eth_dev_priv_dump(uint16_t port_id, FILE *file) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + dev = &rte_eth_devices[port_id]; > + > + if (file == NULL) { > + RTE_ETHDEV_LOG(ERR, "Invalid file (NULL)\n"); > + return -EINVAL; > + } > + > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP); > + return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file)); > +} > + > 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 f554e716bc..3439b04119 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -5432,6 +5432,26 @@ typedef struct { > uint16_t nb_frags; > } rte_eth_ip_reassembly_dynfield_t; > > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Dump private info from device to a file. Provided data and the order depends > + * on the PMD. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param file > + * A pointer to a file for output. > + * @return > + * - (0) on success. > + * - (-ENODEV) if *port_id* is invalid. > + * - (-EINVAL) if null file. > + * - (-ENOTSUP) if the device does not support this function. > + * - (-EIO) if device is removed. > + */ > +__rte_experimental > +int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file); > > #include > > diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map > index 1ca7ec33ee..fb82c8bf53 100644 > --- a/lib/ethdev/version.map > +++ b/lib/ethdev/version.map > @@ -263,6 +263,7 @@ EXPERIMENTAL { > rte_eth_ip_reassembly_capability_get; > rte_eth_ip_reassembly_conf_get; > rte_eth_ip_reassembly_conf_set; > + rte_eth_dev_priv_dump; > }; > > INTERNAL { >