1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
9 #include <rte_common.h>
10 #include <rte_lcore.h>
15 unsigned int portmask = 0;
19 usage(const char *prgname)
21 fprintf(stderr, "Usage: %s [EAL args] -- -p <portmask>\n"
22 "-p PORTMASK: hexadecimal bitmask of NIC ports to configure\n",
27 parse_portmask(const char *portmask_str)
29 return strtoul(portmask_str, NULL, 16);
33 check_core_count(void)
35 if (rte_lcore_count() < 3)
36 rte_exit(EXIT_FAILURE,
37 "At least 3 cores need to be passed in the coremask\n");
41 check_portmask_value(unsigned int portmask)
43 unsigned int port_nb = 0;
45 port_nb = __builtin_popcount(portmask);
48 rte_exit(EXIT_FAILURE,
49 "At least 2 ports need to be passed in the portmask\n");
52 rte_exit(EXIT_FAILURE,
53 "An even number of ports is required in the portmask\n");
57 parse_qw_args(int argc, char **argv)
61 while ((opt = getopt(argc, argv, "h:p:")) != -1) {
67 portmask = parse_portmask(optarg);
75 check_portmask_value(portmask);