get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 35191,
    "url": "http://patches.dpdk.org/api/patches/35191/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1518694544-22334-1-git-send-email-arybchenko@solarflare.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": "<1518694544-22334-1-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1518694544-22334-1-git-send-email-arybchenko@solarflare.com",
    "date": "2018-02-15T11:35:43",
    "name": "[dpdk-dev,v2] eal: register log type and pick level from EAL args",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "2fd6ea386d156c351a6a20ebb266d41c7bc18d2b",
    "submitter": {
        "id": 607,
        "url": "http://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.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/1518694544-22334-1-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/35191/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/35191/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 C33FA1B2A9;\n\tThu, 15 Feb 2018 12:35:57 +0100 (CET)",
            "from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com\n\t[67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 9C26A1B1D0\n\tfor <dev@dpdk.org>; Thu, 15 Feb 2018 12:35:56 +0100 (CET)",
            "from webmail.solarflare.com (webmail.solarflare.com\n\t[12.187.104.26])\n\t(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with\n\tESMTPS id 4E0F89C0053; Thu, 15 Feb 2018 11:35:55 +0000 (UTC)",
            "from sfocexch01r.SolarFlarecom.com (10.20.40.34) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id 15.0.1044.25; Thu, 15 Feb 2018 03:35:52 -0800",
            "from ocex03.SolarFlarecom.com (10.20.40.36) by\n\tsfocexch01r.SolarFlarecom.com (10.20.40.34) with Microsoft SMTP\n\tServer (TLS) id 15.0.1044.25; Thu, 15 Feb 2018 03:35:50 -0800",
            "from opal.uk.solarflarecom.com (10.17.10.1) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id\n\t15.0.1044.25 via Frontend Transport; Thu, 15 Feb 2018 03:35:50 -0800",
            "from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com\n\t[10.17.10.10])\n\tby opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tw1FBZnvb003376; Thu, 15 Feb 2018 11:35:49 GMT",
            "from uklogin.uk.solarflarecom.com (localhost.localdomain\n\t[127.0.0.1])\n\tby uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tw1FBZnkk022367; Thu, 15 Feb 2018 11:35:49 GMT"
        ],
        "X-Virus-Scanned": "Proofpoint Essentials engine",
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<dev@dpdk.org>",
        "CC": "Thomas Monjalon <thomas@monjalon.net>, Olivier Matz\n\t<olivier.matz@6wind.com>, Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Thu, 15 Feb 2018 11:35:43 +0000",
        "Message-ID": "<1518694544-22334-1-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.2.3",
        "In-Reply-To": "<1516899647-8541-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1516899647-8541-1-git-send-email-arybchenko@solarflare.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-MDID": "1518694556-cslQ3AwHD5aA",
        "Subject": "[dpdk-dev] [PATCH v2] eal: register log type and pick level from\n\tEAL args",
        "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Ivan Malov <ivan.malov@oktetlabs.ru>\n\nDynamic log types are registered on RTE_INIT() step.\nThis allows one to set log levels by EAL options on\napplication launch. However, this does not allow to\nmanage log types if they are created during runtime.\n\nEAL does not store log levels and types passed from\nthe command line. Thus, they cannot be picked later.\nThis is an obvious flaw since it would be better to\nbe able to pick levels for dynamic types registered\nfor runtime-determined facilities such as NIC ports.\n\nThis patch provides a mechanism to store log levels\npassed from EAL options and adds an API to register\nlog types and pick levels from the internal storage.\n\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <arybchenko@solarflare.com>\nReviewed-by: Andy Moreton <amoreton@solarflare.com>\n---\n lib/librte_eal/common/eal_common_log.c     | 36 ++++++++++++++++++++++\n lib/librte_eal/common/eal_common_options.c | 23 ++++++++++++++\n lib/librte_eal/common/include/rte_log.h    | 48 ++++++++++++++++++++++++++++++\n lib/librte_eal/rte_eal_version.map         |  1 +\n 4 files changed, 108 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c\nindex 37b2e20..a271926 100644\n--- a/lib/librte_eal/common/eal_common_log.c\n+++ b/lib/librte_eal/common/eal_common_log.c\n@@ -23,6 +23,10 @@ struct rte_logs rte_logs = {\n \t.file = NULL,\n };\n \n+/** Global list of valid EAL log level options */\n+struct rte_eal_opt_loglevel_list opt_loglevel_list =\n+\tTAILQ_HEAD_INITIALIZER(opt_loglevel_list);\n+\n /* Stream to use for logging if rte_logs.file is NULL */\n static FILE *default_log_stream;\n \n@@ -186,6 +190,38 @@ rte_log_register(const char *name)\n \treturn ret;\n }\n \n+/* Register an extended log type and try to pick its level from EAL options */\n+int __rte_experimental\n+rte_log_register_type_and_pick_level(const char *name, uint32_t level_def)\n+{\n+\tstruct rte_eal_opt_loglevel *opt_ll;\n+\tuint32_t level = level_def;\n+\tint type;\n+\n+\ttype = rte_log_register(name);\n+\tif (type < 0)\n+\t\treturn type;\n+\n+\tTAILQ_FOREACH(opt_ll, &opt_loglevel_list, next) {\n+\t\tregex_t r;\n+\n+\t\tif (opt_ll->level > RTE_LOG_DEBUG)\n+\t\t\tcontinue;\n+\n+\t\tif (regcomp(&r, opt_ll->re_type, 0) != 0)\n+\t\t\tcontinue;\n+\n+\t\tif (regexec(&r, name, 0, NULL, 0) == 0)\n+\t\t\tlevel = opt_ll->level;\n+\n+\t\tregfree(&r);\n+\t}\n+\n+\trte_logs.dynamic_types[type].loglevel = level;\n+\n+\treturn type;\n+}\n+\n struct logtype {\n \tuint32_t log_id;\n \tconst char *logtype;\ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex 9f2f8d2..d29b85f 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -946,6 +946,29 @@ eal_parse_log_level(const char *arg)\n \t\tprintf(\"cannot set log level %s,%lu\\n\",\n \t\t\ttype, tmp);\n \t\tgoto fail;\n+\t} else {\n+\t\tstruct rte_eal_opt_loglevel *opt_ll;\n+\n+\t\t/*\n+\t\t * Save the type (regexp string) and the loglevel\n+\t\t * in the global storage so that it could be used\n+\t\t * to configure dynamic logtypes which are absent\n+\t\t * at the moment of EAL option processing but may\n+\t\t * be registered during runtime.\n+\t\t */\n+\t\topt_ll = malloc(sizeof(*opt_ll));\n+\t\tif (opt_ll == NULL)\n+\t\t\tgoto fail;\n+\n+\t\topt_ll->re_type = strdup(type);\n+\t\tif (opt_ll->re_type == NULL) {\n+\t\t\tfree(opt_ll);\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\topt_ll->level = tmp;\n+\n+\t\tTAILQ_INSERT_HEAD(&opt_loglevel_list, opt_ll, next);\n \t}\n \n \tfree(str);\ndiff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h\nindex 9029c78..5f4799e 100644\n--- a/lib/librte_eal/common/include/rte_log.h\n+++ b/lib/librte_eal/common/include/rte_log.h\n@@ -20,6 +20,7 @@ extern \"C\" {\n #include <stdint.h>\n #include <stdio.h>\n #include <stdarg.h>\n+#include <sys/queue.h>\n \n #include <rte_common.h>\n #include <rte_config.h>\n@@ -85,6 +86,32 @@ extern struct rte_logs rte_logs;\n #define RTE_LOG_DEBUG    8U  /**< Debug-level messages.             */\n \n /**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Entry definition for the storage to keep EAL log level options\n+ * which are found to have log type regular expressions specified.\n+ */\n+struct rte_eal_opt_loglevel {\n+\t/** Next list entry */\n+\tTAILQ_ENTRY(rte_eal_opt_loglevel) next;\n+\t/** Regular expression string obtained from the option */\n+\tchar *re_type;\n+\t/** Log level value obtained from the option */\n+\tuint32_t level;\n+};\n+\n+TAILQ_HEAD(rte_eal_opt_loglevel_list, rte_eal_opt_loglevel);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Global list of EAL log level options featuring log type expressions\n+ */\n+extern struct rte_eal_opt_loglevel_list opt_loglevel_list;\n+\n+/**\n  * Change the stream that will be used by the logging system.\n  *\n  * This can be done at any time. The f argument represents the stream\n@@ -195,6 +222,27 @@ int rte_log_cur_msg_logtype(void);\n int rte_log_register(const char *name);\n \n /**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Register a dynamic log type and try to pick its level from EAL options\n+ *\n+ * rte_log_register() is called inside. If successful, the function tries\n+ * to search for matching regexp in the list of EAL log level options and\n+ * pick the level from the last matching entry. If nothing can be applied\n+ * from the list, the level will be set to the user-defined default value.\n+ *\n+ * @param name\n+ *    Name for the log type to be registered\n+ * @param level_def\n+ *    Fallback level to be set if the global list has no matching options\n+ * @return\n+ *    - >=0: the newly registered log type\n+ *    - <0: rte_log_register() error value\n+ */\n+int rte_log_register_type_and_pick_level(const char *name, uint32_t level_def);\n+\n+/**\n  * Dump log information.\n  *\n  * Dump the global level and the registered log types.\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex d123602..f331f54 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -221,6 +221,7 @@ EXPERIMENTAL {\n \trte_eal_hotplug_add;\n \trte_eal_hotplug_remove;\n \trte_eal_mbuf_user_pool_ops;\n+\trte_log_register_type_and_pick_level;\n \trte_mp_action_register;\n \trte_mp_action_unregister;\n \trte_mp_sendmsg;\n",
    "prefixes": [
        "dpdk-dev",
        "v2"
    ]
}