[v2,5/6] bpf: adapt for EAL optional atomics API changes

Message ID 1691775136-6460-6-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series RFC optional rte optional stdatomics API |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Aug. 11, 2023, 5:32 p.m. UTC
  Adapt bpf for EAL optional atomics API changes

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/bpf/bpf_pkt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Morten Brørup Aug. 14, 2023, 8:11 a.m. UTC | #1
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Friday, 11 August 2023 19.32
> 
> Adapt bpf for EAL optional atomics API changes
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/bpf/bpf_pkt.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/bpf/bpf_pkt.c b/lib/bpf/bpf_pkt.c
> index ffd2db7..b300447 100644
> --- a/lib/bpf/bpf_pkt.c
> +++ b/lib/bpf/bpf_pkt.c
> @@ -25,7 +25,7 @@
> 
>  struct bpf_eth_cbi {
>  	/* used by both data & control path */
> -	uint32_t use;    /*usage counter */
> +	uint32_t __rte_atomic use;    /*usage counter */

As mentioned in my review to the 2/6 patch, I think __rte_atomic should come before the type, like this:
	__rte_atomic uint32_t use;    /*usage counter */


>  	const struct rte_eth_rxtx_callback *cb;  /* callback handle */
>  	struct rte_bpf *bpf;
>  	struct rte_bpf_jit jit;
> @@ -110,8 +110,8 @@ struct bpf_eth_cbh {
> 
>  	/* in use, busy wait till current RX/TX iteration is finished */
>  	if ((puse & BPF_ETH_CBI_INUSE) != 0) {
> -		RTE_WAIT_UNTIL_MASKED((uint32_t *)(uintptr_t)&cbi->use,
> -			UINT32_MAX, !=, puse, __ATOMIC_RELAXED);
> +		RTE_WAIT_UNTIL_MASKED((uint32_t __rte_atomic *)(uintptr_t)&cbi->use,

And here:
		RTE_WAIT_UNTIL_MASKED((__rte_atomic uint32_t *) [...]

> +			UINT32_MAX, !=, puse, rte_memory_order_relaxed);
>  	}
>  }
> 
> --
> 1.8.3.1

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
  

Patch

diff --git a/lib/bpf/bpf_pkt.c b/lib/bpf/bpf_pkt.c
index ffd2db7..b300447 100644
--- a/lib/bpf/bpf_pkt.c
+++ b/lib/bpf/bpf_pkt.c
@@ -25,7 +25,7 @@ 
 
 struct bpf_eth_cbi {
 	/* used by both data & control path */
-	uint32_t use;    /*usage counter */
+	uint32_t __rte_atomic use;    /*usage counter */
 	const struct rte_eth_rxtx_callback *cb;  /* callback handle */
 	struct rte_bpf *bpf;
 	struct rte_bpf_jit jit;
@@ -110,8 +110,8 @@  struct bpf_eth_cbh {
 
 	/* in use, busy wait till current RX/TX iteration is finished */
 	if ((puse & BPF_ETH_CBI_INUSE) != 0) {
-		RTE_WAIT_UNTIL_MASKED((uint32_t *)(uintptr_t)&cbi->use,
-			UINT32_MAX, !=, puse, __ATOMIC_RELAXED);
+		RTE_WAIT_UNTIL_MASKED((uint32_t __rte_atomic *)(uintptr_t)&cbi->use,
+			UINT32_MAX, !=, puse, rte_memory_order_relaxed);
 	}
 }