[v1,3/5] baseband/acc: move memory barrier

Message ID 20240422154008.119800-4-hernan.vargas@intel.com (mailing list archive)
State Superseded
Delegated to: Maxime Coquelin
Headers
Series ACC100 improvements and clean up |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hernan Vargas April 22, 2024, 3:40 p.m. UTC
  Moving memory barrier so that dequeue thread can be in sync with enqueue
thread.

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
 drivers/baseband/acc/acc_common.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Maxime Coquelin May 2, 2024, 3:29 p.m. UTC | #1
On 4/22/24 17:40, Hernan Vargas wrote:
> Moving memory barrier so that dequeue thread can be in sync with enqueue
> thread.
> 

It is a fix, so please pass Fixes tag and Cc stable ML.

> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
>   drivers/baseband/acc/acc_common.h | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
> index fddeb0737b8b..e249f37e38fe 100644
> --- a/drivers/baseband/acc/acc_common.h
> +++ b/drivers/baseband/acc/acc_common.h
> @@ -1112,6 +1112,9 @@ acc_dma_enqueue(struct acc_queue *q, uint16_t n,
>   				req_elem_addr,
>   				(void *)q->mmio_reg_enqueue);
>   
> +		q->aq_enqueued++;
> +		q->sw_ring_head += enq_batch_size;
> +
>   		rte_wmb();
>   
>   		/* Start time measurement for enqueue function offload. */
> @@ -1122,8 +1125,6 @@ acc_dma_enqueue(struct acc_queue *q, uint16_t n,
>   
>   		queue_stats->acc_offload_cycles += rte_rdtsc_precise() - start_time;
>   
> -		q->aq_enqueued++;
> -		q->sw_ring_head += enq_batch_size;
>   		n -= enq_batch_size;
>   
>   	} while (n);
  

Patch

diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
index fddeb0737b8b..e249f37e38fe 100644
--- a/drivers/baseband/acc/acc_common.h
+++ b/drivers/baseband/acc/acc_common.h
@@ -1112,6 +1112,9 @@  acc_dma_enqueue(struct acc_queue *q, uint16_t n,
 				req_elem_addr,
 				(void *)q->mmio_reg_enqueue);
 
+		q->aq_enqueued++;
+		q->sw_ring_head += enq_batch_size;
+
 		rte_wmb();
 
 		/* Start time measurement for enqueue function offload. */
@@ -1122,8 +1125,6 @@  acc_dma_enqueue(struct acc_queue *q, uint16_t n,
 
 		queue_stats->acc_offload_cycles += rte_rdtsc_precise() - start_time;
 
-		q->aq_enqueued++;
-		q->sw_ring_head += enq_batch_size;
 		n -= enq_batch_size;
 
 	} while (n);