From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E301EA0679 for ; Tue, 2 Apr 2019 14:22:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE912343C; Tue, 2 Apr 2019 14:22:55 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 2EDEE2E81 for ; Tue, 2 Apr 2019 14:22:53 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Apr 2019 05:22:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,300,1549958400"; d="scan'208";a="145912037" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 02 Apr 2019 05:22:53 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 2 Apr 2019 05:22:53 -0700 Received: from hasmsx112.ger.corp.intel.com (10.184.198.40) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 2 Apr 2019 05:22:52 -0700 Received: from hasmsx111.ger.corp.intel.com ([169.254.5.74]) by HASMSX112.ger.corp.intel.com ([169.254.11.157]) with mapi id 14.03.0415.000; Tue, 2 Apr 2019 15:22:49 +0300 From: "Cel, TomaszX" To: "dev@dpdk.org" , "Trahe, Fiona" , "Jozwiak, TomaszX" Thread-Topic: [PATCH v2 1/1] test/compress: add max mbuf size test case Thread-Index: AQHU6U4GEfiNkDXXxEe4ZwM6uYwzLKYoyeWg Date: Tue, 2 Apr 2019 12:22:49 +0000 Message-ID: References: <1550223873-17119-3-git-send-email-tomaszx.jozwiak@intel.com> <1554207413-19049-1-git-send-email-tomaszx.cel@intel.com> <1554207413-19049-2-git-send-email-tomaszx.cel@intel.com> In-Reply-To: <1554207413-19049-2-git-send-email-tomaszx.cel@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDY2NmY4MmMtYTZiMy00ZmMwLTk2YWEtOTE2M2YzZWE3ODBhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTzZqdTBoandIaloxNnNQb3Z5Z0FISjJ3bE5SY0M1XC9oVFhVS0J3bUtyVHJwdUtWWU15Znl1VHRVVjJCRkh1ZEkifQ== dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.103.104.47] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/1] test/compress: add max mbuf size test case 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190402122249.EdsZs7cmBtLDQWn4d3Y8n71LUspquU0og5Tk1g_WXas@z> Hi Tomasz, > -----Original Message----- > From: Cel, TomaszX > Sent: Tuesday, April 2, 2019 1:17 PM > To: dev@dpdk.org; Trahe, Fiona ; Jozwiak, TomaszX > ; Cel, TomaszX > Subject: [PATCH v2 1/1] test/compress: add max mbuf size test case >=20 > From: Tomasz Jozwiak >=20 > This patch adds new test case in which max. size of chain mbufs has been > used to compress random data dynamically. >=20 > Signed-off-by: Tomasz Jozwiak > --- > app/test/test_compressdev.c | 158 > ++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 136 insertions(+), 22 deletions(-) >=20 > diff --git a/app/test/test_compressdev.c b/app/test/test_compressdev.c > index 13cf26c..f59b3d2 100644 > --- a/app/test/test_compressdev.c > +++ b/app/test/test_compressdev.c > @@ -1,10 +1,10 @@ > /* SPDX-License-Identifier: BSD-3-Clause > - * Copyright(c) 2018 Intel Corporation > + * Copyright(c) 2018 - 2019 Intel Corporation > */ > #include > #include > #include > -#include > +#include >=20 > #include > #include > @@ -45,6 +45,11 @@ >=20 > #define OUT_OF_SPACE_BUF 1 >=20 > +#define MAX_MBUF_SEGMENT_SIZE 65535 > +#define MAX_DATA_MBUF_SIZE (MAX_MBUF_SEGMENT_SIZE - > +RTE_PKTMBUF_HEADROOM) #define NUM_BIG_MBUFS 4 #define > +BIG_DATA_TEST_SIZE (MAX_DATA_MBUF_SIZE * NUM_BIG_MBUFS / 2) > + > const char * > huffman_type_strings[] =3D { > [RTE_COMP_HUFFMAN_DEFAULT] =3D "PMD default", > @@ -73,6 +78,7 @@ struct priv_op_data { > struct comp_testsuite_params { > struct rte_mempool *large_mbuf_pool; > struct rte_mempool *small_mbuf_pool; > + struct rte_mempool *big_mbuf_pool; > struct rte_mempool *op_pool; > struct rte_comp_xform *def_comp_xform; > struct rte_comp_xform *def_decomp_xform; @@ -92,6 +98,7 @@ > struct test_data_params { > enum varied_buff buff_type; > enum zlib_direction zlib_dir; > unsigned int out_of_space; > + unsigned int big_data; > }; >=20 > static struct comp_testsuite_params testsuite_params =3D { 0 }; @@ -105,= 11 > +112,14 @@ testsuite_teardown(void) > RTE_LOG(ERR, USER1, "Large mbuf pool still has unfreed > bufs\n"); > if (rte_mempool_in_use_count(ts_params->small_mbuf_pool)) > RTE_LOG(ERR, USER1, "Small mbuf pool still has unfreed > bufs\n"); > + if (rte_mempool_in_use_count(ts_params->big_mbuf_pool)) > + RTE_LOG(ERR, USER1, "Big mbuf pool still has unfreed > bufs\n"); > if (rte_mempool_in_use_count(ts_params->op_pool)) > RTE_LOG(ERR, USER1, "op pool still has unfreed ops\n"); >=20 > rte_mempool_free(ts_params->large_mbuf_pool); > rte_mempool_free(ts_params->small_mbuf_pool); > + rte_mempool_free(ts_params->big_mbuf_pool); > rte_mempool_free(ts_params->op_pool); > rte_free(ts_params->def_comp_xform); > rte_free(ts_params->def_decomp_xform); > @@ -162,6 +172,17 @@ testsuite_setup(void) > goto exit; > } >=20 > + /* Create mempool with big buffers for SGL testing */ > + ts_params->big_mbuf_pool =3D > rte_pktmbuf_pool_create("big_mbuf_pool", > + NUM_BIG_MBUFS + 1, > + CACHE_SIZE, 0, > + MAX_MBUF_SEGMENT_SIZE, > + rte_socket_id()); > + if (ts_params->big_mbuf_pool =3D=3D NULL) { > + RTE_LOG(ERR, USER1, "Big mbuf pool could not be > created\n"); > + goto exit; > + } > + > ts_params->op_pool =3D rte_comp_op_pool_create("op_pool", > NUM_OPS, > 0, sizeof(struct priv_op_data), > rte_socket_id()); > @@ -598,10 +619,11 @@ prepare_sgl_bufs(const char *test_buf, struct > rte_mbuf *head_buf, > uint32_t total_data_size, > struct rte_mempool *small_mbuf_pool, > struct rte_mempool *large_mbuf_pool, > - uint8_t limit_segs_in_sgl) > + uint8_t limit_segs_in_sgl, > + uint16_t seg_size) > { > uint32_t remaining_data =3D total_data_size; > - uint16_t num_remaining_segs =3D DIV_CEIL(remaining_data, > SMALL_SEG_SIZE); > + uint16_t num_remaining_segs =3D DIV_CEIL(remaining_data, > seg_size); > struct rte_mempool *pool; > struct rte_mbuf *next_seg; > uint32_t data_size; > @@ -617,10 +639,10 @@ prepare_sgl_bufs(const char *test_buf, struct > rte_mbuf *head_buf, > * Allocate data in the first segment (header) and > * copy data if test buffer is provided > */ > - if (remaining_data < SMALL_SEG_SIZE) > + if (remaining_data < seg_size) > data_size =3D remaining_data; > else > - data_size =3D SMALL_SEG_SIZE; > + data_size =3D seg_size; > buf_ptr =3D rte_pktmbuf_append(head_buf, data_size); > if (buf_ptr =3D=3D NULL) { > RTE_LOG(ERR, USER1, > @@ -644,13 +666,13 @@ prepare_sgl_bufs(const char *test_buf, struct > rte_mbuf *head_buf, >=20 > if (i =3D=3D (num_remaining_segs - 1)) { > /* last segment */ > - if (remaining_data > SMALL_SEG_SIZE) > + if (remaining_data > seg_size) > pool =3D large_mbuf_pool; > else > pool =3D small_mbuf_pool; > data_size =3D remaining_data; > } else { > - data_size =3D SMALL_SEG_SIZE; > + data_size =3D seg_size; > pool =3D small_mbuf_pool; > } >=20 > @@ -704,6 +726,7 @@ test_deflate_comp_decomp(const struct > interim_data_params *int_data, > enum rte_comp_op_type state =3D test_data->state; > unsigned int buff_type =3D test_data->buff_type; > unsigned int out_of_space =3D test_data->out_of_space; > + unsigned int big_data =3D test_data->big_data; > enum zlib_direction zlib_dir =3D test_data->zlib_dir; > int ret_status =3D -1; > int ret; > @@ -738,7 +761,9 @@ test_deflate_comp_decomp(const struct > interim_data_params *int_data, > memset(ops_processed, 0, sizeof(struct rte_comp_op *) * > num_bufs); > memset(priv_xforms, 0, sizeof(void *) * num_bufs); >=20 > - if (buff_type =3D=3D SGL_BOTH) > + if (big_data) > + buf_pool =3D ts_params->big_mbuf_pool; > + else if (buff_type =3D=3D SGL_BOTH) > buf_pool =3D ts_params->small_mbuf_pool; > else > buf_pool =3D ts_params->large_mbuf_pool; @@ -757,10 > +782,11 @@ test_deflate_comp_decomp(const struct interim_data_params > *int_data, > for (i =3D 0; i < num_bufs; i++) { > data_size =3D strlen(test_bufs[i]) + 1; > if (prepare_sgl_bufs(test_bufs[i], uncomp_bufs[i], > - data_size, > - ts_params->small_mbuf_pool, > - ts_params->large_mbuf_pool, > - MAX_SEGS) < 0) > + data_size, > + big_data ? buf_pool : ts_params- > >small_mbuf_pool, > + big_data ? buf_pool : ts_params- > >large_mbuf_pool, > + big_data ? 0 : MAX_SEGS, > + big_data ? MAX_DATA_MBUF_SIZE : > SMALL_SEG_SIZE) < 0) > goto exit; > } > } else { > @@ -789,10 +815,12 @@ test_deflate_comp_decomp(const struct > interim_data_params *int_data, > COMPRESS_BUF_SIZE_RATIO); >=20 > if (prepare_sgl_bufs(NULL, comp_bufs[i], > - data_size, > - ts_params->small_mbuf_pool, > - ts_params->large_mbuf_pool, > - MAX_SEGS) < 0) > + data_size, > + big_data ? buf_pool : ts_params- > >small_mbuf_pool, > + big_data ? buf_pool : ts_params- > >large_mbuf_pool, > + big_data ? 0 : MAX_SEGS, > + big_data ? MAX_DATA_MBUF_SIZE : > SMALL_SEG_SIZE) > + < 0) > goto exit; > } >=20 > @@ -1017,10 +1045,12 @@ test_deflate_comp_decomp(const struct > interim_data_params *int_data, > strlen(test_bufs[priv_data->orig_idx]) + 1; >=20 > if (prepare_sgl_bufs(NULL, uncomp_bufs[i], > - data_size, > - ts_params->small_mbuf_pool, > - ts_params->large_mbuf_pool, > - MAX_SEGS) < 0) > + data_size, > + big_data ? buf_pool : ts_params- > >small_mbuf_pool, > + big_data ? buf_pool : ts_params- > >large_mbuf_pool, > + big_data ? 0 : MAX_SEGS, > + big_data ? MAX_DATA_MBUF_SIZE : > SMALL_SEG_SIZE) > + < 0) > goto exit; > } >=20 > @@ -1320,6 +1350,7 @@ test_compressdev_deflate_stateless_fixed(void) > RTE_COMP_OP_STATELESS, > LB_BOTH, > ZLIB_DECOMPRESS, > + 0, > 0 > }; >=20 > @@ -1390,6 +1421,7 @@ > test_compressdev_deflate_stateless_dynamic(void) > RTE_COMP_OP_STATELESS, > LB_BOTH, > ZLIB_DECOMPRESS, > + 0, > 0 > }; >=20 > @@ -1443,6 +1475,7 @@ > test_compressdev_deflate_stateless_multi_op(void) > RTE_COMP_OP_STATELESS, > LB_BOTH, > ZLIB_DECOMPRESS, > + 0, > 0 > }; >=20 > @@ -1492,6 +1525,7 @@ > test_compressdev_deflate_stateless_multi_level(void) > RTE_COMP_OP_STATELESS, > LB_BOTH, > ZLIB_DECOMPRESS, > + 0, > 0 > }; >=20 > @@ -1581,6 +1615,7 @@ > test_compressdev_deflate_stateless_multi_xform(void) > RTE_COMP_OP_STATELESS, > LB_BOTH, > ZLIB_DECOMPRESS, > + 0, > 0 > }; >=20 > @@ -1626,6 +1661,7 @@ test_compressdev_deflate_stateless_sgl(void) > RTE_COMP_OP_STATELESS, > SGL_BOTH, > ZLIB_DECOMPRESS, > + 0, > 0 > }; >=20 > @@ -1733,6 +1769,7 @@ > test_compressdev_deflate_stateless_checksum(void) > RTE_COMP_OP_STATELESS, > LB_BOTH, > ZLIB_DECOMPRESS, > + 0, > 0 > }; >=20 > @@ -1863,7 +1900,8 @@ test_compressdev_out_of_space_buffer(void) > RTE_COMP_OP_STATELESS, > LB_BOTH, > ZLIB_DECOMPRESS, > - 1 > + 1, > + 0 > }; > /* Compress with compressdev, decompress with Zlib */ > test_data.zlib_dir =3D ZLIB_DECOMPRESS; > @@ -1904,6 +1942,80 @@ test_compressdev_out_of_space_buffer(void) > return ret; > } >=20 > +static int > +test_compressdev_deflate_stateless_dynamic_big(void) > +{ > + struct comp_testsuite_params *ts_params =3D &testsuite_params; > + uint16_t i =3D 0; > + int ret =3D TEST_SUCCESS; > + const struct rte_compressdev_capabilities *capab; > + char *test_buffer =3D NULL; > + > + capab =3D rte_compressdev_capability_get(0, > RTE_COMP_ALGO_DEFLATE); > + TEST_ASSERT(capab !=3D NULL, "Failed to retrieve device capabilities"); > + > + if ((capab->comp_feature_flags & > RTE_COMP_FF_HUFFMAN_DYNAMIC) =3D=3D 0) > + return -ENOTSUP; > + > + if ((capab->comp_feature_flags & > RTE_COMP_FF_OOP_SGL_IN_SGL_OUT) =3D=3D 0) > + return -ENOTSUP; > + > + test_buffer =3D rte_malloc(NULL, BIG_DATA_TEST_SIZE, 0); > + if (test_buffer =3D=3D NULL) { > + RTE_LOG(ERR, USER1, > + "Can't allocate buffer for big-data\n"); > + return TEST_FAILED; > + } > + > + struct interim_data_params int_data =3D { > + (const char * const *)&test_buffer, > + 1, > + NULL, > + &ts_params->def_comp_xform, > + &ts_params->def_decomp_xform, > + 1 > + }; > + > + struct test_data_params test_data =3D { > + RTE_COMP_OP_STATELESS, > + SGL_BOTH, > + ZLIB_DECOMPRESS, > + 0, > + 1 > + }; > + > + ts_params->def_comp_xform->compress.deflate.huffman =3D > + > RTE_COMP_HUFFMAN_DYNAMIC; > + > + /* fill the buffer with data based on rand. data */ > + srand(BIG_DATA_TEST_SIZE); > + for (uint32_t i =3D 0; i < BIG_DATA_TEST_SIZE - 1; ++i) > + test_buffer[i] =3D (uint8_t)(rand() % ((uint8_t)-1)) | 1; > + > + test_buffer[BIG_DATA_TEST_SIZE-1] =3D 0; > + int_data.buf_idx =3D &i; > + > + /* Compress with compressdev, decompress with Zlib */ > + test_data.zlib_dir =3D ZLIB_DECOMPRESS; > + if (test_deflate_comp_decomp(&int_data, &test_data) < 0) { > + ret =3D TEST_FAILED; > + goto end; > + } > + > + /* Compress with Zlib, decompress with compressdev */ > + test_data.zlib_dir =3D ZLIB_COMPRESS; > + if (test_deflate_comp_decomp(&int_data, &test_data) < 0) { > + ret =3D TEST_FAILED; > + goto end; > + } > + > +end: > + ts_params->def_comp_xform->compress.deflate.huffman =3D > + > RTE_COMP_HUFFMAN_DEFAULT; > + rte_free(test_buffer); > + return ret; > +} > + >=20 > static struct unit_test_suite compressdev_testsuite =3D { > .suite_name =3D "compressdev unit test suite", @@ -1917,6 +2029,8 > @@ static struct unit_test_suite compressdev_testsuite =3D { > TEST_CASE_ST(generic_ut_setup, generic_ut_teardown, > test_compressdev_deflate_stateless_dynamic), > TEST_CASE_ST(generic_ut_setup, generic_ut_teardown, > + test_compressdev_deflate_stateless_dynamic_big), > + TEST_CASE_ST(generic_ut_setup, generic_ut_teardown, > test_compressdev_deflate_stateless_multi_op), > TEST_CASE_ST(generic_ut_setup, generic_ut_teardown, > test_compressdev_deflate_stateless_multi_level), > -- > 2.7.4 Acked-by: Tomasz Cel