From patchwork Fri Jul 20 15:46:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 43238 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C95429D2; Fri, 20 Jul 2018 17:46:37 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 0688B1E34 for ; Fri, 20 Jul 2018 17:46:33 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jul 2018 08:46:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,380,1526367600"; d="scan'208";a="241931314" Received: from silpixa00397517.ir.intel.com (HELO silpixa00397517.ger.corp.intel.com) ([10.237.222.54]) by orsmga005.jf.intel.com with ESMTP; 20 Jul 2018 08:46:24 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, Kevin Laatz Date: Fri, 20 Jul 2018 16:46:08 +0100 Message-Id: <20180720154608.86740-1-kevin.laatz@intel.com> X-Mailer: git-send-email 2.9.5 Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: add help command to cli X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add a help to the existing application cli. This will enable users to display the usage help with descriptions within the cli. Signed-off-by: Kevin Laatz Acked-by: Cristian Dumitrescu --- examples/ip_pipeline/cli.c | 772 ++++++++++++++++++++++++++++++++------------- 1 file changed, 555 insertions(+), 217 deletions(-) diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index c9587f5..98d01bd 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -48,13 +48,13 @@ is_comment(char *in) return 0; } -/** - * mempool - * buffer - * pool - * cache - * cpu - */ +static const char cmd_mempool_help[] = +"mempool \n" +" buffer \n" +" pool \n" +" cache \n" +" cpu \n"; + static void cmd_mempool(char **tokens, uint32_t n_tokens, @@ -119,14 +119,14 @@ cmd_mempool(char **tokens, } } -/** - * link - * dev | port - * rxq - * txq - * promiscuous on | off - * [rss ... ] - */ +static const char cmd_link_help[] = +"link \n" +" dev | port \n" +" rxq \n" +" txq \n" +" promiscuous on | off\n" +" [rss ... ]\n"; + static void cmd_link(char **tokens, uint32_t n_tokens, @@ -237,11 +237,11 @@ cmd_link(char **tokens, } } -/** - * swq - * size - * cpu - */ +static const char cmd_swq_help[] = +"swq \n" +" size \n" +" cpu \n"; + static void cmd_swq(char **tokens, uint32_t n_tokens, @@ -286,12 +286,12 @@ cmd_swq(char **tokens, } } -/** - * tmgr subport profile - * - * - * - */ +static const char cmd_tmgr_subport_profile_help[] = +"tmgr subport profile\n" +" \n" +" \n" +" \n"; + static void cmd_tmgr_subport_profile(char **tokens, uint32_t n_tokens, @@ -334,14 +334,14 @@ cmd_tmgr_subport_profile(char **tokens, } } -/** - * tmgr pipe profile - * - * - * - * - * - */ +static const char cmd_tmgr_pipe_profile_help[] = +"tmgr pipe profile\n" +" \n" +" \n" +" \n" +" \n" +" \n"; + static void cmd_tmgr_pipe_profile(char **tokens, uint32_t n_tokens, @@ -397,16 +397,16 @@ cmd_tmgr_pipe_profile(char **tokens, } } -/** - * tmgr - * rate - * spp - * pps - * qsize - * fo - * mtu - * cpu - */ +static const char cmd_tmgr_help[] = +"tmgr \n" +" rate \n" +" spp \n" +" pps \n" +" qsize \n" +" fo \n" +" mtu \n" +" cpu \n"; + static void cmd_tmgr(char **tokens, uint32_t n_tokens, @@ -503,10 +503,10 @@ cmd_tmgr(char **tokens, } } -/** - * tmgr subport - * profile - */ +static const char cmd_tmgr_subport_help[] = +"tmgr subport \n" +" profile \n"; + static void cmd_tmgr_subport(char **tokens, uint32_t n_tokens, @@ -541,11 +541,12 @@ cmd_tmgr_subport(char **tokens, } } -/** - * tmgr subport pipe - * from to - * profile - */ + +static const char cmd_tmgr_subport_pipe_help[] = +"tmgr subport pipe\n" +" from to \n" +" profile \n"; + static void cmd_tmgr_subport_pipe(char **tokens, uint32_t n_tokens, @@ -611,9 +612,10 @@ cmd_tmgr_subport_pipe(char **tokens, } } -/** - * tap - */ + +static const char cmd_tap_help[] = +"tap \n"; + static void cmd_tap(char **tokens, uint32_t n_tokens, @@ -637,12 +639,12 @@ cmd_tap(char **tokens, } } -/** - * kni - * link - * mempool - * [thread ] - */ +static const char cmd_kni_help[] = +"kni \n" +" link \n" +" mempool \n" +" [thread ]\n"; + static void cmd_kni(char **tokens, uint32_t n_tokens, @@ -697,11 +699,12 @@ cmd_kni(char **tokens, } } -/** - * port in action profile - * [filter match | mismatch offset mask key port ] - * [balance offset mask port ... ] - */ + +static const char cmd_port_in_action_profile_help[] = +"port in action profile \n" +" [filter match | mismatch offset mask key port ]\n" +" [balance offset mask port ... ]\n"; + static void cmd_port_in_action_profile(char **tokens, uint32_t n_tokens, @@ -861,24 +864,25 @@ cmd_port_in_action_profile(char **tokens, } } -/** - * table action profile - * ipv4 | ipv6 - * offset - * fwd - * [balance offset mask outoffset ] - * [meter srtcm | trtcm - * tc - * stats none | pkts | bytes | both] - * [tm spp pps ] - * [encap ether | vlan | qinq | mpls | pppoe] - * [nat src | dst - * proto udp | tcp] - * [ttl drop | fwd - * stats none | pkts] - * [stats pkts | bytes | both] - * [time] - */ + +static const char cmd_table_action_profile_help[] = +"table action profile \n" +" ipv4 | ipv6\n" +" offset \n" +" fwd\n" +" [balance offset mask outoffset ]\n" +" [meter srtcm | trtcm\n" +" tc \n" +" stats none | pkts | bytes | both]\n" +" [tm spp pps ]\n" +" [encap ether | vlan | qinq | mpls | pppoe]\n" +" [nat src | dst\n" +" proto udp | tcp]\n" +" [ttl drop | fwd\n" +" stats none | pkts]\n" +" [stats pkts | bytes | both]\n" +" [time]\n"; + static void cmd_table_action_profile(char **tokens, uint32_t n_tokens, @@ -1207,12 +1211,12 @@ cmd_table_action_profile(char **tokens, } } -/** - * pipeline - * period - * offset_port_id - * cpu - */ +static const char cmd_pipeline_help[] = +"pipeline \n" +" period \n" +" offset_port_id \n" +" cpu \n"; + static void cmd_pipeline(char **tokens, uint32_t n_tokens, @@ -1267,18 +1271,18 @@ cmd_pipeline(char **tokens, } } -/** - * pipeline port in - * bsz - * link rxq - * | swq - * | tmgr - * | tap mempool mtu - * | kni - * | source mempool file bpp - * [action ] - * [disabled] - */ +static const char cmd_pipeline_port_in_help[] = +"pipeline port in\n" +" bsz \n" +" link rxq \n" +" | swq \n" +" | tmgr \n" +" | tap mempool mtu \n" +" | kni \n" +" | source mempool file bpp \n" +" [action ]\n" +" [disabled]\n"; + static void cmd_pipeline_port_in(char **tokens, uint32_t n_tokens, @@ -1486,16 +1490,16 @@ cmd_pipeline_port_in(char **tokens, } } -/** - * pipeline port out - * bsz - * link txq - * | swq - * | tmgr - * | tap - * | kni - * | sink [file pkts ] - */ +static const char cmd_pipeline_port_out_help[] = +"pipeline port out\n" +" bsz \n" +" link txq \n" +" | swq \n" +" | tmgr \n" +" | tap \n" +" | kni \n" +" | sink [file pkts ]\n"; + static void cmd_pipeline_port_out(char **tokens, uint32_t n_tokens, @@ -1640,30 +1644,30 @@ cmd_pipeline_port_out(char **tokens, } } -/** - * pipeline table - * match - * acl - * ipv4 | ipv6 - * offset - * size - * | array - * offset - * size - * | hash - * ext | lru - * key - * mask - * offset - * buckets - * size - * | lpm - * ipv4 | ipv6 - * offset - * size - * | stub - * [action ] - */ +static const char cmd_pipeline_table_help[] = +"pipeline table\n" +" match\n" +" acl\n" +" ipv4 | ipv6\n" +" offset \n" +" size \n" +" | array\n" +" offset \n" +" size \n" +" | hash\n" +" ext | lru\n" +" key \n" +" mask \n" +" offset \n" +" buckets \n" +" size \n" +" | lpm\n" +" ipv4 | ipv6\n" +" offset \n" +" size \n" +" | stub\n" +" [action ]\n"; + static void cmd_pipeline_table(char **tokens, uint32_t n_tokens, @@ -1925,9 +1929,9 @@ cmd_pipeline_table(char **tokens, } } -/** - * pipeline port in table - */ +static const char cmd_pipeline_port_in_table_help[] = +"pipeline port in table \n"; + static void cmd_pipeline_port_in_table(char **tokens, uint32_t n_tokens, @@ -1979,9 +1983,9 @@ cmd_pipeline_port_in_table(char **tokens, } } -/** - * pipeline port in stats read [clear] - */ + +static const char cmd_pipeline_port_in_stats_help[] = +"pipeline port in stats read [clear]\n"; #define MSG_PIPELINE_PORT_IN_STATS \ "Pkts in: %" PRIu64 "\n" \ @@ -2056,9 +2060,10 @@ cmd_pipeline_port_in_stats(char **tokens, stats.stats.n_pkts_drop); } -/** - * pipeline port in enable - */ + +static const char cmd_pipeline_port_in_enable_help[] = +"pipeline port in enable\n"; + static void cmd_pipeline_port_in_enable(char **tokens, uint32_t n_tokens, @@ -2103,9 +2108,10 @@ cmd_pipeline_port_in_enable(char **tokens, } } -/** - * pipeline port in disable - */ + +static const char cmd_pipeline_port_in_disable_help[] = +"pipeline port in disable\n"; + static void cmd_pipeline_port_in_disable(char **tokens, uint32_t n_tokens, @@ -2150,9 +2156,10 @@ cmd_pipeline_port_in_disable(char **tokens, } } -/** - * pipeline port out stats read [clear] - */ + +static const char cmd_pipeline_port_out_stats_help[] = +"pipeline port out stats read [clear]\n"; + #define MSG_PIPELINE_PORT_OUT_STATS \ "Pkts in: %" PRIu64 "\n" \ "Pkts dropped by AH: %" PRIu64 "\n" \ @@ -2226,9 +2233,10 @@ cmd_pipeline_port_out_stats(char **tokens, stats.stats.n_pkts_drop); } -/** - * pipeline table stats read [clear] - */ + +static const char cmd_pipeline_table_stats_help[] = +"pipeline table stats read [clear]\n"; + #define MSG_PIPELINE_TABLE_STATS \ "Pkts in: %" PRIu64 "\n" \ "Pkts in with lookup miss: %" PRIu64 "\n" \ @@ -3406,11 +3414,12 @@ parse_table_action(char **tokens, return n_tokens0 - n_tokens; } -/** - * pipeline table rule add - * match - * action - */ + +static const char cmd_pipeline_table_rule_add_help[] = +"pipeline table rule add\n" +" match \n" +" action \n"; + static void cmd_pipeline_table_rule_add(char **tokens, uint32_t n_tokens, @@ -3486,17 +3495,18 @@ cmd_pipeline_table_rule_add(char **tokens, } } -/** - * pipeline table rule add - * match - * default - * action - * fwd - * drop - * | port - * | meta - * | table - */ + +static const char cmd_pipeline_table_rule_add_default_help[] = +"pipeline table rule add\n" +" match\n" +" default\n" +" action\n" +" fwd\n" +" drop\n" +" | port \n" +" | meta\n" +" | table \n"; + static void cmd_pipeline_table_rule_add_default(char **tokens, uint32_t n_tokens, @@ -3618,12 +3628,13 @@ cmd_pipeline_table_rule_add_default(char **tokens, } } -/** - * pipeline table rule add bulk - * - * File : - * - line format: match action - */ + +static const char cmd_pipeline_table_rule_add_bulk_help[] = +"pipeline table rule add bulk \n" +"\n" +" File :\n" +" - line format: match action \n"; + static int cli_rule_file_process(const char *file_name, size_t line_len_max, @@ -3745,10 +3756,11 @@ cmd_pipeline_table_rule_add_bulk(char **tokens, free(match); } -/** - * pipeline table rule delete - * match - */ + +static const char cmd_pipeline_table_rule_delete_help[] = +"pipeline table rule delete\n" +" match \n"; + static void cmd_pipeline_table_rule_delete(char **tokens, uint32_t n_tokens, @@ -3813,11 +3825,12 @@ cmd_pipeline_table_rule_delete(char **tokens, } } -/** - * pipeline table rule delete - * match - * default - */ + +static const char cmd_pipeline_table_rule_delete_default_help[] = +"pipeline table rule delete\n" +" match\n" +" default\n"; + static void cmd_pipeline_table_rule_delete_default(char **tokens, uint32_t n_tokens, @@ -3873,9 +3886,10 @@ cmd_pipeline_table_rule_delete_default(char **tokens, } } -/** - * pipeline table rule read stats [clear] - */ + +static const char cmd_pipeline_table_rule_stats_read_help[] = +"pipeline table rule read stats [clear]\n"; + static void cmd_pipeline_table_rule_stats_read(char **tokens, uint32_t n_tokens __rte_unused, @@ -3885,11 +3899,12 @@ cmd_pipeline_table_rule_stats_read(char **tokens, snprintf(out, out_size, MSG_CMD_UNIMPLEM, tokens[0]); } -/** - * pipeline table meter profile - * add srtcm cir cbs ebs - * | trtcm cir pir cbs pbs - */ + +static const char cmd_pipeline_table_meter_profile_add_help[] = +"pipeline table meter profile \n" +" add srtcm cir cbs ebs \n" +" | trtcm cir pir cbs pbs \n"; + static void cmd_pipeline_table_meter_profile_add(char **tokens, uint32_t n_tokens, @@ -4037,10 +4052,11 @@ cmd_pipeline_table_meter_profile_add(char **tokens, } } -/** - * pipeline table - * meter profile delete - */ + +static const char cmd_pipeline_table_meter_profile_delete_help[] = +"pipeline table \n" +" meter profile delete\n"; + static void cmd_pipeline_table_meter_profile_delete(char **tokens, uint32_t n_tokens, @@ -4097,9 +4113,10 @@ cmd_pipeline_table_meter_profile_delete(char **tokens, } } -/** - * pipeline table rule read meter [clear] - */ + +static const char cmd_pipeline_table_rule_meter_read_help[] = +"pipeline table rule read meter [clear]\n"; + static void cmd_pipeline_table_rule_meter_read(char **tokens, uint32_t n_tokens __rte_unused, @@ -4109,13 +4126,14 @@ cmd_pipeline_table_rule_meter_read(char **tokens, snprintf(out, out_size, MSG_CMD_UNIMPLEM, tokens[0]); } -/** - * pipeline table dscp - * - * File : - * - exactly 64 lines - * - line format: , with as: g | y | r - */ + +static const char cmd_pipeline_table_dscp_help[] = +"pipeline table dscp \n" +"\n" +" File :\n" +" - exactly 64 lines\n" +" - line format: , with as: g | y | r\n"; + static int load_dscp_table(struct rte_table_action_dscp_table *dscp_table, const char *file_name, @@ -4258,9 +4276,10 @@ cmd_pipeline_table_dscp(char **tokens, } } -/** - * pipeline table rule read ttl [clear] - */ + +static const char cmd_pipeline_table_rule_ttl_read_help[] = +"pipeline table rule read ttl [clear]\n"; + static void cmd_pipeline_table_rule_ttl_read(char **tokens, uint32_t n_tokens __rte_unused, @@ -4270,9 +4289,10 @@ cmd_pipeline_table_rule_ttl_read(char **tokens, snprintf(out, out_size, MSG_CMD_UNIMPLEM, tokens[0]); } -/** - * thread pipeline enable - */ + +static const char cmd_thread_pipeline_enable_help[] = +"thread pipeline enable\n"; + static void cmd_thread_pipeline_enable(char **tokens, uint32_t n_tokens, @@ -4312,9 +4332,10 @@ cmd_thread_pipeline_enable(char **tokens, } } -/** - * thread pipeline disable - */ + +static const char cmd_thread_pipeline_disable_help[] = +"thread pipeline disable\n"; + static void cmd_thread_pipeline_disable(char **tokens, uint32_t n_tokens, @@ -4355,6 +4376,318 @@ cmd_thread_pipeline_disable(char **tokens, } } +static void +cmd_help(char **tokens, uint32_t n_tokens, char *out, size_t out_size) +{ + tokens++; + n_tokens--; + + if (n_tokens == 0) { + snprintf(out, out_size, + "Type 'help ' for details on each command.\n\n" + "List of commands:\n" + "\tmempool\n" + "\tlink\n" + "\tswq\n" + "\ttmgr subport profile\n" + "\ttmgr pipe profile\n" + "\ttmgr\n" + "\ttmgr subport\n" + "\ttmgr subport pipe\n" + "\ttap\n" + "\tkni\n" + "\tport in action profile\n" + "\ttable action profile\n" + "\tpipeline\n" + "\tpipeline port in\n" + "\tpipeline port out\n" + "\tpipeline table\n" + "\tpipeline port in table\n" + "\tpipeline port in stats\n" + "\tpipeline port in enable\n" + "\tpipeline port in disable\n" + "\tpipeline port out stats\n" + "\tpipeline table stats\n" + "\tpipeline table rule add\n" + "\tpipeline table rule add default\n" + "\tpipeline table rule add bulk\n" + "\tpipeline table rule delete\n" + "\tpipeline table rule delete default\n" + "\tpipeline table rule stats read\n" + "\tpipeline table meter profile add\n" + "\tpipeline table meter profile delete\n" + "\tpipeline table rule meter read\n" + "\tpipeline table dscp\n" + "\tpipeline table rule ttl read\n" + "\tthread pipeline enable\n" + "\tthread pipeline disable\n\n"); + return; + } + + if (strcmp(tokens[0], "mempool") == 0) { + snprintf(out, out_size, "\n%s\n", cmd_mempool_help); + return; + } + + if (strcmp(tokens[0], "link") == 0) { + snprintf(out, out_size, "\n%s\n", cmd_link_help); + return; + } + + if (strcmp(tokens[0], "swq") == 0) { + snprintf(out, out_size, "\n%s\n", cmd_swq_help); + return; + } + + if (strcmp(tokens[0], "tmgr") == 0) { + if (n_tokens == 1) { + snprintf(out, out_size, "\n%s\n", cmd_tmgr_help); + return; + } + + if ((n_tokens == 2) && + (strcmp(tokens[1], "subport")) == 0) { + snprintf(out, out_size, "\n%s\n", cmd_tmgr_subport_help); + return; + } + + if ((n_tokens == 3) && + (strcmp(tokens[1], "subport") == 0) && + (strcmp(tokens[2], "profile") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_tmgr_subport_profile_help); + return; + } + + if ((n_tokens == 3) && + (strcmp(tokens[1], "subport") == 0) && + (strcmp(tokens[2], "pipe") == 0)) { + snprintf(out, out_size, "\n%s\n", cmd_tmgr_subport_pipe_help); + return; + } + + if ((n_tokens == 3) && + (strcmp(tokens[1], "pipe") == 0) && + (strcmp(tokens[2], "profile") == 0)) { + snprintf(out, out_size, "\n%s\n", cmd_tmgr_pipe_profile_help); + return; + } + } + + if (strcmp(tokens[0], "tap") == 0) { + snprintf(out, out_size, "\n%s\n", cmd_tap_help); + return; + } + + if (strcmp(tokens[0], "kni") == 0) { + snprintf(out, out_size, "\n%s\n", cmd_kni_help); + return; + } + + if ((n_tokens == 4) && + (strcmp(tokens[0], "port") == 0) && + (strcmp(tokens[1], "in") == 0) && + (strcmp(tokens[2], "action") == 0) && + (strcmp(tokens[3], "profile") == 0)) { + snprintf(out, out_size, "\n%s\n", cmd_port_in_action_profile_help); + return; + } + + if ((n_tokens == 3) && + (strcmp(tokens[0], "table") == 0) && + (strcmp(tokens[1], "action") == 0) && + (strcmp(tokens[2], "profile") == 0)) { + snprintf(out, out_size, "\n%s\n", cmd_table_action_profile_help); + return; + } + + if ((strcmp(tokens[0], "pipeline") == 0) && (n_tokens == 1)) { + snprintf(out, out_size, "\n%s\n", cmd_pipeline_help); + return; + } + + if ((strcmp(tokens[0], "pipeline") == 0) && + (strcmp(tokens[1], "port") == 0)) { + if ((n_tokens == 3) && (strcmp(tokens[2], "in")) == 0) { + snprintf(out, out_size, "\n%s\n", cmd_pipeline_port_in_help); + return; + } + + if ((n_tokens == 3) && (strcmp(tokens[2], "out")) == 0) { + snprintf(out, out_size, "\n%s\n", cmd_pipeline_port_out_help); + return; + } + + if ((n_tokens == 4) && + (strcmp(tokens[2], "in") == 0) && + (strcmp(tokens[3], "table") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_port_in_table_help); + return; + } + + if ((n_tokens == 4) && + (strcmp(tokens[2], "in") == 0) && + (strcmp(tokens[3], "stats") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_port_in_stats_help); + return; + } + + if ((n_tokens == 4) && + (strcmp(tokens[2], "in") == 0) && + (strcmp(tokens[3], "enable") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_port_in_enable_help); + return; + } + + if ((n_tokens == 4) && + (strcmp(tokens[2], "in") == 0) && + (strcmp(tokens[3], "disable") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_port_in_disable_help); + return; + } + + if ((n_tokens == 4) && + (strcmp(tokens[2], "out") == 0) && + (strcmp(tokens[3], "stats") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_port_out_stats_help); + return; + } + } + + if ((strcmp(tokens[0], "pipeline") == 0) && + (strcmp(tokens[1], "table") == 0)) { + if (n_tokens == 2) { + snprintf(out, out_size, "\n%s\n", cmd_pipeline_table_help); + return; + } + + if ((n_tokens == 3) && strcmp(tokens[2], "stats") == 0) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_stats_help); + return; + } + + if ((n_tokens == 3) && strcmp(tokens[2], "dscp") == 0) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_dscp_help); + return; + } + + if ((n_tokens == 4) && + (strcmp(tokens[2], "rule") == 0) && + (strcmp(tokens[3], "add") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_rule_add_help); + return; + } + + if ((n_tokens == 5) && + (strcmp(tokens[2], "rule") == 0) && + (strcmp(tokens[3], "add") == 0) && + (strcmp(tokens[4], "default") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_rule_add_default_help); + return; + } + + if ((n_tokens == 5) && + (strcmp(tokens[2], "rule") == 0) && + (strcmp(tokens[3], "add") == 0) && + (strcmp(tokens[4], "bulk") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_rule_add_bulk_help); + return; + } + + if ((n_tokens == 4) && + (strcmp(tokens[2], "rule") == 0) && + (strcmp(tokens[3], "delete") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_rule_delete_help); + return; + } + + if ((n_tokens == 5) && + (strcmp(tokens[2], "rule") == 0) && + (strcmp(tokens[3], "delete") == 0) && + (strcmp(tokens[4], "default") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_rule_delete_default_help); + return; + } + + if ((n_tokens == 5) && + (strcmp(tokens[2], "rule") == 0) && + (strcmp(tokens[3], "stats") == 0) && + (strcmp(tokens[4], "read") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_rule_stats_read_help); + return; + } + + if ((n_tokens == 5) && + (strcmp(tokens[2], "meter") == 0) && + (strcmp(tokens[3], "profile") == 0) && + (strcmp(tokens[4], "add") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_meter_profile_add_help); + return; + } + + if ((n_tokens == 5) && + (strcmp(tokens[2], "meter") == 0) && + (strcmp(tokens[3], "profile") == 0) && + (strcmp(tokens[4], "delete") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_meter_profile_delete_help); + return; + } + + if ((n_tokens == 5) && + (strcmp(tokens[2], "rule") == 0) && + (strcmp(tokens[3], "meter") == 0) && + (strcmp(tokens[4], "read") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_rule_meter_read_help); + return; + } + + if ((n_tokens == 5) && + (strcmp(tokens[2], "rule") == 0) && + (strcmp(tokens[3], "ttl") == 0) && + (strcmp(tokens[4], "read") == 0)) { + snprintf(out, out_size, "\n%s\n", + cmd_pipeline_table_rule_ttl_read_help); + return; + } + } + + if ((n_tokens == 3) && + (strcmp(tokens[0], "thread") == 0) && + (strcmp(tokens[1], "pipeline") == 0)) { + if (strcmp(tokens[2], "enable") == 0) { + snprintf(out, out_size, "\n%s\n", + cmd_thread_pipeline_enable_help); + return; + } + + if (strcmp(tokens[2], "disable") == 0) { + snprintf(out, out_size, "\n%s\n", + cmd_thread_pipeline_disable_help); + return; + } + } + + /* Invalid command */ + snprintf(out, out_size, "Invalid command\n"); + return; +} + void cli_process(char *in, char *out, size_t out_size) { @@ -4374,6 +4707,11 @@ cli_process(char *in, char *out, size_t out_size) if (n_tokens == 0) return; + if (strcmp(tokens[0], "help") == 0) { + cmd_help(tokens, n_tokens, out, out_size); + return; + } + if (strcmp(tokens[0], "mempool") == 0) { cmd_mempool(tokens, n_tokens, out, out_size); return;