get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 120945,
    "url": "http://patches.dpdk.org/api/patches/120945/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221215103146.816-7-lihuisong@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": "<20221215103146.816-7-lihuisong@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221215103146.816-7-lihuisong@huawei.com",
    "date": "2022-12-15T10:31:44",
    "name": "[V6,6/8] telemetry: support adding integer value as hexadecimal",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8b597fd4f335b9a3a188d52fbd1317680112e6b1",
    "submitter": {
        "id": 2085,
        "url": "http://patches.dpdk.org/api/people/2085/?format=api",
        "name": "lihuisong (C)",
        "email": "lihuisong@huawei.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20221215103146.816-7-lihuisong@huawei.com/mbox/",
    "series": [
        {
            "id": 26149,
            "url": "http://patches.dpdk.org/api/series/26149/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=26149",
            "date": "2022-12-15T10:31:39",
            "name": "telemetry: fix data truncation and conversion error and add hex integer API",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/26149/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/120945/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/120945/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 5FBD3A0543;\n\tThu, 15 Dec 2022 11:32:18 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id ACD7442D2F;\n\tThu, 15 Dec 2022 11:31:53 +0100 (CET)",
            "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id 8920640698\n for <dev@dpdk.org>; Thu, 15 Dec 2022 11:31:47 +0100 (CET)",
            "from kwepemm600004.china.huawei.com (unknown [172.30.72.55])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NXpRG6cTrzJqYj;\n Thu, 15 Dec 2022 18:30:50 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2375.34; Thu, 15 Dec 2022 18:31:45 +0800"
        ],
        "From": "Huisong Li <lihuisong@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<bruce.richardson@intel.com>, <mb@smartsharesystems.com>,\n <andrew.rybchenko@oktetlabs.ru>, <huangdaode@huawei.com>,\n <liudongdong3@huawei.com>, <fengchengwen@huawei.com>, <lihuisong@huawei.com>",
        "Subject": "[PATCH V6 6/8] telemetry: support adding integer value as hexadecimal",
        "Date": "Thu, 15 Dec 2022 18:31:44 +0800",
        "Message-ID": "<20221215103146.816-7-lihuisong@huawei.com>",
        "X-Mailer": "git-send-email 2.33.0",
        "In-Reply-To": "<20221215103146.816-1-lihuisong@huawei.com>",
        "References": "<20221208080540.62913-1-lihuisong@huawei.com>\n <20221215103146.816-1-lihuisong@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"UTF-8\"",
        "Content-Transfer-Encoding": "8bit",
        "X-Originating-IP": "[10.69.192.56]",
        "X-ClientProxiedBy": "dggems704-chm.china.huawei.com (10.3.19.181) To\n kwepemm600004.china.huawei.com (7.193.23.242)",
        "X-CFilter-Loop": "Reflected",
        "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": "Sometimes displaying a unsigned integer value as hexadecimal encoded style\nis more expected for human consumption, such as, offload capability and\ndevice flag. This patch introduces two APIs to add unsigned integer value\nas hexadecimal encoded string to array or dictionary. And user can choose\nwhether the stored value is padding to the specified width.\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\nAcked-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n lib/telemetry/rte_telemetry.h  | 47 ++++++++++++++++++++++\n lib/telemetry/telemetry_data.c | 72 ++++++++++++++++++++++++++++++++++\n lib/telemetry/version.map      |  9 +++++\n 3 files changed, 128 insertions(+)",
    "diff": "diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h\nindex 40e9a3bf9d..b24f0310ea 100644\n--- a/lib/telemetry/rte_telemetry.h\n+++ b/lib/telemetry/rte_telemetry.h\n@@ -10,6 +10,7 @@ extern \"C\" {\n #endif\n \n #include <stdint.h>\n+#include <rte_compat.h>\n \n /** Maximum length for string used in object. */\n #define RTE_TEL_MAX_STRING_LEN 128\n@@ -153,6 +154,28 @@ int\n rte_tel_data_add_array_container(struct rte_tel_data *d,\n \t\tstruct rte_tel_data *val, int keep);\n \n+/**\n+ * Convert a unsigned integer to hexadecimal encoded strings and add this string\n+ * to an array.\n+ * The array must have been started by rte_tel_data_start_array() with\n+ * RTE_TEL_STRING_VAL as the type parameter.\n+ *\n+ * @param d\n+ *   The data structure passed to the callback\n+ * @param val\n+ *   The number to be returned in the array as a hexadecimal encoded strings.\n+ * @param display_bitwidth\n+ *   The display bit width of the 'val'. If 'display_bitwidth' is zero, the\n+ *   value is stored in the array as no-padding zero hexadecimal encoded string,\n+ *   or the value is stored as padding zero to specified hexadecimal width.\n+ * @return\n+ *   0 on success, negative errno on error\n+ */\n+__rte_experimental\n+int\n+rte_tel_data_add_array_uint_hex(struct rte_tel_data *d, uint64_t val,\n+\t\t\t\tuint8_t display_bitwidth);\n+\n /**\n  * Add a string value to a dictionary.\n  * The dict must have been started by rte_tel_data_start_dict().\n@@ -231,6 +254,30 @@ int\n rte_tel_data_add_dict_container(struct rte_tel_data *d, const char *name,\n \t\tstruct rte_tel_data *val, int keep);\n \n+/**\n+ * Convert a unsigned integer to hexadecimal encoded strings and add this string\n+ * to an dictionary.\n+ * The dict must have been started by rte_tel_data_start_dict().\n+ *\n+ * @param d\n+ *   The data structure passed to the callback\n+ * @param name\n+ *   The name of the value is to be stored in the dict\n+ *   Must contain only alphanumeric characters or the symbols: '_' or '/'\n+ * @param val\n+ *   The number to be stored in the dict as a hexadecimal encoded strings.\n+ * @param display_bitwidth\n+ *   The display bit width of the 'val'. If 'display_bitwidth' is zero, the\n+ *   value is stored in the array as no-padding zero hexadecimal encoded string,\n+ *   or the value is stored as padding zero to specified hexadecimal width.\n+ * @return\n+ *   0 on success, negative errno on error\n+ */\n+__rte_experimental\n+int\n+rte_tel_data_add_dict_uint_hex(struct rte_tel_data *d, const char *name,\n+\t\t\t       uint64_t val, uint8_t display_bitwidth);\n+\n /**\n  * This telemetry callback is used when registering a telemetry command.\n  * It handles getting and formatting information to be returned to telemetry\ndiff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c\nindex 34366ecee3..2a4dcec30a 100644\n--- a/lib/telemetry/telemetry_data.c\n+++ b/lib/telemetry/telemetry_data.c\n@@ -4,6 +4,7 @@\n \n #include <errno.h>\n #include <stdlib.h>\n+#include <inttypes.h>\n \n #undef RTE_USE_LIBBSD\n #include <stdbool.h>\n@@ -12,6 +13,8 @@\n \n #include \"telemetry_data.h\"\n \n+#define RTE_TEL_UINT_HEX_STR_BUF_LEN 64\n+\n int\n rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type)\n {\n@@ -97,6 +100,59 @@ rte_tel_data_add_array_container(struct rte_tel_data *d,\n \treturn 0;\n }\n \n+/* To suppress compiler warning about format string. */\n+#if defined(RTE_TOOLCHAIN_GCC)\n+#pragma GCC diagnostic push\n+#pragma GCC diagnostic ignored \"-Wformat-nonliteral\"\n+#elif defined(RTE_TOOLCHAIN_CLANG)\n+#pragma clang diagnostic push\n+#pragma clang diagnostic ignored \"-Wformat-nonliteral\"\n+#endif\n+\n+static int\n+rte_tel_uint_to_hex_encoded_str(char *buf, uint16_t len, uint64_t val,\n+\t\t\t\tuint8_t display_bitwidth)\n+{\n+#define RTE_TEL_UINT_HEX_FORMAT_LEN 16\n+\n+\tuint8_t spec_hex_width = (display_bitwidth + 3) / 4;\n+\tchar format[RTE_TEL_UINT_HEX_FORMAT_LEN];\n+\n+\t/* Buffer needs to have room to contain the prefix '0x' and '\\0'. */\n+\tif (len < spec_hex_width + 3)\n+\t\treturn -EINVAL;\n+\n+\tif (display_bitwidth != 0) {\n+\t\tsprintf(format, \"0x%%0%u\" PRIx64, spec_hex_width);\n+\t\tsprintf(buf, format, val);\n+\t} else {\n+\t\tsprintf(buf, \"0x%\" PRIx64, val);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+#if defined(RTE_TOOLCHAIN_GCC)\n+#pragma GCC diagnostic pop\n+#elif defined(RTE_TOOLCHAIN_CLANG)\n+#pragma clang diagnostic pop\n+#endif\n+\n+int\n+rte_tel_data_add_array_uint_hex(struct rte_tel_data *d, uint64_t val,\n+\t\t\t\tuint8_t display_bitwidth)\n+{\n+\tchar hex_str[RTE_TEL_UINT_HEX_STR_BUF_LEN];\n+\tint ret;\n+\n+\tret = rte_tel_uint_to_hex_encoded_str(hex_str,\n+\t\t\tRTE_TEL_UINT_HEX_STR_BUF_LEN, val, display_bitwidth);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n+\treturn rte_tel_data_add_array_string(d, hex_str);\n+}\n+\n static bool\n valid_name(const char *name)\n {\n@@ -204,6 +260,22 @@ rte_tel_data_add_dict_container(struct rte_tel_data *d, const char *name,\n \treturn bytes < RTE_TEL_MAX_STRING_LEN ? 0 : E2BIG;\n }\n \n+int\n+rte_tel_data_add_dict_uint_hex(struct rte_tel_data *d, const char *name,\n+\t\t\t       uint64_t val, uint8_t display_bitwidth)\n+{\n+\tchar hex_str[RTE_TEL_UINT_HEX_STR_BUF_LEN];\n+\tint ret;\n+\n+\tret = rte_tel_uint_to_hex_encoded_str(hex_str,\n+\t\t\tRTE_TEL_UINT_HEX_STR_BUF_LEN, val, display_bitwidth);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n+\n+\treturn rte_tel_data_add_dict_string(d, name, hex_str);\n+}\n+\n struct rte_tel_data *\n rte_tel_data_alloc(void)\n {\ndiff --git a/lib/telemetry/version.map b/lib/telemetry/version.map\nindex 9794f9ea20..951bd63974 100644\n--- a/lib/telemetry/version.map\n+++ b/lib/telemetry/version.map\n@@ -1,3 +1,12 @@\n+EXPERIMENTAL {\n+\tglobal:\n+\n+\trte_tel_data_add_array_uint_hex;\n+\trte_tel_data_add_dict_uint_hex;\n+\n+\tlocal: *;\n+};\n+\n DPDK_23 {\n \tglobal:\n \n",
    "prefixes": [
        "V6",
        "6/8"
    ]
}