@@ -523,438 +523,6 @@ cmd_tap(char **tokens,
}
}
-static const char cmd_pipeline_port_in_help[] =
-"pipeline <pipeline_name> port in <port_id>\n"
-" link <link_name> rxq <queue_id> bsz <burst_size>\n"
-" ring <ring_name> bsz <burst_size>\n"
-" | source <mempool_name> <file_name> loop <n_loops>\n"
-" | tap <tap_name> mempool <mempool_name> mtu <mtu> bsz <burst_size>\n";
-
-static void
-cmd_pipeline_port_in(char **tokens,
- uint32_t n_tokens,
- char *out,
- size_t out_size,
- void *obj)
-{
- struct pipeline *p;
- int status;
- uint32_t port_id = 0, t0;
-
- if (n_tokens < 6) {
- snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
- return;
- }
-
- p = pipeline_find(obj, tokens[1]);
- if (!p || p->ctl) {
- snprintf(out, out_size, MSG_ARG_INVALID, tokens[0]);
- return;
- }
-
- if (strcmp(tokens[2], "port") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "port");
- return;
- }
-
- if (strcmp(tokens[3], "in") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "in");
- return;
- }
-
- if (parser_read_uint32(&port_id, tokens[4]) != 0) {
- snprintf(out, out_size, MSG_ARG_INVALID, "port_id");
- return;
- }
-
- t0 = 5;
-
- if (strcmp(tokens[t0], "link") == 0) {
- struct rte_swx_port_ethdev_reader_params params;
- struct link *link;
-
- if (n_tokens < t0 + 6) {
- snprintf(out, out_size, MSG_ARG_MISMATCH,
- "pipeline port in link");
- return;
- }
-
- link = link_find(obj, tokens[t0 + 1]);
- if (!link) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "link_name");
- return;
- }
- params.dev_name = link->dev_name;
-
- if (strcmp(tokens[t0 + 2], "rxq") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "rxq");
- return;
- }
-
- if (parser_read_uint16(¶ms.queue_id, tokens[t0 + 3]) != 0) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "queue_id");
- return;
- }
-
- if (strcmp(tokens[t0 + 4], "bsz") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "bsz");
- return;
- }
-
- if (parser_read_uint32(¶ms.burst_size, tokens[t0 + 5])) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "burst_size");
- return;
- }
-
- t0 += 6;
-
- status = rte_swx_pipeline_port_in_config(p->p,
- port_id,
- "ethdev",
- ¶ms);
- } else if (strcmp(tokens[t0], "ring") == 0) {
- struct rte_swx_port_ring_reader_params params;
- struct ring *ring;
-
- if (n_tokens < t0 + 4) {
- snprintf(out, out_size, MSG_ARG_MISMATCH,
- "pipeline port in ring");
- return;
- }
-
- ring = ring_find(obj, tokens[t0 + 1]);
- if (!ring) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "ring_name");
- return;
- }
- params.name = ring->name;
-
- if (strcmp(tokens[t0 + 2], "bsz") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "bsz");
- return;
- }
-
- if (parser_read_uint32(¶ms.burst_size, tokens[t0 + 3])) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "burst_size");
- return;
- }
-
- t0 += 4;
-
- status = rte_swx_pipeline_port_in_config(p->p,
- port_id,
- "ring",
- ¶ms);
- } else if (strcmp(tokens[t0], "source") == 0) {
- struct rte_swx_port_source_params params;
- struct mempool *mp;
-
- if (n_tokens < t0 + 5) {
- snprintf(out, out_size, MSG_ARG_MISMATCH,
- "pipeline port in source");
- return;
- }
-
- mp = mempool_find(obj, tokens[t0 + 1]);
- if (!mp) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "mempool_name");
- return;
- }
- params.pool = mp->m;
-
- params.file_name = tokens[t0 + 2];
-
- if (strcmp(tokens[t0 + 3], "loop") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "loop");
- return;
- }
-
- if (parser_read_uint64(¶ms.n_loops, tokens[t0 + 4])) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "n_loops");
- return;
- }
-
- t0 += 5;
-
- status = rte_swx_pipeline_port_in_config(p->p,
- port_id,
- "source",
- ¶ms);
- } else if (strcmp(tokens[t0], "tap") == 0) {
- struct rte_swx_port_fd_reader_params params;
- struct tap *tap;
- struct mempool *mp;
-
- if (n_tokens < t0 + 8) {
- snprintf(out, out_size, MSG_ARG_MISMATCH,
- "pipeline port in tap");
- return;
- }
-
- tap = tap_find(obj, tokens[t0 + 1]);
- if (!tap) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "tap_name");
- return;
- }
- params.fd = tap->fd;
-
- if (strcmp(tokens[t0 + 2], "mempool") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND,
- "mempool");
- return;
- }
-
- mp = mempool_find(obj, tokens[t0 + 3]);
- if (!mp) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "mempool_name");
- return;
- }
- params.mempool = mp->m;
-
- if (strcmp(tokens[t0 + 4], "mtu") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND,
- "mtu");
- return;
- }
-
- if (parser_read_uint32(¶ms.mtu, tokens[t0 + 5]) != 0) {
- snprintf(out, out_size, MSG_ARG_INVALID, "mtu");
- return;
- }
-
- if (strcmp(tokens[t0 + 6], "bsz") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "bsz");
- return;
- }
-
- if (parser_read_uint32(¶ms.burst_size, tokens[t0 + 7])) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "burst_size");
- return;
- }
-
- t0 += 8;
-
- status = rte_swx_pipeline_port_in_config(p->p,
- port_id,
- "fd",
- ¶ms);
-
- } else {
- snprintf(out, out_size, MSG_ARG_INVALID, tokens[0]);
- return;
- }
-
- if (status) {
- snprintf(out, out_size, "port in error.");
- return;
- }
-
- if (n_tokens != t0) {
- snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
- return;
- }
-}
-
-static const char cmd_pipeline_port_out_help[] =
-"pipeline <pipeline_name> port out <port_id>\n"
-" link <link_name> txq <txq_id> bsz <burst_size>\n"
-" ring <ring_name> bsz <burst_size>\n"
-" | sink <file_name> | none\n"
-" | tap <tap_name> bsz <burst_size>\n";
-
-static void
-cmd_pipeline_port_out(char **tokens,
- uint32_t n_tokens,
- char *out,
- size_t out_size,
- void *obj)
-{
- struct pipeline *p;
- int status;
- uint32_t port_id = 0, t0;
-
- if (n_tokens < 6) {
- snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
- return;
- }
-
- p = pipeline_find(obj, tokens[1]);
- if (!p || p->ctl) {
- snprintf(out, out_size, MSG_ARG_INVALID, tokens[0]);
- return;
- }
-
- if (strcmp(tokens[2], "port") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "port");
- return;
- }
-
- if (strcmp(tokens[3], "out") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "out");
- return;
- }
-
- if (parser_read_uint32(&port_id, tokens[4]) != 0) {
- snprintf(out, out_size, MSG_ARG_INVALID, "port_id");
- return;
- }
-
- t0 = 5;
-
- if (strcmp(tokens[t0], "link") == 0) {
- struct rte_swx_port_ethdev_writer_params params;
- struct link *link;
-
- if (n_tokens < t0 + 6) {
- snprintf(out, out_size, MSG_ARG_MISMATCH,
- "pipeline port out link");
- return;
- }
-
- link = link_find(obj, tokens[t0 + 1]);
- if (!link) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "link_name");
- return;
- }
- params.dev_name = link->dev_name;
-
- if (strcmp(tokens[t0 + 2], "txq") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "txq");
- return;
- }
-
- if (parser_read_uint16(¶ms.queue_id, tokens[t0 + 3]) != 0) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "queue_id");
- return;
- }
-
- if (strcmp(tokens[t0 + 4], "bsz") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "bsz");
- return;
- }
-
- if (parser_read_uint32(¶ms.burst_size, tokens[t0 + 5])) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "burst_size");
- return;
- }
-
- t0 += 6;
-
- status = rte_swx_pipeline_port_out_config(p->p,
- port_id,
- "ethdev",
- ¶ms);
- } else if (strcmp(tokens[t0], "ring") == 0) {
- struct rte_swx_port_ring_writer_params params;
- struct ring *ring;
-
- if (n_tokens < t0 + 4) {
- snprintf(out, out_size, MSG_ARG_MISMATCH,
- "pipeline port out link");
- return;
- }
-
- ring = ring_find(obj, tokens[t0 + 1]);
- if (!ring) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "ring_name");
- return;
- }
- params.name = ring->name;
-
- if (strcmp(tokens[t0 + 2], "bsz") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "bsz");
- return;
- }
-
- if (parser_read_uint32(¶ms.burst_size, tokens[t0 + 3])) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "burst_size");
- return;
- }
-
- t0 += 4;
-
- status = rte_swx_pipeline_port_out_config(p->p,
- port_id,
- "ring",
- ¶ms);
- } else if (strcmp(tokens[t0], "sink") == 0) {
- struct rte_swx_port_sink_params params;
-
- params.file_name = strcmp(tokens[t0 + 1], "none") ?
- tokens[t0 + 1] : NULL;
-
- t0 += 2;
-
- status = rte_swx_pipeline_port_out_config(p->p,
- port_id,
- "sink",
- ¶ms);
- } else if (strcmp(tokens[t0], "tap") == 0) {
- struct rte_swx_port_fd_writer_params params;
- struct tap *tap;
-
- if (n_tokens < t0 + 4) {
- snprintf(out, out_size, MSG_ARG_MISMATCH,
- "pipeline port out tap");
- return;
- }
-
- tap = tap_find(obj, tokens[t0 + 1]);
- if (!tap) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "tap_name");
- return;
- }
- params.fd = tap->fd;
-
- if (strcmp(tokens[t0 + 2], "bsz") != 0) {
- snprintf(out, out_size, MSG_ARG_NOT_FOUND, "bsz");
- return;
- }
-
- if (parser_read_uint32(¶ms.burst_size, tokens[t0 + 3])) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "burst_size");
- return;
- }
-
- t0 += 4;
-
- status = rte_swx_pipeline_port_out_config(p->p,
- port_id,
- "fd",
- ¶ms);
- } else {
- snprintf(out, out_size, MSG_ARG_INVALID, tokens[0]);
- return;
- }
-
- if (status) {
- snprintf(out, out_size, "port out error.");
- return;
- }
-
- if (n_tokens != t0) {
- snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
- return;
- }
-}
-
static const char cmd_pipeline_codegen_help[] =
"pipeline codegen <spec_file> <code_file>\n";
@@ -3155,8 +2723,6 @@ cmd_help(char **tokens,
"\tmempool\n"
"\tlink\n"
"\ttap\n"
- "\tpipeline port in\n"
- "\tpipeline port out\n"
"\tpipeline codegen\n"
"\tpipeline libbuild\n"
"\tpipeline build\n"
@@ -3207,21 +2773,6 @@ cmd_help(char **tokens,
return;
}
- if ((strcmp(tokens[0], "pipeline") == 0) &&
- (n_tokens == 3) && (strcmp(tokens[1], "port") == 0)) {
- if (strcmp(tokens[2], "in") == 0) {
- snprintf(out, out_size, "\n%s\n",
- cmd_pipeline_port_in_help);
- return;
- }
-
- if (strcmp(tokens[2], "out") == 0) {
- snprintf(out, out_size, "\n%s\n",
- cmd_pipeline_port_out_help);
- return;
- }
- }
-
if ((strcmp(tokens[0], "pipeline") == 0) &&
(n_tokens == 2) && (strcmp(tokens[1], "codegen") == 0)) {
snprintf(out, out_size, "\n%s\n", cmd_pipeline_codegen_help);
@@ -3489,22 +3040,6 @@ cli_process(char *in, char *out, size_t out_size, void *obj)
}
if (strcmp(tokens[0], "pipeline") == 0) {
- if ((n_tokens >= 4) &&
- (strcmp(tokens[2], "port") == 0) &&
- (strcmp(tokens[3], "in") == 0)) {
- cmd_pipeline_port_in(tokens, n_tokens, out, out_size,
- obj);
- return;
- }
-
- if ((n_tokens >= 4) &&
- (strcmp(tokens[2], "port") == 0) &&
- (strcmp(tokens[3], "out") == 0)) {
- cmd_pipeline_port_out(tokens, n_tokens, out, out_size,
- obj);
- return;
- }
-
if ((n_tokens >= 3) &&
(strcmp(tokens[1], "codegen") == 0)) {
cmd_pipeline_codegen(tokens, n_tokens, out, out_size,