[PATCH v2 4/4] net/hns3: use stdatomic API

Ferruh Yigit ferruh.yigit at amd.com
Thu Dec 7 14:57:49 CET 2023


On 12/7/2023 1:42 AM, Jie Hai wrote:
> Replace the use of gcc builtin __atomic_xxx intrinsics with
> corresponding rte_atomic_xxx optional stdatomic API.
> 
> Signed-off-by: Jie Hai <haijie1 at huawei.com>
> 

<...>

> diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
> index b8f7e408d1e0..457247609811 100644
> --- a/drivers/net/hns3/hns3_ethdev.c
> +++ b/drivers/net/hns3/hns3_ethdev.c
> @@ -99,7 +99,7 @@ static const struct rte_eth_fec_capa speed_fec_capa_tbl[] = {
>  };
>  
>  static enum hns3_reset_level hns3_get_reset_level(struct hns3_adapter *hns,
> -						 uint64_t *levels);
> +						 RTE_ATOMIC(uint64_t *)levels);
>

I don't know if is there a defined syntax, but I think better to use
macro for pointers as "RTE_ATOMIC(uint64_t) *levels", because of same
reason to use "int *a", following usage can be confusing:
"RTE_ATOMIC(uint64_t *) level1, level2;"



More information about the dev mailing list