[dpdk-dev] [PATCH v4 1/5] test/compress: add initial unit tests
De Lara Guarch, Pablo
pablo.de.lara.guarch at intel.com
Mon May 14 10:40:21 CEST 2018
> -----Original Message-----
> From: Verma, Shally [mailto:Shally.Verma at cavium.com]
> Sent: Monday, May 14, 2018 9:29 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>; dev at dpdk.org
> Cc: Trahe, Fiona <fiona.trahe at intel.com>; Daly, Lee <lee.daly at intel.com>;
> ahmed.mansour at nxp.com; Gupta, Ashish <Ashish.Gupta at cavium.com>; Gupta,
> Ashish <Ashish.Gupta at cavium.com>
> Subject: RE: [PATCH v4 1/5] test/compress: add initial unit tests
>
>
>
> >-----Original Message-----
> >From: Pablo de Lara [mailto:pablo.de.lara.guarch at intel.com]
> >Sent: 04 May 2018 15:52
> >To: dev at dpdk.org
> >Cc: fiona.trahe at intel.com; lee.daly at intel.com; Verma, Shally
> ><Shally.Verma at cavium.com>; ahmed.mansour at nxp.com; Gupta, Ashish
> ><Ashish.Gupta at cavium.com>; Pablo de Lara
> ><pablo.de.lara.guarch at intel.com>; Gupta, Ashish
> ><Ashish.Gupta at cavium.com>; Verma, Shally <Shally.Verma at cavium.com>
> >Subject: [PATCH v4 1/5] test/compress: add initial unit tests
> >
> >This commit introduces the initial tests for compressdev, performing
> >basic compression and decompression operations of sample test buffers,
> >using the Zlib library in one direction and compressdev in another
> >direction, to make sure that the library is compatible with Zlib.
> >
> >Due to the use of Zlib API, the test is disabled by default, to avoid
> >adding a new dependency on DPDK.
> >
> >Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> >Signed-off-by: Ashish Gupta <ashish.gupta at caviumnetworks.com>
> >Signed-off-by: Shally Verma <shally.verma at caviumnetworks.com>
> >Acked-by: Lee Daly <lee.daly at intel.com>
> >---
> > config/common_base | 5 +
> > test/test/Makefile | 9 +
> > test/test/meson.build | 8 +
> > test/test/test_compressdev.c | 725 +++++++++++++++++++++++
> > test/test/test_compressdev_test_buffer.h | 295 +++++++++
> > 5 files changed, 1042 insertions(+)
> > create mode 100644 test/test/test_compressdev.c create mode 100644
> >test/test/test_compressdev_test_buffer.h
> >
> //snip
>
> >+ * Compresses and decompresses buffer with compressdev API and Zlib
> >+API */ static int test_deflate_comp_decomp(const char *test_buffer,
> >+ struct rte_comp_xform *compress_xform,
> >+ struct rte_comp_xform *decompress_xform,
> >+ enum rte_comp_op_type state,
> >+ enum zlib_direction zlib_dir)
> >+{
> >+ struct comp_testsuite_params *ts_params = &testsuite_params;
> >+ int ret_status = -1;
> >+ int ret;
> >+ struct rte_mbuf *comp_buf = NULL;
> >+ struct rte_mbuf *uncomp_buf = NULL;
> >+ struct rte_comp_op *op = NULL;
> >+ struct rte_comp_op *op_processed = NULL;
> >+ void *priv_xform = NULL;
> >+ uint16_t num_deqd;
> >+ unsigned int deqd_retries = 0;
> >+ char *data_ptr;
> >+
> >+ /* Prepare the source mbuf with the data */
> >+ uncomp_buf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
> >+ if (uncomp_buf == NULL) {
> >+ RTE_LOG(ERR, USER1,
> >+ "Source mbuf could not be allocated "
> >+ "from the mempool\n");
> >+ goto exit;
> >+ }
> >+
> >+ data_ptr = rte_pktmbuf_append(uncomp_buf, strlen(test_buffer) + 1);
> >+ snprintf(data_ptr, strlen(test_buffer) + 1, "%s", test_buffer);
> >+
> >+ /* Prepare the destination mbuf */
> >+ comp_buf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
> >+ if (comp_buf == NULL) {
> >+ RTE_LOG(ERR, USER1,
> >+ "Destination mbuf could not be allocated "
> >+ "from the mempool\n");
> >+ goto exit;
> >+ }
> >+
> >+ rte_pktmbuf_append(comp_buf,
> >+ strlen(test_buffer) * COMPRESS_BUF_SIZE_RATIO);
> >+
> >+ /* Build the compression operations */
> >+ op = rte_comp_op_alloc(ts_params->op_pool);
> >+ if (op == NULL) {
> >+ RTE_LOG(ERR, USER1,
> >+ "Compress operation could not be allocated "
> >+ "from the mempool\n");
> >+ goto exit;
> >+ }
> >+
> >+ op->m_src = uncomp_buf;
> >+ op->m_dst = comp_buf;
> >+ op->src.offset = 0;
> >+ op->src.length = rte_pktmbuf_pkt_len(uncomp_buf);
> >+ op->dst.offset = 0;
> >+ if (state == RTE_COMP_OP_STATELESS) {
> >+ //TODO: FULL or FINAL?
> >+ op->flush_flag = RTE_COMP_FLUSH_FINAL;
> >+ } else {
> >+ RTE_LOG(ERR, USER1,
> >+ "Stateful operations are not supported "
> >+ "in these tests yet\n");
> >+ goto exit;
> >+ }
> >+ op->input_chksum = 0;
> >+
> >+ /* Compress data (either with Zlib API or compressdev API */
> >+ if (zlib_dir == ZLIB_COMPRESS || zlib_dir == ZLIB_ALL) {
> >+ ret = compress_zlib(op,
> >+ (const struct rte_comp_xform *)&compress_xform,
> [Shally] why are we passing ** here, compress_zlib() input rte_comp_xform*,
> this will cause a bug here. So, in call to decompress_zlib() below.
Hi Shally,
Looks like you are right. However, this code has been already merged and this was "fixed"
in the second patch.
Thanks,
Pablo
>
> Thanks
> Shally
More information about the dev
mailing list