diff options
author | Remy Horton <remy.horton@intel.com> | 2017-05-30 10:53:25 +0100 |
---|---|---|
committer | Remy Horton <remy.horton@intel.com> | 2017-06-30 11:09:47 +0100 |
commit | e151ee29d02d7802fab9e32b50ced54fd8d64160 (patch) | |
tree | a8488696519a8900ab23eb7dd1f02fc3b3b9fb0f /examples/l4fwd/parse.c | |
parent | 6e95f5eca55672bdd90aab6cdbb3b479985782f3 (diff) |
Add l4fwd RXTX mode
This mode allows for transactions where the request and response
are of different payload sizes
Change-Id: I0744159f0618c9241e576a4af1c02765bbf1dd9f
Signed-off-by: Remy Horton <remy.horton@intel.com>
Diffstat (limited to 'examples/l4fwd/parse.c')
-rw-r--r-- | examples/l4fwd/parse.c | 18 |
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; |