summaryrefslogtreecommitdiff
path: root/examples/ip_pipeline/cli.c
diff options
context:
space:
mode:
authorJasvinder Singh <jasvinder.singh@intel.com>2018-03-29 19:31:43 +0100
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-04-05 18:23:50 +0200
commit8245472c58c898f1bc2b30058b0f159e9ab2bb3f (patch)
tree4d1e1a638fde66a37fcff51772fb934203319a28 /examples/ip_pipeline/cli.c
parent133c2c6565d6d05432be2e2bafc0e08ef0fd9221 (diff)
downloaddpdk-8245472c58c898f1bc2b30058b0f159e9ab2bb3f.zip
dpdk-8245472c58c898f1bc2b30058b0f159e9ab2bb3f.tar.gz
dpdk-8245472c58c898f1bc2b30058b0f159e9ab2bb3f.tar.xz
examples/ip_pipeline: add sw queue object
Add swq 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.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 803e61e..6aa10a2 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -13,6 +13,7 @@
#include "link.h"
#include "mempool.h"
#include "parser.h"
+#include "swq.h"
#ifndef CMD_MAX_TOKENS
#define CMD_MAX_TOKENS 256
@@ -227,6 +228,55 @@ cmd_link(char **tokens,
}
}
+/**
+ * swq <swq_name>
+ * size <size>
+ * cpu <cpu_id>
+ */
+static void
+cmd_swq(char **tokens,
+ uint32_t n_tokens,
+ char *out,
+ size_t out_size)
+{
+ struct swq_params p;
+ char *name;
+ struct swq *swq;
+
+ if (n_tokens != 6) {
+ snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+ return;
+ }
+
+ name = tokens[1];
+
+ if (strcmp(tokens[2], "size") != 0) {
+ snprintf(out, out_size, MSG_ARG_NOT_FOUND, "size");
+ return;
+ }
+
+ if (parser_read_uint32(&p.size, tokens[3]) != 0) {
+ snprintf(out, out_size, MSG_ARG_INVALID, "size");
+ return;
+ }
+
+ if (strcmp(tokens[4], "cpu") != 0) {
+ snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cpu");
+ return;
+ }
+
+ if (parser_read_uint32(&p.cpu_id, tokens[5]) != 0) {
+ snprintf(out, out_size, MSG_ARG_INVALID, "cpu_id");
+ return;
+ }
+
+ swq = swq_create(name, &p);
+ if (swq == NULL) {
+ snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+ return;
+ }
+}
+
void
cli_process(char *in, char *out, size_t out_size)
{
@@ -256,6 +306,11 @@ cli_process(char *in, char *out, size_t out_size)
return;
}
+ if (strcmp(tokens[0], "swq") == 0) {
+ cmd_swq(tokens, n_tokens, out, out_size);
+ return;
+ }
+
snprintf(out, out_size, MSG_CMD_UNKNOWN, tokens[0]);
}