aboutsummaryrefslogtreecommitdiffstats
path: root/examples/l2fwd
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2017-05-16 14:51:32 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2017-05-16 14:51:32 +0200
commitfca143f059a0bddd7d47b8dc2df646a891b0eb0f (patch)
tree4bfeadc905c977e45e54a90c42330553b8942e4e /examples/l2fwd
parentce3d555e43e3795b5d9507fcfc76b7a0a92fd0d6 (diff)
Imported Upstream version 17.05
Diffstat (limited to 'examples/l2fwd')
-rw-r--r--examples/l2fwd/main.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index b2f58519..f9667272 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -120,7 +120,7 @@ static const struct rte_eth_conf port_conf = {
.hw_ip_checksum = 0, /**< IP checksum offload disabled */
.hw_vlan_filter = 0, /**< VLAN filtering disabled */
.jumbo_frame = 0, /**< Jumbo Frame Support disabled */
- .hw_strip_crc = 0, /**< CRC stripped by hardware */
+ .hw_strip_crc = 1, /**< CRC stripped by hardware */
},
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
@@ -392,6 +392,29 @@ l2fwd_parse_timer_period(const char *q_arg)
return n;
}
+static const char short_options[] =
+ "p:" /* portmask */
+ "q:" /* number of queues */
+ "T:" /* timer period */
+ ;
+
+#define CMD_LINE_OPT_MAC_UPDATING "mac-updating"
+#define CMD_LINE_OPT_NO_MAC_UPDATING "no-mac-updating"
+
+enum {
+ /* long options mapped to a short option */
+
+ /* first long only option value must be >= 256, so that we won't
+ * conflict with short options */
+ CMD_LINE_OPT_MIN_NUM = 256,
+};
+
+static const struct option lgopts[] = {
+ { CMD_LINE_OPT_MAC_UPDATING, no_argument, &mac_updating, 1},
+ { CMD_LINE_OPT_NO_MAC_UPDATING, no_argument, &mac_updating, 0},
+ {NULL, 0, 0, 0}
+};
+
/* Parse the argument given in the command line of the application */
static int
l2fwd_parse_args(int argc, char **argv)
@@ -400,15 +423,10 @@ l2fwd_parse_args(int argc, char **argv)
char **argvopt;
int option_index;
char *prgname = argv[0];
- static struct option lgopts[] = {
- { "mac-updating", no_argument, &mac_updating, 1},
- { "no-mac-updating", no_argument, &mac_updating, 0},
- {NULL, 0, 0, 0}
- };
argvopt = argv;
- while ((opt = getopt_long(argc, argvopt, "p:q:T:",
+ while ((opt = getopt_long(argc, argvopt, short_options,
lgopts, &option_index)) != EOF) {
switch (opt) {
@@ -457,7 +475,7 @@ l2fwd_parse_args(int argc, char **argv)
argv[optind-1] = prgname;
ret = optind-1;
- optind = 0; /* reset getopt lib */
+ optind = 1; /* reset getopt lib */
return ret;
}