summaryrefslogtreecommitdiff
path: root/examples/ip_pipeline/cli.c
diff options
context:
space:
mode:
authorJasvinder Singh <jasvinder.singh@intel.com>2018-03-29 19:31:46 +0100
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-04-05 19:00:00 +0200
commit9a408cc8acc8808e237dceae4bedb7d1b66d3e94 (patch)
tree055226cab7559215400031e17231ac4140deb0c1 /examples/ip_pipeline/cli.c
parent2f74ae28e23f441c6f51241b4f3ea1c9b8b15812 (diff)
downloaddpdk-9a408cc8acc8808e237dceae4bedb7d1b66d3e94.zip
dpdk-9a408cc8acc8808e237dceae4bedb7d1b66d3e94.tar.gz
dpdk-9a408cc8acc8808e237dceae4bedb7d1b66d3e94.tar.xz
examples/ip_pipeline: add KNI object
Add kni object implementation to the application. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Diffstat (limited to 'examples/ip_pipeline/cli.c')
-rw-r--r--examples/ip_pipeline/cli.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 430b49d..5221648 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -10,6 +10,7 @@
#include <rte_common.h>
#include "cli.h"
+#include "kni.h"
#include "link.h"
#include "mempool.h"
#include "parser.h"
@@ -630,6 +631,65 @@ cmd_tap(char **tokens,
}
}
+/**
+ * kni <kni_name>
+ * link <link_name>
+ * mempool <mempool_name>
+ * [thread <thread_id>]
+ */
+static void
+cmd_kni(char **tokens,
+ uint32_t n_tokens,
+ char *out,
+ size_t out_size)
+{
+ struct kni_params p;
+ char *name;
+ struct kni *kni;
+
+ if ((n_tokens != 6) && (n_tokens != 8)) {
+ snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+ return;
+ }
+
+ name = tokens[1];
+
+ if (strcmp(tokens[2], "link") != 0) {
+ snprintf(out, out_size, MSG_ARG_NOT_FOUND, "link");
+ return;
+ }
+
+ p.link_name = tokens[3];
+
+ if (strcmp(tokens[4], "mempool") != 0) {
+ snprintf(out, out_size, MSG_ARG_NOT_FOUND, "mempool");
+ return;
+ }
+
+ p.mempool_name = tokens[5];
+
+ if (n_tokens == 8) {
+ if (strcmp(tokens[6], "thread") != 0) {
+ snprintf(out, out_size, MSG_ARG_NOT_FOUND, "thread");
+ return;
+ }
+
+ if (parser_read_uint32(&p.thread_id, tokens[7]) != 0) {
+ snprintf(out, out_size, MSG_ARG_INVALID, "thread_id");
+ return;
+ }
+
+ p.force_bind = 1;
+ } else
+ p.force_bind = 0;
+
+ kni = kni_create(name, &p);
+ if (kni == NULL) {
+ snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+ return;
+ }
+}
+
void
cli_process(char *in, char *out, size_t out_size)
{
@@ -703,6 +763,11 @@ cli_process(char *in, char *out, size_t out_size)
return;
}
+ if (strcmp(tokens[0], "kni") == 0) {
+ cmd_kni(tokens, n_tokens, out, out_size);
+ return;
+ }
+
snprintf(out, out_size, MSG_CMD_UNKNOWN, tokens[0]);
}