diff options
author | Mariusz Drost <mariuszx.drost@intel.com> | 2020-03-02 13:30:25 +0000 |
---|---|---|
committer | Mariusz Drost <mariuszx.drost@intel.com> | 2020-03-03 14:17:42 +0000 |
commit | 74a565176eeabe32fb2c4cb7c338b8441f51c1f0 (patch) | |
tree | b80bec9c33344112db01fc3dc549c62cf70aeb22 /examples/l4fwd/parse.c | |
parent | 3082ee6bf092482074b26a5bbf34b3e417930c59 (diff) |
l4fwd: Add new cmd-line parameter --mbuf-num
In some cases default value of MPOOL_NB_BUF is too large. Because of
that new cmd-line parameter is added (--mbuf-num/-M), so user can define
that value directly before running an application. Introduced parameter
is optional. Default value of MPOOL_NB_BUF (0x20000) is preserved.
Signed-off-by: Mariusz Drost <mariuszx.drost@intel.com>
Change-Id: I9517955f313b6e97da1bb20c50b25e761430e0a8
Diffstat (limited to 'examples/l4fwd/parse.c')
-rw-r--r-- | examples/l4fwd/parse.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/examples/l4fwd/parse.c b/examples/l4fwd/parse.c index 40adee4..a1e7917 100644 --- a/examples/l4fwd/parse.c +++ b/examples/l4fwd/parse.c @@ -45,6 +45,9 @@ static const struct { #define OPT_SHORT_PROMISC 'P' #define OPT_LONG_PROMISC "promisc" +#define OPT_SHORT_MBUFNUM 'M' +#define OPT_LONG_MBUFNUM "mbuf-num" + #define OPT_SHORT_RBUFS 'R' #define OPT_LONG_RBUFS "rbufs" @@ -95,6 +98,7 @@ static const struct option long_opt[] = { {OPT_LONG_SBULK, 1, 0, OPT_SHORT_SBULK}, {OPT_LONG_CTXFLAGS, 1, 0, OPT_SHORT_CTXFLAGS}, {OPT_LONG_PROMISC, 0, 0, OPT_SHORT_PROMISC}, + {OPT_LONG_MBUFNUM, 1, 0, OPT_SHORT_MBUFNUM}, {OPT_LONG_RBUFS, 1, 0, OPT_SHORT_RBUFS}, {OPT_LONG_SBUFS, 1, 0, OPT_SHORT_SBUFS}, {OPT_LONG_BECFG, 1, 0, OPT_SHORT_BECFG}, @@ -816,7 +820,7 @@ parse_app_options(int argc, char **argv, struct netbe_cfg *cfg, optind = 0; optarg = NULL; - while ((opt = getopt_long(argc, argv, "aB:C:c:LPR:S:TUb:f:s:v:H:K:W:w:", + while ((opt = getopt_long(argc, argv, "aB:C:c:LPR:S:M:TUb:f:s:v:H:K:W:w:", long_opt, &opt_idx)) != EOF) { if (opt == OPT_SHORT_ARP) { cfg->arp = 1; @@ -834,7 +838,13 @@ parse_app_options(int argc, char **argv, struct netbe_cfg *cfg, "for option: \'%c\'\n", __func__, optarg, opt); ctx_prm->flags = v; - } else if (opt == OPT_SHORT_PROMISC) { + } else if (opt == OPT_SHORT_MBUFNUM) { + rc = parse_uint_val(NULL, optarg, &v); + if (rc < 0) + rte_exit(EXIT_FAILURE, "%s: invalid value: %s " + "for option: \'%c\'\n", + __func__, optarg, opt); + cfg->mpool_buf_num = v; } else if (opt == OPT_SHORT_PROMISC) { cfg->promisc = 1; } else if (opt == OPT_SHORT_RBUFS) { |