Skip to content

Commit

Permalink
baseband/fpga_5gnr_fec: fix starting unconfigured queue
Browse files Browse the repository at this point in the history
[ upstream commit 490501e6cbe48503aeadb20f89915a3949b70aa8 ]

Adding exception to prevent segmentation fault in case a queue is
started which was not configured earlier.

Fixes: c58109a ("baseband/fpga_5gnr_fec: add queue configuration")

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  • Loading branch information
Hernanlv authored and kevintraynor committed Jul 18, 2023
1 parent 59b0cc0 commit fac6cde
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,17 +564,21 @@ static int
fpga_queue_start(struct rte_bbdev *dev, uint16_t queue_id)
{
struct fpga_5gnr_fec_device *d = dev->data->dev_private;
struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS +
(sizeof(struct fpga_ring_ctrl_reg) * q->q_idx);
uint8_t enable = 0x01;
uint16_t zero = 0x0000;
#ifdef RTE_LIBRTE_BBDEV_DEBUG
if (d == NULL) {
rte_bbdev_log(ERR, "Invalid device pointer");
return -1;
}
#endif
struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS +
(sizeof(struct fpga_ring_ctrl_reg) * q->q_idx);
uint8_t enable = 0x01;
uint16_t zero = 0x0000;
if (dev->data->queues[queue_id].queue_private == NULL) {
rte_bbdev_log(ERR, "Cannot start invalid queue %d", queue_id);
return -1;
}

/* Clear queue head and tail variables */
q->tail = q->head_free_desc = 0;
Expand Down

0 comments on commit fac6cde

Please sign in to comment.