aboutsummaryrefslogtreecommitdiffstats
path: root/examples/l4fwd/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/l4fwd/parse.c')
-rw-r--r--examples/l4fwd/parse.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/examples/l4fwd/parse.c b/examples/l4fwd/parse.c
index 4850312..158b2cb 100644
--- a/examples/l4fwd/parse.c
+++ b/examples/l4fwd/parse.c
@@ -27,7 +27,8 @@ static const struct {
} name2feop[] = {
{ .name = "rx", .op = RXONLY,},
{ .name = "tx", .op = TXONLY,},
- { .name = "echo", .op = RXTX,},
+ { .name = "echo", .op = ECHO,},
+ { .name = "rxtx", .op = RXTX,},
{ .name = "fwd", .op = FWD,},
};
@@ -520,6 +521,7 @@ parse_netfe_arg(struct netfe_stream_prm *sp, const char *arg)
"fwraddr",
"fwrport",
"belcore",
+ "rxlen",
};
static const arg_handler_t hndl[] = {
@@ -535,6 +537,7 @@ parse_netfe_arg(struct netfe_stream_prm *sp, const char *arg)
parse_ip_val,
parse_uint_val,
parse_uint_val,
+ parse_uint_val,
};
union parse_val val[RTE_DIM(hndl)];
@@ -553,6 +556,7 @@ parse_netfe_arg(struct netfe_stream_prm *sp, const char *arg)
pv2saddr(&sp->fprm.local_addr, val + 7, val + 8);
pv2saddr(&sp->fprm.remote_addr, val + 9, val + 10);
sp->belcore = val[11].u64;
+ sp->rxlen = val[12].u64;
return 0;
}
@@ -631,6 +635,18 @@ check_netfe_arg(const struct netfe_stream_prm *sp)
format_feop(sp->op));
return -EINVAL;
}
+ } else if (sp->op == RXTX) {
+ /* RXTX: Check tx pkt size */
+ if (sp->txlen == 0) {
+ RTE_LOG(ERR, USER1, "invalid arg at line %u: "
+ "txlen cannot be zero.\n", sp->line);
+ return -EINVAL;
+ }
+ if (sp->rxlen == 0) {
+ RTE_LOG(ERR, USER1, "invalid arg at line %u: "
+ "rxlen cannot be zero.\n", sp->line);
+ return -EINVAL;
+ }
}
return 0;