#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"
" [--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"
#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 */
{
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},
{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) {
}
#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};
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)
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");
#include <rte_string_fns.h>
#include "app.h"
+#include "version.h"
#include "parser.h"
/**
};
static const char app_usage[] =
- "Usage: %s [-f CONFIG_FILE] [-s SCRIPT_FILE] [-p PORT_MASK] "
- "[-l LOG_LEVEL] [--preproc PREPROCESSOR] [--preproc-args ARGS]\n"
+ "Usage: %s [--version] [-f CONFIG_FILE] [-s SCRIPT_FILE] [-p PORT_MASK] "
+ "[-l LOG_LEVEL] [--disable-hw-csum] [--preproc PREPROCESSOR] [--preproc-args ARGS]\n"
"\n"
"Arguments:\n"
"\t-f CONFIG_FILE: Default config file is %s\n"
"config file when not provided)\n"
"\t-s SCRIPT_FILE: No CLI script file is run when not specified\n"
"\t-l LOG_LEVEL: 0 = NONE, 1 = HIGH PRIO (default), 2 = LOW PRIO\n"
+ "\t--version application version\n"
"\t--disable-hw-csum Disable TCP/UDP HW checksum\n"
"\t--preproc PREPROCESSOR: Configuration file pre-processor\n"
"\t--preproc-args ARGS: Arguments to be passed to pre-processor\n"
{
const char *optname;
int opt, option_index;
- int f_present, s_present, p_present, l_present;
+ int f_present, s_present, p_present, l_present, v_present;
int preproc_present, preproc_params_present, disable_csum_present;
int hwlb_present;
int flow_dir_present;
{ "preproc-args", 1, 0, 0 },
{ "hwlb", 1, 0, 0 },
{ "flow_dir", 0, 0, 0 },
+ { "version", 0, 0, 0 },
{ NULL, 0, 0, 0 }
};
f_present = 0;
s_present = 0;
p_present = 0;
+ v_present = 0;
l_present = 0;
disable_csum_present = 0;
preproc_present = 0;
flow_dir_present = 0;
- while ((opt = getopt_long(argc, argv, "f:s:p:l:", lgopts,
+ while ((opt = getopt_long(argc, argv, "f:v:s:p:l:", lgopts,
&option_index)) != EOF)
switch (opt) {
case 'f':
case 0:
optname = lgopts[option_index].name;
+ if (strcmp(optname, "version") == 0) {
+ 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 (strcmp(optname, "hwlb") == 0) {
if (hwlb_present)
rte_panic("Error: hwlb argument "
--- /dev/null
+/*
+// Copyright (c) 2017 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+
+#ifndef __INCLUDE_VER_H__
+#define __INCLUDE_VER_H__
+
+#define STRINGIFY(s) #s
+#define SSTR(s) STRINGIFY(s)
+
+/* PROGRAM_NAME defined through Makefile */
+#define VERSION_MAJOR 0
+#define VERSION_MINOR 39
+#define VERSION_REV 0
+
+#if VERSION_REV > 0
+#define VERSION_STR "v" SSTR(VERSION_MAJOR) "." SSTR(VERSION_MINOR) "." SSTR(VERSION_REV)
+#else
+#define VERSION_STR "v" SSTR(VERSION_MAJOR) "." SSTR(VERSION_MINOR)
+#endif
+
+
+#endif