get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43563,
    "url": "http://patches.dpdk.org/api/patches/43563/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180803132032.29038-3-adrien.mazarguil@6wind.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": "<20180803132032.29038-3-adrien.mazarguil@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180803132032.29038-3-adrien.mazarguil@6wind.com",
    "date": "2018-08-03T13:36:34",
    "name": "[v2,2/7] ethdev: add flow API item/action name conversion",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "13d9211e6f1138a9c0a51385787d4e880b33dde4",
    "submitter": {
        "id": 165,
        "url": "http://patches.dpdk.org/api/people/165/?format=api",
        "name": "Adrien Mazarguil",
        "email": "adrien.mazarguil@6wind.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/20180803132032.29038-3-adrien.mazarguil@6wind.com/mbox/",
    "series": [
        {
            "id": 897,
            "url": "http://patches.dpdk.org/api/series/897/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=897",
            "date": "2018-08-03T13:36:30",
            "name": "ethdev: add flow API object converter",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/897/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43563/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43563/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1B4FD1B584;\n\tFri,  3 Aug 2018 15:36:55 +0200 (CEST)",
            "from mail-wr1-f51.google.com (mail-wr1-f51.google.com\n\t[209.85.221.51]) by dpdk.org (Postfix) with ESMTP id CBB2B1B57A\n\tfor <dev@dpdk.org>; Fri,  3 Aug 2018 15:36:52 +0200 (CEST)",
            "by mail-wr1-f51.google.com with SMTP id e7-v6so5433979wrs.9\n\tfor <dev@dpdk.org>; Fri, 03 Aug 2018 06:36:52 -0700 (PDT)",
            "from 6wind.com (host.78.145.23.62.rev.coltfrance.com.\n\t[62.23.145.78]) by smtp.gmail.com with ESMTPSA id\n\to14-v6sm7342079wmd.35.2018.08.03.06.36.51\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 03 Aug 2018 06:36:51 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to;\n\tbh=S6rV3tMI0FLqVOqherKocL4VRIZ/qnW7GgipmNuodTE=;\n\tb=GtLaQAve8Xr1UgTV/40+kim9hF/sh9Qbn16EqHBTQdQQmFfoJKJvUSMfi4ifLY7+Nw\n\tuTpUXf7FfXWwijDBYLQ4PQhktF9qOb4e65Ae9tLwwqQ7vcB7Tbjs8uQAahQtiDTs5Lbq\n\tVBWaZsWxmk9GZXy3iuWvreDd6RruGYNI/pQZHg1wskiOO+7RKHujhhrpXt2tVlNtvnnA\n\tJJ3mnZNoNpXgGosAncVQX0ZowcN/Gp6wcWNMUmGtI6T3K7XA/0IWd1x4UB+m2TLEKP7k\n\tnfl/LWZdJ7SgdI9pb/cTDTAJY5LfRsWaGAuESWD0eqi2g597IgdOVbq3RC9BvpgsvMyd\n\tYpRA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to;\n\tbh=S6rV3tMI0FLqVOqherKocL4VRIZ/qnW7GgipmNuodTE=;\n\tb=YsEOxy/+8PRC81hS6u2iEUMG+QCuecBgSpEHf/5Dz9PTI7z2hdKcVDBXx4i5HCMcaW\n\toixACh8f8OweyoE8U+XaGmX9DPFrYlJ6jvSjj0fplKUWCKFgb3bpdsL8M8l9mtXMA6GI\n\tid5XTTa9v5GSwRj4UaPmCOs8sy49ntJoz3O+YCkV5i7ahkFsuS/EEQ9uktTgW/9WCYlw\n\tY7XRq5dIxjjnSzYa+6veOy2vrdYNoal8PTKu/nZiwXhjcMk3bI+w4b8hDogTtTMSH55S\n\tQ0T/WU6O/WYVVhGcFGkXN2d+S9mbkvpc43ykISfCRmWkCLrdpsRn6G3KFkM2zv5jGWAU\n\t7wrQ==",
        "X-Gm-Message-State": "AOUpUlGnfNfIj3uPciBGPO9AkNMrJRv0GgnI7TvpUG3sRUmKMIvG4AbW\n\tVVVcKtLHmiyEueKmx4QN0L8KXA==",
        "X-Google-Smtp-Source": "AAOMgpe7UztSRRVYxXprJx5/hoV+rA9c5vw3NuNLeOHjcMvP5WsgwR35uVZYhn6EaGTphFF0p40yqQ==",
        "X-Received": "by 2002:adf:e190:: with SMTP id\n\tk16-v6mr2690423wri.36.1533303412465; \n\tFri, 03 Aug 2018 06:36:52 -0700 (PDT)",
        "Date": "Fri, 3 Aug 2018 15:36:34 +0200",
        "From": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "To": "Ferruh Yigit <ferruh.yigit@intel.com>",
        "Cc": "dev@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,\n\tAndrew Rybchenko <arybchenko@solarflare.com>",
        "Message-ID": "<20180803132032.29038-3-adrien.mazarguil@6wind.com>",
        "References": "<cover.1507193185.git.adrien.mazarguil@6wind.com>\n\t<20180803132032.29038-1-adrien.mazarguil@6wind.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "In-Reply-To": "<20180803132032.29038-1-adrien.mazarguil@6wind.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "Subject": "[dpdk-dev] [PATCH v2 2/7] ethdev: add flow API item/action name\n\tconversion",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This provides a means for applications to retrieve the name of flow pattern\nitems and actions.\n\nSigned-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>\nCc: Thomas Monjalon <thomas@monjalon.net>\nCc: Ferruh Yigit <ferruh.yigit@intel.com>\nCc: Andrew Rybchenko <arybchenko@solarflare.com>\n--\nv2 changes:\n\n- Replaced rte_flow_conv_name_ptr() with extra is_ptr argument to\n  rte_flow_conv_name() since both functions were almost identical.\n\n- Properly documented internal helper functions.\n---\n doc/guides/prog_guide/rte_flow.rst |  1 +\n lib/librte_ethdev/rte_flow.c       | 63 +++++++++++++++++++++++++++++++++\n lib/librte_ethdev/rte_flow.h       | 56 +++++++++++++++++++++++++++++\n 3 files changed, 120 insertions(+)",
    "diff": "diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst\nindex 964cf9ceb..1b17f6e01 100644\n--- a/doc/guides/prog_guide/rte_flow.rst\n+++ b/doc/guides/prog_guide/rte_flow.rst\n@@ -2437,6 +2437,7 @@ operations include:\n - Attributes, pattern item or action duplication.\n - Duplication of an entire pattern or list of actions.\n - Duplication of a complete flow rule description.\n+- Pattern item or action name retrieval.\n \n Caveats\n -------\ndiff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c\nindex 930fe09c8..5d487c108 100644\n--- a/lib/librte_ethdev/rte_flow.c\n+++ b/lib/librte_ethdev/rte_flow.c\n@@ -11,6 +11,7 @@\n #include <rte_common.h>\n #include <rte_errno.h>\n #include <rte_branch_prediction.h>\n+#include <rte_string_fns.h>\n #include \"rte_ethdev.h\"\n #include \"rte_flow_driver.h\"\n #include \"rte_flow.h\"\n@@ -679,6 +680,60 @@ rte_flow_conv_rule(struct rte_flow_conv_rule *dst,\n \treturn off;\n }\n \n+/**\n+ * Retrieve the name of a pattern item/action type.\n+ *\n+ * @param is_action\n+ *   Nonzero when @p src represents an action type instead of a pattern item\n+ *   type.\n+ * @param is_ptr\n+ *   Nonzero to write string address instead of contents into @p dst.\n+ * @param[out] dst\n+ *   Destination buffer. Can be NULL if @p size is zero.\n+ * @param size\n+ *   Size of @p dst in bytes.\n+ * @param[in] src\n+ *   Depending on @p is_action, source pattern item or action type cast as a\n+ *   pointer.\n+ * @param[out] error\n+ *   Perform verbose error reporting if not NULL.\n+ *\n+ * @return\n+ *   A positive value representing the number of bytes needed to store the\n+ *   name or its address regardless of @p size on success (@p buf contents\n+ *   are truncated to @p size if not large enough), a negative errno value\n+ *   otherwise and rte_errno is set.\n+ */\n+static int\n+rte_flow_conv_name(int is_action,\n+\t\t   int is_ptr,\n+\t\t   char *dst,\n+\t\t   const size_t size,\n+\t\t   const void *src,\n+\t\t   struct rte_flow_error *error)\n+{\n+\tstruct desc_info {\n+\t\tconst struct rte_flow_desc_data *data;\n+\t\tsize_t num;\n+\t};\n+\tstatic const struct desc_info info_rep[2] = {\n+\t\t{ rte_flow_desc_item, RTE_DIM(rte_flow_desc_item), },\n+\t\t{ rte_flow_desc_action, RTE_DIM(rte_flow_desc_action), },\n+\t};\n+\tconst struct desc_info *const info = &info_rep[!!is_action];\n+\tunsigned int type = (uintptr_t)src;\n+\n+\tif (type >= info->num)\n+\t\treturn rte_flow_error_set\n+\t\t\t(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n+\t\t\t \"unknown object type to retrieve the name of\");\n+\tif (!is_ptr)\n+\t\treturn strlcpy(dst, info->data[type].name, size);\n+\tif (size >= sizeof(const char **))\n+\t\t*((const char **)dst) = info->data[type].name;\n+\treturn sizeof(const char **);\n+}\n+\n /** Helper function to convert flow API objects. */\n int\n rte_flow_conv(enum rte_flow_conv_op op,\n@@ -708,6 +763,14 @@ rte_flow_conv(enum rte_flow_conv_op op,\n \t\treturn rte_flow_conv_actions(dst, size, src, 0, error);\n \tcase RTE_FLOW_CONV_OP_RULE:\n \t\treturn rte_flow_conv_rule(dst, size, src, error);\n+\tcase RTE_FLOW_CONV_OP_ITEM_NAME:\n+\t\treturn rte_flow_conv_name(0, 0, dst, size, src, error);\n+\tcase RTE_FLOW_CONV_OP_ACTION_NAME:\n+\t\treturn rte_flow_conv_name(1, 0, dst, size, src, error);\n+\tcase RTE_FLOW_CONV_OP_ITEM_NAME_PTR:\n+\t\treturn rte_flow_conv_name(0, 1, dst, size, src, error);\n+\tcase RTE_FLOW_CONV_OP_ACTION_NAME_PTR:\n+\t\treturn rte_flow_conv_name(1, 1, dst, size, src, error);\n \t}\n \treturn rte_flow_error_set\n \t\t(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\ndiff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h\nindex 71dc30e4c..c48ea8a51 100644\n--- a/lib/librte_ethdev/rte_flow.h\n+++ b/lib/librte_ethdev/rte_flow.h\n@@ -2043,6 +2043,62 @@ enum rte_flow_conv_op {\n \t *   @code struct rte_flow_conv_rule * @endcode\n \t */\n \tRTE_FLOW_CONV_OP_RULE,\n+\n+\t/**\n+\t * Convert item type to its name string.\n+\t *\n+\t * Writes a NUL-terminated string to @p dst. Like snprintf(), the\n+\t * returned value excludes the terminator which is always written\n+\t * nonetheless.\n+\t *\n+\t * - @p src type:\n+\t *   @code (const void *)enum rte_flow_item_type @endcode\n+\t * - @p dst type:\n+\t *   @code char * @endcode\n+\t **/\n+\tRTE_FLOW_CONV_OP_ITEM_NAME,\n+\n+\t/**\n+\t * Convert action type to its name string.\n+\t *\n+\t * Writes a NUL-terminated string to @p dst. Like snprintf(), the\n+\t * returned value excludes the terminator which is always written\n+\t * nonetheless.\n+\t *\n+\t * - @p src type:\n+\t *   @code (const void *)enum rte_flow_action_type @endcode\n+\t * - @p dst type:\n+\t *   @code char * @endcode\n+\t **/\n+\tRTE_FLOW_CONV_OP_ACTION_NAME,\n+\n+\t/**\n+\t * Convert item type to pointer to item name.\n+\t *\n+\t * Retrieves item name pointer from its type. The string itself is\n+\t * not copied; instead, a unique pointer to an internal static\n+\t * constant storage is written to @p dst.\n+\t *\n+\t * - @p src type:\n+\t *   @code (const void *)enum rte_flow_item_type @endcode\n+\t * - @p dst type:\n+\t *   @code const char ** @endcode\n+\t */\n+\tRTE_FLOW_CONV_OP_ITEM_NAME_PTR,\n+\n+\t/**\n+\t * Convert action type to pointer to action name.\n+\t *\n+\t * Retrieves action name pointer from its type. The string itself is\n+\t * not copied; instead, a unique pointer to an internal static\n+\t * constant storage is written to @p dst.\n+\t *\n+\t * - @p src type:\n+\t *   @code (const void *)enum rte_flow_action_type @endcode\n+\t * - @p dst type:\n+\t *   @code const char ** @endcode\n+\t */\n+\tRTE_FLOW_CONV_OP_ACTION_NAME_PTR,\n };\n \n /**\n",
    "prefixes": [
        "v2",
        "2/7"
    ]
}