diff mbox series

[v2,04/37] baseband/acc100: free SW ring mem for reconfiguration

Message ID 20220820023157.189047-5-hernan.vargas@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers show
Series baseband/acc100: changes for 22.11 | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hernan Vargas Aug. 20, 2022, 2:31 a.m. UTC
Free base address of unaligned memory for SW rings to manage the missed
corner case when there is a reconfiguration.

Fixes: 060e7672930 ("baseband/acc100: add queue configuration")
Cc: stable@dpdk.org

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
 drivers/baseband/acc100/rte_acc100_pmd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Maxime Coquelin Sept. 14, 2022, 7:22 p.m. UTC | #1
On 8/20/22 04:31, Hernan Vargas wrote:
> Free base address of unaligned memory for SW rings to manage the missed
> corner case when there is a reconfiguration.
> 
> Fixes: 060e7672930 ("baseband/acc100: add queue configuration")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
>   drivers/baseband/acc100/rte_acc100_pmd.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
> index 7349bb5bad..349b8be5c1 100644
> --- a/drivers/baseband/acc100/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
> @@ -340,6 +340,8 @@ alloc_sw_rings_min_mem(struct rte_bbdev *dev, struct acc100_device *d,
>   	int i = 0;
>   	uint32_t q_sw_ring_size = ACC100_MAX_QUEUE_DEPTH * get_desc_len();
>   	uint32_t dev_sw_ring_size = q_sw_ring_size * num_queues;
> +	/* Free first in case this is a reconfiguration */
> +	rte_free(d->sw_rings_base);
>   
>   	/* Find an aligned block of memory to store sw rings */
>   	while (i < ACC100_SW_RING_MEM_ALLOC_ATTEMPTS) {
> @@ -768,6 +770,7 @@ acc100_dev_close(struct rte_bbdev *dev)
>   		rte_free(d->tail_ptrs);
>   		rte_free(d->info_ring);
>   		rte_free(d->sw_rings_base);
> +		rte_free(d->harq_layout);
>   		d->sw_rings_base = NULL;
>   	}
>   	/* Ensure all in flight HW transactions are completed */
> @@ -4665,7 +4668,8 @@ poweron_cleanup(struct rte_bbdev *bbdev, struct acc100_device *d,
>   	}
>   	printf("Number of 5GUL engines %d\n", numEngines);
>   
> -	rte_free(d->sw_rings_base);
> +	if (d->sw_rings_base != NULL)
> +		rte_free(d->sw_rings_base);

No need to check it is not NULL, rte_free() takes care of it.

>   	usleep(ACC100_LONG_WAIT);
>   }
>
diff mbox series

Patch

diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 7349bb5bad..349b8be5c1 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -340,6 +340,8 @@  alloc_sw_rings_min_mem(struct rte_bbdev *dev, struct acc100_device *d,
 	int i = 0;
 	uint32_t q_sw_ring_size = ACC100_MAX_QUEUE_DEPTH * get_desc_len();
 	uint32_t dev_sw_ring_size = q_sw_ring_size * num_queues;
+	/* Free first in case this is a reconfiguration */
+	rte_free(d->sw_rings_base);
 
 	/* Find an aligned block of memory to store sw rings */
 	while (i < ACC100_SW_RING_MEM_ALLOC_ATTEMPTS) {
@@ -768,6 +770,7 @@  acc100_dev_close(struct rte_bbdev *dev)
 		rte_free(d->tail_ptrs);
 		rte_free(d->info_ring);
 		rte_free(d->sw_rings_base);
+		rte_free(d->harq_layout);
 		d->sw_rings_base = NULL;
 	}
 	/* Ensure all in flight HW transactions are completed */
@@ -4665,7 +4668,8 @@  poweron_cleanup(struct rte_bbdev *bbdev, struct acc100_device *d,
 	}
 	printf("Number of 5GUL engines %d\n", numEngines);
 
-	rte_free(d->sw_rings_base);
+	if (d->sw_rings_base != NULL)
+		rte_free(d->sw_rings_base);
 	usleep(ACC100_LONG_WAIT);
 }