get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/138074/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 138074,
    "url": "http://patches.dpdk.org/api/patches/138074/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240307030247.599394-2-haijie1@huawei.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20240307030247.599394-2-haijie1@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240307030247.599394-2-haijie1@huawei.com",
    "date": "2024-03-07T03:02:41",
    "name": "[v5,1/7] ethdev: support report register names and filter",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "333d979ff93250655c748a5a5d0d679c6ea70796",
    "submitter": {
        "id": 2935,
        "url": "http://patches.dpdk.org/api/people/2935/?format=api",
        "name": "Jie Hai",
        "email": "haijie1@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240307030247.599394-2-haijie1@huawei.com/mbox/",
    "series": [
        {
            "id": 31410,
            "url": "http://patches.dpdk.org/api/series/31410/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31410",
            "date": "2024-03-07T03:02:40",
            "name": "support dump reigser names and filter them",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/31410/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/138074/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/138074/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id A6B4943B5E;\n\tThu,  7 Mar 2024 04:07:19 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D5C1342D9D;\n\tThu,  7 Mar 2024 04:07:09 +0100 (CET)",
            "from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187])\n by mails.dpdk.org (Postfix) with ESMTP id 60B2D402EA\n for <dev@dpdk.org>; Thu,  7 Mar 2024 04:07:05 +0100 (CET)",
            "from mail.maildlp.com (unknown [172.19.163.174])\n by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4TqvKm4ZqBzwPFx;\n Thu,  7 Mar 2024 11:04:44 +0800 (CST)",
            "from kwepemd100004.china.huawei.com (unknown [7.221.188.31])\n by mail.maildlp.com (Postfix) with ESMTPS id DA4F61400D1;\n Thu,  7 Mar 2024 11:07:02 +0800 (CST)",
            "from localhost.localdomain (10.67.165.2) by\n kwepemd100004.china.huawei.com (7.221.188.31) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.2.1258.28; Thu, 7 Mar 2024 11:07:02 +0800"
        ],
        "From": "Jie Hai <haijie1@huawei.com>",
        "To": "<dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>, Ferruh Yigit\n <ferruh.yigit@amd.com>, Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "CC": "<lihuisong@huawei.com>, <fengchengwen@huawei.com>, <haijie1@huawei.com>",
        "Subject": "[PATCH v5 1/7] ethdev: support report register names and filter",
        "Date": "Thu, 7 Mar 2024 11:02:41 +0800",
        "Message-ID": "<20240307030247.599394-2-haijie1@huawei.com>",
        "X-Mailer": "git-send-email 2.30.0",
        "In-Reply-To": "<20240307030247.599394-1-haijie1@huawei.com>",
        "References": "<20231214015650.3738578-1-haijie1@huawei.com>\n <20240307030247.599394-1-haijie1@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.67.165.2]",
        "X-ClientProxiedBy": "dggems701-chm.china.huawei.com (10.3.19.178) To\n kwepemd100004.china.huawei.com (7.221.188.31)",
        "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>,\n <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>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This patch adds \"filter\" and \"names\" fields to \"rte_dev_reg_info\"\nstructure. Names of registers in data fields can be reported and\nthe registers can be filtered by their names.\n\nThe new API rte_eth_dev_get_reg_info_ext() is added to support\nreporting names and filtering by names. And the original API\nrte_eth_dev_get_reg_info() does not use the names and filter fields.\nA local variable is used in rte_eth_dev_get_reg_info for\ncompatibility. If the drivers does not report the names, set them\nto \"offset_XXX\".\n\nSigned-off-by: Jie Hai <haijie1@huawei.com>\n---\n doc/guides/rel_notes/release_24_03.rst |  9 ++++++\n lib/ethdev/rte_dev_info.h              | 11 ++++++++\n lib/ethdev/rte_ethdev.c                | 38 ++++++++++++++++++++++++++\n lib/ethdev/rte_ethdev.h                | 29 ++++++++++++++++++++\n lib/ethdev/version.map                 |  1 +\n 5 files changed, 88 insertions(+)",
    "diff": "diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst\nindex 78590c047b2e..e491579ca984 100644\n--- a/doc/guides/rel_notes/release_24_03.rst\n+++ b/doc/guides/rel_notes/release_24_03.rst\n@@ -161,6 +161,12 @@ New Features\n   * Added power-saving during polling within the ``rte_event_dequeue_burst()`` API.\n   * Added support for DMA adapter.\n \n+* **Added support for dumping registers with names and filter.**\n+\n+  * Added new API functions ``rte_eth_dev_get_reg_info_ext()`` to and filter\n+    the registers by their names and get the information of registers(names,\n+    values and other attributes).\n+\n \n Removed Items\n -------------\n@@ -228,6 +234,9 @@ ABI Changes\n \n * No ABI change that would break compatibility with 23.11.\n \n+* ethdev: Added ``filter`` and ``names`` fields to ``rte_dev_reg_info``\n+  structure for reporting names of registers and filtering them by names.\n+\n \n Known Issues\n ------------\ndiff --git a/lib/ethdev/rte_dev_info.h b/lib/ethdev/rte_dev_info.h\nindex 67cf0ae52668..0badb92432ae 100644\n--- a/lib/ethdev/rte_dev_info.h\n+++ b/lib/ethdev/rte_dev_info.h\n@@ -11,6 +11,11 @@ extern \"C\" {\n \n #include <stdint.h>\n \n+#define RTE_ETH_REG_NAME_SIZE 64\n+struct rte_eth_reg_name {\n+\tchar name[RTE_ETH_REG_NAME_SIZE];\n+};\n+\n /*\n  * Placeholder for accessing device registers\n  */\n@@ -20,6 +25,12 @@ struct rte_dev_reg_info {\n \tuint32_t length; /**< Number of registers to fetch */\n \tuint32_t width; /**< Size of device register */\n \tuint32_t version; /**< Device version */\n+\t/**\n+\t * Filter for target subset of registers.\n+\t * This field could affects register selection for data/length/names.\n+\t */\n+\tconst char *filter;\n+\tstruct rte_eth_reg_name *names; /**< Registers name saver */\n };\n \n /*\ndiff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex f1c658f49e80..82d228790692 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -6388,8 +6388,37 @@ rte_eth_read_clock(uint16_t port_id, uint64_t *clock)\n \n int\n rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)\n+{\n+\tstruct rte_dev_reg_info reg_info = { 0 };\n+\tint ret;\n+\n+\tif (info == NULL) {\n+\t\tRTE_ETHDEV_LOG_LINE(ERR,\n+\t\t\t\"Cannot get ethdev port %u register info to NULL\",\n+\t\t\tport_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treg_info.length = info->length;\n+\treg_info.data = info->data;\n+\n+\tret = rte_eth_dev_get_reg_info_ext(port_id, &reg_info);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n+\tinfo->length = reg_info.length;\n+\tinfo->width = reg_info.width;\n+\tinfo->version = reg_info.version;\n+\tinfo->offset = reg_info.offset;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_eth_dev_get_reg_info_ext(uint16_t port_id, struct rte_dev_reg_info *info)\n {\n \tstruct rte_eth_dev *dev;\n+\tuint32_t i;\n \tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n@@ -6402,12 +6431,21 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)\n \t\treturn -EINVAL;\n \t}\n \n+\tif (info->names != NULL && info->length != 0)\n+\t\tmemset(info->names, 0,\n+\t\t\tsizeof(struct rte_eth_reg_name) * info->length);\n+\n \tif (*dev->dev_ops->get_reg == NULL)\n \t\treturn -ENOTSUP;\n \tret = eth_err(port_id, (*dev->dev_ops->get_reg)(dev, info));\n \n \trte_ethdev_trace_get_reg_info(port_id, info, ret);\n \n+\t/* Report the default names if drivers not report. */\n+\tif (info->names != NULL && strlen(info->names[0].name) == 0)\n+\t\tfor (i = 0; i < info->length; i++)\n+\t\t\tsnprintf(info->names[i].name, RTE_ETH_REG_NAME_SIZE,\n+\t\t\t\t\"offset_%u\", info->offset + i * info->width);\n \treturn ret;\n }\n \ndiff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h\nindex ed27360447a3..cd95a0d51038 100644\n--- a/lib/ethdev/rte_ethdev.h\n+++ b/lib/ethdev/rte_ethdev.h\n@@ -5066,6 +5066,35 @@ __rte_experimental\n int rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,\n \t\tstruct rte_power_monitor_cond *pmc);\n \n+/**\n+ * Retrieve the filtered device registers (values and names) and\n+ * register attributes (number of registers and register size)\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param info\n+ *   Pointer to rte_dev_reg_info structure to fill in.\n+ *   - If info->filter is NULL, return info for all registers (seen as filter\n+ *     none).\n+ *   - If info->filter is not NULL, return error if the driver does not support\n+ *     names or filter.\n+ *   - If info->data is NULL, the function fills in the width and length fields.\n+ *   - If info->data is not NULL, ethdev considers there are enough spaces to\n+ *     store the registers, and the values of registers whose name contains the\n+ *     filter string are put into the buffer pointed at by info->data.\n+ *   - If info->names is not NULL, drivers should fill it or the ethdev fills it\n+ *     with default names.\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-EINVAL) if bad parameter.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EIO) if device is removed.\n+ *   - others depends on the specific operations implementation.\n+ */\n+__rte_experimental\n+int rte_eth_dev_get_reg_info_ext(uint16_t port_id, struct rte_dev_reg_info *info);\n+\n /**\n  * Retrieve device registers and register attributes (number of registers and\n  * register size)\ndiff --git a/lib/ethdev/version.map b/lib/ethdev/version.map\nindex 79f6f5293b5c..e5ec2a2a9741 100644\n--- a/lib/ethdev/version.map\n+++ b/lib/ethdev/version.map\n@@ -319,6 +319,7 @@ EXPERIMENTAL {\n \n \t# added in 24.03\n \t__rte_eth_trace_tx_queue_count;\n+\trte_eth_dev_get_reg_info_ext;\n \trte_eth_find_rss_algo;\n \trte_flow_async_update_resized;\n \trte_flow_calc_encap_hash;\n",
    "prefixes": [
        "v5",
        "1/7"
    ]
}