net/mlx5: fix Rx CQ doorbell synchronization on aarch64
[dpdk.git] / app / test-compress-perf / comp_perf_options_parse.c
index 74ea81d..12d0a6c 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "comp_perf_options.h"
 
+#define CPERF_PTEST_TYPE       ("ptest")
 #define CPERF_DRIVER_NAME      ("driver-name")
 #define CPERF_TEST_FILE                ("input-file")
 #define CPERF_SEG_SIZE         ("seg-sz")
@@ -27,6 +28,7 @@
 #define CPERF_HUFFMAN_ENC      ("huffman-enc")
 #define CPERF_LEVEL            ("compress-level")
 #define CPERF_WINDOW_SIZE      ("window-sz")
+#define CPERF_EXTERNAL_MBUFS   ("external-mbufs")
 
 struct name_id_map {
        const char *name;
@@ -37,6 +39,7 @@ static void
 usage(char *progname)
 {
        printf("%s [EAL options] --\n"
+               " --ptest benchmark / verify :"
                " --driver-name NAME: compress driver to use\n"
                " --input-file NAME: file to compress and decompress\n"
                " --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -56,6 +59,8 @@ usage(char *progname)
                "               (default: range between 1 and 9)\n"
                " --window-sz N: base two log value of compression window size\n"
                "               (e.g.: 15 => 32k, default: max supported by PMD)\n"
+               " --external-mbufs: use memzones as external buffers instead of\n"
+               "               keeping the data directly in mbuf area\n"
                " -h: prints this help\n",
                progname);
 }
@@ -75,6 +80,33 @@ get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
        return -1;
 }
 
+static int
+parse_cperf_test_type(struct comp_test_data *test_data, const char *arg)
+{
+       struct name_id_map cperftest_namemap[] = {
+               {
+                       comp_perf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK],
+                       CPERF_TEST_TYPE_BENCHMARK
+               },
+               {
+                       comp_perf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
+                       CPERF_TEST_TYPE_VERIFY
+               }
+       };
+
+       int id = get_str_key_id_mapping(
+                       (struct name_id_map *)cperftest_namemap,
+                       RTE_DIM(cperftest_namemap), arg);
+       if (id < 0) {
+               RTE_LOG(ERR, USER1, "failed to parse test type");
+               return -1;
+       }
+
+       test_data->test = (enum cperf_test_type)id;
+
+       return 0;
+}
+
 static int
 parse_uint32_t(uint32_t *value, const char *arg)
 {
@@ -491,6 +523,14 @@ parse_level(struct comp_test_data *test_data, const char *arg)
        return 0;
 }
 
+static int
+parse_external_mbufs(struct comp_test_data *test_data,
+                    const char *arg __rte_unused)
+{
+       test_data->use_external_mbufs = 1;
+       return 0;
+}
+
 typedef int (*option_parser_t)(struct comp_test_data *test_data,
                const char *arg);
 
@@ -501,6 +541,8 @@ struct long_opt_parser {
 };
 
 static struct option lgopts[] = {
+
+       { CPERF_PTEST_TYPE, required_argument, 0, 0 },
        { CPERF_DRIVER_NAME, required_argument, 0, 0 },
        { CPERF_TEST_FILE, required_argument, 0, 0 },
        { CPERF_SEG_SIZE, required_argument, 0, 0 },
@@ -513,12 +555,15 @@ static struct option lgopts[] = {
        { CPERF_HUFFMAN_ENC, required_argument, 0, 0 },
        { CPERF_LEVEL, required_argument, 0, 0 },
        { CPERF_WINDOW_SIZE, required_argument, 0, 0 },
+       { CPERF_EXTERNAL_MBUFS, 0, 0, 0 },
        { NULL, 0, 0, 0 }
 };
+
 static int
 comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
 {
        struct long_opt_parser parsermap[] = {
+               { CPERF_PTEST_TYPE,     parse_cperf_test_type },
                { CPERF_DRIVER_NAME,    parse_driver_name },
                { CPERF_TEST_FILE,      parse_test_file },
                { CPERF_SEG_SIZE,       parse_seg_sz },
@@ -531,6 +576,7 @@ comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data)
                { CPERF_HUFFMAN_ENC,    parse_huffman_enc },
                { CPERF_LEVEL,          parse_level },
                { CPERF_WINDOW_SIZE,    parse_window_sz },
+               { CPERF_EXTERNAL_MBUFS, parse_external_mbufs },
        };
        unsigned int i;
 
@@ -582,10 +628,11 @@ comp_perf_options_default(struct comp_test_data *test_data)
        test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
        test_data->test_op = COMPRESS_DECOMPRESS;
        test_data->window_sz = -1;
-       test_data->level_lst.min = 1;
-       test_data->level_lst.max = 9;
+       test_data->level_lst.min = RTE_COMP_LEVEL_MIN;
+       test_data->level_lst.max = RTE_COMP_LEVEL_MAX;
        test_data->level_lst.inc = 1;
        test_data->test = CPERF_TEST_TYPE_BENCHMARK;
+       test_data->use_external_mbufs = 0;
 }
 
 int