Hi Artur, > -----Original Message----- > From: Trybula, ArturX > Sent: Friday, October 11, 2019 6:46 PM > To: dev@dpdk.org; Trahe, Fiona <fiona.tr...@intel.com>; shal...@marvell.com; > Dybkowski, AdamX > <adamx.dybkow...@intel.com>; Trybula, ArturX <arturx.tryb...@intel.com>; > akhil.go...@nxp.com > Subject: [PATCH v3 2/2] test/compress: unit test for stateless overflow > recovery > > Added unit test to check out-of-space recoverable feature. > > Signed-off-by: Artur Trybula <arturx.tryb...@intel.com> > --- > app/test/test_compressdev.c | 261 +++++++++++++++++++++++++++++------- > 1 file changed, 214 insertions(+), 47 deletions(-)
//snip// > @@ -987,40 +1058,41 @@ test_deflate_comp_decomp(const struct > interim_data_params *int_data, > ops[i]->private_xform = priv_xforms[i]; > } > > - /* Enqueue and dequeue all operations */ > - num_enqd = rte_compressdev_enqueue_burst(0, 0, ops, num_bufs); > - if (num_enqd < num_bufs) { > +recovery_lb: > + ret = test_run_enqueue_dequeue(ops, num_bufs, ops_processed); > + if (ret < 0) { > RTE_LOG(ERR, USER1, > - "The operations could not be enqueued\n"); > + "Enqueue/dequeue operation failed\n"); > goto exit; > } > > - num_total_deqd = 0; > - do { > - /* > - * If retrying a dequeue call, wait for 10 ms to allow > - * enough time to the driver to process the operations > - */ > - if (deqd_retries != 0) { > - /* > - * Avoid infinite loop if not all the > - * operations get out of the device > - */ > - if (deqd_retries == MAX_DEQD_RETRIES) { > + for (i = 0; i < num_bufs; i++) { > + compressed_data_size[i] += ops_processed[i]->produced; > + > + if (ops_processed[i]->status == > + RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE) { > + > + ops[i]->status = > + RTE_COMP_OP_STATUS_NOT_PROCESSED; > + ops[i]->src.offset += > + ops_processed[i]->consumed; > + ops[i]->src.length -= > + ops_processed[i]->consumed; > + ops[i]->dst.offset += > + ops_processed[i]->produced; > + > + buf_ptr = rte_pktmbuf_append( > + ops[i]->m_dst, > + ops_processed[i]->produced); > + > + if (buf_ptr == NULL) { > RTE_LOG(ERR, USER1, > - "Not all operations could be " > - "dequeued\n"); > + "Data recovery: append extra > bytes to the current > mbuf failed\n"); > goto exit; > } > - usleep(DEQUEUE_WAIT_TIME); > + goto recovery_lb; > } > - num_deqd = rte_compressdev_dequeue_burst(0, 0, > - &ops_processed[num_total_deqd], > num_bufs); > - num_total_deqd += num_deqd; > - deqd_retries++; > - > - } while (num_total_deqd < num_enqd); > - > + } > deqd_retries = 0; //snip// Not all drivers support OUT_OF_SPACE_RECOVERABLE - some may return OUT_OF_SPACE_TERMINATED. There's no capability feature-flag which can be checked before running the test. How would this test behave in this case? Ideally it should recognise that OUT_OF_SPACE_TERMINATED is a valid response, but indicates that the driver doesn't support RECOVERABLE status and so return unsupported rather than failed.