net/bnx2x: fix to add PHY lock
[dpdk.git] / examples / ip_pipeline / cli.c
index 27388ba..102a1d6 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <rte_common.h>
 #include <rte_cycles.h>
+#include <rte_ethdev.h>
 
 #include "cli.h"
 #include "kni.h"
@@ -48,13 +49,13 @@ is_comment(char *in)
        return 0;
 }
 
-/**
- * mempool <mempool_name>
- *  buffer <buffer_size>
- *  pool <pool_size>
- *  cache <cache_size>
- *  cpu <cpu_id>
- */
+static const char cmd_mempool_help[] =
+"mempool <mempool_name>\n"
+"   buffer <buffer_size>\n"
+"   pool <pool_size>\n"
+"   cache <cache_size>\n"
+"   cpu <cpu_id>\n";
+
 static void
 cmd_mempool(char **tokens,
        uint32_t n_tokens,
@@ -119,14 +120,14 @@ cmd_mempool(char **tokens,
        }
 }
 
-/**
- * link <link_name>
- *  dev <device_name> | port <port_id>
- *  rxq <n_queues> <queue_size> <mempool_name>
- *  txq <n_queues> <queue_size>
- *  promiscuous on | off
- *  [rss <qid_0> ... <qid_n>]
- */
+static const char cmd_link_help[] =
+"link <link_name>\n"
+"   dev <device_name> | port <port_id>\n"
+"   rxq <n_queues> <queue_size> <mempool_name>\n"
+"   txq <n_queues> <queue_size>\n"
+"   promiscuous on | off\n"
+"   [rss <qid_0> ... <qid_n>]\n";
+
 static void
 cmd_link(char **tokens,
        uint32_t n_tokens,
@@ -138,6 +139,8 @@ cmd_link(char **tokens,
        struct link *link;
        char *name;
 
+       memset(&p, 0, sizeof(p));
+
        if ((n_tokens < 13) || (n_tokens > 14 + LINK_RXQ_RSS_MAX)) {
                snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
                return;
@@ -235,11 +238,96 @@ cmd_link(char **tokens,
        }
 }
 
-/**
- * swq <swq_name>
- *  size <size>
- *  cpu <cpu_id>
+/* Print the link stats and info */
+static void
+print_link_info(struct link *link, char *out, size_t out_size)
+{
+       struct rte_eth_stats stats;
+       struct ether_addr mac_addr;
+       struct rte_eth_link eth_link;
+       uint16_t mtu;
+
+       memset(&stats, 0, sizeof(stats));
+       rte_eth_stats_get(link->port_id, &stats);
+
+       rte_eth_macaddr_get(link->port_id, &mac_addr);
+       rte_eth_link_get(link->port_id, &eth_link);
+       rte_eth_dev_get_mtu(link->port_id, &mtu);
+
+       snprintf(out, out_size,
+               "\n"
+               "%s: flags=<%s> mtu %u\n"
+               "\tether %02X:%02X:%02X:%02X:%02X:%02X rxqueues %u txqueues %u\n"
+               "\tport# %u  speed %u Mbps\n"
+               "\tRX packets %" PRIu64"  bytes %" PRIu64"\n"
+               "\tRX errors %" PRIu64"  missed %" PRIu64"  no-mbuf %" PRIu64"\n"
+               "\tTX packets %" PRIu64"  bytes %" PRIu64"\n"
+               "\tTX errors %" PRIu64"\n",
+               link->name,
+               eth_link.link_status == 0 ? "DOWN" : "UP",
+               mtu,
+               mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
+               mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
+               mac_addr.addr_bytes[4], mac_addr.addr_bytes[5],
+               link->n_rxq,
+               link->n_txq,
+               link->port_id,
+               eth_link.link_speed,
+               stats.ipackets,
+               stats.ibytes,
+               stats.ierrors,
+               stats.imissed,
+               stats.rx_nombuf,
+               stats.opackets,
+               stats.obytes,
+               stats.oerrors);
+}
+
+/*
+ * link show [<link_name>]
  */
+static void
+cmd_link_show(char **tokens, uint32_t n_tokens, char *out, size_t out_size)
+{
+       struct link *link;
+       char *link_name;
+
+       if (n_tokens != 2 && n_tokens != 3) {
+               snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+               return;
+       }
+
+       if (n_tokens == 2) {
+               link = link_next(NULL);
+
+               while (link != NULL) {
+                       out_size = out_size - strlen(out);
+                       out = &out[strlen(out)];
+
+                       print_link_info(link, out, out_size);
+                       link = link_next(link);
+               }
+       } else {
+               out_size = out_size - strlen(out);
+               out = &out[strlen(out)];
+
+               link_name = tokens[2];
+               link = link_find(link_name);
+
+               if (link == NULL) {
+                       snprintf(out, out_size, MSG_ARG_INVALID,
+                                       "Link does not exist");
+                       return;
+               }
+               print_link_info(link, out, out_size);
+       }
+}
+
+static const char cmd_swq_help[] =
+"swq <swq_name>\n"
+"   size <size>\n"
+"   cpu <cpu_id>\n";
+
 static void
 cmd_swq(char **tokens,
        uint32_t n_tokens,
@@ -284,12 +372,12 @@ cmd_swq(char **tokens,
        }
 }
 
-/**
- * tmgr subport profile
- *  <tb_rate> <tb_size>
- *  <tc0_rate> <tc1_rate> <tc2_rate> <tc3_rate>
- *  <tc_period>
- */
+static const char cmd_tmgr_subport_profile_help[] =
+"tmgr subport profile\n"
+"   <tb_rate> <tb_size>\n"
+"   <tc0_rate> <tc1_rate> <tc2_rate> <tc3_rate>\n"
+"   <tc_period>\n";
+
 static void
 cmd_tmgr_subport_profile(char **tokens,
        uint32_t n_tokens,
@@ -332,14 +420,14 @@ cmd_tmgr_subport_profile(char **tokens,
        }
 }
 
-/**
- * tmgr pipe profile
- *  <tb_rate> <tb_size>
- *  <tc0_rate> <tc1_rate> <tc2_rate> <tc3_rate>
- *  <tc_period>
- *  <tc_ov_weight>
- *  <wrr_weight0..15>
- */
+static const char cmd_tmgr_pipe_profile_help[] =
+"tmgr pipe profile\n"
+"   <tb_rate> <tb_size>\n"
+"   <tc0_rate> <tc1_rate> <tc2_rate> <tc3_rate>\n"
+"   <tc_period>\n"
+"   <tc_ov_weight>\n"
+"   <wrr_weight0..15>\n";
+
 static void
 cmd_tmgr_pipe_profile(char **tokens,
        uint32_t n_tokens,
@@ -395,16 +483,16 @@ cmd_tmgr_pipe_profile(char **tokens,
        }
 }
 
-/**
- * tmgr <tmgr_name>
- *  rate <rate>
- *  spp <n_subports_per_port>
- *  pps <n_pipes_per_subport>
- *  qsize <qsize_tc0> <qsize_tc1> <qsize_tc2> <qsize_tc3>
- *  fo <frame_overhead>
- *  mtu <mtu>
- *  cpu <cpu_id>
- */
+static const char cmd_tmgr_help[] =
+"tmgr <tmgr_name>\n"
+"   rate <rate>\n"
+"   spp <n_subports_per_port>\n"
+"   pps <n_pipes_per_subport>\n"
+"   qsize <qsize_tc0> <qsize_tc1> <qsize_tc2> <qsize_tc3>\n"
+"   fo <frame_overhead>\n"
+"   mtu <mtu>\n"
+"   cpu <cpu_id>\n";
+
 static void
 cmd_tmgr(char **tokens,
        uint32_t n_tokens,
@@ -501,10 +589,10 @@ cmd_tmgr(char **tokens,
        }
 }
 
-/**
- * tmgr <tmgr_name> subport <subport_id>
- *  profile <subport_profile_id>
- */
+static const char cmd_tmgr_subport_help[] =
+"tmgr <tmgr_name> subport <subport_id>\n"
+"   profile <subport_profile_id>\n";
+
 static void
 cmd_tmgr_subport(char **tokens,
        uint32_t n_tokens,
@@ -539,11 +627,12 @@ cmd_tmgr_subport(char **tokens,
        }
 }
 
-/**
- * tmgr <tmgr_name> subport <subport_id> pipe
- *  from <pipe_id_first> to <pipe_id_last>
- *  profile <pipe_profile_id>
- */
+
+static const char cmd_tmgr_subport_pipe_help[] =
+"tmgr <tmgr_name> subport <subport_id> pipe\n"
+"   from <pipe_id_first> to <pipe_id_last>\n"
+"   profile <pipe_profile_id>\n";
+
 static void
 cmd_tmgr_subport_pipe(char **tokens,
        uint32_t n_tokens,
@@ -609,9 +698,10 @@ cmd_tmgr_subport_pipe(char **tokens,
        }
 }
 
-/**
- * tap <tap_name>
- */
+
+static const char cmd_tap_help[] =
+"tap <tap_name>\n";
+
 static void
 cmd_tap(char **tokens,
        uint32_t n_tokens,
@@ -635,12 +725,12 @@ cmd_tap(char **tokens,
        }
 }
 
-/**
- * kni <kni_name>
- *  link <link_name>
- *  mempool <mempool_name>
- *  [thread <thread_id>]
- */
+static const char cmd_kni_help[] =
+"kni <kni_name>\n"
+"   link <link_name>\n"
+"   mempool <mempool_name>\n"
+"   [thread <thread_id>]\n";
+
 static void
 cmd_kni(char **tokens,
        uint32_t n_tokens,
@@ -651,6 +741,7 @@ cmd_kni(char **tokens,
        char *name;
        struct kni *kni;
 
+       memset(&p, 0, sizeof(p));
        if ((n_tokens != 6) && (n_tokens != 8)) {
                snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
                return;
@@ -694,11 +785,12 @@ cmd_kni(char **tokens,
        }
 }
 
-/**
- * port in action profile <profile_name>
- *  [filter match | mismatch offset <key_offset> mask <key_mask> key <key_value> port <port_id>]
- *  [balance offset <key_offset> mask <key_mask> port <port_id0> ... <port_id15>]
- */
+
+static const char cmd_port_in_action_profile_help[] =
+"port in action profile <profile_name>\n"
+"   [filter match | mismatch offset <key_offset> mask <key_mask> key <key_value> port <port_id>]\n"
+"   [balance offset <key_offset> mask <key_mask> port <port_id0> ... <port_id15>]\n";
+
 static void
 cmd_port_in_action_profile(char **tokens,
        uint32_t n_tokens,
@@ -805,7 +897,8 @@ cmd_port_in_action_profile(char **tokens,
                uint32_t i;
 
                if (n_tokens < t0 + 22) {
-                       snprintf(out, out_size, MSG_ARG_MISMATCH, "port in action profile balance");
+                       snprintf(out, out_size, MSG_ARG_MISMATCH,
+                               "port in action profile balance");
                        return;
                }
 
@@ -857,23 +950,25 @@ cmd_port_in_action_profile(char **tokens,
        }
 }
 
-/**
- * table action profile <profile_name>
- *  ipv4 | ipv6
- *  offset <ip_offset>
- *  fwd
- *  [meter srtcm | trtcm
- *      tc <n_tc>
- *      stats none | pkts | bytes | both]
- *  [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]
- *  [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 <profile_name>\n"
+"   ipv4 | ipv6\n"
+"   offset <ip_offset>\n"
+"   fwd\n"
+"   [balance offset <key_offset> mask <key_mask> outoffset <out_offset>]\n"
+"   [meter srtcm | trtcm\n"
+"       tc <n_tc>\n"
+"       stats none | pkts | bytes | both]\n"
+"   [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]\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,
@@ -931,6 +1026,47 @@ cmd_table_action_profile(char **tokens,
        p.action_mask |= 1LLU << RTE_TABLE_ACTION_FWD;
 
        t0 = 8;
+       if ((t0 < n_tokens) && (strcmp(tokens[t0], "balance") == 0)) {
+               if (n_tokens < t0 + 7) {
+                       snprintf(out, out_size, MSG_ARG_MISMATCH, "table action profile balance");
+                       return;
+               }
+
+               if (strcmp(tokens[t0 + 1], "offset") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "offset");
+                       return;
+               }
+
+               if (parser_read_uint32(&p.lb.key_offset, tokens[t0 + 2]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "key_offset");
+                       return;
+               }
+
+               if (strcmp(tokens[t0 + 3], "mask") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "mask");
+                       return;
+               }
+
+               p.lb.key_size = RTE_PORT_IN_ACTION_LB_KEY_SIZE_MAX;
+               if (parse_hex_string(tokens[t0 + 4], p.lb.key_mask, &p.lb.key_size) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "key_mask");
+                       return;
+               }
+
+               if (strcmp(tokens[t0 + 5], "outoffset") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "outoffset");
+                       return;
+               }
+
+               if (parser_read_uint32(&p.lb.out_offset, tokens[t0 + 6]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "out_offset");
+                       return;
+               }
+
+               p.action_mask |= 1LLU << RTE_TABLE_ACTION_LB;
+               t0 += 7;
+       } /* balance */
+
        if ((t0 < n_tokens) && (strcmp(tokens[t0], "meter") == 0)) {
                if (n_tokens < t0 + 6) {
                        snprintf(out, out_size, MSG_ARG_MISMATCH,
@@ -1161,12 +1297,12 @@ cmd_table_action_profile(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name>
- *  period <timer_period_ms>
- *  offset_port_id <offset_port_id>
- *  cpu <cpu_id>
- */
+static const char cmd_pipeline_help[] =
+"pipeline <pipeline_name>\n"
+"   period <timer_period_ms>\n"
+"   offset_port_id <offset_port_id>\n"
+"   cpu <cpu_id>\n";
+
 static void
 cmd_pipeline(char **tokens,
        uint32_t n_tokens,
@@ -1221,18 +1357,18 @@ cmd_pipeline(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> port in
- *  bsz <burst_size>
- *  link <link_name> rxq <queue_id>
- *  | swq <swq_name>
- *  | tmgr <tmgr_name>
- *  | tap <tap_name> mempool <mempool_name> mtu <mtu>
- *  | kni <kni_name>
- *  | source mempool <mempool_name> file <file_name> bpp <n_bytes_per_pkt>
- *  [action <port_in_action_profile_name>]
- *  [disabled]
- */
+static const char cmd_pipeline_port_in_help[] =
+"pipeline <pipeline_name> port in\n"
+"   bsz <burst_size>\n"
+"   link <link_name> rxq <queue_id>\n"
+"   | swq <swq_name>\n"
+"   | tmgr <tmgr_name>\n"
+"   | tap <tap_name> mempool <mempool_name> mtu <mtu>\n"
+"   | kni <kni_name>\n"
+"   | source mempool <mempool_name> file <file_name> bpp <n_bytes_per_pkt>\n"
+"   [action <port_in_action_profile_name>]\n"
+"   [disabled]\n";
+
 static void
 cmd_pipeline_port_in(char **tokens,
        uint32_t n_tokens,
@@ -1440,16 +1576,16 @@ cmd_pipeline_port_in(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> port out
- *  bsz <burst_size>
- *  link <link_name> txq <txq_id>
- *  | swq <swq_name>
- *  | tmgr <tmgr_name>
- *  | tap <tap_name>
- *  | kni <kni_name>
- *  | sink [file <file_name> pkts <max_n_pkts>]
- */
+static const char cmd_pipeline_port_out_help[] =
+"pipeline <pipeline_name> port out\n"
+"   bsz <burst_size>\n"
+"   link <link_name> txq <txq_id>\n"
+"   | swq <swq_name>\n"
+"   | tmgr <tmgr_name>\n"
+"   | tap <tap_name>\n"
+"   | kni <kni_name>\n"
+"   | sink [file <file_name> pkts <max_n_pkts>]\n";
+
 static void
 cmd_pipeline_port_out(char **tokens,
        uint32_t n_tokens,
@@ -1594,30 +1730,30 @@ cmd_pipeline_port_out(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> table
- *      match
- *      acl
- *          ipv4 | ipv6
- *          offset <ip_header_offset>
- *          size <n_rules>
- *      | array
- *          offset <key_offset>
- *          size <n_keys>
- *      | hash
- *          ext | lru
- *          key <key_size>
- *          mask <key_mask>
- *          offset <key_offset>
- *          buckets <n_buckets>
- *          size <n_keys>
- *      | lpm
- *          ipv4 | ipv6
- *          offset <ip_header_offset>
- *          size <n_rules>
- *      | stub
- *  [action <table_action_profile_name>]
- */
+static const char cmd_pipeline_table_help[] =
+"pipeline <pipeline_name> table\n"
+"       match\n"
+"       acl\n"
+"           ipv4 | ipv6\n"
+"           offset <ip_header_offset>\n"
+"           size <n_rules>\n"
+"       | array\n"
+"           offset <key_offset>\n"
+"           size <n_keys>\n"
+"       | hash\n"
+"           ext | lru\n"
+"           key <key_size>\n"
+"           mask <key_mask>\n"
+"           offset <key_offset>\n"
+"           buckets <n_buckets>\n"
+"           size <n_keys>\n"
+"       | lpm\n"
+"           ipv4 | ipv6\n"
+"           offset <ip_header_offset>\n"
+"           size <n_rules>\n"
+"       | stub\n"
+"   [action <table_action_profile_name>]\n";
+
 static void
 cmd_pipeline_table(char **tokens,
        uint32_t n_tokens,
@@ -1847,12 +1983,6 @@ cmd_pipeline_table(char **tokens,
 
                t0 += 6;
        } else if (strcmp(tokens[t0], "stub") == 0) {
-               if (n_tokens < t0 + 1) {
-                       snprintf(out, out_size, MSG_ARG_MISMATCH,
-                               "pipeline table stub");
-                       return;
-               }
-
                p.match_type = TABLE_STUB;
 
                t0 += 1;
@@ -1885,9 +2015,9 @@ cmd_pipeline_table(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> port in <port_id> table <table_id>
- */
+static const char cmd_pipeline_port_in_table_help[] =
+"pipeline <pipeline_name> port in <port_id> table <table_id>\n";
+
 static void
 cmd_pipeline_port_in_table(char **tokens,
        uint32_t n_tokens,
@@ -1939,9 +2069,9 @@ cmd_pipeline_port_in_table(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> port in <port_id> stats read [clear]
- */
+
+static const char cmd_pipeline_port_in_stats_help[] =
+"pipeline <pipeline_name> port in <port_id> stats read [clear]\n";
 
 #define MSG_PIPELINE_PORT_IN_STATS                         \
        "Pkts in: %" PRIu64 "\n"                           \
@@ -2016,9 +2146,10 @@ cmd_pipeline_port_in_stats(char **tokens,
                stats.stats.n_pkts_drop);
 }
 
-/**
- * pipeline <pipeline_name> port in <port_id> enable
- */
+
+static const char cmd_pipeline_port_in_enable_help[] =
+"pipeline <pipeline_name> port in <port_id> enable\n";
+
 static void
 cmd_pipeline_port_in_enable(char **tokens,
        uint32_t n_tokens,
@@ -2063,9 +2194,10 @@ cmd_pipeline_port_in_enable(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> port in <port_id> disable
- */
+
+static const char cmd_pipeline_port_in_disable_help[] =
+"pipeline <pipeline_name> port in <port_id> disable\n";
+
 static void
 cmd_pipeline_port_in_disable(char **tokens,
        uint32_t n_tokens,
@@ -2110,9 +2242,10 @@ cmd_pipeline_port_in_disable(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> port out <port_id> stats read [clear]
- */
+
+static const char cmd_pipeline_port_out_stats_help[] =
+"pipeline <pipeline_name> port out <port_id> stats read [clear]\n";
+
 #define MSG_PIPELINE_PORT_OUT_STATS                        \
        "Pkts in: %" PRIu64 "\n"                           \
        "Pkts dropped by AH: %" PRIu64 "\n"                \
@@ -2186,9 +2319,10 @@ cmd_pipeline_port_out_stats(char **tokens,
                stats.stats.n_pkts_drop);
 }
 
-/**
- * pipeline <pipeline_name> table <table_id> stats read [clear]
- */
+
+static const char cmd_pipeline_table_stats_help[] =
+"pipeline <pipeline_name> table <table_id> stats read [clear]\n";
+
 #define MSG_PIPELINE_TABLE_STATS                                     \
        "Pkts in: %" PRIu64 "\n"                                     \
        "Pkts in with lookup miss: %" PRIu64 "\n"                    \
@@ -2271,8 +2405,7 @@ cmd_pipeline_table_stats(char **tokens,
  *       priority <priority>
  *       ipv4 | ipv6 <sa> <sa_depth> <da> <da_depth>
  *       <sp0> <sp1> <dp0> <dp1> <proto>
- *    | array
- *       pos
+ *    | array <pos>
  *    | hash
  *       raw <key>
  *       | ipv4_5tuple <sa> <da> <sp> <dp> <proto>
@@ -2789,6 +2922,31 @@ parse_table_action_fwd(char **tokens,
        return 0;
 }
 
+static uint32_t
+parse_table_action_balance(char **tokens,
+       uint32_t n_tokens,
+       struct table_rule_action *a)
+{
+       uint32_t i;
+
+       if ((n_tokens == 0) || (strcmp(tokens[0], "balance") != 0))
+               return 0;
+
+       tokens++;
+       n_tokens--;
+
+       if (n_tokens < RTE_TABLE_ACTION_LB_TABLE_SIZE)
+               return 0;
+
+       for (i = 0; i < RTE_TABLE_ACTION_LB_TABLE_SIZE; i++)
+               if (parser_read_uint32(&a->lb.out[i], tokens[i]) != 0)
+                       return 0;
+
+       a->action_mask |= 1 << RTE_TABLE_ACTION_LB;
+       return 1 + RTE_TABLE_ACTION_LB_TABLE_SIZE;
+
+}
+
 static int
 parse_policer_action(char *token, enum rte_table_action_policer *a)
 {
@@ -3222,6 +3380,20 @@ parse_table_action(char **tokens,
                n_tokens -= n;
        }
 
+       if (n_tokens && (strcmp(tokens[0], "balance") == 0)) {
+               uint32_t n;
+
+               n = parse_table_action_balance(tokens, n_tokens, a);
+               if (n == 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID,
+                               "action balance");
+                       return 0;
+               }
+
+               tokens += n;
+               n_tokens -= n;
+       }
+
        if (n_tokens && (strcmp(tokens[0], "meter") == 0)) {
                uint32_t n;
 
@@ -3328,11 +3500,12 @@ parse_table_action(char **tokens,
        return n_tokens0 - n_tokens;
 }
 
-/**
- * pipeline <pipeline_name> table <table_id> rule add
- *    match <match>
- *    action <table_action>
- */
+
+static const char cmd_pipeline_table_rule_add_help[] =
+"pipeline <pipeline_name> table <table_id> rule add\n"
+"     match <match>\n"
+"     action <table_action>\n";
+
 static void
 cmd_pipeline_table_rule_add(char **tokens,
        uint32_t n_tokens,
@@ -3408,17 +3581,18 @@ cmd_pipeline_table_rule_add(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> table <table_id> rule add
- *    match
- *       default
- *    action
- *       fwd
- *          drop
- *          | port <port_id>
- *          | meta
- *          | table <table_id>
- */
+
+static const char cmd_pipeline_table_rule_add_default_help[] =
+"pipeline <pipeline_name> table <table_id> rule add\n"
+"     match\n"
+"        default\n"
+"     action\n"
+"        fwd\n"
+"           drop\n"
+"           | port <port_id>\n"
+"           | meta\n"
+"           | table <table_id>\n";
+
 static void
 cmd_pipeline_table_rule_add_default(char **tokens,
        uint32_t n_tokens,
@@ -3540,12 +3714,13 @@ cmd_pipeline_table_rule_add_default(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> table <table_id> rule add bulk <file_name> <n_rules>
- *
- * File <file_name>:
- * - line format: match <match> action <action>
- */
+
+static const char cmd_pipeline_table_rule_add_bulk_help[] =
+"pipeline <pipeline_name> table <table_id> rule add bulk <file_name> <n_rules>\n"
+"\n"
+"  File <file_name>:\n"
+"  - line format: match <match> action <action>\n";
+
 static int
 cli_rule_file_process(const char *file_name,
        size_t line_len_max,
@@ -3667,10 +3842,11 @@ cmd_pipeline_table_rule_add_bulk(char **tokens,
        free(match);
 }
 
-/**
- * pipeline <pipeline_name> table <table_id> rule delete
- *    match <match>
- */
+
+static const char cmd_pipeline_table_rule_delete_help[] =
+"pipeline <pipeline_name> table <table_id> rule delete\n"
+"     match <match>\n";
+
 static void
 cmd_pipeline_table_rule_delete(char **tokens,
        uint32_t n_tokens,
@@ -3735,11 +3911,12 @@ cmd_pipeline_table_rule_delete(char **tokens,
        }
 }
 
-/**
- * pipeline <pipeline_name> table <table_id> rule delete
- *    match
- *       default
- */
+
+static const char cmd_pipeline_table_rule_delete_default_help[] =
+"pipeline <pipeline_name> table <table_id> rule delete\n"
+"     match\n"
+"        default\n";
+
 static void
 cmd_pipeline_table_rule_delete_default(char **tokens,
        uint32_t n_tokens,
@@ -3795,89 +3972,804 @@ cmd_pipeline_table_rule_delete_default(char **tokens,
        }
 }
 
-/**
- * thread <thread_id> pipeline <pipeline_name> enable
- */
+
+static const char cmd_pipeline_table_rule_stats_read_help[] =
+"pipeline <pipeline_name> table <table_id> rule read stats [clear]\n";
+
 static void
-cmd_thread_pipeline_enable(char **tokens,
+cmd_pipeline_table_rule_stats_read(char **tokens,
+       uint32_t n_tokens __rte_unused,
+       char *out,
+       size_t out_size)
+{
+       snprintf(out, out_size, MSG_CMD_UNIMPLEM, tokens[0]);
+}
+
+
+static const char cmd_pipeline_table_meter_profile_add_help[] =
+"pipeline <pipeline_name> table <table_id> meter profile <meter_profile_id>\n"
+"   add srtcm cir <cir> cbs <cbs> ebs <ebs>\n"
+"   | trtcm cir <cir> pir <pir> cbs <cbs> pbs <pbs>\n";
+
+static void
+cmd_pipeline_table_meter_profile_add(char **tokens,
        uint32_t n_tokens,
        char *out,
        size_t out_size)
 {
+       struct rte_table_action_meter_profile p;
        char *pipeline_name;
-       uint32_t thread_id;
+       uint32_t table_id, meter_profile_id;
        int status;
 
-       if (n_tokens != 5) {
+       if (n_tokens < 9) {
                snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
                return;
        }
 
-       if (parser_read_uint32(&thread_id, tokens[1]) != 0) {
-               snprintf(out, out_size, MSG_ARG_INVALID, "thread_id");
-               return;
-       }
+       pipeline_name = tokens[1];
 
-       if (strcmp(tokens[2], "pipeline") != 0) {
-               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pipeline");
+       if (strcmp(tokens[2], "table") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "port");
                return;
        }
 
-       pipeline_name = tokens[3];
-
-       if (strcmp(tokens[4], "enable") != 0) {
-               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "enable");
+       if (parser_read_uint32(&table_id, tokens[3]) != 0) {
+               snprintf(out, out_size, MSG_ARG_INVALID, "table_id");
                return;
        }
 
-       status = thread_pipeline_enable(thread_id, pipeline_name);
-       if (status) {
-               snprintf(out, out_size, MSG_CMD_FAIL, "thread pipeline enable");
+       if (strcmp(tokens[4], "meter") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "meter");
                return;
        }
-}
-
-/**
- * thread <thread_id> pipeline <pipeline_name> disable
- */
-static void
-cmd_thread_pipeline_disable(char **tokens,
-       uint32_t n_tokens,
-       char *out,
-       size_t out_size)
-{
-       char *pipeline_name;
-       uint32_t thread_id;
-       int status;
 
-       if (n_tokens != 5) {
-               snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+       if (strcmp(tokens[5], "profile") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "profile");
                return;
        }
 
-       if (parser_read_uint32(&thread_id, tokens[1]) != 0) {
-               snprintf(out, out_size, MSG_ARG_INVALID, "thread_id");
+       if (parser_read_uint32(&meter_profile_id, tokens[6]) != 0) {
+               snprintf(out, out_size, MSG_ARG_INVALID, "meter_profile_id");
                return;
        }
 
-       if (strcmp(tokens[2], "pipeline") != 0) {
-               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pipeline");
+       if (strcmp(tokens[7], "add") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "add");
                return;
        }
 
-       pipeline_name = tokens[3];
+       if (strcmp(tokens[8], "srtcm") == 0) {
+               if (n_tokens != 15) {
+                       snprintf(out, out_size, MSG_ARG_MISMATCH,
+                               tokens[0]);
+                       return;
+               }
 
-       if (strcmp(tokens[4], "disable") != 0) {
-               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "disable");
-               return;
-       }
+               p.alg = RTE_TABLE_ACTION_METER_SRTCM;
 
-       status = thread_pipeline_disable(thread_id, pipeline_name);
-       if (status) {
-               snprintf(out, out_size, MSG_CMD_FAIL,
-                       "thread pipeline disable");
-               return;
-       }
+               if (strcmp(tokens[9], "cir") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cir");
+                       return;
+               }
+
+               if (parser_read_uint64(&p.srtcm.cir, tokens[10]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "cir");
+                       return;
+               }
+
+               if (strcmp(tokens[11], "cbs") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cbs");
+                       return;
+               }
+
+               if (parser_read_uint64(&p.srtcm.cbs, tokens[12]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "cbs");
+                       return;
+               }
+
+               if (strcmp(tokens[13], "ebs") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "ebs");
+                       return;
+               }
+
+               if (parser_read_uint64(&p.srtcm.ebs, tokens[14]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "ebs");
+                       return;
+               }
+       } else if (strcmp(tokens[8], "trtcm") == 0) {
+               if (n_tokens != 17) {
+                       snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+                       return;
+               }
+
+               p.alg = RTE_TABLE_ACTION_METER_TRTCM;
+
+               if (strcmp(tokens[9], "cir") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cir");
+                       return;
+               }
+
+               if (parser_read_uint64(&p.trtcm.cir, tokens[10]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "cir");
+                       return;
+               }
+
+               if (strcmp(tokens[11], "pir") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pir");
+                       return;
+               }
+
+               if (parser_read_uint64(&p.trtcm.pir, tokens[12]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "pir");
+                       return;
+               }
+               if (strcmp(tokens[13], "cbs") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cbs");
+                       return;
+               }
+
+               if (parser_read_uint64(&p.trtcm.cbs, tokens[14]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "cbs");
+                       return;
+               }
+
+               if (strcmp(tokens[15], "pbs") != 0) {
+                       snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pbs");
+                       return;
+               }
+
+               if (parser_read_uint64(&p.trtcm.pbs, tokens[16]) != 0) {
+                       snprintf(out, out_size, MSG_ARG_INVALID, "pbs");
+                       return;
+               }
+       } else {
+               snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+               return;
+       }
+
+       status = pipeline_table_mtr_profile_add(pipeline_name,
+               table_id,
+               meter_profile_id,
+               &p);
+       if (status) {
+               snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+               return;
+       }
+}
+
+
+static const char cmd_pipeline_table_meter_profile_delete_help[] =
+"pipeline <pipeline_name> table <table_id>\n"
+"   meter profile <meter_profile_id> delete\n";
+
+static void
+cmd_pipeline_table_meter_profile_delete(char **tokens,
+       uint32_t n_tokens,
+       char *out,
+       size_t out_size)
+{
+       char *pipeline_name;
+       uint32_t table_id, meter_profile_id;
+       int status;
+
+       if (n_tokens != 8) {
+               snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+               return;
+       }
+
+       pipeline_name = tokens[1];
+
+       if (strcmp(tokens[2], "table") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "port");
+               return;
+       }
+
+       if (parser_read_uint32(&table_id, tokens[3]) != 0) {
+               snprintf(out, out_size, MSG_ARG_INVALID, "table_id");
+               return;
+       }
+
+       if (strcmp(tokens[4], "meter") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "meter");
+               return;
+       }
+
+       if (strcmp(tokens[5], "profile") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "profile");
+               return;
+       }
+
+       if (parser_read_uint32(&meter_profile_id, tokens[6]) != 0) {
+               snprintf(out, out_size, MSG_ARG_INVALID, "meter_profile_id");
+               return;
+       }
+
+       if (strcmp(tokens[7], "delete") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "delete");
+               return;
+       }
+
+       status = pipeline_table_mtr_profile_delete(pipeline_name,
+               table_id,
+               meter_profile_id);
+       if (status) {
+               snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+               return;
+       }
+}
+
+
+static const char cmd_pipeline_table_rule_meter_read_help[] =
+"pipeline <pipeline_name> table <table_id> rule read meter [clear]\n";
+
+static void
+cmd_pipeline_table_rule_meter_read(char **tokens,
+       uint32_t n_tokens __rte_unused,
+       char *out,
+       size_t out_size)
+{
+       snprintf(out, out_size, MSG_CMD_UNIMPLEM, tokens[0]);
+}
+
+
+static const char cmd_pipeline_table_dscp_help[] =
+"pipeline <pipeline_name> table <table_id> dscp <file_name>\n"
+"\n"
+" File <file_name>:\n"
+"   - exactly 64 lines\n"
+"   - line format: <tc_id> <tc_queue_id> <color>, with <color> as: g | y | r\n";
+
+static int
+load_dscp_table(struct rte_table_action_dscp_table *dscp_table,
+       const char *file_name,
+       uint32_t *line_number)
+{
+       FILE *f = NULL;
+       uint32_t dscp, l;
+
+       /* Check input arguments */
+       if ((dscp_table == NULL) ||
+               (file_name == NULL) ||
+               (line_number == NULL)) {
+               if (line_number)
+                       *line_number = 0;
+               return -EINVAL;
+       }
+
+       /* Open input file */
+       f = fopen(file_name, "r");
+       if (f == NULL) {
+               *line_number = 0;
+               return -EINVAL;
+       }
+
+       /* Read file */
+       for (dscp = 0, l = 1; ; l++) {
+               char line[64];
+               char *tokens[3];
+               enum rte_meter_color color;
+               uint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens);
+
+               if (fgets(line, sizeof(line), f) == NULL)
+                       break;
+
+               if (is_comment(line))
+                       continue;
+
+               if (parse_tokenize_string(line, tokens, &n_tokens)) {
+                       *line_number = l;
+                       fclose(f);
+                       return -EINVAL;
+               }
+
+               if (n_tokens == 0)
+                       continue;
+
+               if ((dscp >= RTE_DIM(dscp_table->entry)) ||
+                       (n_tokens != RTE_DIM(tokens)) ||
+                       parser_read_uint32(&tc_id, tokens[0]) ||
+                       (tc_id >= RTE_TABLE_ACTION_TC_MAX) ||
+                       parser_read_uint32(&tc_queue_id, tokens[1]) ||
+                       (tc_queue_id >= RTE_TABLE_ACTION_TC_QUEUE_MAX) ||
+                       (strlen(tokens[2]) != 1)) {
+                       *line_number = l;
+                       fclose(f);
+                       return -EINVAL;
+               }
+
+               switch (tokens[2][0]) {
+               case 'g':
+               case 'G':
+                       color = e_RTE_METER_GREEN;
+                       break;
+
+               case 'y':
+               case 'Y':
+                       color = e_RTE_METER_YELLOW;
+                       break;
+
+               case 'r':
+               case 'R':
+                       color = e_RTE_METER_RED;
+                       break;
+
+               default:
+                       *line_number = l;
+                       fclose(f);
+                       return -EINVAL;
+               }
+
+               dscp_table->entry[dscp].tc_id = tc_id;
+               dscp_table->entry[dscp].tc_queue_id = tc_queue_id;
+               dscp_table->entry[dscp].color = color;
+               dscp++;
+       }
+
+       /* Close file */
+       fclose(f);
+       return 0;
+}
+
+static void
+cmd_pipeline_table_dscp(char **tokens,
+       uint32_t n_tokens,
+       char *out,
+       size_t out_size)
+{
+       struct rte_table_action_dscp_table dscp_table;
+       char *pipeline_name, *file_name;
+       uint32_t table_id, line_number;
+       int status;
+
+       if (n_tokens != 6) {
+               snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+               return;
+       }
+
+       pipeline_name = tokens[1];
+
+       if (strcmp(tokens[2], "table") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "port");
+               return;
+       }
+
+       if (parser_read_uint32(&table_id, tokens[3]) != 0) {
+               snprintf(out, out_size, MSG_ARG_INVALID, "table_id");
+               return;
+       }
+
+       if (strcmp(tokens[4], "dscp") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "dscp");
+               return;
+       }
+
+       file_name = tokens[5];
+
+       status = load_dscp_table(&dscp_table, file_name, &line_number);
+       if (status) {
+               snprintf(out, out_size, MSG_FILE_ERR, file_name, line_number);
+               return;
+       }
+
+       status = pipeline_table_dscp_table_update(pipeline_name,
+               table_id,
+               UINT64_MAX,
+               &dscp_table);
+       if (status) {
+               snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+               return;
+       }
+}
+
+
+static const char cmd_pipeline_table_rule_ttl_read_help[] =
+"pipeline <pipeline_name> table <table_id> rule read ttl [clear]\n";
+
+static void
+cmd_pipeline_table_rule_ttl_read(char **tokens,
+       uint32_t n_tokens __rte_unused,
+       char *out,
+       size_t out_size)
+{
+       snprintf(out, out_size, MSG_CMD_UNIMPLEM, tokens[0]);
+}
+
+
+static const char cmd_thread_pipeline_enable_help[] =
+"thread <thread_id> pipeline <pipeline_name> enable\n";
+
+static void
+cmd_thread_pipeline_enable(char **tokens,
+       uint32_t n_tokens,
+       char *out,
+       size_t out_size)
+{
+       char *pipeline_name;
+       uint32_t thread_id;
+       int status;
+
+       if (n_tokens != 5) {
+               snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+               return;
+       }
+
+       if (parser_read_uint32(&thread_id, tokens[1]) != 0) {
+               snprintf(out, out_size, MSG_ARG_INVALID, "thread_id");
+               return;
+       }
+
+       if (strcmp(tokens[2], "pipeline") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pipeline");
+               return;
+       }
+
+       pipeline_name = tokens[3];
+
+       if (strcmp(tokens[4], "enable") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "enable");
+               return;
+       }
+
+       status = thread_pipeline_enable(thread_id, pipeline_name);
+       if (status) {
+               snprintf(out, out_size, MSG_CMD_FAIL, "thread pipeline enable");
+               return;
+       }
+}
+
+
+static const char cmd_thread_pipeline_disable_help[] =
+"thread <thread_id> pipeline <pipeline_name> disable\n";
+
+static void
+cmd_thread_pipeline_disable(char **tokens,
+       uint32_t n_tokens,
+       char *out,
+       size_t out_size)
+{
+       char *pipeline_name;
+       uint32_t thread_id;
+       int status;
+
+       if (n_tokens != 5) {
+               snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+               return;
+       }
+
+       if (parser_read_uint32(&thread_id, tokens[1]) != 0) {
+               snprintf(out, out_size, MSG_ARG_INVALID, "thread_id");
+               return;
+       }
+
+       if (strcmp(tokens[2], "pipeline") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pipeline");
+               return;
+       }
+
+       pipeline_name = tokens[3];
+
+       if (strcmp(tokens[4], "disable") != 0) {
+               snprintf(out, out_size, MSG_ARG_NOT_FOUND, "disable");
+               return;
+       }
+
+       status = thread_pipeline_disable(thread_id, pipeline_name);
+       if (status) {
+               snprintf(out, out_size, MSG_CMD_FAIL,
+                       "thread pipeline disable");
+               return;
+       }
+}
+
+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 <command>' 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;
+               }
+       }
+
+       snprintf(out, out_size, "Invalid command\n");
 }
 
 void
@@ -3899,12 +4791,22 @@ 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;
        }
 
        if (strcmp(tokens[0], "link") == 0) {
+               if (strcmp(tokens[1], "show") == 0) {
+                       cmd_link_show(tokens, n_tokens, out, out_size);
+                       return;
+               }
+
                cmd_link(tokens, n_tokens, out, out_size);
                return;
        }
@@ -4094,6 +4996,64 @@ cli_process(char *in, char *out, size_t out_size)
                                out, out_size);
                        return;
                }
+
+               if ((n_tokens >= 7) &&
+                       (strcmp(tokens[2], "table") == 0) &&
+                       (strcmp(tokens[4], "rule") == 0) &&
+                       (strcmp(tokens[5], "read") == 0) &&
+                       (strcmp(tokens[6], "stats") == 0)) {
+                       cmd_pipeline_table_rule_stats_read(tokens, n_tokens,
+                               out, out_size);
+                       return;
+               }
+
+               if ((n_tokens >= 8) &&
+                       (strcmp(tokens[2], "table") == 0) &&
+                       (strcmp(tokens[4], "meter") == 0) &&
+                       (strcmp(tokens[5], "profile") == 0) &&
+                       (strcmp(tokens[7], "add") == 0)) {
+                       cmd_pipeline_table_meter_profile_add(tokens, n_tokens,
+                               out, out_size);
+                       return;
+               }
+
+               if ((n_tokens >= 8) &&
+                       (strcmp(tokens[2], "table") == 0) &&
+                       (strcmp(tokens[4], "meter") == 0) &&
+                       (strcmp(tokens[5], "profile") == 0) &&
+                       (strcmp(tokens[7], "delete") == 0)) {
+                       cmd_pipeline_table_meter_profile_delete(tokens,
+                               n_tokens, out, out_size);
+                       return;
+               }
+
+               if ((n_tokens >= 7) &&
+                       (strcmp(tokens[2], "table") == 0) &&
+                       (strcmp(tokens[4], "rule") == 0) &&
+                       (strcmp(tokens[5], "read") == 0) &&
+                       (strcmp(tokens[6], "meter") == 0)) {
+                       cmd_pipeline_table_rule_meter_read(tokens, n_tokens,
+                               out, out_size);
+                       return;
+               }
+
+               if ((n_tokens >= 5) &&
+                       (strcmp(tokens[2], "table") == 0) &&
+                       (strcmp(tokens[4], "dscp") == 0)) {
+                       cmd_pipeline_table_dscp(tokens, n_tokens,
+                               out, out_size);
+                       return;
+               }
+
+               if ((n_tokens >= 7) &&
+                       (strcmp(tokens[2], "table") == 0) &&
+                       (strcmp(tokens[4], "rule") == 0) &&
+                       (strcmp(tokens[5], "read") == 0) &&
+                       (strcmp(tokens[6], "ttl") == 0)) {
+                       cmd_pipeline_table_rule_ttl_read(tokens, n_tokens,
+                               out, out_size);
+                       return;
+               }
        }
 
        if (strcmp(tokens[0], "thread") == 0) {