On Fri, Mar 17, 2023 at 01:19:47PM -0700, Tyler Retzlaff wrote:
> Replace the use of rte_atomic.h types and functions, instead use GCC
> supplied C++11 memory model builtins.
> 
> Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com>
> ---
>  drivers/net/null/rte_eth_null.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> index 47d9554..195c3bd 100644
> --- a/drivers/net/null/rte_eth_null.c
> +++ b/drivers/net/null/rte_eth_null.c
> @@ -37,8 +37,8 @@ struct null_queue {
>       struct rte_mempool *mb_pool;
>       struct rte_mbuf *dummy_packet;
>  
> -     rte_atomic64_t rx_pkts;
> -     rte_atomic64_t tx_pkts;
> +     int64_t rx_pkts;
> +     int64_t tx_pkts;
>  };
>  
>  struct pmd_options {
> @@ -101,7 +101,7 @@ struct pmd_internals {
>               bufs[i]->port = h->internals->port_id;
>       }
>  
> -     rte_atomic64_add(&(h->rx_pkts), i);
> +     __atomic_fetch_add(&h->rx_pkts, i, __ATOMIC_SEQ_CST);
>  
>       return i;
>  }
> @@ -128,7 +128,7 @@ struct pmd_internals {
>               bufs[i]->port = h->internals->port_id;
>       }
>  
> -     rte_atomic64_add(&(h->rx_pkts), i);
> +     __atomic_fetch_add(&h->rx_pkts, i, __ATOMIC_SEQ_CST);
>  
>       return i;
>  }
> @@ -152,7 +152,7 @@ struct pmd_internals {
>       for (i = 0; i < nb_bufs; i++)
>               rte_pktmbuf_free(bufs[i]);
>  
> -     rte_atomic64_add(&(h->tx_pkts), i);
> +     __atomic_fetch_add(&h->tx_pkts, i, __ATOMIC_SEQ_CST);
>  
>       return i;
>  }
> @@ -174,7 +174,7 @@ struct pmd_internals {
>               rte_pktmbuf_free(bufs[i]);
>       }
>  
> -     rte_atomic64_add(&(h->tx_pkts), i);
> +     __atomic_fetch_add(&h->tx_pkts, i, __ATOMIC_SEQ_CST);
>  
>       return i;
>  }
> @@ -317,7 +317,7 @@ struct pmd_internals {
>                               RTE_DIM(internal->rx_null_queues)));
>       for (i = 0; i < num_stats; i++) {
>               igb_stats->q_ipackets[i] =
> -                     internal->rx_null_queues[i].rx_pkts.cnt;
> +                     internal->rx_null_queues[i].rx_pkts;
>               rx_total += igb_stats->q_ipackets[i];
>       }
>  
> @@ -326,7 +326,7 @@ struct pmd_internals {
>                               RTE_DIM(internal->tx_null_queues)));
>       for (i = 0; i < num_stats; i++) {
>               igb_stats->q_opackets[i] =
> -                     internal->tx_null_queues[i].tx_pkts.cnt;
> +                     internal->tx_null_queues[i].tx_pkts;
>               tx_total += igb_stats->q_opackets[i];
>       }
>  

these variables are operated on with atomic builtins in other places
yet here they are being non-atomically loaded. should probably be using
_atomic_load_n(...)

> @@ -347,9 +347,9 @@ struct pmd_internals {
>  
>       internal = dev->data->dev_private;
>       for (i = 0; i < RTE_DIM(internal->rx_null_queues); i++)
> -             internal->rx_null_queues[i].rx_pkts.cnt = 0;
> +             internal->rx_null_queues[i].rx_pkts = 0;
>       for (i = 0; i < RTE_DIM(internal->tx_null_queues); i++)
> -             internal->tx_null_queues[i].tx_pkts.cnt = 0;
> +             internal->tx_null_queues[i].tx_pkts = 0;

same thing, these should probably be __atomic_store_n(...)

Reply via email to