net/hns3: fix link status when port is stopped
[dpdk.git] / app / test-pmd / parameters.c
index df5eb10..f3954c1 100644 (file)
 static void
 usage(char* progname)
 {
-       printf("usage: %s [EAL options] -- "
-#ifdef RTE_LIB_CMDLINE
-              "[--interactive|-i] "
-              "[--cmdline-file=FILENAME] "
-#endif
-              "[--help|-h] | [--auto-start|-a] | ["
-              "--tx-first | --stats-period=PERIOD | "
-              "--coremask=COREMASK --portmask=PORTMASK --numa "
-              "--portlist=PORTLIST "
-              "--mbuf-size= | --total-num-mbufs= | "
-              "--nb-cores= | --nb-ports= | "
-#ifdef RTE_LIB_CMDLINE
-              "--eth-peers-configfile= | "
-              "--eth-peer=X,M:M:M:M:M:M | "
-              "--tx-ip=SRC,DST | --tx-udp=PORT | "
-#endif
-              "--pkt-filter-mode= |"
-              "--rss-ip | --rss-udp | --rss-level-inner | --rss-level-outer |"
-              "--rxpt= | --rxht= | --rxwt= |"
-              " --rxfreet= | --txpt= | --txht= | --txwt= | --txfreet= | "
-              "--txrst= | --tx-offloads= | | --rx-offloads= | "
-              "--vxlan-gpe-port= | --geneve-parsed-port= | "
-              "--record-core-cycles | --record-burst-stats]\n",
+       printf("\nUsage: %s [EAL options] -- [testpmd options]\n\n",
               progname);
 #ifdef RTE_LIB_CMDLINE
        printf("  --interactive: run in interactive mode.\n");
@@ -97,6 +75,7 @@ usage(char* progname)
        printf("  --portlist=PORTLIST: list of forwarding ports\n");
        printf("  --numa: enable NUMA-aware allocation of RX/TX rings and of "
               "RX memory buffers (mbufs).\n");
+       printf("  --no-numa: disable NUMA-aware allocation.\n");
        printf("  --port-numa-config=(port,socket)[,(port,socket)]: "
               "specify the socket on which the memory pool "
               "used by the port will be allocated.\n");
@@ -136,6 +115,7 @@ usage(char* progname)
               "monitoring on forwarding lcore id N.\n");
 #endif
        printf("  --disable-crc-strip: disable CRC stripping by hardware.\n");
+       printf("  --enable-scatter: enable scattered Rx.\n");
        printf("  --enable-lro: enable large receive offload.\n");
        printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
        printf("  --enable-rx-timestamp: enable rx hardware timestamp offload.\n");
@@ -163,6 +143,7 @@ usage(char* progname)
        printf("  --hairpinq=N: set the number of hairpin queues per port to "
               "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("  --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");
@@ -183,6 +164,9 @@ usage(char* progname)
        printf("  --txpkts=X[,Y]*: set TX segment sizes"
                " or total packet length.\n");
        printf("  --txonly-multi-flow: generate multiple flows in txonly mode\n");
+       printf("  --tx-ip=src,dst: IP addresses in Tx-only mode\n");
+       printf("  --tx-udp=src[,dst]: UDP ports in Tx-only mode\n");
+       printf("  --eth-link-speed: force link speed.\n");
        printf("  --disable-link-check: disable check on link status when "
               "starting/stopping ports.\n");
        printf("  --disable-device-start: do not automatically start port\n");
@@ -213,14 +197,14 @@ usage(char* progname)
        printf("  --noisy-lkup-memory=N: allocate N MB of VNF memory\n");
        printf("  --noisy-lkup-num-writes=N: do N random writes per packet\n");
        printf("  --noisy-lkup-num-reads=N: do N random reads per packet\n");
-       printf("  --noisy-lkup-num-writes=N: do N random reads and writes per packet\n");
+       printf("  --noisy-lkup-num-reads-writes=N: do N random reads and writes per packet\n");
        printf("  --no-iova-contig: mempool memory can be IOVA non contiguous. "
               "valid only with --mp-alloc=anon\n");
        printf("  --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be "
               "enabled\n");
        printf("  --record-core-cycles: enable measurement of CPU cycles.\n");
        printf("  --record-burst-stats: enable display of RX and TX bursts.\n");
-       printf("  --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n "
+       printf("  --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n"
               "    0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"
               "    0x01 - hairpin ports loop, 0x00 - hairpin port self\n");
 }
@@ -484,6 +468,43 @@ parse_event_printing_config(const char *optarg, int enable)
        return 0;
 }
 
+static int
+parse_link_speed(int n)
+{
+       uint32_t speed = ETH_LINK_SPEED_FIXED;
+
+       switch (n) {
+       case 1000:
+               speed |= ETH_LINK_SPEED_1G;
+               break;
+       case 10000:
+               speed |= ETH_LINK_SPEED_10G;
+               break;
+       case 25000:
+               speed |= ETH_LINK_SPEED_25G;
+               break;
+       case 40000:
+               speed |= ETH_LINK_SPEED_40G;
+               break;
+       case 50000:
+               speed |= ETH_LINK_SPEED_50G;
+               break;
+       case 100000:
+               speed |= ETH_LINK_SPEED_100G;
+               break;
+       case 200000:
+               speed |= ETH_LINK_SPEED_200G;
+               break;
+       case 100:
+       case 10:
+       default:
+               printf("Unsupported fixed speed\n");
+               return 0;
+       }
+
+       return speed;
+}
+
 void
 launch_args_parse(int argc, char** argv)
 {
@@ -510,7 +531,6 @@ launch_args_parse(int argc, char** argv)
 #endif
                { "tx-first",                   0, 0, 0 },
                { "stats-period",               1, 0, 0 },
-               { "ports",                      1, 0, 0 },
                { "nb-cores",                   1, 0, 0 },
                { "nb-ports",                   1, 0, 0 },
                { "coremask",                   1, 0, 0 },
@@ -518,7 +538,7 @@ launch_args_parse(int argc, char** argv)
                { "portlist",                   1, 0, 0 },
                { "numa",                       0, 0, 0 },
                { "no-numa",                    0, 0, 0 },
-               { "mp-anon",                    0, 0, 0 },
+               { "mp-anon",                    0, 0, 0 }, /* deprecated */
                { "port-numa-config",           1, 0, 0 },
                { "ring-numa-config",           1, 0, 0 },
                { "socket-num",                 1, 0, 0 },
@@ -561,6 +581,7 @@ launch_args_parse(int argc, char** argv)
                { "hairpinq",                   1, 0, 0 },
                { "hairpin-mode",               1, 0, 0 },
                { "burst",                      1, 0, 0 },
+               { "flowgen-clones",             1, 0, 0 },
                { "mbcache",                    1, 0, 0 },
                { "txpt",                       1, 0, 0 },
                { "txht",                       1, 0, 0 },
@@ -577,6 +598,7 @@ launch_args_parse(int argc, char** argv)
                { "rxpkts",                     1, 0, 0 },
                { "txpkts",                     1, 0, 0 },
                { "txonly-multi-flow",          0, 0, 0 },
+               { "eth-link-speed",             1, 0, 0 },
                { "disable-link-check",         0, 0, 0 },
                { "disable-device-start",       0, 0, 0 },
                { "no-lsc-interrupt",           0, 0, 0 },
@@ -630,7 +652,7 @@ launch_args_parse(int argc, char** argv)
                case 0: /*long options */
                        if (!strcmp(lgopts[opt_idx].name, "help")) {
                                usage(argv[0]);
-                               rte_exit(EXIT_SUCCESS, "Displayed help\n");
+                               exit(EXIT_SUCCESS);
                        }
 #ifdef RTE_LIB_CMDLINE
                        if (!strcmp(lgopts[opt_idx].name, "interactive")) {
@@ -1086,6 +1108,14 @@ launch_args_parse(int argc, char** argv)
                                else
                                        nb_pkt_per_burst = (uint16_t) n;
                        }
+                       if (!strcmp(lgopts[opt_idx].name, "flowgen-clones")) {
+                               n = atoi(optarg);
+                               if (n >= 0)
+                                       nb_pkt_flowgen_clones = (uint16_t) n;
+                               else
+                                       rte_exit(EXIT_FAILURE,
+                                                "clones must be >= 0 and <= current burst\n");
+                       }
                        if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
                                n = atoi(optarg);
                                if ((n >= 0) &&
@@ -1222,6 +1252,11 @@ launch_args_parse(int argc, char** argv)
                                txonly_multi_flow = 1;
                        if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
                                no_flush_rx = 1;
+                       if (!strcmp(lgopts[opt_idx].name, "eth-link-speed")) {
+                               n = atoi(optarg);
+                               if (n >= 0 && parse_link_speed(n) > 0)
+                                       eth_link_speed = parse_link_speed(n);
+                       }
                        if (!strcmp(lgopts[opt_idx].name, "disable-link-check"))
                                no_link_check = 1;
                        if (!strcmp(lgopts[opt_idx].name, "disable-device-start"))
@@ -1359,7 +1394,7 @@ launch_args_parse(int argc, char** argv)
                        break;
                case 'h':
                        usage(argv[0]);
-                       rte_exit(EXIT_SUCCESS, "Displayed help\n");
+                       exit(EXIT_SUCCESS);
                        break;
                default:
                        usage(argv[0]);