bbdev PMD ACC100
PATCH v12 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 | 307 ++++++++++++++++++++++++++++++- drivers/baseband/acc100/rte_acc100_pmd.h | 16 ++ 2 files changed, 320 insertions(+), 3 deletions(-)
drivers/baseband/acc100/rte_acc100_pmd.c +304 -3
@@ -342,6 +342,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_info_ring (struct rte_bbdev *dev) +{ +struct acc100_device *d = dev->data->dev_private; +const struct acc100_registry_addr *reg_addr; +rte_iova_t info_ring_iova; +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_iova =rte_malloc_virt2iova (d->info_ring); + +/* Setup Info Ring */ + phys_high = (uint32_t )(info_ring_iova >>32 ); + phys_low = (uint32_t )(info_ring_iova); +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)
@@ -349,6 +556,7 @@uint32_t phys_low, phys_high, payload;struct acc100_device *d = dev->data->dev_private;const struct acc100_registry_addr *reg_addr; +int ret;if (d->pf_device && !d->acc100_conf.pf_mode_en) { rte_bbdev_log(NOTICE,
@@ -432,6 +640,14 @@acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_hi, phys_high);acc100_reg_write (d, reg_addr->tail_ptrs_dl4g_lo, phys_low); + ret =allocate_info_ring (dev); +if (ret <0 ) { +rte_bbdev_log (ERR ,"Failed to allocate info_ring for %s:%u" , + dev->device->driver->name, + dev->data->dev_id); +/* Continue */ + } + d->harq_layout =rte_zmalloc_socket ("HARQ Layout" ,ACC100_HARQ_LAYOUT *sizeof (*d->harq_layout),RTE_CACHE_LINE_SIZE , dev->data->socket_id);
@@ -453,13 +669,59 @@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 ) { + + ret =allocate_info_ring (dev); +if (ret <0 ) { +rte_bbdev_log (ERR , +"Couldn't allocate info ring for device: %s" , + dev->data->name); +return ret; + } + + 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 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 ; }
@@ -670,6 +932,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 |
@@ -690,6 +953,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,
@@ -703,7 +967,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 =
@@ -728,7 +993,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 =
@@ -778,14 +1044,44 @@#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; + +if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && + dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +return -ENOTSUP ; + + 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 +3314,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 +3374,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 +16 -0
@@ -565,8 +565,16 @@ struct acc100_device {rte_iova_t sw_rings_iova;/* IOVA address of sw_rings */ /* Virtual address of the info memory routed to the this function under * operation, whether it is PF or VF. +* HW may DMA information data at this location asynchronously */ +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 */
@@ -582,4 +590,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
PATCH v12 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 | 436 +++++++++++++++++++++++++++++++ 1 file changed, 436 insertions(+)
drivers/baseband/acc100/rte_acc100_pmd.c +436 -0
@@ -1994,6 +1994,243 @@ } +#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 ; + } +int K = (ldpc_enc->basegraph ==1 ?22 :10 ) * ldpc_enc->z_c; +if (ldpc_enc->n_filler >=K ) { +rte_bbdev_log (ERR , +"K and F are not compatible %u %u" , +K , ldpc_enc->n_filler); +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 ; + } +int K = (ldpc_dec->basegraph ==1 ?22 :10 ) * ldpc_dec->z_c; +if (ldpc_dec->n_filler >=K ) { +rte_bbdev_log (ERR , +"K and F are not compatible %u %u" , +K , ldpc_dec->n_filler); +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,
@@ -2005,6 +2242,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;
@@ -2051,6 +2296,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;
@@ -2105,6 +2358,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;
@@ -2154,6 +2415,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;
@@ -2221,6 +2490,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,
@@ -2233,6 +2638,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;
@@ -2450,6 +2863,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);
@@ -2547,6 +2967,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;
@@ -2632,6 +3060,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
PATCH v12 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 | 71 +++ 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 | 526 ++++++++++++++++++++- drivers/baseband/acc100/rte_acc100_pmd.h | 1 + .../acc100/rte_pmd_bbdev_acc100_version.map | 7 + 7 files changed, 624 insertions(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +71 -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,65 @@ 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 rte_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 rte_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 =rte_acc100_configure (info->dev_name, &conf); +TEST_ASSERT_SUCCESS (ret, +"Failed to configure ACC100 PF for bbdev %s" , + info->dev_name); + } +#endif +/* Let's refresh this now this is configured */ +rte_bbdev_info_get (dev_id, info); 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 rte_acc100_conf {struct rte_acc100_arbitration 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 +rte_acc100_configure (const char *dev_name,struct rte_acc100_conf *conf); + #ifdef __cplusplus }#endif
drivers/baseband/acc100/rte_acc100_pmd.c +521 -5
561 lines not on this page · raw message
drivers/baseband/acc100/rte_acc100_pmd.h +1 -0
@@ -158,6 +158,7 @@#define ACC100_RESET_HARD 0x1FF#define ACC100_ENGINES_MAX 9#define ACC100_LONG_WAIT 1000 +#define ACC100_GPEX_AXIMAP_NUM 17/* ACC100 DMA Descriptor triplet */ struct acc100_dma_triplet {
drivers/baseband/acc100/rte_pmd_bbdev_acc100_version.map +7 -0
@@ -1,3 +1,10 @@ DPDK_21 { local: *; }; + +EXPERIMENTAL { + global: + + rte_acc100_configure; + +};
Signature · 1 line
1.8.3.1
Hi Nicolas,
The series looks overall good to me now. Thanks for implementing the suggested changes.
For what it's worth:
Thanks,
Maxime
Quoted 51 lines · Nicolas Chautru
v12: Correcting 1 spelling error and 1 code clean up.
v11: Further updates based on Tom + Maxime review comments on v9 and v10. Variable renaming
v10: 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 functionapp/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 | 4727 ++++++++++++++++++++ drivers/baseband/acc100/rte_acc100_pmd.h | 602 +++ .../acc100/rte_pmd_bbdev_acc100_version.map | 10 + drivers/baseband/meson.build | 2 +- 14 files changed, 6924 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
Quoted 11 lines
Hi Nicolas,
The series looks overall good to me now. Thanks for implementing the suggested changes.
For what it's worth:
Acked-by Maxime Coquelin <[email protected]>
Series applied to dpdk-next-crypto
Thanks.