net/sfc: support API to negotiate delivery of Rx metadata
[dpdk.git] / app / test-pmd / parameters.c
index f3954c1..b69897e 100644 (file)
@@ -19,7 +19,6 @@
 #include <stdint.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <arpa/inet.h>
 
 #include <rte_common.h>
 #include <rte_byteorder.h>
@@ -144,6 +143,7 @@ usage(char* progname)
               "N.\n");
        printf("  --burst=N: set the number of packets per burst to N.\n");
        printf("  --flowgen-clones=N: set the number of single packet clones to send in flowgen mode. Should be less than burst value.\n");
+       printf("  --flowgen-flows=N: set the number of flows in flowgen mode to N (1 <= N <= INT32_MAX).\n");
        printf("  --mbcache=N: set the cache of mbuf memory pool to N.\n");
        printf("  --rxpt=N: set prefetch threshold register of RX rings to N.\n");
        printf("  --rxht=N: set the host threshold register of RX rings to N.\n");
@@ -185,8 +185,10 @@ usage(char* progname)
        printf("  --hot-plug: enable hot plug for device.\n");
        printf("  --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\n");
        printf("  --geneve-parsed-port=N: UPD port to parse GENEVE tunnel protocol\n");
+#ifndef RTE_EXEC_ENV_WINDOWS
        printf("  --mlockall: lock all memory\n");
        printf("  --no-mlockall: do not lock all memory\n");
+#endif
        printf("  --mp-alloc <native|anon|xmem|xmemhuge>: mempool allocation method.\n"
               "    native: use regular DPDK memory to create and populate mempool\n"
               "    anon: use regular DPDK memory to create and anonymous memory to populate mempool\n"
@@ -211,7 +213,7 @@ usage(char* progname)
 
 #ifdef RTE_LIB_CMDLINE
 static int
-init_peer_eth_addrs(char *config_filename)
+init_peer_eth_addrs(const char *config_filename)
 {
        FILE *config_file;
        portid_t i;
@@ -229,7 +231,8 @@ init_peer_eth_addrs(char *config_filename)
                        break;
 
                if (rte_ether_unformat_addr(buf, &peer_eth_addrs[i]) < 0) {
-                       printf("Bad MAC address format on line %d\n", i+1);
+                       fprintf(stderr, "Bad MAC address format on line %d\n",
+                               i + 1);
                        fclose(config_file);
                        return -1;
                }
@@ -283,10 +286,10 @@ print_invalid_socket_id_error(void)
 {
        unsigned int i = 0;
 
-       printf("Invalid socket id, options are: ");
+       fprintf(stderr, "Invalid socket id, options are: ");
        for (i = 0; i < num_sockets; i++) {
-               printf("%u%s", socket_ids[i],
-                     (i == num_sockets - 1) ? "\n" : ",");
+               fprintf(stderr, "%u%s", socket_ids[i],
+                       (i == num_sockets - 1) ? "\n" : ",");
        }
 }
 
@@ -402,7 +405,8 @@ parse_ringnuma_config(const char *q_arg)
                }
                ring_flag = (uint8_t)int_fld[FLD_FLAG];
                if ((ring_flag < RX_RING_ONLY) || (ring_flag > RXTX_RING)) {
-                       printf("Invalid ring-flag=%d config for port =%d\n",
+                       fprintf(stderr,
+                               "Invalid ring-flag=%d config for port =%d\n",
                                ring_flag,port_id);
                        return -1;
                }
@@ -419,7 +423,8 @@ parse_ringnuma_config(const char *q_arg)
                        txring_numa[port_id] = socket_id;
                        break;
                default:
-                       printf("Invalid ring-flag=%d config for port=%d\n",
+                       fprintf(stderr,
+                               "Invalid ring-flag=%d config for port=%d\n",
                                ring_flag,port_id);
                        break;
                }
@@ -498,7 +503,7 @@ parse_link_speed(int n)
        case 100:
        case 10:
        default:
-               printf("Unsupported fixed speed\n");
+               fprintf(stderr, "Unsupported fixed speed\n");
                return 0;
        }
 
@@ -508,6 +513,9 @@ parse_link_speed(int n)
 void
 launch_args_parse(int argc, char** argv)
 {
+#define PARAM_PROC_ID "proc-id"
+#define PARAM_NUM_PROCS "num-procs"
+
        int n, opt;
        char **argvopt;
        int opt_idx;
@@ -582,6 +590,7 @@ launch_args_parse(int argc, char** argv)
                { "hairpin-mode",               1, 0, 0 },
                { "burst",                      1, 0, 0 },
                { "flowgen-clones",             1, 0, 0 },
+               { "flowgen-flows",              1, 0, 0 },
                { "mbcache",                    1, 0, 0 },
                { "txpt",                       1, 0, 0 },
                { "txht",                       1, 0, 0 },
@@ -610,8 +619,10 @@ launch_args_parse(int argc, char** argv)
                { "hot-plug",                   0, 0, 0 },
                { "vxlan-gpe-port",             1, 0, 0 },
                { "geneve-parsed-port",         1, 0, 0 },
+#ifndef RTE_EXEC_ENV_WINDOWS
                { "mlockall",                   0, 0, 0 },
                { "no-mlockall",                0, 0, 0 },
+#endif
                { "mp-alloc",                   1, 0, 0 },
                { "tx-ip",                      1, 0, 0 },
                { "tx-udp",                     1, 0, 0 },
@@ -625,6 +636,8 @@ launch_args_parse(int argc, char** argv)
                { "rx-mq-mode",                 1, 0, 0 },
                { "record-core-cycles",         0, 0, 0 },
                { "record-burst-stats",         0, 0, 0 },
+               { PARAM_NUM_PROCS,              1, 0, 0 },
+               { PARAM_PROC_ID,                1, 0, 0 },
                { 0, 0, 0, 0 },
        };
 
@@ -723,13 +736,13 @@ launch_args_parse(int argc, char** argv)
                                                 "Invalid tx-ip: %s", optarg);
 
                                *end++ = 0;
-                               if (inet_aton(optarg, &in) == 0)
+                               if (inet_pton(AF_INET, optarg, &in) == 0)
                                        rte_exit(EXIT_FAILURE,
                                                 "Invalid source IP address: %s\n",
                                                 optarg);
                                tx_ip_src_addr = rte_be_to_cpu_32(in.s_addr);
 
-                               if (inet_aton(end, &in) == 0)
+                               if (inet_pton(AF_INET, end, &in) == 0)
                                        rte_exit(EXIT_FAILURE,
                                                 "Invalid destination IP address: %s\n",
                                                 optarg);
@@ -1116,6 +1129,14 @@ launch_args_parse(int argc, char** argv)
                                        rte_exit(EXIT_FAILURE,
                                                 "clones must be >= 0 and <= current burst\n");
                        }
+                       if (!strcmp(lgopts[opt_idx].name, "flowgen-flows")) {
+                               n = atoi(optarg);
+                               if (n > 0)
+                                       nb_flows_flowgen = (int) n;
+                               else
+                                       rte_exit(EXIT_FAILURE,
+                                                "flows must be >= 1\n");
+                       }
                        if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
                                n = atoi(optarg);
                                if ((n >= 0) &&
@@ -1375,7 +1396,7 @@ launch_args_parse(int argc, char** argv)
                                                 "noisy-lkup-num-reads-writes must be >= 0\n");
                        }
                        if (!strcmp(lgopts[opt_idx].name, "no-iova-contig"))
-                               mempool_flags = MEMPOOL_F_NO_IOVA_CONTIG;
+                               mempool_flags = RTE_MEMPOOL_F_NO_IOVA_CONTIG;
 
                        if (!strcmp(lgopts[opt_idx].name, "rx-mq-mode")) {
                                char *end = NULL;
@@ -1391,6 +1412,10 @@ launch_args_parse(int argc, char** argv)
                                record_core_cycles = 1;
                        if (!strcmp(lgopts[opt_idx].name, "record-burst-stats"))
                                record_burst_stats = 1;
+                       if (!strcmp(lgopts[opt_idx].name, PARAM_NUM_PROCS))
+                               num_procs = atoi(optarg);
+                       if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
+                               proc_id = atoi(optarg);
                        break;
                case 'h':
                        usage(argv[0]);
@@ -1398,7 +1423,7 @@ launch_args_parse(int argc, char** argv)
                        break;
                default:
                        usage(argv[0]);
-                       printf("Invalid option: %s\n", argv[optind]);
+                       fprintf(stderr, "Invalid option: %s\n", argv[optind]);
                        rte_exit(EXIT_FAILURE,
                                 "Command line is incomplete or incorrect\n");
                        break;
@@ -1407,7 +1432,7 @@ launch_args_parse(int argc, char** argv)
 
        if (optind != argc) {
                usage(argv[0]);
-               printf("Invalid parameter: %s\n", argv[optind]);
+               fprintf(stderr, "Invalid parameter: %s\n", argv[optind]);
                rte_exit(EXIT_FAILURE, "Command line is incorrect\n");
        }
 
@@ -1415,7 +1440,7 @@ launch_args_parse(int argc, char** argv)
        rx_mode.offloads = rx_offloads;
        tx_mode.offloads = tx_offloads;
 
-       if (mempool_flags & MEMPOOL_F_NO_IOVA_CONTIG &&
+       if (mempool_flags & RTE_MEMPOOL_F_NO_IOVA_CONTIG &&
            mp_alloc_type != MP_ALLOC_ANON) {
                TESTPMD_LOG(WARNING, "cannot use no-iova-contig without "
                                  "mp-alloc=anon. mempool no-iova-contig is "