get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 25777,
    "url": "http://patches.dpdk.org/api/patches/25777/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1498560760-104196-4-git-send-email-jacekx.piasecki@intel.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": "<1498560760-104196-4-git-send-email-jacekx.piasecki@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1498560760-104196-4-git-send-email-jacekx.piasecki@intel.com",
    "date": "2017-06-27T10:52:40",
    "name": "[dpdk-dev,v3,3/3] app/testpmd: add parse arguments from JSON config file",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "50939c5428a971115ac33798ac18febf5bf2ff51",
    "submitter": {
        "id": 667,
        "url": "http://patches.dpdk.org/api/people/667/?format=api",
        "name": "Jacek Piasecki",
        "email": "jacekx.piasecki@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1498560760-104196-4-git-send-email-jacekx.piasecki@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/25777/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/25777/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id D9A652C13;\n\tTue, 27 Jun 2017 13:05:36 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 75A382C08\n\tfor <dev@dpdk.org>; Tue, 27 Jun 2017 13:05:35 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Jun 2017 04:05:34 -0700",
            "from gklab-246-073.igk.intel.com (HELO Sent) ([10.217.246.73])\n\tby fmsmga001.fm.intel.com with SMTP; 27 Jun 2017 04:05:32 -0700",
            "by Sent (sSMTP sendmail emulation); Tue, 27 Jun 2017 13:01:46 +0200"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.39,399,1493708400\"; d=\"scan'208\";\n\ta=\"1165104639\"",
        "From": "Jacek Piasecki <jacekx.piasecki@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "bruce.richardson@intel.com, deepak.k.jain@intel.com,\n\tKuba Kozak <kubax.kozak@intel.com>",
        "Date": "Tue, 27 Jun 2017 12:52:40 +0200",
        "Message-Id": "<1498560760-104196-4-git-send-email-jacekx.piasecki@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1498560760-104196-1-git-send-email-jacekx.piasecki@intel.com>",
        "References": "<1498474759-102089-6-git-send-email-jacekx.piasecki@intel.com>\n\t<1498560760-104196-1-git-send-email-jacekx.piasecki@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 3/3] app/testpmd: add parse arguments from\n\tJSON config file",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://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": "<http://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: Kuba Kozak <kubax.kozak@intel.com>\n\nThis patch shows usage of Jansson library to parse\napplication arguments from JSON config file.\n\nhttps://github.com/akheron/jansson\n\nIf a --cfgfile-path <path> option is passed into commandline\nnon EAL section, then the disired JSON file is loaded and used\nby app. In case when JSON doesn't exist an INI file is loaded.\nThe INI file can be passed also from --cfgfile-path option.\n\nIf a file called config.ini is present in current working\ndirectory, and no --cfgfile-path option is passed in, config.ini\nfile will be loaded and used by app.\n\nSigned-off-by: Kuba Kozak <kubax.kozak@intel.com>\nSuggested-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n app/test-pmd/Makefile    |  6 ++++\n app/test-pmd/config.json | 33 +++++++++++++++++\n app/test-pmd/testpmd.c   | 94 +++++++++++++++++++++++++++++++++++++++++++++++-\n config/common_base       |  5 +++\n 4 files changed, 137 insertions(+), 1 deletion(-)\n create mode 100644 app/test-pmd/config.json",
    "diff": "diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile\nindex c36be19..a1c84cc 100644\n--- a/app/test-pmd/Makefile\n+++ b/app/test-pmd/Makefile\n@@ -83,6 +83,12 @@ endif\n \n endif\n \n+ifeq ($(CONFIG_RTE_JSON_SUPPORT),y)\n+ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),y)\n+LDLIBS += -ljansson\n+endif\n+endif\n+\n CFLAGS_cmdline.o := -D_GNU_SOURCE\n \n include $(RTE_SDK)/mk/rte.app.mk\ndiff --git a/app/test-pmd/config.json b/app/test-pmd/config.json\nnew file mode 100644\nindex 0000000..4589dbc\n--- /dev/null\n+++ b/app/test-pmd/config.json\n@@ -0,0 +1,33 @@\n+{\n+\t\"DPDK\":\n+\t{\n+\t\t\"v\": \"\",\n+\t\t\"l\": \"0-4\",\n+\t\t\"n\": \"4\",\n+\t\t\"master-lcore\": \"0\",\n+\t\t\"proc-type\": \"primary\"\n+\t},\n+\t\"TEST-PMD\":\n+\t{\n+\t\t\"i\": \"\",\n+\t\t\"portmask\": \"0xff\",\n+\t\t\"nb-cores\": \"4\",\n+\t\t\"port-topology\": \"paired\"\n+\t},\n+\t\"DPDK.vdev0\":\n+\t{\n+\t\t\"net_ring0\": \"\"\n+\t},\n+\t\"DPDK.vdev1\":\n+\t{\n+\t\t\"net_ring1\": \"\"\n+\t},\n+\t\"DPDK.vdev2\":\n+\t{\n+\t\t\"net_ring2\": \"\"\n+\t},\n+\t\"DPDK.vdev3\":\n+\t{\n+\t\t\"net_ring3\": \"\"\n+\t}\n+}\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex cd69a6b..9ce1bbe 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -46,6 +46,10 @@\n \n #include <stdint.h>\n #include <unistd.h>\n+\n+#ifdef RTE_JSON_SUPPORT\n+#include <jansson.h>\n+#endif\n #include <inttypes.h>\n \n #include <rte_common.h>\n@@ -2275,6 +2279,87 @@ cfgfile_load_path(int argc, char **argv)\n \t}\n \treturn NULL;\n }\n+\n+#ifdef RTE_JSON_SUPPORT\n+/*\n+ * Decoding JSON structure to rte_cfgfile structure.\n+ * Returns handler to cfgfile object, NULL if error.\n+ */\n+static struct\n+rte_cfgfile *l3fwd_json_to_cfg(json_t *json, int flags)\n+{\n+\tif (!json) {\n+\t\tprintf(\"Error: JSON structure is NULL, nothing to parse\\n\");\n+\t\treturn NULL;\n+\t}\n+\t/* create an empty instance of cfgfile structure */\n+\tstruct rte_cfgfile *cfgfile = rte_cfgfile_create(flags);\n+\n+\tif (!cfgfile)\n+\t\treturn NULL;\n+\n+\tconst char *section;\n+\tjson_t *entry;\n+\n+\t/* set pointer to first section */\n+\tvoid *iter_section = json_object_iter(json);\n+\n+\twhile (iter_section) {\n+\n+\t\tsection = json_object_iter_key(iter_section);\n+\t\tentry = json_object_iter_value(iter_section);\n+\n+\t\t/* add parsed section name of current section to cfgfile */\n+\t\trte_cfgfile_add_section(cfgfile, section);\n+\n+\t\t/* set pointer to first entry */\n+\t\tvoid *iter_entry = json_object_iter(entry);\n+\n+\t\twhile (iter_entry) {\n+\n+\t\t\tconst char *key;\n+\t\t\tconst char *value;\n+\n+\t\t\tkey = json_object_iter_key(iter_entry);\n+\t\t\tvalue = json_string_value(\n+\t\t\t\t\tjson_object_iter_value(iter_entry));\n+\n+\t\t\t/* add parsed key and value of current entry */\n+\t\t\t/* to cfgfile */\n+\t\t\trte_cfgfile_add_entry(cfgfile, section, key, value);\n+\n+\t\t\t/* pointer to next entry */\n+\t\t\titer_entry = json_object_iter_next(entry, iter_entry);\n+\t\t}\n+\t\t/* pointer to next section */\n+\t\titer_section = json_object_iter_next(json, iter_section);\n+\t}\n+\treturn cfgfile;\n+}\n+\n+/*\n+ * Check presence and load JSON file to rte_cfgfile structure.\n+ * Returns handler to cfgfile object, NULL if error.\n+ */\n+static struct\n+rte_cfgfile *l3fwd_load_json_to_cfg(const char *path)\n+{\n+\tstruct rte_cfgfile *cfgfile = NULL;\n+\t/* check if config file exist */\n+\tif (access(path, F_OK) != -1) {\n+\t\t/* parse JSON file */\n+\t\tjson_error_t error;\n+\t\tjson_t *json = json_load_file(path, 0, &error);\n+\n+\t\tif (json)\n+\t\t\tcfgfile = l3fwd_json_to_cfg(json, 0);\n+\t\telse\n+\t\t\tfprintf(stderr, \"JSON error on line %d: %s\\n\",\n+\t\t\t\t\t\t\terror.line, error.text);\n+\t}\n+\treturn cfgfile;\n+}\n+#endif\n #endif\n \n #define APP_NAME \"TEST-PMD\"\n@@ -2303,9 +2388,16 @@ main(int argc, char** argv)\n \t\t\t\t\"in default directory)\\n\");\n \t\tconfig_file = strdup(\"config.ini\");\n \t}\n-\n+#ifndef RTE_JSON_SUPPORT\n \tcfg = rte_cfgfile_load(config_file, CFG_FLAG_EMPTY_VALUES);\n+#endif\n \n+#ifdef RTE_JSON_SUPPORT\n+\tif (strstr(config_file, \".ini\"))\n+\t\tcfg = rte_cfgfile_load(config_file, CFG_FLAG_EMPTY_VALUES);\n+\telse if (strstr(config_file, \".json\"))\n+\t\tcfg = l3fwd_load_json_to_cfg(config_file);\n+#endif\n \tif (cfg == NULL) {\n \t\tprintf(\"Info: Valid cfgfile not found\\n\");\n \t\tcfg = rte_cfgfile_create(CFG_FLAG_EMPTY_VALUES);\ndiff --git a/config/common_base b/config/common_base\nindex c1d0e69..0eed278 100644\n--- a/config/common_base\n+++ b/config/common_base\n@@ -734,3 +734,8 @@ CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n\n # Compile the crypto performance application\n #\n CONFIG_RTE_APP_CRYPTO_PERF=y\n+\n+#\n+# Compile JSON support\n+#\n+CONFIG_RTE_JSON_SUPPORT=n\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "3/3"
    ]
}