get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 12912,
    "url": "https://patches.dpdk.org/api/patches/12912/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1463754940-8114-3-git-send-email-piotrx.t.azarewicz@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1463754940-8114-3-git-send-email-piotrx.t.azarewicz@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1463754940-8114-3-git-send-email-piotrx.t.azarewicz@intel.com",
    "date": "2016-05-20T14:35:35",
    "name": "[dpdk-dev,v2,2/7] examples/ip_pipeline: modifies common pipeline CLI",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e7df71a048a2533f558ab8a1118acbe8288d4251",
    "submitter": {
        "id": 273,
        "url": "https://patches.dpdk.org/api/people/273/?format=api",
        "name": "Piotr Azarewicz",
        "email": "piotrx.t.azarewicz@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1463754940-8114-3-git-send-email-piotrx.t.azarewicz@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/12912/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/12912/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 E91BBB457;\n\tFri, 20 May 2016 16:32:56 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 6C33BB457\n\tfor <dev@dpdk.org>; Fri, 20 May 2016 16:32:54 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga102.jf.intel.com with ESMTP; 20 May 2016 07:32:53 -0700",
            "from gklab-246-018.igk.intel.com (HELO stargo) ([10.217.246.18])\n\tby fmsmga002.fm.intel.com with SMTP; 20 May 2016 07:32:51 -0700",
            "by stargo (sSMTP sendmail emulation);\n\tFri, 20 May 2016 16:38:17 +0200"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.26,339,1459839600\"; d=\"scan'208\";a=\"985349605\"",
        "From": "Piotr Azarewicz <piotrx.t.azarewicz@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Piotr Azarewicz <piotrx.t.azarewicz@intel.com>,\n\tTomasz Kulasek <tomaszx.kulasek@intel.com>,\n\tMichal Kobylinski <michalx.kobylinski@intel.com>",
        "Date": "Fri, 20 May 2016 16:35:35 +0200",
        "Message-Id": "<1463754940-8114-3-git-send-email-piotrx.t.azarewicz@intel.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1463754940-8114-1-git-send-email-piotrx.t.azarewicz@intel.com>",
        "References": "<1462550250-1256-1-git-send-email-michalx.k.jastrzebski@intel.com>\n\t<1463754940-8114-1-git-send-email-piotrx.t.azarewicz@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 2/7] examples/ip_pipeline: modifies common\n\tpipeline CLI",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "All link commands are merged into one command:\ncmd_link_parsed.\nImprove run command to allow run periodically.\nAdding static keyword to a lot of token declarations.\n\nSigned-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>\nSigned-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>\nAcked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n examples/ip_pipeline/pipeline/pipeline_common_fe.c |  452 ++++++++++----------\n examples/ip_pipeline/pipeline/pipeline_common_fe.h |    9 +\n examples/ip_pipeline/thread_fe.c                   |   36 +-\n 3 files changed, 244 insertions(+), 253 deletions(-)",
    "diff": "diff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.c b/examples/ip_pipeline/pipeline/pipeline_common_fe.c\nindex a691d42..dc37a5f 100644\n--- a/examples/ip_pipeline/pipeline/pipeline_common_fe.c\n+++ b/examples/ip_pipeline/pipeline/pipeline_common_fe.c\n@@ -1,7 +1,7 @@\n /*-\n  *   BSD LICENSE\n  *\n- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n  *   All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n@@ -42,12 +42,10 @@\n #include <cmdline_parse.h>\n #include <cmdline_parse_num.h>\n #include <cmdline_parse_string.h>\n-#include <cmdline_parse_ipaddr.h>\n-#include <cmdline_parse_etheraddr.h>\n-#include <cmdline_socket.h>\n #include <cmdline.h>\n \n #include \"pipeline_common_fe.h\"\n+#include \"parser.h\"\n \n int\n app_pipeline_ping(struct app_params *app,\n@@ -464,16 +462,16 @@ cmd_ping_parsed(\n \t\tprintf(\"Command failed\\n\");\n }\n \n-cmdline_parse_token_string_t cmd_ping_p_string =\n+static cmdline_parse_token_string_t cmd_ping_p_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_ping_result, p_string, \"p\");\n \n-cmdline_parse_token_num_t cmd_ping_pipeline_id =\n+static cmdline_parse_token_num_t cmd_ping_pipeline_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_ping_result, pipeline_id, UINT32);\n \n-cmdline_parse_token_string_t cmd_ping_ping_string =\n+static cmdline_parse_token_string_t cmd_ping_ping_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_ping_result, ping_string, \"ping\");\n \n-cmdline_parse_inst_t cmd_ping = {\n+static cmdline_parse_inst_t cmd_ping = {\n \t.f = cmd_ping_parsed,\n \t.data = NULL,\n \t.help_str = \"Pipeline ping\",\n@@ -498,6 +496,7 @@ struct cmd_stats_port_in_result {\n \tuint32_t port_in_id;\n \n };\n+\n static void\n cmd_stats_port_in_parsed(\n \tvoid *parsed_result,\n@@ -531,23 +530,23 @@ cmd_stats_port_in_parsed(\n \t\tstats.stats.n_pkts_drop);\n }\n \n-cmdline_parse_token_string_t cmd_stats_port_in_p_string =\n+static cmdline_parse_token_string_t cmd_stats_port_in_p_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_port_in_result, p_string,\n \t\t\"p\");\n \n-cmdline_parse_token_num_t cmd_stats_port_in_pipeline_id =\n+static cmdline_parse_token_num_t cmd_stats_port_in_pipeline_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_stats_port_in_result, pipeline_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_stats_port_in_stats_string =\n+static cmdline_parse_token_string_t cmd_stats_port_in_stats_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_port_in_result, stats_string,\n \t\t\"stats\");\n \n-cmdline_parse_token_string_t cmd_stats_port_in_port_string =\n+static cmdline_parse_token_string_t cmd_stats_port_in_port_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_port_in_result, port_string,\n \t\t\"port\");\n \n-cmdline_parse_token_string_t cmd_stats_port_in_in_string =\n+static cmdline_parse_token_string_t cmd_stats_port_in_in_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_port_in_result, in_string,\n \t\t\"in\");\n \n@@ -555,7 +554,7 @@ cmdline_parse_token_string_t cmd_stats_port_in_in_string =\n \tTOKEN_NUM_INITIALIZER(struct cmd_stats_port_in_result, port_in_id,\n \t\tUINT32);\n \n-cmdline_parse_inst_t cmd_stats_port_in = {\n+static cmdline_parse_inst_t cmd_stats_port_in = {\n \t.f = cmd_stats_port_in_parsed,\n \t.data = NULL,\n \t.help_str = \"Pipeline input port stats\",\n@@ -617,31 +616,31 @@ cmd_stats_port_out_parsed(\n \t\tstats.stats.n_pkts_drop);\n }\n \n-cmdline_parse_token_string_t cmd_stats_port_out_p_string =\n+static cmdline_parse_token_string_t cmd_stats_port_out_p_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_port_out_result, p_string,\n \t\"p\");\n \n-cmdline_parse_token_num_t cmd_stats_port_out_pipeline_id =\n+static cmdline_parse_token_num_t cmd_stats_port_out_pipeline_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_stats_port_out_result, pipeline_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_stats_port_out_stats_string =\n+static cmdline_parse_token_string_t cmd_stats_port_out_stats_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_port_out_result, stats_string,\n \t\t\"stats\");\n \n-cmdline_parse_token_string_t cmd_stats_port_out_port_string =\n+static cmdline_parse_token_string_t cmd_stats_port_out_port_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_port_out_result, port_string,\n \t\t\"port\");\n \n-cmdline_parse_token_string_t cmd_stats_port_out_out_string =\n+static cmdline_parse_token_string_t cmd_stats_port_out_out_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_port_out_result, out_string,\n \t\t\"out\");\n \n-cmdline_parse_token_num_t cmd_stats_port_out_port_out_id =\n+static cmdline_parse_token_num_t cmd_stats_port_out_port_out_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_stats_port_out_result, port_out_id,\n \t\tUINT32);\n \n-cmdline_parse_inst_t cmd_stats_port_out = {\n+static cmdline_parse_inst_t cmd_stats_port_out = {\n \t.f = cmd_stats_port_out_parsed,\n \t.data = NULL,\n \t.help_str = \"Pipeline output port stats\",\n@@ -707,26 +706,26 @@ cmd_stats_table_parsed(\n \t\tstats.n_pkts_dropped_lkp_miss);\n }\n \n-cmdline_parse_token_string_t cmd_stats_table_p_string =\n+static cmdline_parse_token_string_t cmd_stats_table_p_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_table_result, p_string,\n \t\t\"p\");\n \n-cmdline_parse_token_num_t cmd_stats_table_pipeline_id =\n+static cmdline_parse_token_num_t cmd_stats_table_pipeline_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_stats_table_result, pipeline_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_stats_table_stats_string =\n+static cmdline_parse_token_string_t cmd_stats_table_stats_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_table_result, stats_string,\n \t\t\"stats\");\n \n-cmdline_parse_token_string_t cmd_stats_table_table_string =\n+static cmdline_parse_token_string_t cmd_stats_table_table_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_stats_table_result, table_string,\n \t\t\"table\");\n \n-cmdline_parse_token_num_t cmd_stats_table_table_id =\n+static cmdline_parse_token_num_t cmd_stats_table_table_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_stats_table_result, table_id, UINT32);\n \n-cmdline_parse_inst_t cmd_stats_table = {\n+static cmdline_parse_inst_t cmd_stats_table = {\n \t.f = cmd_stats_table_parsed,\n \t.data = NULL,\n \t.help_str = \"Pipeline table stats\",\n@@ -771,31 +770,31 @@ cmd_port_in_enable_parsed(\n \t\tprintf(\"Command failed\\n\");\n }\n \n-cmdline_parse_token_string_t cmd_port_in_enable_p_string =\n+static cmdline_parse_token_string_t cmd_port_in_enable_p_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_port_in_enable_result, p_string,\n \t\t\"p\");\n \n-cmdline_parse_token_num_t cmd_port_in_enable_pipeline_id =\n+static cmdline_parse_token_num_t cmd_port_in_enable_pipeline_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_port_in_enable_result, pipeline_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_port_in_enable_port_string =\n+static cmdline_parse_token_string_t cmd_port_in_enable_port_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_port_in_enable_result, port_string,\n \t\"port\");\n \n-cmdline_parse_token_string_t cmd_port_in_enable_in_string =\n+static cmdline_parse_token_string_t cmd_port_in_enable_in_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_port_in_enable_result, in_string,\n \t\t\"in\");\n \n-cmdline_parse_token_num_t cmd_port_in_enable_port_in_id =\n+static cmdline_parse_token_num_t cmd_port_in_enable_port_in_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_port_in_enable_result, port_in_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_port_in_enable_enable_string =\n+static cmdline_parse_token_string_t cmd_port_in_enable_enable_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_port_in_enable_result,\n \t\tenable_string, \"enable\");\n \n-cmdline_parse_inst_t cmd_port_in_enable = {\n+static cmdline_parse_inst_t cmd_port_in_enable = {\n \t.f = cmd_port_in_enable_parsed,\n \t.data = NULL,\n \t.help_str = \"Pipeline input port enable\",\n@@ -841,31 +840,31 @@ cmd_port_in_disable_parsed(\n \t\tprintf(\"Command failed\\n\");\n }\n \n-cmdline_parse_token_string_t cmd_port_in_disable_p_string =\n+static cmdline_parse_token_string_t cmd_port_in_disable_p_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_port_in_disable_result, p_string,\n \t\t\"p\");\n \n-cmdline_parse_token_num_t cmd_port_in_disable_pipeline_id =\n+static cmdline_parse_token_num_t cmd_port_in_disable_pipeline_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_port_in_disable_result, pipeline_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_port_in_disable_port_string =\n+static cmdline_parse_token_string_t cmd_port_in_disable_port_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_port_in_disable_result, port_string,\n \t\t\"port\");\n \n-cmdline_parse_token_string_t cmd_port_in_disable_in_string =\n+static cmdline_parse_token_string_t cmd_port_in_disable_in_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_port_in_disable_result, in_string,\n \t\t\"in\");\n \n-cmdline_parse_token_num_t cmd_port_in_disable_port_in_id =\n+static cmdline_parse_token_num_t cmd_port_in_disable_port_in_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_port_in_disable_result, port_in_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_port_in_disable_disable_string =\n+static cmdline_parse_token_string_t cmd_port_in_disable_disable_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_port_in_disable_result,\n \t\tdisable_string, \"disable\");\n \n-cmdline_parse_inst_t cmd_port_in_disable = {\n+static cmdline_parse_inst_t cmd_port_in_disable = {\n \t.f = cmd_port_in_disable_parsed,\n \t.data = NULL,\n \t.help_str = \"Pipeline input port disable\",\n@@ -963,219 +962,144 @@ print_link_info(struct app_link_params *p)\n \tprintf(\"\\n\");\n }\n \n-struct cmd_link_config_result {\n-\tcmdline_fixed_string_t link_string;\n-\tuint32_t link_id;\n-\tcmdline_fixed_string_t config_string;\n-\tcmdline_ipaddr_t ip;\n-\tuint32_t depth;\n-};\n-\n-static void\n-cmd_link_config_parsed(\n-\tvoid *parsed_result,\n-\t__attribute__((unused)) struct cmdline *cl,\n-\t void *data)\n-{\n-\tstruct cmd_link_config_result *params = parsed_result;\n-\tstruct app_params *app = data;\n-\tint status;\n-\n-\tuint32_t link_id = params->link_id;\n-\tuint32_t ip  = rte_bswap32((uint32_t) params->ip.addr.ipv4.s_addr);\n-\tuint32_t depth = params->depth;\n-\n-\tstatus = app_link_config(app, link_id, ip, depth);\n-\tif (status)\n-\t\tprintf(\"Command failed\\n\");\n-\telse {\n-\t\tstruct app_link_params *p;\n-\n-\t\tAPP_PARAM_FIND_BY_ID(app->link_params, \"LINK\", link_id, p);\n-\t\tprint_link_info(p);\n-\t}\n-}\n-\n-cmdline_parse_token_string_t cmd_link_config_link_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_link_config_result, link_string,\n-\t\t\"link\");\n-\n-cmdline_parse_token_num_t cmd_link_config_link_id =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_link_config_result, link_id, UINT32);\n-\n-cmdline_parse_token_string_t cmd_link_config_config_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_link_config_result, config_string,\n-\t\t\"config\");\n-\n-cmdline_parse_token_ipaddr_t cmd_link_config_ip =\n-\tTOKEN_IPV4_INITIALIZER(struct cmd_link_config_result, ip);\n-\n-cmdline_parse_token_num_t cmd_link_config_depth =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_link_config_result, depth, UINT32);\n-\n-cmdline_parse_inst_t cmd_link_config = {\n-\t.f = cmd_link_config_parsed,\n-\t.data = NULL,\n-\t.help_str = \"Link configuration\",\n-\t.tokens = {\n-\t\t(void *)&cmd_link_config_link_string,\n-\t\t(void *)&cmd_link_config_link_id,\n-\t\t(void *)&cmd_link_config_config_string,\n-\t\t(void *)&cmd_link_config_ip,\n-\t\t(void *)&cmd_link_config_depth,\n-\t\tNULL,\n-\t},\n-};\n-\n /*\n- * link up\n+ * link\n+ *\n+ * link config:\n+ *    link <linkid> config <ipaddr> <depth>\n+ *\n+ * link up:\n+ *    link <linkid> up\n+ *\n+ * link down:\n+ *    link <linkid> down\n+ *\n+ * link ls:\n+ *    link ls\n  */\n \n-struct cmd_link_up_result {\n+struct cmd_link_result {\n \tcmdline_fixed_string_t link_string;\n-\tuint32_t link_id;\n-\tcmdline_fixed_string_t up_string;\n+\tcmdline_multi_string_t multi_string;\n };\n \n static void\n-cmd_link_up_parsed(\n+cmd_link_parsed(\n \tvoid *parsed_result,\n \t__attribute__((unused)) struct cmdline *cl,\n-\tvoid *data)\n+\t void *data)\n {\n-\tstruct cmd_link_up_result *params = parsed_result;\n+\tstruct cmd_link_result *params = parsed_result;\n \tstruct app_params *app = data;\n+\n+\tchar *tokens[16];\n+\tuint32_t n_tokens = RTE_DIM(tokens);\n \tint status;\n \n-\tstatus = app_link_up(app, params->link_id);\n-\tif (status != 0)\n-\t\tprintf(\"Command failed\\n\");\n-\telse {\n-\t\tstruct app_link_params *p;\n+\tuint32_t link_id;\n \n-\t\tAPP_PARAM_FIND_BY_ID(app->link_params, \"LINK\", params->link_id,\n-\t\t\tp);\n-\t\tprint_link_info(p);\n+\tstatus = parse_tokenize_string(params->multi_string, tokens, &n_tokens);\n+\tif (status != 0) {\n+\t\tprintf(CMD_MSG_TOO_MANY_ARGS, \"link\");\n+\t\treturn;\n \t}\n-}\n-\n-cmdline_parse_token_string_t cmd_link_up_link_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_link_up_result, link_string,\n-\t\t\"link\");\n \n-cmdline_parse_token_num_t cmd_link_up_link_id =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_link_up_result, link_id, UINT32);\n+\t/* link ls */\n+\tif ((n_tokens == 1) && (strcmp(tokens[0], \"ls\") == 0)) {\n+\t\tfor (link_id = 0; link_id < app->n_links; link_id++) {\n+\t\t\tstruct app_link_params *p;\n \n-cmdline_parse_token_string_t cmd_link_up_up_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_link_up_result, up_string, \"up\");\n+\t\t\tAPP_PARAM_FIND_BY_ID(app->link_params, \"LINK\", link_id, p);\n+\t\t\tprint_link_info(p);\n+\t\t}\n+\t\treturn;\n+\t} /* link ls */\n \n-cmdline_parse_inst_t cmd_link_up = {\n-\t.f = cmd_link_up_parsed,\n-\t.data = NULL,\n-\t.help_str = \"Link UP\",\n-\t.tokens = {\n-\t\t(void *)&cmd_link_up_link_string,\n-\t\t(void *)&cmd_link_up_link_id,\n-\t\t(void *)&cmd_link_up_up_string,\n-\t\tNULL,\n-\t},\n-};\n+\tif (n_tokens < 2) {\n+\t\tprintf(CMD_MSG_MISMATCH_ARGS, \"link\");\n+\t\treturn;\n+\t}\n \n-/*\n- * link down\n- */\n+\tif (parser_read_uint32(&link_id, tokens[0])) {\n+\t\tprintf(CMD_MSG_INVALID_ARG, \"linkid\");\n+\t\treturn;\n+\t}\n \n-struct cmd_link_down_result {\n-\tcmdline_fixed_string_t link_string;\n-\tuint32_t link_id;\n-\tcmdline_fixed_string_t down_string;\n-};\n+\t/* link config */\n+\tif (strcmp(tokens[1], \"config\") == 0) {\n+\t\tstruct in_addr ipaddr_ipv4;\n+\t\tuint32_t depth;\n \n-static void\n-cmd_link_down_parsed(\n-\tvoid *parsed_result,\n-\t__attribute__((unused)) struct cmdline *cl,\n-\tvoid *data)\n-{\n-\tstruct cmd_link_down_result *params = parsed_result;\n-\tstruct app_params *app = data;\n-\tint status;\n+\t\tif (n_tokens != 4) {\n+\t\t\tprintf(CMD_MSG_MISMATCH_ARGS, \"link config\");\n+\t\t\treturn;\n+\t\t}\n \n-\tstatus = app_link_down(app, params->link_id);\n-\tif (status != 0)\n-\t\tprintf(\"Command failed\\n\");\n-\telse {\n-\t\tstruct app_link_params *p;\n+\t\tif (parse_ipv4_addr(tokens[2], &ipaddr_ipv4)) {\n+\t\t\tprintf(CMD_MSG_INVALID_ARG, \"ipaddr\");\n+\t\t\treturn;\n+\t\t}\n \n-\t\tAPP_PARAM_FIND_BY_ID(app->link_params, \"LINK\", params->link_id,\n-\t\t\tp);\n-\t\tprint_link_info(p);\n-\t}\n-}\n+\t\tif (parser_read_uint32(&depth, tokens[3])) {\n+\t\t\tprintf(CMD_MSG_INVALID_ARG, \"depth\");\n+\t\t\treturn;\n+\t\t}\n \n-cmdline_parse_token_string_t cmd_link_down_link_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_link_down_result, link_string,\n-\t\t\"link\");\n+\t\tstatus = app_link_config(app,\n+\t\t\tlink_id,\n+\t\t\trte_be_to_cpu_32(ipaddr_ipv4.s_addr),\n+\t\t\tdepth);\n+\t\tif (status)\n+\t\t\tprintf(CMD_MSG_FAIL, \"link config\");\n \n-cmdline_parse_token_num_t cmd_link_down_link_id =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_link_down_result, link_id, UINT32);\n+\t\treturn;\n+\t} /* link config */\n \n-cmdline_parse_token_string_t cmd_link_down_down_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_link_down_result, down_string,\n-\t\t\"down\");\n+\t/* link up */\n+\tif (strcmp(tokens[1], \"up\") == 0) {\n+\t\tif (n_tokens != 2) {\n+\t\t\tprintf(CMD_MSG_MISMATCH_ARGS, \"link up\");\n+\t\t\treturn;\n+\t\t}\n \n-cmdline_parse_inst_t cmd_link_down = {\n-\t.f = cmd_link_down_parsed,\n-\t.data = NULL,\n-\t.help_str = \"Link DOWN\",\n-\t.tokens = {\n-\t\t(void *) &cmd_link_down_link_string,\n-\t\t(void *) &cmd_link_down_link_id,\n-\t\t(void *) &cmd_link_down_down_string,\n-\t\tNULL,\n-\t},\n-};\n+\t\tstatus = app_link_up(app, link_id);\n+\t\tif (status)\n+\t\t\tprintf(CMD_MSG_FAIL, \"link up\");\n \n-/*\n- * link ls\n- */\n+\t\treturn;\n+\t} /* link up */\n \n-struct cmd_link_ls_result {\n-\tcmdline_fixed_string_t link_string;\n-\tcmdline_fixed_string_t ls_string;\n-};\n+\t/* link down */\n+\tif (strcmp(tokens[1], \"down\") == 0) {\n+\t\tif (n_tokens != 2) {\n+\t\t\tprintf(CMD_MSG_MISMATCH_ARGS, \"link down\");\n+\t\t\treturn;\n+\t\t}\n \n-static void\n-cmd_link_ls_parsed(\n-\t__attribute__((unused)) void *parsed_result,\n-\t__attribute__((unused)) struct cmdline *cl,\n-\t void *data)\n-{\n-\tstruct app_params *app = data;\n-\tuint32_t link_id;\n+\t\tstatus = app_link_down(app, link_id);\n+\t\tif (status)\n+\t\t\tprintf(CMD_MSG_FAIL, \"link down\");\n \n-\tfor (link_id = 0; link_id < app->n_links; link_id++) {\n-\t\tstruct app_link_params *p;\n+\t\treturn;\n+\t} /* link down */\n \n-\t\tAPP_PARAM_FIND_BY_ID(app->link_params, \"LINK\", link_id, p);\n-\t\tprint_link_info(p);\n-\t}\n+\tprintf(CMD_MSG_MISMATCH_ARGS, \"link\");\n }\n \n-cmdline_parse_token_string_t cmd_link_ls_link_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_link_ls_result, link_string,\n-\t\t\"link\");\n+static cmdline_parse_token_string_t cmd_link_link_string =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_link_result, link_string, \"link\");\n \n-cmdline_parse_token_string_t cmd_link_ls_ls_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_link_ls_result, ls_string, \"ls\");\n+static cmdline_parse_token_string_t cmd_link_multi_string =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_link_result, multi_string,\n+\tTOKEN_STRING_MULTI);\n \n-cmdline_parse_inst_t cmd_link_ls = {\n-\t.f = cmd_link_ls_parsed,\n+static cmdline_parse_inst_t cmd_link = {\n+\t.f = cmd_link_parsed,\n \t.data = NULL,\n-\t.help_str = \"Link list\",\n+\t.help_str = \"link config / up / down / ls\",\n \t.tokens = {\n-\t\t(void *)&cmd_link_ls_link_string,\n-\t\t(void *)&cmd_link_ls_ls_string,\n+\t\t(void *) &cmd_link_link_string,\n+\t\t(void *) &cmd_link_multi_string,\n \t\tNULL,\n \t},\n };\n@@ -1212,6 +1136,11 @@ static cmdline_parse_inst_t cmd_quit = {\n \n /*\n  * run\n+ *\n+ *    run <file>\n+ *    run <file> [<count> [<interval>]]\n+\t <count> default is 1\n+ *       <interval> is measured in milliseconds, default is 1 second\n  */\n \n static void\n@@ -1233,9 +1162,9 @@ app_run_file(\n \tclose(fd);\n }\n \n-struct cmd_run_file_result {\n+struct cmd_run_result {\n \tcmdline_fixed_string_t run_string;\n-\tchar file_name[APP_FILE_NAME_SIZE];\n+\tcmdline_multi_string_t multi_string;\n };\n \n static void\n@@ -1244,25 +1173,87 @@ cmd_run_parsed(\n \tstruct cmdline *cl,\n \t__attribute__((unused)) void *data)\n {\n-\tstruct cmd_run_file_result *params = parsed_result;\n+\tstruct cmd_run_result *params = parsed_result;\n+\n+\tchar *tokens[16];\n+\tuint32_t n_tokens = RTE_DIM(tokens);\n+\tint status;\n+\n+\tchar *file_name;\n+\tuint32_t count, interval, i;\n+\n+\tstatus = parse_tokenize_string(params->multi_string, tokens, &n_tokens);\n+\tif (status) {\n+\t\tprintf(CMD_MSG_TOO_MANY_ARGS, \"run\");\n+\t\treturn;\n+\t}\n+\n+\tswitch (n_tokens) {\n+\tcase 0:\n+\t\tprintf(CMD_MSG_NOT_ENOUGH_ARGS, \"run\");\n+\t\treturn;\n+\n+\tcase 1:\n+\t\tfile_name = tokens[0];\n+\t\tcount = 1;\n+\t\tinterval = 1000;\n+\t\tbreak;\n+\n+\tcase 2:\n+\t\tfile_name = tokens[0];\n \n-\tapp_run_file(cl->ctx, params->file_name);\n+\t\tif (parser_read_uint32(&count, tokens[1]) ||\n+\t\t\t(count == 0)) {\n+\t\t\tprintf(CMD_MSG_INVALID_ARG, \"count\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tinterval = 1000;\n+\t\tbreak;\n+\n+\tcase 3:\n+\t\tfile_name = tokens[0];\n+\n+\t\tif (parser_read_uint32(&count, tokens[1]) ||\n+\t\t\t(count == 0)) {\n+\t\t\tprintf(CMD_MSG_INVALID_ARG, \"count\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (parser_read_uint32(&interval, tokens[2]) ||\n+\t\t\t(interval == 0)) {\n+\t\t\tprintf(CMD_MSG_INVALID_ARG, \"interval\");\n+\t\t\treturn;\n+\t\t}\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tprintf(CMD_MSG_MISMATCH_ARGS, \"run\");\n+\t\treturn;\n+\t}\n+\n+\tfor (i = 0; i < count; i++) {\n+\t\tapp_run_file(cl->ctx, file_name);\n+\t\tif (interval)\n+\t\t\tusleep(interval * 1000);\n+\t}\n }\n \n-cmdline_parse_token_string_t cmd_run_run_string =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_run_file_result, run_string,\n-\t\t\"run\");\n+static cmdline_parse_token_string_t cmd_run_run_string =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_run_result, run_string, \"run\");\n \n-cmdline_parse_token_string_t cmd_run_file_name =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_run_file_result, file_name, NULL);\n+static cmdline_parse_token_string_t cmd_run_multi_string =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_run_result, multi_string,\n+\tTOKEN_STRING_MULTI);\n \n-cmdline_parse_inst_t cmd_run = {\n+\n+static cmdline_parse_inst_t cmd_run = {\n \t.f = cmd_run_parsed,\n \t.data = NULL,\n \t.help_str = \"Run CLI script file\",\n \t.tokens = {\n \t\t(void *) &cmd_run_run_string,\n-\t\t(void *) &cmd_run_file_name,\n+\t\t(void *) &cmd_run_multi_string,\n \t\tNULL,\n \t},\n };\n@@ -1270,12 +1261,7 @@ cmdline_parse_inst_t cmd_run = {\n static cmdline_parse_ctx_t pipeline_common_cmds[] = {\n \t(cmdline_parse_inst_t *) &cmd_quit,\n \t(cmdline_parse_inst_t *) &cmd_run,\n-\n-\t(cmdline_parse_inst_t *) &cmd_link_config,\n-\t(cmdline_parse_inst_t *) &cmd_link_up,\n-\t(cmdline_parse_inst_t *) &cmd_link_down,\n-\t(cmdline_parse_inst_t *) &cmd_link_ls,\n-\n+\t(cmdline_parse_inst_t *) &cmd_link,\n \t(cmdline_parse_inst_t *) &cmd_ping,\n \t(cmdline_parse_inst_t *) &cmd_stats_port_in,\n \t(cmdline_parse_inst_t *) &cmd_stats_port_out,\ndiff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.h b/examples/ip_pipeline/pipeline/pipeline_common_fe.h\nindex cfad963..f93ff74 100644\n--- a/examples/ip_pipeline/pipeline/pipeline_common_fe.h\n+++ b/examples/ip_pipeline/pipeline/pipeline_common_fe.h\n@@ -231,4 +231,13 @@ app_link_down(struct app_params *app,\n int\n app_pipeline_common_cmd_push(struct app_params *app);\n \n+#define CMD_MSG_OUT_OF_MEMORY\t\"Not enough memory\\n\"\n+#define CMD_MSG_NOT_ENOUGH_ARGS\t\"Not enough arguments for command \\\"%s\\\"\\n\"\n+#define CMD_MSG_TOO_MANY_ARGS\t\"Too many arguments for command \\\"%s\\\"\\n\"\n+#define CMD_MSG_MISMATCH_ARGS\t\"Incorrect set of arguments for command \\\"%s\\\"\\n\"\n+#define CMD_MSG_INVALID_ARG\t\"Invalid value for argument \\\"%s\\\"\\n\"\n+#define CMD_MSG_ARG_NOT_FOUND\t\"Syntax error: \\\"%s\\\" not found\\n\"\n+#define CMD_MSG_FILE_ERR\t\"Error in file \\\"%s\\\" at line %u\\n\"\n+#define CMD_MSG_FAIL\t\t\"Command \\\"%s\\\" failed\\n\"\n+\n #endif\ndiff --git a/examples/ip_pipeline/thread_fe.c b/examples/ip_pipeline/thread_fe.c\nindex 4a435f7..d1b72b4 100644\n--- a/examples/ip_pipeline/thread_fe.c\n+++ b/examples/ip_pipeline/thread_fe.c\n@@ -5,10 +5,6 @@\n #include <cmdline_parse.h>\n #include <cmdline_parse_num.h>\n #include <cmdline_parse_string.h>\n-#include <cmdline_parse_ipaddr.h>\n-#include <cmdline_parse_etheraddr.h>\n-#include <cmdline_socket.h>\n-#include <cmdline.h>\n \n #include \"thread.h\"\n #include \"thread_fe.h\"\n@@ -259,26 +255,26 @@ cmd_pipeline_enable_parsed(\n \t\tprintf(\"Command failed\\n\");\n }\n \n-cmdline_parse_token_string_t cmd_pipeline_enable_t_string =\n+static cmdline_parse_token_string_t cmd_pipeline_enable_t_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_pipeline_enable_result, t_string, \"t\");\n \n-cmdline_parse_token_string_t cmd_pipeline_enable_t_id_string =\n+static cmdline_parse_token_string_t cmd_pipeline_enable_t_id_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_pipeline_enable_result, t_id_string,\n \t\tNULL);\n \n-cmdline_parse_token_string_t cmd_pipeline_enable_pipeline_string =\n+static cmdline_parse_token_string_t cmd_pipeline_enable_pipeline_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_pipeline_enable_result, pipeline_string,\n \t\t\"pipeline\");\n \n-cmdline_parse_token_num_t cmd_pipeline_enable_pipeline_id =\n+static cmdline_parse_token_num_t cmd_pipeline_enable_pipeline_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_pipeline_enable_result, pipeline_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_pipeline_enable_enable_string =\n+static cmdline_parse_token_string_t cmd_pipeline_enable_enable_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_pipeline_enable_result, enable_string,\n \t\t\"enable\");\n \n-cmdline_parse_inst_t cmd_pipeline_enable = {\n+static cmdline_parse_inst_t cmd_pipeline_enable = {\n \t.f = cmd_pipeline_enable_parsed,\n \t.data = NULL,\n \t.help_str = \"Enable pipeline on specified core\",\n@@ -333,26 +329,26 @@ cmd_pipeline_disable_parsed(\n \t\tprintf(\"Command failed\\n\");\n }\n \n-cmdline_parse_token_string_t cmd_pipeline_disable_t_string =\n+static cmdline_parse_token_string_t cmd_pipeline_disable_t_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_pipeline_disable_result, t_string, \"t\");\n \n-cmdline_parse_token_string_t cmd_pipeline_disable_t_id_string =\n+static cmdline_parse_token_string_t cmd_pipeline_disable_t_id_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_pipeline_disable_result, t_id_string,\n \t\tNULL);\n \n-cmdline_parse_token_string_t cmd_pipeline_disable_pipeline_string =\n+static cmdline_parse_token_string_t cmd_pipeline_disable_pipeline_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_pipeline_disable_result,\n \t\tpipeline_string, \"pipeline\");\n \n-cmdline_parse_token_num_t cmd_pipeline_disable_pipeline_id =\n+static cmdline_parse_token_num_t cmd_pipeline_disable_pipeline_id =\n \tTOKEN_NUM_INITIALIZER(struct cmd_pipeline_disable_result, pipeline_id,\n \t\tUINT32);\n \n-cmdline_parse_token_string_t cmd_pipeline_disable_disable_string =\n+static cmdline_parse_token_string_t cmd_pipeline_disable_disable_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_pipeline_disable_result, disable_string,\n \t\t\"disable\");\n \n-cmdline_parse_inst_t cmd_pipeline_disable = {\n+static cmdline_parse_inst_t cmd_pipeline_disable = {\n \t.f = cmd_pipeline_disable_parsed,\n \t.data = NULL,\n \t.help_str = \"Disable pipeline on specified core\",\n@@ -405,19 +401,19 @@ cmd_thread_headroom_parsed(\n \t\tprintf(\"Command failed\\n\");\n }\n \n-cmdline_parse_token_string_t cmd_thread_headroom_t_string =\n+static cmdline_parse_token_string_t cmd_thread_headroom_t_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result,\n \tt_string, \"t\");\n \n-cmdline_parse_token_string_t cmd_thread_headroom_t_id_string =\n+static cmdline_parse_token_string_t cmd_thread_headroom_t_id_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result,\n \tt_id_string, NULL);\n \n-cmdline_parse_token_string_t cmd_thread_headroom_headroom_string =\n+static cmdline_parse_token_string_t cmd_thread_headroom_headroom_string =\n \tTOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result,\n \t\theadroom_string, \"headroom\");\n \n-cmdline_parse_inst_t cmd_thread_headroom = {\n+static cmdline_parse_inst_t cmd_thread_headroom = {\n \t.f = cmd_thread_headroom_parsed,\n \t.data = NULL,\n \t.help_str = \"Display thread headroom\",\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "2/7"
    ]
}