summaryrefslogtreecommitdiffstats
path: root/VNFs/UDP_Replay
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2017-10-16 18:03:51 -0700
committerDeepak S <deepak.s@linux.intel.com>2017-10-16 18:03:51 -0700
commit2a738a1538bec699534c17d1801bd33f20dafda6 (patch)
treed6f23c023e43c1843e8501dc6204d88eef688b39 /VNFs/UDP_Replay
parent039ac41531956a733ed96f7c715ed072e724e0df (diff)
Adding app version display
Change-Id: I366d915a05f58c5653de89c1c59ebd180904e080 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Diffstat (limited to 'VNFs/UDP_Replay')
-rw-r--r--VNFs/UDP_Replay/main.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/VNFs/UDP_Replay/main.c b/VNFs/UDP_Replay/main.c
index 2830aa41..2e1638e4 100644
--- a/VNFs/UDP_Replay/main.c
+++ b/VNFs/UDP_Replay/main.c
@@ -88,6 +88,7 @@ performance of the solution should be sufficient for testing the UDP NAT perform
#include <lib_arp.h>
#include "l2_proto.h"
#include "interface.h"
+#include "version.h"
#include "l3fwd_common.h"
#include "l3fwd_lpm4.h"
#include "l3fwd_lpm6.h"
@@ -2121,6 +2122,7 @@ print_usage(const char *prgname)
" [--enable-jumbo [--max-pkt-len PKTLEN]]\n"
" -p PORTMASK: hexadecimal bitmask of ports to configure\n"
" -P : enable promiscuous mode\n"
+ " -v version: display app version\n"
" --config (port,queue,lcore): rx queues configuration\n"
" --eth-dest=X,MM:MM:MM:MM:MM:MM: optional, ethernet destination for port X\n"
" --no-numa: optional, disable numa awareness\n"
@@ -2294,6 +2296,7 @@ parse_eth_dest(const char *optarg)
#define CMD_LINE_OPT_NO_HW_CSUM "no-hw-csum"
#define CMD_LINE_OPT_IPV6 "ipv6"
#define CMD_LINE_OPT_ENABLE_JUMBO "enable-jumbo"
+#define CMD_LINE_OPT_VERSION "version"
#define CMD_LINE_OPT_HASH_ENTRY_NUM "hash-entry-num"
/* Parse the argument given in the command line of the application */
@@ -2302,7 +2305,7 @@ parse_args(int argc, char **argv)
{
int opt, ret;
char **argvopt;
- int option_index;
+ int option_index, v_present = 0;
char *prgname = argv[0];
static struct option lgopts[] = {
{CMD_LINE_OPT_CONFIG, 1, 0, 0},
@@ -2311,13 +2314,14 @@ parse_args(int argc, char **argv)
{CMD_LINE_OPT_NO_HW_CSUM, 0, 0, 0},
{CMD_LINE_OPT_IPV6, 0, 0, 0},
{CMD_LINE_OPT_ENABLE_JUMBO, 0, 0, 0},
+ {CMD_LINE_OPT_VERSION, 0, 0, 0},
{CMD_LINE_OPT_HASH_ENTRY_NUM, 1, 0, 0},
{NULL, 0, 0, 0}
};
argvopt = argv;
- while ((opt = getopt_long(argc, argvopt, "s:p:P",
+ while ((opt = getopt_long(argc, argvopt, "v:s:p:P",
lgopts, &option_index)) != EOF) {
switch (opt) {
@@ -2378,6 +2382,15 @@ parse_args(int argc, char **argv)
}
#endif
+ if (!strncmp(lgopts[option_index].name, CMD_LINE_OPT_VERSION,
+ sizeof (CMD_LINE_OPT_VERSION))) {
+ if (v_present)
+ rte_panic("Error: VERSION is provided more than once\n");
+ v_present = 1;
+ printf("Version: %s\n", VERSION_STR);
+ exit(0);
+ }
+
if (!strncmp(lgopts[option_index].name, CMD_LINE_OPT_ENABLE_JUMBO,
sizeof (CMD_LINE_OPT_ENABLE_JUMBO))) {
struct option lenopts = {"max-pkt-len", required_argument, 0, 0};
@@ -2745,6 +2758,11 @@ main(int argc, char **argv)
uint32_t size;
struct pipeline_params *params;
+ /* parse application arguments (after the EAL ones) */
+ ret = parse_args(argc, argv);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Invalid UDP_Replay parameters\n");
+
/* init EAL */
ret = rte_eal_init(argc, argv);
if (ret < 0)
@@ -2752,10 +2770,6 @@ main(int argc, char **argv)
argc -= ret;
argv += ret;
timer_lcore = rte_lcore_id();
- /* parse application arguments (after the EAL ones) */
- ret = parse_args(argc, argv);
- if (ret < 0)
- rte_exit(EXIT_FAILURE, "Invalid UDP_Replay parameters\n");
if (check_lcore_params() < 0)
rte_exit(EXIT_FAILURE, "check_lcore_params failed\n");