bbdev PMD ACC100
Tom Rix
Reviewed-byRe: [dpdk-dev] [PATCH v9 06/10] baseband/acc100: add HARQ loopback support
In reply to Chautru, NicolasQuoted 51 lines · Nicolas
Hi Tom,
Quoted 40 lines
From: Tom Rix <[email protected]>
Quoted 15 lines · Nicolas Chautru
Additional support for HARQ memory loopback
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- drivers/baseband/acc100/rte_acc100_pmd.c | 158 +++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)drivers/baseband/acc100/rte_acc100_pmd.c +0
-0drivers/baseband/acc100/rte_acc100_pmd.c line 658
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0@@ -658,6 +658,7 @@
RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE|RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE| #ifdefACC100_EXT_MEMdrivers/baseband/acc100/rte_acc100_pmd.c line 659
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+
RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK|RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE|RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE|
#endif @@Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-1-1480,12 +1481,169 @@return 1 ; } +static inline int +harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) { +struct acc100_fcw_ld *fcw; +union acc100_dma_desc *desc; +int next_triplet =1 ; +struct rte_mbuf *hq_output_head, *hq_output; + uint16_t harq_in_length = op-ldpc_dec.harq_combined_input.length;
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+if (harq_in_length ==0 ) {Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1499
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+rte_bbdev_log (ERR ,"Loopback of invalid null size\n" ); +return -EINVAL ; + } + +int h_comp =check_bit (op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION + ) ?1 :0 ;bool
Quoted 1 line
Not in that case as this is used explictly as an integer in the FCW.
ok.
Quoted 165 lines
Thanks
NicQuoted 48 lines
Tom
drivers/baseband/acc100/rte_acc100_pmd.c line 1514
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+if (h_comp ==1 ) + harq_in_length = harq_in_length *8 /6 ; + harq_in_length =RTE_ALIGN (harq_in_length,64 ); +uint16_t harq_dma_length_in = (h_comp ==0 ) ? + harq_in_length : + harq_in_length *6 /8 ; +uint16_t harq_dma_length_out = harq_dma_length_in; + bool ddr_mem_in = check_bit(op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE);Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+union acc100_harq_layout_data *harq_layout = q->d->harq_layout; +uint16_t harq_index = (ddr_mem_in ? + op->ldpc_dec.harq_combined_input.offset : + op->ldpc_dec.harq_combined_output.offset) + /ACC100_HARQ_OFFSET ; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; + fcw = &desc->req.fcw_ld; +/* Set the FCW from loopback into DDR */ +memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); + fcw->FCWversion =ACC100_FCW_VER ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ fcw->qm =2 ; + fcw->Zc =384 ; +if (harq_in_length <16 *N_ZC_1 ) + fcw->Zc =16 ; + fcw->ncb = fcw->Zc *N_ZC_1 ; + fcw->rm_e =2 ; + fcw->hcin_en =1 ; + fcw->hcout_en =1 ; + + rte_bbdev_log(DEBUG, "Loopback IN %d Index %d offset %d length%d %d\n",
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ ddr_mem_in, harq_index, + harq_layout[harq_index].offset, harq_in_length, + harq_dma_length_in); + +if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { + fcw->hcin_size0 = harq_layout[harq_index].size0; + fcw->hcin_offset = harq_layout[harq_index].offset; + fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; + harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); +if (h_comp ==1 ) + harq_dma_length_in = harq_dma_length_in *6 /8 ; + }else {Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1551
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ fcw->hcin_size0 = harq_in_length; + } + harq_layout[harq_index].val =0 ; +rte_bbdev_log (DEBUG ,"Loopback FCW Config %d %d %d\n" , + fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); + fcw->hcout_size0 = harq_in_length; + fcw->hcin_decomp_mode = h_comp; + fcw->hcout_comp_mode = h_comp;see here
Quoted 102 lines
Quoted 35 lines
drivers/baseband/acc100/rte_acc100_pmd.c +35
-0+ fcw->gain_i =1 ; + fcw->gain_h =1 ; + +/* Set the prefix of descriptor. This could be done at polling */ + desc->req.word0 =ACC100_DMA_DESC_TYPE ; + desc->req.word1 =0 ;/**< Timestamp could be disabled */ + desc->req.word2 =0 ; + desc->req.word3 =0 ; + desc->req.numCBs =1 ; + +/* Null LLR input for Decoder */ + desc->req.data_ptrs[next_triplet].address = + q->lb_in_addr_phys; + desc->req.data_ptrs[next_triplet].blen =2 ; + desc->req.data_ptrs[next_triplet].blkid =ACC100_DMA_BLKID_IN ; + desc->req.data_ptrs[next_triplet].last =0 ; + desc->req.data_ptrs[next_triplet].dma_ext =0 ; + next_triplet++; + +/* HARQ Combine input from either Memory interface */ +if (!ddr_mem_in) { + next_triplet =acc100_dma_fill_blk_type_out (&desc->req, + op->ldpc_dec.harq_combined_input.data, + op->ldpc_dec.harq_combined_input.offset, + harq_dma_length_in, + next_triplet, +ACC100_DMA_BLKID_IN_HARQ ); + }else { + desc->req.data_ptrs[next_triplet].address = + op->ldpc_dec.harq_combined_input.offset; + desc->req.data_ptrs[next_triplet].blen = + harq_dma_length_in; + desc->req.data_ptrs[next_triplet].blkid = +ACC100_DMA_BLKID_IN_HARQ ; + desc->req.data_ptrs[next_triplet].dma_ext =1 ;drivers/baseband/acc100/rte_acc100_pmd.c line 1609
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ next_triplet++; + } + desc->req.data_ptrs[next_triplet -1 ].last =1 ; + desc->req.m2dlen = next_triplet; + +/* Dropped decoder hard output */ + desc->req.data_ptrs[next_triplet].address = + q->lb_out_addr_phys; + desc->req.data_ptrs[next_triplet].blen =BYTES_IN_WORD ; + desc->req.data_ptrs[next_triplet].blkid =
ACC100_DMA_BLKID_OUT_HARD;drivers/baseband/acc100/rte_acc100_pmd.c line 1631
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ desc->req.data_ptrs[next_triplet].last =0 ; + desc->req.data_ptrs[next_triplet].dma_ext =0 ; + next_triplet++; + +/* HARQ Combine output to either Memory interface */ + if (check_bit(op->ldpc_dec.op_flags, +
RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLEQuoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+ )) { + desc->req.data_ptrs[next_triplet].address = + op->ldpc_dec.harq_combined_output.offset; + desc->req.data_ptrs[next_triplet].blen = + harq_dma_length_out; + desc->req.data_ptrs[next_triplet].blkid = +ACC100_DMA_BLKID_OUT_HARQ ; + desc->req.data_ptrs[next_triplet].dma_ext =1 ; + next_triplet++; + } else { + hq_output_head = op-ldpc_dec.harq_combined_output.data;
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ hq_output = op->ldpc_dec.harq_combined_output.data; + next_triplet =acc100_dma_fill_blk_type_out ( + &desc->req, + op->ldpc_dec.harq_combined_output.data, + op->ldpc_dec.harq_combined_output.offset, + harq_dma_length_out, + next_triplet, +ACC100_DMA_BLKID_OUT_HARQ ); +/* HARQ output */ + mbuf_append(hq_output_head, hq_output,
harq_dma_length_out);Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+ op->ldpc_dec.harq_combined_output.length = + harq_dma_length_out; + } + desc->req.data_ptrs[next_triplet -1 ].last =1 ; + desc->req.d2mlen = next_triplet - desc->req.m2dlen; + desc->req.op_addr = op; + +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} +/** Enqueue one decode operations for ACC100 device in CB mode */ static inline int enqueue_ldpc_dec_one_op_cb(struct
acc100_queue*q, structrte_bbdev_dec_op*op,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0uint16_t total_enqueued_cbs, bool same_op) { int ret; + if (unlikely(check_bit(op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK))) {Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ ret =harq_loopback (q, op, total_enqueued_cbs); +return ret; + }union acc100_dma_desc *desc; uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs)
PATCH v9 7/10 baseband/acc100: add support for 4G processing
In reply to Nicolas ChautruAdding capability for 4G encode and decoder processing
--- doc/guides/bbdevs/features/acc100.ini | 4 +- drivers/baseband/acc100/rte_acc100_pmd.c | 1010 ++++++++++++++++++++++++++++-- 2 files changed, 945 insertions(+), 69 deletions(-)
doc/guides/bbdevs/features/acc100.ini +2 -2
@@ -4,8 +4,8 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] -Turbo Decoder (4G) = N -Turbo Encoder (4G) = N +Turbo Decoder (4G) = Y +Turbo Encoder (4G) = Y LDPC Decoder (5G) = Y LDPC Encoder (5G) = Y LLR/HARQ Compression = Y
drivers/baseband/acc100/rte_acc100_pmd.c +943 -67
1,120 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v9 07/10] baseband/acc100: add support for 4G processing
Quoted 202 lines · Nicolas Chautru
Adding capability for 4G encode and decoder processing
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- doc/guides/bbdevs/features/acc100.ini | 4 +- drivers/baseband/acc100/rte_acc100_pmd.c | 1010 ++++++++++++++++++++++++++++-- 2 files changed, 945 insertions(+), 69 deletions(-)doc/guides/bbdevs/features/acc100.ini +2
-2@@ -4,8 +4,8 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] -Turbo Decoder (4G) = N -Turbo Encoder (4G) = N +Turbo Decoder (4G) = Y +Turbo Encoder (4G) = Y LDPC Decoder (5G) = Y LDPC Encoder (5G) = Y LLR/HARQ Compression = Ydrivers/baseband/acc100/rte_acc100_pmd.c +133
-2@@ -339,7 +339,6 @@free_base_addresses (base_addrs, i); } -/* Allocate 64MB memory used for all software rings */ static int acc100_setup_queues (struct rte_bbdev *dev,uint16_t num_queues,int socket_id)@@ -637,6 +636,41 @@static const struct rte_bbdev_op_cap bbdev_capabilities[] = { { + .type =RTE_BBDEV_OP_TURBO_DEC , + .cap.turbo_dec = { + .capability_flags = +RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE | +RTE_BBDEV_TURBO_CRC_TYPE_24B | +RTE_BBDEV_TURBO_HALF_ITERATION_EVEN | +RTE_BBDEV_TURBO_EARLY_TERMINATION | +RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN | +RTE_BBDEV_TURBO_MAP_DEC | +RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP | +RTE_BBDEV_TURBO_DEC_SCATTER_GATHER , + .max_llr_modulus =INT8_MAX , + .num_buffers_src = +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS , + .num_buffers_hard_out = +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS , + .num_buffers_soft_out = +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS , + } + }, + { + .type =RTE_BBDEV_OP_TURBO_ENC , + .cap.turbo_enc = { + .capability_flags = +RTE_BBDEV_TURBO_CRC_24B_ATTACH | +RTE_BBDEV_TURBO_RV_INDEX_BYPASS | +RTE_BBDEV_TURBO_RATE_MATCH | +RTE_BBDEV_TURBO_ENC_SCATTER_GATHER , + .num_buffers_src = +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS , + .num_buffers_dst = +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS , + } + }, + { .type =RTE_BBDEV_OP_LDPC_ENC , .cap.ldpc_enc = { .capability_flags =@@ -719,7 +753,6 @@#endif } -static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, .close = acc100_dev_close,@@ -763,6 +796,58 @@return tail; } +/* Fill in a frame control word for turbo encoding. */ +static inline void +acc100_fcw_te_fill (const struct rte_bbdev_enc_op *op,struct acc100_fcw_te *fcw) +{ + fcw->code_block_mode = op->turbo_enc.code_block_mode; +if (fcw->code_block_mode ==0 ) {/* For TB mode */ + fcw->k_neg = op->turbo_enc.tb_params.k_neg; + fcw->k_pos = op->turbo_enc.tb_params.k_pos; + fcw->c_neg = op->turbo_enc.tb_params.c_neg; + fcw->c = op->turbo_enc.tb_params.c; + fcw->ncb_neg = op->turbo_enc.tb_params.ncb_neg; + fcw->ncb_pos = op->turbo_enc.tb_params.ncb_pos; + +if (check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RATE_MATCH )) { + fcw->bypass_rm =0 ; + fcw->cab = op->turbo_enc.tb_params.cab; + fcw->ea = op->turbo_enc.tb_params.ea; + fcw->eb = op->turbo_enc.tb_params.eb; + }else { +/* E is set to the encoding output size when RM is +* bypassed. +*/ + fcw->bypass_rm =1 ; + fcw->cab = fcw->c_neg; + fcw->ea =3 * fcw->k_neg +12 ; + fcw->eb =3 * fcw->k_pos +12 ; + } + }else {/* For CB mode */ + fcw->k_pos = op->turbo_enc.cb_params.k; + fcw->ncb_pos = op->turbo_enc.cb_params.ncb; + +if (check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RATE_MATCH )) { + fcw->bypass_rm =0 ; + fcw->eb = op->turbo_enc.cb_params.e; + }else { +/* E is set to the encoding output size when RM is +* bypassed. +*/ + fcw->bypass_rm =1 ; + fcw->eb =3 * fcw->k_pos +12 ; + } + } + + fcw->bypass_rv_idx1 =check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RV_INDEX_BYPASS ); + fcw->code_block_crc =check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_CRC_24B_ATTACH ); + fcw->rv_idx1 = op->turbo_enc.rv_index; +} +/* Compute value of k0. * Based on 3GPP 38.212 Table 5.4.2.1-2 * Starting position of different redundancy versions, k0 @@ -813,6 +898,25 @@ fcw->mcb_count = num_cb; } +/* Fill in a frame control word for turbo decoding. */ +static inline void +acc100_fcw_td_fill (const struct rte_bbdev_dec_op *op,struct acc100_fcw_td *fcw) +{ +/* Note : Early termination is always enabled for 4GUL */ + fcw->fcw_ver =1 ; +if (op->turbo_dec.code_block_mode ==0 ) + fcw->k_pos = op->turbo_dec.tb_params.k_pos; +else + fcw->k_pos = op->turbo_dec.cb_params.k; + fcw->turbo_crc_type =check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_CRC_TYPE_24B ); + fcw->bypass_sb_deint =0 ; + fcw->raw_decoder_input_on =0 ; + fcw->max_iter = op->turbo_dec.iter_max; + fcw->half_iter_on = !check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_HALF_ITERATION_EVEN ); +} +/* Fill in a frame control word for LDPC decoding. */ static inline void acc100_fcw_ld_fill(const struct rte_bbdev_dec_op *op, struct acc100_fcw_ld *fcw,@@ -1042,6 +1146,87 @@ }static inline int +acc100_dma_desc_te_fill (struct rte_bbdev_enc_op *op, +struct acc100_dma_req_desc *desc,struct rte_mbuf **input, +struct rte_mbuf *output,uint32_t *in_offset, +uint32_t *out_offset,uint32_t *out_length, +uint32_t *mbuf_total_left,uint32_t *seg_total_left,uint8_t r) +{ +int next_triplet =1 ;/* FCW already done */ +uint32_t e, ea, eb, length; +uint16_t k, k_neg, k_pos; +uint8_t cab, c_neg; + + desc->word0 =ACC100_DMA_DESC_TYPE ; + desc->word1 =0 ;/**< Timestamp could be disabled */ + desc->word2 =0 ; + desc->word3 =0 ; + desc->numCBs =1 ; + +if (op->turbo_enc.code_block_mode ==0 ) { + ea = op->turbo_enc.tb_params.ea; + eb = op->turbo_enc.tb_params.eb; + cab = op->turbo_enc.tb_params.cab; + k_neg = op->turbo_enc.tb_params.k_neg; + k_pos = op->turbo_enc.tb_params.k_pos; + c_neg = op->turbo_enc.tb_params.c_neg; + e = (r < cab) ? ea : eb; + k = (r < c_neg) ? k_neg : k_pos; + }else {
drivers/baseband/acc100/rte_acc100_pmd.c line 1185
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ e = op->turbo_enc.cb_params.e; + k = op->turbo_enc.cb_params.k; + } + +if (check_bit (op->turbo_enc.op_flags,RTE_BBDEV_TURBO_CRC_24B_ATTACH )) + length = (k -24 ) >>3 ; +else + length = k >>3 ; + +if (unlikely ((*mbuf_total_left ==0 ) || (*mbuf_total_left < length))) {
similar to other patches, this check can be combined to <=
change generally
Quoted 433 lines
drivers/baseband/acc100/rte_acc100_pmd.c +340
-64+rte_bbdev_log (ERR , +"Mismatch between mbuf length and included CB sizes: mbuf len %u, cb len %u" , + *mbuf_total_left, length); +return -1 ; + } + + next_triplet =acc100_dma_fill_blk_type_in (desc, input, in_offset, + length, seg_total_left, next_triplet); +if (unlikely (next_triplet <0 )) { +rte_bbdev_log (ERR , +"Mismatch between data to process and mbuf data length in bbdev_op: %p" , + op); +return -1 ; + } + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->m2dlen = next_triplet; + *mbuf_total_left -= length; + +/* Set output length */ +if (check_bit (op->turbo_enc.op_flags,RTE_BBDEV_TURBO_RATE_MATCH )) +/* Integer round up division by 8 */ + *out_length = (e +7 ) >>3 ; +else + *out_length = (k >>3 ) *3 +2 ; + + next_triplet =acc100_dma_fill_blk_type_out (desc, output, *out_offset, + *out_length, next_triplet,ACC100_DMA_BLKID_OUT_ENC ); +if (unlikely (next_triplet <0 )) { +rte_bbdev_log (ERR , +"Mismatch between data to process and mbuf data length in bbdev_op: %p" , + op); +return -1 ; + } + op->turbo_enc.output.length += *out_length; + *out_offset += *out_length; + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->d2mlen = next_triplet - desc->m2dlen; + + desc->op_addr = op; + +return 0 ; +} + +static inline int acc100_dma_desc_le_fill(struct rte_bbdev_enc_op *op, struct acc100_dma_req_desc *desc, struct rte_mbuf **input, struct rte_mbuf *output, uint32_t *in_offset,@@ -1110,6 +1295,117 @@ }static inline int +acc100_dma_desc_td_fill (struct rte_bbdev_dec_op *op, +struct acc100_dma_req_desc *desc,struct rte_mbuf **input, +struct rte_mbuf *h_output,struct rte_mbuf *s_output, +uint32_t *in_offset,uint32_t *h_out_offset, +uint32_t *s_out_offset,uint32_t *h_out_length, +uint32_t *s_out_length,uint32_t *mbuf_total_left, +uint32_t *seg_total_left,uint8_t r) +{ +int next_triplet =1 ;/* FCW already done */ +uint16_t k; +uint16_t crc24_overlap =0 ; +uint32_t e, kw; + + desc->word0 =ACC100_DMA_DESC_TYPE ; + desc->word1 =0 ;/**< Timestamp could be disabled */ + desc->word2 =0 ; + desc->word3 =0 ; + desc->numCBs =1 ; + +if (op->turbo_dec.code_block_mode ==0 ) { + k = (r < op->turbo_dec.tb_params.c_neg) + ? op->turbo_dec.tb_params.k_neg + : op->turbo_dec.tb_params.k_pos; + e = (r < op->turbo_dec.tb_params.cab) + ? op->turbo_dec.tb_params.ea + : op->turbo_dec.tb_params.eb; + }else { + k = op->turbo_dec.cb_params.k; + e = op->turbo_dec.cb_params.e; + } + +if ((op->turbo_dec.code_block_mode ==0 ) + && !check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP )) + crc24_overlap =24 ; + +/* Calculates circular buffer size. +* According to 3gpp 36.212 section 5.1.4.2 +* Kw = 3 * Kpi, +* where: +* Kpi = nCol * nRow +* where nCol is 32 and nRow can be calculated from: +* D =< nCol * nRow +* where D is the size of each output from turbo encoder block (k + 4). +*/ + kw =RTE_ALIGN_CEIL (k +4 ,32 ) *3 ; + +if (unlikely ((*mbuf_total_left ==0 ) || (*mbuf_total_left < kw))) { +rte_bbdev_log (ERR , +"Mismatch between mbuf length and included CB sizes: mbuf len %u, cb len %u" , + *mbuf_total_left, kw); +return -1 ; + } + + next_triplet =acc100_dma_fill_blk_type_in (desc, input, in_offset, kw, + seg_total_left, next_triplet); +if (unlikely (next_triplet <0 )) { +rte_bbdev_log (ERR , +"Mismatch between data to process and mbuf data length in bbdev_op: %p" , + op); +return -1 ; + } + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->m2dlen = next_triplet; + *mbuf_total_left -= kw; + + next_triplet =acc100_dma_fill_blk_type_out ( + desc, h_output, *h_out_offset, + k >>3 , next_triplet,ACC100_DMA_BLKID_OUT_HARD ); +if (unlikely (next_triplet <0 )) { +rte_bbdev_log (ERR , +"Mismatch between data to process and mbuf data length in bbdev_op: %p" , + op); +return -1 ; + } + + *h_out_length = ((k - crc24_overlap) >>3 ); + op->turbo_dec.hard_output.length += *h_out_length; + *h_out_offset += *h_out_length; + +/* Soft output */ +if (check_bit (op->turbo_dec.op_flags,RTE_BBDEV_TURBO_SOFT_OUTPUT )) { +if (check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_EQUALIZER )) + *s_out_length = e; +else + *s_out_length = (k *3 ) +12 ; + + next_triplet =acc100_dma_fill_blk_type_out (desc, s_output, + *s_out_offset, *s_out_length, next_triplet, +ACC100_DMA_BLKID_OUT_SOFT ); +if (unlikely (next_triplet <0 )) { +rte_bbdev_log (ERR , +"Mismatch between data to process and mbuf data length in bbdev_op: %p" , + op); +return -1 ; + } + + op->turbo_dec.soft_output.length += *s_out_length; + *s_out_offset += *s_out_length; + } + + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->d2mlen = next_triplet - desc->m2dlen; + + desc->op_addr = op; + +return 0 ; +} + +static inline int acc100_dma_desc_ld_fill(struct rte_bbdev_dec_op *op, struct acc100_dma_req_desc *desc, struct rte_mbuf **input, struct rte_mbuf *h_output,@@ -1374,6 +1670,57 @@/* Enqueue one encode operations for ACC100 device in CB mode */ static inline int +enqueue_enc_one_op_cb (struct acc100_queue *q,struct rte_bbdev_enc_op *op, +uint16_t total_enqueued_cbs) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint32_t in_offset, out_offset, out_length, mbuf_total_left, + seg_total_left; +struct rte_mbuf *input, *output_head, *output; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +acc100_fcw_te_fill (op, &desc->req.fcw_te); + + input = op->turbo_enc.input.data; + output_head = output = op->turbo_enc.output.data; + in_offset = op->turbo_enc.input.offset; + out_offset = op->turbo_enc.output.offset; + out_length =0 ; + mbuf_total_left = op->turbo_enc.input.length; + seg_total_left =rte_pktmbuf_data_len (op->turbo_enc.input.data) + - in_offset; + + ret =acc100_dma_desc_te_fill (op, &desc->req, &input, output, + &in_offset, &out_offset, &out_length, &mbuf_total_left, + &seg_total_left,0 ); + +if (unlikely (ret <0 )) +return ret; + +mbuf_append (output_head, output, out_length); + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_te, +sizeof (desc->req.fcw_te) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); + +/* Check if any data left after processing one CB */ +if (mbuf_total_left !=0 ) { +rte_bbdev_log (ERR , +"Some date still left after processing one CB: mbuf_total_left = %u" , + mbuf_total_left); +return -EINVAL ; + } +#endif +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} + +/* Enqueue one encode operations for ACC100 device in CB mode */ +static inline int enqueue_ldpc_enc_n_op_cb (struct acc100_queue *q,struct rte_bbdev_enc_op **ops,uint16_t total_enqueued_cbs,int16_t num) {@@ -1481,78 +1828,235 @@return 1 ; } -static inline int -harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, -uint16_t total_enqueued_cbs) { -struct acc100_fcw_ld *fcw; -union acc100_dma_desc *desc; -int next_triplet =1 ; -struct rte_mbuf *hq_output_head, *hq_output; -uint16_t harq_in_length = op->ldpc_dec.harq_combined_input.length; -if (harq_in_length ==0 ) { -rte_bbdev_log (ERR ,"Loopback of invalid null size\n" ); -return -EINVAL ; - } -int h_comp =check_bit (op->ldpc_dec.op_flags, -RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION - ) ?1 :0 ; -if (h_comp ==1 ) - harq_in_length = harq_in_length *8 /6 ; - harq_in_length =RTE_ALIGN (harq_in_length,64 ); -uint16_t harq_dma_length_in = (h_comp ==0 ) ? - harq_in_length : - harq_in_length *6 /8 ; -uint16_t harq_dma_length_out = harq_dma_length_in; -bool ddr_mem_in =check_bit (op->ldpc_dec.op_flags, -RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE ); -union acc100_harq_layout_data *harq_layout = q->d->harq_layout; -uint16_t harq_index = (ddr_mem_in ? - op->ldpc_dec.harq_combined_input.offset : - op->ldpc_dec.harq_combined_output.offset) - /ACC100_HARQ_OFFSET ; +/* Enqueue one encode operations for ACC100 device in TB mode. */ +static inline int +enqueue_enc_one_op_tb (struct acc100_queue *q,struct rte_bbdev_enc_op *op, +uint16_t total_enqueued_cbs,uint8_t cbs_in_tb) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint8_t r, c; +uint32_t in_offset, out_offset, out_length, mbuf_total_left, + seg_total_left; +struct rte_mbuf *input, *output_head, *output; +uint16_t current_enqueued_cbs =0 ;uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx; - fcw = &desc->req.fcw_ld; -/* Set the FCW from loopback into DDR */ -memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); - fcw->FCWversion =ACC100_FCW_VER ; - fcw->qm =2 ; - fcw->Zc =384 ; -if (harq_in_length <16 *N_ZC_1 ) - fcw->Zc =16 ; - fcw->ncb = fcw->Zc *N_ZC_1 ; - fcw->rm_e =2 ; - fcw->hcin_en =1 ; - fcw->hcout_en =1 ; +uint64_t fcw_offset = (desc_idx <<8 ) +ACC100_DESC_FCW_OFFSET ; +acc100_fcw_te_fill (op, &desc->req.fcw_te); -rte_bbdev_log (DEBUG ,"Loopback IN %d Index %d offset %d length %d %d\n" , - ddr_mem_in, harq_index, - harq_layout[harq_index].offset, harq_in_length, - harq_dma_length_in); + input = op->turbo_enc.input.data; + output_head = output = op->turbo_enc.output.data; + in_offset = op->turbo_enc.input.offset; + out_offset = op->turbo_enc.output.offset; + out_length =0 ; + mbuf_total_left = op->turbo_enc.input.length; -if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { - fcw->hcin_size0 = harq_layout[harq_index].size0; - fcw->hcin_offset = harq_layout[harq_index].offset; - fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; - harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); -if (h_comp ==1 ) - harq_dma_length_in = harq_dma_length_in *6 /8 ; - }else { - fcw->hcin_size0 = harq_in_length; - } - harq_layout[harq_index].val =0 ; -rte_bbdev_log (DEBUG ,"Loopback FCW Config %d %d %d\n" , - fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); - fcw->hcout_size0 = harq_in_length; - fcw->hcin_decomp_mode = h_comp; - fcw->hcout_comp_mode = h_comp; - fcw->gain_i =1 ; - fcw->gain_h =1 ; + c = op->turbo_enc.tb_params.c; + r = op->turbo_enc.tb_params.r; -/* Set the prefix of descriptor. This could be done at polling */ +while (mbuf_total_left >0 && r < c) { + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc->req.data_ptrs[0 ].address = q->ring_addr_phys + fcw_offset; + desc->req.data_ptrs[0 ].blen =ACC100_FCW_TE_BLEN ; + + ret =acc100_dma_desc_te_fill (op, &desc->req, &input, output, + &in_offset, &out_offset, &out_length, + &mbuf_total_left, &seg_total_left, r); +if (unlikely (ret <0 )) +return ret; +mbuf_append (output_head, output, out_length); + +/* Set total number of CBs in TB */ + desc->req.cbs_in_tb = cbs_in_tb; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_te, +sizeof (desc->req.fcw_te) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); +#endif + +if (seg_total_left ==0 ) { +/* Go to the next mbuf */ + input = input->next; + in_offset =0 ; + output = output->next; + out_offset =0 ; + } + + total_enqueued_cbs++; + current_enqueued_cbs++; + r++; + } + +if (unlikely (desc ==NULL )) +return current_enqueued_cbs; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { +rte_bbdev_log (ERR , +"Some date still left for processing: mbuf_total_left = %u" , + mbuf_total_left); +return -EINVAL ; + } +#endif + +/* Set SDone on last CB descriptor for TB mode. */ + desc->req.sdone_enable =1 ; + desc->req.irq_enable = q->irq_enable; + +return current_enqueued_cbs; +} + +/** Enqueue one decode operations for ACC100 device in CB mode */ +static inline int +enqueue_dec_one_op_cb (struct acc100_queue *q,struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint32_t in_offset, h_out_offset, s_out_offset, s_out_length, + h_out_length, mbuf_total_left, seg_total_left; +struct rte_mbuf *input, *h_output_head, *h_output, + *s_output_head, *s_output; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +acc100_fcw_td_fill (op, &desc->req.fcw_td); + + input = op->turbo_dec.input.data; + h_output_head = h_output = op->turbo_dec.hard_output.data; + s_output_head = s_output = op->turbo_dec.soft_output.data; + in_offset = op->turbo_dec.input.offset; + h_out_offset = op->turbo_dec.hard_output.offset; + s_out_offset = op->turbo_dec.soft_output.offset; + h_out_length = s_out_length =0 ; + mbuf_total_left = op->turbo_dec.input.length; + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +if (unlikely (input ==NULL )) { +rte_bbdev_log (ERR ,"Invalid mbuf pointer" ); +return -EFAULT ; + } +#endif + +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + + ret =acc100_dma_desc_td_fill (op, &desc->req, &input, h_output, + s_output, &in_offset, &h_out_offset, &s_out_offset, + &h_out_length, &s_out_length, &mbuf_total_left, + &seg_total_left,0 ); + +if (unlikely (ret <0 )) +return ret; + +/* Hard output */ +mbuf_append (h_output_head, h_output, h_out_length); + +/* Soft output */ +if (check_bit (op->turbo_dec.op_flags,RTE_BBDEV_TURBO_SOFT_OUTPUT )) +mbuf_append (s_output_head, s_output, s_out_length); + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_td, +sizeof (desc->req.fcw_td) -8 );
drivers/baseband/acc100/rte_acc100_pmd.c line 1982
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); + +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { +rte_bbdev_log (ERR , +"Some date still left after processing one CB: mbuf_total_left = %u" , + mbuf_total_left); +return -EINVAL ; + } +#endif
logic similar to debug in mbuf_append, should be a common function.
Quoted 15 lines
drivers/baseband/acc100/rte_acc100_pmd.c +15
-0+ +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} + +static inline int +harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) { +struct acc100_fcw_ld *fcw; +union acc100_dma_desc *desc; +int next_triplet =1 ; +struct rte_mbuf *hq_output_head, *hq_output; +uint16_t harq_in_length = op->ldpc_dec.harq_combined_input.length; +if (harq_in_length ==0 ) { +rte_bbdev_log (ERR ,"Loopback of invalid null size\n" );
drivers/baseband/acc100/rte_acc100_pmd.c line 2007
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+return -EINVAL ; + } + +int h_comp =check_bit (op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION + ) ?1 :0 ; +if (h_comp ==1 ) + harq_in_length = harq_in_length *8 /6 ; + harq_in_length =RTE_ALIGN (harq_in_length,64 ); + uint16_t harq_dma_length_in = (h_comp == 0) ?
Can these h_comp checks be combined to a single if/else ?
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ harq_in_length : + harq_in_length *6 /8 ; +uint16_t harq_dma_length_out = harq_dma_length_in; +bool ddr_mem_in =check_bit (op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE ); +union acc100_harq_layout_data *harq_layout = q->d->harq_layout; +uint16_t harq_index = (ddr_mem_in ? + op->ldpc_dec.harq_combined_input.offset : + op->ldpc_dec.harq_combined_output.offset) + /ACC100_HARQ_OFFSET ;
drivers/baseband/acc100/rte_acc100_pmd.c line 2027
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; + fcw = &desc->req.fcw_ld; +/* Set the FCW from loopback into DDR */ +memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); + fcw->FCWversion =ACC100_FCW_VER ; + fcw->qm =2 ; + fcw->Zc =384 ;
these magic numbers should have #defines
Quoted 207 lines
drivers/baseband/acc100/rte_acc100_pmd.c +186
-0+if (harq_in_length <16 *N_ZC_1 ) + fcw->Zc =16 ; + fcw->ncb = fcw->Zc *N_ZC_1 ; + fcw->rm_e =2 ; + fcw->hcin_en =1 ; + fcw->hcout_en =1 ; + +rte_bbdev_log (DEBUG ,"Loopback IN %d Index %d offset %d length %d %d\n" , + ddr_mem_in, harq_index, + harq_layout[harq_index].offset, harq_in_length, + harq_dma_length_in); + +if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { + fcw->hcin_size0 = harq_layout[harq_index].size0; + fcw->hcin_offset = harq_layout[harq_index].offset; + fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; + harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); +if (h_comp ==1 ) + harq_dma_length_in = harq_dma_length_in *6 /8 ; + }else { + fcw->hcin_size0 = harq_in_length; + } + harq_layout[harq_index].val =0 ; +rte_bbdev_log (DEBUG ,"Loopback FCW Config %d %d %d\n" , + fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); + fcw->hcout_size0 = harq_in_length; + fcw->hcin_decomp_mode = h_comp; + fcw->hcout_comp_mode = h_comp; + fcw->gain_i =1 ; + fcw->gain_h =1 ; + +/* Set the prefix of descriptor. This could be done at polling */ desc->req.word0 =ACC100_DMA_DESC_TYPE ; desc->req.word1 =0 ;/**< Timestamp could be disabled */ desc->req.word2 =0 ;@@ -1816,6 +2320,107 @@return current_enqueued_cbs; } +/* Enqueue one decode operations for ACC100 device in TB mode */ +static inline int +enqueue_dec_one_op_tb (struct acc100_queue *q,struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs,uint8_t cbs_in_tb) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint8_t r, c; +uint32_t in_offset, h_out_offset, s_out_offset, s_out_length, + h_out_length, mbuf_total_left, seg_total_left; +struct rte_mbuf *input, *h_output_head, *h_output, + *s_output_head, *s_output; +uint16_t current_enqueued_cbs =0 ; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +uint64_t fcw_offset = (desc_idx <<8 ) +ACC100_DESC_FCW_OFFSET ; +acc100_fcw_td_fill (op, &desc->req.fcw_td); + + input = op->turbo_dec.input.data; + h_output_head = h_output = op->turbo_dec.hard_output.data; + s_output_head = s_output = op->turbo_dec.soft_output.data; + in_offset = op->turbo_dec.input.offset; + h_out_offset = op->turbo_dec.hard_output.offset; + s_out_offset = op->turbo_dec.soft_output.offset; + h_out_length = s_out_length =0 ; + mbuf_total_left = op->turbo_dec.input.length; + c = op->turbo_dec.tb_params.c; + r = op->turbo_dec.tb_params.r; + +while (mbuf_total_left >0 && r < c) { + + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; + +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc->req.data_ptrs[0 ].address = q->ring_addr_phys + fcw_offset; + desc->req.data_ptrs[0 ].blen =ACC100_FCW_TD_BLEN ; + ret =acc100_dma_desc_td_fill (op, &desc->req, &input, + h_output, s_output, &in_offset, &h_out_offset, + &s_out_offset, &h_out_length, &s_out_length, + &mbuf_total_left, &seg_total_left, r); + +if (unlikely (ret <0 )) +return ret; + +/* Hard output */ +mbuf_append (h_output_head, h_output, h_out_length); + +/* Soft output */ +if (check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_SOFT_OUTPUT )) +mbuf_append (s_output_head, s_output, s_out_length); + +/* Set total number of CBs in TB */ + desc->req.cbs_in_tb = cbs_in_tb; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_td, +sizeof (desc->req.fcw_td) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); +#endif + +if (seg_total_left ==0 ) { +/* Go to the next mbuf */ + input = input->next; + in_offset =0 ; + h_output = h_output->next; + h_out_offset =0 ; + +if (check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_SOFT_OUTPUT )) { + s_output = s_output->next; + s_out_offset =0 ; + } + } + + total_enqueued_cbs++; + current_enqueued_cbs++; + r++; + } + +if (unlikely (desc ==NULL )) +return current_enqueued_cbs; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { +rte_bbdev_log (ERR , +"Some date still left for processing: mbuf_total_left = %u" , + mbuf_total_left); +return -EINVAL ; + } +#endif +/* Set SDone on last CB descriptor for TB mode */ + desc->req.sdone_enable =1 ; + desc->req.irq_enable = q->irq_enable; + +return current_enqueued_cbs; +}/* Calculates number of CBs in processed encoder TB based on 'r' and input * length. @@ -1893,6 +2498,45 @@return cbs_in_tb; } +/* Enqueue encode operations for ACC100 device in CB mode. */ +static uint16_t +acc100_enqueue_enc_cb (struct rte_bbdev_queue_data *q_data, +struct rte_bbdev_enc_op **ops,uint16_t num) +{ +struct acc100_queue *q = q_data->queue_private; +int32_t avail = q->sw_ring_depth + q->sw_ring_tail - q->sw_ring_head; +uint16_t i; +union acc100_dma_desc *desc; +int ret; + +for (i =0 ; i < num; ++i) { +/* Check if there are available space for further processing */ +if (unlikely (avail -1 <0 )) +break ; + avail -=1 ; + + ret =enqueue_enc_one_op_cb (q, ops[i], i); +if (ret <0 ) +break ; + } + +if (unlikely (i ==0 )) +return 0 ;/* Nothing to enqueue */ + +/* Set SDone in last CB in enqueued ops for CB mode*/ + desc = q->ring_addr + ((q->sw_ring_head + i -1 ) + & q->sw_ring_wrap_mask); + desc->req.sdone_enable =1 ; + desc->req.irq_enable = q->irq_enable; + +acc100_dma_enqueue (q, i, &q_data->queue_stats); + +/* Update stats */ + q_data->queue_stats.enqueued_count += i; + q_data->queue_stats.enqueue_err_count += num - i; +return i; +} +/* Check we can mux encode operations with common FCW */ static inline bool check_mux (struct rte_bbdev_enc_op **ops,uint16_t num) {@@ -1960,6 +2604,52 @@return i; } +/* Enqueue encode operations for ACC100 device in TB mode. */ +static uint16_t +acc100_enqueue_enc_tb (struct rte_bbdev_queue_data *q_data, +struct rte_bbdev_enc_op **ops,uint16_t num) +{ +struct acc100_queue *q = q_data->queue_private; +int32_t avail = q->sw_ring_depth + q->sw_ring_tail - q->sw_ring_head; +uint16_t i, enqueued_cbs =0 ; +uint8_t cbs_in_tb; +int ret; + +for (i =0 ; i < num; ++i) { + cbs_in_tb =get_num_cbs_in_tb_enc (&ops[i]->turbo_enc); +/* Check if there are available space for further processing */
drivers/baseband/acc100/rte_acc100_pmd.c line 2630
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+if (unlikely (avail - cbs_in_tb <0 )) +break ; + avail -= cbs_in_tb; + + ret =enqueue_enc_one_op_tb (q, ops[i], enqueued_cbs, cbs_in_tb); +if (ret <0 ) +break ; + enqueued_cbs += ret; + } +
other similar functions have a (i == 0) check here.
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+acc100_dma_enqueue (q, enqueued_cbs, &q_data->queue_stats); + +/* Update stats */ + q_data->queue_stats.enqueued_count += i; + q_data->queue_stats.enqueue_err_count += num - i; +
drivers/baseband/acc100/rte_acc100_pmd.c line 2646
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+return i; +} + +/* Enqueue encode operations for ACC100 device. */ +static uint16_t +acc100_enqueue_enc (struct rte_bbdev_queue_data *q_data, +struct rte_bbdev_enc_op **ops,uint16_t num) +{ +if (unlikely (num ==0 )) +return 0 ;
num == 0 check should move into the tb/cb functions
Quoted 16 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-1+if (ops[0 ]->turbo_enc.code_block_mode ==0 ) +return acc100_enqueue_enc_tb (q_data, ops, num); +else +return acc100_enqueue_enc_cb (q_data, ops, num); +} +/* Enqueue encode operations for ACC100 device. */ static uint16_t acc100_enqueue_ldpc_enc(struct rte_bbdev_queue_data *q_data,@@ -1967,7 +2657,51 @@ {if (unlikely (num ==0 ))return 0 ; -return acc100_enqueue_ldpc_enc_cb (q_data, ops, num); +if (ops[0 ]->ldpc_enc.code_block_mode ==0 ) +return acc100_enqueue_enc_tb (q_data, ops, num);
drivers/baseband/acc100/rte_acc100_pmd.c line 2671
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+else +return acc100_enqueue_ldpc_enc_cb (q_data, ops, num); +} + + +/* Enqueue decode operations for ACC100 device in CB mode */ +static uint16_t +acc100_enqueue_dec_cb (struct rte_bbdev_queue_data *q_data, +struct rte_bbdev_dec_op **ops,uint16_t num) +{
Seems like the 10th variant of a similar function could these be combined to fewer functions ?
Maybe by passing in a function pointer to the enqueue_one_dec_one* that does the work ?
Quoted 37 lines
drivers/baseband/acc100/rte_acc100_pmd.c +33
-0+struct acc100_queue *q = q_data->queue_private; +int32_t avail = q->sw_ring_depth + q->sw_ring_tail - q->sw_ring_head; +uint16_t i; +union acc100_dma_desc *desc; +int ret; + +for (i =0 ; i < num; ++i) { +/* Check if there are available space for further processing */ +if (unlikely (avail -1 <0 )) +break ; + avail -=1 ; + + ret =enqueue_dec_one_op_cb (q, ops[i], i); +if (ret <0 ) +break ; + } + +if (unlikely (i ==0 )) +return 0 ;/* Nothing to enqueue */ + +/* Set SDone in last CB in enqueued ops for CB mode*/ + desc = q->ring_addr + ((q->sw_ring_head + i -1 ) + & q->sw_ring_wrap_mask); + desc->req.sdone_enable =1 ; + desc->req.irq_enable = q->irq_enable; + +acc100_dma_enqueue (q, i, &q_data->queue_stats); + +/* Update stats */ + q_data->queue_stats.enqueued_count += i; + q_data->queue_stats.enqueue_err_count += num - i; + +return i; }/* Check we can mux encode operations with common FCW */
drivers/baseband/acc100/rte_acc100_pmd.c line 2807
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0@@ -2065,6 +2799,53 @@return i; } + +/* Enqueue decode operations for ACC100 device in TB mode */ +static uint16_t +acc100_enqueue_dec_tb (struct rte_bbdev_queue_data *q_data, +struct rte_bbdev_dec_op **ops,uint16_t num) +{
11th ;)
Quoted 25 lines
drivers/baseband/acc100/rte_acc100_pmd.c +25
-0+struct acc100_queue *q = q_data->queue_private; +int32_t avail = q->sw_ring_depth + q->sw_ring_tail - q->sw_ring_head; +uint16_t i, enqueued_cbs =0 ; +uint8_t cbs_in_tb; +int ret; + +for (i =0 ; i < num; ++i) { + cbs_in_tb =get_num_cbs_in_tb_dec (&ops[i]->turbo_dec); +/* Check if there are available space for further processing */ +if (unlikely (avail - cbs_in_tb <0 )) +break ; + avail -= cbs_in_tb; + + ret =enqueue_dec_one_op_tb (q, ops[i], enqueued_cbs, cbs_in_tb); +if (ret <0 ) +break ; + enqueued_cbs += ret; + } + +acc100_dma_enqueue (q, enqueued_cbs, &q_data->queue_stats); + +/* Update stats */ + q_data->queue_stats.enqueued_count += i; + q_data->queue_stats.enqueue_err_count += num - i; +
drivers/baseband/acc100/rte_acc100_pmd.c line 2842
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+return i; +} + +/* Enqueue decode operations for ACC100 device. */ +static uint16_t +acc100_enqueue_dec (struct rte_bbdev_queue_data *q_data, +struct rte_bbdev_dec_op **ops,uint16_t num) +{ +if (unlikely (num ==0 )) +return 0 ;
similar move the num == 0 check to the tb/cb functions.
Quoted 19 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+if (ops[0 ]->turbo_dec.code_block_mode ==0 ) +return acc100_enqueue_dec_tb (q_data, ops, num); +else +return acc100_enqueue_dec_cb (q_data, ops, num); +} +/* Enqueue decode operations for ACC100 device. */ static uint16_t acc100_enqueue_ldpc_dec(struct rte_bbdev_queue_data *q_data,@@ -2388,6 +3169,51 @@return cb_idx; } +/* Dequeue encode operations from ACC100 device. */ +static uint16_t +acc100_dequeue_enc (struct rte_bbdev_queue_data *q_data, +struct rte_bbdev_enc_op **ops,uint16_t num) +{ +struct acc100_queue *q = q_data->queue_private;
drivers/baseband/acc100/rte_acc100_pmd.c line 3187
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+uint16_t dequeue_num; +uint32_t avail = q->sw_ring_head - q->sw_ring_tail; +uint32_t aq_dequeued =0 ; +uint16_t i; +uint16_t dequeued_cbs =0 ; +struct rte_bbdev_enc_op *op; +int ret; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +if (unlikely (ops ==0 && q ==NULL ))
ops is a pointer so should compare with NULL
The && likely needs to be ||
Maybe print out a message so caller knows something wrong happened.
Quoted 38 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 3191
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+return 0 ; +#endif + + dequeue_num = (avail < num) ? avail : num;
very similar to enc function above, consider how to combine them to a single function.
55 lines not shown · raw message
Parts of this message are not shown here. View the raw message.
Re: [dpdk-dev] [PATCH v9 07/10] baseband/acc100: add support for 4G processing
Hi Tom,
Quoted 231 lines
From: Tom Rix <[email protected]>
Quoted 40 lines · Nicolas Chautru
Adding capability for 4G encode and decoder processing
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- doc/guides/bbdevs/features/acc100.ini | 4 +- drivers/baseband/acc100/rte_acc100_pmd.c | 1010 ++++++++++++++++++++++++++++-- 2 files changed, 945 insertions(+), 69 deletions(-)doc/guides/bbdevs/features/acc100.ini +2
-2@@ -4,8 +4,8 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] -Turbo Decoder (4G) = N -Turbo Encoder (4G) = N +Turbo Decoder (4G) = Y +Turbo Encoder (4G) = Y LDPC Decoder (5G) = Y LDPC Encoder (5G) = Y LLR/HARQ Compression = Ydrivers/baseband/acc100/rte_acc100_pmd.c +0
-1@@ -339,7 +339,6 @@free_base_addresses (base_addrs, i); } - /* Allocate 64MB memory used for all software rings */ static int
acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)@@ -637,6 +636,41 @@drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0static const struct rte_bbdev_op_cap bbdev_capabilities[] = { { + .type =RTE_BBDEV_OP_TURBO_DEC , + .cap.turbo_dec = { + .capability_flags = +
RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE|drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+RTE_BBDEV_TURBO_CRC_TYPE_24B |
Quoted 1 line
+
RTE_BBDEV_TURBO_HALF_ITERATION_EVEN|Quoted 1 line
+
RTE_BBDEV_TURBO_EARLY_TERMINATION|Quoted 1 line
+
RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN |drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ RTE_BBDEV_TURBO_MAP_DEC | +RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP |Quoted 1 line
+
RTE_BBDEV_TURBO_DEC_SCATTER_GATHER,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ .max_llr_modulus = INT8_MAX, + .num_buffers_src = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_hard_out = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_soft_out = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ } + }, + { + .type = RTE_BBDEV_OP_TURBO_ENC, + .cap.turbo_enc = { + .capability_flags = +
RTE_BBDEV_TURBO_CRC_24B_ATTACH|Quoted 1 line
+
RTE_BBDEV_TURBO_RV_INDEX_BYPASS|drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ RTE_BBDEV_TURBO_RATE_MATCH | +
RTE_BBDEV_TURBO_ENC_SCATTER_GATHER,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_src = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_dst = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,Quoted 98 lines
drivers/baseband/acc100/rte_acc100_pmd.c +72
-1+ } + }, + { .type = RTE_BBDEV_OP_LDPC_ENC, .cap.ldpc_enc = { .capability_flags =@@ -719,7 +753,6 @@#endif } -static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, .close = acc100_dev_close,@@ -763,6 +796,58 @@return tail; } +/* Fill in a frame control word for turbo encoding. */ static inline +void acc100_fcw_te_fill (const struct rte_bbdev_enc_op *op,struct +acc100_fcw_te *fcw) { + fcw->code_block_mode = op->turbo_enc.code_block_mode; +if (fcw->code_block_mode ==0 ) {/* For TB mode */ + fcw->k_neg = op->turbo_enc.tb_params.k_neg; + fcw->k_pos = op->turbo_enc.tb_params.k_pos; + fcw->c_neg = op->turbo_enc.tb_params.c_neg; + fcw->c = op->turbo_enc.tb_params.c; + fcw->ncb_neg = op->turbo_enc.tb_params.ncb_neg; + fcw->ncb_pos = op->turbo_enc.tb_params.ncb_pos; + +if (check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RATE_MATCH )) { + fcw->bypass_rm =0 ; + fcw->cab = op->turbo_enc.tb_params.cab; + fcw->ea = op->turbo_enc.tb_params.ea; + fcw->eb = op->turbo_enc.tb_params.eb; + }else { +/* E is set to the encoding output size when RM is +* bypassed. +*/ + fcw->bypass_rm =1 ; + fcw->cab = fcw->c_neg; + fcw->ea =3 * fcw->k_neg +12 ; + fcw->eb =3 * fcw->k_pos +12 ; + } + }else {/* For CB mode */ + fcw->k_pos = op->turbo_enc.cb_params.k; + fcw->ncb_pos = op->turbo_enc.cb_params.ncb; + +if (check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RATE_MATCH )) { + fcw->bypass_rm =0 ; + fcw->eb = op->turbo_enc.cb_params.e; + }else { +/* E is set to the encoding output size when RM is +* bypassed. +*/ + fcw->bypass_rm =1 ; + fcw->eb =3 * fcw->k_pos +12 ; + } + } + + fcw->bypass_rv_idx1 =check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RV_INDEX_BYPASS ); + fcw->code_block_crc =check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_CRC_24B_ATTACH ); + fcw->rv_idx1 = op->turbo_enc.rv_index; } +/* Compute value of k0. * Based on 3GPP 38.212 Table 5.4.2.1-2 * Starting position of different redundancy versions, k0 @@ -813,6 +898,25 @@ fcw->mcb_count = num_cb; } +/* Fill in a frame control word for turbo decoding. */ static inline +void acc100_fcw_td_fill (const struct rte_bbdev_dec_op *op,struct +acc100_fcw_td *fcw) { +/* Note : Early termination is always enabled for 4GUL */ + fcw->fcw_ver =1 ; +if (op->turbo_dec.code_block_mode ==0 ) + fcw->k_pos = op->turbo_dec.tb_params.k_pos; +else + fcw->k_pos = op->turbo_dec.cb_params.k; + fcw->turbo_crc_type =check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_CRC_TYPE_24B ); + fcw->bypass_sb_deint =0 ; + fcw->raw_decoder_input_on =0 ; + fcw->max_iter = op->turbo_dec.iter_max; + fcw->half_iter_on = !check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_HALF_ITERATION_EVEN ); +} + /* Fill in a frame control word for LDPC decoding. */ static inlinevoid acc100_fcw_ld_fill(const struct
rte_bbdev_dec_op*op, structacc100_fcw_ld*fcw, @@ -1042,6 +1146,87 @@ }static inline int
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+acc100_dma_desc_te_fill(struct rte_bbdev_enc_op *op, + struct acc100_dma_req_desc *desc, struct rte_mbuf **input, + struct rte_mbuf *output, uint32_t *in_offset, + uint32_t *out_offset, uint32_t *out_length, + uint32_t *mbuf_total_left, uint32_t *seg_total_left, uint8_tr) {
Quoted 16 lines
drivers/baseband/acc100/rte_acc100_pmd.c +16
-0+int next_triplet =1 ;/* FCW already done */ +uint32_t e, ea, eb, length; +uint16_t k, k_neg, k_pos; +uint8_t cab, c_neg; + + desc->word0 =ACC100_DMA_DESC_TYPE ; + desc->word1 =0 ;/**< Timestamp could be disabled */ + desc->word2 =0 ; + desc->word3 =0 ; + desc->numCBs =1 ; + +if (op->turbo_enc.code_block_mode ==0 ) { + ea = op->turbo_enc.tb_params.ea; + eb = op->turbo_enc.tb_params.eb; + cab = op->turbo_enc.tb_params.cab; + k_neg = op->turbo_enc.tb_params.k_neg;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ k_pos = op->turbo_enc.tb_params.k_pos; + c_neg = op->turbo_enc.tb_params.c_neg; + e = (r < cab) ? ea : eb; + k = (r < c_neg) ? k_neg : k_pos; + }else { + e = op->turbo_enc.cb_params.e; + k = op->turbo_enc.cb_params.k; + } + + if (check_bit(op->turbo_enc.op_flags,
RTE_BBDEV_TURBO_CRC_24B_ATTACH))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ length = (k -24 ) >>3 ; + else + length = k >>3 ; + +if (unlikely ((*mbuf_total_left ==0 ) || (*mbuf_total_left < +length))) {similar to other patches, this check can be combined to <=
Quoted 1 line
change generally
same comment on other patch
Quoted 466 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "Mismatch between mbuf length andincluded CB sizes: mbuf len %u, cb len %u",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ *mbuf_total_left, length); +return -1 ; + } + + next_triplet =acc100_dma_fill_blk_type_in (desc, input, in_offset, + length, seg_total_left, next_triplet); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ op); +return -1 ; + } + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->m2dlen = next_triplet; + *mbuf_total_left -= length; + +/* Set output length */ + if (check_bit(op->turbo_enc.op_flags,
RTE_BBDEV_TURBO_RATE_MATCH))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+/* Integer round up division by 8 */ + *out_length = (e +7 ) >>3 ; + else + *out_length = (k >>3 ) *3 +2 ; + + next_triplet = acc100_dma_fill_blk_type_out(desc, output,
*out_offset,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ *out_length, next_triplet,
ACC100_DMA_BLKID_OUT_ENC);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ op); +return -1 ; + } + op->turbo_enc.output.length += *out_length; + *out_offset += *out_length; + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->d2mlen = next_triplet - desc->m2dlen;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ + desc->op_addr = op; + +return 0 ; +} + +static inline int acc100_dma_desc_le_fill(struct rte_bbdev_enc_op *op, struct acc100_dma_req_desc *desc, struct rte_mbuf **input, struct rte_mbuf *output, uint32_t *in_offset, @@ -1110,6+1295,117
Quoted 36 lines
@@ }
static inline int
drivers/baseband/acc100/rte_acc100_pmd.c +33
-0+acc100_dma_desc_td_fill(struct rte_bbdev_dec_op *op, + struct acc100_dma_req_desc *desc, struct rte_mbuf **input, + struct rte_mbuf *h_output, struct rte_mbuf *s_output, + uint32_t *in_offset, uint32_t *h_out_offset, + uint32_t *s_out_offset, uint32_t *h_out_length, + uint32_t *s_out_length, uint32_t *mbuf_total_left, + uint32_t *seg_total_left, uint8_t r) { + int next_triplet = 1; /* FCW already done */ +uint16_t k; +uint16_t crc24_overlap =0 ; +uint32_t e, kw; + + desc->word0 =ACC100_DMA_DESC_TYPE ; + desc->word1 =0 ;/**< Timestamp could be disabled */ + desc->word2 =0 ; + desc->word3 =0 ; + desc->numCBs =1 ; + +if (op->turbo_dec.code_block_mode ==0 ) { + k = (r < op->turbo_dec.tb_params.c_neg) + ? op->turbo_dec.tb_params.k_neg + : op->turbo_dec.tb_params.k_pos; + e = (r < op->turbo_dec.tb_params.cab) + ? op->turbo_dec.tb_params.ea + : op->turbo_dec.tb_params.eb; + }else { + k = op->turbo_dec.cb_params.k; + e = op->turbo_dec.cb_params.e; + } + +if ((op->turbo_dec.code_block_mode ==0 ) + && !check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP ))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ crc24_overlap =24 ; + +/* Calculates circular buffer size. +* According to 3gpp 36.212 section 5.1.4.2 +* Kw = 3 * Kpi, +* where: +* Kpi = nCol * nRow +* where nCol is 32 and nRow can be calculated from: +* D =< nCol * nRow +* where D is the size of each output from turbo encoder block (k + 4).
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+*/ + kw =RTE_ALIGN_CEIL (k +4 ,32 ) *3 ; + +if (unlikely ((*mbuf_total_left ==0 ) || (*mbuf_total_left < kw))) { + rte_bbdev_log(ERR, + "Mismatch between mbuf length andincluded CB sizes: mbuf len %u, cb len %u",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ *mbuf_total_left, kw); +return -1 ; + } + + next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset,kw,
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ seg_total_left, next_triplet); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->m2dlen = next_triplet; + *mbuf_total_left -= kw; + + next_triplet = acc100_dma_fill_blk_type_out( + desc, h_output, *h_out_offset, + k >> 3, next_triplet,
ACC100_DMA_BLKID_OUT_HARD);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c line 1380
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + + *h_out_length = ((k - crc24_overlap) >>3 ); + op->turbo_dec.hard_output.length += *h_out_length; + *h_out_offset += *h_out_length; + +/* Soft output */ + if (check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_SOFT_OUTPUT)) {drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+if (check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_EQUALIZER )) + *s_out_length = e; +else + *s_out_length = (k *3 ) +12 ; + + next_triplet =acc100_dma_fill_blk_type_out (desc, s_output, + *s_out_offset, *s_out_length, next_triplet, +ACC100_DMA_BLKID_OUT_SOFT ); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to processand mbuf data length in
bbdev_op: %p",Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + + op->turbo_dec.soft_output.length += *s_out_length; + *s_out_offset += *s_out_length; + } + + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->d2mlen = next_triplet - desc->m2dlen;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ + desc->op_addr = op; + +return 0 ; +} + +static inline int acc100_dma_desc_ld_fill(struct rte_bbdev_dec_op *op, struct acc100_dma_req_desc *desc, struct rte_mbuf **input, struct rte_mbuf *h_output, @@ -1374,6
Quoted 5 lines
+1670,57 @@
/* Enqueue one encode operations for ACC100 device in CB mode */
static inline int
+enqueue_enc_one_op_cb(structacc100_queue*q, struct
rte_bbdev_enc_op*op,Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +14
-0+ uint16_t total_enqueued_cbs) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint32_t in_offset, out_offset, out_length, mbuf_total_left, + seg_total_left; +struct rte_mbuf *input, *output_head, *output; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +acc100_fcw_te_fill (op, &desc->req.fcw_te); + + input = op->turbo_enc.input.data;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ output_head = output = op->turbo_enc.output.data; + in_offset = op->turbo_enc.input.offset; + out_offset = op->turbo_enc.output.offset; + out_length =0 ; + mbuf_total_left = op->turbo_enc.input.length; + seg_total_left =rte_pktmbuf_data_len (op->turbo_enc.input.data) + - in_offset; + + ret = acc100_dma_desc_te_fill(op, &desc->req, &input, output, + &in_offset, &out_offset, &out_length,
&mbuf_total_left,Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ &seg_total_left, 0); + +if (unlikely (ret <0 )) +return ret; + +mbuf_append (output_head, output, out_length);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_te, +sizeof (desc->req.fcw_te) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); + +/* Check if any data left after processing one CB */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left after processing one CB:
mbuf_total_left= %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ mbuf_total_left); +return -EINVAL ; + } +#endif +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} + +/* Enqueue one encode operations for ACC100 device in CB mode */ +static inline int enqueue_ldpc_enc_n_op_cb(struct acc100_queue *q, struct
rte_bbdev_enc_op**ops,Quoted 1 line
uint16_ttotal_enqueued_cbs,int16_tnum) { @@ -1481,78+1828,235
Quoted 20 lines
@@
drivers/baseband/acc100/rte_acc100_pmd.c +0
-8return 1 ; } -static inline int -harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, -uint16_t total_enqueued_cbs) { -struct acc100_fcw_ld *fcw; -union acc100_dma_desc *desc; -int next_triplet =1 ; -struct rte_mbuf *hq_output_head, *hq_output; - uint16_t harq_in_length = op-ldpc_dec.harq_combined_input.length;
drivers/baseband/acc100/rte_acc100_pmd.c +0
-6-if (harq_in_length ==0 ) { -rte_bbdev_log (ERR ,"Loopback of invalid null size\n" ); -return -EINVAL ; - } -int h_comp =check_bit (op->ldpc_dec.op_flags, - RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSIONdrivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-10- ) ? 1 : 0; -if (h_comp ==1 ) - harq_in_length = harq_in_length *8 /6 ; - harq_in_length =RTE_ALIGN (harq_in_length,64 ); -uint16_t harq_dma_length_in = (h_comp ==0 ) ? - harq_in_length : - harq_in_length *6 /8 ; -uint16_t harq_dma_length_out = harq_dma_length_in; - bool ddr_mem_in = check_bit(op->ldpc_dec.op_flags, -RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE);Quoted 26 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-11-union acc100_harq_layout_data *harq_layout = q->d->harq_layout; -uint16_t harq_index = (ddr_mem_in ? - op->ldpc_dec.harq_combined_input.offset : - op->ldpc_dec.harq_combined_output.offset) - /ACC100_HARQ_OFFSET ; +/* Enqueue one encode operations for ACC100 device in TB mode. */ +static inline int enqueue_enc_one_op_tb (struct acc100_queue *q, +struct rte_bbdev_enc_op *op, +uint16_t total_enqueued_cbs,uint8_t cbs_in_tb) { +union acc100_dma_desc *desc =NULL ; +int ret; +uint8_t r, c; +uint32_t in_offset, out_offset, out_length, mbuf_total_left, + seg_total_left; +struct rte_mbuf *input, *output_head, *output; +uint16_t current_enqueued_cbs =0 ;uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx; - fcw = &desc->req.fcw_ld; -/* Set the FCW from loopback into DDR */ -memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); - fcw->FCWversion =ACC100_FCW_VER ; - fcw->qm =2 ; - fcw->Zc =384 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-7-if (harq_in_length <16 *N_ZC_1 ) - fcw->Zc =16 ; - fcw->ncb = fcw->Zc *N_ZC_1 ; - fcw->rm_e =2 ; - fcw->hcin_en =1 ; - fcw->hcout_en =1 ; +uint64_t fcw_offset = (desc_idx <<8 ) +ACC100_DESC_FCW_OFFSET ; +acc100_fcw_te_fill (op, &desc->req.fcw_te); - rte_bbdev_log(DEBUG, "Loopback IN %d Index %d offset %d length%d %d\n",
Quoted 26 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-19- ddr_mem_in, harq_index, - harq_layout[harq_index].offset, harq_in_length, - harq_dma_length_in); + input = op->turbo_enc.input.data; + output_head = output = op->turbo_enc.output.data; + in_offset = op->turbo_enc.input.offset; + out_offset = op->turbo_enc.output.offset; + out_length =0 ; + mbuf_total_left = op->turbo_enc.input.length; -if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { - fcw->hcin_size0 = harq_layout[harq_index].size0; - fcw->hcin_offset = harq_layout[harq_index].offset; - fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; - harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); -if (h_comp ==1 ) - harq_dma_length_in = harq_dma_length_in *6 /8 ; - }else { - fcw->hcin_size0 = harq_in_length; - } - harq_layout[harq_index].val =0 ; -rte_bbdev_log (DEBUG ,"Loopback FCW Config %d %d %d\n" , - fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); - fcw->hcout_size0 = harq_in_length; - fcw->hcin_decomp_mode = h_comp; - fcw->hcout_comp_mode = h_comp;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-3- fcw->gain_i =1 ; - fcw->gain_h =1 ; + c = op->turbo_enc.tb_params.c; + r = op->turbo_enc.tb_params.r; -/* Set the prefix of descriptor. This could be done at polling */ +while (mbuf_total_left >0 && r < c) { + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head +
total_enqueued_cbs)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ & q->sw_ring_wrap_mask); + desc->req.data_ptrs[0].address = q->ring_addr_phys +
fcw_offset;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ desc->req.data_ptrs[0 ].blen =ACC100_FCW_TE_BLEN ; + + ret = acc100_dma_desc_te_fill(op, &desc->req, &input,output,
drivers/baseband/acc100/rte_acc100_pmd.c line 1881
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ &in_offset, &out_offset, &out_length, + &mbuf_total_left, &seg_total_left, r); +if (unlikely (ret <0 )) +return ret; +mbuf_append (output_head, output, out_length); + +/* Set total number of CBs in TB */ + desc->req.cbs_in_tb = cbs_in_tb; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_te, +sizeof (desc->req.fcw_te) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc));#endif
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ +if (seg_total_left ==0 ) { +/* Go to the next mbuf */ + input = input->next; + in_offset =0 ; + output = output->next; + out_offset =0 ; + } + + total_enqueued_cbs++; + current_enqueued_cbs++; + r++;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } + +if (unlikely (desc ==NULL )) +return current_enqueued_cbs; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left for processing:
mbuf_total_left= %u",Quoted 53 lines
drivers/baseband/acc100/rte_acc100_pmd.c +53
-0+ mbuf_total_left); +return -EINVAL ; + } +#endif + +/* Set SDone on last CB descriptor for TB mode. */ + desc->req.sdone_enable =1 ; + desc->req.irq_enable = q->irq_enable; + +return current_enqueued_cbs; +} + +/** Enqueue one decode operations for ACC100 device in CB mode */ +static inline int enqueue_dec_one_op_cb (struct acc100_queue *q, +struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint32_t in_offset, h_out_offset, s_out_offset, s_out_length, + h_out_length, mbuf_total_left, seg_total_left; +struct rte_mbuf *input, *h_output_head, *h_output, + *s_output_head, *s_output; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +acc100_fcw_td_fill (op, &desc->req.fcw_td); + + input = op->turbo_dec.input.data; + h_output_head = h_output = op->turbo_dec.hard_output.data; + s_output_head = s_output = op->turbo_dec.soft_output.data; + in_offset = op->turbo_dec.input.offset; + h_out_offset = op->turbo_dec.hard_output.offset; + s_out_offset = op->turbo_dec.soft_output.offset; + h_out_length = s_out_length =0 ; + mbuf_total_left = op->turbo_dec.input.length; + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +if (unlikely (input ==NULL )) { +rte_bbdev_log (ERR ,"Invalid mbuf pointer" ); +return -EFAULT ; + } +#endif + +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + + ret = acc100_dma_desc_td_fill(op, &desc->req, &input, h_output, + s_output, &in_offset, &h_out_offset, &s_out_offset, + &h_out_length, &s_out_length, &mbuf_total_left,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ &seg_total_left, 0); + +if (unlikely (ret <0 )) +return ret; + +/* Hard output */ +mbuf_append (h_output_head, h_output, h_out_length); + +/* Soft output */ + if (check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_SOFT_OUTPUT))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+mbuf_append (s_output_head, s_output, s_out_length); + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_td, +sizeof (desc->req.fcw_td) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); + +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left after processing one CB:
mbuf_total_left= %u",
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1717
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ mbuf_total_left); + return -EINVAL; + } +#endif logic similar to debug in
mbuf_append, should be a common function.
Not exactly except if I miss your point.
Quoted 19 lines
Quoted 19 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+ +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} + +static inline int +harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) { +struct acc100_fcw_ld *fcw; +union acc100_dma_desc *desc; +int next_triplet =1 ; +struct rte_mbuf *hq_output_head, *hq_output; + uint16_t harq_in_length = op-ldpc_dec.harq_combined_input.length;
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+if (harq_in_length ==0 ) { +rte_bbdev_log (ERR ,"Loopback of invalid null size\n" ); +return -EINVAL ; + } +
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2007
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+int h_comp =check_bit (op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION + ) ?1 :0 ; +if (h_comp ==1 ) + harq_in_length = harq_in_length *8 /6 ; + harq_in_length =RTE_ALIGN (harq_in_length,64 ); + uint16_t harq_dma_length_in = (h_comp == 0) ?Can these
h_compchecks be combined to a single if/else ?
it may be clearer, ok.
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2018
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ harq_in_length : + harq_in_length *6 /8 ; +uint16_t harq_dma_length_out = harq_dma_length_in; + bool ddr_mem_in = check_bit(op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE);
Quoted 16 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+union acc100_harq_layout_data *harq_layout = q->d->harq_layout; +uint16_t harq_index = (ddr_mem_in ? + op->ldpc_dec.harq_combined_input.offset : + op->ldpc_dec.harq_combined_output.offset) + /ACC100_HARQ_OFFSET ;drivers/baseband/acc100/rte_acc100_pmd.c line 2027
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; + fcw = &desc->req.fcw_ld; +/* Set the FCW from loopback into DDR */ +memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); + fcw->FCWversion =ACC100_FCW_VER ; + fcw->qm =2 ; + fcw->Zc =384 ;these magic numbers should have #defines
These are not magic numbers, but actually 3GPP values
Quoted 220 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+if (harq_in_length <16 *N_ZC_1 ) + fcw->Zc =16 ; + fcw->ncb = fcw->Zc *N_ZC_1 ; + fcw->rm_e =2 ; + fcw->hcin_en =1 ; + fcw->hcout_en =1 ; + + rte_bbdev_log(DEBUG, "Loopback IN %d Index %d offset %d length%d %d\n",
Quoted 57 lines
drivers/baseband/acc100/rte_acc100_pmd.c +50
-0+ ddr_mem_in, harq_index, + harq_layout[harq_index].offset, harq_in_length, + harq_dma_length_in); + +if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { + fcw->hcin_size0 = harq_layout[harq_index].size0; + fcw->hcin_offset = harq_layout[harq_index].offset; + fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; + harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); +if (h_comp ==1 ) + harq_dma_length_in = harq_dma_length_in *6 /8 ; + }else { + fcw->hcin_size0 = harq_in_length; + } + harq_layout[harq_index].val =0 ; +rte_bbdev_log (DEBUG ,"Loopback FCW Config %d %d %d\n" , + fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); + fcw->hcout_size0 = harq_in_length; + fcw->hcin_decomp_mode = h_comp; + fcw->hcout_comp_mode = h_comp; + fcw->gain_i =1 ; + fcw->gain_h =1 ; + +/* Set the prefix of descriptor. This could be done at polling */ desc->req.word0 =ACC100_DMA_DESC_TYPE ; desc->req.word1 =0 ;/**< Timestamp could be disabled */ desc->req.word2 =0 ;@@ -1816,6 +2320,107 @@return current_enqueued_cbs; }Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
drivers/baseband/acc100/rte_acc100_pmd.c line 2332
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+/* Enqueue one decode operations for ACC100 device in TB mode */ +static inline int enqueue_dec_one_op_tb (struct acc100_queue *q, +struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs,uint8_t cbs_in_tb) { +union acc100_dma_desc *desc =NULL ; +int ret; +uint8_t r, c; +uint32_t in_offset, h_out_offset, s_out_offset, s_out_length, + h_out_length, mbuf_total_left, seg_total_left; + struct rte_mbuf *input, *h_output_head, *h_output,
total_enqueued_cbs)143 lines not shown · raw message
Quoted 6 lines
6 lines not shown · raw message
267 lines not shown · raw message
Parts of this message are not shown here. View the raw message.
Re: [dpdk-dev] [PATCH v9 07/10] baseband/acc100: add support for 4G processing
Quoted 700 lines · Nicolas
Hi Tom,
Quoted 230 lines
From: Tom Rix <[email protected]>
Quoted 40 lines · Nicolas Chautru
Adding capability for 4G encode and decoder processing
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- doc/guides/bbdevs/features/acc100.ini | 4 +- drivers/baseband/acc100/rte_acc100_pmd.c | 1010 ++++++++++++++++++++++++++++-- 2 files changed, 945 insertions(+), 69 deletions(-)doc/guides/bbdevs/features/acc100.ini +2
-2@@ -4,8 +4,8 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] -Turbo Decoder (4G) = N -Turbo Encoder (4G) = N +Turbo Decoder (4G) = Y +Turbo Encoder (4G) = Y LDPC Decoder (5G) = Y LDPC Encoder (5G) = Y LLR/HARQ Compression = Ydrivers/baseband/acc100/rte_acc100_pmd.c +0
-1@@ -339,7 +339,6 @@free_base_addresses (base_addrs, i); } - /* Allocate 64MB memory used for all software rings */ static int
acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)@@ -637,6 +636,41 @@drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0static const struct rte_bbdev_op_cap bbdev_capabilities[] = { { + .type =RTE_BBDEV_OP_TURBO_DEC , + .cap.turbo_dec = { + .capability_flags = +
RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE|drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+RTE_BBDEV_TURBO_CRC_TYPE_24B |
Quoted 1 line
+
RTE_BBDEV_TURBO_HALF_ITERATION_EVEN|Quoted 1 line
+
RTE_BBDEV_TURBO_EARLY_TERMINATION|Quoted 1 line
+
RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN |drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ RTE_BBDEV_TURBO_MAP_DEC | +RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP |Quoted 1 line
+
RTE_BBDEV_TURBO_DEC_SCATTER_GATHER,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ .max_llr_modulus = INT8_MAX, + .num_buffers_src = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_hard_out = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_soft_out = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ } + }, + { + .type = RTE_BBDEV_OP_TURBO_ENC, + .cap.turbo_enc = { + .capability_flags = +
RTE_BBDEV_TURBO_CRC_24B_ATTACH|Quoted 1 line
+
RTE_BBDEV_TURBO_RV_INDEX_BYPASS|drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ RTE_BBDEV_TURBO_RATE_MATCH | +
RTE_BBDEV_TURBO_ENC_SCATTER_GATHER,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_src = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_dst = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,Quoted 98 lines
drivers/baseband/acc100/rte_acc100_pmd.c +72
-1+ } + }, + { .type = RTE_BBDEV_OP_LDPC_ENC, .cap.ldpc_enc = { .capability_flags =@@ -719,7 +753,6 @@#endif } -static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, .close = acc100_dev_close,@@ -763,6 +796,58 @@return tail; } +/* Fill in a frame control word for turbo encoding. */ static inline +void acc100_fcw_te_fill (const struct rte_bbdev_enc_op *op,struct +acc100_fcw_te *fcw) { + fcw->code_block_mode = op->turbo_enc.code_block_mode; +if (fcw->code_block_mode ==0 ) {/* For TB mode */ + fcw->k_neg = op->turbo_enc.tb_params.k_neg; + fcw->k_pos = op->turbo_enc.tb_params.k_pos; + fcw->c_neg = op->turbo_enc.tb_params.c_neg; + fcw->c = op->turbo_enc.tb_params.c; + fcw->ncb_neg = op->turbo_enc.tb_params.ncb_neg; + fcw->ncb_pos = op->turbo_enc.tb_params.ncb_pos; + +if (check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RATE_MATCH )) { + fcw->bypass_rm =0 ; + fcw->cab = op->turbo_enc.tb_params.cab; + fcw->ea = op->turbo_enc.tb_params.ea; + fcw->eb = op->turbo_enc.tb_params.eb; + }else { +/* E is set to the encoding output size when RM is +* bypassed. +*/ + fcw->bypass_rm =1 ; + fcw->cab = fcw->c_neg; + fcw->ea =3 * fcw->k_neg +12 ; + fcw->eb =3 * fcw->k_pos +12 ; + } + }else {/* For CB mode */ + fcw->k_pos = op->turbo_enc.cb_params.k; + fcw->ncb_pos = op->turbo_enc.cb_params.ncb; + +if (check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RATE_MATCH )) { + fcw->bypass_rm =0 ; + fcw->eb = op->turbo_enc.cb_params.e; + }else { +/* E is set to the encoding output size when RM is +* bypassed. +*/ + fcw->bypass_rm =1 ; + fcw->eb =3 * fcw->k_pos +12 ; + } + } + + fcw->bypass_rv_idx1 =check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RV_INDEX_BYPASS ); + fcw->code_block_crc =check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_CRC_24B_ATTACH ); + fcw->rv_idx1 = op->turbo_enc.rv_index; } +/* Compute value of k0. * Based on 3GPP 38.212 Table 5.4.2.1-2 * Starting position of different redundancy versions, k0 @@ -813,6 +898,25 @@ fcw->mcb_count = num_cb; } +/* Fill in a frame control word for turbo decoding. */ static inline +void acc100_fcw_td_fill (const struct rte_bbdev_dec_op *op,struct +acc100_fcw_td *fcw) { +/* Note : Early termination is always enabled for 4GUL */ + fcw->fcw_ver =1 ; +if (op->turbo_dec.code_block_mode ==0 ) + fcw->k_pos = op->turbo_dec.tb_params.k_pos; +else + fcw->k_pos = op->turbo_dec.cb_params.k; + fcw->turbo_crc_type =check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_CRC_TYPE_24B ); + fcw->bypass_sb_deint =0 ; + fcw->raw_decoder_input_on =0 ; + fcw->max_iter = op->turbo_dec.iter_max; + fcw->half_iter_on = !check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_HALF_ITERATION_EVEN ); +} + /* Fill in a frame control word for LDPC decoding. */ static inlinevoid acc100_fcw_ld_fill(const struct
rte_bbdev_dec_op*op, structacc100_fcw_ld*fcw, @@ -1042,6 +1146,87 @@ }static inline int
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+acc100_dma_desc_te_fill(struct rte_bbdev_enc_op *op, + struct acc100_dma_req_desc *desc, struct rte_mbuf **input, + struct rte_mbuf *output, uint32_t *in_offset, + uint32_t *out_offset, uint32_t *out_length, + uint32_t *mbuf_total_left, uint32_t *seg_total_left, uint8_tr) {
Quoted 16 lines
drivers/baseband/acc100/rte_acc100_pmd.c +16
-0+int next_triplet =1 ;/* FCW already done */ +uint32_t e, ea, eb, length; +uint16_t k, k_neg, k_pos; +uint8_t cab, c_neg; + + desc->word0 =ACC100_DMA_DESC_TYPE ; + desc->word1 =0 ;/**< Timestamp could be disabled */ + desc->word2 =0 ; + desc->word3 =0 ; + desc->numCBs =1 ; + +if (op->turbo_enc.code_block_mode ==0 ) { + ea = op->turbo_enc.tb_params.ea; + eb = op->turbo_enc.tb_params.eb; + cab = op->turbo_enc.tb_params.cab; + k_neg = op->turbo_enc.tb_params.k_neg;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ k_pos = op->turbo_enc.tb_params.k_pos; + c_neg = op->turbo_enc.tb_params.c_neg; + e = (r < cab) ? ea : eb; + k = (r < c_neg) ? k_neg : k_pos; + }else { + e = op->turbo_enc.cb_params.e; + k = op->turbo_enc.cb_params.k; + } + + if (check_bit(op->turbo_enc.op_flags,
RTE_BBDEV_TURBO_CRC_24B_ATTACH))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ length = (k -24 ) >>3 ; + else + length = k >>3 ; + +if (unlikely ((*mbuf_total_left ==0 ) || (*mbuf_total_left < +length))) {similar to other patches, this check can be combined to <=
Quoted 1 line
change generally
same comment on other patch
Quoted 465 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "Mismatch between mbuf length andincluded CB sizes: mbuf len %u, cb len %u",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ *mbuf_total_left, length); +return -1 ; + } + + next_triplet =acc100_dma_fill_blk_type_in (desc, input, in_offset, + length, seg_total_left, next_triplet); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ op); +return -1 ; + } + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->m2dlen = next_triplet; + *mbuf_total_left -= length; + +/* Set output length */ + if (check_bit(op->turbo_enc.op_flags,
RTE_BBDEV_TURBO_RATE_MATCH))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+/* Integer round up division by 8 */ + *out_length = (e +7 ) >>3 ; + else + *out_length = (k >>3 ) *3 +2 ; + + next_triplet = acc100_dma_fill_blk_type_out(desc, output,
*out_offset,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ *out_length, next_triplet,
ACC100_DMA_BLKID_OUT_ENC);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ op); +return -1 ; + } + op->turbo_enc.output.length += *out_length; + *out_offset += *out_length; + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->d2mlen = next_triplet - desc->m2dlen;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ + desc->op_addr = op; + +return 0 ; +} + +static inline int acc100_dma_desc_le_fill(struct rte_bbdev_enc_op *op, struct acc100_dma_req_desc *desc, struct rte_mbuf **input, struct rte_mbuf *output, uint32_t *in_offset, @@ -1110,6+1295,117
Quoted 36 lines
@@ }
static inline int
drivers/baseband/acc100/rte_acc100_pmd.c +33
-0+acc100_dma_desc_td_fill(struct rte_bbdev_dec_op *op, + struct acc100_dma_req_desc *desc, struct rte_mbuf **input, + struct rte_mbuf *h_output, struct rte_mbuf *s_output, + uint32_t *in_offset, uint32_t *h_out_offset, + uint32_t *s_out_offset, uint32_t *h_out_length, + uint32_t *s_out_length, uint32_t *mbuf_total_left, + uint32_t *seg_total_left, uint8_t r) { + int next_triplet = 1; /* FCW already done */ +uint16_t k; +uint16_t crc24_overlap =0 ; +uint32_t e, kw; + + desc->word0 =ACC100_DMA_DESC_TYPE ; + desc->word1 =0 ;/**< Timestamp could be disabled */ + desc->word2 =0 ; + desc->word3 =0 ; + desc->numCBs =1 ; + +if (op->turbo_dec.code_block_mode ==0 ) { + k = (r < op->turbo_dec.tb_params.c_neg) + ? op->turbo_dec.tb_params.k_neg + : op->turbo_dec.tb_params.k_pos; + e = (r < op->turbo_dec.tb_params.cab) + ? op->turbo_dec.tb_params.ea + : op->turbo_dec.tb_params.eb; + }else { + k = op->turbo_dec.cb_params.k; + e = op->turbo_dec.cb_params.e; + } + +if ((op->turbo_dec.code_block_mode ==0 ) + && !check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP ))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ crc24_overlap =24 ; + +/* Calculates circular buffer size. +* According to 3gpp 36.212 section 5.1.4.2 +* Kw = 3 * Kpi, +* where: +* Kpi = nCol * nRow +* where nCol is 32 and nRow can be calculated from: +* D =< nCol * nRow +* where D is the size of each output from turbo encoder block (k + 4).
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+*/ + kw =RTE_ALIGN_CEIL (k +4 ,32 ) *3 ; + +if (unlikely ((*mbuf_total_left ==0 ) || (*mbuf_total_left < kw))) { + rte_bbdev_log(ERR, + "Mismatch between mbuf length andincluded CB sizes: mbuf len %u, cb len %u",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ *mbuf_total_left, kw); +return -1 ; + } + + next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset,kw,
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ seg_total_left, next_triplet); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->m2dlen = next_triplet; + *mbuf_total_left -= kw; + + next_triplet = acc100_dma_fill_blk_type_out( + desc, h_output, *h_out_offset, + k >> 3, next_triplet,
ACC100_DMA_BLKID_OUT_HARD);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c line 1380
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + + *h_out_length = ((k - crc24_overlap) >>3 ); + op->turbo_dec.hard_output.length += *h_out_length; + *h_out_offset += *h_out_length; + +/* Soft output */ + if (check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_SOFT_OUTPUT)) {drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+if (check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_EQUALIZER )) + *s_out_length = e; +else + *s_out_length = (k *3 ) +12 ; + + next_triplet =acc100_dma_fill_blk_type_out (desc, s_output, + *s_out_offset, *s_out_length, next_triplet, +ACC100_DMA_BLKID_OUT_SOFT ); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to processand mbuf data length in
bbdev_op: %p",Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + + op->turbo_dec.soft_output.length += *s_out_length; + *s_out_offset += *s_out_length; + } + + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->d2mlen = next_triplet - desc->m2dlen;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ + desc->op_addr = op; + +return 0 ; +} + +static inline int acc100_dma_desc_ld_fill(struct rte_bbdev_dec_op *op, struct acc100_dma_req_desc *desc, struct rte_mbuf **input, struct rte_mbuf *h_output, @@ -1374,6
Quoted 5 lines
+1670,57 @@
/* Enqueue one encode operations for ACC100 device in CB mode */
static inline int
+enqueue_enc_one_op_cb(structacc100_queue*q, struct
rte_bbdev_enc_op*op,Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +14
-0+ uint16_t total_enqueued_cbs) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint32_t in_offset, out_offset, out_length, mbuf_total_left, + seg_total_left; +struct rte_mbuf *input, *output_head, *output; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +acc100_fcw_te_fill (op, &desc->req.fcw_te); + + input = op->turbo_enc.input.data;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ output_head = output = op->turbo_enc.output.data; + in_offset = op->turbo_enc.input.offset; + out_offset = op->turbo_enc.output.offset; + out_length =0 ; + mbuf_total_left = op->turbo_enc.input.length; + seg_total_left =rte_pktmbuf_data_len (op->turbo_enc.input.data) + - in_offset; + + ret = acc100_dma_desc_te_fill(op, &desc->req, &input, output, + &in_offset, &out_offset, &out_length,
&mbuf_total_left,Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ &seg_total_left, 0); + +if (unlikely (ret <0 )) +return ret; + +mbuf_append (output_head, output, out_length);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_te, +sizeof (desc->req.fcw_te) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); + +/* Check if any data left after processing one CB */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left after processing one CB:
mbuf_total_left= %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ mbuf_total_left); +return -EINVAL ; + } +#endif +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} + +/* Enqueue one encode operations for ACC100 device in CB mode */ +static inline int enqueue_ldpc_enc_n_op_cb(struct acc100_queue *q, struct
rte_bbdev_enc_op**ops,Quoted 1 line
uint16_ttotal_enqueued_cbs,int16_tnum) { @@ -1481,78+1828,235
Quoted 20 lines
@@
drivers/baseband/acc100/rte_acc100_pmd.c +0
-8return 1 ; } -static inline int -harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, -uint16_t total_enqueued_cbs) { -struct acc100_fcw_ld *fcw; -union acc100_dma_desc *desc; -int next_triplet =1 ; -struct rte_mbuf *hq_output_head, *hq_output; - uint16_t harq_in_length = op-ldpc_dec.harq_combined_input.length;
drivers/baseband/acc100/rte_acc100_pmd.c +0
-6-if (harq_in_length ==0 ) { -rte_bbdev_log (ERR ,"Loopback of invalid null size\n" ); -return -EINVAL ; - } -int h_comp =check_bit (op->ldpc_dec.op_flags, - RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSIONdrivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-10- ) ? 1 : 0; -if (h_comp ==1 ) - harq_in_length = harq_in_length *8 /6 ; - harq_in_length =RTE_ALIGN (harq_in_length,64 ); -uint16_t harq_dma_length_in = (h_comp ==0 ) ? - harq_in_length : - harq_in_length *6 /8 ; -uint16_t harq_dma_length_out = harq_dma_length_in; - bool ddr_mem_in = check_bit(op->ldpc_dec.op_flags, -RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE);Quoted 26 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-11-union acc100_harq_layout_data *harq_layout = q->d->harq_layout; -uint16_t harq_index = (ddr_mem_in ? - op->ldpc_dec.harq_combined_input.offset : - op->ldpc_dec.harq_combined_output.offset) - /ACC100_HARQ_OFFSET ; +/* Enqueue one encode operations for ACC100 device in TB mode. */ +static inline int enqueue_enc_one_op_tb (struct acc100_queue *q, +struct rte_bbdev_enc_op *op, +uint16_t total_enqueued_cbs,uint8_t cbs_in_tb) { +union acc100_dma_desc *desc =NULL ; +int ret; +uint8_t r, c; +uint32_t in_offset, out_offset, out_length, mbuf_total_left, + seg_total_left; +struct rte_mbuf *input, *output_head, *output; +uint16_t current_enqueued_cbs =0 ;uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx; - fcw = &desc->req.fcw_ld; -/* Set the FCW from loopback into DDR */ -memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); - fcw->FCWversion =ACC100_FCW_VER ; - fcw->qm =2 ; - fcw->Zc =384 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-7-if (harq_in_length <16 *N_ZC_1 ) - fcw->Zc =16 ; - fcw->ncb = fcw->Zc *N_ZC_1 ; - fcw->rm_e =2 ; - fcw->hcin_en =1 ; - fcw->hcout_en =1 ; +uint64_t fcw_offset = (desc_idx <<8 ) +ACC100_DESC_FCW_OFFSET ; +acc100_fcw_te_fill (op, &desc->req.fcw_te); - rte_bbdev_log(DEBUG, "Loopback IN %d Index %d offset %d length%d %d\n",
Quoted 26 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-19- ddr_mem_in, harq_index, - harq_layout[harq_index].offset, harq_in_length, - harq_dma_length_in); + input = op->turbo_enc.input.data; + output_head = output = op->turbo_enc.output.data; + in_offset = op->turbo_enc.input.offset; + out_offset = op->turbo_enc.output.offset; + out_length =0 ; + mbuf_total_left = op->turbo_enc.input.length; -if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { - fcw->hcin_size0 = harq_layout[harq_index].size0; - fcw->hcin_offset = harq_layout[harq_index].offset; - fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; - harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); -if (h_comp ==1 ) - harq_dma_length_in = harq_dma_length_in *6 /8 ; - }else { - fcw->hcin_size0 = harq_in_length; - } - harq_layout[harq_index].val =0 ; -rte_bbdev_log (DEBUG ,"Loopback FCW Config %d %d %d\n" , - fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); - fcw->hcout_size0 = harq_in_length; - fcw->hcin_decomp_mode = h_comp; - fcw->hcout_comp_mode = h_comp;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-3- fcw->gain_i =1 ; - fcw->gain_h =1 ; + c = op->turbo_enc.tb_params.c; + r = op->turbo_enc.tb_params.r; -/* Set the prefix of descriptor. This could be done at polling */ +while (mbuf_total_left >0 && r < c) { + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head +
total_enqueued_cbs)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ & q->sw_ring_wrap_mask); + desc->req.data_ptrs[0].address = q->ring_addr_phys +
fcw_offset;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ desc->req.data_ptrs[0 ].blen =ACC100_FCW_TE_BLEN ; + + ret = acc100_dma_desc_te_fill(op, &desc->req, &input,output,
drivers/baseband/acc100/rte_acc100_pmd.c line 1881
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ &in_offset, &out_offset, &out_length, + &mbuf_total_left, &seg_total_left, r); +if (unlikely (ret <0 )) +return ret; +mbuf_append (output_head, output, out_length); + +/* Set total number of CBs in TB */ + desc->req.cbs_in_tb = cbs_in_tb; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_te, +sizeof (desc->req.fcw_te) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc));#endif
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ +if (seg_total_left ==0 ) { +/* Go to the next mbuf */ + input = input->next; + in_offset =0 ; + output = output->next; + out_offset =0 ; + } + + total_enqueued_cbs++; + current_enqueued_cbs++; + r++;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } + +if (unlikely (desc ==NULL )) +return current_enqueued_cbs; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left for processing:
mbuf_total_left= %u",Quoted 53 lines
drivers/baseband/acc100/rte_acc100_pmd.c +53
-0+ mbuf_total_left); +return -EINVAL ; + } +#endif + +/* Set SDone on last CB descriptor for TB mode. */ + desc->req.sdone_enable =1 ; + desc->req.irq_enable = q->irq_enable; + +return current_enqueued_cbs; +} + +/** Enqueue one decode operations for ACC100 device in CB mode */ +static inline int enqueue_dec_one_op_cb (struct acc100_queue *q, +struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint32_t in_offset, h_out_offset, s_out_offset, s_out_length, + h_out_length, mbuf_total_left, seg_total_left; +struct rte_mbuf *input, *h_output_head, *h_output, + *s_output_head, *s_output; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +acc100_fcw_td_fill (op, &desc->req.fcw_td); + + input = op->turbo_dec.input.data; + h_output_head = h_output = op->turbo_dec.hard_output.data; + s_output_head = s_output = op->turbo_dec.soft_output.data; + in_offset = op->turbo_dec.input.offset; + h_out_offset = op->turbo_dec.hard_output.offset; + s_out_offset = op->turbo_dec.soft_output.offset; + h_out_length = s_out_length =0 ; + mbuf_total_left = op->turbo_dec.input.length; + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +if (unlikely (input ==NULL )) { +rte_bbdev_log (ERR ,"Invalid mbuf pointer" ); +return -EFAULT ; + } +#endif + +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + + ret = acc100_dma_desc_td_fill(op, &desc->req, &input, h_output, + s_output, &in_offset, &h_out_offset, &s_out_offset, + &h_out_length, &s_out_length, &mbuf_total_left,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ &seg_total_left, 0); + +if (unlikely (ret <0 )) +return ret; + +/* Hard output */ +mbuf_append (h_output_head, h_output, h_out_length); + +/* Soft output */ + if (check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_SOFT_OUTPUT))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+mbuf_append (s_output_head, s_output, s_out_length); + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_td, +sizeof (desc->req.fcw_td) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); + +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left after processing one CB:
mbuf_total_left= %u",
Quoted 6 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1717
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ mbuf_total_left); + return -EINVAL; + } +#endif logic similar to debug in
mbuf_append, should be a common function.Not exactly except if I miss your point.
I look for code blocks that look similar and want you to consider if they can be combined
into a general function or macro. A general function is easier to maintain. In this case,
it seems like logging of something is wrong with mbuf is similar to an earlier block of code.
Nothing is functionally wrong.
Quoted 53 lines
Quoted 20 lines
Quoted 20 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+ +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} + +static inline int +harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) { +struct acc100_fcw_ld *fcw; +union acc100_dma_desc *desc; +int next_triplet =1 ; +struct rte_mbuf *hq_output_head, *hq_output; + uint16_t harq_in_length = op-ldpc_dec.harq_combined_input.length;
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+if (harq_in_length ==0 ) { +rte_bbdev_log (ERR ,"Loopback of invalid null size\n" ); +return -EINVAL ; + } +Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2007
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+int h_comp =check_bit (op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION + ) ?1 :0 ; +if (h_comp ==1 ) + harq_in_length = harq_in_length *8 /6 ; + harq_in_length =RTE_ALIGN (harq_in_length,64 ); + uint16_t harq_dma_length_in = (h_comp == 0) ?Can these
h_compchecks be combined to a single if/else ?it may be clearer, ok.
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2018
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ harq_in_length : + harq_in_length *6 /8 ; +uint16_t harq_dma_length_out = harq_dma_length_in; + bool ddr_mem_in = check_bit(op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE);Quoted 16 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+union acc100_harq_layout_data *harq_layout = q->d->harq_layout; +uint16_t harq_index = (ddr_mem_in ? + op->ldpc_dec.harq_combined_input.offset : + op->ldpc_dec.harq_combined_output.offset) + /ACC100_HARQ_OFFSET ;drivers/baseband/acc100/rte_acc100_pmd.c line 2027
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; + fcw = &desc->req.fcw_ld; +/* Set the FCW from loopback into DDR */ +memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); + fcw->FCWversion =ACC100_FCW_VER ; + fcw->qm =2 ; + fcw->Zc =384 ;these magic numbers should have #defines
Quoted 1 line
These are not magic numbers, but actually 3GPP values
ok
Quoted 266 lines
Quoted 221 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+if (harq_in_length <16 *N_ZC_1 ) + fcw->Zc =16 ; + fcw->ncb = fcw->Zc *N_ZC_1 ; + fcw->rm_e =2 ; + fcw->hcin_en =1 ; + fcw->hcout_en =1 ; + + rte_bbdev_log(DEBUG, "Loopback IN %d Index %d offset %d length%d %d\n",
Quoted 60 lines
drivers/baseband/acc100/rte_acc100_pmd.c +56
-0+ ddr_mem_in, harq_index, + harq_layout[harq_index].offset, harq_in_length, + harq_dma_length_in); + +if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { + fcw->hcin_size0 = harq_layout[harq_index].size0; + fcw->hcin_offset = harq_layout[harq_index].offset; + fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; + harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); +if (h_comp ==1 ) + harq_dma_length_in = harq_dma_length_in *6 /8 ; + }else { + fcw->hcin_size0 = harq_in_length; + } + harq_layout[harq_index].val =0 ; +rte_bbdev_log (DEBUG ,"Loopback FCW Config %d %d %d\n" , + fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); + fcw->hcout_size0 = harq_in_length; + fcw->hcin_decomp_mode = h_comp; + fcw->hcout_comp_mode = h_comp; + fcw->gain_i =1 ; + fcw->gain_h =1 ; + +/* Set the prefix of descriptor. This could be done at polling */ desc->req.word0 =ACC100_DMA_DESC_TYPE ; desc->req.word1 =0 ;/**< Timestamp could be disabled */ desc->req.word2 =0 ;Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
drivers/baseband/acc100/rte_acc100_pmd.c line 2326
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0@@ -1816,6 +2320,107 @@return current_enqueued_cbs; } +/* Enqueue one decode operations for ACC100 device in TB mode */ +static inline int enqueue_dec_one_op_tb (struct acc100_queue *q, +struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs,uint8_t cbs_in_tb) {
total_enqueued_cbs)143 lines not shown · raw message
Quoted 6 lines
6 lines not shown · raw message
37 lines not shown · raw message
Quoted 9 lines
8 lines not shown · raw message
222 lines not shown · raw message
Parts of this message are not shown here. View the raw message.
Re: [dpdk-dev] [PATCH v9 07/10] baseband/acc100: add support for 4G processing
Hi Tom,
Quoted 712 lines
From: Tom Rix <[email protected]>
Quoted 700 lines · Nicolas
Hi Tom,
Quoted 229 lines
From: Tom Rix <[email protected]>
Quoted 39 lines · Nicolas Chautru
Adding capability for 4G encode and decoder processing
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- doc/guides/bbdevs/features/acc100.ini | 4 +- drivers/baseband/acc100/rte_acc100_pmd.c | 1010 ++++++++++++++++++++++++++++-- 2 files changed, 945 insertions(+), 69 deletions(-)doc/guides/bbdevs/features/acc100.ini +2
-2@@ -4,8 +4,8 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] -Turbo Decoder (4G) = N -Turbo Encoder (4G) = N +Turbo Decoder (4G) = Y +Turbo Encoder (4G) = Y LDPC Decoder (5G) = Y LDPC Encoder (5G) = Y LLR/HARQ Compression = Ydrivers/baseband/acc100/rte_acc100_pmd.c +0
-1@@ -339,7 +339,6 @@free_base_addresses (base_addrs, i); } - /* Allocate 64MB memory used for all software rings */ static int
acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)@@ -637,6 +636,41 @@drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0static const struct rte_bbdev_op_cap bbdev_capabilities[] = { { + .type =RTE_BBDEV_OP_TURBO_DEC , + .cap.turbo_dec = { + .capability_flags = +
RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE|drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+RTE_BBDEV_TURBO_CRC_TYPE_24B |
Quoted 1 line
+
RTE_BBDEV_TURBO_HALF_ITERATION_EVEN|Quoted 1 line
+
RTE_BBDEV_TURBO_EARLY_TERMINATION|Quoted 1 line
+
RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN |drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ RTE_BBDEV_TURBO_MAP_DEC | +RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP |Quoted 1 line
+
RTE_BBDEV_TURBO_DEC_SCATTER_GATHER,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ .max_llr_modulus = INT8_MAX, + .num_buffers_src = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_hard_out = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_soft_out = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ } + }, + { + .type = RTE_BBDEV_OP_TURBO_ENC, + .cap.turbo_enc = { + .capability_flags = +
RTE_BBDEV_TURBO_CRC_24B_ATTACH|Quoted 1 line
+
RTE_BBDEV_TURBO_RV_INDEX_BYPASS|drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ RTE_BBDEV_TURBO_RATE_MATCH | +
RTE_BBDEV_TURBO_ENC_SCATTER_GATHER,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_src = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ .num_buffers_dst = +
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,Quoted 98 lines
drivers/baseband/acc100/rte_acc100_pmd.c +72
-1+ } + }, + { .type = RTE_BBDEV_OP_LDPC_ENC, .cap.ldpc_enc = { .capability_flags =@@ -719,7 +753,6 @@#endif } -static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, .close = acc100_dev_close,@@ -763,6 +796,58 @@return tail; } +/* Fill in a frame control word for turbo encoding. */ static +inline void acc100_fcw_te_fill (const struct rte_bbdev_enc_op *op, +struct acc100_fcw_te *fcw) { + fcw->code_block_mode = op->turbo_enc.code_block_mode; +if (fcw->code_block_mode ==0 ) {/* For TB mode */ + fcw->k_neg = op->turbo_enc.tb_params.k_neg; + fcw->k_pos = op->turbo_enc.tb_params.k_pos; + fcw->c_neg = op->turbo_enc.tb_params.c_neg; + fcw->c = op->turbo_enc.tb_params.c; + fcw->ncb_neg = op->turbo_enc.tb_params.ncb_neg; + fcw->ncb_pos = op->turbo_enc.tb_params.ncb_pos; + +if (check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RATE_MATCH )) { + fcw->bypass_rm =0 ; + fcw->cab = op->turbo_enc.tb_params.cab; + fcw->ea = op->turbo_enc.tb_params.ea; + fcw->eb = op->turbo_enc.tb_params.eb; + }else { +/* E is set to the encoding output size when RM is +* bypassed. +*/ + fcw->bypass_rm =1 ; + fcw->cab = fcw->c_neg; + fcw->ea =3 * fcw->k_neg +12 ; + fcw->eb =3 * fcw->k_pos +12 ; + } + }else {/* For CB mode */ + fcw->k_pos = op->turbo_enc.cb_params.k; + fcw->ncb_pos = op->turbo_enc.cb_params.ncb; + +if (check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RATE_MATCH )) { + fcw->bypass_rm =0 ; + fcw->eb = op->turbo_enc.cb_params.e; + }else { +/* E is set to the encoding output size when RM is +* bypassed. +*/ + fcw->bypass_rm =1 ; + fcw->eb =3 * fcw->k_pos +12 ; + } + } + + fcw->bypass_rv_idx1 =check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_RV_INDEX_BYPASS ); + fcw->code_block_crc =check_bit (op->turbo_enc.op_flags, +RTE_BBDEV_TURBO_CRC_24B_ATTACH ); + fcw->rv_idx1 = op->turbo_enc.rv_index; } +/* Compute value of k0. * Based on 3GPP 38.212 Table 5.4.2.1-2 * Starting position of different redundancy versions, k0 @@ -813,6 +898,25 @@ fcw->mcb_count = num_cb; } +/* Fill in a frame control word for turbo decoding. */ static +inline void acc100_fcw_td_fill (const struct rte_bbdev_dec_op *op, +struct acc100_fcw_td *fcw) { +/* Note : Early termination is always enabled for 4GUL */ + fcw->fcw_ver =1 ; +if (op->turbo_dec.code_block_mode ==0 ) + fcw->k_pos = op->turbo_dec.tb_params.k_pos; +else + fcw->k_pos = op->turbo_dec.cb_params.k; + fcw->turbo_crc_type =check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_CRC_TYPE_24B ); + fcw->bypass_sb_deint =0 ; + fcw->raw_decoder_input_on =0 ; + fcw->max_iter = op->turbo_dec.iter_max; + fcw->half_iter_on = !check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_HALF_ITERATION_EVEN ); +} + /* Fill in a frame control word for LDPC decoding. */ staticinline void acc100_fcw_ld_fill(const struct
rte_bbdev_dec_op*op, structacc100_fcw_ld*fcw, @@ -1042,6 +1146,87 @@ }static inline int
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+acc100_dma_desc_te_fill(struct rte_bbdev_enc_op *op, + struct acc100_dma_req_desc *desc, struct rte_mbuf **input, + struct rte_mbuf *output, uint32_t *in_offset, + uint32_t *out_offset, uint32_t *out_length, + uint32_t *mbuf_total_left, uint32_t *seg_total_left, uint8_tr) {
Quoted 16 lines
drivers/baseband/acc100/rte_acc100_pmd.c +16
-0+int next_triplet =1 ;/* FCW already done */ +uint32_t e, ea, eb, length; +uint16_t k, k_neg, k_pos; +uint8_t cab, c_neg; + + desc->word0 =ACC100_DMA_DESC_TYPE ; + desc->word1 =0 ;/**< Timestamp could be disabled */ + desc->word2 =0 ; + desc->word3 =0 ; + desc->numCBs =1 ; + +if (op->turbo_enc.code_block_mode ==0 ) { + ea = op->turbo_enc.tb_params.ea; + eb = op->turbo_enc.tb_params.eb; + cab = op->turbo_enc.tb_params.cab; + k_neg = op->turbo_enc.tb_params.k_neg;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ k_pos = op->turbo_enc.tb_params.k_pos; + c_neg = op->turbo_enc.tb_params.c_neg; + e = (r < cab) ? ea : eb; + k = (r < c_neg) ? k_neg : k_pos; + }else { + e = op->turbo_enc.cb_params.e; + k = op->turbo_enc.cb_params.k; + } + + if (check_bit(op->turbo_enc.op_flags,
RTE_BBDEV_TURBO_CRC_24B_ATTACH))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ length = (k -24 ) >>3 ; + else + length = k >>3 ; + +if (unlikely ((*mbuf_total_left ==0 ) || (*mbuf_total_left < +length))) {similar to other patches, this check can be combined to <=
Quoted 1 line
change generally
same comment on other patch
Quoted 466 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "Mismatch between mbuf length andincluded CB sizes: mbuf len %u, cb len %u",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ *mbuf_total_left, length); +return -1 ; + } + + next_triplet =acc100_dma_fill_blk_type_in (desc, input, in_offset, + length, seg_total_left, next_triplet); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ op); +return -1 ; + } + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->m2dlen = next_triplet; + *mbuf_total_left -= length; + +/* Set output length */ + if (check_bit(op->turbo_enc.op_flags,
RTE_BBDEV_TURBO_RATE_MATCH))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+/* Integer round up division by 8 */ + *out_length = (e +7 ) >>3 ; + else + *out_length = (k >>3 ) *3 +2 ; + + next_triplet = acc100_dma_fill_blk_type_out(desc, output,
*out_offset,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ *out_length, next_triplet,
ACC100_DMA_BLKID_OUT_ENC);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ op); +return -1 ; + } + op->turbo_enc.output.length += *out_length; + *out_offset += *out_length; + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->d2mlen = next_triplet - desc->m2dlen;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ + desc->op_addr = op; + +return 0 ; +} + +static inline int acc100_dma_desc_le_fill(struct rte_bbdev_enc_op *op, struct acc100_dma_req_desc *desc, struct rte_mbuf **input, struct rte_mbuf *output, uint32_t *in_offset, @@ -1110,6+1295,117
Quoted 37 lines
@@ }
static inline int
drivers/baseband/acc100/rte_acc100_pmd.c +34
-0+acc100_dma_desc_td_fill(struct rte_bbdev_dec_op *op, + struct acc100_dma_req_desc *desc, struct rte_mbuf **input, + struct rte_mbuf *h_output, struct rte_mbuf *s_output, + uint32_t *in_offset, uint32_t *h_out_offset, + uint32_t *s_out_offset, uint32_t *h_out_length, + uint32_t *s_out_length, uint32_t *mbuf_total_left, + uint32_t *seg_total_left, uint8_t r) { + int next_triplet = 1; /* FCW already done */ +uint16_t k; +uint16_t crc24_overlap =0 ; +uint32_t e, kw; + + desc->word0 =ACC100_DMA_DESC_TYPE ; + desc->word1 =0 ;/**< Timestamp could be disabled */ + desc->word2 =0 ; + desc->word3 =0 ; + desc->numCBs =1 ; + +if (op->turbo_dec.code_block_mode ==0 ) { + k = (r < op->turbo_dec.tb_params.c_neg) + ? op->turbo_dec.tb_params.k_neg + : op->turbo_dec.tb_params.k_pos; + e = (r < op->turbo_dec.tb_params.cab) + ? op->turbo_dec.tb_params.ea + : op->turbo_dec.tb_params.eb; + }else { + k = op->turbo_dec.cb_params.k; + e = op->turbo_dec.cb_params.e; + } + +if ((op->turbo_dec.code_block_mode ==0 ) + && !check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP )) + crc24_overlap =24 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +/* Calculates circular buffer size. +* According to 3gpp 36.212 section 5.1.4.2 +* Kw = 3 * Kpi, +* where: +* Kpi = nCol * nRow +* where nCol is 32 and nRow can be calculated from: +* D =< nCol * nRow +* where D is the size of each output from turbo encoder block (k ++ 4).
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+*/ + kw =RTE_ALIGN_CEIL (k +4 ,32 ) *3 ; + +if (unlikely ((*mbuf_total_left ==0 ) || (*mbuf_total_left < kw))) { + rte_bbdev_log(ERR, + "Mismatch between mbuf length andincluded CB sizes: mbuf len %u, cb len %u",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ *mbuf_total_left, kw); +return -1 ; + } + + next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset,kw,
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ seg_total_left, next_triplet); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->m2dlen = next_triplet; + *mbuf_total_left -= kw; + + next_triplet = acc100_dma_fill_blk_type_out( + desc, h_output, *h_out_offset, + k >> 3, next_triplet,
ACC100_DMA_BLKID_OUT_HARD);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to process andmbuf data length in
bbdev_op: %p",drivers/baseband/acc100/rte_acc100_pmd.c line 1380
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + + *h_out_length = ((k - crc24_overlap) >>3 ); + op->turbo_dec.hard_output.length += *h_out_length; + *h_out_offset += *h_out_length; + +/* Soft output */ + if (check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_SOFT_OUTPUT)) {drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+if (check_bit (op->turbo_dec.op_flags, +RTE_BBDEV_TURBO_EQUALIZER )) + *s_out_length = e; +else + *s_out_length = (k *3 ) +12 ; + + next_triplet =acc100_dma_fill_blk_type_out (desc, s_output, + *s_out_offset, *s_out_length, next_triplet, +ACC100_DMA_BLKID_OUT_SOFT ); +if (unlikely (next_triplet <0 )) { + rte_bbdev_log(ERR, + "Mismatch between data to processand mbuf data length in
bbdev_op: %p",Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ op); +return -1 ; + } + + op->turbo_dec.soft_output.length += *s_out_length; + *s_out_offset += *s_out_length; + } + + desc->data_ptrs[next_triplet -1 ].last =1 ; + desc->d2mlen = next_triplet - desc->m2dlen;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ + desc->op_addr = op; + +return 0 ; +} + +static inline int acc100_dma_desc_ld_fill(struct rte_bbdev_dec_op *op, struct acc100_dma_req_desc *desc, struct rte_mbuf **input, struct rte_mbuf *h_output, @@ -1374,6
Quoted 5 lines
+1670,57 @@
/* Enqueue one encode operations for ACC100 device in CB mode */
static inline int
+enqueue_enc_one_op_cb(structacc100_queue*q, struct
rte_bbdev_enc_op*op,Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +14
-0+ uint16_t total_enqueued_cbs) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint32_t in_offset, out_offset, out_length, mbuf_total_left, + seg_total_left; +struct rte_mbuf *input, *output_head, *output; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +acc100_fcw_te_fill (op, &desc->req.fcw_te); + + input = op->turbo_enc.input.data;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ output_head = output = op->turbo_enc.output.data; + in_offset = op->turbo_enc.input.offset; + out_offset = op->turbo_enc.output.offset; + out_length =0 ; + mbuf_total_left = op->turbo_enc.input.length; + seg_total_left =rte_pktmbuf_data_len (op->turbo_enc.input.data) + - in_offset; + + ret = acc100_dma_desc_te_fill(op, &desc->req, &input, output, + &in_offset, &out_offset, &out_length,
&mbuf_total_left,Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ &seg_total_left, 0); + +if (unlikely (ret <0 )) +return ret; + +mbuf_append (output_head, output, out_length);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_te, +sizeof (desc->req.fcw_te) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); + +/* Check if any data left after processing one CB */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left after processing one CB:
mbuf_total_left= %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ mbuf_total_left); +return -EINVAL ; + } +#endif +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} + +/* Enqueue one encode operations for ACC100 device in CB mode */ +static inline int enqueue_ldpc_enc_n_op_cb(struct acc100_queue *q, struct
rte_bbdev_enc_op**ops,Quoted 1 line
uint16_ttotal_enqueued_cbs,int16_tnum) { @@ -1481,78+1828,235
Quoted 20 lines
@@
drivers/baseband/acc100/rte_acc100_pmd.c +0
-8return 1 ; } -static inline int -harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, -uint16_t total_enqueued_cbs) { -struct acc100_fcw_ld *fcw; -union acc100_dma_desc *desc; -int next_triplet =1 ; -struct rte_mbuf *hq_output_head, *hq_output; - uint16_t harq_in_length = op-ldpc_dec.harq_combined_input.length;
drivers/baseband/acc100/rte_acc100_pmd.c +0
-6-if (harq_in_length ==0 ) { -rte_bbdev_log (ERR ,"Loopback of invalid null size\n" ); -return -EINVAL ; - } -int h_comp =check_bit (op->ldpc_dec.op_flags, - RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSIONdrivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-10- ) ? 1 : 0; -if (h_comp ==1 ) - harq_in_length = harq_in_length *8 /6 ; - harq_in_length =RTE_ALIGN (harq_in_length,64 ); -uint16_t harq_dma_length_in = (h_comp ==0 ) ? - harq_in_length : - harq_in_length *6 /8 ; -uint16_t harq_dma_length_out = harq_dma_length_in; - bool ddr_mem_in = check_bit(op->ldpc_dec.op_flags, -RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE);Quoted 26 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-11-union acc100_harq_layout_data *harq_layout = q->d->harq_layout; -uint16_t harq_index = (ddr_mem_in ? - op->ldpc_dec.harq_combined_input.offset : - op->ldpc_dec.harq_combined_output.offset) - /ACC100_HARQ_OFFSET ; +/* Enqueue one encode operations for ACC100 device in TB mode. */ +static inline int enqueue_enc_one_op_tb (struct acc100_queue *q, +struct rte_bbdev_enc_op *op, +uint16_t total_enqueued_cbs,uint8_t cbs_in_tb) { +union acc100_dma_desc *desc =NULL ; +int ret; +uint8_t r, c; +uint32_t in_offset, out_offset, out_length, mbuf_total_left, + seg_total_left; +struct rte_mbuf *input, *output_head, *output; +uint16_t current_enqueued_cbs =0 ;uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx; - fcw = &desc->req.fcw_ld; -/* Set the FCW from loopback into DDR */ -memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); - fcw->FCWversion =ACC100_FCW_VER ; - fcw->qm =2 ; - fcw->Zc =384 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-7-if (harq_in_length <16 *N_ZC_1 ) - fcw->Zc =16 ; - fcw->ncb = fcw->Zc *N_ZC_1 ; - fcw->rm_e =2 ; - fcw->hcin_en =1 ; - fcw->hcout_en =1 ; +uint64_t fcw_offset = (desc_idx <<8 ) +ACC100_DESC_FCW_OFFSET ; +acc100_fcw_te_fill (op, &desc->req.fcw_te); - rte_bbdev_log(DEBUG, "Loopback IN %d Index %d offset %d length%d %d\n",
Quoted 26 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-19- ddr_mem_in, harq_index, - harq_layout[harq_index].offset, harq_in_length, - harq_dma_length_in); + input = op->turbo_enc.input.data; + output_head = output = op->turbo_enc.output.data; + in_offset = op->turbo_enc.input.offset; + out_offset = op->turbo_enc.output.offset; + out_length =0 ; + mbuf_total_left = op->turbo_enc.input.length; -if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { - fcw->hcin_size0 = harq_layout[harq_index].size0; - fcw->hcin_offset = harq_layout[harq_index].offset; - fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; - harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); -if (h_comp ==1 ) - harq_dma_length_in = harq_dma_length_in *6 /8 ; - }else { - fcw->hcin_size0 = harq_in_length; - } - harq_layout[harq_index].val =0 ; -rte_bbdev_log (DEBUG ,"Loopback FCW Config %d %d %d\n" , - fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); - fcw->hcout_size0 = harq_in_length; - fcw->hcin_decomp_mode = h_comp; - fcw->hcout_comp_mode = h_comp;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-3- fcw->gain_i =1 ; - fcw->gain_h =1 ; + c = op->turbo_enc.tb_params.c; + r = op->turbo_enc.tb_params.r; -/* Set the prefix of descriptor. This could be done at polling */ +while (mbuf_total_left >0 && r < c) { + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head +
total_enqueued_cbs)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ & q->sw_ring_wrap_mask); + desc->req.data_ptrs[0].address = q->ring_addr_phys +
fcw_offset;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ desc->req.data_ptrs[0 ].blen =ACC100_FCW_TE_BLEN ; + + ret = acc100_dma_desc_te_fill(op, &desc->req, &input,output,
drivers/baseband/acc100/rte_acc100_pmd.c line 1881
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ &in_offset, &out_offset, &out_length, + &mbuf_total_left, &seg_total_left, r); +if (unlikely (ret <0 )) +return ret; +mbuf_append (output_head, output, out_length); + +/* Set total number of CBs in TB */ + desc->req.cbs_in_tb = cbs_in_tb; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_te, +sizeof (desc->req.fcw_te) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc));#endif
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ +if (seg_total_left ==0 ) { +/* Go to the next mbuf */ + input = input->next; + in_offset =0 ; + output = output->next; + out_offset =0 ; + } + + total_enqueued_cbs++; + current_enqueued_cbs++; + r++;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } + +if (unlikely (desc ==NULL )) +return current_enqueued_cbs; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left for processing:
mbuf_total_left= %u",Quoted 53 lines
drivers/baseband/acc100/rte_acc100_pmd.c +53
-0+ mbuf_total_left); +return -EINVAL ; + } +#endif + +/* Set SDone on last CB descriptor for TB mode. */ + desc->req.sdone_enable =1 ; + desc->req.irq_enable = q->irq_enable; + +return current_enqueued_cbs; +} + +/** Enqueue one decode operations for ACC100 device in CB mode */ +static inline int enqueue_dec_one_op_cb (struct acc100_queue *q, +struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) +{ +union acc100_dma_desc *desc =NULL ; +int ret; +uint32_t in_offset, h_out_offset, s_out_offset, s_out_length, + h_out_length, mbuf_total_left, seg_total_left; +struct rte_mbuf *input, *h_output_head, *h_output, + *s_output_head, *s_output; + +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; +acc100_fcw_td_fill (op, &desc->req.fcw_td); + + input = op->turbo_dec.input.data; + h_output_head = h_output = op->turbo_dec.hard_output.data; + s_output_head = s_output = op->turbo_dec.soft_output.data; + in_offset = op->turbo_dec.input.offset; + h_out_offset = op->turbo_dec.hard_output.offset; + s_out_offset = op->turbo_dec.soft_output.offset; + h_out_length = s_out_length =0 ; + mbuf_total_left = op->turbo_dec.input.length; + seg_total_left =rte_pktmbuf_data_len (input) - in_offset; + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +if (unlikely (input ==NULL )) { +rte_bbdev_log (ERR ,"Invalid mbuf pointer" ); +return -EFAULT ; + } +#endif + +/* Set up DMA descriptor */ + desc = q->ring_addr + ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + + ret = acc100_dma_desc_td_fill(op, &desc->req, &input, h_output, + s_output, &in_offset, &h_out_offset, &s_out_offset, + &h_out_length, &s_out_length, &mbuf_total_left,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ &seg_total_left, 0); + +if (unlikely (ret <0 )) +return ret; + +/* Hard output */ +mbuf_append (h_output_head, h_output, h_out_length); + +/* Soft output */ + if (check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_SOFT_OUTPUT))drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+mbuf_append (s_output_head, s_output, s_out_length); + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +rte_memdump (stderr,"FCW" , &desc->req.fcw_td, +sizeof (desc->req.fcw_td) -8 ); +rte_memdump (stderr,"Req Desc." , desc,sizeof (*desc)); + +/* Check if any CBs left for processing */ +if (mbuf_total_left !=0 ) { + rte_bbdev_log(ERR, + "Some date still left after processing one CB:
mbuf_total_left= %u",Quoted 6 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1717
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ mbuf_total_left); + return -EINVAL; + } +#endif logic similar to debug in
mbuf_append, should be a common function.Not exactly except if I miss your point.
I look for code blocks that look similar and want you to consider if they can be combined
Quoted 7 lines
into a general function or macro. A general function is easier to maintain. In this case,
it seems like logging of something is wrong with mbuf is similar to an earlier block of code.
Nothing is functionally wrong.
For that very example I can add a common error trap.
Not totally convinced of the value and this prevents using %s, __func__, but ok.
Quoted 327 lines
Quoted 54 lines
Quoted 21 lines
Quoted 21 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+ +/* One CB (one op) was successfully prepared to enqueue */ +return 1 ; +} + +static inline int +harq_loopback (struct acc100_queue *q,struct rte_bbdev_dec_op *op, +uint16_t total_enqueued_cbs) { +struct acc100_fcw_ld *fcw; +union acc100_dma_desc *desc; +int next_triplet =1 ; +struct rte_mbuf *hq_output_head, *hq_output; + uint16_t harq_in_length = op-ldpc_dec.harq_combined_input.length;
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+if (harq_in_length ==0 ) { +rte_bbdev_log (ERR ,"Loopback of invalid null size\n" ); +return -EINVAL ; + } +Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2007
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+int h_comp =check_bit (op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION + ) ?1 :0 ; +if (h_comp ==1 ) + harq_in_length = harq_in_length *8 /6 ; + harq_in_length =RTE_ALIGN (harq_in_length,64 ); + uint16_t harq_dma_length_in = (h_comp == 0) ?Can these
h_compchecks be combined to a single if/else ?it may be clearer, ok.
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2018
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ harq_in_length : + harq_in_length *6 /8 ; +uint16_t harq_dma_length_out = harq_dma_length_in; + bool ddr_mem_in = check_bit(op->ldpc_dec.op_flags, +RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE);Quoted 16 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+union acc100_harq_layout_data *harq_layout = q->d->harq_layout; +uint16_t harq_index = (ddr_mem_in ? + op->ldpc_dec.harq_combined_input.offset : + op->ldpc_dec.harq_combined_output.offset) + /ACC100_HARQ_OFFSET ;drivers/baseband/acc100/rte_acc100_pmd.c line 2027
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) + & q->sw_ring_wrap_mask); + desc = q->ring_addr + desc_idx; + fcw = &desc->req.fcw_ld; +/* Set the FCW from loopback into DDR */ +memset (fcw,0 ,sizeof (struct acc100_fcw_ld )); + fcw->FCWversion =ACC100_FCW_VER ; + fcw->qm =2 ; + fcw->Zc =384 ;these magic numbers should have #defines
Quoted 1 line
These are not magic numbers, but actually 3GPP values
ok
Quoted 271 lines
Quoted 222 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+if (harq_in_length <16 *N_ZC_1 ) + fcw->Zc =16 ; + fcw->ncb = fcw->Zc *N_ZC_1 ; + fcw->rm_e =2 ; + fcw->hcin_en =1 ; + fcw->hcout_en =1 ; + + rte_bbdev_log(DEBUG, "Loopback IN %d Index %d offset %d length%d %d\n",
Quoted 57 lines
drivers/baseband/acc100/rte_acc100_pmd.c +52
-0+ ddr_mem_in, harq_index, + harq_layout[harq_index].offset, harq_in_length, + harq_dma_length_in); + +if (ddr_mem_in && (harq_layout[harq_index].offset >0 )) { + fcw->hcin_size0 = harq_layout[harq_index].size0; + fcw->hcin_offset = harq_layout[harq_index].offset; + fcw->hcin_size1 = harq_in_length - fcw->hcin_offset; + harq_dma_length_in = (fcw->hcin_size0 + fcw->hcin_size1); +if (h_comp ==1 ) + harq_dma_length_in = harq_dma_length_in *6 /8 ; + }else { + fcw->hcin_size0 = harq_in_length; + } + harq_layout[harq_index].val =0 ; + rte_bbdev_log(DEBUG, "Loopback FCW Config %d %d %d\n",Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
drivers/baseband/acc100/rte_acc100_pmd.c line 2061
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ fcw->hcin_size0, fcw->hcin_offset, fcw->hcin_size1); + fcw->hcout_size0 = harq_in_length; + fcw->hcin_decomp_mode = h_comp; + fcw->hcout_comp_mode = h_comp; + fcw->gain_i =1 ; + fcw->gain_h =1 ; + +/* Set the prefix of descriptor. This could be done at polling */ desc->req.word0 =ACC100_DMA_DESC_TYPE ; desc->req.word1 =0 ;/**< Timestamp could be disabled */
total_enqueued_cbs)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
fcw_offset;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
&h_out_offset,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
&s_out_length,135 lines not shown · raw message
Quoted 6 lines
6 lines not shown · raw message
41 lines not shown · raw message
Quoted 8 lines
7 lines not shown · raw message
227 lines not shown · raw message
Parts of this message are not shown here. View the raw message.
PATCH v9 8/10 baseband/acc100: add interrupt support to PMD
In reply to Nicolas ChautruAdding capability and functions to support MSI
interrupts, call backs and inforing.
--- drivers/baseband/acc100/rte_acc100_pmd.c | 288 ++++++++++++++++++++++++++++++- drivers/baseband/acc100/rte_acc100_pmd.h | 15 ++ 2 files changed, 300 insertions(+), 3 deletions(-)
drivers/baseband/acc100/rte_acc100_pmd.c +285 -3
@@ -339,6 +339,213 @@free_base_addresses (base_addrs, i); } +/* +* Find queue_id of a device queue based on details from the Info Ring. +* If a queue isn't found UINT16_MAX is returned. +*/ +static inline uint16_t +get_queue_id_from_ring_info (struct rte_bbdev_data *data, +const union acc100_info_ring_data ring_data) +{ +uint16_t queue_id; + +for (queue_id =0 ; queue_id < data->num_queues; ++queue_id) { +struct acc100_queue *acc100_q = + data->queues[queue_id].queue_private; +if (acc100_q !=NULL && acc100_q->aq_id == ring_data.aq_id && + acc100_q->qgrp_id == ring_data.qg_id && + acc100_q->vf_id == ring_data.vf_id) +return queue_id; + } + +return UINT16_MAX ; +} + +/* Checks PF Info Ring to find the interrupt cause and handles it accordingly */ +static inline void +acc100_check_ir (struct acc100_device *acc100_dev) +{ +volatile union acc100_info_ring_data *ring_data; +uint16_t info_ring_head = acc100_dev->info_ring_head; +if (acc100_dev->info_ring ==NULL ) +return ; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { +if ((ring_data->int_nb <ACC100_PF_INT_DMA_DL_DESC_IRQ ) || ( + ring_data->int_nb > +ACC100_PF_INT_DMA_DL5G_DESC_IRQ )) +rte_bbdev_log (WARNING ,"InfoRing: ITR:%d Info:0x%x" , + ring_data->int_nb, ring_data->detailed_info); +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ; + info_ring_head++; + ring_data = acc100_dev->info_ring + + (info_ring_head &ACC100_INFO_RING_MASK ); + } +} + +/* Checks PF Info Ring to find the interrupt cause and handles it accordingly */ +static inline void +acc100_pf_interrupt_handler (struct rte_bbdev *dev) +{ +struct acc100_device *acc100_dev = dev->data->dev_private; +volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + +rte_bbdev_log_debug ( +"ACC100 PF Interrupt received, Info Ring data: 0x%x" , + ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_PF_INT_DMA_DL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_PF_INT_DMA_DL5G_DESC_IRQ : + deq_intr_det.queue_id =get_queue_id_from_ring_info ( + dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { +rte_bbdev_log (ERR , +"Couldn't find queue: aq_id: %u, qg_id: %u, vf_id: %u" , + ring_data->aq_id, + ring_data->qg_id, + ring_data->vf_id); +return ; + } +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_DEQUEUE , &deq_intr_det); +break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ; + ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + } +} + +/* Checks VF Info Ring to find the interrupt cause and handles it accordingly */ +static inline void +acc100_vf_interrupt_handler (struct rte_bbdev *dev) +{ +struct acc100_device *acc100_dev = dev->data->dev_private; +volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + +rte_bbdev_log_debug ( +"ACC100 VF Interrupt received, Info Ring data: 0x%x" , + ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_VF_INT_DMA_DL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_VF_INT_DMA_DL5G_DESC_IRQ : +/* VFs are not aware of their vf_id - it's set to 0 in +* queue structures. +*/ + ring_data->vf_id =0 ; + deq_intr_det.queue_id =get_queue_id_from_ring_info ( + dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { +rte_bbdev_log (ERR , +"Couldn't find queue: aq_id: %u, qg_id: %u" , + ring_data->aq_id, + ring_data->qg_id); +return ; + } +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_DEQUEUE , &deq_intr_det); +break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->valid =0 ; + ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head + &ACC100_INFO_RING_MASK ); + } +} + +/* Interrupt handler triggered by ACC100 dev for handling specific interrupt */ +static void +acc100_dev_interrupt_handler (void *cb_arg) +{ +struct rte_bbdev *dev = cb_arg; +struct acc100_device *acc100_dev = dev->data->dev_private; + +/* Read info ring */ +if (acc100_dev->pf_device) +acc100_pf_interrupt_handler (dev); +else +acc100_vf_interrupt_handler (dev); +} + +/* Allocate and setup inforing */ +static int +allocate_inforing (struct rte_bbdev *dev) +{ +struct acc100_device *d = dev->data->dev_private; +const struct acc100_registry_addr *reg_addr; +rte_iova_t info_ring_phys; +uint32_t phys_low, phys_high; + +if (d->info_ring !=NULL ) +return 0 ;/* Already configured */ + +/* Choose correct registry addresses for the device type */ +if (d->pf_device) + reg_addr = &pf_reg_addr; +else + reg_addr = &vf_reg_addr; +/* Allocate InfoRing */ + d->info_ring =rte_zmalloc_socket ("Info Ring" , +ACC100_INFO_RING_NUM_ENTRIES * +sizeof (*d->info_ring),RTE_CACHE_LINE_SIZE , + dev->data->socket_id); +if (d->info_ring ==NULL ) { +rte_bbdev_log (ERR , +"Failed to allocate Info Ring for %s:%u" , + dev->device->driver->name, + dev->data->dev_id); +return -ENOMEM ; + } + info_ring_phys =rte_malloc_virt2iova (d->info_ring); + +/* Setup Info Ring */ + phys_high = (uint32_t )(info_ring_phys >>32 ); + phys_low = (uint32_t )(info_ring_phys); +acc100_reg_write (d, reg_addr->info_ring_hi, phys_high); +acc100_reg_write (d, reg_addr->info_ring_lo, phys_low); +acc100_reg_write (d, reg_addr->info_ring_en,ACC100_REG_IRQ_EN_ALL ); + d->info_ring_head = (acc100_reg_read (d, reg_addr->info_ring_ptr) & +0xFFF ) /sizeof (union acc100_info_ring_data ); +return 0 ; +} + +/* Allocate 64MB memory used for all software rings */ static int acc100_setup_queues (struct rte_bbdev *dev,uint16_t num_queues,int socket_id)
@@ -426,6 +633,7 @@acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_hi, phys_high);acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_lo, phys_low); +allocate_inforing (dev); d->harq_layout =rte_zmalloc_socket ("HARQ Layout" ,ACC100_HARQ_LAYOUT *sizeof (*d->harq_layout),RTE_CACHE_LINE_SIZE , dev->data->socket_id);
@@ -437,13 +645,53 @@return 0 ; } +static int +acc100_intr_enable (struct rte_bbdev *dev) +{ +int ret; +struct acc100_device *d = dev->data->dev_private; + +/* Only MSI are currently supported */ +if (dev->intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSI || + dev->intr_handle->type ==RTE_INTR_HANDLE_UIO ) { + +allocate_inforing (dev); + + ret =rte_intr_enable (dev->intr_handle); +if (ret <0 ) { +rte_bbdev_log (ERR , +"Couldn't enable interrupts for device: %s" , + dev->data->name); +rte_free (d->info_ring); +return ret; + } + ret =rte_intr_callback_register (dev->intr_handle, + acc100_dev_interrupt_handler, dev); +if (ret <0 ) { +rte_bbdev_log (ERR , +"Couldn't register interrupt callback for device: %s" , + dev->data->name); +rte_free (d->info_ring); +return ret; + } + +return 0 ; + } + +rte_bbdev_log (ERR ,"ACC100 (%s) supports only VFIO MSI interrupts" , + dev->data->name); +return -ENOTSUP ; +} +/* Free 64MB memory used for software rings */ static int acc100_dev_close (struct rte_bbdev *dev) {struct acc100_device *d = dev->data->dev_private; +acc100_check_ir (d);if (d->sw_rings_base !=NULL ) {rte_free (d->tail_ptrs); +rte_free (d->info_ring);rte_free (d->sw_rings_base); d->sw_rings_base =NULL ; }
@@ -643,6 +891,7 @@RTE_BBDEV_TURBO_CRC_TYPE_24B |RTE_BBDEV_TURBO_HALF_ITERATION_EVEN |RTE_BBDEV_TURBO_EARLY_TERMINATION | +RTE_BBDEV_TURBO_DEC_INTERRUPTS |RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN |RTE_BBDEV_TURBO_MAP_DEC | RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP |
@@ -663,6 +912,7 @@RTE_BBDEV_TURBO_CRC_24B_ATTACH |RTE_BBDEV_TURBO_RV_INDEX_BYPASS |RTE_BBDEV_TURBO_RATE_MATCH | +RTE_BBDEV_TURBO_ENC_INTERRUPTS | RTE_BBDEV_TURBO_ENC_SCATTER_GATHER, .num_buffers_src = RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,
@@ -676,7 +926,8 @@ .capability_flags =RTE_BBDEV_LDPC_RATE_MATCH |RTE_BBDEV_LDPC_CRC_24B_ATTACH | - RTE_BBDEV_LDPC_INTERLEAVER_BYPASS, +RTE_BBDEV_LDPC_INTERLEAVER_BYPASS | + RTE_BBDEV_LDPC_ENC_INTERRUPTS, .num_buffers_src = RTE_BBDEV_LDPC_MAX_CODE_BLOCKS, .num_buffers_dst =
@@ -701,7 +952,8 @@RTE_BBDEV_LDPC_DECODE_BYPASS |RTE_BBDEV_LDPC_DEC_SCATTER_GATHER |RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION | - RTE_BBDEV_LDPC_LLR_COMPRESSION, +RTE_BBDEV_LDPC_LLR_COMPRESSION | + RTE_BBDEV_LDPC_DEC_INTERRUPTS, .llr_size = 8, .llr_decimals = 1, .num_buffers_src =
@@ -751,14 +1003,39 @@#else dev_info->harq_buffer_size =0 ;#endif +acc100_check_ir (d); +} + +static int +acc100_queue_intr_enable (struct rte_bbdev *dev,uint16_t queue_id) +{ +struct acc100_queue *q = dev->data->queues[queue_id].queue_private; + +if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && + dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +return -ENOTSUP ; + + q->irq_enable =1 ; +return 0 ; +} + +static int +acc100_queue_intr_disable (struct rte_bbdev *dev,uint16_t queue_id) +{ +struct acc100_queue *q = dev->data->queues[queue_id].queue_private; + q->irq_enable =0 ; +return 0 ; }static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, + .intr_enable = acc100_intr_enable, .close = acc100_dev_close, .info_get = acc100_dev_info_get, .queue_setup = acc100_queue_setup, .queue_release = acc100_queue_release, + .queue_intr_enable = acc100_queue_intr_enable, + .queue_intr_disable = acc100_queue_intr_disable };/* ACC100 PCI PF address map */
@@ -3018,8 +3295,10 @@ ? (1 << RTE_BBDEV_DATA_ERROR) : 0); op->status |= ((rsp.dma_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); op->status |= ((rsp.fcw_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); -if (op->status !=0 ) +if (op->status !=0 ) { q_data->queue_stats.dequeue_err_count++; +acc100_check_ir (q->d); + }/* CRC invalid if error exists */ if (!op->status)
@@ -3076,6 +3355,9 @@ op->status |=1 <<RTE_BBDEV_SYNDROME_ERROR ; op->ldpc_dec.iter_count = (uint8_t ) rsp.iter_cnt; +if (op->status & (1 <<RTE_BBDEV_DRV_ERROR )) +acc100_check_ir (q->d); +/* Check if this is the last desc in batch (Atomic Queue) */ if (desc->req.last_desc_in_batch) { (*aq_dequeued)++;
drivers/baseband/acc100/rte_acc100_pmd.h +15 -0
@@ -559,7 +559,14 @@ struct acc100_device {/* Virtual address of the info memory routed to the this function under * operation, whether it is PF or VF. */ +union acc100_info_ring_data *info_ring; +union acc100_harq_layout_data *harq_layout; +/* Virtual Info Ring head */ +uint16_t info_ring_head; +/* Number of bytes available for each queue in device, depending on +* how many queues are enabled with configure() +*/ uint32_t sw_ring_size;uint32_t ddr_size;/* Size in kB */ uint32_t *tail_ptrs;/* Base address of response tail pointer buffer */
@@ -575,4 +582,12 @@ struct acc100_device { bool configured; /**< True if this ACC100 device is configured */ }; +/** +* Structure with details about RTE_BBDEV_EVENT_DEQUEUE event. It's passed to +* the callback function. +*/ +struct acc100_deq_intr_details { +uint16_t queue_id; +}; +#endif /* _RTE_ACC100_PMD_H_ */
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v9 08/10] baseband/acc100: add interrupt support to PMD
Quoted 25 lines · Nicolas Chautru
Adding capability and functions to support MSI
interrupts, call backs and inforing.Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- drivers/baseband/acc100/rte_acc100_pmd.c | 288 ++++++++++++++++++++++++++++++- drivers/baseband/acc100/rte_acc100_pmd.h | 15 ++ 2 files changed, 300 insertions(+), 3 deletions(-)drivers/baseband/acc100/rte_acc100_pmd.c +7
-0@@ -339,6 +339,213 @@free_base_addresses (base_addrs, i); } +/* +* Find queue_id of a device queue based on details from the Info Ring. +* If a queue isn't found UINT16_MAX is returned. +*/ +static inline uint16_t +get_queue_id_from_ring_info (struct rte_bbdev_data *data, +const union acc100_info_ring_data ring_data)
drivers/baseband/acc100/rte_acc100_pmd.c line 358
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+{ +uint16_t queue_id; + +for (queue_id =0 ; queue_id < data->num_queues; ++queue_id) { +struct acc100_queue *acc100_q = + data->queues[queue_id].queue_private; +if (acc100_q !=NULL && acc100_q->aq_id == ring_data.aq_id && + acc100_q->qgrp_id == ring_data.qg_id && + acc100_q->vf_id == ring_data.vf_id) +return queue_id;
If num_queues is large, this linear search will be slow.
Consider changing the search algorithm.
drivers/baseband/acc100/rte_acc100_pmd.c line 361
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ } + +return UINT16_MAX ;
the interrupt handlers that use this function do not a great job of handling this error.
Quoted 15 lines
drivers/baseband/acc100/rte_acc100_pmd.c +15
-0+} + +/* Checks PF Info Ring to find the interrupt cause and handles it accordingly */ +static inline void +acc100_check_ir (struct acc100_device *acc100_dev) +{ +volatile union acc100_info_ring_data *ring_data; +uint16_t info_ring_head = acc100_dev->info_ring_head; +if (acc100_dev->info_ring ==NULL ) +return ; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) {
drivers/baseband/acc100/rte_acc100_pmd.c line 386
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+if ((ring_data->int_nb <ACC100_PF_INT_DMA_DL_DESC_IRQ ) || ( + ring_data->int_nb > +ACC100_PF_INT_DMA_DL5G_DESC_IRQ )) +rte_bbdev_log (WARNING ,"InfoRing: ITR:%d Info:0x%x" , + ring_data->int_nb, ring_data->detailed_info); +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ; + info_ring_head++; + ring_data = acc100_dev->info_ring + + (info_ring_head &ACC100_INFO_RING_MASK );
These three statements are common for the ring handling, consider a macro or inline function.
Quoted 46 lines
drivers/baseband/acc100/rte_acc100_pmd.c +46
-0+ } +} + +/* Checks PF Info Ring to find the interrupt cause and handles it accordingly */ +static inline void +acc100_pf_interrupt_handler (struct rte_bbdev *dev) +{ +struct acc100_device *acc100_dev = dev->data->dev_private; +volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + +rte_bbdev_log_debug ( +"ACC100 PF Interrupt received, Info Ring data: 0x%x" , + ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_PF_INT_DMA_DL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_PF_INT_DMA_DL5G_DESC_IRQ : + deq_intr_det.queue_id =get_queue_id_from_ring_info ( + dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { +rte_bbdev_log (ERR , +"Couldn't find queue: aq_id: %u, qg_id: %u, vf_id: %u" , + ring_data->aq_id, + ring_data->qg_id, + ring_data->vf_id); +return ; + } +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_DEQUEUE , &deq_intr_det); +break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ;
drivers/baseband/acc100/rte_acc100_pmd.c line 442
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + } +} + +/* Checks VF Info Ring to find the interrupt cause and handles it accordingly */ +static inline void +acc100_vf_interrupt_handler (struct rte_bbdev *dev)
very similar to pf case, consider combining.
Quoted 49 lines
drivers/baseband/acc100/rte_acc100_pmd.c +49
-0+{ +struct acc100_device *acc100_dev = dev->data->dev_private; +volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + +rte_bbdev_log_debug ( +"ACC100 VF Interrupt received, Info Ring data: 0x%x" , + ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_VF_INT_DMA_DL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_VF_INT_DMA_DL5G_DESC_IRQ : +/* VFs are not aware of their vf_id - it's set to 0 in +* queue structures. +*/ + ring_data->vf_id =0 ; + deq_intr_det.queue_id =get_queue_id_from_ring_info ( + dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { +rte_bbdev_log (ERR , +"Couldn't find queue: aq_id: %u, qg_id: %u" , + ring_data->aq_id, + ring_data->qg_id); +return ; + } +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_DEQUEUE , &deq_intr_det); +break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->valid =0 ; + ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head + &ACC100_INFO_RING_MASK ); + } +} +
drivers/baseband/acc100/rte_acc100_pmd.c line 501
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+/* Interrupt handler triggered by ACC100 dev for handling specific interrupt */ +static void +acc100_dev_interrupt_handler (void *cb_arg) +{ +struct rte_bbdev *dev = cb_arg; +struct acc100_device *acc100_dev = dev->data->dev_private; + +/* Read info ring */ +if (acc100_dev->pf_device) +acc100_pf_interrupt_handler (dev);
combined like ..
acc100_interrupt_handler(dev, is_pf)
drivers/baseband/acc100/rte_acc100_pmd.c line 508
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+else +acc100_vf_interrupt_handler (dev); +} + +/* Allocate and setup inforing */ +static int +allocate_inforing (struct rte_bbdev *dev)
consider renaming
allocate_info_ring
Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +14
-0+{ +struct acc100_device *d = dev->data->dev_private; +const struct acc100_registry_addr *reg_addr; +rte_iova_t info_ring_phys; +uint32_t phys_low, phys_high; + +if (d->info_ring !=NULL ) +return 0 ;/* Already configured */ + +/* Choose correct registry addresses for the device type */ +if (d->pf_device) + reg_addr = &pf_reg_addr; +else + reg_addr = &vf_reg_addr;
drivers/baseband/acc100/rte_acc100_pmd.c line 532
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+/* Allocate InfoRing */ + d->info_ring =rte_zmalloc_socket ("Info Ring" , +ACC100_INFO_RING_NUM_ENTRIES * +sizeof (*d->info_ring),RTE_CACHE_LINE_SIZE , + dev->data->socket_id); +if (d->info_ring ==NULL ) { +rte_bbdev_log (ERR , +"Failed to allocate Info Ring for %s:%u" , + dev->device->driver->name, + dev->data->dev_id);
The callers do not check that this fails.
Quoted 20 lines
drivers/baseband/acc100/rte_acc100_pmd.c +16
-0+return -ENOMEM ; + } + info_ring_phys =rte_malloc_virt2iova (d->info_ring); + +/* Setup Info Ring */ + phys_high = (uint32_t )(info_ring_phys >>32 ); + phys_low = (uint32_t )(info_ring_phys); +acc100_reg_write (d, reg_addr->info_ring_hi, phys_high); +acc100_reg_write (d, reg_addr->info_ring_lo, phys_low); +acc100_reg_write (d, reg_addr->info_ring_en,ACC100_REG_IRQ_EN_ALL ); + d->info_ring_head = (acc100_reg_read (d, reg_addr->info_ring_ptr) & +0xFFF ) /sizeof (union acc100_info_ring_data ); +return 0 ; +} + +/* Allocate 64MB memory used for all software rings */ static int acc100_setup_queues (struct rte_bbdev *dev,uint16_t num_queues,int socket_id)
drivers/baseband/acc100/rte_acc100_pmd.c line 636
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0@@ -426,6 +633,7 @@acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_hi, phys_high);acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_lo, phys_low); +allocate_inforing (dev);
need to check here
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0d->harq_layout =rte_zmalloc_socket ("HARQ Layout" ,ACC100_HARQ_LAYOUT *sizeof (*d->harq_layout),RTE_CACHE_LINE_SIZE , dev->data->socket_id);@@ -437,13 +645,53 @@return 0 ; } +static int
drivers/baseband/acc100/rte_acc100_pmd.c line 658
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+acc100_intr_enable(struct rte_bbdev *dev) +{ +int ret; +struct acc100_device *d = dev->data->dev_private; + +/* Only MSI are currently supported */ +if (dev->intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSI || + dev->intr_handle->type ==RTE_INTR_HANDLE_UIO ) { + +allocate_inforing (dev);
need to check here
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ + ret =rte_intr_enable (dev->intr_handle); +if (ret <0 ) { +rte_bbdev_log (ERR , +"Couldn't enable interrupts for device: %s" , + dev->data->name);
drivers/baseband/acc100/rte_acc100_pmd.c line 674
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+rte_free (d->info_ring); +return ret; + } + ret =rte_intr_callback_register (dev->intr_handle, + acc100_dev_interrupt_handler, dev); +if (ret <0 ) { +rte_bbdev_log (ERR , +"Couldn't register interrupt callback for device: %s" , + dev->data->name); +rte_free (d->info_ring);
does intr need to be disabled here ?
Quoted 74 lines
drivers/baseband/acc100/rte_acc100_pmd.c +30
-2+return ret; + } + +return 0 ; + } + +rte_bbdev_log (ERR ,"ACC100 (%s) supports only VFIO MSI interrupts" , + dev->data->name); +return -ENOTSUP ; +} +/* Free 64MB memory used for software rings */ static int acc100_dev_close (struct rte_bbdev *dev) {struct acc100_device *d = dev->data->dev_private; +acc100_check_ir (d);if (d->sw_rings_base !=NULL ) {rte_free (d->tail_ptrs); +rte_free (d->info_ring);rte_free (d->sw_rings_base); d->sw_rings_base =NULL ; }@@ -643,6 +891,7 @@RTE_BBDEV_TURBO_CRC_TYPE_24B |RTE_BBDEV_TURBO_HALF_ITERATION_EVEN |RTE_BBDEV_TURBO_EARLY_TERMINATION | +RTE_BBDEV_TURBO_DEC_INTERRUPTS |RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN |RTE_BBDEV_TURBO_MAP_DEC | RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP |@@ -663,6 +912,7 @@RTE_BBDEV_TURBO_CRC_24B_ATTACH |RTE_BBDEV_TURBO_RV_INDEX_BYPASS |RTE_BBDEV_TURBO_RATE_MATCH | +RTE_BBDEV_TURBO_ENC_INTERRUPTS | RTE_BBDEV_TURBO_ENC_SCATTER_GATHER, .num_buffers_src = RTE_BBDEV_TURBO_MAX_CODE_BLOCKS,@@ -676,7 +926,8 @@ .capability_flags =RTE_BBDEV_LDPC_RATE_MATCH |RTE_BBDEV_LDPC_CRC_24B_ATTACH | - RTE_BBDEV_LDPC_INTERLEAVER_BYPASS, +RTE_BBDEV_LDPC_INTERLEAVER_BYPASS | + RTE_BBDEV_LDPC_ENC_INTERRUPTS, .num_buffers_src = RTE_BBDEV_LDPC_MAX_CODE_BLOCKS, .num_buffers_dst =@@ -701,7 +952,8 @@RTE_BBDEV_LDPC_DECODE_BYPASS |RTE_BBDEV_LDPC_DEC_SCATTER_GATHER |RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION | - RTE_BBDEV_LDPC_LLR_COMPRESSION, +RTE_BBDEV_LDPC_LLR_COMPRESSION | + RTE_BBDEV_LDPC_DEC_INTERRUPTS, .llr_size = 8, .llr_decimals = 1, .num_buffers_src =@@ -751,14 +1003,39 @@#else dev_info->harq_buffer_size =0 ;#endif +acc100_check_ir (d); +} + +static int +acc100_queue_intr_enable (struct rte_bbdev *dev,uint16_t queue_id) +{ +struct acc100_queue *q = dev->data->queues[queue_id].queue_private; + +if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && + dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +return -ENOTSUP ;
drivers/baseband/acc100/rte_acc100_pmd.c line 1026
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ + q->irq_enable =1 ; +return 0 ; +} + +static int +acc100_queue_intr_disable (struct rte_bbdev *dev,uint16_t queue_id) +{ +struct acc100_queue *q = dev->data->queues[queue_id].queue_private; + q->irq_enable =0 ;
A -ENOTSUP above, should need similar check here.
Quoted 42 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-1+return 0 ; }static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, + .intr_enable = acc100_intr_enable, .close = acc100_dev_close, .info_get = acc100_dev_info_get, .queue_setup = acc100_queue_setup, .queue_release = acc100_queue_release, + .queue_intr_enable = acc100_queue_intr_enable, + .queue_intr_disable = acc100_queue_intr_disable };/* ACC100 PCI PF address map */ @@ -3018,8 +3295,10 @@ ? (1 << RTE_BBDEV_DATA_ERROR) : 0); op->status |= ((rsp.dma_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); op->status |= ((rsp.fcw_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); -if (op->status !=0 ) +if (op->status !=0 ) { q_data->queue_stats.dequeue_err_count++; +acc100_check_ir (q->d); + }/* CRC invalid if error exists */ if (!op->status)@@ -3076,6 +3355,9 @@ op->status |=1 <<RTE_BBDEV_SYNDROME_ERROR ; op->ldpc_dec.iter_count = (uint8_t ) rsp.iter_cnt; +if (op->status & (1 <<RTE_BBDEV_DRV_ERROR )) +acc100_check_ir (q->d); +/* Check if this is the last desc in batch (Atomic Queue) */ if (desc->req.last_desc_in_batch) { (*aq_dequeued)++;drivers/baseband/acc100/rte_acc100_pmd.h +0
-0
drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device { · line 562
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.h +1
-0@@ -559,7 +559,14 @@ struct acc100_device {/* Virtual address of the info memory routed to the this function under * operation, whether it is PF or VF. */ +union acc100_info_ring_data *info_ring;
Need a comment that this array needs a sentinel ?
Tom
Quoted 23 lines
drivers/baseband/acc100/rte_acc100_pmd.h +14
-0+union acc100_harq_layout_data *harq_layout; +/* Virtual Info Ring head */ +uint16_t info_ring_head; +/* Number of bytes available for each queue in device, depending on +* how many queues are enabled with configure() +*/ uint32_t sw_ring_size;uint32_t ddr_size;/* Size in kB */ uint32_t *tail_ptrs;/* Base address of response tail pointer buffer */ @@ -575,4 +582,12 @@ struct acc100_device { bool configured; /**< True if this ACC100 device is configured */ }; +/** +* Structure with details about RTE_BBDEV_EVENT_DEQUEUE event. It's passed to +* the callback function. +*/ +struct acc100_deq_intr_details { +uint16_t queue_id; +}; +#endif /* _RTE_ACC100_PMD_H_ */
Re: [dpdk-dev] [PATCH v9 08/10] baseband/acc100: add interrupt support to PMD
Hi Tom,
Quoted 36 lines
From: Tom Rix <[email protected]>
Quoted 23 lines · Nicolas Chautru
Adding capability and functions to support MSI interrupts, call backs and inforing.
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- drivers/baseband/acc100/rte_acc100_pmd.c | 288 ++++++++++++++++++++++++++++++- drivers/baseband/acc100/rte_acc100_pmd.h | 15 ++ 2 files changed, 300 insertions(+), 3 deletions(-)drivers/baseband/acc100/rte_acc100_pmd.c +3
-0@@ -339,6 +339,213 @@free_base_addresses (base_addrs, i); } +/* +* Find queue_id of a device queue based on details from the Info Ring. +* If a queue isn't found UINT16_MAX is returned. drivers/baseband/acc100/rte_acc100_pmd.c line 354
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+*/ +static inline uint16_t +get_queue_id_from_ring_info (struct rte_bbdev_data *data, +const union acc100_info_ring_data ring_data) { +uint16_t queue_id; + +for (queue_id =0 ; queue_id < data->num_queues; ++queue_id) { +struct acc100_queue *acc100_q = + data->queues[queue_id].queue_private; + if (acc100_q != NULL && acc100_q->aq_id == ring_data.aq_id&&
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 358
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ acc100_q->qgrp_id == ring_data.qg_id && + acc100_q->vf_id == ring_data.vf_id) +return queue_id;If
num_queuesis large, this linear search will be slow.Consider changing the search algorithm.
This is not in the time critical part of the code
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 361
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ } + +return UINT16_MAX ;the interrupt handlers that use this function do not a great job of handling this error.
if that error actualy happened then there is not much else that can be done except reporting the unexpected data.
Quoted 20 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+} + +/* Checks PF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void acc100_check_ir (struct +acc100_device *acc100_dev) {drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+volatile union acc100_info_ring_data *ring_data; +uint16_t info_ring_head = acc100_dev->info_ring_head; +if (acc100_dev->info_ring ==NULL ) +return ; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + if ((ring_data->int_nb <
ACC100_PF_INT_DMA_DL_DESC_IRQ) || (drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ ring_data->int_nb > + ACC100_PF_INT_DMA_DL5G_DESC_IRQ)) + rte_bbdev_log(WARNING, "InfoRing: ITR:%dInfo:0x%x",
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ring_data->int_nb, ring_data- detailed_info); +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ; + info_ring_head++; + ring_data = acc100_dev->info_ring + + (info_ring_head &
ACC100_INFO_RING_MASK);
These three statements are common for the ring handling, consider a macro or inline function.
ok
Quoted 125 lines
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ } +} + +/* Checks PF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void acc100_pf_interrupt_handler (struct +rte_bbdev *dev) { +struct acc100_device *acc100_dev = dev->data->dev_private;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + + rte_bbdev_log_debug( + "ACC100 PF Interrupt received, Info Ringdata: 0x%x",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_PF_INT_DMA_DL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_PF_INT_DMA_DL5G_DESC_IRQ : + deq_intr_det.queue_id =get_queue_id_from_ring_info(
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { + rte_bbdev_log(ERR, + "Couldn't find queue: aq_id:%u,
qg_id: %u,vf_id: %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ ring_data->aq_id, + ring_data->qg_id, + ring_data->vf_id); +return ; + } + rte_bbdev_pmd_callback_process(dev, + RTE_BBDEV_EVENT_DEQUEUE,
&deq_intr_det);Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + } +} + +/* Checks VF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void acc100_vf_interrupt_handler (struct +rte_bbdev *dev)very similar to pf case, consider combining.
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+{ +struct acc100_device *acc100_dev = dev->data->dev_private; +volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + + rte_bbdev_log_debug( + "ACC100 VF Interrupt received, Info Ringdata: 0x%x",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_VF_INT_DMA_DL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_VF_INT_DMA_DL5G_DESC_IRQ : +/* VFs are not aware of their vf_id - it's set to 0 in +* queue structures. +*/ + ring_data->vf_id =0 ; + deq_intr_det.queue_id =get_queue_id_from_ring_info(
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { + rte_bbdev_log(ERR, + "Couldn't find queue: aq_id:%u,
qg_id: %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ring_data->aq_id, + ring_data->qg_id); +return ; + } + rte_bbdev_pmd_callback_process(dev, + RTE_BBDEV_EVENT_DEQUEUE,
&deq_intr_det);Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->valid =0 ; + ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + (acc100_dev-
info_ring_headdrivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ & ACC100_INFO_RING_MASK); + }drivers/baseband/acc100/rte_acc100_pmd.c line 501
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+} + +/* Interrupt handler triggered by ACC100 dev for handling specific +interrupt */ static void acc100_dev_interrupt_handler (void *cb_arg) { +struct rte_bbdev *dev = cb_arg; +struct acc100_device *acc100_dev = dev->data->dev_private; + +/* Read info ring */ +if (acc100_dev->pf_device) +acc100_pf_interrupt_handler (dev);combined like ..
Quoted 1 line
acc100_interrupt_handler(dev, is_pf)
unsure it will help readability. Much of the code would still be distinct
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 508
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+else +acc100_vf_interrupt_handler (dev); +} + +/* Allocate and setup inforing */ +static int +allocate_inforing (struct rte_bbdev *dev)consider renaming
Quoted 1 line
allocate_info_ring
ok
Quoted 18 lines
Quoted 18 lines
drivers/baseband/acc100/rte_acc100_pmd.c +17
-0+{ +struct acc100_device *d = dev->data->dev_private; +const struct acc100_registry_addr *reg_addr; +rte_iova_t info_ring_phys; +uint32_t phys_low, phys_high; + +if (d->info_ring !=NULL ) +return 0 ;/* Already configured */ + +/* Choose correct registry addresses for the device type */ +if (d->pf_device) + reg_addr = &pf_reg_addr; +else + reg_addr = &vf_reg_addr; +/* Allocate InfoRing */ + d->info_ring = rte_zmalloc_socket("Info Ring", + ACC100_INFO_RING_NUM_ENTRIES *
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 532
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+sizeof (*d->info_ring),RTE_CACHE_LINE_SIZE , + dev->data->socket_id); +if (d->info_ring ==NULL ) { +rte_bbdev_log (ERR , +"Failed to allocate Info Ring for %s:%u" , + dev->device->driver->name, + dev->data->dev_id);The callers do not check that this fails.
arguably the error would be self contained if that did fail. But doesn't hurt to add, ok.
Quoted 60 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+return -ENOMEM ; + } + info_ring_phys =rte_malloc_virt2iova (d->info_ring); + +/* Setup Info Ring */ + phys_high = (uint32_t )(info_ring_phys >>32 ); + phys_low = (uint32_t )(info_ring_phys); +acc100_reg_write (d, reg_addr->info_ring_hi, phys_high); +acc100_reg_write (d, reg_addr->info_ring_lo, phys_low); + acc100_reg_write(d, reg_addr->info_ring_en,
ACC100_REG_IRQ_EN_ALL);drivers/baseband/acc100/rte_acc100_pmd.c line 636
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ d->info_ring_head = (acc100_reg_read (d, reg_addr->info_ring_ptr) & +0xFFF ) /sizeof (union acc100_info_ring_data ); +return 0 ; +} + + /* Allocate 64MB memory used for all software rings */ static int
acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)@@ -426,6 +633,7 @@drivers/baseband/acc100/rte_acc100_pmd.c +1
-0acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_hi, phys_high);acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_lo, phys_low); +allocate_inforing (dev);need to check here
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0d->harq_layout =rte_zmalloc_socket ("HARQ Layout" ,ACC100_HARQ_LAYOUT *sizeof (*d->harq_layout), RTE_CACHE_LINE_SIZE, dev->data->socket_id); @@ -437,13 +645,53 @@
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0return 0 ; } +static int +acc100_intr_enable (struct rte_bbdev *dev) { +int ret; +struct acc100_device *d = dev->data->dev_private; + +/* Only MSI are currently supported */ +if (dev->intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSI || + dev->intr_handle->type ==RTE_INTR_HANDLE_UIO ){
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ +allocate_inforing (dev);need to check here
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ + ret =rte_intr_enable (dev->intr_handle); +if (ret <0 ) { + rte_bbdev_log(ERR, + "Couldn't enable interrupts fordevice: %s",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ dev->data->name); +rte_free (d->info_ring); +return ret; + } + ret =rte_intr_callback_register (dev->intr_handle, + acc100_dev_interrupt_handler, dev); +if (ret <0 ) { + rte_bbdev_log(ERR, + "Couldn't register interrupt callbackfor device: %s",
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ dev->data->name); +rte_free (d->info_ring);does intr need to be disabled here ?
Well I don't see a lot of consistency with other drivers. Sometimes these are not even check for failure.
I would rather defer changing through other future patch if required as this is same code on other bbdev drivers already used (if changed I would rather all changed the same way).
Quoted 92 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+return ret; + } + +return 0 ; + } + + rte_bbdev_log(ERR, "ACC100 (%s) supports only VFIO MSIinterrupts",
Quoted 15 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data->name); +return -ENOTSUP ; +} + /* Free 64MB memory used for software rings */ static int
acc100_dev_close(struct rte_bbdev *dev){drivers/baseband/acc100/rte_acc100_pmd.c +2
-0struct acc100_device *d = dev->data->dev_private; +acc100_check_ir (d);if (d->sw_rings_base !=NULL ) {rte_free (d->tail_ptrs); +rte_free (d->info_ring);rte_free (d->sw_rings_base); d->sw_rings_base =NULL ; }drivers/baseband/acc100/rte_acc100_pmd.c line 891
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0@@ -643,6 +891,7 @@RTE_BBDEV_TURBO_CRC_TYPE_24B |
Quoted 1 line
RTE_BBDEV_TURBO_HALF_ITERATION_EVEN|Quoted 1 line
RTE_BBDEV_TURBO_EARLY_TERMINATION|Quoted 1 line
+
RTE_BBDEV_TURBO_DEC_INTERRUPTS|Quoted 1 line
RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN |Quoted 2 lines
RTE_BBDEV_TURBO_MAP_DEC|RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP | @@ -663,6 +912,7@@
Quoted 1 line
RTE_BBDEV_TURBO_CRC_24B_ATTACH|Quoted 1 line
RTE_BBDEV_TURBO_RV_INDEX_BYPASS|drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0RTE_BBDEV_TURBO_RATE_MATCH | +
RTE_BBDEV_TURBO_ENC_INTERRUPTS|Quoted 1 line
RTE_BBDEV_TURBO_ENC_SCATTER_GATHER,Quoted 2 lines
.num_buffers_src =
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS, @@ -676,7 +926,8 @@drivers/baseband/acc100/rte_acc100_pmd.c line 927
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0.capability_flags = RTE_BBDEV_LDPC_RATE_MATCH |RTE_BBDEV_LDPC_CRC_24B_ATTACH |Quoted 1 line
-
RTE_BBDEV_LDPC_INTERLEAVER_BYPASS,Quoted 1 line
+
RTE_BBDEV_LDPC_INTERLEAVER_BYPASS|Quoted 1 line
+
RTE_BBDEV_LDPC_ENC_INTERRUPTS,Quoted 2 lines
.num_buffers_src =
RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c line 954
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0.num_buffers_dst =@@ -701,7 +952,8 @@RTE_BBDEV_LDPC_DECODE_BYPASS | RTE_BBDEV_LDPC_DEC_SCATTER_GATHER |
RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION|Quoted 24 lines
drivers/baseband/acc100/rte_acc100_pmd.c +15
-1- RTE_BBDEV_LDPC_LLR_COMPRESSION, +RTE_BBDEV_LDPC_LLR_COMPRESSION | + RTE_BBDEV_LDPC_DEC_INTERRUPTS, .llr_size = 8, .llr_decimals = 1, .num_buffers_src =@@ -751,14 +1003,39 @@#else dev_info->harq_buffer_size =0 ;#endif +acc100_check_ir (d); +} + +static int +acc100_queue_intr_enable (struct rte_bbdev *dev,uint16_t queue_id) { +struct acc100_queue *q = dev->data- queues[queue_id].queue_private; + +if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && + dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +return -ENOTSUP ; + + q->irq_enable =1 ; +return 0 ;
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1026
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+} + +static int +acc100_queue_intr_disable (struct rte_bbdev *dev,uint16_t queue_id) { +struct acc100_queue *q = dev->data- queues[queue_id].queue_private; + q->irq_enable =0 ;A
-ENOTSUPabove, should need similar check here.
How can this fail when we purely disable?
Quoted 45 lines
Quoted 43 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-1+return 0 ; }static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, + .intr_enable = acc100_intr_enable, .close = acc100_dev_close, .info_get = acc100_dev_info_get, .queue_setup = acc100_queue_setup, .queue_release = acc100_queue_release, + .queue_intr_enable = acc100_queue_intr_enable, + .queue_intr_disable = acc100_queue_intr_disable };/* ACC100 PCI PF address map */ @@ -3018,8 +3295,10 @@ ? (1 << RTE_BBDEV_DATA_ERROR) : 0); op->status |= ((rsp.dma_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); op->status |= ((rsp.fcw_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); -if (op->status !=0 ) +if (op->status !=0 ) { q_data->queue_stats.dequeue_err_count++; +acc100_check_ir (q->d); + }/* CRC invalid if error exists */ if (!op->status)@@ -3076,6 +3355,9 @@ op->status |=1 <<RTE_BBDEV_SYNDROME_ERROR ; op->ldpc_dec.iter_count = (uint8_t ) rsp.iter_cnt; +if (op->status & (1 <<RTE_BBDEV_DRV_ERROR )) +acc100_check_ir (q->d); +/* Check if this is the last desc in batch (Atomic Queue) */ if (desc->req.last_desc_in_batch) { (*aq_dequeued)++;drivers/baseband/acc100/rte_acc100_pmd.h +0
-0drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device { · line 559
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.h +0
-0@@ -559,7 +559,14 @@ struct acc100_device {/* Virtual address of the info memory routed to the this function under
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device { · line 562
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.h +1
-0* operation, whether it is PF or VF. */ +union acc100_info_ring_data *info_ring;Need a comment that this array needs a sentinel ?
Can clarify a bit expected HW behaviour
Thanks
Quoted 28 lines
Tom
drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device {
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.h +4
-0+union acc100_harq_layout_data *harq_layout; +/* Virtual Info Ring head */ +uint16_t info_ring_head; +/* Number of bytes available for each queue in device, depending on
Quoted 19 lines
drivers/baseband/acc100/rte_acc100_pmd.h +2
-0+* how many queues are enabled with configure() +*/ uint32_t sw_ring_size;uint32_t ddr_size;/* Size in kB */ uint32_t *tail_ptrs;/* Base address of response tail pointer buffer */ @@ -575,4 +582,12 @@ struct
acc100_device{
bool configured; /**< True if this ACC100 device is configured */
};drivers/baseband/acc100/rte_acc100_pmd.h +9
-0+/** +* Structure with details about RTE_BBDEV_EVENT_DEQUEUE event. It's +passed to +* the callback function. +*/ +struct acc100_deq_intr_details { +uint16_t queue_id; +}; +#endif /* _RTE_ACC100_PMD_H_ */
Re: [dpdk-dev] [PATCH v9 08/10] baseband/acc100: add interrupt support to PMD
Quoted 38 lines · Nicolas
Hi Tom,
Quoted 36 lines
From: Tom Rix <[email protected]>
Quoted 23 lines · Nicolas Chautru
Adding capability and functions to support MSI interrupts, call backs and inforing.
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- drivers/baseband/acc100/rte_acc100_pmd.c | 288 ++++++++++++++++++++++++++++++- drivers/baseband/acc100/rte_acc100_pmd.h | 15 ++ 2 files changed, 300 insertions(+), 3 deletions(-)drivers/baseband/acc100/rte_acc100_pmd.c +3
-0@@ -339,6 +339,213 @@free_base_addresses (base_addrs, i); } +/* +* Find queue_id of a device queue based on details from the Info Ring. +* If a queue isn't found UINT16_MAX is returned. drivers/baseband/acc100/rte_acc100_pmd.c line 354
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+*/ +static inline uint16_t +get_queue_id_from_ring_info (struct rte_bbdev_data *data, +const union acc100_info_ring_data ring_data) { +uint16_t queue_id; + +for (queue_id =0 ; queue_id < data->num_queues; ++queue_id) { +struct acc100_queue *acc100_q = + data->queues[queue_id].queue_private; + if (acc100_q != NULL && acc100_q->aq_id == ring_data.aq_id&&
Quoted 7 lines
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 358
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ acc100_q->qgrp_id == ring_data.qg_id && + acc100_q->vf_id == ring_data.vf_id) +return queue_id;If
num_queuesis large, this linear search will be slow.Consider changing the search algorithm.
This is not in the time critical part of the code
ok
Quoted 8 lines
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 361
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ } + +return UINT16_MAX ;the interrupt handlers that use this function do not a great job of handling this error.
if that error actualy happened then there is not much else that can be done except reporting the unexpected data.
ok
Quoted 157 lines
Quoted 21 lines
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+} + +/* Checks PF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void acc100_check_ir (struct +acc100_device *acc100_dev) {drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+volatile union acc100_info_ring_data *ring_data; +uint16_t info_ring_head = acc100_dev->info_ring_head; +if (acc100_dev->info_ring ==NULL ) +return ; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + if ((ring_data->int_nb <
ACC100_PF_INT_DMA_DL_DESC_IRQ) || (drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ ring_data->int_nb > + ACC100_PF_INT_DMA_DL5G_DESC_IRQ)) + rte_bbdev_log(WARNING, "InfoRing: ITR:%dInfo:0x%x",
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ring_data->int_nb, ring_data- detailed_info); +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ; + info_ring_head++; + ring_data = acc100_dev->info_ring + + (info_ring_head &
ACC100_INFO_RING_MASK);
These three statements are common for the ring handling, consider a macro or inline function.ok
Quoted 124 lines
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ } +} + +/* Checks PF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void acc100_pf_interrupt_handler (struct +rte_bbdev *dev) { +struct acc100_device *acc100_dev = dev->data->dev_private;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + + rte_bbdev_log_debug( + "ACC100 PF Interrupt received, Info Ringdata: 0x%x",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_PF_INT_DMA_DL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_PF_INT_DMA_DL5G_DESC_IRQ : + deq_intr_det.queue_id =get_queue_id_from_ring_info(
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { + rte_bbdev_log(ERR, + "Couldn't find queue: aq_id:%u,
qg_id: %u,vf_id: %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ ring_data->aq_id, + ring_data->qg_id, + ring_data->vf_id); +return ; + } + rte_bbdev_pmd_callback_process(dev, + RTE_BBDEV_EVENT_DEQUEUE,
&deq_intr_det);Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + } +} + +/* Checks VF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void acc100_vf_interrupt_handler (struct +rte_bbdev *dev)very similar to pf case, consider combining.
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+{ +struct acc100_device *acc100_dev = dev->data->dev_private; +volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + + rte_bbdev_log_debug( + "ACC100 VF Interrupt received, Info Ringdata: 0x%x",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_VF_INT_DMA_DL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_VF_INT_DMA_DL5G_DESC_IRQ : +/* VFs are not aware of their vf_id - it's set to 0 in +* queue structures. +*/ + ring_data->vf_id =0 ; + deq_intr_det.queue_id =get_queue_id_from_ring_info(
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { + rte_bbdev_log(ERR, + "Couldn't find queue: aq_id:%u,
qg_id: %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ring_data->aq_id, + ring_data->qg_id); +return ; + } + rte_bbdev_pmd_callback_process(dev, + RTE_BBDEV_EVENT_DEQUEUE,
&deq_intr_det);Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->valid =0 ; + ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + (acc100_dev-
info_ring_headdrivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ & ACC100_INFO_RING_MASK); + }drivers/baseband/acc100/rte_acc100_pmd.c line 501
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+} + +/* Interrupt handler triggered by ACC100 dev for handling specific +interrupt */ static void acc100_dev_interrupt_handler (void *cb_arg) { +struct rte_bbdev *dev = cb_arg; +struct acc100_device *acc100_dev = dev->data->dev_private; + +/* Read info ring */ +if (acc100_dev->pf_device) +acc100_pf_interrupt_handler (dev);combined like ..
Quoted 2 lines
Quoted 1 line
acc100_interrupt_handler(dev, is_pf)unsure it will help readability. Much of the code would still be distinct
ok
Quoted 100 lines
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 508
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+else +acc100_vf_interrupt_handler (dev); +} + +/* Allocate and setup inforing */ +static int +allocate_inforing (struct rte_bbdev *dev)consider renaming
allocate_info_ringok
Quoted 17 lines
Quoted 17 lines
drivers/baseband/acc100/rte_acc100_pmd.c +17
-0+{ +struct acc100_device *d = dev->data->dev_private; +const struct acc100_registry_addr *reg_addr; +rte_iova_t info_ring_phys; +uint32_t phys_low, phys_high; + +if (d->info_ring !=NULL ) +return 0 ;/* Already configured */ + +/* Choose correct registry addresses for the device type */ +if (d->pf_device) + reg_addr = &pf_reg_addr; +else + reg_addr = &vf_reg_addr; +/* Allocate InfoRing */ + d->info_ring = rte_zmalloc_socket("Info Ring", + ACC100_INFO_RING_NUM_ENTRIES *Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 532
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+sizeof (*d->info_ring),RTE_CACHE_LINE_SIZE , + dev->data->socket_id); +if (d->info_ring ==NULL ) { +rte_bbdev_log (ERR , +"Failed to allocate Info Ring for %s:%u" , + dev->device->driver->name, + dev->data->dev_id);The callers do not check that this fails.
arguably the error would be self contained if that did fail. But doesn't hurt to add, ok.
Quoted 60 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+return -ENOMEM ; + } + info_ring_phys =rte_malloc_virt2iova (d->info_ring); + +/* Setup Info Ring */ + phys_high = (uint32_t )(info_ring_phys >>32 ); + phys_low = (uint32_t )(info_ring_phys); +acc100_reg_write (d, reg_addr->info_ring_hi, phys_high); +acc100_reg_write (d, reg_addr->info_ring_lo, phys_low); + acc100_reg_write(d, reg_addr->info_ring_en,
ACC100_REG_IRQ_EN_ALL);drivers/baseband/acc100/rte_acc100_pmd.c line 636
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ d->info_ring_head = (acc100_reg_read (d, reg_addr->info_ring_ptr) & +0xFFF ) /sizeof (union acc100_info_ring_data ); +return 0 ; +} + + /* Allocate 64MB memory used for all software rings */ static int
acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)@@ -426,6 +633,7 @@drivers/baseband/acc100/rte_acc100_pmd.c +1
-0acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_hi, phys_high);acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_lo, phys_low); +allocate_inforing (dev);need to check here
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0d->harq_layout =rte_zmalloc_socket ("HARQ Layout" ,ACC100_HARQ_LAYOUT *sizeof (*d->harq_layout), RTE_CACHE_LINE_SIZE, dev->data->socket_id); @@ -437,13 +645,53 @@
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0return 0 ; } +static int +acc100_intr_enable (struct rte_bbdev *dev) { +int ret; +struct acc100_device *d = dev->data->dev_private; + +/* Only MSI are currently supported */ +if (dev->intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSI || + dev->intr_handle->type ==RTE_INTR_HANDLE_UIO ){
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ +allocate_inforing (dev);need to check here
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ + ret =rte_intr_enable (dev->intr_handle); +if (ret <0 ) { + rte_bbdev_log(ERR, + "Couldn't enable interrupts fordevice: %s",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ dev->data->name); +rte_free (d->info_ring); +return ret; + } + ret =rte_intr_callback_register (dev->intr_handle, + acc100_dev_interrupt_handler, dev); +if (ret <0 ) { + rte_bbdev_log(ERR, + "Couldn't register interrupt callbackfor device: %s",
Quoted 5 lines
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ dev->data->name); +rte_free (d->info_ring);does intr need to be disabled here ?
Well I don't see a lot of consistency with other drivers. Sometimes these are not even check for failure.
I would rather defer changing through other future patch if required as this is same code on other bbdev drivers already used (if changed I would rather all changed the same way).
ok.
Quoted 95 lines
Quoted 87 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+return ret; + } + +return 0 ; + } + + rte_bbdev_log(ERR, "ACC100 (%s) supports only VFIO MSIinterrupts",
Quoted 15 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data->name); +return -ENOTSUP ; +} + /* Free 64MB memory used for software rings */ static int
acc100_dev_close(struct rte_bbdev *dev){drivers/baseband/acc100/rte_acc100_pmd.c +2
-0struct acc100_device *d = dev->data->dev_private; +acc100_check_ir (d);if (d->sw_rings_base !=NULL ) {rte_free (d->tail_ptrs); +rte_free (d->info_ring);rte_free (d->sw_rings_base); d->sw_rings_base =NULL ; }drivers/baseband/acc100/rte_acc100_pmd.c line 891
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0@@ -643,6 +891,7 @@RTE_BBDEV_TURBO_CRC_TYPE_24B |
RTE_BBDEV_TURBO_HALF_ITERATION_EVEN|
RTE_BBDEV_TURBO_EARLY_TERMINATION|drivers/baseband/acc100/rte_acc100_pmd.c line 892
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+RTE_BBDEV_TURBO_DEC_INTERRUPTS | RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN |drivers/baseband/acc100/rte_acc100_pmd.c line 894
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0RTE_BBDEV_TURBO_MAP_DEC |RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP | @@ -663,6 +912,7@@
RTE_BBDEV_TURBO_CRC_24B_ATTACH|
RTE_BBDEV_TURBO_RV_INDEX_BYPASS|drivers/baseband/acc100/rte_acc100_pmd.c line 896
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0RTE_BBDEV_TURBO_RATE_MATCH | +
RTE_BBDEV_TURBO_ENC_INTERRUPTS|
RTE_BBDEV_TURBO_ENC_SCATTER_GATHER,drivers/baseband/acc100/rte_acc100_pmd.c line 897
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0.num_buffers_src =RTE_BBDEV_TURBO_MAX_CODE_BLOCKS, @@ -676,7 +926,8 @@drivers/baseband/acc100/rte_acc100_pmd.c line 927
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0.capability_flags = RTE_BBDEV_LDPC_RATE_MATCH |RTE_BBDEV_LDPC_CRC_24B_ATTACH |Quoted 1 line
-
RTE_BBDEV_LDPC_INTERLEAVER_BYPASS,Quoted 1 line
+
RTE_BBDEV_LDPC_INTERLEAVER_BYPASS|Quoted 1 line
+
RTE_BBDEV_LDPC_ENC_INTERRUPTS,Quoted 2 lines
.num_buffers_src =
RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c line 954
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0.num_buffers_dst =@@ -701,7 +952,8 @@RTE_BBDEV_LDPC_DECODE_BYPASS | RTE_BBDEV_LDPC_DEC_SCATTER_GATHER |
RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION|Quoted 24 lines
drivers/baseband/acc100/rte_acc100_pmd.c +15
-1- RTE_BBDEV_LDPC_LLR_COMPRESSION, +RTE_BBDEV_LDPC_LLR_COMPRESSION | + RTE_BBDEV_LDPC_DEC_INTERRUPTS, .llr_size = 8, .llr_decimals = 1, .num_buffers_src =@@ -751,14 +1003,39 @@#else dev_info->harq_buffer_size =0 ;#endif +acc100_check_ir (d); +} + +static int +acc100_queue_intr_enable (struct rte_bbdev *dev,uint16_t queue_id) { +struct acc100_queue *q = dev->data- queues[queue_id].queue_private; + +if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && + dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +return -ENOTSUP ; + + q->irq_enable =1 ; +return 0 ;Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1026
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+} + +static int +acc100_queue_intr_disable (struct rte_bbdev *dev,uint16_t queue_id) { +struct acc100_queue *q = dev->data- queues[queue_id].queue_private; + q->irq_enable =0 ;A
-ENOTSUPabove, should need similar check here.
Quoted 1 line
How can this fail when we purely disable?
It is for api consistency.
the enable fails
the disable succeeds
that is not consistent.
Tom
Quoted 81 lines
Quoted 46 lines
Quoted 44 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-1+return 0 ; }static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, + .intr_enable = acc100_intr_enable, .close = acc100_dev_close, .info_get = acc100_dev_info_get, .queue_setup = acc100_queue_setup, .queue_release = acc100_queue_release, + .queue_intr_enable = acc100_queue_intr_enable, + .queue_intr_disable = acc100_queue_intr_disable };/* ACC100 PCI PF address map */ @@ -3018,8 +3295,10 @@ ? (1 << RTE_BBDEV_DATA_ERROR) : 0); op->status |= ((rsp.dma_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); op->status |= ((rsp.fcw_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); -if (op->status !=0 ) +if (op->status !=0 ) { q_data->queue_stats.dequeue_err_count++; +acc100_check_ir (q->d); + }/* CRC invalid if error exists */ if (!op->status)@@ -3076,6 +3355,9 @@ op->status |=1 <<RTE_BBDEV_SYNDROME_ERROR ; op->ldpc_dec.iter_count = (uint8_t ) rsp.iter_cnt; +if (op->status & (1 <<RTE_BBDEV_DRV_ERROR )) +acc100_check_ir (q->d); +/* Check if this is the last desc in batch (Atomic Queue) */ if (desc->req.last_desc_in_batch) { (*aq_dequeued)++;drivers/baseband/acc100/rte_acc100_pmd.h +0
-0drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device { · line 559
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.h +0
-0@@ -559,7 +559,14 @@ struct acc100_device {/* Virtual address of the info memory routed to the this function under
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device { · line 562
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.h +1
-0* operation, whether it is PF or VF. */ +union acc100_info_ring_data *info_ring;Need a comment that this array needs a sentinel ?
Can clarify a bit expected HW behaviour
Thanks
Quoted 27 lines
Tom
drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device {
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.h +4
-0+union acc100_harq_layout_data *harq_layout; +/* Virtual Info Ring head */ +uint16_t info_ring_head; +/* Number of bytes available for each queue in device, depending on
Quoted 19 lines
drivers/baseband/acc100/rte_acc100_pmd.h +2
-0+* how many queues are enabled with configure() +*/ uint32_t sw_ring_size;uint32_t ddr_size;/* Size in kB */ uint32_t *tail_ptrs;/* Base address of response tail pointer buffer */ @@ -575,4 +582,12 @@ struct
acc100_device{
bool configured; /**< True if this ACC100 device is configured */
};drivers/baseband/acc100/rte_acc100_pmd.h +9
-0+/** +* Structure with details about RTE_BBDEV_EVENT_DEQUEUE event. It's +passed to +* the callback function. +*/ +struct acc100_deq_intr_details { +uint16_t queue_id; +}; +#endif /* _RTE_ACC100_PMD_H_ */
Re: [dpdk-dev] [PATCH v9 08/10] baseband/acc100: add interrupt support to PMD
Hi Tom,
Quoted 431 lines
From: Tom Rix <[email protected]>
Quoted 37 lines · Nicolas
Hi Tom,
Quoted 35 lines
From: Tom Rix <[email protected]>
Quoted 22 lines · Nicolas Chautru
Adding capability and functions to support MSI interrupts, call backs and inforing.
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- drivers/baseband/acc100/rte_acc100_pmd.c | 288 ++++++++++++++++++++++++++++++- drivers/baseband/acc100/rte_acc100_pmd.h | 15 ++ 2 files changed, 300 insertions(+), 3 deletions(-)drivers/baseband/acc100/rte_acc100_pmd.c +3
-0@@ -339,6 +339,213 @@free_base_addresses (base_addrs, i); } +/* +* Find queue_id of a device queue based on details from the Info Ring. +* If a queue isn't found UINT16_MAX is returned. drivers/baseband/acc100/rte_acc100_pmd.c line 353
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+*/ +static inline uint16_t +get_queue_id_from_ring_info (struct rte_bbdev_data *data, +const union acc100_info_ring_data ring_data) { +uint16_t queue_id; + +for (queue_id =0 ; queue_id < data->num_queues; ++queue_id) { +struct acc100_queue *acc100_q = + data->queues[queue_id].queue_private; + if (acc100_q != NULL && acc100_q->aq_id == ring_data.aq_id&&
Quoted 7 lines
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 358
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ acc100_q->qgrp_id == ring_data.qg_id && + acc100_q->vf_id == ring_data.vf_id) +return queue_id;If
num_queuesis large, this linear search will be slow.Consider changing the search algorithm.
This is not in the time critical part of the code
ok
Quoted 8 lines
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 361
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ } + +return UINT16_MAX ;the interrupt handlers that use this function do not a great job of handling this error.
if that error actualy happened then there is not much else that can be
done except reporting the unexpected data.
okQuoted 159 lines
Quoted 21 lines
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+} + +/* Checks PF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void acc100_check_ir (struct +acc100_device *acc100_dev) {drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+volatile union acc100_info_ring_data *ring_data; +uint16_t info_ring_head = acc100_dev->info_ring_head; +if (acc100_dev->info_ring ==NULL ) +return ; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + if ((ring_data->int_nb <
ACC100_PF_INT_DMA_DL_DESC_IRQ) || (drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ ring_data->int_nb > + ACC100_PF_INT_DMA_DL5G_DESC_IRQ)) + rte_bbdev_log(WARNING, "InfoRing: ITR:%dInfo:0x%x",
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ring_data->int_nb, ring_data- detailed_info); +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ; + info_ring_head++; + ring_data = acc100_dev->info_ring + + (info_ring_head &
ACC100_INFO_RING_MASK);
These three statements are common for the ring handling, consider a macro or inline function.ok
Quoted 126 lines
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ } +} + +/* Checks PF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void +acc100_pf_interrupt_handler (struct +rte_bbdev *dev) { +struct acc100_device *acc100_dev = dev->data->dev_private;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + + rte_bbdev_log_debug( + "ACC100 PF Interrupt received, Info Ringdata: 0x%x",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_PF_INT_DMA_DL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL_DESC_IRQ : +case ACC100_PF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_PF_INT_DMA_DL5G_DESC_IRQ : + deq_intr_det.queue_id =get_queue_id_from_ring_info(
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { + rte_bbdev_log(ERR, + "Couldn't find queue: aq_id:%u,
qg_id: %u,vf_id: %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ ring_data->aq_id, + ring_data->qg_id, + ring_data->vf_id); +return ; + } + rte_bbdev_pmd_callback_process(dev, + RTE_BBDEV_EVENT_DEQUEUE,
&deq_intr_det);Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->val =0 ; + ++acc100_dev->info_ring_head;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ ring_data = acc100_dev->info_ring + + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + } +} + +/* Checks VF Info Ring to find the interrupt cause and handles it +accordingly */ static inline void +acc100_vf_interrupt_handler (struct +rte_bbdev *dev)very similar to pf case, consider combining.
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+{ +struct acc100_device *acc100_dev = dev->data->dev_private; +volatile union acc100_info_ring_data *ring_data; +struct acc100_deq_intr_details deq_intr_det; + + ring_data = acc100_dev->info_ring + (acc100_dev->info_ring_head & +ACC100_INFO_RING_MASK ); + +while (ring_data->valid) { + + rte_bbdev_log_debug( + "ACC100 VF Interrupt received, Info Ringdata: 0x%x",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+ ring_data->val); + +switch (ring_data->int_nb) { +case ACC100_VF_INT_DMA_DL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL_DESC_IRQ : +case ACC100_VF_INT_DMA_UL5G_DESC_IRQ : +case ACC100_VF_INT_DMA_DL5G_DESC_IRQ : +/* VFs are not aware of their vf_id - it's set to 0 in +* queue structures. +*/ + ring_data->vf_id =0 ; + deq_intr_det.queue_id =get_queue_id_from_ring_info(
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data, *ring_data); +if (deq_intr_det.queue_id ==UINT16_MAX ) { + rte_bbdev_log(ERR, + "Couldn't find queue: aq_id:%u,
qg_id: %u",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ring_data->aq_id, + ring_data->qg_id); +return ; + } + rte_bbdev_pmd_callback_process(dev, + RTE_BBDEV_EVENT_DEQUEUE,
&deq_intr_det);Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+break ; +default : +rte_bbdev_pmd_callback_process (dev, +RTE_BBDEV_EVENT_ERROR ,NULL ); +break ; + } + +/* Initialize Info Ring entry and move forward */ + ring_data->valid =0 ; + ++acc100_dev->info_ring_head; + ring_data = acc100_dev->info_ring + (acc100_dev-
info_ring_headdrivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ & ACC100_INFO_RING_MASK); + }drivers/baseband/acc100/rte_acc100_pmd.c line 501
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+} + +/* Interrupt handler triggered by ACC100 dev for handling specific +interrupt */ static void acc100_dev_interrupt_handler (void *cb_arg) { +struct rte_bbdev *dev = cb_arg; +struct acc100_device *acc100_dev = dev->data->dev_private; + +/* Read info ring */ +if (acc100_dev->pf_device) +acc100_pf_interrupt_handler (dev);combined like ..
Quoted 3 lines
Quoted 1 line
acc100_interrupt_handler(dev, is_pf)unsure it will help readability. Much of the code would still be distinct
ok
Quoted 37 lines
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 508
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+else +acc100_vf_interrupt_handler (dev); } + +/* Allocate and setup inforing */ +static int +allocate_inforing (struct rte_bbdev *dev)consider renaming
allocate_info_ringok
Quoted 17 lines
Quoted 17 lines
drivers/baseband/acc100/rte_acc100_pmd.c +17
-0+{ +struct acc100_device *d = dev->data->dev_private; +const struct acc100_registry_addr *reg_addr; +rte_iova_t info_ring_phys; +uint32_t phys_low, phys_high; + +if (d->info_ring !=NULL ) +return 0 ;/* Already configured */ + +/* Choose correct registry addresses for the device type */ +if (d->pf_device) + reg_addr = &pf_reg_addr; +else + reg_addr = &vf_reg_addr; +/* Allocate InfoRing */ + d->info_ring = rte_zmalloc_socket("Info Ring", + ACC100_INFO_RING_NUM_ENTRIES *Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 532
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+sizeof (*d->info_ring),RTE_CACHE_LINE_SIZE , + dev->data->socket_id); +if (d->info_ring ==NULL ) { +rte_bbdev_log (ERR , +"Failed to allocate Info Ring for %s:%u" , + dev->device->driver->name, + dev->data->dev_id);The callers do not check that this fails.
Quoted 1 line
arguably the error would be self contained if that did fail. But doesn't hurt
to add, ok.
Quoted 61 lines
Quoted 61 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+return -ENOMEM ; + } + info_ring_phys =rte_malloc_virt2iova (d->info_ring); + +/* Setup Info Ring */ + phys_high = (uint32_t )(info_ring_phys >>32 ); + phys_low = (uint32_t )(info_ring_phys); +acc100_reg_write (d, reg_addr->info_ring_hi, phys_high); +acc100_reg_write (d, reg_addr->info_ring_lo, phys_low); + acc100_reg_write(d, reg_addr->info_ring_en,
ACC100_REG_IRQ_EN_ALL);drivers/baseband/acc100/rte_acc100_pmd.c line 636
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ d->info_ring_head = (acc100_reg_read (d, reg_addr->info_ring_ptr) & +0xFFF ) /sizeof (union acc100_info_ring_data ); +return 0 ; +} + + /* Allocate 64MB memory used for all software rings */ static int
acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)@@ -426,6 +633,7 @@drivers/baseband/acc100/rte_acc100_pmd.c +1
-0acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_hi, phys_high);acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_lo, phys_low); +allocate_inforing (dev);need to check here
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0d->harq_layout =rte_zmalloc_socket ("HARQ Layout" ,ACC100_HARQ_LAYOUT *sizeof (*d->harq_layout), RTE_CACHE_LINE_SIZE, dev->data->socket_id); @@ -437,13 +645,53 @@
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 11 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0return 0 ; } +static int +acc100_intr_enable (struct rte_bbdev *dev) { +int ret; +struct acc100_device *d = dev->data->dev_private; + +/* Only MSI are currently supported */ +if (dev->intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSI || + dev->intr_handle->type ==RTE_INTR_HANDLE_UIO ){
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ +allocate_inforing (dev);need to check here
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ + ret =rte_intr_enable (dev->intr_handle); +if (ret <0 ) { + rte_bbdev_log(ERR, + "Couldn't enable interrupts fordevice: %s",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ dev->data->name); +rte_free (d->info_ring); +return ret; + } + ret =rte_intr_callback_register (dev->intr_handle, + acc100_dev_interrupt_handler, dev); +if (ret <0 ) { + rte_bbdev_log(ERR, + "Couldn't register interrupt callbackfor device: %s",
Quoted 4 lines
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ dev->data->name); +rte_free (d->info_ring);does intr need to be disabled here ?
Well I don't see a lot of consistency with other drivers. Sometimes these
are not even check for failure.
Quoted 1 line
I would rather defer changing through other future patch if required as this
is same code on other bbdev drivers already used (if changed I would rather all changed the same way).
ok.
Quoted 28 lines
Quoted 28 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+return ret; + } + +return 0 ; + } + + rte_bbdev_log(ERR, "ACC100 (%s) supports only VFIO MSIinterrupts",
Quoted 15 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ dev->data->name); +return -ENOTSUP ; +} + /* Free 64MB memory used for software rings */ static int
acc100_dev_close(struct rte_bbdev *dev){drivers/baseband/acc100/rte_acc100_pmd.c +2
-0struct acc100_device *d = dev->data->dev_private; +acc100_check_ir (d);if (d->sw_rings_base !=NULL ) {rte_free (d->tail_ptrs); +rte_free (d->info_ring);rte_free (d->sw_rings_base); d->sw_rings_base =NULL ; }drivers/baseband/acc100/rte_acc100_pmd.c line 891
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0@@ -643,6 +891,7 @@RTE_BBDEV_TURBO_CRC_TYPE_24B |
RTE_BBDEV_TURBO_HALF_ITERATION_EVEN|
RTE_BBDEV_TURBO_EARLY_TERMINATION|Quoted 6 lines
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 892
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+RTE_BBDEV_TURBO_DEC_INTERRUPTS | RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN |drivers/baseband/acc100/rte_acc100_pmd.c line 894
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0RTE_BBDEV_TURBO_MAP_DEC |RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP | @@ -663,6 +912,7@@
Quoted 28 lines
Quoted 28 lines
RTE_BBDEV_TURBO_CRC_24B_ATTACH|
RTE_BBDEV_TURBO_RV_INDEX_BYPASS|drivers/baseband/acc100/rte_acc100_pmd.c line 896
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0RTE_BBDEV_TURBO_RATE_MATCH | +
RTE_BBDEV_TURBO_ENC_INTERRUPTS|
RTE_BBDEV_TURBO_ENC_SCATTER_GATHER,drivers/baseband/acc100/rte_acc100_pmd.c line 897
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0.num_buffers_src =RTE_BBDEV_TURBO_MAX_CODE_BLOCKS, @@ -676,7 +926,8 @@drivers/baseband/acc100/rte_acc100_pmd.c line 927
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0.capability_flags = RTE_BBDEV_LDPC_RATE_MATCH |RTE_BBDEV_LDPC_CRC_24B_ATTACH |Quoted 1 line
-
RTE_BBDEV_LDPC_INTERLEAVER_BYPASS,Quoted 1 line
+
RTE_BBDEV_LDPC_INTERLEAVER_BYPASS|Quoted 1 line
+
RTE_BBDEV_LDPC_ENC_INTERRUPTS,Quoted 2 lines
.num_buffers_src =
RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,drivers/baseband/acc100/rte_acc100_pmd.c line 954
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +0
-0.num_buffers_dst =@@ -701,7 +952,8 @@RTE_BBDEV_LDPC_DECODE_BYPASS | RTE_BBDEV_LDPC_DEC_SCATTER_GATHER |
RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION|Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-1- RTE_BBDEV_LDPC_LLR_COMPRESSION, +RTE_BBDEV_LDPC_LLR_COMPRESSION | + RTE_BBDEV_LDPC_DEC_INTERRUPTS, .llr_size = 8, .llr_decimals = 1, .num_buffers_src =@@ -751,14 +1003,39 @@Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1010
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0#else dev_info->harq_buffer_size =0 ;#endif +acc100_check_ir (d); +} + +static int +acc100_queue_intr_enable (struct rte_bbdev *dev,uint16_t queue_id){
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+struct acc100_queue *q = dev->data- queues[queue_id].queue_private; + +if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && + dev->intr_handle->type !=RTE_INTR_HANDLE_UIO )Quoted 8 lines
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1023
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+return -ENOTSUP ; + + q->irq_enable =1 ; +return 0 ; +} + +static int +acc100_queue_intr_disable (struct rte_bbdev *dev,uint16_t queue_id){
Quoted 5 lines
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 1026
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+struct acc100_queue *q = dev->data- queues[queue_id].queue_private; + q->irq_enable =0 ;A
-ENOTSUPabove, should need similar check here.How can this fail when we purely disable?
Quoted 8 lines
It is for api consistency.
the enable fails
the disable succeeds
that is not consistent.
OK can do. Thanks
Quoted 84 lines
Tom
Quoted 71 lines
Quoted 46 lines
Quoted 44 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-1+return 0 ; }static const struct rte_bbdev_ops acc100_bbdev_ops = { .setup_queues = acc100_setup_queues, + .intr_enable = acc100_intr_enable, .close = acc100_dev_close, .info_get = acc100_dev_info_get, .queue_setup = acc100_queue_setup, .queue_release = acc100_queue_release, + .queue_intr_enable = acc100_queue_intr_enable, + .queue_intr_disable = acc100_queue_intr_disable };/* ACC100 PCI PF address map */ @@ -3018,8 +3295,10 @@ ? (1 << RTE_BBDEV_DATA_ERROR) : 0); op->status |= ((rsp.dma_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); op->status |= ((rsp.fcw_err) ? (1 <<RTE_BBDEV_DRV_ERROR ) :0 ); -if (op->status !=0 ) +if (op->status !=0 ) { q_data->queue_stats.dequeue_err_count++; +acc100_check_ir (q->d); + }/* CRC invalid if error exists */ if (!op->status)@@ -3076,6 +3355,9 @@ op->status |=1 <<RTE_BBDEV_SYNDROME_ERROR ; op->ldpc_dec.iter_count = (uint8_t ) rsp.iter_cnt; +if (op->status & (1 <<RTE_BBDEV_DRV_ERROR )) +acc100_check_ir (q->d); +/* Check if this is the last desc in batch (Atomic Queue) */ if (desc->req.last_desc_in_batch) { (*aq_dequeued)++;drivers/baseband/acc100/rte_acc100_pmd.h +0
-0drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device { · line 559
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.h +0
-0@@ -559,7 +559,14 @@ struct acc100_device {/* Virtual address of the info memory routed to the this function under
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device { · line 562
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.h +1
-0* operation, whether it is PF or VF. */ +union acc100_info_ring_data *info_ring;Need a comment that this array needs a sentinel ?
Can clarify a bit expected HW behaviour
Thanks
Quoted 17 lines
Tom
drivers/baseband/acc100/rte_acc100_pmd.h struct acc100_device {
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.h +4
-0+union acc100_harq_layout_data *harq_layout; +/* Virtual Info Ring head */ +uint16_t info_ring_head; +/* Number of bytes available for each queue in device, depending on
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.h +2
-0+* how many queues are enabled with configure() +*/ uint32_t sw_ring_size;uint32_t ddr_size;/* Size in kB */ uint32_t *tail_ptrs;/* Base address of response tail pointer buffer */ @@ -575,4 +582,12 @@ struct
acc100_device{
bool configured; /**< True if this ACC100 device is configured */
};Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+/**
+ * Structure with details aboutRTE_BBDEV_EVENT_DEQUEUEevent.It's
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.h +7
-0+passed to +* the callback function. +*/ +struct acc100_deq_intr_details { +uint16_t queue_id; +}; +#endif /* _RTE_ACC100_PMD_H_ */
PATCH v9 9/10 baseband/acc100: add debug function to validate input
In reply to Nicolas ChautruDebug functions to validate the input API from user Only enabled in DEBUG mode at build time
--- drivers/baseband/acc100/rte_acc100_pmd.c | 424 +++++++++++++++++++++++++++++++ 1 file changed, 424 insertions(+)
drivers/baseband/acc100/rte_acc100_pmd.c +424 -0
@@ -1945,6 +1945,231 @@ } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validates turbo encoder parameters */ +static inline int +validate_enc_op (struct rte_bbdev_enc_op *op) +{ +struct rte_bbdev_op_turbo_enc *turbo_enc = &op->turbo_enc; +struct rte_bbdev_op_enc_turbo_cb_params *cb =NULL ; +struct rte_bbdev_op_enc_turbo_tb_params *tb =NULL ; +uint16_t kw, kw_neg, kw_pos; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (turbo_enc->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (turbo_enc->output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid output pointer" ); +return -1 ; + } +if (turbo_enc->rv_index >3 ) { +rte_bbdev_log (ERR , +"rv_index (%u) is out of range 0 <= value <= 3" , + turbo_enc->rv_index); +return -1 ; + } +if (turbo_enc->code_block_mode !=0 && + turbo_enc->code_block_mode !=1 ) { +rte_bbdev_log (ERR , +"code_block_mode (%u) is out of range 0 <= value <= 1" , + turbo_enc->code_block_mode); +return -1 ; + } + +if (turbo_enc->code_block_mode ==0 ) { + tb = &turbo_enc->tb_params; +if ((tb->k_neg <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_neg >RTE_BBDEV_TURBO_MAX_CB_SIZE ) + && tb->c_neg >0 ) { +rte_bbdev_log (ERR , +"k_neg (%u) is out of range %u <= value <= %u" , + tb->k_neg,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if (tb->k_pos <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_pos >RTE_BBDEV_TURBO_MAX_CB_SIZE ) { +rte_bbdev_log (ERR , +"k_pos (%u) is out of range %u <= value <= %u" , + tb->k_pos,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if (tb->c_neg > (RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1 )) +rte_bbdev_log (ERR , +"c_neg (%u) is out of range 0 <= value <= %u" , + tb->c_neg, +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1 ); +if (tb->c <1 || tb->c >RTE_BBDEV_TURBO_MAX_CODE_BLOCKS ) { +rte_bbdev_log (ERR , +"c (%u) is out of range 1 <= value <= %u" , + tb->c,RTE_BBDEV_TURBO_MAX_CODE_BLOCKS ); +return -1 ; + } +if (tb->cab > tb->c) { +rte_bbdev_log (ERR , +"cab (%u) is greater than c (%u)" , + tb->cab, tb->c); +return -1 ; + } +if ((tb->ea <RTE_BBDEV_TURBO_MIN_CB_SIZE || (tb->ea %2 )) + && tb->r < tb->cab) { +rte_bbdev_log (ERR , +"ea (%u) is less than %u or it is not even" , + tb->ea,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } +if ((tb->eb <RTE_BBDEV_TURBO_MIN_CB_SIZE || (tb->eb %2 )) + && tb->c > tb->cab) { +rte_bbdev_log (ERR , +"eb (%u) is less than %u or it is not even" , + tb->eb,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } + + kw_neg =3 *RTE_ALIGN_CEIL (tb->k_neg +4 , +RTE_BBDEV_TURBO_C_SUBBLOCK ); +if (tb->ncb_neg < tb->k_neg || tb->ncb_neg > kw_neg) { +rte_bbdev_log (ERR , +"ncb_neg (%u) is out of range (%u) k_neg <= value <= (%u) kw_neg" , + tb->ncb_neg, tb->k_neg, kw_neg); +return -1 ; + } + + kw_pos =3 *RTE_ALIGN_CEIL (tb->k_pos +4 , +RTE_BBDEV_TURBO_C_SUBBLOCK ); +if (tb->ncb_pos < tb->k_pos || tb->ncb_pos > kw_pos) { +rte_bbdev_log (ERR , +"ncb_pos (%u) is out of range (%u) k_pos <= value <= (%u) kw_pos" , + tb->ncb_pos, tb->k_pos, kw_pos); +return -1 ; + } +if (tb->r > (tb->c -1 )) { +rte_bbdev_log (ERR , +"r (%u) is greater than c - 1 (%u)" , + tb->r, tb->c -1 ); +return -1 ; + } + }else { + cb = &turbo_enc->cb_params; +if (cb->k <RTE_BBDEV_TURBO_MIN_CB_SIZE + || cb->k >RTE_BBDEV_TURBO_MAX_CB_SIZE ) { +rte_bbdev_log (ERR , +"k (%u) is out of range %u <= value <= %u" , + cb->k,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } + +if (cb->e <RTE_BBDEV_TURBO_MIN_CB_SIZE || (cb->e %2 )) { +rte_bbdev_log (ERR , +"e (%u) is less than %u or it is not even" , + cb->e,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } + + kw =RTE_ALIGN_CEIL (cb->k +4 ,RTE_BBDEV_TURBO_C_SUBBLOCK ) *3 ; +if (cb->ncb < cb->k || cb->ncb > kw) { +rte_bbdev_log (ERR , +"ncb (%u) is out of range (%u) k <= value <= (%u) kw" , + cb->ncb, cb->k, kw); +return -1 ; + } + } + +return 0 ; +} +/* Validates LDPC encoder parameters */ +static inline int +validate_ldpc_enc_op (struct rte_bbdev_enc_op *op) +{ +struct rte_bbdev_op_ldpc_enc *ldpc_enc = &op->ldpc_enc; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (ldpc_enc->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (ldpc_enc->output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid output pointer" ); +return -1 ; + } +if (ldpc_enc->input.length > +RTE_BBDEV_LDPC_MAX_CB_SIZE >>3 ) { +rte_bbdev_log (ERR ,"CB size (%u) is too big, max: %d" , + ldpc_enc->input.length, +RTE_BBDEV_LDPC_MAX_CB_SIZE ); +return -1 ; + } +if ((ldpc_enc->basegraph >2 ) || (ldpc_enc->basegraph ==0 )) { +rte_bbdev_log (ERR , +"BG (%u) is out of range 1 <= value <= 2" , + ldpc_enc->basegraph); +return -1 ; + } +if (ldpc_enc->rv_index >3 ) { +rte_bbdev_log (ERR , +"rv_index (%u) is out of range 0 <= value <= 3" , + ldpc_enc->rv_index); +return -1 ; + } +if (ldpc_enc->code_block_mode >1 ) { +rte_bbdev_log (ERR , +"code_block_mode (%u) is out of range 0 <= value <= 1" , + ldpc_enc->code_block_mode); +return -1 ; + } + +return 0 ; +} + +/* Validates LDPC decoder parameters */ +static inline int +validate_ldpc_dec_op (struct rte_bbdev_dec_op *op) +{ +struct rte_bbdev_op_ldpc_dec *ldpc_dec = &op->ldpc_dec; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if ((ldpc_dec->basegraph >2 ) || (ldpc_dec->basegraph ==0 )) { +rte_bbdev_log (ERR , +"BG (%u) is out of range 1 <= value <= 2" , + ldpc_dec->basegraph); +return -1 ; + } +if (ldpc_dec->iter_max ==0 ) { +rte_bbdev_log (ERR , +"iter_max (%u) is equal to 0" , + ldpc_dec->iter_max); +return -1 ; + } +if (ldpc_dec->rv_index >3 ) { +rte_bbdev_log (ERR , +"rv_index (%u) is out of range 0 <= value <= 3" , + ldpc_dec->rv_index); +return -1 ; + } +if (ldpc_dec->code_block_mode >1 ) { +rte_bbdev_log (ERR , +"code_block_mode (%u) is out of range 0 <= value <= 1" , + ldpc_dec->code_block_mode); +return -1 ; + } + +return 0 ; +} +#endif +/* Enqueue one encode operations for ACC100 device in CB mode */ static inline int enqueue_enc_one_op_cb(struct acc100_queue *q, struct rte_bbdev_enc_op *op,
@@ -1956,6 +2181,14 @@ seg_total_left;struct rte_mbuf *input, *output_head, *output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
@@ -2008,6 +2241,14 @@uint16_t in_length_in_bytes;struct rte_bbdev_op_ldpc_enc *enc = &ops[0 ]->ldpc_enc; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_enc_op (ops[0 ]) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
@@ -2065,6 +2306,14 @@ seg_total_left;struct rte_mbuf *input, *output_head, *output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
@@ -2119,6 +2368,14 @@struct rte_mbuf *input, *output_head, *output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
@@ -2191,6 +2448,142 @@return current_enqueued_cbs; } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validates turbo decoder parameters */ +static inline int +validate_dec_op (struct rte_bbdev_dec_op *op) +{ +struct rte_bbdev_op_turbo_dec *turbo_dec = &op->turbo_dec; +struct rte_bbdev_op_dec_turbo_cb_params *cb =NULL ; +struct rte_bbdev_op_dec_turbo_tb_params *tb =NULL ; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (turbo_dec->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (turbo_dec->hard_output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid hard_output pointer" ); +return -1 ; + } +if (check_bit (turbo_dec->op_flags,RTE_BBDEV_TURBO_SOFT_OUTPUT ) && + turbo_dec->soft_output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid soft_output pointer" ); +return -1 ; + } +if (turbo_dec->rv_index >3 ) { +rte_bbdev_log (ERR , +"rv_index (%u) is out of range 0 <= value <= 3" , + turbo_dec->rv_index); +return -1 ; + } +if (turbo_dec->iter_min <1 ) { +rte_bbdev_log (ERR , +"iter_min (%u) is less than 1" , + turbo_dec->iter_min); +return -1 ; + } +if (turbo_dec->iter_max <=2 ) { +rte_bbdev_log (ERR , +"iter_max (%u) is less than or equal to 2" , + turbo_dec->iter_max); +return -1 ; + } +if (turbo_dec->iter_min > turbo_dec->iter_max) { +rte_bbdev_log (ERR , +"iter_min (%u) is greater than iter_max (%u)" , + turbo_dec->iter_min, turbo_dec->iter_max); +return -1 ; + } +if (turbo_dec->code_block_mode !=0 && + turbo_dec->code_block_mode !=1 ) { +rte_bbdev_log (ERR , +"code_block_mode (%u) is out of range 0 <= value <= 1" , + turbo_dec->code_block_mode); +return -1 ; + } + +if (turbo_dec->code_block_mode ==0 ) { + tb = &turbo_dec->tb_params; +if ((tb->k_neg <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_neg >RTE_BBDEV_TURBO_MAX_CB_SIZE ) + && tb->c_neg >0 ) { +rte_bbdev_log (ERR , +"k_neg (%u) is out of range %u <= value <= %u" , + tb->k_neg,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if ((tb->k_pos <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_pos >RTE_BBDEV_TURBO_MAX_CB_SIZE ) + && tb->c > tb->c_neg) { +rte_bbdev_log (ERR , +"k_pos (%u) is out of range %u <= value <= %u" , + tb->k_pos,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if (tb->c_neg > (RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1 )) +rte_bbdev_log (ERR , +"c_neg (%u) is out of range 0 <= value <= %u" , + tb->c_neg, +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1 ); +if (tb->c <1 || tb->c >RTE_BBDEV_TURBO_MAX_CODE_BLOCKS ) { +rte_bbdev_log (ERR , +"c (%u) is out of range 1 <= value <= %u" , + tb->c,RTE_BBDEV_TURBO_MAX_CODE_BLOCKS ); +return -1 ; + } +if (tb->cab > tb->c) { +rte_bbdev_log (ERR , +"cab (%u) is greater than c (%u)" , + tb->cab, tb->c); +return -1 ; + } +if (check_bit (turbo_dec->op_flags,RTE_BBDEV_TURBO_EQUALIZER ) && + (tb->ea <RTE_BBDEV_TURBO_MIN_CB_SIZE + || (tb->ea %2 )) + && tb->cab >0 ) { +rte_bbdev_log (ERR , +"ea (%u) is less than %u or it is not even" , + tb->ea,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } +if (check_bit (turbo_dec->op_flags,RTE_BBDEV_TURBO_EQUALIZER ) && + (tb->eb <RTE_BBDEV_TURBO_MIN_CB_SIZE + || (tb->eb %2 )) + && tb->c > tb->cab) { +rte_bbdev_log (ERR , +"eb (%u) is less than %u or it is not even" , + tb->eb,RTE_BBDEV_TURBO_MIN_CB_SIZE ); + } + }else { + cb = &turbo_dec->cb_params; +if (cb->k <RTE_BBDEV_TURBO_MIN_CB_SIZE + || cb->k >RTE_BBDEV_TURBO_MAX_CB_SIZE ) { +rte_bbdev_log (ERR , +"k (%u) is out of range %u <= value <= %u" , + cb->k,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if (check_bit (turbo_dec->op_flags,RTE_BBDEV_TURBO_EQUALIZER ) && + (cb->e <RTE_BBDEV_TURBO_MIN_CB_SIZE || + (cb->e %2 ))) { +rte_bbdev_log (ERR , +"e (%u) is less than %u or it is not even" , + cb->e,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } + } + +return 0 ; +} +#endif +/** Enqueue one decode operations for ACC100 device in CB mode */ static inline int enqueue_dec_one_op_cb(struct acc100_queue *q, struct rte_bbdev_dec_op *op,
@@ -2203,6 +2596,14 @@struct rte_mbuf *input, *h_output_head, *h_output, *s_output_head, *s_output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
@@ -2426,6 +2827,13 @@return ret; } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC decoder validation failed" ); +return -EINVAL ; + } +#endif union acc100_dma_desc *desc;uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask);
@@ -2521,6 +2929,14 @@struct rte_mbuf *input, *h_output_head, *h_output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
@@ -2611,6 +3027,14 @@ *s_output_head, *s_output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v9 09/10] baseband/acc100: add debug function to validate input
Quoted 231 lines · Nicolas Chautru
Debug functions to validate the input API from user Only enabled in DEBUG mode at build time
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- drivers/baseband/acc100/rte_acc100_pmd.c | 424 +++++++++++++++++++++++++++++++ 1 file changed, 424 insertions(+)drivers/baseband/acc100/rte_acc100_pmd.c +214
-0@@ -1945,6 +1945,231 @@ } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validates turbo encoder parameters */ +static inline int +validate_enc_op (struct rte_bbdev_enc_op *op) +{ +struct rte_bbdev_op_turbo_enc *turbo_enc = &op->turbo_enc; +struct rte_bbdev_op_enc_turbo_cb_params *cb =NULL ; +struct rte_bbdev_op_enc_turbo_tb_params *tb =NULL ; +uint16_t kw, kw_neg, kw_pos; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (turbo_enc->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (turbo_enc->output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid output pointer" ); +return -1 ; + } +if (turbo_enc->rv_index >3 ) { +rte_bbdev_log (ERR , +"rv_index (%u) is out of range 0 <= value <= 3" , + turbo_enc->rv_index); +return -1 ; + } +if (turbo_enc->code_block_mode !=0 && + turbo_enc->code_block_mode !=1 ) { +rte_bbdev_log (ERR , +"code_block_mode (%u) is out of range 0 <= value <= 1" , + turbo_enc->code_block_mode); +return -1 ; + } + +if (turbo_enc->code_block_mode ==0 ) { + tb = &turbo_enc->tb_params; +if ((tb->k_neg <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_neg >RTE_BBDEV_TURBO_MAX_CB_SIZE ) + && tb->c_neg >0 ) { +rte_bbdev_log (ERR , +"k_neg (%u) is out of range %u <= value <= %u" , + tb->k_neg,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if (tb->k_pos <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_pos >RTE_BBDEV_TURBO_MAX_CB_SIZE ) { +rte_bbdev_log (ERR , +"k_pos (%u) is out of range %u <= value <= %u" , + tb->k_pos,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if (tb->c_neg > (RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1 )) +rte_bbdev_log (ERR , +"c_neg (%u) is out of range 0 <= value <= %u" , + tb->c_neg, +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1 ); +if (tb->c <1 || tb->c >RTE_BBDEV_TURBO_MAX_CODE_BLOCKS ) { +rte_bbdev_log (ERR , +"c (%u) is out of range 1 <= value <= %u" , + tb->c,RTE_BBDEV_TURBO_MAX_CODE_BLOCKS ); +return -1 ; + } +if (tb->cab > tb->c) { +rte_bbdev_log (ERR , +"cab (%u) is greater than c (%u)" , + tb->cab, tb->c); +return -1 ; + } +if ((tb->ea <RTE_BBDEV_TURBO_MIN_CB_SIZE || (tb->ea %2 )) + && tb->r < tb->cab) { +rte_bbdev_log (ERR , +"ea (%u) is less than %u or it is not even" , + tb->ea,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } +if ((tb->eb <RTE_BBDEV_TURBO_MIN_CB_SIZE || (tb->eb %2 )) + && tb->c > tb->cab) { +rte_bbdev_log (ERR , +"eb (%u) is less than %u or it is not even" , + tb->eb,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } + + kw_neg =3 *RTE_ALIGN_CEIL (tb->k_neg +4 , +RTE_BBDEV_TURBO_C_SUBBLOCK ); +if (tb->ncb_neg < tb->k_neg || tb->ncb_neg > kw_neg) { +rte_bbdev_log (ERR , +"ncb_neg (%u) is out of range (%u) k_neg <= value <= (%u) kw_neg" , + tb->ncb_neg, tb->k_neg, kw_neg); +return -1 ; + } + + kw_pos =3 *RTE_ALIGN_CEIL (tb->k_pos +4 , +RTE_BBDEV_TURBO_C_SUBBLOCK ); +if (tb->ncb_pos < tb->k_pos || tb->ncb_pos > kw_pos) { +rte_bbdev_log (ERR , +"ncb_pos (%u) is out of range (%u) k_pos <= value <= (%u) kw_pos" , + tb->ncb_pos, tb->k_pos, kw_pos); +return -1 ; + } +if (tb->r > (tb->c -1 )) { +rte_bbdev_log (ERR , +"r (%u) is greater than c - 1 (%u)" , + tb->r, tb->c -1 ); +return -1 ; + } + }else { + cb = &turbo_enc->cb_params; +if (cb->k <RTE_BBDEV_TURBO_MIN_CB_SIZE + || cb->k >RTE_BBDEV_TURBO_MAX_CB_SIZE ) { +rte_bbdev_log (ERR , +"k (%u) is out of range %u <= value <= %u" , + cb->k,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } + +if (cb->e <RTE_BBDEV_TURBO_MIN_CB_SIZE || (cb->e %2 )) { +rte_bbdev_log (ERR , +"e (%u) is less than %u or it is not even" , + cb->e,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } + + kw =RTE_ALIGN_CEIL (cb->k +4 ,RTE_BBDEV_TURBO_C_SUBBLOCK ) *3 ; +if (cb->ncb < cb->k || cb->ncb > kw) { +rte_bbdev_log (ERR , +"ncb (%u) is out of range (%u) k <= value <= (%u) kw" , + cb->ncb, cb->k, kw); +return -1 ; + } + } + +return 0 ; +} +/* Validates LDPC encoder parameters */ +static inline int +validate_ldpc_enc_op (struct rte_bbdev_enc_op *op) +{ +struct rte_bbdev_op_ldpc_enc *ldpc_enc = &op->ldpc_enc; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (ldpc_enc->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (ldpc_enc->output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid output pointer" ); +return -1 ; + } +if (ldpc_enc->input.length > +RTE_BBDEV_LDPC_MAX_CB_SIZE >>3 ) { +rte_bbdev_log (ERR ,"CB size (%u) is too big, max: %d" , + ldpc_enc->input.length, +RTE_BBDEV_LDPC_MAX_CB_SIZE ); +return -1 ; + } +if ((ldpc_enc->basegraph >2 ) || (ldpc_enc->basegraph ==0 )) { +rte_bbdev_log (ERR , +"BG (%u) is out of range 1 <= value <= 2" , + ldpc_enc->basegraph); +return -1 ; + } +if (ldpc_enc->rv_index >3 ) { +rte_bbdev_log (ERR , +"rv_index (%u) is out of range 0 <= value <= 3" , + ldpc_enc->rv_index); +return -1 ; + } +if (ldpc_enc->code_block_mode >1 ) { +rte_bbdev_log (ERR , +"code_block_mode (%u) is out of range 0 <= value <= 1" , + ldpc_enc->code_block_mode); +return -1 ; + } + +return 0 ; +} + +/* Validates LDPC decoder parameters */ +static inline int +validate_ldpc_dec_op (struct rte_bbdev_dec_op *op) +{ +struct rte_bbdev_op_ldpc_dec *ldpc_dec = &op->ldpc_dec; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if ((ldpc_dec->basegraph >2 ) || (ldpc_dec->basegraph ==0 )) { +rte_bbdev_log (ERR , +"BG (%u) is out of range 1 <= value <= 2" , + ldpc_dec->basegraph); +return -1 ; + } +if (ldpc_dec->iter_max ==0 ) { +rte_bbdev_log (ERR , +"iter_max (%u) is equal to 0" , + ldpc_dec->iter_max); +return -1 ; + } +if (ldpc_dec->rv_index >3 ) { +rte_bbdev_log (ERR , +"rv_index (%u) is out of range 0 <= value <= 3" , + ldpc_dec->rv_index); +return -1 ; + }
drivers/baseband/acc100/rte_acc100_pmd.c line 2171
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+if (ldpc_dec->code_block_mode >1 ) { +rte_bbdev_log (ERR , +"code_block_mode (%u) is out of range 0 <= value <= 1" , + ldpc_dec->code_block_mode); +return -1 ; + } + + return 0; +} +#endif
Could have an #else with stubs so the users do not have to bother with #ifdef decorations
Quoted 65 lines
drivers/baseband/acc100/rte_acc100_pmd.c +33
-0+/* Enqueue one encode operations for ACC100 device in CB mode */ static inline int enqueue_enc_one_op_cb(struct acc100_queue *q, struct rte_bbdev_enc_op *op,@@ -1956,6 +2181,14 @@ seg_total_left;struct rte_mbuf *input, *output_head, *output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2008,6 +2241,14 @@uint16_t in_length_in_bytes;struct rte_bbdev_op_ldpc_enc *enc = &ops[0 ]->ldpc_enc; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_enc_op (ops[0 ]) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2065,6 +2306,14 @@ seg_total_left;struct rte_mbuf *input, *output_head, *output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2119,6 +2368,14 @@struct rte_mbuf *input, *output_head, *output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
drivers/baseband/acc100/rte_acc100_pmd.c line 2455
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0@@ -2191,6 +2448,142 @@return current_enqueued_cbs; } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validates turbo decoder parameters */ +static inline int +validate_dec_op (struct rte_bbdev_dec_op *op) +{
This (guessing) later dec validation share similar code with enc validation, consider function for the common parts.
Tom
Quoted 193 lines
drivers/baseband/acc100/rte_acc100_pmd.c +162
-0+struct rte_bbdev_op_turbo_dec *turbo_dec = &op->turbo_dec; +struct rte_bbdev_op_dec_turbo_cb_params *cb =NULL ; +struct rte_bbdev_op_dec_turbo_tb_params *tb =NULL ; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (turbo_dec->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (turbo_dec->hard_output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid hard_output pointer" ); +return -1 ; + } +if (check_bit (turbo_dec->op_flags,RTE_BBDEV_TURBO_SOFT_OUTPUT ) && + turbo_dec->soft_output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid soft_output pointer" ); +return -1 ; + } +if (turbo_dec->rv_index >3 ) { +rte_bbdev_log (ERR , +"rv_index (%u) is out of range 0 <= value <= 3" , + turbo_dec->rv_index); +return -1 ; + } +if (turbo_dec->iter_min <1 ) { +rte_bbdev_log (ERR , +"iter_min (%u) is less than 1" , + turbo_dec->iter_min); +return -1 ; + } +if (turbo_dec->iter_max <=2 ) { +rte_bbdev_log (ERR , +"iter_max (%u) is less than or equal to 2" , + turbo_dec->iter_max); +return -1 ; + } +if (turbo_dec->iter_min > turbo_dec->iter_max) { +rte_bbdev_log (ERR , +"iter_min (%u) is greater than iter_max (%u)" , + turbo_dec->iter_min, turbo_dec->iter_max); +return -1 ; + } +if (turbo_dec->code_block_mode !=0 && + turbo_dec->code_block_mode !=1 ) { +rte_bbdev_log (ERR , +"code_block_mode (%u) is out of range 0 <= value <= 1" , + turbo_dec->code_block_mode); +return -1 ; + } + +if (turbo_dec->code_block_mode ==0 ) { + tb = &turbo_dec->tb_params; +if ((tb->k_neg <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_neg >RTE_BBDEV_TURBO_MAX_CB_SIZE ) + && tb->c_neg >0 ) { +rte_bbdev_log (ERR , +"k_neg (%u) is out of range %u <= value <= %u" , + tb->k_neg,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if ((tb->k_pos <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_pos >RTE_BBDEV_TURBO_MAX_CB_SIZE ) + && tb->c > tb->c_neg) { +rte_bbdev_log (ERR , +"k_pos (%u) is out of range %u <= value <= %u" , + tb->k_pos,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if (tb->c_neg > (RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1 )) +rte_bbdev_log (ERR , +"c_neg (%u) is out of range 0 <= value <= %u" , + tb->c_neg, +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1 ); +if (tb->c <1 || tb->c >RTE_BBDEV_TURBO_MAX_CODE_BLOCKS ) { +rte_bbdev_log (ERR , +"c (%u) is out of range 1 <= value <= %u" , + tb->c,RTE_BBDEV_TURBO_MAX_CODE_BLOCKS ); +return -1 ; + } +if (tb->cab > tb->c) { +rte_bbdev_log (ERR , +"cab (%u) is greater than c (%u)" , + tb->cab, tb->c); +return -1 ; + } +if (check_bit (turbo_dec->op_flags,RTE_BBDEV_TURBO_EQUALIZER ) && + (tb->ea <RTE_BBDEV_TURBO_MIN_CB_SIZE + || (tb->ea %2 )) + && tb->cab >0 ) { +rte_bbdev_log (ERR , +"ea (%u) is less than %u or it is not even" , + tb->ea,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } +if (check_bit (turbo_dec->op_flags,RTE_BBDEV_TURBO_EQUALIZER ) && + (tb->eb <RTE_BBDEV_TURBO_MIN_CB_SIZE + || (tb->eb %2 )) + && tb->c > tb->cab) { +rte_bbdev_log (ERR , +"eb (%u) is less than %u or it is not even" , + tb->eb,RTE_BBDEV_TURBO_MIN_CB_SIZE ); + } + }else { + cb = &turbo_dec->cb_params; +if (cb->k <RTE_BBDEV_TURBO_MIN_CB_SIZE + || cb->k >RTE_BBDEV_TURBO_MAX_CB_SIZE ) { +rte_bbdev_log (ERR , +"k (%u) is out of range %u <= value <= %u" , + cb->k,RTE_BBDEV_TURBO_MIN_CB_SIZE , +RTE_BBDEV_TURBO_MAX_CB_SIZE ); +return -1 ; + } +if (check_bit (turbo_dec->op_flags,RTE_BBDEV_TURBO_EQUALIZER ) && + (cb->e <RTE_BBDEV_TURBO_MIN_CB_SIZE || + (cb->e %2 ))) { +rte_bbdev_log (ERR , +"e (%u) is less than %u or it is not even" , + cb->e,RTE_BBDEV_TURBO_MIN_CB_SIZE ); +return -1 ; + } + } + +return 0 ; +} +#endif +/** Enqueue one decode operations for ACC100 device in CB mode */ static inline int enqueue_dec_one_op_cb(struct acc100_queue *q, struct rte_bbdev_dec_op *op,@@ -2203,6 +2596,14 @@struct rte_mbuf *input, *h_output_head, *h_output, *s_output_head, *s_output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2426,6 +2827,13 @@return ret; } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC decoder validation failed" ); +return -EINVAL ; + } +#endif union acc100_dma_desc *desc;uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask);@@ -2521,6 +2929,14 @@struct rte_mbuf *input, *h_output_head, *h_output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2611,6 +3027,14 @@ *s_output_head, *s_output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
Re: [dpdk-dev] [PATCH v9 09/10] baseband/acc100: add debug function to validate input
Hi Tom,
Quoted 266 lines
From: Tom Rix <[email protected]>
Quoted 32 lines · Nicolas Chautru
Debug functions to validate the input API from user Only enabled in DEBUG mode at build time
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- drivers/baseband/acc100/rte_acc100_pmd.c | 424 +++++++++++++++++++++++++++++++ 1 file changed, 424 insertions(+)drivers/baseband/acc100/rte_acc100_pmd.c +13
-0@@ -1945,6 +1945,231 @@ } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validates turbo encoder parameters */ static inline int +validate_enc_op (struct rte_bbdev_enc_op *op) { +struct rte_bbdev_op_turbo_enc *turbo_enc = &op->turbo_enc; +struct rte_bbdev_op_enc_turbo_cb_params *cb =NULL ; +struct rte_bbdev_op_enc_turbo_tb_params *tb =NULL ; +uint16_t kw, kw_neg, kw_pos; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (turbo_enc->input.data ==NULL ) {drivers/baseband/acc100/rte_acc100_pmd.c line 1970
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (turbo_enc->output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid output pointer" ); +return -1 ; + } +if (turbo_enc->rv_index >3 ) { + rte_bbdev_log(ERR, + "rv_index (%u) is out of range 0 <= value <=3",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ turbo_enc->rv_index); +return -1 ; + } +if (turbo_enc->code_block_mode !=0 && + turbo_enc->code_block_mode !=1 ) { + rte_bbdev_log(ERR, + "code_block_mode (%u) is out of range 0 <=value <= 1",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ turbo_enc->code_block_mode); +return -1 ; + } + + if (turbo_enc->code_block_mode == 0) { + tb = &turbo_enc->tb_params; + if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_neg >
RTE_BBDEV_TURBO_MAX_CB_SIZE)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->c_neg > 0) { + rte_bbdev_log(ERR, + "k_neg (%u) is out of range %u <=value <= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 1989
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->k_neg,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } +if (tb->k_pos <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_pos >
RTE_BBDEV_TURBO_MAX_CB_SIZE) {drivers/baseband/acc100/rte_acc100_pmd.c line 1996
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "k_pos (%u) is out of range %u <=value <= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 1997
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->k_pos,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + if (tb->c_neg > (RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1))
drivers/baseband/acc100/rte_acc100_pmd.c line 2003
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "c_neg (%u) is out of range 0 <= value<= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2005
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ tb->c_neg, +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS - 1);drivers/baseband/acc100/rte_acc100_pmd.c line 2006
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ if (tb->c < 1 || tb->c >
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) {drivers/baseband/acc100/rte_acc100_pmd.c line 2008
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "c (%u) is out of range 1 <= value <=%u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2009
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->c,
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+return -1 ; + } +if (tb->cab > tb->c) { +rte_bbdev_log (ERR , +"cab (%u) is greater than c (%u)" , + tb->cab, tb->c); +return -1 ; + } + if ((tb->ea < RTE_BBDEV_TURBO_MIN_CB_SIZE || (tb->ea %2))
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->r < tb->cab) { + rte_bbdev_log(ERR, + "ea (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2022
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->ea,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+return -1 ; + } + if ((tb->eb < RTE_BBDEV_TURBO_MIN_CB_SIZE || (tb->eb %2))
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->c > tb->cab) { + rte_bbdev_log(ERR, + "eb (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2029
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->eb,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+return -1 ; + } + + kw_neg =3 *RTE_ALIGN_CEIL (tb->k_neg +4 , +RTE_BBDEV_TURBO_C_SUBBLOCK ); +if (tb->ncb_neg < tb->k_neg || tb->ncb_neg > kw_neg) { + rte_bbdev_log(ERR, + "ncb_neg (%u) is out of range (%u)
k_neg<= value <= (%u)kw_neg",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ tb->ncb_neg, tb->k_neg, kw_neg); +return -1 ; + } + + kw_pos =3 *RTE_ALIGN_CEIL (tb->k_pos +4 , +RTE_BBDEV_TURBO_C_SUBBLOCK ); +if (tb->ncb_pos < tb->k_pos || tb->ncb_pos > kw_pos) { + rte_bbdev_log(ERR, + "ncb_pos (%u) is out of range (%u)
k_pos<= value <= (%u)kw_pos",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+ tb->ncb_pos, tb->k_pos, kw_pos); +return -1 ; + } +if (tb->r > (tb->c -1 )) { +rte_bbdev_log (ERR , +"r (%u) is greater than c - 1 (%u)" , + tb->r, tb->c -1 ); +return -1 ; + } + } else { + cb = &turbo_enc->cb_params; + if (cb->k < RTE_BBDEV_TURBO_MIN_CB_SIZE + || cb->k >
RTE_BBDEV_TURBO_MAX_CB_SIZE) {drivers/baseband/acc100/rte_acc100_pmd.c line 2061
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "k (%u) is out of range %u <= value <=%u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2062
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ cb->k,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + +if (cb->e <RTE_BBDEV_TURBO_MIN_CB_SIZE || (cb->e %2 )){
drivers/baseband/acc100/rte_acc100_pmd.c line 2069
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "e (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2070
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ cb->e,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+return -1 ; + } + + kw = RTE_ALIGN_CEIL(cb->k + 4,
RTE_BBDEV_TURBO_C_SUBBLOCK) * 3;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+if (cb->ncb < cb->k || cb->ncb > kw) { + rte_bbdev_log(ERR, + "ncb (%u) is out of range (%u) k <=value <= (%u) kw",
Quoted 29 lines
drivers/baseband/acc100/rte_acc100_pmd.c +29
-0+ cb->ncb, cb->k, kw); +return -1 ; + } + } + +return 0 ; +} +/* Validates LDPC encoder parameters */ static inline int +validate_ldpc_enc_op (struct rte_bbdev_enc_op *op) { +struct rte_bbdev_op_ldpc_enc *ldpc_enc = &op->ldpc_enc; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (ldpc_enc->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (ldpc_enc->output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid output pointer" ); +return -1 ; + } +if (ldpc_enc->input.length > +RTE_BBDEV_LDPC_MAX_CB_SIZE >>3 ) { +rte_bbdev_log (ERR ,"CB size (%u) is too big, max: %d" , + ldpc_enc->input.length, +RTE_BBDEV_LDPC_MAX_CB_SIZE ); +return -1 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } +if ((ldpc_enc->basegraph >2 ) || (ldpc_enc->basegraph ==0 )) { +rte_bbdev_log (ERR , +"BG (%u) is out of range 1 <= value <= 2" , + ldpc_enc->basegraph); +return -1 ; + } +if (ldpc_enc->rv_index >3 ) { + rte_bbdev_log(ERR, + "rv_index (%u) is out of range 0 <= value <=3",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ldpc_enc->rv_index); +return -1 ; + } +if (ldpc_enc->code_block_mode >1 ) { + rte_bbdev_log(ERR, + "code_block_mode (%u) is out of range 0 <=value <= 1",
Quoted 20 lines
drivers/baseband/acc100/rte_acc100_pmd.c +20
-0+ ldpc_enc->code_block_mode); +return -1 ; + } + +return 0 ; +} + +/* Validates LDPC decoder parameters */ static inline int +validate_ldpc_dec_op (struct rte_bbdev_dec_op *op) { +struct rte_bbdev_op_ldpc_dec *ldpc_dec = &op->ldpc_dec; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if ((ldpc_dec->basegraph >2 ) || (ldpc_dec->basegraph ==0 )) { +rte_bbdev_log (ERR , +"BG (%u) is out of range 1 <= value <= 2" , + ldpc_dec->basegraph); +return -1 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } +if (ldpc_dec->iter_max ==0 ) { +rte_bbdev_log (ERR , +"iter_max (%u) is equal to 0" , + ldpc_dec->iter_max); +return -1 ; + } +if (ldpc_dec->rv_index >3 ) { + rte_bbdev_log(ERR, + "rv_index (%u) is out of range 0 <= value <=3",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ldpc_dec->rv_index); +return -1 ; + } +if (ldpc_dec->code_block_mode >1 ) { + rte_bbdev_log(ERR, + "code_block_mode (%u) is out of range 0 <=value <= 1",
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2171
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ ldpc_dec->code_block_mode); + return -1; + } + +return 0 ; +} +#endif Could have an #else with stubs so the users do not have to bother with #ifdef decorations
I see what you mean. Debatable. But given this is done the same way for other bbdev driver I would rather keep consistency.
Quoted 67 lines
Quoted 67 lines
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+/* Enqueue one encode operations for ACC100 device in CB mode */ static inline int enqueue_enc_one_op_cb(struct acc100_queue *q,struct
rte_bbdev_enc_op*op, @@ -1956,6 +2181,14 @@drivers/baseband/acc100/rte_acc100_pmd.c +32
-0seg_total_left;struct rte_mbuf *input, *output_head, *output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2008,6 +2241,14 @@uint16_t in_length_in_bytes;struct rte_bbdev_op_ldpc_enc *enc = &ops[0 ]->ldpc_enc; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_enc_op (ops[0 ]) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2065,6 +2306,14 @@ seg_total_left;struct rte_mbuf *input, *output_head, *output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2119,6 +2368,14 @@struct rte_mbuf *input, *output_head, *output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2191,6 +2448,142 @@return current_enqueued_cbs; }
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2453
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validates turbo decoder parameters */ static inline int +validate_dec_op (struct rte_bbdev_dec_op *op) {This (guessing) later dec validation share similar code with enc validation, consider function for the common parts.
They have different API really, a few checks only have common range checks. So not convinced it would help personnaly.
Thanks
Quoted 224 lines
Tom
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+struct rte_bbdev_op_turbo_dec *turbo_dec = &op->turbo_dec; +struct rte_bbdev_op_dec_turbo_cb_params *cb =NULL ; +struct rte_bbdev_op_dec_turbo_tb_params *tb =NULL ; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } +if (turbo_dec->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (turbo_dec->hard_output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid hard_output pointer" ); +return -1 ; + } + if (check_bit(turbo_dec->op_flags,
RTE_BBDEV_TURBO_SOFT_OUTPUT) &&drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ turbo_dec->soft_output.data == NULL) { +rte_bbdev_log (ERR ,"Invalid soft_output pointer" ); +return -1 ; + } +if (turbo_dec->rv_index >3 ) { + rte_bbdev_log(ERR, + "rv_index (%u) is out of range 0 <= value <=3",
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ turbo_dec->rv_index); +return -1 ; + } +if (turbo_dec->iter_min <1 ) { +rte_bbdev_log (ERR , +"iter_min (%u) is less than 1" , + turbo_dec->iter_min); +return -1 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } +if (turbo_dec->iter_max <=2 ) { +rte_bbdev_log (ERR , +"iter_max (%u) is less than or equal to 2" , + turbo_dec->iter_max); +return -1 ; + } +if (turbo_dec->iter_min > turbo_dec->iter_max) { + rte_bbdev_log(ERR, + "iter_min (%u) is greater than iter_max(%u)",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ turbo_dec->iter_min, turbo_dec->iter_max); +return -1 ; + } +if (turbo_dec->code_block_mode !=0 && + turbo_dec->code_block_mode !=1 ) { + rte_bbdev_log(ERR, + "code_block_mode (%u) is out of range 0 <=value <= 1",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ turbo_dec->code_block_mode); +return -1 ; + } + + if (turbo_dec->code_block_mode == 0) { + tb = &turbo_dec->tb_params; + if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_neg >
RTE_BBDEV_TURBO_MAX_CB_SIZE)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->c_neg > 0) { + rte_bbdev_log(ERR, + "k_neg (%u) is out of range %u <=value <= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2514
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->k_neg,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + if ((tb->k_pos < RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_pos >
RTE_BBDEV_TURBO_MAX_CB_SIZE)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->c > tb->c_neg) { + rte_bbdev_log(ERR, + "k_pos (%u) is out of range %u <=value <= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2523
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->k_pos,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + if (tb->c_neg > (RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1))
drivers/baseband/acc100/rte_acc100_pmd.c line 2529
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "c_neg (%u) is out of range 0 <= value<= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2531
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ tb->c_neg, +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS - 1);drivers/baseband/acc100/rte_acc100_pmd.c line 2532
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ if (tb->c < 1 || tb->c >
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) {drivers/baseband/acc100/rte_acc100_pmd.c line 2534
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "c (%u) is out of range 1 <= value <=%u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2535
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->c,
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+return -1 ; + } +if (tb->cab > tb->c) { +rte_bbdev_log (ERR , +"cab (%u) is greater than c (%u)" , + tb->cab, tb->c); +return -1 ; + } + if (check_bit(turbo_dec->op_flags,
RTE_BBDEV_TURBO_EQUALIZER) &&drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ (tb->ea < RTE_BBDEV_TURBO_MIN_CB_SIZE + || (tb->ea % 2)) + && tb->cab > 0) { + rte_bbdev_log(ERR, + "ea (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2550
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->ea,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+return -1 ; + } + if (check_bit(turbo_dec->op_flags,
RTE_BBDEV_TURBO_EQUALIZER) &&drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ (tb->eb < RTE_BBDEV_TURBO_MIN_CB_SIZE + || (tb->eb % 2)) + && tb->c > tb->cab) { + rte_bbdev_log(ERR, + "eb (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2559
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->eb,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ } + } else { + cb = &turbo_dec->cb_params; + if (cb->k < RTE_BBDEV_TURBO_MIN_CB_SIZE + || cb->k >
RTE_BBDEV_TURBO_MAX_CB_SIZE) {drivers/baseband/acc100/rte_acc100_pmd.c line 2566
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "k (%u) is out of range %u <= value <=%u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2567
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ cb->k,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + if (check_bit(turbo_dec->op_flags,
RTE_BBDEV_TURBO_EQUALIZER) &&drivers/baseband/acc100/rte_acc100_pmd.c line 2572
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ (cb->e < RTE_BBDEV_TURBO_MIN_CB_SIZE||
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ (cb->e % 2))) { + rte_bbdev_log(ERR, + "e (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2576
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ cb->e,
RTE_BBDEV_TURBO_MIN_CB_SIZE);Quoted 69 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ return -1; + } + } + +return 0 ; +} +#endif +/** Enqueue one decode operations for ACC100 device in CB mode */ static inline int enqueue_dec_one_op_cb(struct acc100_queue *q,struct
rte_bbdev_dec_op*op, @@ -2203,6 +2596,14 @@drivers/baseband/acc100/rte_acc100_pmd.c +31
-0struct rte_mbuf *input, *h_output_head, *h_output, *s_output_head, *s_output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2426,6 +2827,13 @@return ret; } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC decoder validation failed" ); +return -EINVAL ; + } +#endif union acc100_dma_desc *desc;uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask);@@ -2521,6 +2929,14 @@struct rte_mbuf *input, *h_output_head, *h_output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2611,6 +3027,14 @@ *s_output_head, *s_output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
Tom Rix
Reviewed-byRe: [dpdk-dev] [PATCH v9 09/10] baseband/acc100: add debug function to validate input
Quoted 277 lines · Nicolas
Hi Tom,
Quoted 266 lines
From: Tom Rix <[email protected]>
Quoted 32 lines · Nicolas Chautru
Debug functions to validate the input API from user Only enabled in DEBUG mode at build time
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- drivers/baseband/acc100/rte_acc100_pmd.c | 424 +++++++++++++++++++++++++++++++ 1 file changed, 424 insertions(+)drivers/baseband/acc100/rte_acc100_pmd.c +13
-0@@ -1945,6 +1945,231 @@ } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validates turbo encoder parameters */ static inline int +validate_enc_op (struct rte_bbdev_enc_op *op) { +struct rte_bbdev_op_turbo_enc *turbo_enc = &op->turbo_enc; +struct rte_bbdev_op_enc_turbo_cb_params *cb =NULL ; +struct rte_bbdev_op_enc_turbo_tb_params *tb =NULL ; +uint16_t kw, kw_neg, kw_pos; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (turbo_enc->input.data ==NULL ) {drivers/baseband/acc100/rte_acc100_pmd.c line 1970
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (turbo_enc->output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid output pointer" ); +return -1 ; + } +if (turbo_enc->rv_index >3 ) { + rte_bbdev_log(ERR, + "rv_index (%u) is out of range 0 <= value <=3",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ turbo_enc->rv_index); +return -1 ; + } +if (turbo_enc->code_block_mode !=0 && + turbo_enc->code_block_mode !=1 ) { + rte_bbdev_log(ERR, + "code_block_mode (%u) is out of range 0 <=value <= 1",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ turbo_enc->code_block_mode); +return -1 ; + } + + if (turbo_enc->code_block_mode == 0) { + tb = &turbo_enc->tb_params; + if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_neg >
RTE_BBDEV_TURBO_MAX_CB_SIZE)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->c_neg > 0) { + rte_bbdev_log(ERR, + "k_neg (%u) is out of range %u <=value <= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 1989
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->k_neg,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } +if (tb->k_pos <RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_pos >
RTE_BBDEV_TURBO_MAX_CB_SIZE) {drivers/baseband/acc100/rte_acc100_pmd.c line 1996
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "k_pos (%u) is out of range %u <=value <= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 1997
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->k_pos,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + if (tb->c_neg > (RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1))
drivers/baseband/acc100/rte_acc100_pmd.c line 2003
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "c_neg (%u) is out of range 0 <= value<= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2005
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ tb->c_neg, +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS - 1);drivers/baseband/acc100/rte_acc100_pmd.c line 2006
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ if (tb->c < 1 || tb->c >
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) {drivers/baseband/acc100/rte_acc100_pmd.c line 2008
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "c (%u) is out of range 1 <= value <=%u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2009
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->c,
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+return -1 ; + } +if (tb->cab > tb->c) { +rte_bbdev_log (ERR , +"cab (%u) is greater than c (%u)" , + tb->cab, tb->c); +return -1 ; + } + if ((tb->ea < RTE_BBDEV_TURBO_MIN_CB_SIZE || (tb->ea %2))
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->r < tb->cab) { + rte_bbdev_log(ERR, + "ea (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2022
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->ea,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+return -1 ; + } + if ((tb->eb < RTE_BBDEV_TURBO_MIN_CB_SIZE || (tb->eb %2))
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->c > tb->cab) { + rte_bbdev_log(ERR, + "eb (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2029
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->eb,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+return -1 ; + } + + kw_neg =3 *RTE_ALIGN_CEIL (tb->k_neg +4 , +RTE_BBDEV_TURBO_C_SUBBLOCK ); +if (tb->ncb_neg < tb->k_neg || tb->ncb_neg > kw_neg) { + rte_bbdev_log(ERR, + "ncb_neg (%u) is out of range (%u)
k_neg<= value <= (%u)kw_neg",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ tb->ncb_neg, tb->k_neg, kw_neg); +return -1 ; + } + + kw_pos =3 *RTE_ALIGN_CEIL (tb->k_pos +4 , +RTE_BBDEV_TURBO_C_SUBBLOCK ); +if (tb->ncb_pos < tb->k_pos || tb->ncb_pos > kw_pos) { + rte_bbdev_log(ERR, + "ncb_pos (%u) is out of range (%u)
k_pos<= value <= (%u)kw_pos",drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+ tb->ncb_pos, tb->k_pos, kw_pos); +return -1 ; + } +if (tb->r > (tb->c -1 )) { +rte_bbdev_log (ERR , +"r (%u) is greater than c - 1 (%u)" , + tb->r, tb->c -1 ); +return -1 ; + } + } else { + cb = &turbo_enc->cb_params; + if (cb->k < RTE_BBDEV_TURBO_MIN_CB_SIZE + || cb->k >
RTE_BBDEV_TURBO_MAX_CB_SIZE) {drivers/baseband/acc100/rte_acc100_pmd.c line 2061
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "k (%u) is out of range %u <= value <=%u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2062
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ cb->k,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + +if (cb->e <RTE_BBDEV_TURBO_MIN_CB_SIZE || (cb->e %2 )){
drivers/baseband/acc100/rte_acc100_pmd.c line 2069
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "e (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2070
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ cb->e,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+return -1 ; + } + + kw = RTE_ALIGN_CEIL(cb->k + 4,
RTE_BBDEV_TURBO_C_SUBBLOCK) * 3;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+if (cb->ncb < cb->k || cb->ncb > kw) { + rte_bbdev_log(ERR, + "ncb (%u) is out of range (%u) k <=value <= (%u) kw",
Quoted 29 lines
drivers/baseband/acc100/rte_acc100_pmd.c +29
-0+ cb->ncb, cb->k, kw); +return -1 ; + } + } + +return 0 ; +} +/* Validates LDPC encoder parameters */ static inline int +validate_ldpc_enc_op (struct rte_bbdev_enc_op *op) { +struct rte_bbdev_op_ldpc_enc *ldpc_enc = &op->ldpc_enc; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if (ldpc_enc->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (ldpc_enc->output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid output pointer" ); +return -1 ; + } +if (ldpc_enc->input.length > +RTE_BBDEV_LDPC_MAX_CB_SIZE >>3 ) { +rte_bbdev_log (ERR ,"CB size (%u) is too big, max: %d" , + ldpc_enc->input.length, +RTE_BBDEV_LDPC_MAX_CB_SIZE ); +return -1 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } +if ((ldpc_enc->basegraph >2 ) || (ldpc_enc->basegraph ==0 )) { +rte_bbdev_log (ERR , +"BG (%u) is out of range 1 <= value <= 2" , + ldpc_enc->basegraph); +return -1 ; + } +if (ldpc_enc->rv_index >3 ) { + rte_bbdev_log(ERR, + "rv_index (%u) is out of range 0 <= value <=3",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ldpc_enc->rv_index); +return -1 ; + } +if (ldpc_enc->code_block_mode >1 ) { + rte_bbdev_log(ERR, + "code_block_mode (%u) is out of range 0 <=value <= 1",
Quoted 20 lines
drivers/baseband/acc100/rte_acc100_pmd.c +20
-0+ ldpc_enc->code_block_mode); +return -1 ; + } + +return 0 ; +} + +/* Validates LDPC decoder parameters */ static inline int +validate_ldpc_dec_op (struct rte_bbdev_dec_op *op) { +struct rte_bbdev_op_ldpc_dec *ldpc_dec = &op->ldpc_dec; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ; + } +if ((ldpc_dec->basegraph >2 ) || (ldpc_dec->basegraph ==0 )) { +rte_bbdev_log (ERR , +"BG (%u) is out of range 1 <= value <= 2" , + ldpc_dec->basegraph); +return -1 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } +if (ldpc_dec->iter_max ==0 ) { +rte_bbdev_log (ERR , +"iter_max (%u) is equal to 0" , + ldpc_dec->iter_max); +return -1 ; + } +if (ldpc_dec->rv_index >3 ) { + rte_bbdev_log(ERR, + "rv_index (%u) is out of range 0 <= value <=3",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ ldpc_dec->rv_index); +return -1 ; + } +if (ldpc_dec->code_block_mode >1 ) { + rte_bbdev_log(ERR, + "code_block_mode (%u) is out of range 0 <=value <= 1",
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2171
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ ldpc_dec->code_block_mode); + return -1; + } + +return 0 ; +} +#endif Could have an #else with stubs so the users do not have to bother with #ifdef decorations
Quoted 2 lines
I see what you mean. Debatable. But given this is done the same way for other bbdev driver I would rather keep consistency.
ok
Quoted 68 lines
Quoted 68 lines
Quoted 68 lines
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+/* Enqueue one encode operations for ACC100 device in CB mode */ static inline int enqueue_enc_one_op_cb(struct acc100_queue *q,struct
rte_bbdev_enc_op*op, @@ -1956,6 +2181,14 @@drivers/baseband/acc100/rte_acc100_pmd.c +32
-0seg_total_left;struct rte_mbuf *input, *output_head, *output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2008,6 +2241,14 @@uint16_t in_length_in_bytes;struct rte_bbdev_op_ldpc_enc *enc = &ops[0 ]->ldpc_enc; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_enc_op (ops[0 ]) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2065,6 +2306,14 @@ seg_total_left;struct rte_mbuf *input, *output_head, *output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2119,6 +2368,14 @@struct rte_mbuf *input, *output_head, *output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_enc_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo encoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2191,6 +2448,142 @@return current_enqueued_cbs; }
Quoted 8 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c line 2453
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validates turbo decoder parameters */ static inline int +validate_dec_op (struct rte_bbdev_dec_op *op) {This (guessing) later dec validation share similar code with enc validation, consider function for the common parts.
They have different API really, a few checks only have common range checks. So not convinced it would help personnaly.
Thanks
ok
Quoted 224 lines
Quoted 224 lines
Tom
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+struct rte_bbdev_op_turbo_dec *turbo_dec = &op->turbo_dec; +struct rte_bbdev_op_dec_turbo_cb_params *cb =NULL ; +struct rte_bbdev_op_dec_turbo_tb_params *tb =NULL ; + +if (op->mempool ==NULL ) { +rte_bbdev_log (ERR ,"Invalid mempool pointer" ); +return -1 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } +if (turbo_dec->input.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid input pointer" ); +return -1 ; + } +if (turbo_dec->hard_output.data ==NULL ) { +rte_bbdev_log (ERR ,"Invalid hard_output pointer" ); +return -1 ; + } + if (check_bit(turbo_dec->op_flags,
RTE_BBDEV_TURBO_SOFT_OUTPUT) &&drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ turbo_dec->soft_output.data == NULL) { +rte_bbdev_log (ERR ,"Invalid soft_output pointer" ); +return -1 ; + } +if (turbo_dec->rv_index >3 ) { + rte_bbdev_log(ERR, + "rv_index (%u) is out of range 0 <= value <=3",
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ turbo_dec->rv_index); +return -1 ; + } +if (turbo_dec->iter_min <1 ) { +rte_bbdev_log (ERR , +"iter_min (%u) is less than 1" , + turbo_dec->iter_min); +return -1 ;drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ } +if (turbo_dec->iter_max <=2 ) { +rte_bbdev_log (ERR , +"iter_max (%u) is less than or equal to 2" , + turbo_dec->iter_max); +return -1 ; + } +if (turbo_dec->iter_min > turbo_dec->iter_max) { + rte_bbdev_log(ERR, + "iter_min (%u) is greater than iter_max(%u)",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0+ turbo_dec->iter_min, turbo_dec->iter_max); +return -1 ; + } +if (turbo_dec->code_block_mode !=0 && + turbo_dec->code_block_mode !=1 ) { + rte_bbdev_log(ERR, + "code_block_mode (%u) is out of range 0 <=value <= 1",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ turbo_dec->code_block_mode); +return -1 ; + } + + if (turbo_dec->code_block_mode == 0) { + tb = &turbo_dec->tb_params; + if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_neg >
RTE_BBDEV_TURBO_MAX_CB_SIZE)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->c_neg > 0) { + rte_bbdev_log(ERR, + "k_neg (%u) is out of range %u <=value <= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2514
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->k_neg,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + if ((tb->k_pos < RTE_BBDEV_TURBO_MIN_CB_SIZE + || tb->k_pos >
RTE_BBDEV_TURBO_MAX_CB_SIZE)drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ && tb->c > tb->c_neg) { + rte_bbdev_log(ERR, + "k_pos (%u) is out of range %u <=value <= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2523
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->k_pos,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + if (tb->c_neg > (RTE_BBDEV_TURBO_MAX_CODE_BLOCKS -1))
drivers/baseband/acc100/rte_acc100_pmd.c line 2529
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "c_neg (%u) is out of range 0 <= value<= %u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2531
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ tb->c_neg, +RTE_BBDEV_TURBO_MAX_CODE_BLOCKS - 1);drivers/baseband/acc100/rte_acc100_pmd.c line 2532
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ if (tb->c < 1 || tb->c >
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) {drivers/baseband/acc100/rte_acc100_pmd.c line 2534
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "c (%u) is out of range 1 <= value <=%u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2535
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->c,
RTE_BBDEV_TURBO_MAX_CODE_BLOCKS);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+return -1 ; + } +if (tb->cab > tb->c) { +rte_bbdev_log (ERR , +"cab (%u) is greater than c (%u)" , + tb->cab, tb->c); +return -1 ; + } + if (check_bit(turbo_dec->op_flags,
RTE_BBDEV_TURBO_EQUALIZER) &&drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ (tb->ea < RTE_BBDEV_TURBO_MIN_CB_SIZE + || (tb->ea % 2)) + && tb->cab > 0) { + rte_bbdev_log(ERR, + "ea (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2550
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->ea,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+return -1 ; + } + if (check_bit(turbo_dec->op_flags,
RTE_BBDEV_TURBO_EQUALIZER) &&drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ (tb->eb < RTE_BBDEV_TURBO_MIN_CB_SIZE + || (tb->eb % 2)) + && tb->c > tb->cab) { + rte_bbdev_log(ERR, + "eb (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2559
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ tb->eb,
RTE_BBDEV_TURBO_MIN_CB_SIZE);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ } + } else { + cb = &turbo_dec->cb_params; + if (cb->k < RTE_BBDEV_TURBO_MIN_CB_SIZE + || cb->k >
RTE_BBDEV_TURBO_MAX_CB_SIZE) {drivers/baseband/acc100/rte_acc100_pmd.c line 2566
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ rte_bbdev_log(ERR, + "k (%u) is out of range %u <= value <=%u",
drivers/baseband/acc100/rte_acc100_pmd.c line 2567
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ cb->k,
RTE_BBDEV_TURBO_MIN_CB_SIZE,drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ RTE_BBDEV_TURBO_MAX_CB_SIZE); +return -1 ; + } + if (check_bit(turbo_dec->op_flags,
RTE_BBDEV_TURBO_EQUALIZER) &&drivers/baseband/acc100/rte_acc100_pmd.c line 2572
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ (cb->e < RTE_BBDEV_TURBO_MIN_CB_SIZE||
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+ (cb->e % 2))) { + rte_bbdev_log(ERR, + "e (%u) is less than %u or it is noteven",
drivers/baseband/acc100/rte_acc100_pmd.c line 2576
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+ cb->e,
RTE_BBDEV_TURBO_MIN_CB_SIZE);Quoted 69 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ return -1; + } + } + +return 0 ; +} +#endif +/** Enqueue one decode operations for ACC100 device in CB mode */ static inline int enqueue_dec_one_op_cb(struct acc100_queue *q,struct
rte_bbdev_dec_op*op, @@ -2203,6 +2596,14 @@drivers/baseband/acc100/rte_acc100_pmd.c +31
-0struct rte_mbuf *input, *h_output_head, *h_output, *s_output_head, *s_output; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2426,6 +2827,13 @@return ret; } +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC decoder validation failed" ); +return -EINVAL ; + } +#endif union acc100_dma_desc *desc;uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask);@@ -2521,6 +2929,14 @@struct rte_mbuf *input, *h_output_head, *h_output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_ldpc_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"LDPC decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;@@ -2611,6 +3027,14 @@ *s_output_head, *s_output;uint16_t current_enqueued_cbs =0 ; +#ifdef RTE_LIBRTE_BBDEV_DEBUG +/* Validate op structure */ +if (validate_dec_op (op) ==-1 ) { +rte_bbdev_log (ERR ,"Turbo decoder validation failed" ); +return -EINVAL ; + } +#endif +uint16_t desc_idx = ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask); desc = q->ring_addr + desc_idx;
PATCH v9 10/10 baseband/acc100: add configure function
In reply to Nicolas ChautruAdd configure function to configure the PF from within the bbdev-test itself without external application configuration the device.
--- app/test-bbdev/test_bbdev_perf.c | 72 +++ doc/guides/rel_notes/release_20_11.rst | 5 + drivers/baseband/acc100/meson.build | 2 + drivers/baseband/acc100/rte_acc100_cfg.h | 17 + drivers/baseband/acc100/rte_acc100_pmd.c | 505 +++++++++++++++++++++ .../acc100/rte_pmd_bbdev_acc100_version.map | 7 + 6 files changed, 608 insertions(+)
app/test-bbdev/test_bbdev_perf.c +72 -0
@@ -52,6 +52,18 @@#define FLR_5G_TIMEOUT 610#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 +#include <rte_acc100_cfg.h> +#define ACC100PF_DRIVER_NAME ("intel_acc100_pf") +#define ACC100VF_DRIVER_NAME ("intel_acc100_vf") +#define ACC100_QMGR_NUM_AQS 16 +#define ACC100_QMGR_NUM_QGS 2 +#define ACC100_QMGR_AQ_DEPTH 5 +#define ACC100_QMGR_INVALID_IDX -1 +#define ACC100_QMGR_RR 1 +#define ACC100_QOS_GBR 0 +#endif +#define OPS_CACHE_SIZE 256U#define OPS_POOL_SIZE_MIN 511U/* 0.5K per queue */
@@ -653,6 +665,66 @@ typedef int (test_case_function)(struct active_device *ad, info->dev_name); }#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 +if ((get_init_device () == true) && + (!strcmp (info->drv.driver_name,ACC100PF_DRIVER_NAME ))) { +struct acc100_conf conf; +unsigned int i; + +printf ("Configure ACC100 FEC Driver %s with default values\n" , + info->drv.driver_name); + +/* clear default configuration before initialization */ +memset (&conf,0 ,sizeof (struct acc100_conf )); + +/* Always set in PF mode for built-in configuration */ + conf.pf_mode_en = true; +for (i =0 ; i <RTE_ACC100_NUM_VFS ; ++i) { + conf.arb_dl_4g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_dl_4g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_dl_4g[i].round_robin_weight =ACC100_QMGR_RR ; + conf.arb_ul_4g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_ul_4g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_ul_4g[i].round_robin_weight =ACC100_QMGR_RR ; + conf.arb_dl_5g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_dl_5g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_dl_5g[i].round_robin_weight =ACC100_QMGR_RR ; + conf.arb_ul_5g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_ul_5g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_ul_5g[i].round_robin_weight =ACC100_QMGR_RR ; + } + + conf.input_pos_llr_1_bit = true; + conf.output_pos_llr_1_bit = true; + conf.num_vf_bundles =1 ;/**< Number of VF bundles to setup */ + + conf.q_ul_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_4g.first_qgroup_index =ACC100_QMGR_INVALID_IDX ; + conf.q_ul_4g.num_aqs_per_groups =ACC100_QMGR_NUM_AQS ; + conf.q_ul_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_4g.first_qgroup_index =ACC100_QMGR_INVALID_IDX ; + conf.q_dl_4g.num_aqs_per_groups =ACC100_QMGR_NUM_AQS ; + conf.q_dl_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_ul_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_5g.first_qgroup_index =ACC100_QMGR_INVALID_IDX ; + conf.q_ul_5g.num_aqs_per_groups =ACC100_QMGR_NUM_AQS ; + conf.q_ul_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_5g.first_qgroup_index =ACC100_QMGR_INVALID_IDX ; + conf.q_dl_5g.num_aqs_per_groups =ACC100_QMGR_NUM_AQS ; + conf.q_dl_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + +/* setup PF with configuration information */ + ret =acc100_configure (info->dev_name, &conf); +TEST_ASSERT_SUCCESS (ret, +"Failed to configure ACC100 PF for bbdev %s" , + info->dev_name); +/* Let's refresh this now this is configured */ + } +rte_bbdev_info_get (dev_id, info); +#endif + nb_queues =RTE_MIN (rte_lcore_count (), info->drv.max_num_queues); nb_queues =RTE_MIN (nb_queues, (unsigned int )MAX_QUEUES );
doc/guides/rel_notes/release_20_11.rst +5 -0
@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added Intel ACC100 bbdev PMD.** + + Added a new ``acc100`` bbdev driver for the Intel\ |reg| ACC100 accelerator + also known as Mount Bryce. See the + :doc:`../bbdevs/acc100` BBDEV guide for more details on this new driver. Removed Items -------------
drivers/baseband/acc100/meson.build +2 -0
@@ -4,3 +4,5 @@ deps += ['bbdev', 'bus_vdev', 'ring', 'pci', 'bus_pci'] sources = files('rte_acc100_pmd.c') + +install_headers('rte_acc100_cfg.h')
drivers/baseband/acc100/rte_acc100_cfg.h +17 -0
@@ -89,6 +89,23 @@ struct acc100_conf {struct rte_arbitration_t arb_dl_5g[RTE_ACC100_NUM_VFS ]; }; +/** +* Configure a ACC100 device +* +* @param dev_name +* The name of the device. This is the short form of PCI BDF, e.g. 00:01.0. +* It can also be retrieved for a bbdev device from the dev_name field in the +* rte_bbdev_info structure returned by rte_bbdev_info_get(). +* @param conf +* Configuration to apply to ACC100 HW. +* +* @return +* Zero on success, negative value on failure. +*/ +__rte_experimental +int +acc100_configure (const char *dev_name,struct acc100_conf *conf); + #ifdef __cplusplus }#endif
drivers/baseband/acc100/rte_acc100_pmd.c +505 -0
520 lines not on this page · raw message
drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map +7 -0
@@ -1,3 +1,10 @@ DPDK_21 { local: *; }; + +EXPERIMENTAL { + global: + + acc100_configure; + +};
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v9 10/10] baseband/acc100: add configure function
Quoted 39 lines · Nicolas Chautru
Add configure function to configure the PF from within the bbdev-test itself without external application configuration the device.
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- app/test-bbdev/test_bbdev_perf.c | 72 +++ doc/guides/rel_notes/release_20_11.rst | 5 + drivers/baseband/acc100/meson.build | 2 + drivers/baseband/acc100/rte_acc100_cfg.h | 17 + drivers/baseband/acc100/rte_acc100_pmd.c | 505 +++++++++++++++++++++ .../acc100/rte_pmd_bbdev_acc100_version.map | 7 + 6 files changed, 608 insertions(+)app/test-bbdev/test_bbdev_perf.c +12
-0@@ -52,6 +52,18 @@#define FLR_5G_TIMEOUT 610#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 +#include <rte_acc100_cfg.h> +#define ACC100PF_DRIVER_NAME ("intel_acc100_pf") +#define ACC100VF_DRIVER_NAME ("intel_acc100_vf") +#define ACC100_QMGR_NUM_AQS 16 +#define ACC100_QMGR_NUM_QGS 2 +#define ACC100_QMGR_AQ_DEPTH 5 +#define ACC100_QMGR_INVALID_IDX -1 +#define ACC100_QMGR_RR 1 +#define ACC100_QOS_GBR 0 +#endif +#define OPS_CACHE_SIZE 256U#define OPS_POOL_SIZE_MIN 511U/* 0.5K per queue */
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad, · line 668
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1
-0@@ -653,6 +665,66 @@ typedef int (test_case_function)(struct active_device *ad, info->dev_name); }#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100
seems like this function would break if one of the other bbdev's were #defined.
Quoted 47 lines
app/test-bbdev/test_bbdev_perf.c +47
-0+if ((get_init_device () == true) && + (!strcmp (info->drv.driver_name,ACC100PF_DRIVER_NAME ))) { +struct acc100_conf conf; +unsigned int i; + +printf ("Configure ACC100 FEC Driver %s with default values\n" , + info->drv.driver_name); + +/* clear default configuration before initialization */ +memset (&conf,0 ,sizeof (struct acc100_conf )); + +/* Always set in PF mode for built-in configuration */ + conf.pf_mode_en = true; +for (i =0 ; i <RTE_ACC100_NUM_VFS ; ++i) { + conf.arb_dl_4g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_dl_4g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_dl_4g[i].round_robin_weight =ACC100_QMGR_RR ; + conf.arb_ul_4g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_ul_4g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_ul_4g[i].round_robin_weight =ACC100_QMGR_RR ; + conf.arb_dl_5g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_dl_5g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_dl_5g[i].round_robin_weight =ACC100_QMGR_RR ; + conf.arb_ul_5g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_ul_5g[i].gbr_threshold1 =ACC100_QOS_GBR ; + conf.arb_ul_5g[i].round_robin_weight =ACC100_QMGR_RR ; + } + + conf.input_pos_llr_1_bit = true; + conf.output_pos_llr_1_bit = true; + conf.num_vf_bundles =1 ;/**< Number of VF bundles to setup */ + + conf.q_ul_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_4g.first_qgroup_index =ACC100_QMGR_INVALID_IDX ; + conf.q_ul_4g.num_aqs_per_groups =ACC100_QMGR_NUM_AQS ; + conf.q_ul_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_4g.first_qgroup_index =ACC100_QMGR_INVALID_IDX ; + conf.q_dl_4g.num_aqs_per_groups =ACC100_QMGR_NUM_AQS ; + conf.q_dl_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_ul_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_5g.first_qgroup_index =ACC100_QMGR_INVALID_IDX ; + conf.q_ul_5g.num_aqs_per_groups =ACC100_QMGR_NUM_AQS ; + conf.q_ul_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_5g.first_qgroup_index =ACC100_QMGR_INVALID_IDX ; + conf.q_dl_5g.num_aqs_per_groups =ACC100_QMGR_NUM_AQS ;
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad, · line 725
Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10
-0+ conf.q_dl_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + +/* setup PF with configuration information */ + ret =acc100_configure (info->dev_name, &conf); +TEST_ASSERT_SUCCESS (ret, +"Failed to configure ACC100 PF for bbdev %s" , + info->dev_name); +/* Let's refresh this now this is configured */ + } +rte_bbdev_info_get (dev_id, info);
The other bbdev's do not call rte_bbdev_info_get, can this be removed ?
Quoted 73 lines
app/test-bbdev/test_bbdev_perf.c +2
-0+#endif + nb_queues =RTE_MIN (rte_lcore_count (), info->drv.max_num_queues); nb_queues =RTE_MIN (nb_queues, (unsigned int )MAX_QUEUES );doc/guides/rel_notes/release_20_11.rst +5
-0@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added Intel ACC100 bbdev PMD.** + + Added a new ``acc100`` bbdev driver for the Intel\ |reg| ACC100 accelerator + also known as Mount Bryce. See the + :doc:`../bbdevs/acc100` BBDEV guide for more details on this new driver. Removed Items -------------drivers/baseband/acc100/meson.build +2
-0@@ -4,3 +4,5 @@ deps += ['bbdev', 'bus_vdev', 'ring', 'pci', 'bus_pci'] sources = files('rte_acc100_pmd.c') + +install_headers('rte_acc100_cfg.h')drivers/baseband/acc100/rte_acc100_cfg.h +17
-0@@ -89,6 +89,23 @@ struct acc100_conf {struct rte_arbitration_t arb_dl_5g[RTE_ACC100_NUM_VFS ]; }; +/** +* Configure a ACC100 device +* +* @param dev_name +* The name of the device. This is the short form of PCI BDF, e.g. 00:01.0. +* It can also be retrieved for a bbdev device from the dev_name field in the +* rte_bbdev_info structure returned by rte_bbdev_info_get(). +* @param conf +* Configuration to apply to ACC100 HW. +* +* @return +* Zero on success, negative value on failure. +*/ +__rte_experimental +int +acc100_configure (const char *dev_name,struct acc100_conf *conf); + #ifdef __cplusplus }#endif drivers/baseband/acc100/rte_acc100_pmd.c +6
-0@@ -85,6 +85,26 @@enum {UL_4G =0 ,UL_5G ,DL_4G ,DL_5G ,NUM_ACC }; +/* Return the accelerator enum for a Queue Group Index */ +static inline int +accFromQgid (int qg_idx,const struct acc100_conf *acc100_conf) +{ +int accQg[ACC100_NUM_QGRPS ]; +int NumQGroupsPerFn[NUM_ACC ];
drivers/baseband/acc100/rte_acc100_pmd.c line 103
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+int acc, qgIdx, qgIndex =0 ; +for (qgIdx =0 ; qgIdx <ACC100_NUM_QGRPS ; qgIdx++) + accQg[qgIdx] =0 ; + NumQGroupsPerFn[UL_4G ] = acc100_conf->q_ul_4g.num_qgroups; + NumQGroupsPerFn[UL_5G ] = acc100_conf->q_ul_5g.num_qgroups; + NumQGroupsPerFn[DL_4G ] = acc100_conf->q_dl_4g.num_qgroups; + NumQGroupsPerFn[DL_5G ] = acc100_conf->q_dl_5g.num_qgroups; +for (acc =UL_4G ; acc <NUM_ACC ; acc++) +for (qgIdx =0 ; qgIdx < NumQGroupsPerFn[acc]; qgIdx++) + accQg[qgIndex++] = acc;
This looks inefficient, is there a way this could be calculated without filling arrays to
access 1 value ?
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ acc = accQg[qg_idx]; +return acc; +} +/* Return the queue topology for a Queue Group Index */ static inline void qtopFromAcc(struct rte_q_topology_t **qtop, int acc_enum,@@ -113,6 +133,30 @@ *qtop = p_qtop; }
drivers/baseband/acc100/rte_acc100_pmd.c line 144
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+/* Return the AQ depth for a Queue Group Index */ +static inline int +aqDepth (int qg_idx,struct acc100_conf *acc100_conf) +{ +struct rte_q_topology_t *q_top =NULL ; +int acc_enum =accFromQgid (qg_idx, acc100_conf); +qtopFromAcc (&q_top, acc_enum, acc100_conf); +if (unlikely (q_top ==NULL )) +return 0 ;
This error is not handled well be the callers.
aqNum is similar.
Quoted 19 lines
drivers/baseband/acc100/rte_acc100_pmd.c +15
-0+return q_top->aq_depth_log2; +} + +/* Return the AQ depth for a Queue Group Index */ +static inline int +aqNum (int qg_idx,struct acc100_conf *acc100_conf) +{ +struct rte_q_topology_t *q_top =NULL ; +int acc_enum =accFromQgid (qg_idx, acc100_conf); +qtopFromAcc (&q_top, acc_enum, acc100_conf); +if (unlikely (q_top ==NULL )) +return 0 ; +return q_top->num_aqs_per_groups; +} +static void initQTop (struct acc100_conf *acc100_conf) {
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4227
Quoted 7 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0@@ -4177,3 +4221,464 @@ static int acc100_pci_remove(struct rte_pci_device *pci_dev)RTE_PMD_REGISTER_PCI_TABLE (ACC100PF_DRIVER_NAME , pci_id_acc100_pf_map);RTE_PMD_REGISTER_PCI (ACC100VF_DRIVER_NAME , acc100_pci_vf_driver);RTE_PMD_REGISTER_PCI_TABLE (ACC100VF_DRIVER_NAME , pci_id_acc100_vf_map); + +/* +* Implementation to fix the power on status of some 5GUL engines +* This requires DMA permission if ported outside DPDK
This sounds like a workaround, can more detail be added here ?
Quoted 140 lines
drivers/baseband/acc100/rte_acc100_pmd.c +140
-0+*/ +static void +poweron_cleanup (struct rte_bbdev *bbdev,struct acc100_device *d, +struct acc100_conf *conf) +{ +int i, template_idx, qg_idx; +uint32_t address, status, payload; +printf ("Need to clear power-on 5GUL status in internal memory\n" ); +/* Reset LDPC Cores */ +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) +acc100_reg_write (d, HWPfFecUl5gCntrlReg + +ACC100_ENGINE_OFFSET * i,ACC100_RESET_HI ); +usleep (LONG_WAIT ); +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) +acc100_reg_write (d, HWPfFecUl5gCntrlReg + +ACC100_ENGINE_OFFSET * i,ACC100_RESET_LO ); +usleep (LONG_WAIT ); +/* Prepare dummy workload */ +alloc_2x64mb_sw_rings_mem (bbdev, d,0 ); +/* Set base addresses */ +uint32_t phys_high = (uint32_t )(d->sw_rings_phys >>32 ); +uint32_t phys_low = (uint32_t )(d->sw_rings_phys & + ~(ACC100_SIZE_64MBYTE -1 )); +acc100_reg_write (d, HWPfDmaFec5GulDescBaseHiRegVf, phys_high); +acc100_reg_write (d, HWPfDmaFec5GulDescBaseLoRegVf, phys_low); + +/* Descriptor for a dummy 5GUL code block processing*/ +union acc100_dma_desc *desc =NULL ; + desc = d->sw_rings; + desc->req.data_ptrs[0 ].address = d->sw_rings_phys + +ACC100_DESC_FCW_OFFSET ; + desc->req.data_ptrs[0 ].blen =ACC100_FCW_LD_BLEN ; + desc->req.data_ptrs[0 ].blkid =ACC100_DMA_BLKID_FCW ; + desc->req.data_ptrs[0 ].last =0 ; + desc->req.data_ptrs[0 ].dma_ext =0 ; + desc->req.data_ptrs[1 ].address = d->sw_rings_phys +512 ; + desc->req.data_ptrs[1 ].blkid =ACC100_DMA_BLKID_IN ; + desc->req.data_ptrs[1 ].last =1 ; + desc->req.data_ptrs[1 ].dma_ext =0 ; + desc->req.data_ptrs[1 ].blen =44 ; + desc->req.data_ptrs[2 ].address = d->sw_rings_phys +1024 ; + desc->req.data_ptrs[2 ].blkid =ACC100_DMA_BLKID_OUT_ENC ; + desc->req.data_ptrs[2 ].last =1 ; + desc->req.data_ptrs[2 ].dma_ext =0 ; + desc->req.data_ptrs[2 ].blen =5 ; +/* Dummy FCW */ + desc->req.fcw_ld.FCWversion =ACC100_FCW_VER ; + desc->req.fcw_ld.qm =1 ; + desc->req.fcw_ld.nfiller =30 ; + desc->req.fcw_ld.BG =2 -1 ; + desc->req.fcw_ld.Zc =7 ; + desc->req.fcw_ld.ncb =350 ; + desc->req.fcw_ld.rm_e =4 ; + desc->req.fcw_ld.itmax =10 ; + desc->req.fcw_ld.gain_i =1 ; + desc->req.fcw_ld.gain_h =1 ; + +int engines_to_restart[SIG_UL_5G_LAST +1 ] = {0 }; +int num_failed_engine =0 ; +/* Detect engines in undefined state */ +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { +/* Check engine power-on status */ + address = HwPfFecUl5gIbDebugReg + +ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; +if (status ==0 ) { + engines_to_restart[num_failed_engine] = template_idx; + num_failed_engine++; + } + } + +int numQqsAcc = conf->q_ul_5g.num_qgroups; +int numQgs = conf->q_ul_5g.num_qgroups; + payload =0 ; +for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc); qg_idx++) + payload |= (1 << qg_idx); +/* Force each engine which is in unspecified state */ +for (i =0 ; i < num_failed_engine; i++) { +int failed_engine = engines_to_restart[i]; +printf ("Force engine %d\n" , failed_engine); +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (template_idx == failed_engine) +acc100_reg_write (d, address, payload); +else +acc100_reg_write (d, address,0 ); + } +/* Reset descriptor header */ + desc->req.word0 =ACC100_DMA_DESC_TYPE ; + desc->req.word1 =0 ; + desc->req.word2 =0 ; + desc->req.word3 =0 ; + desc->req.numCBs =1 ; + desc->req.m2dlen =2 ; + desc->req.d2mlen =1 ; +/* Enqueue the code block for processing */ +union acc100_enqueue_reg_fmt enq_req; + enq_req.val =0 ; + enq_req.addr_offset =ACC100_DESC_OFFSET ; + enq_req.num_elem =1 ; + enq_req.req_elem_addr =0 ; +rte_wmb (); +acc100_reg_write (d, HWPfQmgrIngressAq +0x100 , enq_req.val); +usleep (LONG_WAIT *100 ); +if (desc->req.word0 !=2 ) +printf ("DMA Response %#" PRIx32"\n" , desc->req.word0); + } + +/* Reset LDPC Cores */ +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) +acc100_reg_write (d, HWPfFecUl5gCntrlReg + +ACC100_ENGINE_OFFSET * i,ACC100_RESET_HI ); +usleep (LONG_WAIT ); +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) +acc100_reg_write (d, HWPfFecUl5gCntrlReg + +ACC100_ENGINE_OFFSET * i,ACC100_RESET_LO ); +usleep (LONG_WAIT ); +acc100_reg_write (d, HWPfHi5GHardResetReg,ACC100_RESET_HARD ); +usleep (LONG_WAIT ); +int numEngines =0 ; +/* Check engine power-on status again */ +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { + address = HwPfFecUl5gIbDebugReg + +ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (status ==1 ) { +acc100_reg_write (d, address, payload); + numEngines++; + }else +acc100_reg_write (d, address,0 ); + } +printf ("Number of 5GUL engines %d\n" , numEngines); + +if (d->sw_rings_base !=NULL )
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4377
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+rte_free (d->sw_rings_base); +usleep (LONG_WAIT ); +} + +/* Initial configuration of a ACC100 device prior to running configure() */ +int +acc100_configure (const char *dev_name,struct acc100_conf *conf) +{ +rte_bbdev_log (INFO ,"acc100_configure" ); +uint32_t payload, address, status;
maybe value or data would be a better variable name than payload.
would mean changing acc100_reg_write
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+int qg_idx, template_idx, vf_idx, acc, i; +struct rte_bbdev *bbdev =rte_bbdev_get_named_dev (dev_name); + +/* Compile time checks */ +RTE_BUILD_BUG_ON (sizeof (struct acc100_dma_req_desc ) !=256 ); +RTE_BUILD_BUG_ON (sizeof (union acc100_dma_desc ) !=256 ); +RTE_BUILD_BUG_ON (sizeof (struct acc100_fcw_td ) !=24 ); +RTE_BUILD_BUG_ON (sizeof (struct acc100_fcw_te ) !=32 ); + +if (bbdev ==NULL ) { +rte_bbdev_log (ERR , +"Invalid dev_name (%s), or device is not yet initialised" , + dev_name);
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4400
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+return -ENODEV ; + } +struct acc100_device *d = bbdev->data->dev_private; + +/* Store configuration */ +rte_memcpy (&d->acc100_conf, conf,sizeof (d->acc100_conf)); + +/* PCIe Bridge configuration */ +acc100_reg_write (d, HwPfPcieGpexBridgeControl,ACC100_CFG_PCI_BRIDGE ); +for (i =1 ; i <17 ; i++)
17 is a magic number, use a #define
this is a general issue.
Quoted 141 lines
drivers/baseband/acc100/rte_acc100_pmd.c +141
-0+acc100_reg_write (d, + HwPfPcieGpexAxiAddrMappingWindowPexBaseHigh + + i *16 ,0 ); + +/* PCIe Link Trainiing and Status State Machine */ +acc100_reg_write (d, HwPfPcieGpexLtssmStateCntrl,0xDFC00000 ); + +/* Prevent blocking AXI read on BRESP for AXI Write */ + address = HwPfPcieGpexAxiPioControl; + payload =ACC100_CFG_PCI_AXI ; +acc100_reg_write (d, address, payload); + +/* 5GDL PLL phase shift */ +acc100_reg_write (d, HWPfChaDl5gPllPhshft0,0x1 ); + +/* Explicitly releasing AXI as this may be stopped after PF FLR/BME */ + address = HWPfDmaAxiControl; + payload =1 ; +acc100_reg_write (d, address, payload); + +/* DDR Configuration */ + address = HWPfDdrBcTim6; + payload =acc100_reg_read (d, address); + payload &=0xFFFFFFFB ;/* Bit 2 */ +#ifdef ACC100_DDR_ECC_ENABLE + payload |=0x4 ; +#endif +acc100_reg_write (d, address, payload); + address = HWPfDdrPhyDqsCountNum; +#ifdef ACC100_DDR_ECC_ENABLE + payload =9 ; +#else + payload =8 ; +#endif +acc100_reg_write (d, address, payload); + +/* Set default descriptor signature */ + address = HWPfDmaDescriptorSignatuture; + payload =0 ; +acc100_reg_write (d, address, payload); + +/* Enable the Error Detection in DMA */ + payload =ACC100_CFG_DMA_ERROR ; + address = HWPfDmaErrorDetectionEn; +acc100_reg_write (d, address, payload); + +/* AXI Cache configuration */ + payload =ACC100_CFG_AXI_CACHE ; + address = HWPfDmaAxcacheReg; +acc100_reg_write (d, address, payload); + +/* Default DMA Configuration (Qmgr Enabled) */ + address = HWPfDmaConfig0Reg; + payload =0 ; +acc100_reg_write (d, address, payload); + address = HWPfDmaQmanen; + payload =0 ; +acc100_reg_write (d, address, payload); + +/* Default RLIM/ALEN configuration */ + address = HWPfDmaConfig1Reg; + payload = (1 <<31 ) + (23 <<8 ) + (1 <<6 ) +7 ; +acc100_reg_write (d, address, payload); + +/* Configure DMA Qmanager addresses */ + address = HWPfDmaQmgrAddrReg; + payload = HWPfQmgrEgressQueuesTemplate; +acc100_reg_write (d, address, payload); + +/* ===== Qmgr Configuration ===== */ +/* Configuration of the AQueue Depth QMGR_GRP_0_DEPTH_LOG2 for UL */ +int totalQgs = conf->q_ul_4g.num_qgroups + + conf->q_ul_5g.num_qgroups + + conf->q_dl_4g.num_qgroups + + conf->q_dl_5g.num_qgroups; +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { + address = HWPfQmgrDepthLog2Grp + +BYTES_IN_WORD * qg_idx; + payload =aqDepth (qg_idx, conf); +acc100_reg_write (d, address, payload); + address = HWPfQmgrTholdGrp + +BYTES_IN_WORD * qg_idx; + payload = (1 <<16 ) + (1 << (aqDepth (qg_idx, conf) -1 )); +acc100_reg_write (d, address, payload); + } + +/* Template Priority in incremental order */ +for (template_idx =0 ; template_idx <ACC100_NUM_TMPL ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg0Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_0 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg1Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_1 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg2indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_2 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg3Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_3 ; +acc100_reg_write (d, address, payload); + } + + address = HWPfQmgrGrpPriority; + payload =ACC100_CFG_QMGR_HI_P ; +acc100_reg_write (d, address, payload); + +/* Template Configuration */ +for (template_idx =0 ; template_idx <ACC100_NUM_TMPL ; template_idx++) { + payload =0 ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +acc100_reg_write (d, address, payload); + } +/* 4GUL */ +int numQgs = conf->q_ul_4g.num_qgroups; +int numQqsAcc =0 ; + payload =0 ; +for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc); qg_idx++) + payload |= (1 << qg_idx); +for (template_idx =SIG_UL_4G ; template_idx <=SIG_UL_4G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx; +acc100_reg_write (d, address, payload); + } +/* 5GUL */ + numQqsAcc += numQgs; + numQgs = conf->q_ul_5g.num_qgroups; + payload =0 ; +int numEngines =0 ; +for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc); qg_idx++) + payload |= (1 << qg_idx); +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { +/* Check engine power-on status */ + address = HwPfFecUl5gIbDebugReg +
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4551
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (status ==1 ) { +acc100_reg_write (d, address, payload); + numEngines++; + }else +acc100_reg_write (d, address,0 ); +#if RTE_ACC100_SINGLE_FEC ==1
#if should be at start of line
Quoted 116 lines
drivers/baseband/acc100/rte_acc100_pmd.c +116
-0+ payload =0 ; +#endif + } +printf ("Number of 5GUL engines %d\n" , numEngines); +/* 4GDL */ + numQqsAcc += numQgs; + numQgs = conf->q_dl_4g.num_qgroups; + payload =0 ; +for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc); qg_idx++) + payload |= (1 << qg_idx); +for (template_idx =SIG_DL_4G ; template_idx <=SIG_DL_4G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx; +acc100_reg_write (d, address, payload); +#if RTE_ACC100_SINGLE_FEC ==1 + payload =0 ; +#endif + } +/* 5GDL */ + numQqsAcc += numQgs; + numQgs = conf->q_dl_5g.num_qgroups; + payload =0 ; +for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc); qg_idx++) + payload |= (1 << qg_idx); +for (template_idx =SIG_DL_5G ; template_idx <=SIG_DL_5G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx; +acc100_reg_write (d, address, payload); +#if RTE_ACC100_SINGLE_FEC ==1 + payload =0 ; +#endif + } + +/* Queue Group Function mapping */ +int qman_func_id[5 ] = {0 ,2 ,1 ,3 ,4 }; + address = HWPfQmgrGrpFunction0; + payload =0 ; +for (qg_idx =0 ; qg_idx <8 ; qg_idx++) { + acc =accFromQgid (qg_idx, conf); + payload |= qman_func_id[acc]<<(qg_idx *4 ); + } +acc100_reg_write (d, address, payload); + +/* Configuration of the Arbitration QGroup depth to 1 */ +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { + address = HWPfQmgrArbQDepthGrp + +BYTES_IN_WORD * qg_idx; + payload =0 ; +acc100_reg_write (d, address, payload); + } + +/* Enabling AQueues through the Queue hierarchy*/ +for (vf_idx =0 ; vf_idx <ACC100_NUM_VFS ; vf_idx++) { +for (qg_idx =0 ; qg_idx <ACC100_NUM_QGRPS ; qg_idx++) { + payload =0 ; +if (vf_idx < conf->num_vf_bundles && + qg_idx < totalQgs) + payload = (1 <<aqNum (qg_idx, conf)) -1 ; + address = HWPfQmgrAqEnableVf + + vf_idx *BYTES_IN_WORD ; + payload += (qg_idx <<16 ); +acc100_reg_write (d, address, payload); + } + } + +/* This pointer to ARAM (256kB) is shifted by 2 (4B per register) */ +uint32_t aram_address =0 ; +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { +for (vf_idx =0 ; vf_idx < conf->num_vf_bundles; vf_idx++) { + address = HWPfQmgrVfBaseAddr + vf_idx + *BYTES_IN_WORD + qg_idx + *BYTES_IN_WORD *64 ; + payload = aram_address; +acc100_reg_write (d, address, payload); +/* Offset ARAM Address for next memory bank +* - increment of 4B +*/ + aram_address +=aqNum (qg_idx, conf) * + (1 <<aqDepth (qg_idx, conf)); + } + } + +if (aram_address >WORDS_IN_ARAM_SIZE ) { +rte_bbdev_log (ERR ,"ARAM Configuration not fitting %d %d\n" , + aram_address,WORDS_IN_ARAM_SIZE ); +return -EINVAL ; + } + +/* ==== HI Configuration ==== */ + +/* Prevent Block on Transmit Error */ + address = HWPfHiBlockTransmitOnErrorEn; + payload =0 ; +acc100_reg_write (d, address, payload); +/* Prevents to drop MSI */ + address = HWPfHiMsiDropEnableReg; + payload =0 ; +acc100_reg_write (d, address, payload); +/* Set the PF Mode register */ + address = HWPfHiPfMode; + payload = (conf->pf_mode_en) ?2 :0 ; +acc100_reg_write (d, address, payload); +/* Enable Error Detection in HW */ + address = HWPfDmaErrorDetectionEn; + payload =0x3D7 ; +acc100_reg_write (d, address, payload); + +/* QoS overflow init */ + payload =1 ; + address = HWPfQosmonAEvalOverflow0; +acc100_reg_write (d, address, payload); + address = HWPfQosmonBEvalOverflow0; +acc100_reg_write (d, address, payload); +
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4677
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+/* HARQ DDR Configuration */ +unsigned int ddrSizeInMb =512 ;/* Fixed to 512 MB per VF for now */ +for (vf_idx =0 ; vf_idx < conf->num_vf_bundles; vf_idx++) { + address = HWPfDmaVfDdrBaseRw + vf_idx + *0x10 ; + payload = ((vf_idx * (ddrSizeInMb /64 )) <<16 ) + + (ddrSizeInMb -1 ); +acc100_reg_write (d, address, payload); + } +usleep (LONG_WAIT );
Is sleep needed here ? the reg_write has one.
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4678
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+
Since this seems like a workaround, add a comment here.
Tom
Quoted 21 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+if (numEngines < (SIG_UL_5G_LAST +1 )) +poweron_cleanup (bbdev, d, conf); + +rte_bbdev_log_debug ("PF Tip configuration complete for %s" , dev_name); +return 0 ; +}drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map +7
-0@@ -1,3 +1,10 @@ DPDK_21 { local: *; }; + +EXPERIMENTAL { + global: + + acc100_configure; + +};
Re: [dpdk-dev] [PATCH v9 10/10] baseband/acc100: add configure function
Hi Tom,
Quoted 41 lines
From: Tom Rix <[email protected]>
Quoted 11 lines · Nicolas Chautru
Add configure function to configure the PF from within the bbdev-test itself without external application configuration the device.
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- app/test-bbdev/test_bbdev_perf.c | 72 +++ doc/guides/rel_notes/release_20_11.rst | 5 + drivers/baseband/acc100/meson.build | 2 + drivers/baseband/acc100/rte_acc100_cfg.h | 17 + drivers/baseband/acc100/rte_acc100_pmd.c | 505+++++++++++++++++++++
Quoted 27 lines
.../acc100/rte_pmd_bbdev_acc100_version.map | 7 + 6 files changed, 608 insertions(+)app/test-bbdev/test_bbdev_perf.c +12
-0@@ -52,6 +52,18 @@#define FLR_5G_TIMEOUT 610#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 +#include <rte_acc100_cfg.h> +#define ACC100PF_DRIVER_NAME ("intel_acc100_pf") +#define ACC100VF_DRIVER_NAME ("intel_acc100_vf") +#define ACC100_QMGR_NUM_AQS 16 +#define ACC100_QMGR_NUM_QGS 2 +#define ACC100_QMGR_AQ_DEPTH 5 +#define ACC100_QMGR_INVALID_IDX -1 +#define ACC100_QMGR_RR 1 +#define ACC100_QOS_GBR 0 +#endif +#define OPS_CACHE_SIZE 256U#define OPS_POOL_SIZE_MIN 511U/* 0.5K per queue */
Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0
-0@@ -653,6 +665,66 @@ typedef int (test_case_function)(struct
active_device*ad,app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad, · line 668
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1
-0info->dev_name); }#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 seems like this function would break if one of the other bbdev's were #defined.
No these are independent. By default they are all defined.
Quoted 77 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 670
Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +2
-0+ if ((get_init_device() == true) && + (!strcmp(info->drv.driver_name,
ACC100PF_DRIVER_NAME))) {app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4
-0+struct acc100_conf conf; +unsigned int i; + + printf("Configure ACC100 FEC Driver %s with defaultvalues\n",
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 9 lines
app/test-bbdev/test_bbdev_perf.c +9
-0+ info->drv.driver_name); + +/* clear default configuration before initialization */ +memset (&conf,0 ,sizeof (struct acc100_conf )); + +/* Always set in PF mode for built-in configuration */ + conf.pf_mode_en = true; +for (i =0 ; i <RTE_ACC100_NUM_VFS ; ++i) { + conf.arb_dl_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 684
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 685
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_4g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 686
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 687
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 688
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 689
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 690
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 691
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 692
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 693
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 694
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +5
-0+ } + + conf.input_pos_llr_1_bit = true; + conf.output_pos_llr_1_bit = true; + conf.num_vf_bundles =1 ;/**< Number of VF bundles to setup */
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ + conf.q_ul_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_4g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 703
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_ul_4g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_ul_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_4g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 707
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_dl_4g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_dl_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_ul_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_5g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 711
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_ul_5g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_ul_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_5g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 715
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_dl_5g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +6
-0+ conf.q_dl_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + +/* setup PF with configuration information */ + ret =acc100_configure (info->dev_name, &conf); + TEST_ASSERT_SUCCESS(ret, + "Failed to configure ACC100 PF for bbdev%s",
Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad, · line 725
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4
-0+ info->dev_name); +/* Let's refresh this now this is configured */ + } +rte_bbdev_info_get (dev_id, info);The other bbdev's do not call
rte_bbdev_info_get, can this be removed ?
Actually it should be added outside for all versions post-configuraion. Thanks
Quoted 90 lines
Quoted 39 lines
app/test-bbdev/test_bbdev_perf.c +2
-0+#endif + nb_queues =RTE_MIN (rte_lcore_count (), info- drv.max_num_queues); nb_queues =RTE_MIN (nb_queues, (unsigned int )MAX_QUEUES );doc/guides/rel_notes/release_20_11.rst +5
-0@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added Intel ACC100 bbdev PMD.** + + Added a new ``acc100`` bbdev driver for the Intel\ |reg| ACC100 + accelerator also known as Mount Bryce. See the + :doc:`../bbdevs/acc100` BBDEV guide for more details on this new driver. Removed Items -------------drivers/baseband/acc100/meson.build +2
-0@@ -4,3 +4,5 @@ deps += ['bbdev', 'bus_vdev', 'ring', 'pci', 'bus_pci'] sources = files('rte_acc100_pmd.c') + +install_headers('rte_acc100_cfg.h')drivers/baseband/acc100/rte_acc100_cfg.h +0
-0drivers/baseband/acc100/rte_acc100_cfg.h struct acc100_conf { · line 96
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_cfg.h +6
-0@@ -89,6 +89,23 @@ struct acc100_conf {struct rte_arbitration_t arb_dl_5g[RTE_ACC100_NUM_VFS ]; }; +/** +* Configure a ACC100 device +* +* @param dev_name +* The name of the device. This is the short form of PCI BDF, e.g. 00:01.0. +* It can also be retrieved for a bbdev device from the dev_name field in the
Quoted 28 lines
drivers/baseband/acc100/rte_acc100_cfg.h +11
-0+* rte_bbdev_info structure returned by rte_bbdev_info_get(). +* @param conf +* Configuration to apply to ACC100 HW. +* +* @return +* Zero on success, negative value on failure. +*/ +__rte_experimental +int +acc100_configure (const char *dev_name,struct acc100_conf *conf); + #ifdef __cplusplus }#endif drivers/baseband/acc100/rte_acc100_pmd.c +5
-0@@ -85,6 +85,26 @@enum {UL_4G =0 ,UL_5G ,DL_4G ,DL_5G ,NUM_ACC }; +/* Return the accelerator enum for a Queue Group Index */ static +inline int accFromQgid (int qg_idx,const struct acc100_conf +*acc100_conf) { +int accQg[ACC100_NUM_QGRPS ]; +int NumQGroupsPerFn[NUM_ACC ];drivers/baseband/acc100/rte_acc100_pmd.c line 102
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+int acc, qgIdx, qgIndex =0 ; +for (qgIdx =0 ; qgIdx <ACC100_NUM_QGRPS ; qgIdx++) + accQg[qgIdx] =0 ; + NumQGroupsPerFn[UL_4G ] = acc100_conf->q_ul_4g.num_qgroups; + NumQGroupsPerFn[UL_5G ] = acc100_conf->q_ul_5g.num_qgroups; + NumQGroupsPerFn[DL_4G ] = acc100_conf->q_dl_4g.num_qgroups; + NumQGroupsPerFn[DL_5G ] = acc100_conf->q_dl_5g.num_qgroups; +for (acc =UL_4G ; acc <NUM_ACC ; acc++) +for (qgIdx =0 ; qgIdx < NumQGroupsPerFn[acc]; qgIdx++) + accQg[qgIndex++] = acc;This looks inefficient, is there a way this could be calculated without filling arrays to
Quoted 1 line
access 1 value ?
That is not time critical, and the same common code is run each time.
Quoted 21 lines
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ acc = accQg[qg_idx]; +return acc; +} + /* Return the queue topology for a Queue Group Index */ staticinline void qtopFromAcc(struct
rte_q_topology_t**qtop, intacc_enum, @@ -113,6 +133,30 @@drivers/baseband/acc100/rte_acc100_pmd.c line 144
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0*qtop = p_qtop; } +/* Return the AQ depth for a Queue Group Index */ static inline int +aqDepth (int qg_idx,struct acc100_conf *acc100_conf) { +struct rte_q_topology_t *q_top =NULL ; +int acc_enum =accFromQgid (qg_idx, acc100_conf); +qtopFromAcc (&q_top, acc_enum, acc100_conf); +if (unlikely (q_top ==NULL )) +return 0 ;This error is not handled well be the callers.
Quoted 1 line
aqNum is similar.
This fails in a consistent basis, by having not queue available and handling this as the default case.
Quoted 20 lines
Quoted 16 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+return q_top->aq_depth_log2; +} + +/* Return the AQ depth for a Queue Group Index */ static inline int +aqNum (int qg_idx,struct acc100_conf *acc100_conf) { +struct rte_q_topology_t *q_top =NULL ; +int acc_enum =accFromQgid (qg_idx, acc100_conf); +qtopFromAcc (&q_top, acc_enum, acc100_conf); +if (unlikely (q_top ==NULL )) +return 0 ; +return q_top->num_aqs_per_groups; +} +static void initQTop(struct acc100_conf *acc100_conf) { @@ -4177,3 +4221,464Quoted 3 lines
@@ static int
acc100_pci_remove(struct rte_pci_device *pci_dev)RTE_PMD_REGISTER_PCI_TABLE(ACC100PF_DRIVER_NAME, pci_id_acc100_pf_map);RTE_PMD_REGISTER_PCI(ACC100VF_DRIVER_NAME,
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4227
Quoted 7 lines
acc100_pci_vf_driver);RTE_PMD_REGISTER_PCI_TABLE(ACC100VF_DRIVER_NAME, pci_id_acc100_vf_map);drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ +/* +* Implementation to fix the power on status of some 5GUL engines +* This requires DMA permission if ported outside DPDK This sounds like a workaround, can more detail be added here ?
There are comments through the code I believe:
- /* Detect engines in undefined state */
- /* Force each engine which is in unspecified state */
- /* Reset LDPC Cores */
- /* Check engine power-on status again */ Do you believe this is not explicit enough. Power-on status may be in an undefined state hence this engine are avtivate with dummy payload to make sure they are in a predicable state once configuration is done.
Quoted 163 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 12 lines
+ */
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+static void +poweron_cleanup (struct rte_bbdev *bbdev,struct acc100_device *d, +struct acc100_conf *conf) +{ +int i, template_idx, qg_idx; +uint32_t address, status, payload; +printf ("Need to clear power-on 5GUL status in internal memory\n" ); +/* Reset LDPC Cores */ +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_HI);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+usleep (LONG_WAIT ); +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_LO);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+usleep (LONG_WAIT ); +/* Prepare dummy workload */ +alloc_2x64mb_sw_rings_mem (bbdev, d,0 ); +/* Set base addresses */ +uint32_t phys_high = (uint32_t )(d->sw_rings_phys >>32 ); +uint32_t phys_low = (uint32_t )(d->sw_rings_phys & + ~(ACC100_SIZE_64MBYTE -1 )); + acc100_reg_write(d, HWPfDmaFec5GulDescBaseHiRegVf,
phys_high);Quoted 34 lines
drivers/baseband/acc100/rte_acc100_pmd.c +34
-0+acc100_reg_write (d, HWPfDmaFec5GulDescBaseLoRegVf, phys_low); + +/* Descriptor for a dummy 5GUL code block processing*/ +union acc100_dma_desc *desc =NULL ; + desc = d->sw_rings; + desc->req.data_ptrs[0 ].address = d->sw_rings_phys + +ACC100_DESC_FCW_OFFSET ; + desc->req.data_ptrs[0 ].blen =ACC100_FCW_LD_BLEN ; + desc->req.data_ptrs[0 ].blkid =ACC100_DMA_BLKID_FCW ; + desc->req.data_ptrs[0 ].last =0 ; + desc->req.data_ptrs[0 ].dma_ext =0 ; + desc->req.data_ptrs[1 ].address = d->sw_rings_phys +512 ; + desc->req.data_ptrs[1 ].blkid =ACC100_DMA_BLKID_IN ; + desc->req.data_ptrs[1 ].last =1 ; + desc->req.data_ptrs[1 ].dma_ext =0 ; + desc->req.data_ptrs[1 ].blen =44 ; + desc->req.data_ptrs[2 ].address = d->sw_rings_phys +1024 ; + desc->req.data_ptrs[2 ].blkid =ACC100_DMA_BLKID_OUT_ENC ; + desc->req.data_ptrs[2 ].last =1 ; + desc->req.data_ptrs[2 ].dma_ext =0 ; + desc->req.data_ptrs[2 ].blen =5 ; +/* Dummy FCW */ + desc->req.fcw_ld.FCWversion =ACC100_FCW_VER ; + desc->req.fcw_ld.qm =1 ; + desc->req.fcw_ld.nfiller =30 ; + desc->req.fcw_ld.BG =2 -1 ; + desc->req.fcw_ld.Zc =7 ; + desc->req.fcw_ld.ncb =350 ; + desc->req.fcw_ld.rm_e =4 ; + desc->req.fcw_ld.itmax =10 ; + desc->req.fcw_ld.gain_i =1 ; + desc->req.fcw_ld.gain_h =1 ; + +int engines_to_restart[SIG_UL_5G_LAST +1 ] = {0 };drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+int num_failed_engine =0 ; +/* Detect engines in undefined state */ +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { +/* Check engine power-on status */ + address = HwPfFecUl5gIbDebugReg + +ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; +if (status ==0 ) { + engines_to_restart[num_failed_engine] =
template_idx;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ num_failed_engine++; + } + } + +int numQqsAcc = conf->q_ul_5g.num_qgroups; +int numQgs = conf->q_ul_5g.num_qgroups; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ payload |= (1 << qg_idx); +/* Force each engine which is in unspecified state */ +for (i =0 ; i < num_failed_engine; i++) { +int failed_engine = engines_to_restart[i]; +printf ("Force engine %d\n" , failed_engine); + for (template_idx = SIG_UL_5G; template_idx <=
SIG_UL_5G_LAST;Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +14
-0+ template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (template_idx == failed_engine) +acc100_reg_write (d, address, payload); +else +acc100_reg_write (d, address,0 ); + } +/* Reset descriptor header */ + desc->req.word0 =ACC100_DMA_DESC_TYPE ; + desc->req.word1 =0 ; + desc->req.word2 =0 ; + desc->req.word3 =0 ; + desc->req.numCBs =1 ;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ desc->req.m2dlen =2 ; + desc->req.d2mlen =1 ; +/* Enqueue the code block for processing */ +union acc100_enqueue_reg_fmt enq_req; + enq_req.val =0 ; + enq_req.addr_offset =ACC100_DESC_OFFSET ; + enq_req.num_elem =1 ; + enq_req.req_elem_addr =0 ; +rte_wmb (); + acc100_reg_write(d, HWPfQmgrIngressAq + 0x100,enq_req.val);
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+usleep (LONG_WAIT *100 ); +if (desc->req.word0 !=2 ) + printf("DMA Response %#"PRIx32"\n", desc-req.word0);
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ } + +/* Reset LDPC Cores */ +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_HI);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+usleep (LONG_WAIT ); +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_LO);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+usleep (LONG_WAIT ); + acc100_reg_write(d, HWPfHi5GHardResetReg,
ACC100_RESET_HARD);Quoted 18 lines
drivers/baseband/acc100/rte_acc100_pmd.c +18
-0+usleep (LONG_WAIT ); +int numEngines =0 ; +/* Check engine power-on status again */ +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { + address = HwPfFecUl5gIbDebugReg + +ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (status ==1 ) { +acc100_reg_write (d, address, payload); + numEngines++; + }else +acc100_reg_write (d, address,0 ); + } +printf ("Number of 5GUL engines %d\n" , numEngines); +drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4377
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+if (d->sw_rings_base !=NULL ) +rte_free (d->sw_rings_base); +usleep (LONG_WAIT ); +} + +/* Initial configuration of a ACC100 device prior to running +configure() */ int acc100_configure (const char *dev_name,struct +acc100_conf *conf) { +rte_bbdev_log (INFO ,"acc100_configure" ); +uint32_t payload, address, status;maybe value or data would be a better variable name than payload.
Quoted 1 line
would mean changing
acc100_reg_write
transparent to me, but can change given DPDK uses term value.
Quoted 24 lines
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+int qg_idx, template_idx, vf_idx, acc, i; +struct rte_bbdev *bbdev =rte_bbdev_get_named_dev (dev_name); + +/* Compile time checks */ +RTE_BUILD_BUG_ON (sizeof (struct acc100_dma_req_desc ) !=256 ); +RTE_BUILD_BUG_ON (sizeof (union acc100_dma_desc ) !=256 ); +RTE_BUILD_BUG_ON (sizeof (struct acc100_fcw_td ) !=24 ); +RTE_BUILD_BUG_ON (sizeof (struct acc100_fcw_te ) !=32 ); + +if (bbdev ==NULL ) { + rte_bbdev_log(ERR, + "Invalid dev_name (%s), or device is not yet initialised",drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ dev_name); +return -ENODEV ; + } +struct acc100_device *d = bbdev->data->dev_private; + +/* Store configuration */ +rte_memcpy (&d->acc100_conf, conf,sizeof (d->acc100_conf)); + +/* PCIe Bridge configuration */ + acc100_reg_write(d, HwPfPcieGpexBridgeControl,
ACC100_CFG_PCI_BRIDGE);
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4400
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+for (i =1 ; i <17 ; i++)17 is a magic number, use a #define
this is a general issue.
These are only used once but still agreed.
Quoted 141 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 3 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ acc100_reg_write(d, +HwPfPcieGpexAxiAddrMappingWindowPexBaseHigh
Quoted 58 lines
drivers/baseband/acc100/rte_acc100_pmd.c +58
-0+ + i * 16, 0); + +/* PCIe Link Trainiing and Status State Machine */ +acc100_reg_write (d, HwPfPcieGpexLtssmStateCntrl,0xDFC00000 ); + +/* Prevent blocking AXI read on BRESP for AXI Write */ + address = HwPfPcieGpexAxiPioControl; + payload =ACC100_CFG_PCI_AXI ; +acc100_reg_write (d, address, payload); + +/* 5GDL PLL phase shift */ +acc100_reg_write (d, HWPfChaDl5gPllPhshft0,0x1 ); + +/* Explicitly releasing AXI as this may be stopped after PF FLR/BME */ + address = HWPfDmaAxiControl; + payload =1 ; +acc100_reg_write (d, address, payload); + +/* DDR Configuration */ + address = HWPfDdrBcTim6; + payload =acc100_reg_read (d, address); + payload &=0xFFFFFFFB ;/* Bit 2 */ #ifdef ACC100_DDR_ECC_ENABLE + payload |=0x4 ; +#endif +acc100_reg_write (d, address, payload); + address = HWPfDdrPhyDqsCountNum; +#ifdef ACC100_DDR_ECC_ENABLE + payload =9 ; +#else + payload =8 ; +#endif +acc100_reg_write (d, address, payload); + +/* Set default descriptor signature */ + address = HWPfDmaDescriptorSignatuture; + payload =0 ; +acc100_reg_write (d, address, payload); + +/* Enable the Error Detection in DMA */ + payload =ACC100_CFG_DMA_ERROR ; + address = HWPfDmaErrorDetectionEn; +acc100_reg_write (d, address, payload); + +/* AXI Cache configuration */ + payload =ACC100_CFG_AXI_CACHE ; + address = HWPfDmaAxcacheReg; +acc100_reg_write (d, address, payload); + +/* Default DMA Configuration (Qmgr Enabled) */ + address = HWPfDmaConfig0Reg; + payload =0 ; +acc100_reg_write (d, address, payload); + address = HWPfDmaQmanen; + payload =0 ; +acc100_reg_write (d, address, payload); + +/* Default RLIM/ALEN configuration */ + address = HWPfDmaConfig1Reg;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload = (1 <<31 ) + (23 <<8 ) + (1 <<6 ) +7 ; +acc100_reg_write (d, address, payload); + +/* Configure DMA Qmanager addresses */ + address = HWPfDmaQmgrAddrReg; + payload = HWPfQmgrEgressQueuesTemplate; +acc100_reg_write (d, address, payload); + +/* ===== Qmgr Configuration ===== */ +/* Configuration of the AQueue Depth QMGR_GRP_0_DEPTH_LOG2 for UL */
Quoted 32 lines
drivers/baseband/acc100/rte_acc100_pmd.c +32
-0+int totalQgs = conf->q_ul_4g.num_qgroups + + conf->q_ul_5g.num_qgroups + + conf->q_dl_4g.num_qgroups + + conf->q_dl_5g.num_qgroups; +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { + address = HWPfQmgrDepthLog2Grp + +BYTES_IN_WORD * qg_idx; + payload =aqDepth (qg_idx, conf); +acc100_reg_write (d, address, payload); + address = HWPfQmgrTholdGrp + +BYTES_IN_WORD * qg_idx; + payload = (1 <<16 ) + (1 << (aqDepth (qg_idx, conf) -1 )); +acc100_reg_write (d, address, payload); + } + +/* Template Priority in incremental order */ +for (template_idx =0 ; template_idx <ACC100_NUM_TMPL ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg0Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_0 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg1Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_1 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg2indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_2 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg3Indx + +BYTES_IN_WORD * (template_idx %8 );drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload =TMPL_PRI_3 ; +acc100_reg_write (d, address, payload); + } + + address = HWPfQmgrGrpPriority; + payload =ACC100_CFG_QMGR_HI_P ; +acc100_reg_write (d, address, payload); + +/* Template Configuration */ + for (template_idx = 0; template_idx < ACC100_NUM_TMPL;template_idx++) {
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload =0 ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +acc100_reg_write (d, address, payload); + } +/* 4GUL */ +int numQgs = conf->q_ul_4g.num_qgroups; +int numQqsAcc =0 ; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_UL_4G ; template_idx <=SIG_UL_4G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx; +acc100_reg_write (d, address, payload); + } +/* 5GUL */ + numQqsAcc += numQgs; + numQgs = conf->q_ul_5g.num_qgroups; + payload =0 ; +int numEngines =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
Quoted 16 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { +/* Check engine power-on status */ + address = HwPfFecUl5gIbDebugReg +drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4551
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (status ==1 ) { +acc100_reg_write (d, address, payload); + numEngines++; + }else +acc100_reg_write (d, address,0 ); +#if RTE_ACC100_SINGLE_FEC ==1 #if should be at start of line
ok
Quoted 122 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ payload =0 ; +#endif + } +printf ("Number of 5GUL engines %d\n" , numEngines); +/* 4GDL */ + numQqsAcc += numQgs; + numQgs = conf->q_dl_4g.num_qgroups; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_DL_4G ; template_idx <=SIG_DL_4G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+acc100_reg_write (d, address, payload); +#if RTE_ACC100_SINGLE_FEC ==1 + payload =0 ; +#endif + } +/* 5GDL */ + numQqsAcc += numQgs; + numQgs = conf->q_dl_5g.num_qgroups; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
Quoted 52 lines
drivers/baseband/acc100/rte_acc100_pmd.c +52
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_DL_5G ; template_idx <=SIG_DL_5G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx; +acc100_reg_write (d, address, payload); +#if RTE_ACC100_SINGLE_FEC ==1 + payload =0 ; +#endif + } + +/* Queue Group Function mapping */ +int qman_func_id[5 ] = {0 ,2 ,1 ,3 ,4 }; + address = HWPfQmgrGrpFunction0; + payload =0 ; +for (qg_idx =0 ; qg_idx <8 ; qg_idx++) { + acc =accFromQgid (qg_idx, conf); + payload |= qman_func_id[acc]<<(qg_idx *4 ); + } +acc100_reg_write (d, address, payload); + +/* Configuration of the Arbitration QGroup depth to 1 */ +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { + address = HWPfQmgrArbQDepthGrp + +BYTES_IN_WORD * qg_idx; + payload =0 ; +acc100_reg_write (d, address, payload); + } + +/* Enabling AQueues through the Queue hierarchy*/ +for (vf_idx =0 ; vf_idx <ACC100_NUM_VFS ; vf_idx++) { +for (qg_idx =0 ; qg_idx <ACC100_NUM_QGRPS ; qg_idx++) { + payload =0 ; +if (vf_idx < conf->num_vf_bundles && + qg_idx < totalQgs) + payload = (1 <<aqNum (qg_idx, conf)) -1 ; + address = HWPfQmgrAqEnableVf + + vf_idx *BYTES_IN_WORD ; + payload += (qg_idx <<16 ); +acc100_reg_write (d, address, payload); + } + } + +/* This pointer to ARAM (256kB) is shifted by 2 (4B per register) */ +uint32_t aram_address =0 ; +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { +for (vf_idx =0 ; vf_idx < conf->num_vf_bundles; vf_idx++) { + address = HWPfQmgrVfBaseAddr + vf_idx + *BYTES_IN_WORD + qg_idx + *BYTES_IN_WORD *64 ; + payload = aram_address; +acc100_reg_write (d, address, payload);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+/* Offset ARAM Address for next memory bank +* - increment of 4B +*/ + aram_address +=aqNum (qg_idx, conf) * + (1 <<aqDepth (qg_idx, conf)); + } + } + +if (aram_address >WORDS_IN_ARAM_SIZE ) { + rte_bbdev_log(ERR, "ARAM Configuration not fitting %d%d\n",
Quoted 22 lines
drivers/baseband/acc100/rte_acc100_pmd.c +22
-0+ aram_address, WORDS_IN_ARAM_SIZE); +return -EINVAL ; + } + +/* ==== HI Configuration ==== */ + +/* Prevent Block on Transmit Error */ + address = HWPfHiBlockTransmitOnErrorEn; + payload =0 ; +acc100_reg_write (d, address, payload); +/* Prevents to drop MSI */ + address = HWPfHiMsiDropEnableReg; + payload =0 ; +acc100_reg_write (d, address, payload); +/* Set the PF Mode register */ + address = HWPfHiPfMode; + payload = (conf->pf_mode_en) ?2 :0 ; +acc100_reg_write (d, address, payload); +/* Enable Error Detection in HW */ + address = HWPfDmaErrorDetectionEn; + payload =0x3D7 ; +acc100_reg_write (d, address, payload);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ +/* QoS overflow init */ + payload =1 ; + address = HWPfQosmonAEvalOverflow0; +acc100_reg_write (d, address, payload); + address = HWPfQosmonBEvalOverflow0; +acc100_reg_write (d, address, payload); + +/* HARQ DDR Configuration */ +unsigned int ddrSizeInMb =512 ;/* Fixed to 512 MB per VF for now */
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4677
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+for (vf_idx =0 ; vf_idx < conf->num_vf_bundles; vf_idx++) { + address = HWPfDmaVfDdrBaseRw + vf_idx + *0x10 ; + payload = ((vf_idx * (ddrSizeInMb /64 )) <<16 ) + + (ddrSizeInMb -1 ); +acc100_reg_write (d, address, payload); + } +usleep (LONG_WAIT );Is sleep needed here ? the
reg_writehas one.
This one is needed on top
Quoted 3 lines
Quoted 1 line
+
Since this seems like a workaround, add a comment here.
fair enough, ok, thanks
Quoted 27 lines
Tom
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+if (numEngines < (SIG_UL_5G_LAST +1 )) +poweron_cleanup (bbdev, d, conf); + + rte_bbdev_log_debug("PF Tip configuration complete for %s",
dev_name);Quoted 19 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+return 0 ; +}(quoted diff) +0
-0a/drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map b/drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map index 4a76d1d..91c234d 100644
drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map +7
-0@@ -1,3 +1,10 @@ DPDK_21 { local: *; }; + +EXPERIMENTAL { + global: + + acc100_configure; + +};
Re: [dpdk-dev] [PATCH v9 10/10] baseband/acc100: add configure function
Quoted 45 lines · Nicolas
Hi Tom,
Quoted 43 lines
From: Tom Rix <[email protected]>
Quoted 11 lines · Nicolas Chautru
Add configure function to configure the PF from within the bbdev-test itself without external application configuration the device.
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- app/test-bbdev/test_bbdev_perf.c | 72 +++ doc/guides/rel_notes/release_20_11.rst | 5 + drivers/baseband/acc100/meson.build | 2 + drivers/baseband/acc100/rte_acc100_cfg.h | 17 + drivers/baseband/acc100/rte_acc100_pmd.c | 505+++++++++++++++++++++
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct
Quoted 28 lines
.../acc100/rte_pmd_bbdev_acc100_version.map | 7 + 6 files changed, 608 insertions(+)app/test-bbdev/test_bbdev_perf.c +12
-0@@ -52,6 +52,18 @@#define FLR_5G_TIMEOUT 610#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 +#include <rte_acc100_cfg.h> +#define ACC100PF_DRIVER_NAME ("intel_acc100_pf") +#define ACC100VF_DRIVER_NAME ("intel_acc100_vf") +#define ACC100_QMGR_NUM_AQS 16 +#define ACC100_QMGR_NUM_QGS 2 +#define ACC100_QMGR_AQ_DEPTH 5 +#define ACC100_QMGR_INVALID_IDX -1 +#define ACC100_QMGR_RR 1 +#define ACC100_QOS_GBR 0 +#endif +#define OPS_CACHE_SIZE 256U#define OPS_POOL_SIZE_MIN 511U/* 0.5K per queue */ @@ -653,6 +665,66 @@ typedef int (test_case_function)(struct
active_device*ad,
Quoted 7 lines
Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad, · line 668
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1
-0info->dev_name); }#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 seems like this function would break if one of the other bbdev's were #defined.
No these are independent. By default they are all defined.
ok
Quoted 175 lines
Quoted 79 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 670
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +2
-0+ if ((get_init_device() == true) && + (!strcmp(info->drv.driver_name,
ACC100PF_DRIVER_NAME))) {app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4
-0+struct acc100_conf conf; +unsigned int i; + + printf("Configure ACC100 FEC Driver %s with defaultvalues\n",
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 9 lines
app/test-bbdev/test_bbdev_perf.c +9
-0+ info->drv.driver_name); + +/* clear default configuration before initialization */ +memset (&conf,0 ,sizeof (struct acc100_conf )); + +/* Always set in PF mode for built-in configuration */ + conf.pf_mode_en = true; +for (i =0 ; i <RTE_ACC100_NUM_VFS ; ++i) { + conf.arb_dl_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 684
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 685
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_4g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 686
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 687
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 688
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 689
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 690
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 691
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 692
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 693
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 694
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +5
-0+ } + + conf.input_pos_llr_1_bit = true; + conf.output_pos_llr_1_bit = true; + conf.num_vf_bundles =1 ;/**< Number of VF bundles to setup */
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ + conf.q_ul_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_4g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 703
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_ul_4g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_ul_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_4g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 707
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_dl_4g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_dl_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_ul_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_5g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 711
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_ul_5g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_ul_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_5g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 715
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_dl_5g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +6
-0+ conf.q_dl_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + +/* setup PF with configuration information */ + ret =acc100_configure (info->dev_name, &conf); + TEST_ASSERT_SUCCESS(ret, + "Failed to configure ACC100 PF for bbdev%s",
Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad, · line 725
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4
-0+ info->dev_name); +/* Let's refresh this now this is configured */ + } +rte_bbdev_info_get (dev_id, info);The other bbdev's do not call
rte_bbdev_info_get, can this be removed ?Actually it should be added outside for all versions post-configuraion. Thanks
Quoted 89 lines
Quoted 39 lines
app/test-bbdev/test_bbdev_perf.c +2
-0+#endif + nb_queues =RTE_MIN (rte_lcore_count (), info- drv.max_num_queues); nb_queues =RTE_MIN (nb_queues, (unsigned int )MAX_QUEUES );doc/guides/rel_notes/release_20_11.rst +5
-0@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added Intel ACC100 bbdev PMD.** + + Added a new ``acc100`` bbdev driver for the Intel\ |reg| ACC100 + accelerator also known as Mount Bryce. See the + :doc:`../bbdevs/acc100` BBDEV guide for more details on this new driver. Removed Items -------------drivers/baseband/acc100/meson.build +2
-0@@ -4,3 +4,5 @@ deps += ['bbdev', 'bus_vdev', 'ring', 'pci', 'bus_pci'] sources = files('rte_acc100_pmd.c') + +install_headers('rte_acc100_cfg.h')drivers/baseband/acc100/rte_acc100_cfg.h +0
-0drivers/baseband/acc100/rte_acc100_cfg.h struct acc100_conf { · line 96
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_cfg.h +6
-0@@ -89,6 +89,23 @@ struct acc100_conf {struct rte_arbitration_t arb_dl_5g[RTE_ACC100_NUM_VFS ]; }; +/** +* Configure a ACC100 device +* +* @param dev_name +* The name of the device. This is the short form of PCI BDF, e.g. 00:01.0. +* It can also be retrieved for a bbdev device from the dev_name field in the
Quoted 28 lines
drivers/baseband/acc100/rte_acc100_cfg.h +11
-0+* rte_bbdev_info structure returned by rte_bbdev_info_get(). +* @param conf +* Configuration to apply to ACC100 HW. +* +* @return +* Zero on success, negative value on failure. +*/ +__rte_experimental +int +acc100_configure (const char *dev_name,struct acc100_conf *conf); + #ifdef __cplusplus }#endif drivers/baseband/acc100/rte_acc100_pmd.c +5
-0@@ -85,6 +85,26 @@enum {UL_4G =0 ,UL_5G ,DL_4G ,DL_5G ,NUM_ACC }; +/* Return the accelerator enum for a Queue Group Index */ static +inline int accFromQgid (int qg_idx,const struct acc100_conf +*acc100_conf) { +int accQg[ACC100_NUM_QGRPS ]; +int NumQGroupsPerFn[NUM_ACC ];drivers/baseband/acc100/rte_acc100_pmd.c line 102
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+int acc, qgIdx, qgIndex =0 ; +for (qgIdx =0 ; qgIdx <ACC100_NUM_QGRPS ; qgIdx++) + accQg[qgIdx] =0 ; + NumQGroupsPerFn[UL_4G ] = acc100_conf->q_ul_4g.num_qgroups; + NumQGroupsPerFn[UL_5G ] = acc100_conf->q_ul_5g.num_qgroups; + NumQGroupsPerFn[DL_4G ] = acc100_conf->q_dl_4g.num_qgroups; + NumQGroupsPerFn[DL_5G ] = acc100_conf->q_dl_5g.num_qgroups; +for (acc =UL_4G ; acc <NUM_ACC ; acc++) +for (qgIdx =0 ; qgIdx < NumQGroupsPerFn[acc]; qgIdx++) + accQg[qgIndex++] = acc;This looks inefficient, is there a way this could be calculated without filling arrays to
Quoted 2 lines
Quoted 1 line
access 1 value ?
That is not time critical, and the same common code is run each time.
ok
Quoted 20 lines
Quoted 20 lines
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ acc = accQg[qg_idx]; +return acc; +} + /* Return the queue topology for a Queue Group Index */ staticinline void qtopFromAcc(struct
rte_q_topology_t**qtop, intacc_enum, @@ -113,6 +133,30 @@drivers/baseband/acc100/rte_acc100_pmd.c line 144
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0*qtop = p_qtop; } +/* Return the AQ depth for a Queue Group Index */ static inline int +aqDepth (int qg_idx,struct acc100_conf *acc100_conf) { +struct rte_q_topology_t *q_top =NULL ; +int acc_enum =accFromQgid (qg_idx, acc100_conf); +qtopFromAcc (&q_top, acc_enum, acc100_conf); +if (unlikely (q_top ==NULL )) +return 0 ;This error is not handled well be the callers.
Quoted 2 lines
Quoted 1 line
aqNum is similar.
This fails in a consistent basis, by having not queue available and handling this as the default case.
ok
Quoted 28 lines
Quoted 20 lines
Quoted 16 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+return q_top->aq_depth_log2; +} + +/* Return the AQ depth for a Queue Group Index */ static inline int +aqNum (int qg_idx,struct acc100_conf *acc100_conf) { +struct rte_q_topology_t *q_top =NULL ; +int acc_enum =accFromQgid (qg_idx, acc100_conf); +qtopFromAcc (&q_top, acc_enum, acc100_conf); +if (unlikely (q_top ==NULL )) +return 0 ; +return q_top->num_aqs_per_groups; +} +static void initQTop(struct acc100_conf *acc100_conf) { @@ -4177,3 +4221,464Quoted 3 lines
@@ static int
acc100_pci_remove(struct rte_pci_device *pci_dev)RTE_PMD_REGISTER_PCI_TABLE(ACC100PF_DRIVER_NAME, pci_id_acc100_pf_map);RTE_PMD_REGISTER_PCI(ACC100VF_DRIVER_NAME,
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4227
Quoted 7 lines
acc100_pci_vf_driver);RTE_PMD_REGISTER_PCI_TABLE(ACC100VF_DRIVER_NAME, pci_id_acc100_vf_map);drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ +/* +* Implementation to fix the power on status of some 5GUL engines +* This requires DMA permission if ported outside DPDK This sounds like a workaround, can more detail be added here ?
Quoted 5 lines
There are comments through the code I believe:
- /* Detect engines in undefined state */
- /* Force each engine which is in unspecified state */
- /* Reset LDPC Cores */
- /* Check engine power-on status again */ Do you believe this is not explicit enough. Power-on status may be in an undefined state hence this engine are avtivate with dummy payload to make sure they are in a predicable state once configuration is done.
Yes, not explicit enough. They do not say it is a workaround so someone else would not know that
this is needed or is likely needs adjusting in the future. Maybe change
/* Check engine power-on status again */ to
/*
* Power-on status may be in an undefined state.
* Active this engine with a dummy payload to make sure the state is defined.
*/
Tom
Quoted 516 lines
Quoted 162 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 12 lines
+ */
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+static void +poweron_cleanup (struct rte_bbdev *bbdev,struct acc100_device *d, +struct acc100_conf *conf) +{ +int i, template_idx, qg_idx; +uint32_t address, status, payload; +printf ("Need to clear power-on 5GUL status in internal memory\n" ); +/* Reset LDPC Cores */ +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_HI);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+usleep (LONG_WAIT ); +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_LO);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+usleep (LONG_WAIT ); +/* Prepare dummy workload */ +alloc_2x64mb_sw_rings_mem (bbdev, d,0 ); +/* Set base addresses */ +uint32_t phys_high = (uint32_t )(d->sw_rings_phys >>32 ); +uint32_t phys_low = (uint32_t )(d->sw_rings_phys & + ~(ACC100_SIZE_64MBYTE -1 )); + acc100_reg_write(d, HWPfDmaFec5GulDescBaseHiRegVf,
phys_high);Quoted 34 lines
drivers/baseband/acc100/rte_acc100_pmd.c +34
-0+acc100_reg_write (d, HWPfDmaFec5GulDescBaseLoRegVf, phys_low); + +/* Descriptor for a dummy 5GUL code block processing*/ +union acc100_dma_desc *desc =NULL ; + desc = d->sw_rings; + desc->req.data_ptrs[0 ].address = d->sw_rings_phys + +ACC100_DESC_FCW_OFFSET ; + desc->req.data_ptrs[0 ].blen =ACC100_FCW_LD_BLEN ; + desc->req.data_ptrs[0 ].blkid =ACC100_DMA_BLKID_FCW ; + desc->req.data_ptrs[0 ].last =0 ; + desc->req.data_ptrs[0 ].dma_ext =0 ; + desc->req.data_ptrs[1 ].address = d->sw_rings_phys +512 ; + desc->req.data_ptrs[1 ].blkid =ACC100_DMA_BLKID_IN ; + desc->req.data_ptrs[1 ].last =1 ; + desc->req.data_ptrs[1 ].dma_ext =0 ; + desc->req.data_ptrs[1 ].blen =44 ; + desc->req.data_ptrs[2 ].address = d->sw_rings_phys +1024 ; + desc->req.data_ptrs[2 ].blkid =ACC100_DMA_BLKID_OUT_ENC ; + desc->req.data_ptrs[2 ].last =1 ; + desc->req.data_ptrs[2 ].dma_ext =0 ; + desc->req.data_ptrs[2 ].blen =5 ; +/* Dummy FCW */ + desc->req.fcw_ld.FCWversion =ACC100_FCW_VER ; + desc->req.fcw_ld.qm =1 ; + desc->req.fcw_ld.nfiller =30 ; + desc->req.fcw_ld.BG =2 -1 ; + desc->req.fcw_ld.Zc =7 ; + desc->req.fcw_ld.ncb =350 ; + desc->req.fcw_ld.rm_e =4 ; + desc->req.fcw_ld.itmax =10 ; + desc->req.fcw_ld.gain_i =1 ; + desc->req.fcw_ld.gain_h =1 ; + +int engines_to_restart[SIG_UL_5G_LAST +1 ] = {0 };drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+int num_failed_engine =0 ; +/* Detect engines in undefined state */ +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { +/* Check engine power-on status */ + address = HwPfFecUl5gIbDebugReg + +ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; +if (status ==0 ) { + engines_to_restart[num_failed_engine] =
template_idx;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ num_failed_engine++; + } + } + +int numQqsAcc = conf->q_ul_5g.num_qgroups; +int numQgs = conf->q_ul_5g.num_qgroups; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ payload |= (1 << qg_idx); +/* Force each engine which is in unspecified state */ +for (i =0 ; i < num_failed_engine; i++) { +int failed_engine = engines_to_restart[i]; +printf ("Force engine %d\n" , failed_engine); + for (template_idx = SIG_UL_5G; template_idx <=
SIG_UL_5G_LAST;Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +14
-0+ template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (template_idx == failed_engine) +acc100_reg_write (d, address, payload); +else +acc100_reg_write (d, address,0 ); + } +/* Reset descriptor header */ + desc->req.word0 =ACC100_DMA_DESC_TYPE ; + desc->req.word1 =0 ; + desc->req.word2 =0 ; + desc->req.word3 =0 ; + desc->req.numCBs =1 ;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ desc->req.m2dlen =2 ; + desc->req.d2mlen =1 ; +/* Enqueue the code block for processing */ +union acc100_enqueue_reg_fmt enq_req; + enq_req.val =0 ; + enq_req.addr_offset =ACC100_DESC_OFFSET ; + enq_req.num_elem =1 ; + enq_req.req_elem_addr =0 ; +rte_wmb (); + acc100_reg_write(d, HWPfQmgrIngressAq + 0x100,enq_req.val);
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+usleep (LONG_WAIT *100 ); +if (desc->req.word0 !=2 ) + printf("DMA Response %#"PRIx32"\n", desc-req.word0);
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ } + +/* Reset LDPC Cores */ +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_HI);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+usleep (LONG_WAIT ); +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_LO);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+usleep (LONG_WAIT ); + acc100_reg_write(d, HWPfHi5GHardResetReg,
ACC100_RESET_HARD);Quoted 18 lines
drivers/baseband/acc100/rte_acc100_pmd.c +18
-0+usleep (LONG_WAIT ); +int numEngines =0 ; +/* Check engine power-on status again */ +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { + address = HwPfFecUl5gIbDebugReg + +ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (status ==1 ) { +acc100_reg_write (d, address, payload); + numEngines++; + }else +acc100_reg_write (d, address,0 ); + } +printf ("Number of 5GUL engines %d\n" , numEngines); +drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4377
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+if (d->sw_rings_base !=NULL ) +rte_free (d->sw_rings_base); +usleep (LONG_WAIT ); +} + +/* Initial configuration of a ACC100 device prior to running +configure() */ int acc100_configure (const char *dev_name,struct +acc100_conf *conf) { +rte_bbdev_log (INFO ,"acc100_configure" ); +uint32_t payload, address, status;maybe value or data would be a better variable name than payload.
Quoted 1 line
would mean changing
acc100_reg_writetransparent to me, but can change given DPDK uses term value.
Quoted 23 lines
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+int qg_idx, template_idx, vf_idx, acc, i; +struct rte_bbdev *bbdev =rte_bbdev_get_named_dev (dev_name); + +/* Compile time checks */ +RTE_BUILD_BUG_ON (sizeof (struct acc100_dma_req_desc ) !=256 ); +RTE_BUILD_BUG_ON (sizeof (union acc100_dma_desc ) !=256 ); +RTE_BUILD_BUG_ON (sizeof (struct acc100_fcw_td ) !=24 ); +RTE_BUILD_BUG_ON (sizeof (struct acc100_fcw_te ) !=32 ); + +if (bbdev ==NULL ) { + rte_bbdev_log(ERR, + "Invalid dev_name (%s), or device is not yet initialised",drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ dev_name); +return -ENODEV ; + } +struct acc100_device *d = bbdev->data->dev_private; + +/* Store configuration */ +rte_memcpy (&d->acc100_conf, conf,sizeof (d->acc100_conf)); + +/* PCIe Bridge configuration */ + acc100_reg_write(d, HwPfPcieGpexBridgeControl,
ACC100_CFG_PCI_BRIDGE);Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4400
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+for (i =1 ; i <17 ; i++)17 is a magic number, use a #define
this is a general issue.
These are only used once but still agreed.
Quoted 140 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ acc100_reg_write(d, +HwPfPcieGpexAxiAddrMappingWindowPexBaseHigh
Quoted 58 lines
drivers/baseband/acc100/rte_acc100_pmd.c +58
-0+ + i * 16, 0); + +/* PCIe Link Trainiing and Status State Machine */ +acc100_reg_write (d, HwPfPcieGpexLtssmStateCntrl,0xDFC00000 ); + +/* Prevent blocking AXI read on BRESP for AXI Write */ + address = HwPfPcieGpexAxiPioControl; + payload =ACC100_CFG_PCI_AXI ; +acc100_reg_write (d, address, payload); + +/* 5GDL PLL phase shift */ +acc100_reg_write (d, HWPfChaDl5gPllPhshft0,0x1 ); + +/* Explicitly releasing AXI as this may be stopped after PF FLR/BME */ + address = HWPfDmaAxiControl; + payload =1 ; +acc100_reg_write (d, address, payload); + +/* DDR Configuration */ + address = HWPfDdrBcTim6; + payload =acc100_reg_read (d, address); + payload &=0xFFFFFFFB ;/* Bit 2 */ #ifdef ACC100_DDR_ECC_ENABLE + payload |=0x4 ; +#endif +acc100_reg_write (d, address, payload); + address = HWPfDdrPhyDqsCountNum; +#ifdef ACC100_DDR_ECC_ENABLE + payload =9 ; +#else + payload =8 ; +#endif +acc100_reg_write (d, address, payload); + +/* Set default descriptor signature */ + address = HWPfDmaDescriptorSignatuture; + payload =0 ; +acc100_reg_write (d, address, payload); + +/* Enable the Error Detection in DMA */ + payload =ACC100_CFG_DMA_ERROR ; + address = HWPfDmaErrorDetectionEn; +acc100_reg_write (d, address, payload); + +/* AXI Cache configuration */ + payload =ACC100_CFG_AXI_CACHE ; + address = HWPfDmaAxcacheReg; +acc100_reg_write (d, address, payload); + +/* Default DMA Configuration (Qmgr Enabled) */ + address = HWPfDmaConfig0Reg; + payload =0 ; +acc100_reg_write (d, address, payload); + address = HWPfDmaQmanen; + payload =0 ; +acc100_reg_write (d, address, payload); + +/* Default RLIM/ALEN configuration */ + address = HWPfDmaConfig1Reg;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload = (1 <<31 ) + (23 <<8 ) + (1 <<6 ) +7 ; +acc100_reg_write (d, address, payload); + +/* Configure DMA Qmanager addresses */ + address = HWPfDmaQmgrAddrReg; + payload = HWPfQmgrEgressQueuesTemplate; +acc100_reg_write (d, address, payload); + +/* ===== Qmgr Configuration ===== */ +/* Configuration of the AQueue Depth QMGR_GRP_0_DEPTH_LOG2 for UL */
Quoted 32 lines
drivers/baseband/acc100/rte_acc100_pmd.c +32
-0+int totalQgs = conf->q_ul_4g.num_qgroups + + conf->q_ul_5g.num_qgroups + + conf->q_dl_4g.num_qgroups + + conf->q_dl_5g.num_qgroups; +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { + address = HWPfQmgrDepthLog2Grp + +BYTES_IN_WORD * qg_idx; + payload =aqDepth (qg_idx, conf); +acc100_reg_write (d, address, payload); + address = HWPfQmgrTholdGrp + +BYTES_IN_WORD * qg_idx; + payload = (1 <<16 ) + (1 << (aqDepth (qg_idx, conf) -1 )); +acc100_reg_write (d, address, payload); + } + +/* Template Priority in incremental order */ +for (template_idx =0 ; template_idx <ACC100_NUM_TMPL ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg0Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_0 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg1Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_1 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg2indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_2 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg3Indx + +BYTES_IN_WORD * (template_idx %8 );drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload =TMPL_PRI_3 ; +acc100_reg_write (d, address, payload); + } + + address = HWPfQmgrGrpPriority; + payload =ACC100_CFG_QMGR_HI_P ; +acc100_reg_write (d, address, payload); + +/* Template Configuration */ + for (template_idx = 0; template_idx < ACC100_NUM_TMPL;template_idx++) {
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload =0 ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +acc100_reg_write (d, address, payload); + } +/* 4GUL */ +int numQgs = conf->q_ul_4g.num_qgroups; +int numQqsAcc =0 ; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_UL_4G ; template_idx <=SIG_UL_4G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx; +acc100_reg_write (d, address, payload); + } +/* 5GUL */ + numQqsAcc += numQgs; + numQgs = conf->q_ul_5g.num_qgroups; + payload =0 ; +int numEngines =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
Quoted 16 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { +/* Check engine power-on status */ + address = HwPfFecUl5gIbDebugReg +drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4551
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (status ==1 ) { +acc100_reg_write (d, address, payload); + numEngines++; + }else +acc100_reg_write (d, address,0 ); +#if RTE_ACC100_SINGLE_FEC ==1 #if should be at start of line
ok
Quoted 122 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c +9
-0+ payload =0 ; +#endif + } +printf ("Number of 5GUL engines %d\n" , numEngines); +/* 4GDL */ + numQqsAcc += numQgs; + numQgs = conf->q_dl_4g.num_qgroups; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_DL_4G ; template_idx <=SIG_DL_4G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+acc100_reg_write (d, address, payload); +#if RTE_ACC100_SINGLE_FEC ==1 + payload =0 ; +#endif + } +/* 5GDL */ + numQqsAcc += numQgs; + numQgs = conf->q_dl_5g.num_qgroups; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
Quoted 52 lines
drivers/baseband/acc100/rte_acc100_pmd.c +52
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_DL_5G ; template_idx <=SIG_DL_5G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx; +acc100_reg_write (d, address, payload); +#if RTE_ACC100_SINGLE_FEC ==1 + payload =0 ; +#endif + } + +/* Queue Group Function mapping */ +int qman_func_id[5 ] = {0 ,2 ,1 ,3 ,4 }; + address = HWPfQmgrGrpFunction0; + payload =0 ; +for (qg_idx =0 ; qg_idx <8 ; qg_idx++) { + acc =accFromQgid (qg_idx, conf); + payload |= qman_func_id[acc]<<(qg_idx *4 ); + } +acc100_reg_write (d, address, payload); + +/* Configuration of the Arbitration QGroup depth to 1 */ +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { + address = HWPfQmgrArbQDepthGrp + +BYTES_IN_WORD * qg_idx; + payload =0 ; +acc100_reg_write (d, address, payload); + } + +/* Enabling AQueues through the Queue hierarchy*/ +for (vf_idx =0 ; vf_idx <ACC100_NUM_VFS ; vf_idx++) { +for (qg_idx =0 ; qg_idx <ACC100_NUM_QGRPS ; qg_idx++) { + payload =0 ; +if (vf_idx < conf->num_vf_bundles && + qg_idx < totalQgs) + payload = (1 <<aqNum (qg_idx, conf)) -1 ; + address = HWPfQmgrAqEnableVf + + vf_idx *BYTES_IN_WORD ; + payload += (qg_idx <<16 ); +acc100_reg_write (d, address, payload); + } + } + +/* This pointer to ARAM (256kB) is shifted by 2 (4B per register) */ +uint32_t aram_address =0 ; +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { +for (vf_idx =0 ; vf_idx < conf->num_vf_bundles; vf_idx++) { + address = HWPfQmgrVfBaseAddr + vf_idx + *BYTES_IN_WORD + qg_idx + *BYTES_IN_WORD *64 ; + payload = aram_address; +acc100_reg_write (d, address, payload);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+/* Offset ARAM Address for next memory bank +* - increment of 4B +*/ + aram_address +=aqNum (qg_idx, conf) * + (1 <<aqDepth (qg_idx, conf)); + } + } + +if (aram_address >WORDS_IN_ARAM_SIZE ) { + rte_bbdev_log(ERR, "ARAM Configuration not fitting %d%d\n",
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 32 lines
drivers/baseband/acc100/rte_acc100_pmd.c +32
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*/
Quoted 9 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Is sleep needed here ? the
reg_writehas one.30 lines not shown · raw message
Parts of this message are not shown here. View the raw message.
Re: [dpdk-dev] [PATCH v9 10/10] baseband/acc100: add configure function
Hi Tom,
Quoted 306 lines
From: Tom Rix <[email protected]>
Quoted 45 lines · Nicolas
Hi Tom,
Quoted 43 lines
From: Tom Rix <[email protected]>
Quoted 11 lines · Nicolas Chautru
Add configure function to configure the PF from within the bbdev-test itself without external application configuration the device.
Signed-off-by Nicolas Chautru <[email protected]>Acked-by Liu Tianjiao <[email protected]>--- app/test-bbdev/test_bbdev_perf.c | 72 +++ doc/guides/rel_notes/release_20_11.rst | 5 + drivers/baseband/acc100/meson.build | 2 + drivers/baseband/acc100/rte_acc100_cfg.h | 17 + drivers/baseband/acc100/rte_acc100_pmd.c | 505+++++++++++++++++++++
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct
Quoted 28 lines
.../acc100/rte_pmd_bbdev_acc100_version.map | 7 + 6 files changed, 608 insertions(+)app/test-bbdev/test_bbdev_perf.c +12
-0@@ -52,6 +52,18 @@#define FLR_5G_TIMEOUT 610#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 +#include <rte_acc100_cfg.h> +#define ACC100PF_DRIVER_NAME ("intel_acc100_pf") +#define ACC100VF_DRIVER_NAME ("intel_acc100_vf") +#define ACC100_QMGR_NUM_AQS 16 +#define ACC100_QMGR_NUM_QGS 2 +#define ACC100_QMGR_AQ_DEPTH 5 +#define ACC100_QMGR_INVALID_IDX -1 +#define ACC100_QMGR_RR 1 +#define ACC100_QOS_GBR 0 +#endif +#define OPS_CACHE_SIZE 256U#define OPS_POOL_SIZE_MIN 511U/* 0.5K per queue */ @@ -653,6 +665,66 @@ typedef int (test_case_function)(struct
active_device*ad,Quoted 7 lines
Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad, · line 668
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1
-0info->dev_name); }#endif +#ifdef RTE_LIBRTE_PMD_BBDEV_ACC100 seems like this function would break if one of the other bbdev's were #defined.
No these are independent. By default they are all defined.
ok
Quoted 84 lines
Quoted 79 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 670
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +2
-0+ if ((get_init_device() == true) && + (!strcmp(info->drv.driver_name,
ACC100PF_DRIVER_NAME))) {app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4
-0+struct acc100_conf conf; +unsigned int i; + + printf("Configure ACC100 FEC Driver %s with defaultvalues\n",
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 9 lines
app/test-bbdev/test_bbdev_perf.c +9
-0+ info->drv.driver_name); + +/* clear default configuration before initialization */ +memset (&conf,0 ,sizeof (struct acc100_conf )); + +/* Always set in PF mode for built-in configuration */ + conf.pf_mode_en = true; +for (i =0 ; i <RTE_ACC100_NUM_VFS ; ++i) { + conf.arb_dl_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 684
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 685
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_4g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 686
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 687
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 688
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_4g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 689
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 690
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 691
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_dl_5g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 692
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 693
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].gbr_threshold1 =
ACC100_QOS_GBR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 694
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.arb_ul_5g[i].round_robin_weight =
ACC100_QMGR_RR;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +5
-0+ } + + conf.input_pos_llr_1_bit = true; + conf.output_pos_llr_1_bit = true; + conf.num_vf_bundles =1 ;/**< Number of VF bundles to setup */
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ + conf.q_ul_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_4g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 703
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_ul_4g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_ul_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_4g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_4g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 707
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_dl_4g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_dl_4g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_ul_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_ul_5g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 711
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_ul_5g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3
-0+ conf.q_ul_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + conf.q_dl_5g.num_qgroups =ACC100_QMGR_NUM_QGS ; + conf.q_dl_5g.first_qgroup_index =
ACC100_QMGR_INVALID_IDX;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct · line 715
Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1
-0+ conf.q_dl_5g.num_aqs_per_groups =
ACC100_QMGR_NUM_AQS;app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad,
Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +6
-0+ conf.q_dl_5g.aq_depth_log2 =ACC100_QMGR_AQ_DEPTH ; + +/* setup PF with configuration information */ + ret =acc100_configure (info->dev_name, &conf); + TEST_ASSERT_SUCCESS(ret, + "Failed to configure ACC100 PF for bbdev%s",
Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c typedef int (test_case_function)(struct active_device *ad, · line 725
Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4
-0+ info->dev_name); +/* Let's refresh this now this is configured */ + } +rte_bbdev_info_get (dev_id, info);The other bbdev's do not call
rte_bbdev_info_get, can this be removed ?Quoted 6 lines
Actually it should be added outside for all versions post-configuraion. Thanks
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c
Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +2
-0+#endif + nb_queues = RTE_MIN(rte_lcore_count(), info-drv.max_num_queues);
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +0
-0nb_queues =RTE_MIN (nb_queues, (unsigned int )MAX_QUEUES );doc/guides/rel_notes/release_20_11.rst +0
-0@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. =======================================================Quoted 5 lines
Quoted 5 lines
doc/guides/rel_notes/release_20_11.rst New Features · line 62
Quoted 5 lines
doc/guides/rel_notes/release_20_11.rst +5
-0+* **Added Intel ACC100 bbdev PMD.** + + Added a new ``acc100`` bbdev driver for the Intel\ |reg| ACC100 + accelerator also known as Mount Bryce. See the + :doc:`../bbdevs/acc100` BBDEV guide for more details on this newdriver.
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
doc/guides/rel_notes/release_20_11.rst +0
-0Removed Items -------------drivers/baseband/acc100/meson.build +2
-0@@ -4,3 +4,5 @@ deps += ['bbdev', 'bus_vdev', 'ring', 'pci', 'bus_pci'] sources = files('rte_acc100_pmd.c') + +install_headers('rte_acc100_cfg.h')drivers/baseband/acc100/rte_acc100_cfg.h +0
-0@@ -89,6 +89,23 @@ struct acc100_conf {struct rte_arbitration_t arb_dl_5g[RTE_ACC100_NUM_VFS ]; };Quoted 5 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_cfg.h struct acc100_conf {
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_cfg.h +5
-0+/** +* Configure a ACC100 device +* +* @param dev_name +* The name of the device. This is the short form of PCI BDF, e.g. 00:01.0.
Quoted 1 line
Quoted 1 line
drivers/baseband/acc100/rte_acc100_cfg.h struct acc100_conf { · line 96
Quoted 1 line
drivers/baseband/acc100/rte_acc100_cfg.h +1
-0+* It can also be retrieved for a bbdev device from the dev_name field in
Quoted 42 lines
Quoted 42 lines
the
Quoted 28 lines
drivers/baseband/acc100/rte_acc100_cfg.h +11
-0+* rte_bbdev_info structure returned by rte_bbdev_info_get(). +* @param conf +* Configuration to apply to ACC100 HW. +* +* @return +* Zero on success, negative value on failure. +*/ +__rte_experimental +int +acc100_configure (const char *dev_name,struct acc100_conf *conf); + #ifdef __cplusplus }#endif drivers/baseband/acc100/rte_acc100_pmd.c +5
-0@@ -85,6 +85,26 @@enum {UL_4G =0 ,UL_5G ,DL_4G ,DL_5G ,NUM_ACC }; +/* Return the accelerator enum for a Queue Group Index */ static +inline int accFromQgid (int qg_idx,const struct acc100_conf +*acc100_conf) { +int accQg[ACC100_NUM_QGRPS ]; +int NumQGroupsPerFn[NUM_ACC ];drivers/baseband/acc100/rte_acc100_pmd.c line 102
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+int acc, qgIdx, qgIndex =0 ; +for (qgIdx =0 ; qgIdx <ACC100_NUM_QGRPS ; qgIdx++) + accQg[qgIdx] =0 ; + NumQGroupsPerFn[UL_4G ] = acc100_conf->q_ul_4g.num_qgroups; + NumQGroupsPerFn[UL_5G ] = acc100_conf->q_ul_5g.num_qgroups; + NumQGroupsPerFn[DL_4G ] = acc100_conf->q_dl_4g.num_qgroups; + NumQGroupsPerFn[DL_5G ] = acc100_conf->q_dl_5g.num_qgroups; +for (acc =UL_4G ; acc <NUM_ACC ; acc++) +for (qgIdx =0 ; qgIdx < NumQGroupsPerFn[acc]; qgIdx++) + accQg[qgIndex++] = acc;This looks inefficient, is there a way this could be calculated without filling arrays to
Quoted 2 lines
Quoted 1 line
access 1 value ?
That is not time critical, and the same common code is run each time.
ok
Quoted 20 lines
Quoted 20 lines
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ acc = accQg[qg_idx]; +return acc; +} + /* Return the queue topology for a Queue Group Index */ staticinline void qtopFromAcc(struct
rte_q_topology_t**qtop, intacc_enum, @@ -113,6 +133,30 @@drivers/baseband/acc100/rte_acc100_pmd.c line 144
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +7
-0*qtop = p_qtop; } +/* Return the AQ depth for a Queue Group Index */ static inline int +aqDepth (int qg_idx,struct acc100_conf *acc100_conf) { +struct rte_q_topology_t *q_top =NULL ; +int acc_enum =accFromQgid (qg_idx, acc100_conf); +qtopFromAcc (&q_top, acc_enum, acc100_conf); +if (unlikely (q_top ==NULL )) +return 0 ;This error is not handled well be the callers.
Quoted 2 lines
Quoted 1 line
aqNum is similar.
This fails in a consistent basis, by having not queue available and handling
this as the default case.
okQuoted 28 lines
Quoted 20 lines
Quoted 16 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+return q_top->aq_depth_log2; +} + +/* Return the AQ depth for a Queue Group Index */ static inline int +aqNum (int qg_idx,struct acc100_conf *acc100_conf) { +struct rte_q_topology_t *q_top =NULL ; +int acc_enum =accFromQgid (qg_idx, acc100_conf); +qtopFromAcc (&q_top, acc_enum, acc100_conf); +if (unlikely (q_top ==NULL )) +return 0 ; +return q_top->num_aqs_per_groups; +} +static void initQTop(struct acc100_conf *acc100_conf) { @@ -4177,3 +4221,464Quoted 3 lines
@@ static int
acc100_pci_remove(struct rte_pci_device *pci_dev)RTE_PMD_REGISTER_PCI_TABLE(ACC100PF_DRIVER_NAME, pci_id_acc100_pf_map);RTE_PMD_REGISTER_PCI(ACC100VF_DRIVER_NAME,
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4227
Quoted 7 lines
acc100_pci_vf_driver);RTE_PMD_REGISTER_PCI_TABLE(ACC100VF_DRIVER_NAME, pci_id_acc100_vf_map);drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+ +/* +* Implementation to fix the power on status of some 5GUL engines +* This requires DMA permission if ported outside DPDK This sounds like a workaround, can more detail be added here ?
Quoted 5 lines
There are comments through the code I believe:
- /* Detect engines in undefined state */
- /* Force each engine which is in unspecified state */
- /* Reset LDPC Cores */
- /* Check engine power-on status again */ Do you believe this is notexplicit enough. Power-on status may be in an undefined state hence this engine are avtivate with dummy payload to make sure they are in a predicable state once configuration is done.
Yes, not explicit enough. They do not say it is a workaround so someone else would not know that
this is needed or is likely needs adjusting in the future. Maybe change
/* Check engine power-on status again */ to
Quoted 9 lines
/*
* Power-on status may be in an undefined state.
* Active this engine with a dummy payload to make sure the state is defined.
*/
OK I will add a bit more in comments. Thanks
Quoted 518 lines
Tom
Quoted 516 lines
Quoted 162 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 12 lines
+ */
drivers/baseband/acc100/rte_acc100_pmd.c +11
-0+static void +poweron_cleanup (struct rte_bbdev *bbdev,struct acc100_device *d, +struct acc100_conf *conf) +{ +int i, template_idx, qg_idx; +uint32_t address, status, payload; +printf ("Need to clear power-on 5GUL status in internal memory\n" ); +/* Reset LDPC Cores */ +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_HI);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+usleep (LONG_WAIT ); +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_LO);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+usleep (LONG_WAIT ); +/* Prepare dummy workload */ +alloc_2x64mb_sw_rings_mem (bbdev, d,0 ); +/* Set base addresses */ +uint32_t phys_high = (uint32_t )(d->sw_rings_phys >>32 ); +uint32_t phys_low = (uint32_t )(d->sw_rings_phys & + ~(ACC100_SIZE_64MBYTE -1 )); + acc100_reg_write(d, HWPfDmaFec5GulDescBaseHiRegVf,
phys_high);Quoted 34 lines
drivers/baseband/acc100/rte_acc100_pmd.c +34
-0+acc100_reg_write (d, HWPfDmaFec5GulDescBaseLoRegVf, phys_low); + +/* Descriptor for a dummy 5GUL code block processing*/ +union acc100_dma_desc *desc =NULL ; + desc = d->sw_rings; + desc->req.data_ptrs[0 ].address = d->sw_rings_phys + +ACC100_DESC_FCW_OFFSET ; + desc->req.data_ptrs[0 ].blen =ACC100_FCW_LD_BLEN ; + desc->req.data_ptrs[0 ].blkid =ACC100_DMA_BLKID_FCW ; + desc->req.data_ptrs[0 ].last =0 ; + desc->req.data_ptrs[0 ].dma_ext =0 ; + desc->req.data_ptrs[1 ].address = d->sw_rings_phys +512 ; + desc->req.data_ptrs[1 ].blkid =ACC100_DMA_BLKID_IN ; + desc->req.data_ptrs[1 ].last =1 ; + desc->req.data_ptrs[1 ].dma_ext =0 ; + desc->req.data_ptrs[1 ].blen =44 ; + desc->req.data_ptrs[2 ].address = d->sw_rings_phys +1024 ; + desc->req.data_ptrs[2 ].blkid =ACC100_DMA_BLKID_OUT_ENC ; + desc->req.data_ptrs[2 ].last =1 ; + desc->req.data_ptrs[2 ].dma_ext =0 ; + desc->req.data_ptrs[2 ].blen =5 ; +/* Dummy FCW */ + desc->req.fcw_ld.FCWversion =ACC100_FCW_VER ; + desc->req.fcw_ld.qm =1 ; + desc->req.fcw_ld.nfiller =30 ; + desc->req.fcw_ld.BG =2 -1 ; + desc->req.fcw_ld.Zc =7 ; + desc->req.fcw_ld.ncb =350 ; + desc->req.fcw_ld.rm_e =4 ; + desc->req.fcw_ld.itmax =10 ; + desc->req.fcw_ld.gain_i =1 ; + desc->req.fcw_ld.gain_h =1 ; + +int engines_to_restart[SIG_UL_5G_LAST +1 ] = {0 };drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+int num_failed_engine =0 ; +/* Detect engines in undefined state */ +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { +/* Check engine power-on status */ + address = HwPfFecUl5gIbDebugReg + +ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; +if (status ==0 ) { + engines_to_restart[num_failed_engine] =
template_idx;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 8 lines
drivers/baseband/acc100/rte_acc100_pmd.c +8
-0+ num_failed_engine++; + } + } + +int numQqsAcc = conf->q_ul_5g.num_qgroups; +int numQgs = conf->q_ul_5g.num_qgroups; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 6 lines
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ payload |= (1 << qg_idx); +/* Force each engine which is in unspecified state */ +for (i =0 ; i < num_failed_engine; i++) { +int failed_engine = engines_to_restart[i]; +printf ("Force engine %d\n" , failed_engine); + for (template_idx = SIG_UL_5G; template_idx <=
SIG_UL_5G_LAST;Quoted 14 lines
drivers/baseband/acc100/rte_acc100_pmd.c +14
-0+ template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (template_idx == failed_engine) +acc100_reg_write (d, address, payload); +else +acc100_reg_write (d, address,0 ); + } +/* Reset descriptor header */ + desc->req.word0 =ACC100_DMA_DESC_TYPE ; + desc->req.word1 =0 ; + desc->req.word2 =0 ; + desc->req.word3 =0 ; + desc->req.numCBs =1 ;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ desc->req.m2dlen =2 ; + desc->req.d2mlen =1 ; +/* Enqueue the code block for processing */ +union acc100_enqueue_reg_fmt enq_req; + enq_req.val =0 ; + enq_req.addr_offset =ACC100_DESC_OFFSET ; + enq_req.num_elem =1 ; + enq_req.req_elem_addr =0 ; +rte_wmb (); + acc100_reg_write(d, HWPfQmgrIngressAq + 0x100,enq_req.val);
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +3
-0+usleep (LONG_WAIT *100 ); +if (desc->req.word0 !=2 ) + printf("DMA Response %#"PRIx32"\n", desc-req.word0);
drivers/baseband/acc100/rte_acc100_pmd.c +6
-0+ } + +/* Reset LDPC Cores */ +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_HI);drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c +4
-0+usleep (LONG_WAIT ); +for (i =0 ; i <ACC100_ENGINES_MAX ; i++) + acc100_reg_write(d, HWPfFecUl5gCntrlReg + + ACC100_ENGINE_OFFSET * i,
ACC100_RESET_LO);drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+usleep (LONG_WAIT ); + acc100_reg_write(d, HWPfHi5GHardResetReg,
ACC100_RESET_HARD);Quoted 18 lines
drivers/baseband/acc100/rte_acc100_pmd.c +18
-0+usleep (LONG_WAIT ); +int numEngines =0 ; +/* Check engine power-on status again */ +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { + address = HwPfFecUl5gIbDebugReg + +ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (status ==1 ) { +acc100_reg_write (d, address, payload); + numEngines++; + }else +acc100_reg_write (d, address,0 ); + } +printf ("Number of 5GUL engines %d\n" , numEngines); +drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4377
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+if (d->sw_rings_base !=NULL ) +rte_free (d->sw_rings_base); +usleep (LONG_WAIT ); +} + +/* Initial configuration of a ACC100 device prior to running +configure() */ int acc100_configure (const char *dev_name,struct +acc100_conf *conf) { +rte_bbdev_log (INFO ,"acc100_configure" ); +uint32_t payload, address, status;maybe value or data would be a better variable name than payload.
Quoted 1 line
would mean changing
acc100_reg_writetransparent to me, but can change given DPDK uses term value.
Quoted 23 lines
Quoted 12 lines
drivers/baseband/acc100/rte_acc100_pmd.c +12
-0+int qg_idx, template_idx, vf_idx, acc, i; +struct rte_bbdev *bbdev =rte_bbdev_get_named_dev (dev_name); + +/* Compile time checks */ +RTE_BUILD_BUG_ON (sizeof (struct acc100_dma_req_desc ) !=256 ); +RTE_BUILD_BUG_ON (sizeof (union acc100_dma_desc ) !=256 ); +RTE_BUILD_BUG_ON (sizeof (struct acc100_fcw_td ) !=24 ); +RTE_BUILD_BUG_ON (sizeof (struct acc100_fcw_te ) !=32 ); + +if (bbdev ==NULL ) { + rte_bbdev_log(ERR, + "Invalid dev_name (%s), or device is not yet initialised",drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ dev_name); +return -ENODEV ; + } +struct acc100_device *d = bbdev->data->dev_private; + +/* Store configuration */ +rte_memcpy (&d->acc100_conf, conf,sizeof (d->acc100_conf)); + +/* PCIe Bridge configuration */ + acc100_reg_write(d, HwPfPcieGpexBridgeControl,
ACC100_CFG_PCI_BRIDGE);Quoted 4 lines
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4400
Quoted 1 line
drivers/baseband/acc100/rte_acc100_pmd.c +1
-0+for (i =1 ; i <17 ; i++)17 is a magic number, use a #define
this is a general issue.
These are only used once but still agreed.
Quoted 140 lines
drivers/baseband/acc100/rte_acc100_pmd.c
Quoted 2 lines
drivers/baseband/acc100/rte_acc100_pmd.c +2
-0+ acc100_reg_write(d, +HwPfPcieGpexAxiAddrMappingWindowPexBaseHigh
Quoted 58 lines
drivers/baseband/acc100/rte_acc100_pmd.c +58
-0+ + i * 16, 0); + +/* PCIe Link Trainiing and Status State Machine */ +acc100_reg_write (d, HwPfPcieGpexLtssmStateCntrl,0xDFC00000 ); + +/* Prevent blocking AXI read on BRESP for AXI Write */ + address = HwPfPcieGpexAxiPioControl; + payload =ACC100_CFG_PCI_AXI ; +acc100_reg_write (d, address, payload); + +/* 5GDL PLL phase shift */ +acc100_reg_write (d, HWPfChaDl5gPllPhshft0,0x1 ); + +/* Explicitly releasing AXI as this may be stopped after PF FLR/BME */ + address = HWPfDmaAxiControl; + payload =1 ; +acc100_reg_write (d, address, payload); + +/* DDR Configuration */ + address = HWPfDdrBcTim6; + payload =acc100_reg_read (d, address); + payload &=0xFFFFFFFB ;/* Bit 2 */ #ifdef ACC100_DDR_ECC_ENABLE + payload |=0x4 ; +#endif +acc100_reg_write (d, address, payload); + address = HWPfDdrPhyDqsCountNum; +#ifdef ACC100_DDR_ECC_ENABLE + payload =9 ; +#else + payload =8 ; +#endif +acc100_reg_write (d, address, payload); + +/* Set default descriptor signature */ + address = HWPfDmaDescriptorSignatuture; + payload =0 ; +acc100_reg_write (d, address, payload); + +/* Enable the Error Detection in DMA */ + payload =ACC100_CFG_DMA_ERROR ; + address = HWPfDmaErrorDetectionEn; +acc100_reg_write (d, address, payload); + +/* AXI Cache configuration */ + payload =ACC100_CFG_AXI_CACHE ; + address = HWPfDmaAxcacheReg; +acc100_reg_write (d, address, payload); + +/* Default DMA Configuration (Qmgr Enabled) */ + address = HWPfDmaConfig0Reg; + payload =0 ; +acc100_reg_write (d, address, payload); + address = HWPfDmaQmanen; + payload =0 ; +acc100_reg_write (d, address, payload); + +/* Default RLIM/ALEN configuration */ + address = HWPfDmaConfig1Reg;drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload = (1 <<31 ) + (23 <<8 ) + (1 <<6 ) +7 ; +acc100_reg_write (d, address, payload); + +/* Configure DMA Qmanager addresses */ + address = HWPfDmaQmgrAddrReg; + payload = HWPfQmgrEgressQueuesTemplate; +acc100_reg_write (d, address, payload); + +/* ===== Qmgr Configuration ===== */ +/* Configuration of the AQueue Depth QMGR_GRP_0_DEPTH_LOG2 for UL */
Quoted 32 lines
drivers/baseband/acc100/rte_acc100_pmd.c +32
-0+int totalQgs = conf->q_ul_4g.num_qgroups + + conf->q_ul_5g.num_qgroups + + conf->q_dl_4g.num_qgroups + + conf->q_dl_5g.num_qgroups; +for (qg_idx =0 ; qg_idx < totalQgs; qg_idx++) { + address = HWPfQmgrDepthLog2Grp + +BYTES_IN_WORD * qg_idx; + payload =aqDepth (qg_idx, conf); +acc100_reg_write (d, address, payload); + address = HWPfQmgrTholdGrp + +BYTES_IN_WORD * qg_idx; + payload = (1 <<16 ) + (1 << (aqDepth (qg_idx, conf) -1 )); +acc100_reg_write (d, address, payload); + } + +/* Template Priority in incremental order */ +for (template_idx =0 ; template_idx <ACC100_NUM_TMPL ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg0Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_0 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg1Indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_1 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg2indx + +BYTES_IN_WORD * (template_idx %8 ); + payload =TMPL_PRI_2 ; +acc100_reg_write (d, address, payload); + address = HWPfQmgrGrpTmplateReg3Indx + +BYTES_IN_WORD * (template_idx %8 );drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload =TMPL_PRI_3 ; +acc100_reg_write (d, address, payload); + } + + address = HWPfQmgrGrpPriority; + payload =ACC100_CFG_QMGR_HI_P ; +acc100_reg_write (d, address, payload); + +/* Template Configuration */ + for (template_idx = 0; template_idx < ACC100_NUM_TMPL;template_idx++) {
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ payload =0 ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +acc100_reg_write (d, address, payload); + } +/* 4GUL */ +int numQgs = conf->q_ul_4g.num_qgroups; +int numQqsAcc =0 ; + payload =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev)
Quoted 13 lines
drivers/baseband/acc100/rte_acc100_pmd.c +13
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_UL_4G ; template_idx <=SIG_UL_4G_LAST ; + template_idx++) { + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD *template_idx; +acc100_reg_write (d, address, payload); + } +/* 5GUL */ + numQqsAcc += numQgs; + numQgs = conf->q_ul_5g.num_qgroups; + payload =0 ; +int numEngines =0 ; + for (qg_idx = numQqsAcc; qg_idx < (numQgs + numQqsAcc);qg_idx++)
Quoted 16 lines
Quoted 5 lines
drivers/baseband/acc100/rte_acc100_pmd.c +5
-0+ payload |= (1 << qg_idx); +for (template_idx =SIG_UL_5G ; template_idx <=SIG_UL_5G_LAST ; + template_idx++) { +/* Check engine power-on status */ + address = HwPfFecUl5gIbDebugReg +drivers/baseband/acc100/rte_acc100_pmd.c static int acc100_pci_remove(struct rte_pci_device *pci_dev) · line 4551
Quoted 10 lines
drivers/baseband/acc100/rte_acc100_pmd.c +10
-0+ACC100_ENGINE_OFFSET * template_idx; + status = (acc100_reg_read (d, address) >>4 ) &0xF ; + address = HWPfQmgrGrpTmplateReg4Indx + +BYTES_IN_WORD * template_idx; +if (status ==1 ) { +acc100_reg_write (d, address, payload); + numEngines++; + }else +acc100_reg_write (d, address,0 ); +#if RTE_ACC100_SINGLE_FEC ==1 #if should be at start of line
ok
161 lines not shown · raw message
Part of this message is not shown here. View the raw message.
v10 cover bbdev PMD ACC100
In reply to Nicolas Chautruv10: Updates based on Tom Rix valuable review comments. Notably doc clarifiction, #define names updates, few magic numbers left, stricter error handling and few valuable coding suggestions. Thanks
v9: moved the release notes update to the last commit
v8: integrated the doc feature table in previous commit as suggested.
v7: Fingers trouble. Previous one sent mid-rebase. My bad.
v6: removed a legacy makefile no longer required
v5: rebase based on latest on main. The legacy makefiles are removed.
v4: an odd compilation error is reported for one CI variant using "gcc latest" which looks to me like a false positive of maybe-undeclared.
http://mails.dpdk.org/archives/test-report/2020-August/148936.html
Still forcing a dummy declare to remove this CI warning I will check with [email protected] in parallel.
v3: missed a change during rebase
v2: includes clean up from latest CI checks.
Nicolas Chautru (10):
drivers/baseband: add PMD for ACC100 baseband/acc100: add register definition file baseband/acc100: add info get function baseband/acc100: add queue configuration baseband/acc100: add LDPC processing functions baseband/acc100: add HARQ loopback support baseband/acc100: add support for 4G processing baseband/acc100: add interrupt support to PMD baseband/acc100: add debug function to validate input baseband/acc100: add configure function
app/test-bbdev/meson.build | 3 + app/test-bbdev/test_bbdev_perf.c | 71 + doc/guides/bbdevs/acc100.rst | 228 + doc/guides/bbdevs/features/acc100.ini | 14 + doc/guides/bbdevs/index.rst | 1 + doc/guides/rel_notes/release_20_11.rst | 5 + drivers/baseband/acc100/acc100_pf_enum.h | 1068 +++++ drivers/baseband/acc100/acc100_vf_enum.h | 73 + drivers/baseband/acc100/meson.build | 8 + drivers/baseband/acc100/rte_acc100_cfg.h | 113 + drivers/baseband/acc100/rte_acc100_pmd.c | 4731 ++++++++++++++++++++ drivers/baseband/acc100/rte_acc100_pmd.h | 602 +++ .../acc100/rte_pmd_bbdev_acc100_version.map | 10 + drivers/baseband/meson.build | 2 +- 14 files changed, 6928 insertions(+), 1 deletion(-) create mode 100644 doc/guides/bbdevs/acc100.rst create mode 100644 doc/guides/bbdevs/features/acc100.ini create mode 100644 drivers/baseband/acc100/acc100_pf_enum.h create mode 100644 drivers/baseband/acc100/acc100_vf_enum.h create mode 100644 drivers/baseband/acc100/meson.build create mode 100644 drivers/baseband/acc100/rte_acc100_cfg.h create mode 100644 drivers/baseband/acc100/rte_acc100_pmd.c create mode 100644 drivers/baseband/acc100/rte_acc100_pmd.h create mode 100644 drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map
Signature · 1 line
1.8.3.1
PATCH v10 1/10 drivers/baseband: add PMD for ACC100
Add stubs for the ACC100 PMD
--- doc/guides/bbdevs/acc100.rst | 228 +++++++++++++++++++++ doc/guides/bbdevs/features/acc100.ini | 14 ++ doc/guides/bbdevs/index.rst | 1 + drivers/baseband/acc100/meson.build | 6 + drivers/baseband/acc100/rte_acc100_pmd.c | 175 ++++++++++++++++ drivers/baseband/acc100/rte_acc100_pmd.h | 37 ++++ .../acc100/rte_pmd_bbdev_acc100_version.map | 3 + drivers/baseband/meson.build | 2 +- 8 files changed, 465 insertions(+), 1 deletion(-) create mode 100644 doc/guides/bbdevs/acc100.rst create mode 100644 doc/guides/bbdevs/features/acc100.ini create mode 100644 drivers/baseband/acc100/meson.build create mode 100644 drivers/baseband/acc100/rte_acc100_pmd.c create mode 100644 drivers/baseband/acc100/rte_acc100_pmd.h create mode 100644 drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map
doc/guides/bbdevs/acc100.rst new file +228 -0
@@ -0,0 +1,228 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Intel Corporation + +Intel(R) ACC100 5G/4G FEC Poll Mode Driver +========================================== + +The BBDEV ACC100 5G/4G FEC poll mode driver (PMD) supports an +implementation of a VRAN FEC wireless acceleration function. +This device is also known as Mount Bryce. + +Features +-------- + +ACC100 5G/4G FEC PMD supports the following features: + +- LDPC Encode in the DL (5GNR) +- LDPC Decode in the UL (5GNR) +- Turbo Encode in the DL (4G) +- Turbo Decode in the UL (4G) +- 16 VFs per PF (physical device) +- Maximum of 128 queues per VF +- PCIe Gen-3 x16 Interface +- MSI +- SR-IOV + +ACC100 5G/4G FEC PMD supports the following BBDEV capabilities: + +* For the LDPC encode operation: + - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` : set to attach CRC24B to CB(s) + - ``RTE_BBDEV_LDPC_RATE_MATCH`` : if set then do not do Rate Match bypass + - ``RTE_BBDEV_LDPC_INTERLEAVER_BYPASS`` : if set then bypass interleaver + +* For the LDPC decode operation: + - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` : check CRC24B from CB(s) + - ``RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE`` : disable early termination + - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` : drops CRC24B bits appended while decoding + - ``RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE`` : provides an input for HARQ combining + - ``RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE`` : provides an input for HARQ combining + - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE`` : HARQ memory input is internal + - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE`` : HARQ memory output is internal + - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK`` : loopback data to/from HARQ memory + - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS`` : HARQ memory includes the fillers bits + - ``RTE_BBDEV_LDPC_DEC_SCATTER_GATHER`` : supports scatter-gather for input/output data + - ``RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION`` : supports compression of the HARQ input/output + - ``RTE_BBDEV_LDPC_LLR_COMPRESSION`` : supports LLR input compression + +* For the turbo encode operation: + - ``RTE_BBDEV_TURBO_CRC_24B_ATTACH`` : set to attach CRC24B to CB(s) + - ``RTE_BBDEV_TURBO_RATE_MATCH`` : if set then do not do Rate Match bypass + - ``RTE_BBDEV_TURBO_ENC_INTERRUPTS`` : set for encoder dequeue interrupts + - ``RTE_BBDEV_TURBO_RV_INDEX_BYPASS`` : set to bypass RV index + - ``RTE_BBDEV_TURBO_ENC_SCATTER_GATHER`` : supports scatter-gather for input/output data + +* For the turbo decode operation: + - ``RTE_BBDEV_TURBO_CRC_TYPE_24B`` : check CRC24B from CB(s) + - ``RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE`` : perform subblock de-interleave + - ``RTE_BBDEV_TURBO_DEC_INTERRUPTS`` : set for decoder dequeue interrupts + - ``RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN`` : set if negative LLR encoder i/p is supported + - ``RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN`` : set if positive LLR encoder i/p is supported + - ``RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP`` : keep CRC24B bits appended while decoding + - ``RTE_BBDEV_TURBO_EARLY_TERMINATION`` : set early early termination feature + - ``RTE_BBDEV_TURBO_DEC_SCATTER_GATHER`` : supports scatter-gather for input/output data + - ``RTE_BBDEV_TURBO_HALF_ITERATION_EVEN`` : set half iteration granularity + +Installation +------------ + +Section 3 of the DPDK manual provides instuctions on installing and compiling DPDK. The +default set of bbdev compile flags may be found in config/common_base, where for example +the flag to build the ACC100 5G/4G FEC device, ``CONFIG_RTE_LIBRTE_PMD_BBDEV_ACC100``, +is already set. + +DPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual. +The bbdev test application has been tested with a configuration 40 x 1GB hugepages. The +hugepage configuration of a server may be examined using: + +.. code-block:: console + + grep Huge* /proc/meminfo + + +Initialization +-------------- + +When the device first powers up, its PCI Physical Functions (PF) can be listed through this command: + +.. code-block:: console + + sudo lspci -vd8086:0d5c + +The physical and virtual functions are compatible with Linux UIO drivers: +``vfio`` and ``igb_uio``. However, in order to work the ACC100 5G/4G +FEC device first needs to be bound to one of these linux drivers through DPDK. + + +Bind PF UIO driver(s) +~~~~~~~~~~~~~~~~~~~~~ + +Install the DPDK igb_uio driver, bind it with the PF PCI device ID and use +``lspci`` to confirm the PF device is under use by ``igb_uio`` DPDK UIO driver. + +The igb_uio driver may be bound to the PF PCI device using one of three methods: + + +1. PCI functions (physical or virtual, depending on the use case) can be bound to +the UIO driver by repeating this command for every function. + +.. code-block:: console + + cd <dpdk-top-level-directory> + insmod ./build/kmod/igb_uio.ko + echo "8086 0d5c" > /sys/bus/pci/drivers/igb_uio/new_id + lspci -vd8086:0d5c + + +2. Another way to bind PF with DPDK UIO driver is by using the ``dpdk-devbind.py`` tool + +.. code-block:: console + + cd <dpdk-top-level-directory> + ./usertools/dpdk-devbind.py -b igb_uio 0000:06:00.0 + +where the PCI device ID (example: 0000:06:00.0) is obtained using lspci -vd8086:0d5c + + +3. A third way to bind is to use ``dpdk-setup.sh`` tool + +.. code-block:: console + + cd <dpdk-top-level-directory> + ./usertools/dpdk-setup.sh + + select 'Bind Ethernet/Crypto/Baseband device to IGB UIO module' + enter PCI device ID + select 'Display current Ethernet/Crypto/Baseband device settings' to confirm binding + +In a similar way the ACC100 5G/4G FEC PF may be bound with vfio-pci as any PCIe device. + +Enable Virtual Functions +~~~~~~~~~~~~~~~~~~~~~~~~ + +Now, it should be visible in the printouts that PCI PF is under igb_uio control +"``Kernel driver in use: igb_uio``" + +To show the number of available VFs on the device, read ``sriov_totalvfs`` file.. + +.. code-block:: console + + cat /sys/bus/pci/devices/0000\:<b>\:<d>.<f>/sriov_totalvfs + + where 0000\:<b>\:<d>.<f> is the PCI device ID + + +To enable VFs via igb_uio, echo the number of virtual functions intended to +enable to ``max_vfs`` file.. + +.. code-block:: console + + echo <num-of-vfs> > /sys/bus/pci/devices/0000\:<b>\:<d>.<f>/max_vfs + + +Afterwards, all VFs must be bound to appropriate UIO drivers as required, same +way it was done with the physical function previously. + +Enabling SR-IOV via vfio driver is pretty much the same, except that the file +name is different: + +.. code-block:: console + + echo <num-of-vfs> > /sys/bus/pci/devices/0000\:<b>\:<d>.<f>/sriov_numvfs + + +Configure the VFs through PF +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The PCI virtual functions must be configured before working or getting assigned +to VMs/Containers. The configuration involves allocating the number of hardware +queues, priorities, load balance, bandwidth and other settings necessary for the +device to perform FEC functions. + +This configuration needs to be executed at least once after reboot or PCI FLR and can +be achieved by using the function ``acc100_configure()``, which sets up the +parameters defined in ``acc100_conf`` structure. + +Test Application +---------------- + +BBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing +the functionality of ACC100 5G/4G FEC encode and decode, depending on the device's +capabilities. The test application is located under app->test-bbdev folder and has the +following options: + +.. code-block:: console + + "-p", "--testapp-path": specifies path to the bbdev test app. + "-e", "--eal-params" : EAL arguments which are passed to the test app. + "-t", "--timeout" : Timeout in seconds (default=300). + "-c", "--test-cases" : Defines test cases to run. Run all if not specified. + "-v", "--test-vector" : Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data). + "-n", "--num-ops" : Number of operations to process on device (default=32). + "-b", "--burst-size" : Operations enqueue/dequeue burst size (default=32). + "-s", "--snr" : SNR in dB used when generating LLRs for bler tests. + "-s", "--iter_max" : Number of iterations for LDPC decoder. + "-l", "--num-lcores" : Number of lcores to run (default=16). + "-i", "--init-device" : Initialise PF device with default values. + + +To execute the test application tool using simple decode or encode data, +type one of the following: + +.. code-block:: console + + ./test-bbdev.py -c validation -n 64 -b 1 -v ./ldpc_dec_default.data + ./test-bbdev.py -c validation -n 64 -b 1 -v ./ldpc_enc_default.data + + +The test application ``test-bbdev.py``, supports the ability to configure the PF device with +a default set of values, if the "-i" or "- -init-device" option is included. The default values +are defined in test_bbdev_perf.c. + + +Test Vectors +~~~~~~~~~~~~ + +In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides +a range of additional tests under the test_vectors folder, which may be useful. The results +of these tests will depend on the ACC100 5G/4G FEC capabilities which may cause some +testcases to be skipped, but no failure should be reported.
doc/guides/bbdevs/features/acc100.ini new file +14 -0
@@ -0,0 +1,14 @@ +; +; Supported features of the 'acc100' bbdev driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Turbo Decoder (4G) = N +Turbo Encoder (4G) = N +LDPC Decoder (5G) = N +LDPC Encoder (5G) = N +LLR/HARQ Compression = N +External DDR Access = N +HW Accelerated = Y +BBDEV API = Y
doc/guides/bbdevs/index.rst +1 -0
@@ -13,3 +13,4 @@ Baseband Device Drivers turbo_sw fpga_lte_fec fpga_5gnr_fec + acc100
drivers/baseband/acc100/meson.build new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +deps += ['bbdev', 'bus_vdev', 'ring', 'pci', 'bus_pci'] + +sources = files('rte_acc100_pmd.c')
drivers/baseband/acc100/rte_acc100_pmd.c new file +175 -0
175 lines not on this page · raw message
drivers/baseband/acc100/rte_acc100_pmd.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2020 Intel Corporation +*/ + +#ifndef _RTE_ACC100_PMD_H_ +#define _RTE_ACC100_PMD_H_ + +/* Helper macro for logging */ +#define rte_bbdev_log (level, fmt, ...) \ + rte_log(RTE_LOG_ ## level, acc100_logtype, fmt "\n", \ + ##__VA_ARGS__) + +#ifdef RTE_LIBRTE_BBDEV_DEBUG +#define rte_bbdev_log_debug (fmt, ...) \ + rte_bbdev_log(DEBUG, "acc100_pmd: " fmt, \ + ##__VA_ARGS__) +#else +#define rte_bbdev_log_debug (fmt, ...) +#endif + +/* ACC100 PF and VF driver names */ +#define ACC100PF_DRIVER_NAME intel_acc100_pf +#define ACC100VF_DRIVER_NAME intel_acc100_vf + +/* ACC100 PCI vendor & device IDs */ +#define RTE_ACC100_VENDOR_ID (0x8086) +#define RTE_ACC100_PF_DEVICE_ID (0x0d5c) +#define RTE_ACC100_VF_DEVICE_ID (0x0d5d) + +/* Private data structure for each ACC100 device */ +struct acc100_device { +void *mmio_base;/**< Base address of MMIO registers (BAR0) */ +bool pf_device;/**< True if this is a PF ACC100 device */ +bool configured;/**< True if this ACC100 device is configured */ +}; + +#endif /* _RTE_ACC100_PMD_H_ */
drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_21 { + local: *; +};
drivers/baseband/meson.build +1 -1
@@ -5,7 +5,7 @@ if is_windows subdir_done() endif -drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec'] +drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec', 'acc100'] config_flag_fmt = 'RTE_LIBRTE_PMD_BBDEV_@0@' driver_name_fmt = 'rte_pmd_bbdev_@0@'
Signature · 1 line
1.8.3.1