Show a patch.

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

{
    "id": 44069,
    "url": "http://patches.dpdk.org/api/patches/44069/",
    "web_url": "http://patches.dpdk.org/patch/44069/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20180831085337.21419-3-adrien.mazarguil@6wind.com>",
    "date": "2018-08-31T09:01:02",
    "name": "[v3,2/7] ethdev: add flow API item/action name conversion",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "13d9211e6f1138a9c0a51385787d4e880b33dde4",
    "submitter": {
        "id": 165,
        "url": "http://patches.dpdk.org/api/people/165/",
        "name": "Adrien Mazarguil",
        "email": "adrien.mazarguil@6wind.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@intel.com"
    },
    "mbox": "http://patches.dpdk.org/patch/44069/mbox/",
    "series": [
        {
            "id": 1123,
            "url": "http://patches.dpdk.org/api/series/1123/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1123",
            "date": "2018-08-31T09:00:57",
            "name": "ethdev: add flow API object converter",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/1123/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44069/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44069/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<20180831085337.21419-1-adrien.mazarguil@6wind.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.11.0",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 60ACF4CB5;\n\tFri, 31 Aug 2018 11:01:23 +0200 (CEST)",
            "from mail-wm0-f50.google.com (mail-wm0-f50.google.com\n\t[74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 108134CAB\n\tfor <dev@dpdk.org>; Fri, 31 Aug 2018 11:01:21 +0200 (CEST)",
            "by mail-wm0-f50.google.com with SMTP id j25-v6so2842609wmc.1\n\tfor <dev@dpdk.org>; Fri, 31 Aug 2018 02:01:21 -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\tt9-v6sm891994wmf.1.2018.08.31.02.01.18\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 31 Aug 2018 02:01:18 -0700 (PDT)"
        ],
        "References": "<20180803132032.29038-1-adrien.mazarguil@6wind.com>\n\t<20180831085337.21419-1-adrien.mazarguil@6wind.com>",
        "X-Google-Smtp-Source": "ANB0VdZor3ngWMpkDs1WG3fvJRUk0FSUQTMNDi9dQScM1Rm4U3za6Tpc8aB4QqU7+YB3T4l5PAvN5w==",
        "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=cg7wPrCBOR0XWnMPnT8WQUETRScquCCH7BEk6idb1tk=;\n\tb=cTYTBWYL0pk7Xso0eW0Hzc4nkJ4oipwKPEqniJzDLmaZJaqWxdKkBQqjwnzXYlEIGD\n\tkXUTaPlOIPHgNLwVwwHFx9/Um7DmsGcPoYmskwkmg7Y8Ox6Hotc1I8j6sLJizk3G3/I4\n\tAvQnFdZzKNov6hJfnU4PzJVoN5qUDpaVfnLFlLclBdnZtORXqFaDz6i8kZjasCk/WWE4\n\tuuAQiMG8Jn6bCWsFgLIROoBjbeMAjoi8IjPm0VYKLnaz3R+NA7zbLwE3/7RQ7V6pRX1S\n\tARtRADZCGrjgQLUsINtHZFcYY+lFfJofEJIMWdoidkx+YkHIBpqtaZxdeQa3d5oRrJBa\n\tcRtQ==",
        "MIME-Version": "1.0",
        "X-Received": "by 2002:a1c:9b91:: with SMTP id\n\td139-v6mr4395888wme.50.1535706079322; \n\tFri, 31 Aug 2018 02:01:19 -0700 (PDT)",
        "Message-ID": "<20180831085337.21419-3-adrien.mazarguil@6wind.com>",
        "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=cg7wPrCBOR0XWnMPnT8WQUETRScquCCH7BEk6idb1tk=;\n\tb=Eees3gRjm9KGmln9dgVR5EwXutxBT+7r1iKgFZCKVKuhDsETip+zEbuU2WFVuIbfZk\n\t+/UdmLKyqHUZTj+wm6ILsAE5/f2S8U0bVAyXP20yvvkQXRdCru/XvfpDwejQ7uuabOT9\n\t2EOcLSNhb6GqYXyzq4FYcIXoxJxseFGk2qEHAAW1my0OFAsUhl+PyIyk13Cp2JCMaHnL\n\tL7bprdEd7FpNo01dez2TxkhzLolS/Ze7clCYOvdg1Aha/1e6SWXpbl/uH9peJhNIqybG\n\tbaP3xS56299EaMRZo6bgTahiaTQuR3cR9gKpQ1aLz/prtboT6K9ktnNcfqDAgJWnFLki\n\td5cw==",
        "Delivered-To": "patchwork@dpdk.org",
        "Precedence": "list",
        "From": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "To": "Ferruh Yigit <ferruh.yigit@intel.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "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>",
        "Date": "Fri, 31 Aug 2018 11:01:02 +0200",
        "X-Gm-Message-State": "APzg51CzB7hzX6fpQld7IGSFMSeUNpOQnYMp8VrU35X7EVw5V9Wq7q8e\n\tQ+AkzJfUN1Lq5W+d47xU5kfysQ==",
        "Cc": "dev@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,\n\tAndrew Rybchenko <arybchenko@solarflare.com>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-BeenThere": "dev@dpdk.org",
        "Subject": "[dpdk-dev] [PATCH v3 2/7] ethdev: add flow API item/action name\n\tconversion"
    },
    "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 4fd6cfa76..c3ff7e713 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 1288e76ae..052ceefb6 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": [
        "v3",
        "2/7"
    ]
}