baseband/acc100: fix ring/queue allocation
Allocate info ring, tail pointers and HARQ layout memory
for a device only if it hasn't already been allocated.
Fixes: 0653146415
("baseband/acc100: support interrupt")
Cc: stable@dpdk.org
Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
parent
5802f36dd4
commit
e23491fc2e
@ -499,6 +499,7 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
|
|||||||
acc_reg_write(d, reg_addr->ring_size, value);
|
acc_reg_write(d, reg_addr->ring_size, value);
|
||||||
|
|
||||||
/* Configure tail pointer for use when SDONE enabled */
|
/* Configure tail pointer for use when SDONE enabled */
|
||||||
|
if (d->tail_ptrs == NULL)
|
||||||
d->tail_ptrs = rte_zmalloc_socket(
|
d->tail_ptrs = rte_zmalloc_socket(
|
||||||
dev->device->driver->name,
|
dev->device->driver->name,
|
||||||
ACC100_NUM_QGRPS * ACC100_NUM_AQS * sizeof(uint32_t),
|
ACC100_NUM_QGRPS * ACC100_NUM_AQS * sizeof(uint32_t),
|
||||||
@ -507,8 +508,8 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
|
|||||||
rte_bbdev_log(ERR, "Failed to allocate tail ptr for %s:%u",
|
rte_bbdev_log(ERR, "Failed to allocate tail ptr for %s:%u",
|
||||||
dev->device->driver->name,
|
dev->device->driver->name,
|
||||||
dev->data->dev_id);
|
dev->data->dev_id);
|
||||||
rte_free(d->sw_rings);
|
ret = -ENOMEM;
|
||||||
return -ENOMEM;
|
goto free_sw_rings;
|
||||||
}
|
}
|
||||||
d->tail_ptr_iova = rte_malloc_virt2iova(d->tail_ptrs);
|
d->tail_ptr_iova = rte_malloc_virt2iova(d->tail_ptrs);
|
||||||
|
|
||||||
@ -531,6 +532,7 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
|
|||||||
/* Continue */
|
/* Continue */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d->harq_layout == NULL)
|
||||||
d->harq_layout = rte_zmalloc_socket("HARQ Layout",
|
d->harq_layout = rte_zmalloc_socket("HARQ Layout",
|
||||||
ACC_HARQ_LAYOUT * sizeof(*d->harq_layout),
|
ACC_HARQ_LAYOUT * sizeof(*d->harq_layout),
|
||||||
RTE_CACHE_LINE_SIZE, dev->data->socket_id);
|
RTE_CACHE_LINE_SIZE, dev->data->socket_id);
|
||||||
@ -538,8 +540,8 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
|
|||||||
rte_bbdev_log(ERR, "Failed to allocate harq_layout for %s:%u",
|
rte_bbdev_log(ERR, "Failed to allocate harq_layout for %s:%u",
|
||||||
dev->device->driver->name,
|
dev->device->driver->name,
|
||||||
dev->data->dev_id);
|
dev->data->dev_id);
|
||||||
rte_free(d->sw_rings);
|
ret = -ENOMEM;
|
||||||
return -ENOMEM;
|
goto free_tail_ptrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark as configured properly */
|
/* Mark as configured properly */
|
||||||
@ -548,8 +550,16 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
|
|||||||
rte_bbdev_log_debug(
|
rte_bbdev_log_debug(
|
||||||
"ACC100 (%s) configured sw_rings = %p, sw_rings_iova = %#"
|
"ACC100 (%s) configured sw_rings = %p, sw_rings_iova = %#"
|
||||||
PRIx64, dev->data->name, d->sw_rings, d->sw_rings_iova);
|
PRIx64, dev->data->name, d->sw_rings, d->sw_rings_iova);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
free_tail_ptrs:
|
||||||
|
rte_free(d->tail_ptrs);
|
||||||
|
d->tail_ptrs = NULL;
|
||||||
|
free_sw_rings:
|
||||||
|
rte_free(d->sw_rings_base);
|
||||||
|
d->sw_rings = NULL;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user