RTE_LOG(ERR,USER1,"Private xform could not be created\n");
res=-1;
gotoend;
}
num_iter=1;
for(iter=0;iter<num_iter;iter++){
uint32_ttotal_ops=mem->total_bufs;
uint32_tremaining_ops=mem->total_bufs;
uint32_ttotal_deq_ops=0;
uint32_ttotal_enq_ops=0;
uint16_tops_unused=0;
uint16_tnum_enq=0;
uint16_tnum_deq=0;
output_size=0;
while(remaining_ops>0){
uint16_tnum_ops=RTE_MIN(remaining_ops,
test_data->burst_sz);
uint16_tops_needed=num_ops-ops_unused;
/*
*Movetheunusedoperationsfromtheprevious
*enqueue_burstcalltothefront,tomaintainorder
*/
if((ops_unused>0)&&(num_enq>0)){
size_tnb_b_to_mov=
ops_unused*sizeof(structrte_comp_op*);
memmove(ops,&ops[num_enq],nb_b_to_mov);
}
/* Allocate compression operations */
if(ops_needed&&!rte_comp_op_bulk_alloc(
mem->op_pool,
&ops[ops_unused],
ops_needed)){
RTE_LOG(ERR,USER1,
"Could not allocate enough operations\n");
res=-1;
gotoend;
}
allocated+=ops_needed;
for(i=0;i<ops_needed;i++){
/*
*Calculatenextbuffertoattachtooperation
*/
uint32_tbuf_id=total_enq_ops+i+
ops_unused;
uint16_top_id=ops_unused+i;
/* Reset all data in output buffers */
structrte_mbuf*m=output_bufs[buf_id];
m->pkt_len=out_seg_sz*m->nb_segs;
while(m){
m->data_len=m->buf_len-m->data_off;
m=m->next;
}
ops[op_id]->m_src=input_bufs[buf_id];
ops[op_id]->m_dst=output_bufs[buf_id];
ops[op_id]->src.offset=0;
ops[op_id]->src.length=
rte_pktmbuf_pkt_len(input_bufs[buf_id]);
ops[op_id]->dst.offset=0;
ops[op_id]->flush_flag=RTE_COMP_FLUSH_FINAL;
ops[op_id]->input_chksum=buf_id;
ops[op_id]->private_xform=priv_xform;
}
if(unlikely(test_data->perf_comp_force_stop))
gotoend;
num_enq=rte_compressdev_enqueue_burst(dev_id,
mem->qp_id,ops,
num_ops);
if(num_enq==0){
structrte_compressdev_statsstats;
rte_compressdev_stats_get(dev_id,&stats);
if(stats.enqueue_err_count){
res=-1;
gotoend;
}
}
ops_unused=num_ops-num_enq;
remaining_ops-=num_enq;
total_enq_ops+=num_enq;
num_deq=rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
test_data->burst_sz);
total_deq_ops+=num_deq;
for(i=0;i<num_deq;i++){
structrte_comp_op*op=deq_ops[i];
if(op->status==
RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED||
op->status==
RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE){
RTE_LOG(ERR,USER1,
"Out of space error occurred due to uncompressible input data expanding to larger than destination buffer. Increase the EXPANSE_RATIO constant to use this data.\n");
res=-1;
gotoend;
}elseif(op->status!=
RTE_COMP_OP_STATUS_SUCCESS){
RTE_LOG(ERR,USER1,
"Some operations were not successful\n");
gotoend;
}
constvoid*read_data_addr=
rte_pktmbuf_read(op->m_dst,0,
op->produced,output_data_ptr);
if(read_data_addr==NULL){
RTE_LOG(ERR,USER1,
"Could not copy buffer in destination\n");
res=-1;
gotoend;
}
if(read_data_addr!=output_data_ptr)
rte_memcpy(output_data_ptr,
rte_pktmbuf_mtod(op->m_dst,
uint8_t*),
op->produced);
output_data_ptr+=op->produced;
output_size+=op->produced;
}
if(iter==num_iter-1){
for(i=0;i<num_deq;i++){
structrte_comp_op*op=deq_ops[i];
structrte_mbuf*m=op->m_dst;
m->pkt_len=op->produced;
uint32_tremaining_data=op->produced;
uint16_tdata_to_append;
while(remaining_data>0){
data_to_append=
RTE_MIN(remaining_data,
out_seg_sz);
m->data_len=data_to_append;
remaining_data-=
data_to_append;
m=m->next;
}
}
}
rte_mempool_put_bulk(mem->op_pool,
(void**)deq_ops,num_deq);
allocated-=num_deq;
}
/* Dequeue the last operations */
while(total_deq_ops<total_ops){
if(unlikely(test_data->perf_comp_force_stop))
gotoend;
num_deq=rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
test_data->burst_sz);
if(num_deq==0){
structrte_compressdev_statsstats;
rte_compressdev_stats_get(dev_id,&stats);
if(stats.dequeue_err_count){
res=-1;
gotoend;
}
}
total_deq_ops+=num_deq;
for(i=0;i<num_deq;i++){
structrte_comp_op*op=deq_ops[i];
if(op->status==
RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED||
op->status==
RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE){
RTE_LOG(ERR,USER1,
"Out of space error occurred due to uncompressible input data expanding to larger than destination buffer. Increase the EXPANSE_RATIO constant to use this data.\n");