remove unnecessary null checks
[dpdk.git] / app / test-flow-perf / main.c
index 01bfa20..56d4373 100644 (file)
@@ -68,6 +68,7 @@ static bool dump_socket_mem_flag;
 static bool enable_fwd;
 static bool unique_data;
 static bool policy_mtr;
+static bool packet_mode;
 
 static uint8_t rx_queues_count;
 static uint8_t tx_queues_count;
@@ -488,6 +489,7 @@ usage(char *progname)
        printf("  --meter-profile=cir,cbs,ebs: set CIR CBS EBS parameters in meter"
                " profile, default values are %d,%d,%d\n", METER_CIR,
                METER_CIR / 8, 0);
+       printf("  --packet-mode: to enable packet mode for meter profile\n");
 
        printf("To set flow attributes:\n");
        printf("  --ingress: set ingress attribute in flows\n");
@@ -712,6 +714,8 @@ args_parse(int argc, char **argv)
                { "vxlan-decap",                0, 0, 0 },
                { "policy-mtr",                 1, 0, 0 },
                { "meter-profile",              1, 0, 0 },
+               { "packet-mode",                0, 0, 0 },
+               { 0, 0, 0, 0 },
        };
 
        RTE_ETH_FOREACH_DEV(i)
@@ -942,11 +946,13 @@ args_parse(int argc, char **argv)
                                        token = strsep(&optarg, ",\0");
                                }
                        }
+                       if (strcmp(lgopts[opt_idx].name, "packet-mode") == 0)
+                               packet_mode = true;
                        break;
                default:
                        usage(argv[0]);
                        rte_exit(EXIT_FAILURE, "Invalid option: %s\n",
-                                       argv[optind]);
+                                       argv[optind - 1]);
                        break;
                }
        }
@@ -1272,6 +1278,7 @@ create_meter_profile(void)
                mp.srtcm_rfc2697.cbs = meter_profile_values[1] ?
                        meter_profile_values[1] : METER_CIR / 8;
                mp.srtcm_rfc2697.ebs = meter_profile_values[2];
+               mp.packet_mode = packet_mode;
                ret = rte_mtr_meter_profile_add
                        (port_id, DEFAULT_METER_PROF_ID, &mp, &error);
                if (ret != 0) {
@@ -1512,7 +1519,7 @@ dump_used_cpu_time(const char *item,
         * threads time.
         *
         * Throughput: total count of rte rules divided
-        * over the average of the time cosumed by all
+        * over the average of the time consumed by all
         * threads time.
         */
        double insertion_latency_time;