> -----Original Message----- > From: Verma, Shally [mailto:shally.ve...@cavium.com] > Sent: Monday, May 14, 2018 9:29 AM > To: De Lara Guarch, Pablo <pablo.de.lara.gua...@intel.com>; dev@dpdk.org > Cc: Trahe, Fiona <fiona.tr...@intel.com>; Daly, Lee <lee.d...@intel.com>; > ahmed.mans...@nxp.com; Gupta, Ashish <ashish.gu...@cavium.com>; Gupta, > Ashish <ashish.gu...@cavium.com> > Subject: RE: [PATCH v4 1/5] test/compress: add initial unit tests > > > > >-----Original Message----- > >From: Pablo de Lara [mailto:pablo.de.lara.gua...@intel.com] > >Sent: 04 May 2018 15:52 > >To: dev@dpdk.org > >Cc: fiona.tr...@intel.com; lee.d...@intel.com; Verma, Shally > ><shally.ve...@cavium.com>; ahmed.mans...@nxp.com; Gupta, Ashish > ><ashish.gu...@cavium.com>; Pablo de Lara > ><pablo.de.lara.gua...@intel.com>; Gupta, Ashish > ><ashish.gu...@cavium.com>; Verma, Shally <shally.ve...@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.gua...@intel.com> > >Signed-off-by: Ashish Gupta <ashish.gu...@caviumnetworks.com> > >Signed-off-by: Shally Verma <shally.ve...@caviumnetworks.com> > >Acked-by: Lee Daly <lee.d...@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