From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0072.outbound.protection.outlook.com [104.47.37.72]) by dpdk.org (Postfix) with ESMTP id 1779D5688 for ; Mon, 5 Nov 2018 09:40:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3I7WosH33WB4BubvtIUXO+I2GTL+g4d5yQyr5PULpis=; b=C6PX7fPo9Azyw7A4DRGpVS3irgpszHiGsXC3KFciU+VFxa4sCZb1gCuiS9CF5ahz7gN9v2YHNkbt0+kng42aVMc8pIouozgT/WIj1jALMxeenD9vnbv381nUStvI/b1NQ50j2gIofK4z6faRS9j26/hYqS2RvPhsFGQpaGBejeE= Received: from SN6PR07MB5152.namprd07.prod.outlook.com (52.135.101.33) by SN6PR07MB4253.namprd07.prod.outlook.com (52.135.89.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Mon, 5 Nov 2018 08:40:22 +0000 Received: from SN6PR07MB5152.namprd07.prod.outlook.com ([fe80::49cb:b2a:974:2211]) by SN6PR07MB5152.namprd07.prod.outlook.com ([fe80::49cb:b2a:974:2211%4]) with mapi id 15.20.1294.028; Mon, 5 Nov 2018 08:40:22 +0000 From: "Verma, Shally" To: Tomasz Jozwiak , "dev@dpdk.org" , "fiona.trahe@intel.com" , "akhil.goyal@nxp.com" Thread-Topic: [PATCH v2 1/3] app/compress-perf: add parser Thread-Index: AQHUcpCb6JcXbSWPL0yP2FHwVAsxlKVA3/qA Date: Mon, 5 Nov 2018 08:40:21 +0000 Message-ID: References: <1538400427-20164-1-git-send-email-tomaszx.jozwiak@intel.com> <1541151842-8746-1-git-send-email-tomaszx.jozwiak@intel.com> <1541151842-8746-2-git-send-email-tomaszx.jozwiak@intel.com> In-Reply-To: <1541151842-8746-2-git-send-email-tomaszx.jozwiak@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; x-originating-ip: [115.113.156.3] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; SN6PR07MB4253; 6:Mjybs21wlkbeJ8dYaCvUw2xgN9t5zS9Tius4aGZiqJWpd92M5vBEXI08/0MjIQ3hwCWQEJHRgu24owB3dBTSBfBjv56gvw5wFNyviIfN3nBM+wTVJ/m+UsfVBuKx9bfdbMyUmFzttfULbhRW9bHc383g3IYMyD5N/nMaScaD6BU2kT2+YiXqqKYDZ/n+9OrP2Zz3CLVjlh3plE/nHhHkX3TBisw/QG3Hu06YZd8PlXwQf18Huh+Aj6UgNHZgglFeN2nAVpZPy5hLYfw9fht9raw4wFeGAi6b1PPBpQkimiCTPWhX8Z+TwQ8meTDrxzuVSV5VJJY+HYKvqlDVJ0QRSSejGbChQYAOnvzhAaBR3PhYKvcFw/MKBP5H65unM3T5tzDPg1M+jbSGVU1/a324awBhm7eqlOIh4qcqFKgzpp6Uj6o439Otxd+0QpFRCJIi9n+2VxdmgFVKc3zaiOqm2w==; 5:HFcpVZUzapt51Fdzmfb34DBVFL4AVw83L2NxnsMt2xa6rr3rf1KSQ7IPge0XTRLmHe9eJIKmJDllW0w7Un5Q4SkCjnjulgD0QXaYMFSIokWnntipBGH9x4nciC5W/hka26jMLB24tjHxymfnkezUOYr7zps5sd7jIBXmlKs5NFo=; 7:5KC7YDXxJBFf7jfeOqtc+UYSbQf7tVOjS2p+WcjwFAmbyAjMjTETLo9A3IaFXLjBtbnZk5Xe46wJa6rRH/9GV0RKLGZfxnMFyqwNu/Pgmp0Qi6zOWE+oX867qVuxh/rWBtSdOolvmzHKrUeBXmEKlA== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 2d017f55-5632-469f-addc-08d642fa52f6 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4253; x-ms-traffictypediagnostic: SN6PR07MB4253: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699)(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231382)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:SN6PR07MB4253; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4253; x-forefront-prvs: 08476BC6EF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39850400004)(366004)(346002)(136003)(396003)(376002)(199004)(189003)(13464003)(55016002)(110136005)(76176011)(26005)(6116002)(6506007)(6436002)(68736007)(55236004)(99286004)(3846002)(316002)(53936002)(81156014)(4744004)(2501003)(6246003)(71200400001)(14454004)(7736002)(8936002)(2900100001)(81166006)(2906002)(53946003)(8676002)(71190400001)(7696005)(9686003)(305945005)(2201001)(86362001)(72206003)(66066001)(5660300001)(25786009)(97736004)(256004)(102836004)(186003)(478600001)(229853002)(446003)(33656002)(11346002)(476003)(486006)(106356001)(105586002)(14444005)(74316002)(579004)(559001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4253; H:SN6PR07MB5152.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: s1moVAhHbCGFV7hyjA3aTHaRkRgIiNmcr5SPP5DgkHeb1QClUDxJdRLZwTD/ZLykAP08EcGBvJ8PS/LxCZHljkOGJE08o/V17JS+pa/rLbgdYReA9mo/RsYiTU1c2hkeWbDJNKqZhEn3v6EOuUyw3gmjgjylRiqbTcpFWuKpqG+IbARrfT/wO4b7KEuGhQOXT+oTaRLT+6nALIuzeIu3OBD1tWc0ZPU5MlNLvVKITIZmD8MLO0U5Ex799ZzkpBBm4N9dGaICthcCwTUAXxp66bf7Vr3EAoZbL5n+ViIm5ujYFeqkHl+dGATLQUW3MCEl3pDr/EY8yGrdffYo+w62kK9etSpdFE6dk3fDFFqJUVc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d017f55-5632-469f-addc-08d642fa52f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Nov 2018 08:40:21.9548 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4253 Subject: Re: [dpdk-dev] [PATCH v2 1/3] app/compress-perf: add parser X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Nov 2018 08:40:24 -0000 >-----Original Message----- >From: Tomasz Jozwiak >Sent: 02 November 2018 15:14 >To: dev@dpdk.org; fiona.trahe@intel.com; tomaszx.jozwiak@intel.com; Verma,= Shally ; >akhil.goyal@nxp.com >Subject: [PATCH v2 1/3] app/compress-perf: add parser > >External Email > >Added parser part into compression perf. test. > >Signed-off-by: De Lara Guarch, Pablo >Signed-off-by: Tomasz Jozwiak >--- > app/Makefile | 4 + > app/meson.build | 1 + > app/test-compress-perf/Makefile | 16 + > app/test-compress-perf/comp_perf_options.h | 59 +++ > app/test-compress-perf/comp_perf_options_parse.c | 596 ++++++++++++++++++= +++++ > app/test-compress-perf/main.c | 52 ++ > app/test-compress-perf/meson.build | 7 + > config/common_base | 5 + > 8 files changed, 740 insertions(+) > create mode 100644 app/test-compress-perf/Makefile > create mode 100644 app/test-compress-perf/comp_perf_options.h > create mode 100644 app/test-compress-perf/comp_perf_options_parse.c > create mode 100644 app/test-compress-perf/main.c > create mode 100644 app/test-compress-perf/meson.build > >diff --git a/app/Makefile b/app/Makefile >index 069fa98..d6641ef 100644 >--- a/app/Makefile >+++ b/app/Makefile >@@ -11,6 +11,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_BBDEV),y) > DIRS-$(CONFIG_RTE_TEST_BBDEV) +=3D test-bbdev > endif > >+ifeq ($(CONFIG_RTE_LIBRTE_COMPRESSDEV),y) >+DIRS-$(CONFIG_RTE_APP_COMPRESS_PERF) +=3D test-compress-perf >+endif >+ > ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) > DIRS-$(CONFIG_RTE_APP_CRYPTO_PERF) +=3D test-crypto-perf > endif >diff --git a/app/meson.build b/app/meson.build >index a9a026b..47a2a86 100644 >--- a/app/meson.build >+++ b/app/meson.build >@@ -4,6 +4,7 @@ > apps =3D ['pdump', > 'proc-info', > 'test-bbdev', >+ 'test-compress-perf', > 'test-crypto-perf', > 'test-eventdev', > 'test-pmd'] >diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Make= file >new file mode 100644 >index 0000000..8aa7a22 >--- /dev/null >+++ b/app/test-compress-perf/Makefile >@@ -0,0 +1,16 @@ >+# SPDX-License-Identifier: BSD-3-Clause >+# Copyright(c) 2018 Intel Corporation >+ >+include $(RTE_SDK)/mk/rte.vars.mk >+ >+APP =3D dpdk-test-compress-perf >+ >+CFLAGS +=3D $(WERROR_FLAGS) >+CFLAGS +=3D -DALLOW_EXPERIMENTAL_API >+CFLAGS +=3D -O3 >+ >+# all source are stored in SRCS-y >+SRCS-y :=3D main.c >+SRCS-y +=3D comp_perf_options_parse.c >+ >+include $(RTE_SDK)/mk/rte.app.mk >diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compres= s-perf/comp_perf_options.h >new file mode 100644 >index 0000000..7516ea0 >--- /dev/null >+++ b/app/test-compress-perf/comp_perf_options.h >@@ -0,0 +1,59 @@ >+/* SPDX-License-Identifier: BSD-3-Clause >+ * Copyright(c) 2018 Intel Corporation >+ */ >+ >+#define MAX_DRIVER_NAME 64 >+#define MAX_INPUT_FILE_NAME 64 >+#define MAX_LIST 32 >+ >+enum comp_operation { >+ COMPRESS_ONLY, >+ DECOMPRESS_ONLY, >+ COMPRESS_DECOMPRESS >+}; >+ >+struct range_list { >+ uint8_t min; >+ uint8_t max; >+ uint8_t inc; >+ uint8_t count; >+ uint8_t list[MAX_LIST]; >+}; >+ >+struct comp_test_data { >+ char driver_name[64]; >+ char input_file[64]; >+ struct rte_mbuf **comp_bufs; >+ struct rte_mbuf **decomp_bufs; >+ uint32_t total_bufs; >+ uint8_t *input_data; >+ size_t input_data_sz; >+ uint8_t *compressed_data; >+ uint8_t *decompressed_data; >+ struct rte_mempool *comp_buf_pool; >+ struct rte_mempool *decomp_buf_pool; >+ struct rte_mempool *op_pool; >+ int8_t cdev_id; >+ uint16_t seg_sz; >+ uint16_t burst_sz; >+ uint32_t pool_sz; >+ uint32_t num_iter; >+ uint16_t max_sgl_segs; >+ enum rte_comp_huffman huffman_enc; >+ enum comp_operation test_op; >+ int window_sz; >+ struct range_list level; >+ /* Store TSC duration for all levels (including level 0) */ >+ uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1]; >+ uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1]; >+}; >+ >+int >+comp_perf_options_parse(struct comp_test_data *test_data, int argc, >+ char **argv); >+ >+void >+comp_perf_options_default(struct comp_test_data *test_data); >+ >+int >+comp_perf_options_check(struct comp_test_data *test_data); >diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-c= ompress-perf/comp_perf_options_parse.c >new file mode 100644 >index 0000000..bef4d2f >--- /dev/null >+++ b/app/test-compress-perf/comp_perf_options_parse.c >@@ -0,0 +1,596 @@ >+/* SPDX-License-Identifier: BSD-3-Clause >+ * Copyright(c) 2018 Intel Corporation >+ */ >+ >+#include >+#include >+#include >+#include >+#include >+#include >+#include >+ >+#include >+#include >+ >+#include "comp_perf_options.h" >+ >+#define CPERF_DRIVER_NAME ("driver-name") >+#define CPERF_TEST_FILE ("input-file") >+#define CPERF_SEG_SIZE ("seg-sz") >+#define CPERF_BURST_SIZE ("burst-sz") >+#define CPERF_EXTENDED_SIZE ("extended-input-sz") >+#define CPERF_POOL_SIZE ("pool-sz") >+#define CPERF_MAX_SGL_SEGS ("max-num-sgl-segs") >+#define CPERF_NUM_ITER ("num-iter") >+#define CPERF_OPTYPE ("operation") >+#define CPERF_HUFFMAN_ENC ("huffman-enc") >+#define CPERF_LEVEL ("compress-level") >+#define CPERF_WINDOW_SIZE ("window-sz") >+ >+struct name_id_map { >+ const char *name; >+ uint32_t id; >+}; >+ >+static void >+usage(char *progname) >+{ >+ printf("%s [EAL options] --\n" >+ " --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" >+ " --seg-sz N: size of segment to store the data (default: = 2048)\n" >+ " --burst-sz N: compress operation burst size\n" >+ " --pool-sz N: mempool size for compress operations/mbufs\= n" >+ " (default: 8192)\n" >+ " --max-num-sgl-segs N: maximum number of segments for eac= h mbuf\n" We still taking it as input? >+ " (default: 65535)\n" >+ " --num-iter N: number of times the file will be\n" >+ " compressed/decompressed (default: 10000)\n= " >+ " --operation [comp/decomp/comp_and_decomp]: perform test = on\n" >+ " compression, decompression or both operati= ons\n" >+ " --huffman-enc [fixed/dynamic/default]: Huffman encoding\= n" >+ " (default: dynamic)\n" >+ " --compress-level N: compression level, which could be a = single value, list or range\n" >+ " (default: range between 1 and 9)\n" >+ " --window-sz N: base two log value of compression window = size\n" >+ " (e.g.: 15 =3D> 32k, default: max supported= by PMD)\n" >+ " -h: prints this help\n", >+ progname); >+} >+ >+static int >+get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len, >+ const char *str_key) >+{ >+ unsigned int i; >+ >+ for (i =3D 0; i < map_len; i++) { >+ >+ if (strcmp(str_key, map[i].name) =3D=3D 0) >+ return map[i].id; >+ } >+ >+ return -1; >+} >+ >+static int >+parse_uint32_t(uint32_t *value, const char *arg) >+{ >+ char *end =3D NULL; >+ unsigned long n =3D strtoul(arg, &end, 10); >+ >+ if ((optarg[0] =3D=3D '\0') || (end =3D=3D NULL) || (*end !=3D '\0= ')) >+ return -1; >+ >+ if (n > UINT32_MAX) >+ return -ERANGE; >+ >+ *value =3D (uint32_t) n; >+ >+ return 0; >+} >+ >+static int >+parse_uint16_t(uint16_t *value, const char *arg) >+{ >+ uint32_t val =3D 0; >+ int ret =3D parse_uint32_t(&val, arg); >+ >+ if (ret < 0) >+ return ret; >+ >+ if (val > UINT16_MAX) >+ return -ERANGE; >+ >+ *value =3D (uint16_t) val; >+ >+ return 0; >+} >+ >+static int >+parse_range(const char *arg, uint8_t *min, uint8_t *max, uint8_t *inc) >+{ >+ char *token; >+ uint8_t number; >+ >+ char *copy_arg =3D strdup(arg); >+ >+ if (copy_arg =3D=3D NULL) >+ return -1; >+ >+ errno =3D 0; >+ token =3D strtok(copy_arg, ":"); >+ >+ /* Parse minimum value */ >+ if (token !=3D NULL) { >+ number =3D strtoul(token, NULL, 10); >+ >+ if (errno =3D=3D EINVAL || errno =3D=3D ERANGE) >+ goto err_range; >+ >+ *min =3D number; >+ } else >+ goto err_range; >+ >+ token =3D strtok(NULL, ":"); >+ >+ /* Parse increment value */ >+ if (token !=3D NULL) { >+ number =3D strtoul(token, NULL, 10); >+ >+ if (errno =3D=3D EINVAL || errno =3D=3D ERANGE || >+ number =3D=3D 0) >+ goto err_range; >+ >+ *inc =3D number; >+ } else >+ goto err_range; >+ >+ token =3D strtok(NULL, ":"); >+ >+ /* Parse maximum value */ >+ if (token !=3D NULL) { >+ number =3D strtoul(token, NULL, 10); >+ >+ if (errno =3D=3D EINVAL || errno =3D=3D ERANGE || >+ number < *min) >+ goto err_range; >+ >+ *max =3D number; >+ } else >+ goto err_range; >+ >+ if (strtok(NULL, ":") !=3D NULL) >+ goto err_range; >+ >+ free(copy_arg); >+ return 0; >+ >+err_range: >+ free(copy_arg); >+ return -1; >+} >+ >+static int >+parse_list(const char *arg, uint8_t *list, uint8_t *min, uint8_t *max) >+{ >+ char *token; >+ uint32_t number; >+ uint8_t count =3D 0; >+ uint32_t temp_min; >+ uint32_t temp_max; >+ >+ char *copy_arg =3D strdup(arg); >+ >+ if (copy_arg =3D=3D NULL) >+ return -1; >+ >+ errno =3D 0; >+ token =3D strtok(copy_arg, ","); >+ >+ /* Parse first value */ >+ if (token !=3D NULL) { >+ number =3D strtoul(token, NULL, 10); >+ >+ if (errno =3D=3D EINVAL || errno =3D=3D ERANGE) >+ goto err_list; >+ >+ list[count++] =3D number; >+ temp_min =3D number; >+ temp_max =3D number; >+ } else >+ goto err_list; >+ >+ token =3D strtok(NULL, ","); >+ >+ while (token !=3D NULL) { >+ if (count =3D=3D MAX_LIST) { >+ RTE_LOG(WARNING, USER1, >+ "Using only the first %u sizes\n", >+ MAX_LIST); >+ break; >+ } >+ >+ number =3D strtoul(token, NULL, 10); >+ >+ if (errno =3D=3D EINVAL || errno =3D=3D ERANGE) >+ goto err_list; >+ >+ list[count++] =3D number; >+ >+ if (number < temp_min) >+ temp_min =3D number; >+ if (number > temp_max) >+ temp_max =3D number; >+ >+ token =3D strtok(NULL, ","); >+ } >+ >+ if (min) >+ *min =3D temp_min; >+ if (max) >+ *max =3D temp_max; >+ >+ free(copy_arg); >+ return count; >+ >+err_list: >+ free(copy_arg); >+ return -1; >+} >+ >+static int >+parse_num_iter(struct comp_test_data *test_data, const char *arg) >+{ >+ int ret =3D parse_uint32_t(&test_data->num_iter, arg); >+ >+ if (ret) { >+ RTE_LOG(ERR, USER1, "Failed to parse total iteration count= \n"); >+ return -1; >+ } >+ >+ if (test_data->num_iter =3D=3D 0) { >+ RTE_LOG(ERR, USER1, >+ "Total number of iterations must be higher= than 0\n"); >+ return -1; >+ } >+ >+ return ret; >+} >+ >+static int >+parse_pool_sz(struct comp_test_data *test_data, const char *arg) >+{ >+ int ret =3D parse_uint32_t(&test_data->pool_sz, arg); >+ >+ if (ret) { >+ RTE_LOG(ERR, USER1, "Failed to parse pool size"); >+ return -1; >+ } >+ >+ if (test_data->pool_sz =3D=3D 0) { >+ RTE_LOG(ERR, USER1, "Pool size must be higher than 0\n"); >+ return -1; >+ } >+ >+ return ret; >+} >+ >+static int >+parse_burst_sz(struct comp_test_data *test_data, const char *arg) >+{ >+ int ret =3D parse_uint16_t(&test_data->burst_sz, arg); >+ >+ if (ret) { >+ RTE_LOG(ERR, USER1, "Failed to parse burst size/s\n"); >+ return -1; >+ } >+ >+ if (test_data->burst_sz =3D=3D 0) { >+ RTE_LOG(ERR, USER1, "Burst size must be higher than 0\n"); >+ return -1; >+ } >+ >+ return 0; >+} >+ >+static int >+parse_extended_input_sz(struct comp_test_data *test_data, const char *arg= ) >+{ >+ uint32_t tmp; >+ int ret =3D parse_uint32_t(&tmp, arg); >+ >+ if (ret) { >+ RTE_LOG(ERR, USER1, "Failed to parse extended input size\n= "); >+ return -1; >+ } >+ test_data->input_data_sz =3D tmp; >+ >+ if (tmp =3D=3D 0) { >+ RTE_LOG(ERR, USER1, >+ "Extended file size must be higher than 0\n"); >+ return -1; >+ } >+ return 0; >+} >+ >+static int >+parse_seg_sz(struct comp_test_data *test_data, const char *arg) >+{ >+ int ret =3D parse_uint16_t(&test_data->seg_sz, arg); >+ >+ if (ret) { >+ RTE_LOG(ERR, USER1, "Failed to parse segment size\n"); >+ return -1; >+ } >+ >+ if (test_data->seg_sz =3D=3D 0) { >+ RTE_LOG(ERR, USER1, "Segment size must be higher than 0\n"= ); >+ return -1; >+ } >+ >+ return 0; >+} >+ >+static int >+parse_max_num_sgl_segs(struct comp_test_data *test_data, const char *arg) >+{ >+ int ret =3D parse_uint16_t(&test_data->max_sgl_segs, arg); >+ >+ if (ret) { >+ RTE_LOG(ERR, USER1, >+ "Failed to parse max number of segments per mbuf c= hain\n"); >+ return -1; >+ } >+ >+ if (test_data->max_sgl_segs =3D=3D 0) { >+ RTE_LOG(ERR, USER1, "Max number of segments per mbuf chain= " >+ "must be higher than 0\n"); >+ return -1; >+ } >+ >+ return 0; >+} >+ >+static int >+parse_window_sz(struct comp_test_data *test_data, const char *arg) >+{ >+ int ret =3D parse_uint16_t((uint16_t *)&test_data->window_sz, arg)= ; >+ >+ if (ret) { >+ RTE_LOG(ERR, USER1, "Failed to parse window size\n"); >+ return -1; >+ } >+ >+ return 0; >+} >+ >+static int >+parse_driver_name(struct comp_test_data *test_data, const char *arg) >+{ >+ if (strlen(arg) > (sizeof(test_data->driver_name) - 1)) >+ return -1; >+ >+ rte_strlcpy(test_data->driver_name, arg, >+ sizeof(test_data->driver_name)); >+ >+ return 0; >+} >+ >+static int >+parse_test_file(struct comp_test_data *test_data, const char *arg) >+{ >+ if (strlen(arg) > (sizeof(test_data->input_file) - 1)) >+ return -1; >+ >+ rte_strlcpy(test_data->input_file, arg, sizeof(test_data->input_fi= le)); >+ >+ return 0; >+} >+ >+static int >+parse_op_type(struct comp_test_data *test_data, const char *arg) >+{ >+ struct name_id_map optype_namemap[] =3D { >+ { >+ "comp", >+ COMPRESS_ONLY >+ }, >+ { >+ "decomp", >+ DECOMPRESS_ONLY >+ }, >+ { >+ "comp_and_decomp", >+ COMPRESS_DECOMPRESS >+ } >+ }; >+ >+ int id =3D get_str_key_id_mapping(optype_namemap, >+ RTE_DIM(optype_namemap), arg); >+ if (id < 0) { >+ RTE_LOG(ERR, USER1, "Invalid operation type specified\n"); >+ return -1; >+ } >+ >+ test_data->test_op =3D (enum comp_operation)id; >+ >+ return 0; >+} >+ >+static int >+parse_huffman_enc(struct comp_test_data *test_data, const char *arg) >+{ >+ struct name_id_map huffman_namemap[] =3D { >+ { >+ "default", >+ RTE_COMP_HUFFMAN_DEFAULT >+ }, >+ { >+ "fixed", >+ RTE_COMP_HUFFMAN_FIXED >+ }, >+ { >+ "dynamic", >+ RTE_COMP_HUFFMAN_DYNAMIC >+ } >+ }; >+ >+ int id =3D get_str_key_id_mapping(huffman_namemap, >+ RTE_DIM(huffman_namemap), arg); >+ if (id < 0) { >+ RTE_LOG(ERR, USER1, "Invalid Huffmane encoding specified\n= "); >+ return -1; >+ } >+ >+ test_data->huffman_enc =3D (enum rte_comp_huffman)id; >+ >+ return 0; >+} >+ >+static int >+parse_level(struct comp_test_data *test_data, const char *arg) >+{ >+ int ret; >+ >+ /* >+ * Try parsing the argument as a range, if it fails, >+ * arse it as a list >+ */ >+ if (parse_range(arg, &test_data->level.min, &test_data->level.max, >+ &test_data->level.inc) < 0) { >+ ret =3D parse_list(arg, test_data->level.list, >+ &test_data->level.min, >+ &test_data->level.max); >+ if (ret < 0) { >+ RTE_LOG(ERR, USER1, >+ "Failed to parse compression level/s\n"); >+ return -1; >+ } >+ test_data->level.count =3D ret; >+ >+ if (test_data->level.max > RTE_COMP_LEVEL_MAX) { >+ RTE_LOG(ERR, USER1, "Level cannot be higher than %= u\n", >+ RTE_COMP_LEVEL_MAX); >+ return -1; >+ } >+ } >+ >+ return 0; >+} >+ >+typedef int (*option_parser_t)(struct comp_test_data *test_data, >+ const char *arg); >+ >+struct long_opt_parser { >+ const char *lgopt_name; >+ option_parser_t parser_fn; >+ >+}; >+ >+static struct option lgopts[] =3D { >+ >+ { CPERF_DRIVER_NAME, required_argument, 0, 0 }, >+ { CPERF_TEST_FILE, required_argument, 0, 0 }, >+ { CPERF_SEG_SIZE, required_argument, 0, 0 }, >+ { CPERF_BURST_SIZE, required_argument, 0, 0 }, >+ { CPERF_EXTENDED_SIZE, required_argument, 0, 0 }, >+ { CPERF_POOL_SIZE, required_argument, 0, 0 }, >+ { CPERF_MAX_SGL_SEGS, required_argument, 0, 0}, >+ { CPERF_NUM_ITER, required_argument, 0, 0 }, >+ { CPERF_OPTYPE, required_argument, 0, 0 }, >+ { CPERF_HUFFMAN_ENC, required_argument, 0, 0 }, >+ { CPERF_LEVEL, required_argument, 0, 0 }, >+ { CPERF_WINDOW_SIZE, required_argument, 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[] =3D { >+ { CPERF_DRIVER_NAME, parse_driver_name }, >+ { CPERF_TEST_FILE, parse_test_file }, >+ { CPERF_SEG_SIZE, parse_seg_sz }, >+ { CPERF_BURST_SIZE, parse_burst_sz }, >+ { CPERF_EXTENDED_SIZE, parse_extended_input_sz }, >+ { CPERF_POOL_SIZE, parse_pool_sz }, >+ { CPERF_MAX_SGL_SEGS, parse_max_num_sgl_segs }, >+ { CPERF_NUM_ITER, parse_num_iter }, >+ { CPERF_OPTYPE, parse_op_type }, >+ { CPERF_HUFFMAN_ENC, parse_huffman_enc }, >+ { CPERF_LEVEL, parse_level }, >+ { CPERF_WINDOW_SIZE, parse_window_sz }, >+ }; >+ unsigned int i; >+ >+ for (i =3D 0; i < RTE_DIM(parsermap); i++) { >+ if (strncmp(lgopts[opt_idx].name, parsermap[i].lgopt_name, >+ strlen(lgopts[opt_idx].name)) =3D=3D 0) >+ return parsermap[i].parser_fn(test_data, optarg); >+ } >+ >+ return -EINVAL; >+} >+ >+int >+comp_perf_options_parse(struct comp_test_data *test_data, int argc, char = **argv) >+{ >+ int opt, retval, opt_idx; >+ >+ while ((opt =3D getopt_long(argc, argv, "h", lgopts, &opt_idx)) != =3D EOF) { >+ switch (opt) { >+ case 'h': >+ usage(argv[0]); >+ rte_exit(EXIT_SUCCESS, "Displayed help\n"); >+ break; >+ /* long options */ >+ case 0: >+ retval =3D comp_perf_opts_parse_long(opt_idx, test= _data); >+ if (retval !=3D 0) >+ return retval; >+ >+ break; >+ >+ default: >+ usage(argv[0]); >+ return -EINVAL; >+ } >+ } >+ >+ return 0; >+} >+ >+void >+comp_perf_options_default(struct comp_test_data *test_data) >+{ >+ test_data->cdev_id =3D -1; >+ test_data->seg_sz =3D 2048; >+ test_data->burst_sz =3D 32; >+ test_data->pool_sz =3D 8192; >+ test_data->max_sgl_segs =3D UINT16_MAX; >+ test_data->num_iter =3D 10000; >+ test_data->huffman_enc =3D RTE_COMP_HUFFMAN_DYNAMIC; >+ test_data->test_op =3D COMPRESS_DECOMPRESS; >+ test_data->window_sz =3D -1; >+ test_data->level.min =3D 1; >+ test_data->level.max =3D 9; >+ test_data->level.inc =3D 1; >+} >+ >+int >+comp_perf_options_check(struct comp_test_data *test_data) >+{ >+ if (strcmp(test_data->driver_name, "") =3D=3D 0) { >+ RTE_LOG(ERR, USER1, "Driver name has to be set\n"); >+ return -1; >+ } >+ >+ if (strcmp(test_data->input_file, "") =3D=3D 0) { >+ RTE_LOG(ERR, USER1, "Input file name has to be set\n"); >+ return -1; >+ } Think other params such as window sz , Huffman coding level too should be t= est and adjusted according to driver capability Thanks Shally >+ >+ return 0; >+} >diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c >new file mode 100644 >index 0000000..f52b98d >--- /dev/null >+++ b/app/test-compress-perf/main.c >@@ -0,0 +1,52 @@ >+/* SPDX-License-Identifier: BSD-3-Clause >+ * Copyright(c) 2018 Intel Corporation >+ */ >+ >+#include >+#include >+#include >+#include >+ >+#include "comp_perf_options.h" >+ >+int >+main(int argc, char **argv) >+{ >+ int ret; >+ struct comp_test_data *test_data; >+ >+ /* Initialise DPDK EAL */ >+ ret =3D rte_eal_init(argc, argv); >+ if (ret < 0) >+ rte_exit(EXIT_FAILURE, "Invalid EAL arguments!\n"); >+ argc -=3D ret; >+ argv +=3D ret; >+ >+ test_data =3D rte_zmalloc_socket(NULL, sizeof(struct comp_test_dat= a), >+ 0, rte_socket_id()); >+ >+ if (test_data =3D=3D NULL) >+ rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d= \n", >+ rte_socket_id()); >+ >+ comp_perf_options_default(test_data); >+ >+ if (comp_perf_options_parse(test_data, argc, argv) < 0) { >+ RTE_LOG(ERR, USER1, >+ "Parsing one or more user options failed\n"); >+ ret =3D EXIT_FAILURE; >+ goto err; >+ } >+ >+ if (comp_perf_options_check(test_data) < 0) { >+ ret =3D EXIT_FAILURE; >+ goto err; >+ } >+ >+ ret =3D EXIT_SUCCESS; >+ >+err: >+ rte_free(test_data); >+ >+ return ret; >+} >diff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/m= eson.build >new file mode 100644 >index 0000000..ba6d64d >--- /dev/null >+++ b/app/test-compress-perf/meson.build >@@ -0,0 +1,7 @@ >+# SPDX-License-Identifier: BSD-3-Clause >+# Copyright(c) 2018 Intel Corporation >+ >+allow_experimental_apis =3D true >+sources =3D files('comp_perf_options_parse.c', >+ 'main.c') >+deps =3D ['compressdev'] >diff --git a/config/common_base b/config/common_base >index d12ae98..2ab4b7b 100644 >--- a/config/common_base >+++ b/config/common_base >@@ -949,6 +949,11 @@ CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=3Dn > CONFIG_RTE_TEST_BBDEV=3Dy > > # >+# Compile the compression performance application >+# >+CONFIG_RTE_APP_COMPRESS_PERF=3Dy >+ >+# > # Compile the crypto performance application > # > CONFIG_RTE_APP_CRYPTO_PERF=3Dy >-- >2.7.4