use stdatomic API
Subsystems (8)
cover use stdatomic API
This series converts all non-generic built atomics to use the rte_atomic macros that allow optional enablement of standard C11 atomics.
Use of generic atomics for non-scalar types are not converted in this change and will be evaluated as a part of a separate series.
Note if this series ends up requiring too much rebasing due to tree churn before it is merged i will break it up into smaller series.
Tyler Retzlaff (46):
net/mlx5: use rte stdatomic API
net/ixgbe: use rte stdatomic API
net/iavf: use rte stdatomic API
net/ice: use rte stdatomic API
net/i40e: use rte stdatomic API
net/hns3: use rte stdatomic API
net/bnxt: use rte stdatomic API
net/cpfl: use rte stdatomic API
net/af_xdp: use rte stdatomic API
net/octeon_ep: use rte stdatomic API
net/octeontx: use rte stdatomic API
net/cxgbe: use rte stdatomic API
net/gve: use rte stdatomic API
net/memif: use rte stdatomic API
net/sfc: use rte stdatomic API
net/thunderx: use rte stdatomic API
net/virtio: use rte stdatomic API
net/hinic: use rte stdatomic API
net/idpf: use rte stdatomic API
net/qede: use rte stdatomic API
net/ring: use rte stdatomic API
vdpa/mlx5: use rte stdatomic API
raw/ifpga: use rte stdatomic API
event/opdl: use rte stdatomic API
event/octeontx: use rte stdatomic API
event/dsw: use rte stdatomic API
dma/skeleton: use rte stdatomic API
crypto/octeontx: use rte stdatomic API
common/mlx5: use rte stdatomic API
common/idpf: use rte stdatomic API
common/iavf: use rte stdatomic API
baseband/acc: use rte stdatomic API
net/txgbe: use rte stdatomic API
net/null: use rte stdatomic API
event/dlb2: use rte stdatomic API
dma/idxd: use rte stdatomic API
crypto/ccp: use rte stdatomic API
common/cpt: use rte stdatomic API
bus/vmbus: use rte stdatomic API
examples: use rte stdatomic API
app/dumpcap: use rte stdatomic API
app/test: use rte stdatomic API
app/test-eventdev: use rte stdatomic API
app/test-crypto-perf: use rte stdatomic API
app/test-compress-perf: use rte stdatomic API
app/test-bbdev: use rte stdatomic API
app/dumpcap/main.c | 12 +- app/test-bbdev/test_bbdev_perf.c | 183 +++++++++++++-------- app/test-compress-perf/comp_perf_test_common.h | 2 +- app/test-compress-perf/comp_perf_test_cyclecount.c | 4 +- app/test-compress-perf/comp_perf_test_throughput.c | 10 +- app/test-compress-perf/comp_perf_test_verify.c | 6 +- app/test-crypto-perf/cperf_test_latency.c | 6 +- app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 10 +- app/test-crypto-perf/cperf_test_throughput.c | 10 +- app/test-crypto-perf/cperf_test_verify.c | 10 +- app/test-eventdev/test_order_atq.c | 4 +- app/test-eventdev/test_order_common.c | 5 +- app/test-eventdev/test_order_common.h | 8 +- app/test-eventdev/test_order_queue.c | 4 +- app/test-eventdev/test_perf_common.h | 6 +- app/test/test_bpf.c | 46 ++++-- app/test/test_distributor.c | 114 ++++++------- app/test/test_distributor_perf.c | 4 +- app/test/test_func_reentrancy.c | 28 ++-- app/test/test_hash_multiwriter.c | 16 +- app/test/test_hash_readwrite.c | 74 ++++----- app/test/test_hash_readwrite_lf_perf.c | 88 +++++----- app/test/test_lcores.c | 25 +-- app/test/test_lpm_perf.c | 14 +- app/test/test_mcslock.c | 12 +- app/test/test_mempool_perf.c | 9 +- app/test/test_pflock.c | 13 +- app/test/test_pmd_perf.c | 10 +- app/test/test_rcu_qsbr_perf.c | 114 ++++++------- app/test/test_ring_perf.c | 11 +- app/test/test_ring_stress_impl.h | 10 +- app/test/test_rwlock.c | 9 +- app/test/test_seqlock.c | 6 +- app/test/test_service_cores.c | 24 +-- app/test/test_spinlock.c | 9 +- app/test/test_stack_perf.c | 12 +- app/test/test_threads.c | 33 ++-- app/test/test_ticketlock.c | 9 +- app/test/test_timer.c | 31 ++-- drivers/baseband/acc/rte_acc100_pmd.c | 36 ++-- drivers/baseband/acc/rte_vrb_pmd.c | 46 ++++-- drivers/bus/vmbus/vmbus_channel.c | 9 +- drivers/common/cpt/cpt_common.h | 2 +- drivers/common/iavf/iavf_impl.c | 4 +- drivers/common/idpf/idpf_common_device.h | 6 +- drivers/common/idpf/idpf_common_rxtx.c | 14 +- drivers/common/idpf/idpf_common_rxtx.h | 2 +- drivers/common/idpf/idpf_common_rxtx_avx512.c | 16 +- drivers/common/mlx5/linux/mlx5_nl.c | 5 +- drivers/common/mlx5/mlx5_common.h | 2 +- drivers/common/mlx5/mlx5_common_mr.c | 16 +- drivers/common/mlx5/mlx5_common_mr.h | 2 +- drivers/common/mlx5/mlx5_common_utils.c | 32 ++-- drivers/common/mlx5/mlx5_common_utils.h | 6 +- drivers/common/mlx5/mlx5_malloc.c | 58 +++---- drivers/crypto/ccp/ccp_dev.c | 8 +- drivers/crypto/octeontx/otx_cryptodev_ops.c | 4 +- drivers/dma/idxd/idxd_internal.h | 2 +- drivers/dma/idxd/idxd_pci.c | 9 +- drivers/dma/skeleton/skeleton_dmadev.c | 5 +- drivers/dma/skeleton/skeleton_dmadev.h | 2 +- drivers/event/dlb2/dlb2.c | 34 ++-- drivers/event/dlb2/dlb2_priv.h | 10 +- drivers/event/dlb2/dlb2_xstats.c | 2 +- drivers/event/dsw/dsw_evdev.h | 6 +- drivers/event/dsw/dsw_event.c | 34 ++-- drivers/event/dsw/dsw_xstats.c | 4 +- drivers/event/octeontx/timvf_evdev.h | 8 +- drivers/event/octeontx/timvf_worker.h | 36 ++-- drivers/event/opdl/opdl_ring.c | 80 ++++----- drivers/net/af_xdp/rte_eth_af_xdp.c | 20 ++- drivers/net/bnxt/bnxt_cpr.h | 4 +- drivers/net/bnxt/bnxt_rxq.h | 2 +- drivers/net/bnxt/bnxt_rxr.c | 13 +- drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 2 +- drivers/net/bnxt/bnxt_stats.c | 4 +- drivers/net/cpfl/cpfl_ethdev.c | 8 +- drivers/net/cxgbe/clip_tbl.c | 12 +- drivers/net/cxgbe/clip_tbl.h | 2 +- drivers/net/cxgbe/cxgbe_main.c | 20 +-- drivers/net/cxgbe/cxgbe_ofld.h | 6 +- drivers/net/cxgbe/l2t.c | 12 +- drivers/net/cxgbe/l2t.h | 2 +- drivers/net/cxgbe/mps_tcam.c | 21 +-- drivers/net/cxgbe/mps_tcam.h | 2 +- drivers/net/cxgbe/smt.c | 12 +- drivers/net/cxgbe/smt.h | 2 +- drivers/net/gve/base/gve_osdep.h | 4 +- drivers/net/hinic/hinic_pmd_rx.c | 2 +- drivers/net/hinic/hinic_pmd_rx.h | 2 +- drivers/net/hns3/hns3_cmd.c | 18 +- drivers/net/hns3/hns3_dcb.c | 2 +- drivers/net/hns3/hns3_ethdev.c | 36 ++-- drivers/net/hns3/hns3_ethdev.h | 32 ++-- drivers/net/hns3/hns3_ethdev_vf.c | 60 +++---- drivers/net/hns3/hns3_intr.c | 36 ++-- drivers/net/hns3/hns3_intr.h | 4 +- drivers/net/hns3/hns3_mbx.c | 6 +- drivers/net/hns3/hns3_mp.c | 6 +- drivers/net/hns3/hns3_rxtx.c | 10 +- drivers/net/hns3/hns3_tm.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 4 +- drivers/net/i40e/i40e_rxtx.c | 6 +- drivers/net/i40e/i40e_rxtx_vec_neon.c | 2 +- drivers/net/iavf/iavf.h | 16 +- drivers/net/iavf/iavf_rxtx.c | 4 +- drivers/net/iavf/iavf_rxtx_vec_neon.c | 2 +- drivers/net/iavf/iavf_vchnl.c | 14 +- drivers/net/ice/base/ice_osdep.h | 4 +- drivers/net/ice/ice_dcf.c | 6 +- drivers/net/ice/ice_dcf.h | 2 +- drivers/net/ice/ice_dcf_ethdev.c | 8 +- drivers/net/ice/ice_dcf_parent.c | 16 +- drivers/net/ice/ice_ethdev.c | 12 +- drivers/net/ice/ice_ethdev.h | 2 +- drivers/net/idpf/idpf_ethdev.c | 7 +- drivers/net/ixgbe/ixgbe_ethdev.c | 14 +- drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 4 +- drivers/net/memif/memif.h | 4 +- drivers/net/memif/rte_eth_memif.c | 50 +++--- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 6 +- drivers/net/mlx5/linux/mlx5_verbs.c | 9 +- drivers/net/mlx5/mlx5.c | 9 +- drivers/net/mlx5/mlx5.h | 66 ++++---- drivers/net/mlx5/mlx5_flow.c | 37 +++-- drivers/net/mlx5/mlx5_flow.h | 8 +- drivers/net/mlx5/mlx5_flow_aso.c | 43 +++-- drivers/net/mlx5/mlx5_flow_dv.c | 126 +++++++------- drivers/net/mlx5/mlx5_flow_flex.c | 14 +- drivers/net/mlx5/mlx5_flow_hw.c | 61 +++---- drivers/net/mlx5/mlx5_flow_meter.c | 30 ++-- drivers/net/mlx5/mlx5_flow_quota.c | 32 ++-- drivers/net/mlx5/mlx5_hws_cnt.c | 71 ++++---- drivers/net/mlx5/mlx5_hws_cnt.h | 10 +- drivers/net/mlx5/mlx5_rx.h | 14 +- drivers/net/mlx5/mlx5_rxq.c | 30 ++-- drivers/net/mlx5/mlx5_trigger.c | 2 +- drivers/net/mlx5/mlx5_tx.h | 18 +- drivers/net/mlx5/mlx5_txpp.c | 84 +++++----- drivers/net/mlx5/mlx5_txq.c | 12 +- drivers/net/mlx5/mlx5_utils.c | 10 +- drivers/net/mlx5/mlx5_utils.h | 4 +- drivers/net/null/rte_eth_null.c | 12 +- drivers/net/octeon_ep/cnxk_ep_rx.h | 5 +- drivers/net/octeon_ep/cnxk_ep_tx.c | 5 +- drivers/net/octeon_ep/cnxk_ep_vf.c | 8 +- drivers/net/octeon_ep/otx2_ep_vf.c | 8 +- drivers/net/octeon_ep/otx_ep_common.h | 4 +- drivers/net/octeon_ep/otx_ep_rxtx.c | 6 +- drivers/net/octeontx/octeontx_ethdev.c | 8 +- drivers/net/qede/base/bcm_osal.c | 6 +- drivers/net/ring/rte_eth_ring.c | 8 +- drivers/net/sfc/meson.build | 5 +- drivers/net/sfc/sfc_mae_counter.c | 30 ++-- drivers/net/sfc/sfc_repr_proxy.c | 8 +- drivers/net/sfc/sfc_stats.h | 8 +- drivers/net/thunderx/nicvf_rxtx.c | 9 +- drivers/net/thunderx/nicvf_struct.h | 4 +- drivers/net/txgbe/txgbe_ethdev.c | 12 +- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/virtio/virtio_ring.h | 4 +- drivers/net/virtio/virtio_user/virtio_user_dev.c | 12 +- drivers/net/virtio/virtqueue.h | 32 ++-- drivers/raw/ifpga/ifpga_rawdev.c | 9 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 24 +-- drivers/vdpa/mlx5/mlx5_vdpa.h | 14 +- drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 46 +++--- drivers/vdpa/mlx5/mlx5_vdpa_lm.c | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 4 +- examples/bbdev_app/main.c | 13 +- examples/l2fwd-event/l2fwd_common.h | 4 +- examples/l2fwd-event/l2fwd_event.c | 24 +-- examples/l2fwd-jobstats/main.c | 11 +- .../client_server_mp/mp_server/main.c | 6 +- examples/server_node_efd/efd_server/main.c | 6 +- examples/vhost/main.c | 32 ++-- examples/vhost/main.h | 4 +- examples/vhost/virtio_net.c | 13 +- examples/vhost_blk/vhost_blk.c | 8 +- examples/vm_power_manager/channel_monitor.c | 9 +- 183 files changed, 1653 insertions(+), 1522 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/46 net/mlx5: use rte stdatomic API
Replace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 6 +- drivers/net/mlx5/linux/mlx5_verbs.c | 9 ++- drivers/net/mlx5/mlx5.c | 9 ++- drivers/net/mlx5/mlx5.h | 66 ++++++++--------- drivers/net/mlx5/mlx5_flow.c | 37 +++++----- drivers/net/mlx5/mlx5_flow.h | 8 +- drivers/net/mlx5/mlx5_flow_aso.c | 43 ++++++----- drivers/net/mlx5/mlx5_flow_dv.c | 126 ++++++++++++++++---------------- drivers/net/mlx5/mlx5_flow_flex.c | 14 ++-- drivers/net/mlx5/mlx5_flow_hw.c | 61 +++++++++------- drivers/net/mlx5/mlx5_flow_meter.c | 30 ++++---- drivers/net/mlx5/mlx5_flow_quota.c | 32 ++++---- drivers/net/mlx5/mlx5_hws_cnt.c | 71 +++++++++--------- drivers/net/mlx5/mlx5_hws_cnt.h | 10 +-- drivers/net/mlx5/mlx5_rx.h | 14 ++-- drivers/net/mlx5/mlx5_rxq.c | 30 ++++---- drivers/net/mlx5/mlx5_trigger.c | 2 +- drivers/net/mlx5/mlx5_tx.h | 18 ++--- drivers/net/mlx5/mlx5_txpp.c | 84 ++++++++++----------- drivers/net/mlx5/mlx5_txq.c | 12 +-- drivers/net/mlx5/mlx5_utils.c | 10 +-- drivers/net/mlx5/mlx5_utils.h | 4 +- 22 files changed, 351 insertions(+), 345 deletions(-)
drivers/net/mlx5/linux/mlx5_ethdev_os.c +3 -3
@@ -1918,9 +1918,9 @@ int mlx5_txpp_map_hca_bar(struct rte_eth_dev *dev)return -ENOTSUP ; }/* Check there is no concurrent mapping in other thread. */ -if (!__atomic_compare_exchange_n (&ppriv->hca_bar, &expected, - base, false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (!rte_atomic_compare_exchange_strong_explicit (&ppriv->hca_bar, &expected, + base, + rte_memory_order_relaxed, rte_memory_order_relaxed))rte_mem_unmap (base,MLX5_ST_SZ_BYTES (initial_seg));return 0 ; }
drivers/net/mlx5/linux/mlx5_verbs.c +5 -4
@@ -1117,7 +1117,7 @@return 0 ; }/* Only need to check refcnt, 0 after "sh" is allocated. */ -if (!!(__atomic_fetch_add (&sh->self_lb.refcnt,1 , __ATOMIC_RELAXED))) { +if (!!(rte_atomic_fetch_add_explicit (&sh->self_lb.refcnt,1 , rte_memory_order_relaxed))) {MLX5_ASSERT (sh->self_lb.ibv_cq && sh->self_lb.qp); priv->lb_used =1 ;return 0 ;
@@ -1163,7 +1163,7 @@claim_zero (mlx5_glue->destroy_cq (sh->self_lb.ibv_cq)); sh->self_lb.ibv_cq = NULL; } -__atomic_fetch_sub (&sh->self_lb.refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&sh->self_lb.refcnt,1 , rte_memory_order_relaxed);return -rte_errno;#else RTE_SET_USED (dev);
@@ -1186,8 +1186,9 @@if (!priv->lb_used)return ; -MLX5_ASSERT (__atomic_load_n (&sh->self_lb.refcnt, __ATOMIC_RELAXED)); -if (!(__atomic_fetch_sub (&sh->self_lb.refcnt,1 , __ATOMIC_RELAXED) -1 )) { +MLX5_ASSERT (rte_atomic_load_explicit (&sh->self_lb.refcnt, rte_memory_order_relaxed)); +if (!(rte_atomic_fetch_sub_explicit (&sh->self_lb.refcnt,1 , + rte_memory_order_relaxed) -1 )) {if (sh->self_lb.qp) {claim_zero (mlx5_glue->destroy_qp (sh->self_lb.qp)); sh->self_lb.qp =NULL ;
drivers/net/mlx5/mlx5.c +5 -4
@@ -855,8 +855,8 @@ ct_pool = mng->pools[idx];for (i =0 ; i <MLX5_ASO_CT_ACTIONS_PER_POOL ; i++) { ct = &ct_pool->actions[i]; - val =__atomic_fetch_sub (&ct->refcnt,1 , - __ATOMIC_RELAXED); + val =rte_atomic_fetch_sub_explicit (&ct->refcnt,1 , + rte_memory_order_relaxed);MLX5_ASSERT (val ==1 );if (val >1 ) cnt++;
@@ -1082,7 +1082,8 @@DRV_LOG (ERR ,"Dynamic flex parser is not supported on HWS" );return -ENOTSUP ; } -if (__atomic_fetch_add (&priv->sh->srh_flex_parser.refcnt,1 , __ATOMIC_RELAXED) +1 >1 ) +if (rte_atomic_fetch_add_explicit (&priv->sh->srh_flex_parser.refcnt,1 , + rte_memory_order_relaxed) +1 >1 )return 0 ; priv->sh->srh_flex_parser.flex.devx_fp =mlx5_malloc (MLX5_MEM_ZERO ,sizeof (struct mlx5_flex_parser_devx ),0 ,SOCKET_ID_ANY );
@@ -1173,7 +1174,7 @@struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_internal_flex_parser_profile *fp = &priv->sh->srh_flex_parser; -if (__atomic_fetch_sub (&fp->refcnt,1 , __ATOMIC_RELAXED) -1 ) +if (rte_atomic_fetch_sub_explicit (&fp->refcnt,1 , rte_memory_order_relaxed) -1 )return ;mlx5_devx_cmd_destroy (fp->flex.devx_fp->devx_obj);mlx5_free (fp->flex.devx_fp);
drivers/net/mlx5/mlx5.h +33 -33
207 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.c +19 -18
@@ -4623,8 +4623,8 @@ struct mlx5_translated_action_handle { shared_rss =mlx5_ipool_get (priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS ], idx); -__atomic_fetch_add (&shared_rss->refcnt,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&shared_rss->refcnt,1 , + rte_memory_order_relaxed);return idx;default :break ;
@@ -7459,7 +7459,7 @@ struct mlx5_list_entry *if (tunnel) { flow->tunnel =1 ; flow->tunnel_id = tunnel->tunnel_id; -__atomic_fetch_add (&tunnel->refctn,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&tunnel->refctn,1 , rte_memory_order_relaxed);mlx5_free (default_miss_ctx.queue); }mlx5_flow_pop_thread_workspace ();
@@ -7470,10 +7470,10 @@ struct mlx5_list_entry *flow_mreg_del_copy_action (dev, flow);flow_drv_destroy (dev, flow);if (rss_desc->shared_rss) -__atomic_fetch_sub (&((struct mlx5_shared_action_rss *) +rte_atomic_fetch_sub_explicit (&((struct mlx5_shared_action_rss *)mlx5_ipool_get (priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS ], - rss_desc->shared_rss))->refcnt,1 , __ATOMIC_RELAXED); + rss_desc->shared_rss))->refcnt,1 , rte_memory_order_relaxed);mlx5_ipool_free (priv->flows[type], idx); rte_errno = ret;/* Restore rte_errno. */ ret = rte_errno;
@@ -7976,7 +7976,8 @@ struct rte_flow * tunnel =mlx5_find_tunnel_id (dev, flow->tunnel_id);RTE_VERIFY (tunnel); -if (!(__atomic_fetch_sub (&tunnel->refctn,1 , __ATOMIC_RELAXED) -1 )) +if (!(rte_atomic_fetch_sub_explicit (&tunnel->refctn,1 , + rte_memory_order_relaxed) -1 ))mlx5_flow_tunnel_free (dev, tunnel); }flow_mreg_del_copy_action (dev, flow);
@@ -9456,7 +9457,7 @@ struct mlx5_flow_workspace* {uint32_t pools_n, us; - pools_n =__atomic_load_n (&sh->sws_cmng.n_valid, __ATOMIC_RELAXED); + pools_n =rte_atomic_load_explicit (&sh->sws_cmng.n_valid, rte_memory_order_relaxed); us =MLX5_POOL_QUERY_FREQ_US / pools_n;DRV_LOG (DEBUG ,"Set alarm for %u pools each %u us" , pools_n, us);if (rte_eal_alarm_set (us, mlx5_flow_query_alarm, sh)) {
@@ -9558,17 +9559,17 @@ struct mlx5_flow_workspace*for (i =0 ; i <MLX5_COUNTERS_PER_POOL ; ++i) { cnt =MLX5_POOL_GET_CNT (pool, i); age_param =MLX5_CNT_TO_AGE (cnt); -if (__atomic_load_n (&age_param->state, - __ATOMIC_RELAXED) !=AGE_CANDIDATE ) +if (rte_atomic_load_explicit (&age_param->state, + rte_memory_order_relaxed) !=AGE_CANDIDATE )continue ;if (cur->data[i].hits != prev->data[i].hits) { -__atomic_store_n (&age_param->sec_since_last_hit,0 , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&age_param->sec_since_last_hit,0 , + rte_memory_order_relaxed);continue ; } -if (__atomic_fetch_add (&age_param->sec_since_last_hit, +if (rte_atomic_fetch_add_explicit (&age_param->sec_since_last_hit, time_delta, - __ATOMIC_RELAXED) + time_delta <= age_param->timeout) + rte_memory_order_relaxed) + time_delta <= age_param->timeout)continue ;/** * Hold the lock first, or if between the
@@ -9579,10 +9580,10 @@ struct mlx5_flow_workspace* priv = rte_eth_devices[age_param->port_id].data->dev_private; age_info =GET_PORT_AGE_INFO (priv);rte_spinlock_lock (&age_info->aged_sl); -if (__atomic_compare_exchange_n (&age_param->state, &expected, -AGE_TMOUT , false, - __ATOMIC_RELAXED, - __ATOMIC_RELAXED)) { +if (rte_atomic_compare_exchange_strong_explicit (&age_param->state, &expected, +AGE_TMOUT , + rte_memory_order_relaxed, + rte_memory_order_relaxed)) {TAILQ_INSERT_TAIL (&age_info->aged_counters, cnt, next);MLX5_AGE_SET (age_info,MLX5_AGE_EVENT_NEW ); }
@@ -11407,7 +11408,7 @@ struct tunnel_db_element_release_ctx { {struct tunnel_db_element_release_ctx *ctx = x; ctx->ret =0 ; -if (!(__atomic_fetch_sub (&tunnel->refctn,1 , __ATOMIC_RELAXED) -1 )) +if (!(rte_atomic_fetch_sub_explicit (&tunnel->refctn,1 , rte_memory_order_relaxed) -1 ))mlx5_flow_tunnel_free (dev, tunnel); }
drivers/net/mlx5/mlx5_flow.h +4 -4
@@ -1049,7 +1049,7 @@ struct mlx5_flow_tunnel {LIST_ENTRY (mlx5_flow_tunnel) chain;struct rte_flow_tunnel app_tunnel;/** app tunnel copy */ uint32_t tunnel_id;/** unique tunnel ID */ -uint32_t refctn; +RTE_ATOMIC (uint32_t ) refctn;struct rte_flow_action action;struct rte_flow_item item;struct mlx5_hlist *groups;/** tunnel groups */
@@ -1470,7 +1470,7 @@ struct rte_flow_pattern_template {struct mlx5dr_match_template *mt;/* mlx5 match template. */ uint64_t item_flags;/* Item layer flags. */ uint64_t orig_item_nb;/* Number of pattern items provided by the user (with END item). */ -uint32_t refcnt;/* Reference counter. */ +RTE_ATOMIC (uint32_t ) refcnt;/* Reference counter. */ /* * If true, then rule pattern should be prepended with * represented_port pattern item.
@@ -1502,7 +1502,7 @@ struct rte_flow_actions_template {uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint16_t recom_off;/* Offset of DR IPv6 routing push remove action. */ -uint32_t refcnt;/* Reference counter. */ +RTE_ATOMIC (uint32_t ) refcnt;/* Reference counter. */ uint8_t flex_item;/* flex item index. */ };
@@ -1855,7 +1855,7 @@ struct rte_flow_template_table {/* Shared RSS action structure */ struct mlx5_shared_action_rss {ILIST_ENTRY (uint32_t )next;/**< Index to the next RSS structure. */ -uint32_t refcnt;/**< Atomically accessed refcnt. */ +RTE_ATOMIC (uint32_t ) refcnt;/**< Atomically accessed refcnt. */ struct rte_flow_action_rss origin;/**< Original rte RSS action. */ uint8_t key[MLX5_RSS_HASH_KEY_LEN ];/**< RSS hash key. */ struct mlx5_ind_table_obj *ind_tbl;
drivers/net/mlx5/mlx5_flow_aso.c +21 -22
120 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_dv.c +63 -63
307 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_flex.c +7 -7
@@ -86,7 +86,7 @@MLX5_ASSERT (!item->refcnt);MLX5_ASSERT (!item->devx_fp); item->devx_fp =NULL ; -__atomic_store_n (&item->refcnt,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&item->refcnt,0 , rte_memory_order_release); priv->flex_item_map |=1u << idx; } }
@@ -107,7 +107,7 @@MLX5_ASSERT (!item->refcnt);MLX5_ASSERT (!item->devx_fp); item->devx_fp =NULL ; -__atomic_store_n (&item->refcnt,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&item->refcnt,0 , rte_memory_order_release); priv->flex_item_map &= ~(1u << idx);rte_spinlock_unlock (&priv->flex_item_sl); }
@@ -379,7 +379,7 @@return ret; }if (acquire) -__atomic_fetch_add (&flex->refcnt,1 , __ATOMIC_RELEASE); +rte_atomic_fetch_add_explicit (&flex->refcnt,1 , rte_memory_order_release);return ret; }
@@ -414,7 +414,7 @@ rte_errno = -EINVAL ;return -EINVAL ; } -__atomic_fetch_sub (&flex->refcnt,1 , __ATOMIC_RELEASE); +rte_atomic_fetch_sub_explicit (&flex->refcnt,1 , rte_memory_order_release);return 0 ; }
@@ -1337,7 +1337,7 @@ struct rte_flow_item_flex_handle * } flex->devx_fp = container_of(ent, struct mlx5_flex_parser_devx, entry);/* Mark initialized flex item valid. */ -__atomic_fetch_add (&flex->refcnt,1 , __ATOMIC_RELEASE); +rte_atomic_fetch_add_explicit (&flex->refcnt,1 , rte_memory_order_release);return (struct rte_flow_item_flex_handle *)flex; error:
@@ -1378,8 +1378,8 @@ struct rte_flow_item_flex_handle *RTE_FLOW_ERROR_TYPE_ITEM ,NULL , "invalid flex item handle value"); } -if (!__atomic_compare_exchange_n (&flex->refcnt, &old_refcnt,0 ,0 , - __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) { +if (!rte_atomic_compare_exchange_strong_explicit (&flex->refcnt, &old_refcnt,0 , + rte_memory_order_acquire, rte_memory_order_relaxed)) {rte_spinlock_unlock (&priv->flex_item_sl); return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
drivers/net/mlx5/mlx5_flow_hw.c +33 -28
169 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_meter.c +15 -15
@@ -2055,9 +2055,9 @@ struct mlx5_flow_meter_policy * NULL, "Meter profile id not valid.");/* Meter policy must exist. */ if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) { -__atomic_fetch_add +rte_atomic_fetch_add_explicit (&priv->sh->mtrmng->def_policy_ref_cnt, -1 , __ATOMIC_RELAXED); +1 , rte_memory_order_relaxed); domain_bitmap =MLX5_MTR_ALL_DOMAIN_BIT ;if (!priv->sh->config.dv_esw_en) domain_bitmap &= ~MLX5_MTR_DOMAIN_TRANSFER_BIT ;
@@ -2137,7 +2137,7 @@ struct mlx5_flow_meter_policy * fm->is_enable = params->meter_enable; fm->shared = !!shared; fm->color_aware = !!params->use_prev_mtr_color; -__atomic_fetch_add (&fm->profile->ref_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&fm->profile->ref_cnt,1 , rte_memory_order_relaxed);if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) { fm->def_policy =1 ; fm->flow_ipool =mlx5_ipool_create (&flow_ipool_cfg);
@@ -2166,7 +2166,7 @@ struct mlx5_flow_meter_policy * } fm->active_state = params->meter_enable;if (mtr_policy) -__atomic_fetch_add (&mtr_policy->ref_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&mtr_policy->ref_cnt,1 , rte_memory_order_relaxed);return 0 ; error:mlx5_flow_destroy_mtr_tbls (dev, fm);
@@ -2271,8 +2271,8 @@ struct mlx5_flow_meter_policy * NULL, "Failed to create devx meter."); } fm->active_state = params->meter_enable; -__atomic_fetch_add (&fm->profile->ref_cnt,1 , __ATOMIC_RELAXED); -__atomic_fetch_add (&policy->ref_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&fm->profile->ref_cnt,1 , rte_memory_order_relaxed); +rte_atomic_fetch_add_explicit (&policy->ref_cnt,1 , rte_memory_order_relaxed);return 0 ; }#endif
@@ -2295,7 +2295,7 @@ struct mlx5_flow_meter_policy *if (fmp ==NULL )return -1 ;/* Update dependencies. */ -__atomic_fetch_sub (&fmp->ref_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&fmp->ref_cnt,1 , rte_memory_order_relaxed); fm->profile =NULL ;/* Remove from list. */ if (!priv->sh->meter_aso_en) {
@@ -2313,15 +2313,15 @@ struct mlx5_flow_meter_policy * }mlx5_flow_destroy_mtr_tbls (dev, fm);if (fm->def_policy) -__atomic_fetch_sub (&priv->sh->mtrmng->def_policy_ref_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&priv->sh->mtrmng->def_policy_ref_cnt, +1 , rte_memory_order_relaxed);if (priv->sh->meter_aso_en) {if (!fm->def_policy) { mtr_policy =mlx5_flow_meter_policy_find (dev, fm->policy_id,NULL );if (mtr_policy) -__atomic_fetch_sub (&mtr_policy->ref_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&mtr_policy->ref_cnt, +1 , rte_memory_order_relaxed); fm->policy_id =0 ; } fm->def_policy =0 ;
@@ -2424,13 +2424,13 @@ struct mlx5_flow_meter_policy *RTE_MTR_ERROR_TYPE_UNSPECIFIED , NULL, "Meter object is being used.");/* Destroy the meter profile. */ -__atomic_fetch_sub (&fm->profile->ref_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&fm->profile->ref_cnt, +1 , rte_memory_order_relaxed);/* Destroy the meter policy. */ policy =mlx5_flow_meter_policy_find (dev, fm->policy_id,NULL ); -__atomic_fetch_sub (&policy->ref_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&policy->ref_cnt, +1 , rte_memory_order_relaxed);memset (fm,0 ,sizeof (struct mlx5_flow_meter_info ));return 0 ; }
drivers/net/mlx5/mlx5_flow_quota.c +16 -16
@@ -218,9 +218,9 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict,struct mlx5_quota *quota_obj = sq->elts[(sq->tail + i) & mask].quota_obj; -__atomic_compare_exchange_n ("a_obj->state, &state, -MLX5_QUOTA_STATE_READY , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED); +rte_atomic_compare_exchange_strong_explicit ("a_obj->state, &state, +MLX5_QUOTA_STATE_READY , + rte_memory_order_relaxed, rte_memory_order_relaxed); } }
@@ -278,7 +278,7 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict,rte_spinlock_lock (&sq->sqsl);mlx5_quota_cmd_completion_handle (sq);rte_spinlock_unlock (&sq->sqsl); -if (__atomic_load_n ("a_obj->state, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit ("a_obj->state, rte_memory_order_relaxed) ==MLX5_QUOTA_STATE_READY )return 0 ; }while (poll_cqe_times -=MLX5_ASO_WQE_CQE_RESPONSE_DELAY );
@@ -470,9 +470,9 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict, mlx5_quota_check_ready(struct mlx5_quota *qobj, struct rte_flow_error *error) { uint8_t state = MLX5_QUOTA_STATE_READY; -bool verdict =__atomic_compare_exchange_n - (&qobj->state, &state,MLX5_QUOTA_STATE_WAIT , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED); +bool verdict =rte_atomic_compare_exchange_strong_explicit + (&qobj->state, &state,MLX5_QUOTA_STATE_WAIT , + rte_memory_order_relaxed, rte_memory_order_relaxed); if (!verdict) return rte_flow_error_set(error, EBUSY,
@@ -507,8 +507,8 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict, ret =mlx5_quota_cmd_wqe (dev, qobj, mlx5_quota_wqe_query, qix, work_queue, async_job ? async_job : &sync_job, push,NULL );if (ret) { -__atomic_store_n (&qobj->state,MLX5_QUOTA_STATE_READY , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&qobj->state,MLX5_QUOTA_STATE_READY , + rte_memory_order_relaxed);return rte_flow_error_set (error,EAGAIN ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"try again" ); }
@@ -557,8 +557,8 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict, async_job ? async_job : &sync_job, push, (void *)(uintptr_t)update->conf);if (ret) { -__atomic_store_n (&qobj->state,MLX5_QUOTA_STATE_READY , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&qobj->state,MLX5_QUOTA_STATE_READY , + rte_memory_order_relaxed);return rte_flow_error_set (error,EAGAIN ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"try again" ); }
@@ -593,9 +593,9 @@ struct rte_flow_action_handle * NULL, "quota: failed to allocate quota object");return NULL ; } - verdict =__atomic_compare_exchange_n - (&qobj->state, &state,MLX5_QUOTA_STATE_WAIT , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED); + verdict =rte_atomic_compare_exchange_strong_explicit + (&qobj->state, &state,MLX5_QUOTA_STATE_WAIT , + rte_memory_order_relaxed, rte_memory_order_relaxed);if (!verdict) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"quota: new quota object has invalid state" );
@@ -616,8 +616,8 @@ struct rte_flow_action_handle * (void *)(uintptr_t)conf);if (ret) {mlx5_ipool_free (qctx->quota_ipool, id); -__atomic_store_n (&qobj->state,MLX5_QUOTA_STATE_FREE , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&qobj->state,MLX5_QUOTA_STATE_FREE , + rte_memory_order_relaxed);rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"quota: WR failure" );return 0 ;
drivers/net/mlx5/mlx5_hws_cnt.c +35 -36
161 lines not on this page · raw message
drivers/net/mlx5/mlx5_hws_cnt.h +5 -5
@@ -101,7 +101,7 @@ struct mlx5_hws_cnt_pool {LIST_ENTRY (mlx5_hws_cnt_pool) next; struct mlx5_hws_cnt_pool_cfg cfg __rte_cache_aligned; struct mlx5_hws_cnt_dcs_mng dcs_mng __rte_cache_aligned; - uint32_t query_gen __rte_cache_aligned; + RTE_ATOMIC(uint32_t) query_gen __rte_cache_aligned;struct mlx5_hws_cnt *pool;struct mlx5_hws_cnt_raw_data_mng *raw_mng;struct rte_ring *reuse_list;
@@ -134,10 +134,10 @@ enum {/* HWS counter age parameter. */ struct mlx5_hws_age_param { -uint32_t timeout;/* Aging timeout in seconds (atomically accessed). */ -uint32_t sec_since_last_hit; +RTE_ATOMIC (uint32_t ) timeout;/* Aging timeout in seconds (atomically accessed). */ +RTE_ATOMIC (uint32_t ) sec_since_last_hit;/* Time in seconds since last hit (atomically accessed). */ -uint16_t state;/* AGE state (atomically accessed). */ +RTE_ATOMIC (uint16_t ) state;/* AGE state (atomically accessed). */ uint64_t accumulator_last_hits;/* Last total value of hits for comparing. */ uint64_t accumulator_hits;
@@ -426,7 +426,7 @@ struct mlx5_hws_age_param { iidx =mlx5_hws_cnt_iidx (hpool, *cnt_id); hpool->pool[iidx].in_used = false; hpool->pool[iidx].query_gen_when_free = -__atomic_load_n (&hpool->query_gen, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&hpool->query_gen, rte_memory_order_relaxed);if (likely (queue !=NULL ) && cpool->cfg.host_cpool ==NULL ) qcache = hpool->cache->qcache[*queue];if (unlikely (qcache ==NULL )) {
drivers/net/mlx5/mlx5_rx.h +7 -7
@@ -173,7 +173,7 @@ struct mlx5_rxq_ctrl {/* RX queue private data. */ struct mlx5_rxq_priv {uint16_t idx;/* Queue index. */ -uint32_t refcnt;/* Reference counter. */ +RTE_ATOMIC (uint32_t ) refcnt;/* Reference counter. */ struct mlx5_rxq_ctrl *ctrl;/* Shared Rx Queue. */ LIST_ENTRY (mlx5_rxq_priv) owner_entry;/* Entry in shared rxq_ctrl. */ struct mlx5_priv *priv;/* Back pointer to private data. */
@@ -188,7 +188,7 @@ struct mlx5_rxq_priv {/* External RX queue descriptor. */ struct mlx5_external_rxq {uint32_t hw_id;/* Queue index in the Hardware. */ -uint32_t refcnt;/* Reference counter. */ +RTE_ATOMIC (uint32_t ) refcnt;/* Reference counter. */ };/* mlx5_rxq.c */
@@ -412,7 +412,7 @@ uint16_t mlx5_rx_burst_mprq_vec(void *dpdk_rxq, struct rte_mbuf **pkts,struct mlx5_mprq_buf *buf = (*rxq->mprq_bufs)[rq_idx];void *addr; -if (__atomic_load_n (&buf->refcnt, __ATOMIC_RELAXED) >1 ) { +if (rte_atomic_load_explicit (&buf->refcnt, rte_memory_order_relaxed) >1 ) {MLX5_ASSERT (rep !=NULL );/* Replace MPRQ buf. */ (*rxq->mprq_bufs)[rq_idx] = rep;
@@ -524,9 +524,9 @@ uint16_t mlx5_rx_burst_mprq_vec(void *dpdk_rxq, struct rte_mbuf **pkts,void *buf_addr;/* Increment the refcnt of the whole chunk. */ -__atomic_fetch_add (&buf->refcnt,1 , __ATOMIC_RELAXED); -MLX5_ASSERT (__atomic_load_n (&buf->refcnt, - __ATOMIC_RELAXED) <= strd_n +1 ); +rte_atomic_fetch_add_explicit (&buf->refcnt,1 , rte_memory_order_relaxed); +MLX5_ASSERT (rte_atomic_load_explicit (&buf->refcnt, + rte_memory_order_relaxed) <= strd_n +1 ); buf_addr =RTE_PTR_SUB (addr,RTE_PKTMBUF_HEADROOM );/* * MLX5 device doesn't use iova but it is necessary in a
@@ -666,7 +666,7 @@ uint16_t mlx5_rx_burst_mprq_vec(void *dpdk_rxq, struct rte_mbuf **pkts,if (!priv->ext_rxqs || queue_idx <RTE_PMD_MLX5_EXTERNAL_RX_QUEUE_ID_MIN )return false; rxq = &priv->ext_rxqs[queue_idx -RTE_PMD_MLX5_EXTERNAL_RX_QUEUE_ID_MIN ]; -return !!__atomic_load_n (&rxq->refcnt, __ATOMIC_RELAXED); +return !!rte_atomic_load_explicit (&rxq->refcnt, rte_memory_order_relaxed); }#define LWM_COOKIE_RXQID_OFFSET 0
drivers/net/mlx5/mlx5_rxq.c +15 -15
@@ -416,7 +416,7 @@ rte_errno =EINVAL ;return -rte_errno; } -return (__atomic_load_n (&rxq->refcnt, __ATOMIC_RELAXED) ==1 ); +return (rte_atomic_load_explicit (&rxq->refcnt, rte_memory_order_relaxed) ==1 ); }/* Fetches and drops all SW-owned and error CQEs to synchronize CQ. */
@@ -1319,7 +1319,7 @@memset (_m,0 ,sizeof (*buf)); buf->mp = mp; -__atomic_store_n (&buf->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&buf->refcnt,1 , rte_memory_order_relaxed);for (j =0 ; j != strd_n; ++j) { shinfo = &buf->shinfos[j]; shinfo->free_cb = mlx5_mprq_buf_free_cb;
@@ -2037,7 +2037,7 @@ struct mlx5_rxq_priv *struct mlx5_rxq_priv *rxq =mlx5_rxq_get (dev, idx);if (rxq !=NULL ) -__atomic_fetch_add (&rxq->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->refcnt,1 , rte_memory_order_relaxed);return rxq; }
@@ -2059,7 +2059,7 @@ struct mlx5_rxq_priv *if (rxq ==NULL )return 0 ; -return __atomic_fetch_sub (&rxq->refcnt,1 , __ATOMIC_RELAXED) -1 ; +return rte_atomic_fetch_sub_explicit (&rxq->refcnt,1 , rte_memory_order_relaxed) -1 ; }/**
@@ -2138,7 +2138,7 @@ struct mlx5_external_rxq * {struct mlx5_external_rxq *rxq =mlx5_ext_rxq_get (dev, idx); -__atomic_fetch_add (&rxq->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->refcnt,1 , rte_memory_order_relaxed);return rxq; }
@@ -2158,7 +2158,7 @@ struct mlx5_external_rxq * {struct mlx5_external_rxq *rxq =mlx5_ext_rxq_get (dev, idx); -return __atomic_fetch_sub (&rxq->refcnt,1 , __ATOMIC_RELAXED) -1 ; +return rte_atomic_fetch_sub_explicit (&rxq->refcnt,1 , rte_memory_order_relaxed) -1 ; }/**
@@ -2447,8 +2447,8 @@ struct mlx5_ind_table_obj * (memcmp(ind_tbl->queues, queues, ind_tbl->queues_n * sizeof(ind_tbl->queues[0])) == 0)) { -__atomic_fetch_add (&ind_tbl->refcnt,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&ind_tbl->refcnt,1 , + rte_memory_order_relaxed);break ; } }
@@ -2479,7 +2479,7 @@ struct mlx5_ind_table_obj *unsigned int ret;rte_rwlock_write_lock (&priv->ind_tbls_lock); - ret =__atomic_fetch_sub (&ind_tbl->refcnt,1 , __ATOMIC_RELAXED) -1 ; + ret =rte_atomic_fetch_sub_explicit (&ind_tbl->refcnt,1 , rte_memory_order_relaxed) -1 ;if (!ret)LIST_REMOVE (ind_tbl, next);rte_rwlock_write_unlock (&priv->ind_tbls_lock);
@@ -2561,7 +2561,7 @@ struct mlx5_ind_table_obj * }return ret; } -__atomic_fetch_add (&ind_tbl->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&ind_tbl->refcnt,1 , rte_memory_order_relaxed);return 0 ; }
@@ -2626,7 +2626,7 @@ struct mlx5_ind_table_obj * {uint32_t refcnt; - refcnt =__atomic_load_n (&ind_tbl->refcnt, __ATOMIC_RELAXED); + refcnt =rte_atomic_load_explicit (&ind_tbl->refcnt, rte_memory_order_relaxed);if (refcnt <=1 )return 0 ;/*
@@ -3258,8 +3258,8 @@ struct mlx5_hrxq * ext_rxq =mlx5_external_rx_queue_get_validate (port_id, dpdk_idx);if (ext_rxq ==NULL )return -rte_errno; -if (!__atomic_compare_exchange_n (&ext_rxq->refcnt, &unmapped,1 , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { +if (!rte_atomic_compare_exchange_strong_explicit (&ext_rxq->refcnt, &unmapped,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) {if (ext_rxq->hw_id != hw_idx) {DRV_LOG (ERR ,"Port %u external RxQ index %u " "is already mapped to HW index (requesting is "
@@ -3296,8 +3296,8 @@ struct mlx5_hrxq * rte_errno =EINVAL ;return -rte_errno; } -if (!__atomic_compare_exchange_n (&ext_rxq->refcnt, &mapped,0 , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { +if (!rte_atomic_compare_exchange_strong_explicit (&ext_rxq->refcnt, &mapped,0 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) {DRV_LOG (ERR ,"Port %u external RxQ index %u doesn't exist." , port_id, dpdk_idx); rte_errno =EINVAL ;
drivers/net/mlx5/mlx5_trigger.c +1 -1
@@ -1441,7 +1441,7 @@rte_delay_us_sleep (1000 * priv->rxqs_n);DRV_LOG (DEBUG ,"port %u stopping device" , dev->data->port_id);if (priv->sh->config.dv_flow_en ==2 ) { -if (!__atomic_load_n (&priv->hws_mark_refcnt, __ATOMIC_RELAXED)) +if (!rte_atomic_load_explicit (&priv->hws_mark_refcnt, rte_memory_order_relaxed))flow_hw_rxq_flag_set (dev, false); }else {mlx5_flow_stop_default (dev);
drivers/net/mlx5/mlx5_tx.h +9 -9
@@ -179,7 +179,7 @@ struct mlx5_txq_data { __extension__ struct mlx5_txq_ctrl { LIST_ENTRY(mlx5_txq_ctrl) next; /* Pointer to the next element. */ - uint32_t refcnt; /* Reference counter. */ + RTE_ATOMIC(uint32_t) refcnt; /* Reference counter. */ unsigned int socket; /* CPU socket ID for allocations. */ bool is_hairpin; /* Whether TxQ type is Hairpin. */ unsigned int max_inline_data; /* Max inline data. */
@@ -339,8 +339,8 @@ int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,* the service thread, data should be re-read. */ rte_compiler_barrier (); - ci =__atomic_load_n (&sh->txpp.ts.ci_ts, __ATOMIC_RELAXED); - ts =__atomic_load_n (&sh->txpp.ts.ts, __ATOMIC_RELAXED); + ci =rte_atomic_load_explicit (&sh->txpp.ts.ci_ts, rte_memory_order_relaxed); + ts =rte_atomic_load_explicit (&sh->txpp.ts.ts, rte_memory_order_relaxed);rte_compiler_barrier ();if (!((ts ^ ci) << (64 -MLX5_CQ_INDEX_WIDTH )))break ;
@@ -350,8 +350,8 @@ int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, mts -= ts;if (unlikely (mts >=UINT64_MAX /2 )) {/* We have negative integer, mts is in the past. */ -__atomic_fetch_add (&sh->txpp.err_ts_past, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&sh->txpp.err_ts_past, +1 , rte_memory_order_relaxed);return -1 ; } tick = sh->txpp.tick;
@@ -360,8 +360,8 @@ int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, mts = (mts + tick -1 ) / tick;if (unlikely (mts >= (1 <<MLX5_CQ_INDEX_WIDTH ) /2 -1 )) {/* We have mts is too distant future. */ -__atomic_fetch_add (&sh->txpp.err_ts_future, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&sh->txpp.err_ts_future, +1 , rte_memory_order_relaxed);return -1 ; } mts <<=64 -MLX5_CQ_INDEX_WIDTH ;
@@ -1743,8 +1743,8 @@ int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,/* Convert the timestamp into completion to wait. */ ts = *RTE_MBUF_DYNFIELD(loc->mbuf, txq->ts_offset, uint64_t *);if (txq->ts_last && ts < txq->ts_last) -__atomic_fetch_add (&txq->sh->txpp.err_ts_order, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&txq->sh->txpp.err_ts_order, +1 , rte_memory_order_relaxed); txq->ts_last = ts; wqe = txq->wqes + (txq->wqe_ci & txq->wqe_m); sh = txq->sh;
drivers/net/mlx5/mlx5_txpp.c +42 -42
155 lines not on this page · raw message
drivers/net/mlx5/mlx5_txq.c +6 -6
@@ -1108,7 +1108,7 @@ struct mlx5_txq_ctrl * rte_errno =ENOMEM ; goto error; } -__atomic_fetch_add (&tmpl->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&tmpl->refcnt,1 , rte_memory_order_relaxed); tmpl->is_hairpin = false;LIST_INSERT_HEAD (&priv->txqsctrl, tmpl, next);return tmpl;
@@ -1153,7 +1153,7 @@ struct mlx5_txq_ctrl * tmpl->txq.idx = idx; tmpl->hairpin_conf = *hairpin_conf; tmpl->is_hairpin = true; -__atomic_fetch_add (&tmpl->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&tmpl->refcnt,1 , rte_memory_order_relaxed);LIST_INSERT_HEAD (&priv->txqsctrl, tmpl, next);return tmpl; }
@@ -1178,7 +1178,7 @@ struct mlx5_txq_ctrl *if (txq_data) { ctrl = container_of(txq_data, struct mlx5_txq_ctrl, txq); -__atomic_fetch_add (&ctrl->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&ctrl->refcnt,1 , rte_memory_order_relaxed); }return ctrl; }
@@ -1203,7 +1203,7 @@ struct mlx5_txq_ctrl *if (priv->txqs ==NULL || (*priv->txqs)[idx] ==NULL )return 0 ; txq_ctrl = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq); -if (__atomic_fetch_sub (&txq_ctrl->refcnt,1 , __ATOMIC_RELAXED) -1 >1 ) +if (rte_atomic_fetch_sub_explicit (&txq_ctrl->refcnt,1 , rte_memory_order_relaxed) -1 >1 )return 1 ;if (txq_ctrl->obj) { priv->obj_ops.txq_obj_release (txq_ctrl->obj);
@@ -1219,7 +1219,7 @@ struct mlx5_txq_ctrl *txq_free_elts (txq_ctrl); dev->data->tx_queue_state[idx] =RTE_ETH_QUEUE_STATE_STOPPED ; } -if (!__atomic_load_n (&txq_ctrl->refcnt, __ATOMIC_RELAXED)) { +if (!rte_atomic_load_explicit (&txq_ctrl->refcnt, rte_memory_order_relaxed)) {if (!txq_ctrl->is_hairpin)mlx5_mr_btree_free (&txq_ctrl->txq.mr_ctrl.cache_bh);LIST_REMOVE (txq_ctrl, next);
@@ -1249,7 +1249,7 @@ struct mlx5_txq_ctrl *if (!(*priv->txqs)[idx])return -1 ; txq = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq); -return (__atomic_load_n (&txq->refcnt, __ATOMIC_RELAXED) ==1 ); +return (rte_atomic_load_explicit (&txq->refcnt, rte_memory_order_relaxed) ==1 ); }/**
drivers/net/mlx5/mlx5_utils.c +5 -5
@@ -203,7 +203,7 @@ struct mlx5_indexed_pool *struct mlx5_indexed_cache *gc, *lc, *olc =NULL ; lc = pool->cache[cidx]->lc; - gc =__atomic_load_n (&pool->gc, __ATOMIC_RELAXED); + gc =rte_atomic_load_explicit (&pool->gc, rte_memory_order_relaxed);if (gc && lc != gc) {mlx5_ipool_lock (pool);if (lc && !(--lc->ref_cnt))
@@ -266,8 +266,8 @@ struct mlx5_indexed_pool * pool->cache[cidx]->len = fetch_size -1 ;return pool->cache[cidx]->idx[pool->cache[cidx]->len]; } - trunk_idx = lc ?__atomic_load_n (&lc->n_trunk_valid, - __ATOMIC_ACQUIRE) :0 ; + trunk_idx = lc ?rte_atomic_load_explicit (&lc->n_trunk_valid, + rte_memory_order_acquire) :0 ; trunk_n = lc ? lc->n_trunk :0 ; cur_max_idx =mlx5_trunk_idx_offset_get (pool, trunk_idx);/* Check if index reach maximum. */
@@ -332,11 +332,11 @@ struct mlx5_indexed_pool * lc = p; lc->ref_cnt =1 ; pool->cache[cidx]->lc = lc; -__atomic_store_n (&pool->gc, p, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&pool->gc, p, rte_memory_order_relaxed); }/* Add trunk to trunks array. */ lc->trunks[trunk_idx] = trunk; -__atomic_fetch_add (&lc->n_trunk_valid,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&lc->n_trunk_valid,1 , rte_memory_order_relaxed);/* Enqueue half of the index to global. */ ts_idx =mlx5_trunk_idx_offset_get (pool, trunk_idx) +1 ; fetch_size = trunk->free >>1 ;
drivers/net/mlx5/mlx5_utils.h +2 -2
@@ -240,7 +240,7 @@ struct mlx5_indexed_trunk {struct mlx5_indexed_cache {struct mlx5_indexed_trunk **trunks; -volatile uint32_t n_trunk_valid;/* Trunks allocated. */ +volatile RTE_ATOMIC (uint32_t ) n_trunk_valid;/* Trunks allocated. */ uint32_t n_trunk;/* Trunk pointer array size. */ uint32_t ref_cnt;uint32_t len;
@@ -266,7 +266,7 @@ struct mlx5_indexed_pool {uint32_t free_list;/* Index to first free trunk. */ };struct { -struct mlx5_indexed_cache *gc; +RTE_ATOMIC (struct mlx5_indexed_cache *) gc;/* Global cache. */ struct mlx5_ipool_per_lcore *cache[RTE_MAX_LCORE +1 ];/* Local cache. */
Signature · 1 line
1.8.3.1
PATCH 2/46 net/ixgbe: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 14 ++++++++------ drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +8 -6
@@ -1130,7 +1130,7 @@ struct rte_ixgbe_xstats_name_off { }/* NOTE: review for potential ordering optimization */ -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);ixgbe_parse_devargs (eth_dev->data->dev_private, pci_dev->device.devargs);rte_eth_copy_pci_info (eth_dev, pci_dev);
@@ -1638,7 +1638,7 @@ static int ixgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) }/* NOTE: review for potential ordering optimization */ -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);ixgbevf_parse_devargs (eth_dev->data->dev_private, pci_dev->device.devargs);
@@ -4203,7 +4203,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,uint32_t timeout = timeout_ms ? timeout_ms :WARNING_TIMEOUT ;/* NOTE: review for potential ordering optimization */ -while (__atomic_load_n (&ad->link_thread_running, __ATOMIC_SEQ_CST)) { +while (rte_atomic_load_explicit (&ad->link_thread_running, rte_memory_order_seq_cst)) {msec_delay (1 ); timeout--;
@@ -4240,7 +4240,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG ;/* NOTE: review for potential ordering optimization */ -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);return 0 ; }
@@ -4336,7 +4336,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,if (ixgbe_get_media_type (hw) == ixgbe_media_type_fiber) {ixgbe_dev_wait_setup_link_complete (dev,0 );/* NOTE: review for potential ordering optimization */ -if (!__atomic_test_and_set (&ad->link_thread_running, __ATOMIC_SEQ_CST)) { +if (!rte_atomic_exchange_explicit (&ad->link_thread_running,1 , + rte_memory_order_seq_cst)) {/* To avoid race condition between threads, set * the IXGBE_FLAG_NEED_LINK_CONFIG flag only * when there is no link thread running.
@@ -4348,7 +4349,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,PMD_DRV_LOG (ERR ,"Create link thread failed!" );/* NOTE: review for potential ordering optimization */ -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , + rte_memory_order_seq_cst); } }else { PMD_DRV_LOG(ERR,
drivers/net/ixgbe/ixgbe_ethdev.h +1 -1
@@ -511,7 +511,7 @@ struct ixgbe_adapter {*/ uint8_t pflink_fullchk;uint8_t mac_ctrl_frame_fwd; -bool link_thread_running; +RTE_ATOMIC (bool ) link_thread_running;rte_thread_t link_thread_tid; };
drivers/net/ixgbe/ixgbe_rxtx.c +2 -2
@@ -1831,7 +1831,7 @@* Use acquire fence to ensure that status_error which includes * DD bit is loaded before loading of other descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); rxd = *rxdp;
@@ -2114,7 +2114,7 @@* Use acquire fence to ensure that status_error which includes * DD bit is loaded before loading of other descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); rxd = *rxdp;
Signature · 1 line
1.8.3.1
PATCH 3/46 net/iavf: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/iavf/iavf.h | 16 ++++++++-------- drivers/net/iavf/iavf_rxtx.c | 4 ++-- drivers/net/iavf/iavf_rxtx_vec_neon.c | 2 +- drivers/net/iavf/iavf_vchnl.c | 14 +++++++------- 4 files changed, 18 insertions(+), 18 deletions(-)
drivers/net/iavf/iavf.h +8 -8
@@ -238,8 +238,8 @@ struct iavf_info {struct virtchnl_vlan_caps vlan_v2_caps;uint64_t supported_rxdid;uint8_t *proto_xtr;/* proto xtr type for all queues */ -volatile enum virtchnl_ops pend_cmd;/* pending command not finished */ -uint32_t pend_cmd_count; +volatile RTE_ATOMIC (enum virtchnl_ops ) pend_cmd;/* pending command not finished */ +RTE_ATOMIC (uint32_t ) pend_cmd_count;int cmd_retval;/* return value of the cmd response from PF */ uint8_t *aq_resp;/* buffer to store the adminq response from PF */
@@ -456,13 +456,13 @@ struct iavf_cmd_info { _atomic_set_cmd(struct iavf_info *vf, enum virtchnl_ops ops) {enum virtchnl_ops op_unk =VIRTCHNL_OP_UNKNOWN ; -int ret =__atomic_compare_exchange (&vf->pend_cmd, &op_unk, &ops, -0 , __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); +int ret =rte_atomic_compare_exchange_strong_explicit (&vf->pend_cmd, &op_unk, ops, + rte_memory_order_acquire, rte_memory_order_acquire);if (!ret)PMD_DRV_LOG (ERR ,"There is incomplete cmd %d" , vf->pend_cmd); -__atomic_store_n (&vf->pend_cmd_count,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&vf->pend_cmd_count,1 , rte_memory_order_relaxed);return !ret; }
@@ -472,13 +472,13 @@ struct iavf_cmd_info { _atomic_set_async_response_cmd(struct iavf_info *vf, enum virtchnl_ops ops) {enum virtchnl_ops op_unk =VIRTCHNL_OP_UNKNOWN ; -int ret =__atomic_compare_exchange (&vf->pend_cmd, &op_unk, &ops, -0 , __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); +int ret =rte_atomic_compare_exchange_strong_explicit (&vf->pend_cmd, &op_unk, ops, + rte_memory_order_acquire, rte_memory_order_acquire);if (!ret)PMD_DRV_LOG (ERR ,"There is incomplete cmd %d" , vf->pend_cmd); -__atomic_store_n (&vf->pend_cmd_count,2 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&vf->pend_cmd_count,2 , rte_memory_order_relaxed);return !ret; }
drivers/net/iavf/iavf_rxtx.c +2 -2
@@ -2025,7 +2025,7 @@ struct iavf_txq_ops iavf_txq_release_mbufs_ops[] = { s[j] =rte_le_to_cpu_16 (rxdp[j].wb.status_error0);/* This barrier is to order loads of different words in the descriptor */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* Compute how many contiguous DD bits were set */ for (j =0 , nb_dd =0 ; j <IAVF_LOOK_AHEAD ; j++) {
@@ -2152,7 +2152,7 @@ struct iavf_txq_ops iavf_txq_release_mbufs_ops[] = { }/* This barrier is to order loads of different words in the descriptor */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* Compute how many contiguous DD bits were set */ for (j =0 , nb_dd =0 ; j <IAVF_LOOK_AHEAD ; j++) {
drivers/net/iavf/iavf_rxtx_vec_neon.c +1 -1
@@ -273,7 +273,7 @@ descs[0 ] =vld1q_u64 ((uint64_t *)(rxdp));/* Use acquire fence to order loads of descriptor qwords */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* A.2 reload qword0 to make it ordered after qword1 load */ descs[3 ] =vld1q_lane_u64 ((uint64_t *)(rxdp +3 ), descs[3 ],0 ); descs[2 ] =vld1q_lane_u64 ((uint64_t *)(rxdp +2 ), descs[2 ],0 );
drivers/net/iavf/iavf_vchnl.c +7 -7
@@ -41,7 +41,7 @@ struct iavf_event_element { };struct iavf_event_handler { -uint32_t ndev; +RTE_ATOMIC (uint32_t ) ndev;rte_thread_t tid;int fd[2 ];pthread_mutex_t lock;
@@ -129,7 +129,7 @@ struct iavf_event_handler { {struct iavf_event_handler *handler = &event_handler; -if (__atomic_fetch_add (&handler->ndev,1 , __ATOMIC_RELAXED) +1 !=1 ) +if (rte_atomic_fetch_add_explicit (&handler->ndev,1 , rte_memory_order_relaxed) +1 !=1 )return 0 ;#if defined(RTE_EXEC_ENV_IS_WINDOWS ) &&RTE_EXEC_ENV_IS_WINDOWS !=0 int err =_pipe (handler->fd,MAX_EVENT_PENDING ,O_BINARY );
@@ -137,7 +137,7 @@ struct iavf_event_handler {int err =pipe (handler->fd);#endif if (err !=0 ) { -__atomic_fetch_sub (&handler->ndev,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&handler->ndev,1 , rte_memory_order_relaxed);return -1 ; }
@@ -146,7 +146,7 @@ struct iavf_event_handler {if (rte_thread_create_internal_control (&handler->tid,"iavf-event" , iavf_dev_event_handle,NULL )) { -__atomic_fetch_sub (&handler->ndev,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&handler->ndev,1 , rte_memory_order_relaxed);return -1 ; }
@@ -158,7 +158,7 @@ struct iavf_event_handler { {struct iavf_event_handler *handler = &event_handler; -if (__atomic_fetch_sub (&handler->ndev,1 , __ATOMIC_RELAXED) -1 !=0 ) +if (rte_atomic_fetch_sub_explicit (&handler->ndev,1 , rte_memory_order_relaxed) -1 !=0 )return ;int unused =pthread_cancel ((pthread_t )handler->tid.opaque_id);
@@ -574,8 +574,8 @@ struct iavf_event_handler {/* read message and it's expected one */ if (msg_opc == vf->pend_cmd) {uint32_t cmd_count = -__atomic_fetch_sub (&vf->pend_cmd_count, -1 , __ATOMIC_RELAXED) -1 ; +rte_atomic_fetch_sub_explicit (&vf->pend_cmd_count, +1 , rte_memory_order_relaxed) -1 ;if (cmd_count ==0 )_notify_cmd (vf, msg_ret); }else {
Signature · 1 line
1.8.3.1
PATCH 4/46 net/ice: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/ice/base/ice_osdep.h | 4 ++-- drivers/net/ice/ice_dcf.c | 6 +++--- drivers/net/ice/ice_dcf.h | 2 +- drivers/net/ice/ice_dcf_ethdev.c | 8 ++++---- drivers/net/ice/ice_dcf_parent.c | 16 ++++++++-------- drivers/net/ice/ice_ethdev.c | 12 ++++++------ drivers/net/ice/ice_ethdev.h | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-)
drivers/net/ice/base/ice_osdep.h +2 -2
@@ -235,7 +235,7 @@ struct ice_lock { ice_alloc_dma_mem(__rte_unused struct ice_hw *hw, struct ice_dma_mem *mem, u64 size) { - static uint64_t ice_dma_memzone_id; + static RTE_ATOMIC(uint64_t) ice_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];
@@ -243,7 +243,7 @@ struct ice_lock {return NULL ;snprintf (z_name,sizeof (z_name),"ice_dma_%" PRIu64, -__atomic_fetch_add (&ice_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&ice_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_bounded (z_name, size,SOCKET_ID_ANY ,0 ,0 ,RTE_PGSIZE_2M );if (!mz)
drivers/net/ice/ice_dcf.c +3 -3
@@ -764,7 +764,7 @@ struct virtchnl_proto_hdrs ice_dcf_inner_ipv6_sctp_tmplt = {rte_spinlock_init (&hw->vc_cmd_queue_lock);TAILQ_INIT (&hw->vc_cmd_queue); -__atomic_store_n (&hw->vsi_update_thread_num,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->vsi_update_thread_num,0 , rte_memory_order_relaxed); hw->arq_buf =rte_zmalloc ("arq_buf" ,ICE_DCF_AQ_BUF_SZ ,0 );if (hw->arq_buf ==NULL ) {
@@ -888,8 +888,8 @@ struct virtchnl_proto_hdrs ice_dcf_inner_ipv6_sctp_tmplt = { ice_dcf_dev_interrupt_handler, hw);/* Wait for all `ice-thread` threads to exit. */ -while (__atomic_load_n (&hw->vsi_update_thread_num, - __ATOMIC_ACQUIRE) !=0 ) +while (rte_atomic_load_explicit (&hw->vsi_update_thread_num, + rte_memory_order_acquire) !=0 )rte_delay_ms (ICE_DCF_CHECK_INTERVAL );ice_dcf_mode_disable (hw);
drivers/net/ice/ice_dcf.h +1 -1
@@ -105,7 +105,7 @@ struct ice_dcf_hw {void (*vc_event_msg_cb)(struct ice_dcf_hw *dcf_hw,uint8_t *msg,uint16_t msglen); -int vsi_update_thread_num; +RTE_ATOMIC (int ) vsi_update_thread_num;uint8_t *arq_buf;
drivers/net/ice/ice_dcf_ethdev.c +4 -4
@@ -1743,7 +1743,7 @@ static int ice_dcf_xstats_get(struct rte_eth_dev *dev, ice_dcf_adminq_need_retry(struct ice_adapter *ad) {return ad->hw.dcf_enabled && - !__atomic_load_n (&ad->dcf_state_on, __ATOMIC_RELAXED); + !rte_atomic_load_explicit (&ad->dcf_state_on, rte_memory_order_relaxed); }/* Add UDP tunneling port */
@@ -1944,12 +1944,12 @@ static int ice_dcf_xstats_get(struct rte_eth_dev *dev, adapter->real_hw.vc_event_msg_cb = ice_dcf_handle_pf_event_msg;if (ice_dcf_init_hw (eth_dev, &adapter->real_hw) !=0 ) {PMD_INIT_LOG (ERR ,"Failed to init DCF hardware" ); -__atomic_store_n (&parent_adapter->dcf_state_on, false, - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&parent_adapter->dcf_state_on, false, + rte_memory_order_relaxed);return -1 ; } -__atomic_store_n (&parent_adapter->dcf_state_on, true, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&parent_adapter->dcf_state_on, true, rte_memory_order_relaxed);if (ice_dcf_init_parent_adapter (eth_dev) !=0 ) {PMD_INIT_LOG (ERR ,"Failed to init DCF parent adapter" );
drivers/net/ice/ice_dcf_parent.c +8 -8
@@ -123,8 +123,8 @@ struct ice_dcf_reset_event_param { container_of(hw, struct ice_dcf_adapter, real_hw);struct ice_adapter *parent_adapter = &adapter->parent; -__atomic_fetch_add (&hw->vsi_update_thread_num,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&hw->vsi_update_thread_num,1 , + rte_memory_order_relaxed);rte_thread_detach (rte_thread_self ());
@@ -133,8 +133,8 @@ struct ice_dcf_reset_event_param {rte_spinlock_lock (&vsi_update_lock);if (!ice_dcf_handle_vsi_update_event (hw)) { -__atomic_store_n (&parent_adapter->dcf_state_on, true, - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&parent_adapter->dcf_state_on, true, + rte_memory_order_relaxed);ice_dcf_update_vf_vsi_map (&adapter->parent.hw, hw->num_vfs, hw->vf_vsi_map); }
@@ -156,8 +156,8 @@ struct ice_dcf_reset_event_param {free (param); -__atomic_fetch_sub (&hw->vsi_update_thread_num,1 , - __ATOMIC_RELEASE); +rte_atomic_fetch_sub_explicit (&hw->vsi_update_thread_num,1 , + rte_memory_order_release);return 0 ; }
@@ -269,8 +269,8 @@ struct ice_dcf_reset_event_param {PMD_DRV_LOG (DEBUG ,"VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE event : VF%u with VSI num %u" , pf_msg->event_data.vf_vsi_map.vf_id, pf_msg->event_data.vf_vsi_map.vsi_id); -__atomic_store_n (&parent_adapter->dcf_state_on, false, - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&parent_adapter->dcf_state_on, false, + rte_memory_order_relaxed);start_vsi_reset_thread (dcf_hw, true, pf_msg->event_data.vf_vsi_map.vf_id);break ;
drivers/net/ice/ice_ethdev.c +6 -6
@@ -4062,9 +4062,9 @@ static int ice_init_rss(struct ice_pf *pf)struct rte_eth_link *src = &dev->data->dev_link;/* NOTE: review for potential ordering optimization */ -if (!__atomic_compare_exchange_n ((uint64_t *)dst, (uint64_t *)dst, - *(uint64_t *)src,0 , - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) + if (!rte_atomic_compare_exchange_strong_explicit((uint64_t __rte_atomic *)dst, + (uint64_t *)dst, *(uint64_t *)src, + rte_memory_order_seq_cst, rte_memory_order_seq_cst))return -1 ;return 0 ;
@@ -4078,9 +4078,9 @@ static int ice_init_rss(struct ice_pf *pf)struct rte_eth_link *src = link;/* NOTE: review for potential ordering optimization */ -if (!__atomic_compare_exchange_n ((uint64_t *)dst, (uint64_t *)dst, - *(uint64_t *)src,0 , - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) + if (!rte_atomic_compare_exchange_strong_explicit((uint64_t __rte_atomic *)dst, + (uint64_t *)dst, *(uint64_t *)src, + rte_memory_order_seq_cst, rte_memory_order_seq_cst))return -1 ;return 0 ;
drivers/net/ice/ice_ethdev.h +1 -1
@@ -621,7 +621,7 @@ struct ice_adapter {struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS ];struct ice_rss_prof_info rss_prof_info[ICE_MAX_PTGS ];/* True if DCF state of the associated PF is on */ -bool dcf_state_on; +RTE_ATOMIC (bool ) dcf_state_on;/* Set bit if the engine is disabled */ unsigned long disabled_engine_mask;struct ice_parser *psr;
Signature · 1 line
1.8.3.1
PATCH 5/46 net/i40e: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/i40e/i40e_ethdev.c | 4 ++-- drivers/net/i40e/i40e_rxtx.c | 6 +++--- drivers/net/i40e/i40e_rxtx_vec_neon.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -4687,7 +4687,7 @@ enum i40e_status_code u64 size, u32 alignment) { -static uint64_t i40e_dma_memzone_id; +static RTE_ATOMIC (uint64_t ) i40e_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];
@@ -4695,7 +4695,7 @@ enum i40e_status_codereturn I40E_ERR_PARAM ;snprintf (z_name,sizeof (z_name),"i40e_dma_%" PRIu64, -__atomic_fetch_add (&i40e_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&i40e_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_bounded (z_name, size,SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG , alignment,RTE_PGSIZE_2M );if (!mz)
drivers/net/i40e/i40e_rxtx.c +3 -3
@@ -486,7 +486,7 @@ }/* This barrier is to order loads of different words in the descriptor */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* Compute how many status bits were set */ for (j =0 , nb_dd =0 ; j <I40E_LOOK_AHEAD ; j++) {
@@ -745,7 +745,7 @@* Use acquire fence to ensure that qword1 which includes DD * bit is loaded before loading of other descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); rxd = *rxdp; nb_hold++;
@@ -867,7 +867,7 @@* Use acquire fence to ensure that qword1 which includes DD * bit is loaded before loading of other descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); rxd = *rxdp; nb_hold++;
drivers/net/i40e/i40e_rxtx_vec_neon.c +1 -1
@@ -425,7 +425,7 @@ descs[0 ] =vld1q_u64 ((uint64_t *)(rxdp));/* Use acquire fence to order loads of descriptor qwords */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* A.2 reload qword0 to make it ordered after qword1 load */ descs[3 ] =vld1q_lane_u64 ((uint64_t *)(rxdp +3 ), descs[3 ],0 ); descs[2 ] =vld1q_lane_u64 ((uint64_t *)(rxdp +2 ), descs[2 ],0 );
Signature · 1 line
1.8.3.1
PATCH 6/46 net/hns3: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/hns3/hns3_cmd.c | 18 ++++++------ drivers/net/hns3/hns3_dcb.c | 2 +- drivers/net/hns3/hns3_ethdev.c | 36 +++++++++++------------ drivers/net/hns3/hns3_ethdev.h | 32 ++++++++++----------- drivers/net/hns3/hns3_ethdev_vf.c | 60 +++++++++++++++++++-------------------- drivers/net/hns3/hns3_intr.c | 36 +++++++++++------------ drivers/net/hns3/hns3_intr.h | 4 +-- drivers/net/hns3/hns3_mbx.c | 6 ++-- drivers/net/hns3/hns3_mp.c | 6 ++-- drivers/net/hns3/hns3_rxtx.c | 10 +++---- drivers/net/hns3/hns3_tm.c | 4 +-- 11 files changed, 107 insertions(+), 107 deletions(-)
drivers/net/hns3/hns3_cmd.c +9 -9
@@ -44,12 +44,12 @@ hns3_allocate_dma_mem(struct hns3_hw *hw, struct hns3_cmq_ring *ring, uint64_t size, uint32_t alignment) { - static uint64_t hns3_dma_memzone_id; + static RTE_ATOMIC(uint64_t) hns3_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];snprintf (z_name,sizeof (z_name),"hns3_dma_%" PRIu64, -__atomic_fetch_add (&hns3_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&hns3_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_bounded (z_name, size,SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG , alignment,RTE_PGSIZE_2M );
@@ -198,8 +198,8 @@hns3_err (hw,"wrong cmd addr(%0x) head (%u, %u-%u)" , addr, head, csq->next_to_use, csq->next_to_clean);if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -__atomic_store_n (&hw->reset.disable_cmd,1 , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , + rte_memory_order_relaxed);hns3_schedule_delayed_reset (HNS3_DEV_HW_TO_ADAPTER (hw)); }
@@ -313,7 +313,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)if (hns3_cmd_csq_done (hw))return 0 ; -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) {hns3_err (hw,"Don't wait for reply because of disable_cmd" );return -EBUSY ;
@@ -360,7 +360,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)int retval;uint32_t ntc; -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed))return -EBUSY ;rte_spinlock_lock (&hw->cmq.csq.lock);
@@ -747,7 +747,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw) ret = -EBUSY ; goto err_cmd_init; } -__atomic_store_n (&hw->reset.disable_cmd,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,0 , rte_memory_order_relaxed); ret =hns3_cmd_query_firmware_version_and_capability (hw);if (ret) {
@@ -790,7 +790,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)return 0 ; err_cmd_init: -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);return ret; }
@@ -819,7 +819,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)if (!hns->is_vf) (void )hns3_firmware_compat_config (hw, false); -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);/* * A delay is added to ensure that the register cleanup operations
drivers/net/hns3/hns3_dcb.c +1 -1
@@ -648,7 +648,7 @@* and configured directly to the hardware in the RESET_STAGE_RESTORE * stage of the reset process. */ -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 ) {for (i =0 ; i < hw->rss_ind_tbl_size; i++) rss_cfg->rss_indirection_tbl[i] = i % hw->alloc_rss_size;
drivers/net/hns3/hns3_ethdev.c +18 -18
@@ -99,7 +99,7 @@ struct hns3_intr_state { };static enum hns3_reset_level hns3_get_reset_level (struct hns3_adapter *hns, -uint64_t *levels); +RTE_ATOMIC (uint64_t ) *levels);static int hns3_dev_mtu_set (struct rte_eth_dev *dev,uint16_t mtu);static int hns3_vlan_pvid_configure (struct hns3_adapter *hns,uint16_t pvid,int on);
@@ -134,7 +134,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, {struct hns3_hw *hw = &hns->hw; -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);hns3_atomic_set_bit (HNS3_IMP_RESET , &hw->reset.pending); *vec_val =BIT (HNS3_VECTOR0_IMPRESET_INT_B ); hw->reset.stats.imp_cnt++;
@@ -148,7 +148,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, {struct hns3_hw *hw = &hns->hw; -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);hns3_atomic_set_bit (HNS3_GLOBAL_RESET , &hw->reset.pending); *vec_val =BIT (HNS3_VECTOR0_GLOBALRESET_INT_B ); hw->reset.stats.global_cnt++;
@@ -1151,7 +1151,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* ensure that the hardware configuration remains unchanged before and * after reset. */ -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 ) { hw->port_base_vlan_cfg.state =HNS3_PORT_BASE_VLAN_DISABLE ; hw->port_base_vlan_cfg.pvid =HNS3_INVALID_PVID ; }
@@ -1175,7 +1175,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* we will restore configurations to hardware in hns3_restore_vlan_table * and hns3_restore_vlan_conf later. */ -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 ) { ret =hns3_vlan_pvid_configure (hns,HNS3_INVALID_PVID ,0 );if (ret) {hns3_err (hw,"pvid set fail in pf, ret =%d" , ret);
@@ -5059,7 +5059,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,int ret;PMD_INIT_FUNC_TRACE (); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed))return -EBUSY ;rte_spinlock_lock (&hw->lock);
@@ -5150,7 +5150,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* during reset and is required to be released after the reset is * completed. */ -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 )hns3_dev_release_mbufs (hns); ret =hns3_cfg_mac_mode (hw, false);
@@ -5158,7 +5158,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,return ret; hw->mac.link_status =RTE_ETH_LINK_DOWN ; -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed) ==0 ) {hns3_configure_all_mac_addr (hns, true); ret =hns3_reset_all_tqps (hns);if (ret) {
@@ -5184,7 +5184,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,hns3_stop_rxtx_datapath (dev);rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 ) {hns3_tm_dev_stop_proc (hw);hns3_config_mac_tnl_int (hw, false);hns3_stop_tqps (hw);
@@ -5577,7 +5577,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, last_req =hns3_get_reset_level (hns, &hw->reset.pending);if (last_req ==HNS3_NONE_RESET || last_req < new_req) { -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);hns3_schedule_delayed_reset (hns);hns3_warn (hw,"High level reset detected, delay do reset" );return true;
@@ -5677,7 +5677,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, }static enum hns3_reset_level -hns3_get_reset_level (struct hns3_adapter *hns,uint64_t *levels) +hns3_get_reset_level (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels) {struct hns3_hw *hw = &hns->hw;enum hns3_reset_level reset_level =HNS3_NONE_RESET ;
@@ -5737,7 +5737,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* any mailbox handling or command to firmware is only valid * after hns3_cmd_init is called. */ -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed); hw->reset.stats.request_cnt++;break ;case HNS3_IMP_RESET :
@@ -5792,7 +5792,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* from table space. Hence, for function reset software intervention is * required to delete the entries */ -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED) ==0 ) +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed) ==0 )hns3_configure_all_mc_mac_addr (hns, true);rte_spinlock_unlock (&hw->lock);
@@ -5913,10 +5913,10 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* The interrupt may have been lost. It is necessary to handle * the interrupt to recover from the error. */ -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) ==SCHEDULE_DEFERRED ) { -__atomic_store_n (&hw->reset.schedule,SCHEDULE_REQUESTED , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_REQUESTED , + rte_memory_order_relaxed);hns3_err (hw,"Handling interrupts in delayed tasks" );hns3_interrupt_handler (&rte_eth_devices[hw->data->port_id]); reset_level =hns3_get_reset_level (hns, &hw->reset.pending);
@@ -5925,7 +5925,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,hns3_atomic_set_bit (HNS3_IMP_RESET , &hw->reset.pending); } } -__atomic_store_n (&hw->reset.schedule,SCHEDULE_NONE , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_NONE , rte_memory_order_relaxed);/* * Check if there is any ongoing reset in the hardware. This status can
@@ -6576,7 +6576,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, hw->adapter_state =HNS3_NIC_INITIALIZED ; -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) ==SCHEDULE_PENDING ) {hns3_err (hw,"Reschedule reset service after dev_init" );hns3_schedule_reset (hns);
drivers/net/hns3/hns3_ethdev.h +16 -16
@@ -401,17 +401,17 @@ enum hns3_schedule {struct hns3_reset_data {enum hns3_reset_stage stage; -uint16_t schedule; +RTE_ATOMIC (uint16_t ) schedule;/* Reset flag, covering the entire reset process */ -uint16_t resetting; +RTE_ATOMIC (uint16_t ) resetting;/* Used to disable sending cmds during reset */ -uint16_t disable_cmd; +RTE_ATOMIC (uint16_t ) disable_cmd;/* The reset level being processed */ enum hns3_reset_level level;/* Reset level set, each bit represents a reset level */ -uint64_t pending; +RTE_ATOMIC (uint64_t ) pending;/* Request reset level set, from interrupt or mailbox */ -uint64_t request; +RTE_ATOMIC (uint64_t ) request;int attempts;/* Reset failure retry */ int retries;/* Timeout failure retry in reset_post */ /*
@@ -499,7 +499,7 @@ struct hns3_hw {* by dev_set_link_up() or dev_start(). */ bool set_link_down; -unsigned int secondary_cnt;/* Number of secondary processes init'd. */ +RTE_ATOMIC (unsigned int ) secondary_cnt;/* Number of secondary processes init'd. */ struct hns3_tqp_stats tqp_stats;/* Include Mac stats | Rx stats | Tx stats */ struct hns3_mac_stats mac_stats;
@@ -844,7 +844,7 @@ struct hns3_vf {struct hns3_adapter *adapter;/* Whether PF support push link status change to VF */ -uint16_t pf_push_lsc_cap; +RTE_ATOMIC (uint16_t ) pf_push_lsc_cap;/* * If PF support push link status change, VF still need send request to
@@ -853,7 +853,7 @@ struct hns3_vf {*/ uint16_t req_link_info_cnt; -uint16_t poll_job_started;/* whether poll job is started */ +RTE_ATOMIC (uint16_t ) poll_job_started;/* whether poll job is started */ };struct hns3_adapter {
@@ -997,32 +997,32 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg) hns3_read_reg((a)->io_base, (reg))static inline uint64_t -hns3_atomic_test_bit (unsigned int nr,volatile uint64_t *addr) +hns3_atomic_test_bit (unsigned int nr,volatile RTE_ATOMIC (uint64_t ) *addr) {uint64_t res; - res = (__atomic_load_n (addr, __ATOMIC_RELAXED) & (1UL << nr)) !=0 ; + res = (rte_atomic_load_explicit (addr, rte_memory_order_relaxed) & (1UL << nr)) !=0 ;return res; }static inline void -hns3_atomic_set_bit (unsigned int nr,volatile uint64_t *addr) +hns3_atomic_set_bit (unsigned int nr,volatile RTE_ATOMIC (uint64_t ) *addr) { -__atomic_fetch_or (addr, (1UL << nr), __ATOMIC_RELAXED); +rte_atomic_fetch_or_explicit (addr, (1UL << nr), rte_memory_order_relaxed); }static inline void -hns3_atomic_clear_bit (unsigned int nr,volatile uint64_t *addr) +hns3_atomic_clear_bit (unsigned int nr,volatile RTE_ATOMIC (uint64_t ) *addr) { -__atomic_fetch_and (addr, ~(1UL << nr), __ATOMIC_RELAXED); +rte_atomic_fetch_and_explicit (addr, ~(1UL << nr), rte_memory_order_relaxed); }static inline uint64_t -hns3_test_and_clear_bit (unsigned int nr,volatile uint64_t *addr) +hns3_test_and_clear_bit (unsigned int nr,volatile RTE_ATOMIC (uint64_t ) *addr) {uint64_t mask = (1UL << nr); -return __atomic_fetch_and (addr, ~mask, __ATOMIC_RELAXED) & mask; +return rte_atomic_fetch_and_explicit (addr, ~mask, rte_memory_order_relaxed) & mask; }int
drivers/net/hns3/hns3_ethdev_vf.c +30 -30
202 lines not on this page · raw message
drivers/net/hns3/hns3_intr.c +18 -18
@@ -2033,7 +2033,7 @@ enum hns3_hw_err_report_type {static int hns3_handle_hw_error (struct hns3_adapter *hns,struct hns3_cmd_desc *desc, -int num,uint64_t *levels, +int num,RTE_ATOMIC (uint64_t ) *levels,enum hns3_hw_err_report_type err_type) {const struct hns3_hw_error_desc *err = pf_ras_err_tbl;
@@ -2104,7 +2104,7 @@ enum hns3_hw_err_report_type { }void -hns3_handle_msix_error (struct hns3_adapter *hns,uint64_t *levels) +hns3_handle_msix_error (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels) {uint32_t mpf_bd_num, pf_bd_num, bd_num;struct hns3_hw *hw = &hns->hw;
@@ -2151,7 +2151,7 @@ enum hns3_hw_err_report_type { }void -hns3_handle_ras_error (struct hns3_adapter *hns,uint64_t *levels) +hns3_handle_ras_error (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels) {uint32_t mpf_bd_num, pf_bd_num, bd_num;struct hns3_hw *hw = &hns->hw;
@@ -2402,7 +2402,7 @@ enum hns3_hw_err_report_type { hw->reset.request =0 ; hw->reset.pending =0 ; hw->reset.resetting =0 ; -__atomic_store_n (&hw->reset.disable_cmd,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,0 , rte_memory_order_relaxed); hw->reset.wait_data =rte_zmalloc ("wait_data" ,sizeof (struct hns3_wait_data ),0 );if (!hw->reset.wait_data) {
@@ -2419,8 +2419,8 @@ enum hns3_hw_err_report_type {/* Reschedule the reset process after successful initialization */ if (hw->adapter_state ==HNS3_NIC_UNINITIALIZED ) { -__atomic_store_n (&hw->reset.schedule,SCHEDULE_PENDING , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_PENDING , + rte_memory_order_relaxed);return ; }
@@ -2428,15 +2428,15 @@ enum hns3_hw_err_report_type {return ;/* Schedule restart alarm if it is not scheduled yet */ -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) ==SCHEDULE_REQUESTED )return ; -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) ==SCHEDULE_DEFERRED )rte_eal_alarm_cancel (hw->reset.ops->reset_service, hns); -__atomic_store_n (&hw->reset.schedule,SCHEDULE_REQUESTED , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_REQUESTED , + rte_memory_order_relaxed);rte_eal_alarm_set (SWITCH_CONTEXT_US , hw->reset.ops->reset_service, hns); }
@@ -2453,11 +2453,11 @@ enum hns3_hw_err_report_type {return ; } -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) != +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) !=SCHEDULE_NONE )return ; -__atomic_store_n (&hw->reset.schedule,SCHEDULE_DEFERRED , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_DEFERRED , + rte_memory_order_relaxed);rte_eal_alarm_set (DEFERRED_SCHED_US , hw->reset.ops->reset_service, hns); }
@@ -2537,7 +2537,7 @@ enum hns3_hw_err_report_type { }static void -hns3_clear_reset_level (struct hns3_hw *hw,uint64_t *levels) +hns3_clear_reset_level (struct hns3_hw *hw,RTE_ATOMIC (uint64_t ) *levels) {uint64_t merge_cnt = hw->reset.stats.merge_cnt;uint64_t tmp;
@@ -2633,7 +2633,7 @@ enum hns3_hw_err_report_type {* Regardless of whether the execution is successful or not, the * flow after execution must be continued. */ -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) (void )hns3_cmd_init (hw); reset_fail: hw->reset.attempts =0 ;
@@ -2661,7 +2661,7 @@ enum hns3_hw_err_report_type {int ret;if (hw->reset.stage ==RESET_STAGE_NONE ) { -__atomic_store_n (&hns->hw.reset.resetting,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hns->hw.reset.resetting,1 , rte_memory_order_relaxed); hw->reset.stage =RESET_STAGE_DOWN ;hns3_report_reset_begin (hw); ret = hw->reset.ops->stop_service (hns);
@@ -2750,7 +2750,7 @@ enum hns3_hw_err_report_type {hns3_notify_reset_ready (hw, false);hns3_clear_reset_level (hw, &hw->reset.pending);hns3_clear_reset_status (hw); -__atomic_store_n (&hns->hw.reset.resetting,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hns->hw.reset.resetting,0 , rte_memory_order_relaxed); hw->reset.attempts =0 ; hw->reset.stats.success_cnt++; hw->reset.stage =RESET_STAGE_NONE ;
@@ -2812,7 +2812,7 @@ enum hns3_hw_err_report_type { hw->reset.mbuf_deferred_free = false; }rte_spinlock_unlock (&hw->lock); -__atomic_store_n (&hns->hw.reset.resetting,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hns->hw.reset.resetting,0 , rte_memory_order_relaxed); hw->reset.stage =RESET_STAGE_NONE ;hns3_clock_gettime (&tv);timersub (&tv, &hw->reset.start_time, &tv_delta);
drivers/net/hns3/hns3_intr.h +2 -2
@@ -171,8 +171,8 @@ struct hns3_hw_error_desc { };int hns3_enable_hw_error_intr (struct hns3_adapter *hns,bool en); -void hns3_handle_msix_error (struct hns3_adapter *hns,uint64_t *levels); -void hns3_handle_ras_error (struct hns3_adapter *hns,uint64_t *levels); +void hns3_handle_msix_error (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels); +void hns3_handle_ras_error (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels);void hns3_config_mac_tnl_int (struct hns3_hw *hw,bool en);void hns3_handle_error (struct hns3_adapter *hns);
drivers/net/hns3/hns3_mbx.c +3 -3
@@ -65,7 +65,7 @@ mbx_time_limit = (uint32_t )hns->mbx_time_limit_ms *US_PER_MS ;while (wait_time < mbx_time_limit) { -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) {hns3_err (hw,"Don't wait for mbx response because of " "disable_cmd" );return -EBUSY ;
@@ -382,7 +382,7 @@rte_spinlock_lock (&hw->cmq.crq.lock);while (!hns3_cmd_crq_empty (hw)) { -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) {rte_spinlock_unlock (&hw->cmq.crq.lock);return ; }
@@ -457,7 +457,7 @@ }while (!hns3_cmd_crq_empty (hw)) { -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) {rte_spinlock_unlock (&hw->cmq.crq.lock);return ; }
drivers/net/hns3/hns3_mp.c +3 -3
@@ -151,7 +151,7 @@int i;if (rte_eal_process_type () ==RTE_PROC_SECONDARY || -__atomic_load_n (&hw->secondary_cnt, __ATOMIC_RELAXED) ==0 ) +rte_atomic_load_explicit (&hw->secondary_cnt, rte_memory_order_relaxed) ==0 )return ;if (!mp_req_type_is_valid (type)) {
@@ -277,7 +277,7 @@ void hns3_mp_req_stop_rxtx(struct rte_eth_dev *dev) ret);return ret; } -__atomic_fetch_add (&hw->secondary_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&hw->secondary_cnt,1 , rte_memory_order_relaxed); }else { ret =hns3_mp_init_primary ();if (ret) {
@@ -297,7 +297,7 @@ void hns3_mp_uninit(struct rte_eth_dev *dev)struct hns3_hw *hw =HNS3_DEV_PRIVATE_TO_HW (dev->data->dev_private);if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) -__atomic_fetch_sub (&hw->secondary_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&hw->secondary_cnt,1 , rte_memory_order_relaxed); process_data.eth_dev_cnt--;if (process_data.eth_dev_cnt ==0 ) {
drivers/net/hns3/hns3_rxtx.c +5 -5
@@ -4464,7 +4464,7 @@struct hns3_adapter *hns = eth_dev->data->dev_private;if (hns->hw.adapter_state ==HNS3_NIC_STARTED && -__atomic_load_n (&hns->hw.reset.resetting, __ATOMIC_RELAXED) ==0 ) { +rte_atomic_load_explicit (&hns->hw.reset.resetting, rte_memory_order_relaxed) ==0 ) { eth_dev->rx_pkt_burst =hns3_get_rx_function (eth_dev); eth_dev->rx_descriptor_status = hns3_dev_rx_descriptor_status; eth_dev->tx_pkt_burst = hw->set_link_down ?
@@ -4530,7 +4530,7 @@rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) {hns3_err (hw,"fail to start Rx queue during resetting." );rte_spinlock_unlock (&hw->lock);return -EIO ;
@@ -4586,7 +4586,7 @@rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) {hns3_err (hw,"fail to stop Rx queue during resetting." );rte_spinlock_unlock (&hw->lock);return -EIO ;
@@ -4615,7 +4615,7 @@rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) {hns3_err (hw,"fail to start Tx queue during resetting." );rte_spinlock_unlock (&hw->lock);return -EIO ;
@@ -4648,7 +4648,7 @@rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) {hns3_err (hw,"fail to stop Tx queue during resetting." );rte_spinlock_unlock (&hw->lock);return -EIO ;
drivers/net/hns3/hns3_tm.c +2 -2
@@ -1051,7 +1051,7 @@if (error ==NULL )return -EINVAL ; -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) { error->type =RTE_TM_ERROR_TYPE_UNSPECIFIED ; error->message ="device is resetting" ;/* don't goto fail_clear, user may try later */
@@ -1141,7 +1141,7 @@if (error ==NULL )return -EINVAL ; -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) { error->type =RTE_TM_ERROR_TYPE_UNSPECIFIED ; error->message ="device is resetting" ;return -EBUSY ;
Signature · 1 line
1.8.3.1
PATCH 7/46 net/bnxt: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/bnxt/bnxt_cpr.h | 4 ++-- drivers/net/bnxt/bnxt_rxq.h | 2 +- drivers/net/bnxt/bnxt_rxr.c | 13 ++++++++----- drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 2 +- drivers/net/bnxt/bnxt_stats.c | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-)
drivers/net/bnxt/bnxt_cpr.h +2 -2
@@ -107,7 +107,7 @@ struct bnxt_cp_ring_info {/** * Check validity of a completion ring entry. If the entry is valid, include a -* C11 __ATOMIC_ACQUIRE fence to ensure that subsequent loads of fields in the +* C11 rte_memory_order_acquire fence to ensure that subsequent loads of fields in the * completion are not hoisted by the compiler or by the CPU to come before the * loading of the "valid" field. *
@@ -130,7 +130,7 @@ struct bnxt_cp_ring_info { expected = !(raw_cons & ring_size); valid = !!(rte_le_to_cpu_32 (c->info3_v) &CMPL_BASE_V );if (valid == expected) { -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);return true; }return false;
drivers/net/bnxt/bnxt_rxq.h +1 -1
@@ -40,7 +40,7 @@ struct bnxt_rx_queue {struct bnxt_rx_ring_info *rx_ring;struct bnxt_cp_ring_info *cp_ring;struct rte_mbuf fake_mbuf; -uint64_t rx_mbuf_alloc_fail; +RTE_ATOMIC (uint64_t ) rx_mbuf_alloc_fail;uint8_t need_realloc;const struct rte_memzone *mz; };
drivers/net/bnxt/bnxt_rxr.c +8 -5
@@ -49,7 +49,8 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq, rx_buf = &rxr->rx_buf_ring[prod]; mbuf =__bnxt_alloc_rx_data (rxq->mb_pool);if (!mbuf) { -__atomic_fetch_add (&rxq->rx_mbuf_alloc_fail,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_mbuf_alloc_fail,1 , + rte_memory_order_relaxed);/* If buff has failed already, setting this again won't hurt */ rxq->need_realloc =1 ;return -ENOMEM ;
@@ -86,7 +87,8 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq, mbuf =__bnxt_alloc_rx_data (rxq->mb_pool);if (!mbuf) { -__atomic_fetch_add (&rxq->rx_mbuf_alloc_fail,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_mbuf_alloc_fail,1 , + rte_memory_order_relaxed);/* If buff has failed already, setting this again won't hurt */ rxq->need_realloc =1 ;return -ENOMEM ;
@@ -465,7 +467,8 @@ static inline struct rte_mbuf *bnxt_tpa_end(struct rte_mbuf *new_data =__bnxt_alloc_rx_data (rxq->mb_pool);RTE_ASSERT (new_data !=NULL );if (!new_data) { -__atomic_fetch_add (&rxq->rx_mbuf_alloc_fail,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_mbuf_alloc_fail,1 , + rte_memory_order_relaxed);return NULL ; } tpa_info->mbuf = new_data;
@@ -1677,8 +1680,8 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq) rxr->tpa_info[i].mbuf =__bnxt_alloc_rx_data (rxq->mb_pool);if (!rxr->tpa_info[i].mbuf) { -__atomic_fetch_add (&rxq->rx_mbuf_alloc_fail,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_mbuf_alloc_fail,1 , + rte_memory_order_relaxed);return -ENOMEM ; } }
drivers/net/bnxt/bnxt_rxtx_vec_neon.c +1 -1
@@ -240,7 +240,7 @@ rxcmp1[0 ] =vld1q_u32 ((void *)&cpr->cp_desc_ring[cons +1 ]);/* Use acquire fence to order loads of descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* Reload lower 64b of descriptors to make it ordered after info3_v. */ rxcmp1[3] = vreinterpretq_u32_u64(vld1q_lane_u64 ((void *)&cpr->cp_desc_ring[cons + 7],
drivers/net/bnxt/bnxt_stats.c +2 -2
@@ -663,7 +663,7 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev,bnxt_fill_rte_eth_stats_ext (bnxt_stats, &ring_stats, i, true); bnxt_stats->rx_nombuf += -__atomic_load_n (&rxq->rx_mbuf_alloc_fail, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&rxq->rx_mbuf_alloc_fail, rte_memory_order_relaxed); } num_q_stats = RTE_MIN(bp->tx_cp_nr_rings,
@@ -724,7 +724,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,bnxt_fill_rte_eth_stats (bnxt_stats, &ring_stats, i, true); bnxt_stats->rx_nombuf += -__atomic_load_n (&rxq->rx_mbuf_alloc_fail, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&rxq->rx_mbuf_alloc_fail, rte_memory_order_relaxed); } num_q_stats = RTE_MIN(bp->tx_cp_nr_rings,
Signature · 1 line
1.8.3.1
PATCH 8/46 net/cpfl: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/cpfl/cpfl_ethdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/cpfl/cpfl_ethdev.c +5 -3
@@ -300,8 +300,9 @@ struct rte_cpfl_xstats_name_off {for (i =0 ; i < dev->data->nb_rx_queues; i++) { cpfl_rxq = dev->data->rx_queues[i]; - mbuf_alloc_failed +=__atomic_load_n (&cpfl_rxq->base.rx_stats.mbuf_alloc_failed, - __ATOMIC_RELAXED); + mbuf_alloc_failed += +rte_atomic_load_explicit (&cpfl_rxq->base.rx_stats.mbuf_alloc_failed, + rte_memory_order_relaxed); }return mbuf_alloc_failed;
@@ -349,7 +350,8 @@ struct rte_cpfl_xstats_name_off {for (i =0 ; i < dev->data->nb_rx_queues; i++) { cpfl_rxq = dev->data->rx_queues[i]; -__atomic_store_n (&cpfl_rxq->base.rx_stats.mbuf_alloc_failed,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&cpfl_rxq->base.rx_stats.mbuf_alloc_failed,0 , + rte_memory_order_relaxed); } }
Signature · 1 line
1.8.3.1
PATCH 9/46 net/af_xdp: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/af_xdp/rte_eth_af_xdp.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +11 -9
@@ -116,7 +116,7 @@ struct xsk_umem_info {const struct rte_memzone *mz;struct rte_mempool *mb_pool;void *buffer; -uint8_t refcnt; +RTE_ATOMIC (uint8_t ) refcnt;uint32_t max_xsks; };
@@ -995,7 +995,8 @@ static int link_xdp_prog_with_dev(int ifindex, int fd, __u32 flags)break ;xsk_socket__delete (rxq->xsk); -if (__atomic_fetch_sub (&rxq->umem->refcnt,1 , __ATOMIC_ACQUIRE) -1 ==0 ) +if (rte_atomic_fetch_sub_explicit (&rxq->umem->refcnt,1 , + rte_memory_order_acquire) -1 ==0 )xdp_umem_destroy (rxq->umem);/* free pkt_tx_queue */
@@ -1097,8 +1098,8 @@ static inline uintptr_t get_base_addr(struct rte_mempool *mp, uint64_t *align) ret =-1 ; goto out; } -if (__atomic_load_n (&internals->rx_queues[i].umem->refcnt, - __ATOMIC_ACQUIRE)) { +if (rte_atomic_load_explicit (&internals->rx_queues[i].umem->refcnt, + rte_memory_order_acquire)) { *umem = internals->rx_queues[i].umem; goto out; }
@@ -1131,11 +1132,11 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,return NULL ;if (umem !=NULL && -__atomic_load_n (&umem->refcnt, __ATOMIC_ACQUIRE) < +rte_atomic_load_explicit (&umem->refcnt, rte_memory_order_acquire) < umem->max_xsks) {AF_XDP_LOG (INFO ,"%s,qid%i sharing UMEM\n" , internals->if_name, rxq->xsk_queue_idx); -__atomic_fetch_add (&umem->refcnt,1 , __ATOMIC_ACQUIRE); +rte_atomic_fetch_add_explicit (&umem->refcnt,1 , rte_memory_order_acquire); } }
@@ -1177,7 +1178,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, mb_pool->name, umem->max_xsks); } -__atomic_store_n (&umem->refcnt,1 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&umem->refcnt,1 , rte_memory_order_release); }return umem;
@@ -1606,7 +1607,8 @@ struct msg_internal {if (rxq->umem ==NULL )return -ENOMEM ; txq->umem = rxq->umem; - reserve_before =__atomic_load_n (&rxq->umem->refcnt, __ATOMIC_ACQUIRE) <=1 ; + reserve_before =rte_atomic_load_explicit (&rxq->umem->refcnt, + rte_memory_order_acquire) <=1 ;#if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG ) ret =rte_pktmbuf_alloc_bulk (rxq->umem->mb_pool, fq_bufs, reserve_size);
@@ -1723,7 +1725,7 @@ struct msg_internal { out_xsk:xsk_socket__delete (rxq->xsk); out_umem: -if (__atomic_fetch_sub (&rxq->umem->refcnt,1 , __ATOMIC_ACQUIRE) -1 ==0 ) +if (rte_atomic_fetch_sub_explicit (&rxq->umem->refcnt,1 , rte_memory_order_acquire) -1 ==0 )xdp_umem_destroy (rxq->umem);return ret;
Signature · 1 line
1.8.3.1
PATCH 10/46 net/octeon_ep: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/octeon_ep/cnxk_ep_rx.h | 5 +++-- drivers/net/octeon_ep/cnxk_ep_tx.c | 5 +++-- drivers/net/octeon_ep/cnxk_ep_vf.c | 8 ++++---- drivers/net/octeon_ep/otx2_ep_vf.c | 8 ++++---- drivers/net/octeon_ep/otx_ep_common.h | 4 ++-- drivers/net/octeon_ep/otx_ep_rxtx.c | 6 ++++-- 6 files changed, 20 insertions(+), 16 deletions(-)
drivers/net/octeon_ep/cnxk_ep_rx.h +3 -2
@@ -98,7 +98,7 @@* This adds an extra local variable, but almost halves the * number of PCIe writes. */ - val =__atomic_load_n (droq->pkts_sent_ism, __ATOMIC_RELAXED); + val =rte_atomic_load_explicit (droq->pkts_sent_ism, rte_memory_order_relaxed); new_pkts = val - droq->pkts_sent_prev; droq->pkts_sent_prev = val;
@@ -111,7 +111,8 @@rte_mb ();rte_write64 (OTX2_SDP_REQUEST_ISM , droq->pkts_sent_reg); -while (__atomic_load_n (droq->pkts_sent_ism, __ATOMIC_RELAXED) >= val) { +while (rte_atomic_load_explicit (droq->pkts_sent_ism, + rte_memory_order_relaxed) >= val) {rte_write64 (OTX2_SDP_REQUEST_ISM , droq->pkts_sent_reg);rte_mb (); }
drivers/net/octeon_ep/cnxk_ep_tx.c +3 -2
@@ -15,7 +15,7 @@* This adds an extra local variable, but almost halves the * number of PCIe writes. */ - val =__atomic_load_n (iq->inst_cnt_ism, __ATOMIC_RELAXED); + val =rte_atomic_load_explicit (iq->inst_cnt_ism, rte_memory_order_relaxed); iq->inst_cnt += val - iq->inst_cnt_prev; iq->inst_cnt_prev = val;
@@ -27,7 +27,8 @@rte_mb ();rte_write64 (OTX2_SDP_REQUEST_ISM , iq->inst_cnt_reg); -while (__atomic_load_n (iq->inst_cnt_ism, __ATOMIC_RELAXED) >= val) { +while (rte_atomic_load_explicit (iq->inst_cnt_ism, + rte_memory_order_relaxed) >= val) {rte_write64 (OTX2_SDP_REQUEST_ISM , iq->inst_cnt_reg);rte_mb (); }
drivers/net/octeon_ep/cnxk_ep_vf.c +4 -4
@@ -150,10 +150,10 @@rte_write64 (ism_addr, (uint8_t *)otx_ep->hw_addr +CNXK_EP_R_IN_CNTS_ISM (iq_no)); iq->inst_cnt_ism = - (uint32_t *)((uint8_t *)otx_ep->ism_buffer_mz->addr + (uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr +CNXK_EP_IQ_ISM_OFFSET (iq_no));otx_ep_err ("SDP_R[%d] INST Q ISM virt: %p, dma: 0x%" PRIX64 , iq_no, - (void *)iq->inst_cnt_ism, ism_addr); + (void *)(uintptr_t )iq->inst_cnt_ism, ism_addr); *iq->inst_cnt_ism =0 ; iq->inst_cnt_prev =0 ; iq->partial_ih = ((uint64_t )otx_ep->pkind) <<36 ;
@@ -235,10 +235,10 @@rte_write64 (ism_addr, (uint8_t *)otx_ep->hw_addr +CNXK_EP_R_OUT_CNTS_ISM (oq_no)); droq->pkts_sent_ism = - (uint32_t *)((uint8_t *)otx_ep->ism_buffer_mz->addr + (uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr +CNXK_EP_OQ_ISM_OFFSET (oq_no));otx_ep_err ("SDP_R[%d] OQ ISM virt: %p dma: 0x%" PRIX64 , - oq_no, (void *)droq->pkts_sent_ism, ism_addr); + oq_no, (void *)(uintptr_t )droq->pkts_sent_ism, ism_addr); *droq->pkts_sent_ism =0 ; droq->pkts_sent_prev =0 ;
drivers/net/octeon_ep/otx2_ep_vf.c +4 -4
@@ -300,10 +300,10 @@ static int otx2_vf_enable_rxq_intr(struct otx_ep_device *otx_epvf,oct_ep_write64 (ism_addr, (uint8_t *)otx_ep->hw_addr +SDP_VF_R_IN_CNTS_ISM (iq_no)); iq->inst_cnt_ism = - (uint32_t *)((uint8_t *)otx_ep->ism_buffer_mz->addr + (uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr +OTX2_EP_IQ_ISM_OFFSET (iq_no));otx_ep_err ("SDP_R[%d] INST Q ISM virt: %p, dma: 0x%x" , iq_no, - (void *)iq->inst_cnt_ism, + (void *)(uintptr_t )iq->inst_cnt_ism, (unsigned int )ism_addr); *iq->inst_cnt_ism =0 ; iq->inst_cnt_prev =0 ;
@@ -386,10 +386,10 @@ static int otx2_vf_enable_rxq_intr(struct otx_ep_device *otx_epvf,oct_ep_write64 (ism_addr, (uint8_t *)otx_ep->hw_addr +SDP_VF_R_OUT_CNTS_ISM (oq_no)); droq->pkts_sent_ism = - (uint32_t *)((uint8_t *)otx_ep->ism_buffer_mz->addr + (uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr +OTX2_EP_OQ_ISM_OFFSET (oq_no));otx_ep_err ("SDP_R[%d] OQ ISM virt: %p, dma: 0x%x" , oq_no, - (void *)droq->pkts_sent_ism, + (void *)(uintptr_t )droq->pkts_sent_ism, (unsigned int )ism_addr); *droq->pkts_sent_ism =0 ; droq->pkts_sent_prev =0 ;
drivers/net/octeon_ep/otx_ep_common.h +2 -2
@@ -218,7 +218,7 @@ struct otx_ep_iq_config {*/ struct otx_ep_instr_queue {/* Location in memory updated by SDP ISM */ -uint32_t *inst_cnt_ism; +RTE_ATOMIC (uint32_t ) *inst_cnt_ism;struct rte_mbuf **mbuf_list;/* Pointer to the Virtual Base addr of the input ring. */ uint8_t *base_addr;
@@ -413,7 +413,7 @@ struct otx_ep_droq {uint8_t ism_ena;/* Pointer to host memory copy of output packet count, set by ISM */ -uint32_t *pkts_sent_ism; +RTE_ATOMIC (uint32_t) *pkts_sent_ism;uint32_t pkts_sent_prev;/* Statistics for this DROQ. */
drivers/net/octeon_ep/otx_ep_rxtx.c +4 -2
@@ -475,7 +475,8 @@rte_mb ();rte_write64 (OTX2_SDP_REQUEST_ISM , iq->inst_cnt_reg); -while (__atomic_load_n (iq->inst_cnt_ism, __ATOMIC_RELAXED) >= val) { +while (rte_atomic_load_explicit (iq->inst_cnt_ism, + rte_memory_order_relaxed) >= val) {rte_write64 (OTX2_SDP_REQUEST_ISM , iq->inst_cnt_reg);rte_mb (); }
@@ -871,7 +872,8 @@rte_mb ();rte_write64 (OTX2_SDP_REQUEST_ISM , droq->pkts_sent_reg); -while (__atomic_load_n (droq->pkts_sent_ism, __ATOMIC_RELAXED) >= val) { +while (rte_atomic_load_explicit (droq->pkts_sent_ism, + rte_memory_order_relaxed) >= val) {rte_write64 (OTX2_SDP_REQUEST_ISM , droq->pkts_sent_reg);rte_mb (); }
Signature · 1 line
1.8.3.1
PATCH 11/46 net/octeontx: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/octeontx/octeontx_ethdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/octeontx/octeontx_ethdev.c +4 -4
@@ -31,7 +31,7 @@/* Useful in stopping/closing event device if no of * eth ports are using it. */ -uint16_t evdev_refcnt; +RTE_ATOMIC (uint16_t ) evdev_refcnt;#define OCTEONTX_QLM_MODE_SGMII 7#define OCTEONTX_QLM_MODE_XFI 12
@@ -559,7 +559,7 @@ enum octeontx_link_speed {return 0 ;/* Stopping/closing event device once all eth ports are closed. */ -if (__atomic_fetch_sub (&evdev_refcnt,1 , __ATOMIC_ACQUIRE) -1 ==0 ) { +if (rte_atomic_fetch_sub_explicit (&evdev_refcnt,1 , rte_memory_order_acquire) -1 ==0 ) {rte_event_dev_stop (nic->evdev);rte_event_dev_close (nic->evdev); }
@@ -1593,7 +1593,7 @@ static void build_xstat_names(struct rte_eth_xstat_name *xstat_names) nic->pko_vfid = pko_vfid; nic->port_id = port; nic->evdev = evdev; -__atomic_fetch_add (&evdev_refcnt,1 , __ATOMIC_ACQUIRE); +rte_atomic_fetch_add_explicit (&evdev_refcnt,1 , rte_memory_order_acquire); res =octeontx_port_open (nic);if (res <0 )
@@ -1844,7 +1844,7 @@ static void build_xstat_names(struct rte_eth_xstat_name *xstat_names) } } -__atomic_store_n (&evdev_refcnt,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&evdev_refcnt,0 , rte_memory_order_release);/* * Do 1:1 links for ports & queues. All queues would be mapped to * one port. If there are more ports than queues, then some ports
Signature · 1 line
1.8.3.1
PATCH 12/46 net/cxgbe: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/cxgbe/clip_tbl.c | 12 ++++++------ drivers/net/cxgbe/clip_tbl.h | 2 +- drivers/net/cxgbe/cxgbe_main.c | 20 ++++++++++---------- drivers/net/cxgbe/cxgbe_ofld.h | 6 +++--- drivers/net/cxgbe/l2t.c | 12 ++++++------ drivers/net/cxgbe/l2t.h | 2 +- drivers/net/cxgbe/mps_tcam.c | 21 +++++++++++---------- drivers/net/cxgbe/mps_tcam.h | 2 +- drivers/net/cxgbe/smt.c | 12 ++++++------ drivers/net/cxgbe/smt.h | 2 +- 10 files changed, 46 insertions(+), 45 deletions(-)
drivers/net/cxgbe/clip_tbl.c +6 -6
@@ -55,7 +55,7 @@ void cxgbe_clip_release(struct rte_eth_dev *dev, struct clip_entry *ce)int ret;t4_os_lock (&ce->lock); -if (__atomic_fetch_sub (&ce->refcnt,1 , __ATOMIC_RELAXED) -1 ==0 ) { +if (rte_atomic_fetch_sub_explicit (&ce->refcnt,1 , rte_memory_order_relaxed) -1 ==0 ) { ret =clip6_release_mbox (dev, ce->addr);if (ret)dev_debug (adap,"CLIP FW DEL CMD failed: %d" , ret);
@@ -79,7 +79,7 @@ static struct clip_entry *find_or_alloc_clipe(struct clip_tbl *c,unsigned int clipt_size = c->clipt_size;for (e = &c->cl_list[0 ], end = &c->cl_list[clipt_size]; e != end; ++e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) {if (!first_free) first_free = e; }else {
@@ -114,12 +114,12 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev, ce =find_or_alloc_clipe (ctbl, lip);if (ce) {t4_os_lock (&ce->lock); -if (__atomic_load_n (&ce->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&ce->refcnt, rte_memory_order_relaxed) ==0 ) {rte_memcpy (ce->addr, lip,sizeof (ce->addr));if (v6) { ce->type =FILTER_TYPE_IPV6 ; -__atomic_store_n (&ce->refcnt,1 , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&ce->refcnt,1 , + rte_memory_order_relaxed); ret =clip6_get_mbox (dev, lip);if (ret) dev_debug(adap,
@@ -129,7 +129,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev, ce->type =FILTER_TYPE_IPV4 ; } }else { -__atomic_fetch_add (&ce->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&ce->refcnt,1 , rte_memory_order_relaxed); }t4_os_unlock (&ce->lock); }
drivers/net/cxgbe/clip_tbl.h +1 -1
@@ -13,7 +13,7 @@ struct clip_entry {enum filter_type type;/* entry type */ u32 addr[4 ];/* IPV4 or IPV6 address */ rte_spinlock_t lock;/* entry lock */ -u32 refcnt;/* entry reference count */ +RTE_ATOMIC (u32) refcnt;/* entry reference count */ };struct clip_tbl {
drivers/net/cxgbe/cxgbe_main.c +10 -10
@@ -418,15 +418,15 @@ void cxgbe_remove_tid(struct tid_info *t, unsigned int chan, unsigned int tid,if (t->tid_tab[tid]) { t->tid_tab[tid] =NULL ; -__atomic_fetch_sub (&t->conns_in_use,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&t->conns_in_use,1 , rte_memory_order_relaxed);if (t->hash_base && tid >= t->hash_base) {if (family ==FILTER_TYPE_IPV4 ) -__atomic_fetch_sub (&t->hash_tids_in_use,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&t->hash_tids_in_use,1 , + rte_memory_order_relaxed); }else {if (family ==FILTER_TYPE_IPV4 ) -__atomic_fetch_sub (&t->tids_in_use,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&t->tids_in_use,1 , + rte_memory_order_relaxed); } }
@@ -448,15 +448,15 @@ void cxgbe_insert_tid(struct tid_info *t, void *data, unsigned int tid, t->tid_tab[tid] = data;if (t->hash_base && tid >= t->hash_base) {if (family ==FILTER_TYPE_IPV4 ) -__atomic_fetch_add (&t->hash_tids_in_use,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&t->hash_tids_in_use,1 , + rte_memory_order_relaxed); }else {if (family ==FILTER_TYPE_IPV4 ) -__atomic_fetch_add (&t->tids_in_use,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&t->tids_in_use,1 , + rte_memory_order_relaxed); } -__atomic_fetch_add (&t->conns_in_use,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&t->conns_in_use,1 , rte_memory_order_relaxed); }/**
drivers/net/cxgbe/cxgbe_ofld.h +3 -3
@@ -60,10 +60,10 @@ struct tid_info {unsigned int atids_in_use;/* TIDs in the TCAM */ -u32 tids_in_use; +RTE_ATOMIC (u32) tids_in_use;/* TIDs in the HASH */ -u32 hash_tids_in_use; -u32 conns_in_use; +RTE_ATOMIC (u32) hash_tids_in_use; +RTE_ATOMIC (u32) conns_in_use; rte_spinlock_t atid_lock __rte_cache_aligned;rte_spinlock_t ftid_lock;
drivers/net/cxgbe/l2t.c +6 -6
@@ -14,8 +14,8 @@*/ void cxgbe_l2t_release (struct l2t_entry *e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) !=0 ) -__atomic_fetch_sub (&e->refcnt,1 , __ATOMIC_RELAXED); +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) !=0 ) +rte_atomic_fetch_sub_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }/**
@@ -112,7 +112,7 @@ static struct l2t_entry *find_or_alloc_l2e(struct l2t_data *d, u16 vlan,struct l2t_entry *first_free =NULL ;for (e = &d->l2tab[0 ], end = &d->l2tab[d->l2t_size]; e != end; ++e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) {if (!first_free) first_free = e; }else {
@@ -151,18 +151,18 @@ static struct l2t_entry *t4_l2t_alloc_switching(struct rte_eth_dev *dev, e =find_or_alloc_l2e (d, vlan, port, eth_addr);if (e) {t4_os_lock (&e->lock); -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) { e->state =L2T_STATE_SWITCHING ; e->vlan = vlan; e->lport = port;rte_memcpy (e->dmac, eth_addr,RTE_ETHER_ADDR_LEN ); -__atomic_store_n (&e->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&e->refcnt,1 , rte_memory_order_relaxed); ret =write_l2e (dev, e,0 , !L2T_LPBK , !L2T_ARPMISS );if (ret <0 )dev_debug (adap,"Failed to write L2T entry: %d" , ret); }else { -__atomic_fetch_add (&e->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }t4_os_unlock (&e->lock); }
drivers/net/cxgbe/l2t.h +1 -1
@@ -30,7 +30,7 @@ struct l2t_entry {u8 lport;/* destination port */ u8 dmac[RTE_ETHER_ADDR_LEN ];/* destination MAC address */ rte_spinlock_t lock;/* entry lock */ -u32 refcnt;/* entry reference count */ +RTE_ATOMIC (u32) refcnt;/* entry reference count */ };struct l2t_data {
drivers/net/cxgbe/mps_tcam.c +11 -10
@@ -76,7 +76,7 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr,t4_os_write_lock (&mpstcam->lock); entry =cxgbe_mpstcam_lookup (adap->mpstcam, eth_addr, mask);if (entry) { -__atomic_fetch_add (&entry->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&entry->refcnt,1 , rte_memory_order_relaxed);t4_os_write_unlock (&mpstcam->lock);return entry->idx; }
@@ -98,7 +98,7 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr, entry = &mpstcam->entry[ret];memcpy (entry->eth_addr, eth_addr,RTE_ETHER_ADDR_LEN );memcpy (entry->mask, mask,RTE_ETHER_ADDR_LEN ); -__atomic_store_n (&entry->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,1 , rte_memory_order_relaxed); entry->state =MPS_ENTRY_USED ;if (cxgbe_update_free_idx (mpstcam))
@@ -147,7 +147,7 @@ int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr)* provided value is -1 */ if (entry->state ==MPS_ENTRY_UNUSED ) { -__atomic_store_n (&entry->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,1 , rte_memory_order_relaxed); entry->state =MPS_ENTRY_USED ; }
@@ -165,7 +165,7 @@ static inline void reset_mpstcam_entry(struct mps_tcam_entry *entry) {memset (entry->eth_addr,0 ,RTE_ETHER_ADDR_LEN );memset (entry->mask,0 ,RTE_ETHER_ADDR_LEN ); -__atomic_store_n (&entry->refcnt,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,0 , rte_memory_order_relaxed); entry->state =MPS_ENTRY_UNUSED ; }
@@ -190,12 +190,13 @@ int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx)return -EINVAL ; } -if (__atomic_load_n (&entry->refcnt, __ATOMIC_RELAXED) ==1 ) +if (rte_atomic_load_explicit (&entry->refcnt, rte_memory_order_relaxed) ==1 ) ret =t4_free_raw_mac_filt (adap, pi->viid, entry->eth_addr, entry->mask, idx,1 , pi->port_id, false);else - ret =__atomic_fetch_sub (&entry->refcnt,1 , __ATOMIC_RELAXED) -1 ; + ret =rte_atomic_fetch_sub_explicit (&entry->refcnt,1 , + rte_memory_order_relaxed) -1 ;if (ret ==0 ) {reset_mpstcam_entry (entry);
@@ -222,7 +223,7 @@ int cxgbe_mpstcam_rawf_enable(struct port_info *pi)t4_os_write_lock (&t->lock); rawf_idx = adap->params.rawf_start + pi->port_id; entry = &t->entry[rawf_idx]; -if (__atomic_load_n (&entry->refcnt, __ATOMIC_RELAXED) ==1 ) +if (rte_atomic_load_explicit (&entry->refcnt, rte_memory_order_relaxed) ==1 ) goto out_unlock; ret = t4_alloc_raw_mac_filt(adap, pi->viid, entry->eth_addr,
@@ -231,7 +232,7 @@ int cxgbe_mpstcam_rawf_enable(struct port_info *pi)if (ret <0 ) goto out_unlock; -__atomic_store_n (&entry->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,1 , rte_memory_order_relaxed); out_unlock:t4_os_write_unlock (&t->lock);
@@ -253,7 +254,7 @@ int cxgbe_mpstcam_rawf_disable(struct port_info *pi)t4_os_write_lock (&t->lock); rawf_idx = adap->params.rawf_start + pi->port_id; entry = &t->entry[rawf_idx]; -if (__atomic_load_n (&entry->refcnt, __ATOMIC_RELAXED) !=1 ) +if (rte_atomic_load_explicit (&entry->refcnt, rte_memory_order_relaxed) !=1 ) goto out_unlock; ret = t4_free_raw_mac_filt(adap, pi->viid, entry->eth_addr,
@@ -262,7 +263,7 @@ int cxgbe_mpstcam_rawf_disable(struct port_info *pi)if (ret <0 ) goto out_unlock; -__atomic_store_n (&entry->refcnt,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,0 , rte_memory_order_relaxed); out_unlock:t4_os_write_unlock (&t->lock);
drivers/net/cxgbe/mps_tcam.h +1 -1
@@ -29,7 +29,7 @@ struct mps_tcam_entry {u8 mask[RTE_ETHER_ADDR_LEN ];struct mpstcam_table *mpstcam;/* backptr */ -u32 refcnt; +RTE_ATOMIC (u32) refcnt; };struct mpstcam_table {
drivers/net/cxgbe/smt.c +6 -6
@@ -119,7 +119,7 @@ static struct smt_entry *find_or_alloc_smte(struct smt_data *s, u8 *smac)struct smt_entry *e, *end, *first_free =NULL ;for (e = &s->smtab[0 ], end = &s->smtab[s->smt_size]; e != end; ++e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) {if (!first_free) first_free = e; }else {
@@ -156,7 +156,7 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev, e =find_or_alloc_smte (s, smac);if (e) {t4_os_lock (&e->lock); -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) { e->pfvf = pfvf;rte_memcpy (e->src_mac, smac,RTE_ETHER_ADDR_LEN ); ret =write_smt_entry (dev, e);
@@ -168,9 +168,9 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev, goto out_write_unlock; } e->state =SMT_STATE_SWITCHING ; -__atomic_store_n (&e->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }else { -__atomic_fetch_add (&e->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }t4_os_unlock (&e->lock); }
@@ -195,8 +195,8 @@ struct smt_entry *cxgbe_smt_alloc_switching(struct rte_eth_dev *dev, u8 *smac)void cxgbe_smt_release (struct smt_entry *e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) !=0 ) -__atomic_fetch_sub (&e->refcnt,1 , __ATOMIC_RELAXED); +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) !=0 ) +rte_atomic_fetch_sub_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }/**
drivers/net/cxgbe/smt.h +1 -1
@@ -23,7 +23,7 @@ struct smt_entry {u16 pfvf;u16 hw_idx;u8 src_mac[RTE_ETHER_ADDR_LEN ]; -u32 refcnt; +RTE_ATOMIC (u32) refcnt;rte_spinlock_t lock; };
Signature · 1 line
1.8.3.1
PATCH 13/46 net/gve: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/gve/base/gve_osdep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/gve/base/gve_osdep.h +2 -2
@@ -135,7 +135,7 @@ struct gve_dma_mem {static inline void *gve_alloc_dma_mem (struct gve_dma_mem *mem,u64 size) { -static uint16_t gve_dma_memzone_id; +static RTE_ATOMIC (uint16_t ) gve_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];
@@ -143,7 +143,7 @@ struct gve_dma_mem {return NULL ;snprintf (z_name,sizeof (z_name),"gve_dma_%u" , -__atomic_fetch_add (&gve_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&gve_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_aligned (z_name, size,SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG ,PAGE_SIZE );
Signature · 1 line
1.8.3.1
PATCH 14/46 net/memif: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/memif/memif.h | 4 ++-- drivers/net/memif/rte_eth_memif.c | 50 +++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 27 deletions(-)
drivers/net/memif/memif.h +2 -2
@@ -169,9 +169,9 @@ typedef struct __rte_packed __rte_aligned(128)uint32_t cookie;/**< MEMIF_COOKIE */ uint16_t flags;/**< flags */ #define MEMIF_RING_FLAG_MASK_INT 1/**< disable interrupt mode */ -uint16_t head;/**< pointer to ring buffer head */ +RTE_ATOMIC (uint16_t ) head;/**< pointer to ring buffer head */ MEMIF_CACHELINE_ALIGN_MARK (cacheline1); -uint16_t tail;/**< pointer to ring buffer tail */ +RTE_ATOMIC (uint16_t ) tail;/**< pointer to ring buffer tail */ MEMIF_CACHELINE_ALIGN_MARK (cacheline2);memif_desc_t desc[0 ];/**< buffer descriptors */ } memif_ring_t;
drivers/net/memif/rte_eth_memif.c +25 -25
156 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 15/46 net/sfc: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/sfc/meson.build | 5 ++--- drivers/net/sfc/sfc_mae_counter.c | 30 +++++++++++++++--------------- drivers/net/sfc/sfc_repr_proxy.c | 8 ++++---- drivers/net/sfc/sfc_stats.h | 8 ++++---- 4 files changed, 25 insertions(+), 26 deletions(-)
drivers/net/sfc/meson.build +2 -3
@@ -47,9 +47,8 @@ int main(void) __int128 a = 0; __int128 b; - b = __atomic_load_n(&a, __ATOMIC_RELAXED); - __atomic_store(&b, &a, __ATOMIC_RELAXED); - __atomic_store_n(&b, a, __ATOMIC_RELAXED); + b = rte_atomic_load_explicit(&a, rte_memory_order_relaxed); + rte_atomic_store_explicit(&b, a, rte_memory_order_relaxed); return 0; } '''
drivers/net/sfc/sfc_mae_counter.c +15 -15
@@ -131,8 +131,8 @@* And it does not depend on different stores/loads in other threads. * Paired with relaxed ordering in counter increment. */ -__atomic_store (&p->reset.pkts_bytes.int128, - &p->value.pkts_bytes.int128, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&p->reset.pkts_bytes.int128, + p->value.pkts_bytes.int128, rte_memory_order_relaxed); p->generation_count = generation_count; p->ft_switch_hit_counter = counterp->ft_switch_hit_counter;
@@ -142,7 +142,7 @@* at the beginning of delete operation. Release ordering is * paired with acquire ordering on load in counter increment operation. */ -__atomic_store_n (&p->inuse, true, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&p->inuse, true, rte_memory_order_release); sfc_info(sa, "enabled MAE counter 0x%x-#%u with reset pkts=%" PRIu64 " bytes=%" PRIu64, counterp->type, mae_counter.id,
@@ -189,7 +189,7 @@* paired with acquire ordering on load in counter increment operation. */ p = &counters->mae_counters[mae_counter->id]; -__atomic_store_n (&p->inuse, false, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&p->inuse, false, rte_memory_order_release); rc =efx_mae_counters_free_type (sa->nic, counter->type,1 , &unused, mae_counter,NULL );
@@ -228,7 +228,7 @@* Acquire ordering is paired with release ordering in counter add * and delete operations. */ -__atomic_load (&p->inuse, &inuse, __ATOMIC_ACQUIRE); + inuse =rte_atomic_load_explicit (&p->inuse, rte_memory_order_acquire);if (!inuse) {/* * Two possible cases include:
@@ -258,15 +258,15 @@* And it does not depend on different stores/loads in other threads. * Paired with relaxed ordering on counter reset. */ -__atomic_store (&p->value.pkts_bytes, - &cnt_val.pkts_bytes, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&p->value.pkts_bytes, + cnt_val.pkts_bytes, rte_memory_order_relaxed);if (p->ft_switch_hit_counter !=NULL ) {uint64_t ft_switch_hit_counter; ft_switch_hit_counter = *p->ft_switch_hit_counter + pkts; -__atomic_store_n (p->ft_switch_hit_counter, ft_switch_hit_counter, - __ATOMIC_RELAXED); +rte_atomic_store_explicit (p->ft_switch_hit_counter, ft_switch_hit_counter, + rte_memory_order_relaxed); } sfc_info(sa, "update MAE counter 0x%x-#%u: pkts+%" PRIu64 "=%" PRIu64
@@ -498,8 +498,8 @@ &sa->mae.counter_registry;int32_t rc; -while (__atomic_load_n (&counter_registry->polling.thread.run, - __ATOMIC_ACQUIRE)) { +while (rte_atomic_load_explicit (&counter_registry->polling.thread.run, + rte_memory_order_acquire)) { rc =sfc_mae_counter_poll_packets (sa);if (rc ==0 ) {/*
@@ -684,8 +684,8 @@int rc;/* Ensure that flag is set before attempting to join thread */ -__atomic_store_n (&counter_registry->polling.thread.run, false, - __ATOMIC_RELEASE); +rte_atomic_store_explicit (&counter_registry->polling.thread.run, false, + rte_memory_order_release); rc =rte_thread_join (counter_registry->polling.thread.id,NULL );if (rc !=0 )
@@ -1024,8 +1024,8 @@* And it does not depend on different stores/loads in other threads. * Paired with relaxed ordering in counter increment. */ - value.pkts_bytes.int128 =__atomic_load_n (&p->value.pkts_bytes.int128, - __ATOMIC_RELAXED); + value.pkts_bytes.int128 =rte_atomic_load_explicit (&p->value.pkts_bytes.int128, + rte_memory_order_relaxed); data->hits_set =1 ; data->hits = value.pkts - p->reset.pkts;
drivers/net/sfc/sfc_repr_proxy.c +4 -4
@@ -83,7 +83,7 @@* Release ordering enforces marker set after data is populated. * Paired with acquire ordering in sfc_repr_proxy_mbox_handle(). */ -__atomic_store_n (&mbox->write_marker, true, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&mbox->write_marker, true, rte_memory_order_release);/* * Wait for the representor routine to process the request.
@@ -94,7 +94,7 @@* Paired with release ordering in sfc_repr_proxy_mbox_handle() * on acknowledge write. */ -if (__atomic_load_n (&mbox->ack, __ATOMIC_ACQUIRE)) +if (rte_atomic_load_explicit (&mbox->ack, rte_memory_order_acquire))break ;rte_delay_ms (1 );
@@ -119,7 +119,7 @@* Paired with release ordering in sfc_repr_proxy_mbox_send() * on marker set. */ -if (!__atomic_load_n (&mbox->write_marker, __ATOMIC_ACQUIRE)) +if (!rte_atomic_load_explicit (&mbox->write_marker, rte_memory_order_acquire))return ; mbox->write_marker = false;
@@ -146,7 +146,7 @@* Paired with acquire ordering in sfc_repr_proxy_mbox_send() * on acknowledge read. */ -__atomic_store_n (&mbox->ack, true, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&mbox->ack, true, rte_memory_order_release); } static void
drivers/net/sfc/sfc_stats.h +4 -4
@@ -51,8 +51,8 @@* Store the result atomically to guarantee that the reader * core sees both counter updates together. */ -__atomic_store_n (&st->pkts_bytes.int128, result.pkts_bytes.int128, - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&st->pkts_bytes.int128, result.pkts_bytes.int128, + rte_memory_order_relaxed);#else st->pkts += pkts; st->bytes += bytes;
@@ -66,8 +66,8 @@ sfc_pkts_bytes_get(const union sfc_pkts_bytes *st, union sfc_pkts_bytes *result) { #if SFC_SW_STATS_ATOMIC - result->pkts_bytes.int128 = __atomic_load_n(&st->pkts_bytes.int128, - __ATOMIC_RELAXED); + result->pkts_bytes.int128 = rte_atomic_load_explicit(&st->pkts_bytes.int128, + rte_memory_order_relaxed);#else *result = *st;#endif
Signature · 1 line
1.8.3.1
Re: [PATCH 15/46] net/sfc: use rte stdatomic API
Quoted 17 lines · Tyler Retzlaff
Replace the use of gcc builtin
__atomic_xxxintrinsics with correspondingrte_atomic_xxxoptional rte stdatomic API.Signed-off-by Tyler Retzlaff <[email protected]>--- drivers/net/sfc/meson.build | 5 ++--- drivers/net/sfc/sfc_mae_counter.c | 30 +++++++++++++++--------------- drivers/net/sfc/sfc_repr_proxy.c | 8 ++++---- drivers/net/sfc/sfc_stats.h | 8 ++++---- 4 files changed, 25 insertions(+), 26 deletions(-)drivers/net/sfc/meson.build +0
-0@@ -47,9 +47,8 @@ int main(void) __int128 a = 0;
drivers/net/sfc/meson.build int main(void) · line 54
Quoted 10 lines
drivers/net/sfc/meson.build +2
-3__int128 b; - b = __atomic_load_n(&a, __ATOMIC_RELAXED); - __atomic_store(&b, &a, __ATOMIC_RELAXED); - __atomic_store_n(&b, a, __ATOMIC_RELAXED); + b = rte_atomic_load_explicit(&a, rte_memory_order_relaxed); + rte_atomic_store_explicit(&b, a, rte_memory_order_relaxed); return 0; } '''
I think this is a case where simple find/replace is a problem. For example, this is a sample file that the meson build uses to determine if libatomic is properly installed. However, it is very bare-bones.
Your change is likely causing a compile error when cc.links happens in the meson file. That leads to the ABI error.
If the goal is to remove all the intrinsics, then maybe a better change would be dropping this libatomic check from here completely.
WDYT?
Re: [PATCH 15/46] net/sfc: use rte stdatomic API
Quoted 34 lines · Aaron Conole
Quoted 17 lines · Tyler Retzlaff
Replace the use of gcc builtin
__atomic_xxxintrinsics with correspondingrte_atomic_xxxoptional rte stdatomic API.Signed-off-by Tyler Retzlaff <[email protected]>--- drivers/net/sfc/meson.build | 5 ++--- drivers/net/sfc/sfc_mae_counter.c | 30 +++++++++++++++--------------- drivers/net/sfc/sfc_repr_proxy.c | 8 ++++---- drivers/net/sfc/sfc_stats.h | 8 ++++---- 4 files changed, 25 insertions(+), 26 deletions(-)drivers/net/sfc/meson.build +0
-0@@ -47,9 +47,8 @@ int main(void) __int128 a = 0;drivers/net/sfc/meson.build int main(void) · line 54
Quoted 10 lines
drivers/net/sfc/meson.build +2
-3__int128 b; - b = __atomic_load_n(&a, __ATOMIC_RELAXED); - __atomic_store(&b, &a, __ATOMIC_RELAXED); - __atomic_store_n(&b, a, __ATOMIC_RELAXED); + b = rte_atomic_load_explicit(&a, rte_memory_order_relaxed); + rte_atomic_store_explicit(&b, a, rte_memory_order_relaxed); return 0; } '''I think this is a case where simple find/replace is a problem. For example, this is a sample file that the meson build uses to determine if libatomic is properly installed. However, it is very bare-bones.
Quoted 7 lines
Your change is likely causing a compile error when cc.links happens in the meson file. That leads to the ABI error.
If the goal is to remove all the intrinsics, then maybe a better change would be dropping this libatomic check from here completely.
WDYT?
yeah, actually it wasn't a search replace mistake it was an unintentionally included file where i was experimenting with keeping the test (thought i had reverted it).
i shouldn't have added the change to the series thanks for pointing the mistake out and sorry for the noise.
appreciate it!
PATCH 16/46 net/thunderx: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/thunderx/nicvf_rxtx.c | 9 +++++---- drivers/net/thunderx/nicvf_struct.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/thunderx/nicvf_rxtx.c +5 -4
@@ -374,8 +374,8 @@NICVF_RX_ASSERT ((unsigned int )to_fill <= (qlen_mask - (nicvf_addr_read (rbdr->rbdr_status) &NICVF_RBDR_COUNT_MASK ))); - next_tail =__atomic_fetch_add (&rbdr->next_tail, to_fill, - __ATOMIC_ACQUIRE); + next_tail =rte_atomic_fetch_add_explicit (&rbdr->next_tail, to_fill, + rte_memory_order_acquire); ltail = next_tail;for (i =0 ; i < to_fill; i++) {struct rbdr_entry_t *entry = desc + (ltail & qlen_mask);
@@ -385,9 +385,10 @@ ltail++; } -rte_wait_until_equal_32 (&rbdr->tail, next_tail, __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&rbdr->tail, next_tail, + rte_memory_order_relaxed); -__atomic_store_n (&rbdr->tail, ltail, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&rbdr->tail, ltail, rte_memory_order_release);nicvf_addr_write (door, to_fill);return to_fill; }
drivers/net/thunderx/nicvf_struct.h +2 -2
@@ -20,8 +20,8 @@ struct nicvf_rbdr {struct rbdr_entry_t *desc;nicvf_iova_addr_t phys;uint32_t buffsz; -uint32_t tail; -uint32_t next_tail; +RTE_ATOMIC (uint32_t ) tail; +RTE_ATOMIC (uint32_t ) next_tail;uint32_t head;uint32_t qlen_mask; } __rte_cache_aligned;
Signature · 1 line
1.8.3.1
PATCH 17/46 net/virtio: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/virtio/virtio_ring.h | 4 +-- drivers/net/virtio/virtio_user/virtio_user_dev.c | 12 ++++----- drivers/net/virtio/virtqueue.h | 32 ++++++++++++------------ 3 files changed, 24 insertions(+), 24 deletions(-)
drivers/net/virtio/virtio_ring.h +2 -2
@@ -59,7 +59,7 @@ struct vring_used_elem {struct vring_used {uint16_t flags; -uint16_t idx; +RTE_ATOMIC (uint16_t ) idx;struct vring_used_elem ring[]; };
@@ -70,7 +70,7 @@ struct vring_packed_desc {uint64_t addr;uint32_t len;uint16_t id; -uint16_t flags; +RTE_ATOMIC (uint16_t ) flags; };#define RING_EVENT_FLAGS_ENABLE 0x0
drivers/net/virtio/virtio_user/virtio_user_dev.c +6 -6
@@ -948,7 +948,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)static inline int desc_is_avail (struct vring_packed_desc *desc,bool wrap_counter) { -uint16_t flags =__atomic_load_n (&desc->flags, __ATOMIC_ACQUIRE); +uint16_t flags =rte_atomic_load_explicit (&desc->flags, rte_memory_order_acquire);return wrap_counter == !!(flags &VRING_PACKED_DESC_F_AVAIL ) && wrap_counter != !!(flags &VRING_PACKED_DESC_F_USED );
@@ -1037,8 +1037,8 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)if (vq->used_wrap_counter) flags |=VRING_PACKED_DESC_F_AVAIL_USED ; -__atomic_store_n (&vring->desc[vq->used_idx].flags, flags, - __ATOMIC_RELEASE); +rte_atomic_store_explicit (&vring->desc[vq->used_idx].flags, flags, + rte_memory_order_release); vq->used_idx += n_descs;if (vq->used_idx >= dev->queue_size) {
@@ -1057,9 +1057,9 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)struct vring *vring = &dev->vrings.split[queue_idx];/* Consume avail ring, using used ring idx as first one */ -while (__atomic_load_n (&vring->used->idx, __ATOMIC_RELAXED) +while (rte_atomic_load_explicit (&vring->used->idx, rte_memory_order_relaxed) != vring->avail->idx) { - avail_idx =__atomic_load_n (&vring->used->idx, __ATOMIC_RELAXED) + avail_idx =rte_atomic_load_explicit (&vring->used->idx, rte_memory_order_relaxed) & (vring->num -1 ); desc_idx = vring->avail->ring[avail_idx];
@@ -1070,7 +1070,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) uep->id = desc_idx; uep->len = n_descs; -__atomic_fetch_add (&vring->used->idx,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&vring->used->idx,1 , rte_memory_order_relaxed); } }
drivers/net/virtio/virtqueue.h +16 -16
@@ -37,7 +37,7 @@ virtio_mb(uint8_t weak_barriers) {if (weak_barriers) -rte_atomic_thread_fence (__ATOMIC_SEQ_CST); +rte_atomic_thread_fence (rte_memory_order_seq_cst);else rte_mb (); }
@@ -46,7 +46,7 @@ virtio_rmb(uint8_t weak_barriers) {if (weak_barriers) -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);else rte_io_rmb (); }
@@ -55,7 +55,7 @@ virtio_wmb(uint8_t weak_barriers) {if (weak_barriers) -rte_atomic_thread_fence (__ATOMIC_RELEASE); +rte_atomic_thread_fence (rte_memory_order_release);else rte_io_wmb (); }
@@ -67,12 +67,12 @@uint16_t flags;if (weak_barriers) { -/* x86 prefers to using rte_io_rmb over __atomic_load_n as it reports +/* x86 prefers to using rte_io_rmb over rte_atomic_load_explicit as it reports * a better perf(~1.5%), which comes from the saved branch by the compiler. * The if and else branch are identical on the platforms except Arm. */ #ifdef RTE_ARCH_ARM - flags =__atomic_load_n (&dp->flags, __ATOMIC_ACQUIRE); + flags =rte_atomic_load_explicit (&dp->flags, rte_memory_order_acquire);#else flags = dp->flags;rte_io_rmb ();
@@ -90,12 +90,12 @@ uint16_t flags, uint8_t weak_barriers) {if (weak_barriers) { -/* x86 prefers to using rte_io_wmb over __atomic_store_n as it reports +/* x86 prefers to using rte_io_wmb over rte_atomic_store_explicit as it reports * a better perf(~1.5%), which comes from the saved branch by the compiler. * The if and else branch are identical on the platforms except Arm. */ #ifdef RTE_ARCH_ARM -__atomic_store_n (&dp->flags, flags, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&dp->flags, flags, rte_memory_order_release);#else rte_io_wmb (); dp->flags = flags;
@@ -425,7 +425,7 @@ struct virtqueue *virtqueue_alloc(struct virtio_hw *hw, uint16_t index,if (vq->hw->weak_barriers) {/** -* x86 prefers to using rte_smp_rmb over __atomic_load_n as it +* x86 prefers to using rte_smp_rmb over rte_atomic_load_explicit as it * reports a slightly better perf, which comes from the saved * branch by the compiler. * The if and else branches are identical with the smp and io
@@ -435,8 +435,8 @@ struct virtqueue *virtqueue_alloc(struct virtio_hw *hw, uint16_t index, idx = vq->vq_split.ring.used->idx;rte_smp_rmb ();#else - idx =__atomic_load_n (&(vq)->vq_split.ring.used->idx, - __ATOMIC_ACQUIRE); + idx =rte_atomic_load_explicit (&(vq)->vq_split.ring.used->idx, + rte_memory_order_acquire);#endif }else { idx = vq->vq_split.ring.used->idx;
@@ -454,7 +454,7 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx, vq_update_avail_idx(struct virtqueue *vq) {if (vq->hw->weak_barriers) { -/* x86 prefers to using rte_smp_wmb over __atomic_store_n as +/* x86 prefers to using rte_smp_wmb over rte_atomic_store_explicit as * it reports a slightly better perf, which comes from the * saved branch by the compiler. * The if and else branches are identical with the smp and
@@ -464,8 +464,8 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx,rte_smp_wmb (); vq->vq_split.ring.avail->idx = vq->vq_avail_idx;#else -__atomic_store_n (&vq->vq_split.ring.avail->idx, - vq->vq_avail_idx, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&vq->vq_split.ring.avail->idx, + vq->vq_avail_idx, rte_memory_order_release);#endif }else {rte_io_wmb ();
@@ -528,8 +528,8 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx,#ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP #define VIRTQUEUE_DUMP (vq) do { \ uint16_t used_idx, nused; \ - used_idx = __atomic_load_n(&(vq)->vq_split.ring.used->idx, \ - __ATOMIC_RELAXED); \ + used_idx = rte_atomic_load_explicit(&(vq)->vq_split.ring.used->idx, \ + rte_memory_order_relaxed); \ nused = (uint16_t)(used_idx - (vq)->vq_used_cons_idx); \ if (virtio_with_packed_queue((vq)->hw)) { \ PMD_INIT_LOG(DEBUG, \
@@ -546,7 +546,7 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx," avail.flags=0x%x; used.flags=0x%x" , \ (vq)->vq_nentries, (vq)->vq_free_cnt, nused, (vq)->vq_desc_head_idx, \ (vq)->vq_split.ring.avail->idx, (vq)->vq_used_cons_idx, \ -__atomic_load_n (&(vq)->vq_split.ring.used->idx, __ATOMIC_RELAXED), \ +rte_atomic_load_explicit (&(vq)->vq_split.ring.used->idx, rte_memory_order_relaxed), \ (vq)->vq_split.ring.avail->flags, (vq)->vq_split.ring.used->flags); \ } while (0) #else
Signature · 1 line
1.8.3.1
PATCH 18/46 net/hinic: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/hinic/hinic_pmd_rx.c | 2 +- drivers/net/hinic/hinic_pmd_rx.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/hinic/hinic_pmd_rx.c +1 -1
@@ -1004,7 +1004,7 @@ u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16 nb_pkts)while (pkts < nb_pkts) {/* 2. current ci is done */ rx_cqe = &rxq->rx_cqe[sw_ci]; - status =__atomic_load_n (&rx_cqe->status, __ATOMIC_ACQUIRE); + status =rte_atomic_load_explicit (&rx_cqe->status, rte_memory_order_acquire);if (!HINIC_GET_RX_DONE_BE (status))break ;
drivers/net/hinic/hinic_pmd_rx.h +1 -1
@@ -29,7 +29,7 @@ struct hinic_rq_ctrl { };struct hinic_rq_cqe { -u32 status; +RTE_ATOMIC (u32) status;u32 vlan_len;u32 offload_type;u32 rss_hash;
Signature · 1 line
1.8.3.1
PATCH 19/46 net/idpf: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/idpf/idpf_ethdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/idpf/idpf_ethdev.c +4 -3
@@ -259,8 +259,8 @@ struct rte_idpf_xstats_name_off {for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; - mbuf_alloc_failed +=__atomic_load_n (&rxq->rx_stats.mbuf_alloc_failed, - __ATOMIC_RELAXED); + mbuf_alloc_failed +=rte_atomic_load_explicit (&rxq->rx_stats.mbuf_alloc_failed, + rte_memory_order_relaxed); }return mbuf_alloc_failed;
@@ -308,7 +308,8 @@ struct rte_idpf_xstats_name_off {for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; -__atomic_store_n (&rxq->rx_stats.mbuf_alloc_failed,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&rxq->rx_stats.mbuf_alloc_failed,0 , + rte_memory_order_relaxed); } }
Signature · 1 line
1.8.3.1
PATCH 20/46 net/qede: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/qede/base/bcm_osal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/qede/base/bcm_osal.c +3 -3
@@ -51,11 +51,11 @@ void osal_poll_mode_dpc(osal_int_ptr_t hwfn_cookie)/* Counter to track current memzone allocated */ static uint16_t ecore_mz_count; -static uint32_t ref_cnt; +static RTE_ATOMIC (uint32_t ) ref_cnt;int ecore_mz_mapping_alloc (void ) { -if (__atomic_fetch_add (&ref_cnt,1 , __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_fetch_add_explicit (&ref_cnt,1 , rte_memory_order_relaxed) ==0 ) { ecore_mz_mapping =rte_calloc ("ecore_mz_map" ,rte_memzone_max_get (),sizeof (struct rte_memzone *),0 ); }
@@ -68,7 +68,7 @@ int ecore_mz_mapping_alloc(void)void ecore_mz_mapping_free (void ) { -if (__atomic_fetch_sub (&ref_cnt,1 , __ATOMIC_RELAXED) -1 ==0 ) { +if (rte_atomic_fetch_sub_explicit (&ref_cnt,1 , rte_memory_order_relaxed) -1 ==0 ) {rte_free (ecore_mz_mapping); ecore_mz_mapping =NULL ; }
Signature · 1 line
1.8.3.1
PATCH 21/46 net/ring: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/ring/rte_eth_ring.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ring/rte_eth_ring.c +4 -4
@@ -44,8 +44,8 @@ enum dev_action {struct ring_queue {struct rte_ring *rng; -uint64_t rx_pkts; -uint64_t tx_pkts; +RTE_ATOMIC (uint64_t ) rx_pkts; +RTE_ATOMIC (uint64_t ) tx_pkts; };struct pmd_internals {
@@ -82,7 +82,7 @@ struct pmd_internals {if (r->rng->flags &RING_F_SC_DEQ ) r->rx_pkts += nb_rx;else -__atomic_fetch_add (&r->rx_pkts, nb_rx, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&r->rx_pkts, nb_rx, rte_memory_order_relaxed);return nb_rx; }
@@ -96,7 +96,7 @@ struct pmd_internals {if (r->rng->flags &RING_F_SP_ENQ ) r->tx_pkts += nb_tx;else -__atomic_fetch_add (&r->tx_pkts, nb_tx, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&r->tx_pkts, nb_tx, rte_memory_order_relaxed);return nb_tx; }
Signature · 1 line
1.8.3.1
PATCH 22/46 vdpa/mlx5: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/vdpa/mlx5/mlx5_vdpa.c | 24 +++++++++--------- drivers/vdpa/mlx5/mlx5_vdpa.h | 14 +++++------ drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 46 +++++++++++++++++------------------ drivers/vdpa/mlx5/mlx5_vdpa_lm.c | 4 ++- drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 4 ++- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 4 ++- 6 files changed, 52 insertions(+), 44 deletions(-)
drivers/vdpa/mlx5/mlx5_vdpa.c +13 -11
@@ -261,8 +261,8 @@uint32_t timeout =0 ;/* Check and wait all close tasks done. */ -while (__atomic_load_n (&priv->dev_close_progress, - __ATOMIC_RELAXED) !=0 && timeout <1000 ) { +while (rte_atomic_load_explicit (&priv->dev_close_progress, + rte_memory_order_relaxed) !=0 && timeout <1000 ) {rte_delay_us_sleep (10000 ); timeout++; }
@@ -294,8 +294,8 @@ priv->last_c_thrd_idx =0 ; else priv->last_c_thrd_idx++; -__atomic_store_n (&priv->dev_close_progress, -1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&priv->dev_close_progress, +1 , rte_memory_order_relaxed); if (mlx5_vdpa_task_add(priv, priv->last_c_thrd_idx, MLX5_VDPA_TASK_DEV_CLOSE_NOWAIT,
@@ -319,8 +319,8 @@if (!priv->connected)mlx5_vdpa_dev_cache_clean (priv); priv->vid =0 ; -__atomic_store_n (&priv->dev_close_progress,0 , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&priv->dev_close_progress,0 , + rte_memory_order_relaxed); priv->state =MLX5_VDPA_STATE_PROBED ;DRV_LOG (INFO ,"vDPA device %d was closed." , vid);return ret;
@@ -664,7 +664,9 @@static int mlx5_vdpa_virtq_resource_prepare (struct mlx5_vdpa_priv *priv) { -uint32_t remaining_cnt =0 , err_cnt =0 , task_num =0 ; +RTE_ATOMIC (uint32_t ) remaining_cnt =0 ; +RTE_ATOMIC (uint32_t ) err_cnt =0 ; +uint32_t task_num =0 ;uint32_t max_queues, index, thrd_idx, data[1 ];struct mlx5_vdpa_virtq *virtq;
@@ -847,8 +849,8 @@if (conf_thread_mng.initializer_priv == priv)if (mlx5_vdpa_mult_threads_create ()) goto error; -__atomic_fetch_add (&conf_thread_mng.refcnt,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&conf_thread_mng.refcnt,1 , + rte_memory_order_relaxed); }if (mlx5_vdpa_create_dev_resources (priv)) goto error;
@@ -937,8 +939,8 @@if (priv->vdev)rte_vdpa_unregister_device (priv->vdev);if (priv->use_c_thread) -if (__atomic_fetch_sub (&conf_thread_mng.refcnt, -1 , __ATOMIC_RELAXED) ==1 ) +if (rte_atomic_fetch_sub_explicit (&conf_thread_mng.refcnt, +1 , rte_memory_order_relaxed) ==1 )mlx5_vdpa_mult_threads_destroy (true);rte_free (priv); }
drivers/vdpa/mlx5/mlx5_vdpa.h +7 -7
@@ -93,8 +93,8 @@ enum mlx5_vdpa_task_type {struct mlx5_vdpa_task {struct mlx5_vdpa_priv *priv;enum mlx5_vdpa_task_type type; -uint32_t *remaining_cnt; -uint32_t *err_cnt; +RTE_ATOMIC (uint32_t ) *remaining_cnt; +RTE_ATOMIC (uint32_t ) *err_cnt;uint32_t idx; } __rte_packed __rte_aligned(4);
@@ -107,7 +107,7 @@ struct mlx5_vdpa_c_thread {struct mlx5_vdpa_conf_thread_mng {void *initializer_priv; -uint32_t refcnt; +RTE_ATOMIC (uint32_t ) refcnt;uint32_t max_thrds;pthread_mutex_t cthrd_lock;struct mlx5_vdpa_c_thread cthrd[MLX5_VDPA_MAX_C_THRD ];
@@ -212,7 +212,7 @@ struct mlx5_vdpa_priv {uint64_t features;/* Negotiated features. */ uint16_t log_max_rqt_size;uint16_t last_c_thrd_idx; -uint16_t dev_close_progress; +RTE_ATOMIC (uint16_t ) dev_close_progress;uint16_t num_mrs;/* Number of memory regions. */ struct mlx5_vdpa_steer steer;struct mlx5dv_var *var;
@@ -581,13 +581,13 @@ int mlx5_vdpa_dirty_bitmap_set(struct mlx5_vdpa_priv *priv, uint64_t log_base, mlx5_vdpa_task_add(struct mlx5_vdpa_priv *priv, uint32_t thrd_idx, enum mlx5_vdpa_task_type task_type, - uint32_t *remaining_cnt, uint32_t *err_cnt, + RTE_ATOMIC(uint32_t) *remaining_cnt, RTE_ATOMIC(uint32_t) *err_cnt, void **task_data, uint32_t num);int mlx5_vdpa_register_mr (struct mlx5_vdpa_priv *priv,uint32_t idx);bool -mlx5_vdpa_c_thread_wait_bulk_tasks_done (uint32_t *remaining_cnt, -uint32_t *err_cnt,uint32_t sleep_time); +mlx5_vdpa_c_thread_wait_bulk_tasks_done (RTE_ATOMIC (uint32_t ) *remaining_cnt, +RTE_ATOMIC (uint32_t ) *err_cnt,uint32_t sleep_time);int mlx5_vdpa_virtq_setup (struct mlx5_vdpa_priv *priv,int index,bool reg_kick);void
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c +23 -23
114 lines not on this page · raw message
drivers/vdpa/mlx5/mlx5_vdpa_lm.c +3 -1
@@ -92,7 +92,9 @@int mlx5_vdpa_lm_log (struct mlx5_vdpa_priv *priv) { -uint32_t remaining_cnt =0 , err_cnt =0 , task_num =0 ; +RTE_ATOMIC (uint32_t ) remaining_cnt =0 ; +RTE_ATOMIC (uint32_t ) err_cnt =0 ; +uint32_t task_num =0 ;uint32_t i, thrd_idx, data[1 ];struct mlx5_vdpa_virtq *virtq;uint64_t features;
drivers/vdpa/mlx5/mlx5_vdpa_mem.c +3 -1
@@ -279,7 +279,9 @@uint8_t mode =0 ;int ret = -rte_errno;uint32_t i, thrd_idx, data[1 ]; -uint32_t remaining_cnt =0 , err_cnt =0 , task_num =0 ; +RTE_ATOMIC (uint32_t ) remaining_cnt =0 ; +RTE_ATOMIC (uint32_t ) err_cnt =0 ; +uint32_t task_num =0 ;struct rte_vhost_memory *mem =mlx5_vdpa_vhost_mem_regions_prepare (priv->vid, &mode, &priv->vmem_info.size, &priv->vmem_info.gcd, &priv->vmem_info.entries_num);
drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +3 -1
@@ -666,7 +666,9 @@ {int ret =rte_vhost_get_negotiated_features (priv->vid, &priv->features);uint16_t nr_vring =rte_vhost_get_vring_num (priv->vid); -uint32_t remaining_cnt =0 , err_cnt =0 , task_num =0 ; +RTE_ATOMIC (uint32_t ) remaining_cnt =0 ; +RTE_ATOMIC (uint32_t ) err_cnt =0 ; +uint32_t task_num =0 ;uint32_t i, thrd_idx, data[1 ];struct mlx5_vdpa_virtq *virtq;struct rte_vhost_vring vq;
Signature · 1 line
1.8.3.1
PATCH 23/46 raw/ifpga: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/raw/ifpga/ifpga_rawdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/raw/ifpga/ifpga_rawdev.c +5 -4
@@ -73,7 +73,7 @@static struct ifpga_rawdev ifpga_rawdevices[IFPGA_RAWDEV_NUM ]; -static int ifpga_monitor_refcnt; +static RTE_ATOMIC (int ) ifpga_monitor_refcnt;static rte_thread_t ifpga_monitor_start_thread; static struct ifpga_rawdev *
@@ -512,7 +512,7 @@ static int set_surprise_link_check_aer(int gsd_enable, ret;#define MS 1000 -while (__atomic_load_n (&ifpga_monitor_refcnt, __ATOMIC_RELAXED)) { +while (rte_atomic_load_explicit (&ifpga_monitor_refcnt, rte_memory_order_relaxed)) { gsd_enable =0 ;for (i =0 ; i <IFPGA_RAWDEV_NUM ; i++) { ifpga_rdev = &ifpga_rawdevices[i];
@@ -549,7 +549,7 @@ static int set_surprise_link_check_aer( dev->poll_enabled =1 ; -if (!__atomic_fetch_add (&ifpga_monitor_refcnt,1 , __ATOMIC_RELAXED)) { +if (!rte_atomic_fetch_add_explicit (&ifpga_monitor_refcnt,1 , rte_memory_order_relaxed)) { ret =rte_thread_create_internal_control (&ifpga_monitor_start_thread,"ifpga-mon" , ifpga_rawdev_gsd_handle,NULL );if (ret !=0 ) {
@@ -573,7 +573,8 @@ static int set_surprise_link_check_aer( dev->poll_enabled =0 ; -if (!(__atomic_fetch_sub (&ifpga_monitor_refcnt,1 , __ATOMIC_RELAXED) -1 ) && +if (!(rte_atomic_fetch_sub_explicit (&ifpga_monitor_refcnt,1 , + rte_memory_order_relaxed) -1 ) && ifpga_monitor_start_thread.opaque_id !=0 ) { ret =pthread_cancel ((pthread_t )ifpga_monitor_start_thread.opaque_id);if (ret)
Signature · 1 line
1.8.3.1
PATCH 24/46 event/opdl: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/event/opdl/opdl_ring.c | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-)
drivers/event/opdl/opdl_ring.c +40 -40
@@ -47,12 +47,12 @@ struct shared_state {/* Last known minimum sequence number of dependencies, used for multi * thread operation */ -uint32_t available_seq; +RTE_ATOMIC (uint32_t ) available_seq;char _pad1[RTE_CACHE_LINE_SIZE *3 ]; -uint32_t head;/* Head sequence number (for multi thread operation) */ +RTE_ATOMIC (uint32_t ) head;/* Head sequence number (for multi thread operation) */ char _pad2[RTE_CACHE_LINE_SIZE *3 ];struct opdl_stage *stage;/* back pointer */ -uint32_t tail;/* Tail sequence number */ +RTE_ATOMIC (uint32_t ) tail;/* Tail sequence number */ char _pad3[RTE_CACHE_LINE_SIZE *2 ]; } __rte_cache_aligned;
@@ -150,10 +150,10 @@ struct opdl_ring { available(const struct opdl_stage *s) {if (s->threadsafe == true) { -uint32_t n =__atomic_load_n (&s->shared.available_seq, - __ATOMIC_ACQUIRE) - -__atomic_load_n (&s->shared.head, - __ATOMIC_ACQUIRE); +uint32_t n =rte_atomic_load_explicit (&s->shared.available_seq, + rte_memory_order_acquire) - +rte_atomic_load_explicit (&s->shared.head, + rte_memory_order_acquire);/* Return 0 if available_seq needs to be updated */ return (n <= s->num_slots) ? n :0 ;
@@ -169,7 +169,7 @@ struct opdl_ring { {uint32_t i;uint32_t this_tail = s->shared.tail; -uint32_t min_seq =__atomic_load_n (&s->deps[0 ]->tail, __ATOMIC_ACQUIRE); +uint32_t min_seq =rte_atomic_load_explicit (&s->deps[0 ]->tail, rte_memory_order_acquire);/* Input stage sequence numbers are greater than the sequence numbers of * its dependencies so an offset of t->num_slots is needed when * calculating available slots and also the condition which is used to
@@ -180,16 +180,16 @@ struct opdl_ring {if (is_input_stage (s)) { wrap = s->num_slots;for (i =1 ; i < s->num_deps; i++) { -uint32_t seq =__atomic_load_n (&s->deps[i]->tail, - __ATOMIC_ACQUIRE); +uint32_t seq =rte_atomic_load_explicit (&s->deps[i]->tail, + rte_memory_order_acquire);if ((this_tail - seq) > (this_tail - min_seq)) min_seq = seq; } }else { wrap =0 ;for (i =1 ; i < s->num_deps; i++) { -uint32_t seq =__atomic_load_n (&s->deps[i]->tail, - __ATOMIC_ACQUIRE); +uint32_t seq =rte_atomic_load_explicit (&s->deps[i]->tail, + rte_memory_order_acquire);if ((seq - this_tail) < (min_seq - this_tail)) min_seq = seq; }
@@ -198,8 +198,8 @@ struct opdl_ring {if (s->threadsafe == false) s->available_seq = min_seq + wrap;else -__atomic_store_n (&s->shared.available_seq, min_seq + wrap, - __ATOMIC_RELEASE); +rte_atomic_store_explicit (&s->shared.available_seq, min_seq + wrap, + rte_memory_order_release); }/* Wait until the number of available slots reaches number requested */
@@ -299,7 +299,7 @@ struct opdl_ring {copy_entries_in (t, head, entries, num_entries); s->head += num_entries; -__atomic_store_n (&s->shared.tail, s->head, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&s->shared.tail, s->head, rte_memory_order_release);return num_entries; }
@@ -382,18 +382,18 @@ struct opdl_ring {/* There should be no race condition here. If shared.tail * matches, no other core can update it until this one does. */ -if (__atomic_load_n (&s->shared.tail, __ATOMIC_ACQUIRE) == +if (rte_atomic_load_explicit (&s->shared.tail, rte_memory_order_acquire) == tail) {if (num_entries >= (head - tail)) {claim_mgr_remove (disclaims); -__atomic_store_n (&s->shared.tail, head, - __ATOMIC_RELEASE); +rte_atomic_store_explicit (&s->shared.tail, head, + rte_memory_order_release); num_entries -= (head - tail); }else {claim_mgr_move_tail (disclaims, num_entries); -__atomic_store_n (&s->shared.tail, +rte_atomic_store_explicit (&s->shared.tail, num_entries + tail, - __ATOMIC_RELEASE); + rte_memory_order_release); num_entries =0 ; } }else if (block == false)
@@ -421,7 +421,7 @@ struct opdl_ring {opdl_stage_disclaim_multithread_n (s, disclaims->num_to_disclaim, false); - *old_head =__atomic_load_n (&s->shared.head, __ATOMIC_ACQUIRE); + *old_head =rte_atomic_load_explicit (&s->shared.head, rte_memory_order_acquire);while (true) {bool success;/* If called by opdl_ring_input(), claim does not need to be
@@ -441,11 +441,10 @@ struct opdl_ring {if (*num_entries ==0 )return ; - success =__atomic_compare_exchange_n (&s->shared.head, old_head, + success =rte_atomic_compare_exchange_weak_explicit (&s->shared.head, old_head, *old_head + *num_entries, - true,/* may fail spuriously */ - __ATOMIC_RELEASE,/* memory order on success */ - __ATOMIC_ACQUIRE);/* memory order on fail */ + rte_memory_order_release,/* memory order on success */ + rte_memory_order_acquire);/* memory order on fail */ if (likely (success))break ;rte_pause ();
@@ -473,10 +472,11 @@ struct opdl_ring {/* If another thread started inputting before this one, but hasn't * finished, we need to wait for it to complete to update the tail. */ -rte_wait_until_equal_32 (&s->shared.tail, old_head, __ATOMIC_ACQUIRE); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&s->shared.tail, old_head, + rte_memory_order_acquire); -__atomic_store_n (&s->shared.tail, old_head + num_entries, - __ATOMIC_RELEASE); +rte_atomic_store_explicit (&s->shared.tail, old_head + num_entries, + rte_memory_order_release);return num_entries; }
@@ -526,8 +526,8 @@ struct opdl_ring {for (j =0 ; j < num_entries; j++) { ev = (struct rte_event *)get_slot (t, s->head+j); - event =__atomic_load_n (&(ev->event), - __ATOMIC_ACQUIRE); + event = rte_atomic_load_explicit((uint64_t __rte_atomic *)&ev->event, + rte_memory_order_acquire); opa_id =OPDL_OPA_MASK & (event >>OPDL_OPA_OFFSET ); flow_id =OPDL_FLOWID_MASK & event;
@@ -628,8 +628,8 @@ struct opdl_ring { num_entries, s->head - old_tail); num_entries = s->head - old_tail; } -__atomic_store_n (&s->shared.tail, num_entries + old_tail, - __ATOMIC_RELEASE); +rte_atomic_store_explicit (&s->shared.tail, num_entries + old_tail, + rte_memory_order_release); }uint32_t
@@ -658,7 +658,7 @@ struct opdl_ring {copy_entries_in (t, head, entries, num_entries); s->head += num_entries; -__atomic_store_n (&s->shared.tail, s->head, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&s->shared.tail, s->head, rte_memory_order_release);return num_entries;
@@ -677,7 +677,7 @@ struct opdl_ring {copy_entries_out (t, head, entries, num_entries); s->head += num_entries; -__atomic_store_n (&s->shared.tail, s->head, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&s->shared.tail, s->head, rte_memory_order_release);return num_entries; }
@@ -756,7 +756,7 @@ struct opdl_ring {return 0 ; }if (s->threadsafe == false) { -__atomic_store_n (&s->shared.tail, s->head, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&s->shared.tail, s->head, rte_memory_order_release); s->seq += s->num_claimed; s->shadow_head = s->head; s->num_claimed =0 ;
@@ -1009,8 +1009,8 @@ struct opdl_ring * ev_orig = (struct rte_event *)get_slot (t, s->shadow_head+i); - event =__atomic_load_n (&(ev_orig->event), - __ATOMIC_ACQUIRE); + event = rte_atomic_load_explicit((uint64_t __rte_atomic *)&ev_orig->event, + rte_memory_order_acquire); opa_id =OPDL_OPA_MASK & (event >>OPDL_OPA_OFFSET ); flow_id =OPDL_FLOWID_MASK & event;
@@ -1027,9 +1027,9 @@ struct opdl_ring *if ((event &OPDL_EVENT_MASK ) != ev_temp) { -__atomic_store_n (&(ev_orig->event), - ev_update, - __ATOMIC_RELEASE); + rte_atomic_store_explicit( + (uint64_t __rte_atomic *)&ev_orig->event, + ev_update, rte_memory_order_release); ev_updated = true; }if (ev_orig->u64 != ev->u64) {
Signature · 1 line
1.8.3.1
PATCH 25/46 event/octeontx: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/event/octeontx/timvf_evdev.h | 8 ++++---- drivers/event/octeontx/timvf_worker.h | 36 +++++++++++++++++------------------ 2 files changed, 22 insertions(+), 22 deletions(-)
drivers/event/octeontx/timvf_evdev.h +4 -4
@@ -126,15 +126,15 @@ enum timvf_clk_src {struct tim_mem_bucket {uint64_t first_chunk;union { -uint64_t w1; +RTE_ATOMIC (uint64_t ) w1;struct { -uint32_t nb_entry; +RTE_ATOMIC (uint32_t ) nb_entry;uint8_t sbt:1 ;uint8_t hbt:1 ;uint8_t bsk:1 ;uint8_t rsvd:5 ; -uint8_t lock; -int16_t chunk_remainder; +RTE_ATOMIC (uint8_t ) lock; +RTE_ATOMIC (int16_t ) chunk_remainder; }; };uint64_t current_chunk;
drivers/event/octeontx/timvf_worker.h +18 -18
@@ -19,22 +19,22 @@static inline int16_t timr_bkt_get_rem (struct tim_mem_bucket *bktp) { -return __atomic_load_n (&bktp->chunk_remainder, - __ATOMIC_ACQUIRE); +return rte_atomic_load_explicit (&bktp->chunk_remainder, + rte_memory_order_acquire); }static inline void timr_bkt_set_rem (struct tim_mem_bucket *bktp,uint16_t v) { -__atomic_store_n (&bktp->chunk_remainder, v, - __ATOMIC_RELEASE); +rte_atomic_store_explicit (&bktp->chunk_remainder, v, + rte_memory_order_release); }static inline void timr_bkt_sub_rem (struct tim_mem_bucket *bktp,uint16_t v) { -__atomic_fetch_sub (&bktp->chunk_remainder, v, - __ATOMIC_RELEASE); +rte_atomic_fetch_sub_explicit (&bktp->chunk_remainder, v, + rte_memory_order_release); } static inline uint8_t
@@ -47,14 +47,14 @@ timr_bkt_set_sbt(struct tim_mem_bucket *bktp) {const uint64_t v =TIM_BUCKET_W1_M_SBT <<TIM_BUCKET_W1_S_SBT ; -return __atomic_fetch_or (&bktp->w1, v, __ATOMIC_ACQ_REL); +return rte_atomic_fetch_or_explicit (&bktp->w1, v, rte_memory_order_acq_rel); }static inline uint64_t timr_bkt_clr_sbt (struct tim_mem_bucket *bktp) {const uint64_t v = ~(TIM_BUCKET_W1_M_SBT <<TIM_BUCKET_W1_S_SBT ); -return __atomic_fetch_and (&bktp->w1, v, __ATOMIC_ACQ_REL); +return rte_atomic_fetch_and_explicit (&bktp->w1, v, rte_memory_order_acq_rel); } static inline uint8_t
@@ -81,34 +81,34 @@ {/*Clear everything except lock. */ const uint64_t v =TIM_BUCKET_W1_M_LOCK <<TIM_BUCKET_W1_S_LOCK ; -return __atomic_fetch_and (&bktp->w1, v, __ATOMIC_ACQ_REL); +return rte_atomic_fetch_and_explicit (&bktp->w1, v, rte_memory_order_acq_rel); }static inline uint64_t timr_bkt_fetch_sema_lock (struct tim_mem_bucket *bktp) { -return __atomic_fetch_add (&bktp->w1,TIM_BUCKET_SEMA_WLOCK , - __ATOMIC_ACQ_REL); +return rte_atomic_fetch_add_explicit (&bktp->w1,TIM_BUCKET_SEMA_WLOCK , + rte_memory_order_acq_rel); }static inline uint64_t timr_bkt_fetch_sema (struct tim_mem_bucket *bktp) { -return __atomic_fetch_add (&bktp->w1,TIM_BUCKET_SEMA , - __ATOMIC_RELAXED); +return rte_atomic_fetch_add_explicit (&bktp->w1,TIM_BUCKET_SEMA , + rte_memory_order_relaxed); }static inline uint64_t timr_bkt_inc_lock (struct tim_mem_bucket *bktp) {const uint64_t v =1ull <<TIM_BUCKET_W1_S_LOCK ; -return __atomic_fetch_add (&bktp->w1, v, __ATOMIC_ACQ_REL); +return rte_atomic_fetch_add_explicit (&bktp->w1, v, rte_memory_order_acq_rel); }static inline void timr_bkt_dec_lock (struct tim_mem_bucket *bktp) { -__atomic_fetch_add (&bktp->lock,0xff , __ATOMIC_ACQ_REL); +rte_atomic_fetch_add_explicit (&bktp->lock,0xff , rte_memory_order_acq_rel); } static inline uint32_t
@@ -121,13 +121,13 @@static inline void timr_bkt_inc_nent (struct tim_mem_bucket *bktp) { -__atomic_fetch_add (&bktp->nb_entry,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&bktp->nb_entry,1 , rte_memory_order_relaxed); }static inline void timr_bkt_add_nent (struct tim_mem_bucket *bktp,uint32_t v) { -__atomic_fetch_add (&bktp->nb_entry, v, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&bktp->nb_entry, v, rte_memory_order_relaxed); } static inline uint64_t
@@ -135,7 +135,7 @@ {const uint64_t v = ~(TIM_BUCKET_W1_M_NUM_ENTRIES <<TIM_BUCKET_W1_S_NUM_ENTRIES ); -return __atomic_fetch_and (&bktp->w1, v, __ATOMIC_ACQ_REL) & v; +return rte_atomic_fetch_and_explicit (&bktp->w1, v, rte_memory_order_acq_rel) & v; } static inline struct tim_mem_entry *
Signature · 1 line
1.8.3.1
PATCH 26/46 event/dsw: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/event/dsw/dsw_evdev.h | 6 +++--- drivers/event/dsw/dsw_event.c | 34 +++++++++++++++++----------------- drivers/event/dsw/dsw_xstats.c | 4 ++-- 3 files changed, 22 insertions(+), 22 deletions(-)
drivers/event/dsw/dsw_evdev.h +3 -3
@@ -227,9 +227,9 @@ struct dsw_port { struct rte_ring *ctl_in_ring __rte_cache_aligned;/* Estimate of current port load. */ - int16_t load __rte_cache_aligned; + RTE_ATOMIC(int16_t) load __rte_cache_aligned;/* Estimate of flows currently migrating to this port. */ - int32_t immigration_load __rte_cache_aligned; + RTE_ATOMIC(int32_t) immigration_load __rte_cache_aligned; } __rte_cache_aligned;struct dsw_queue {
@@ -252,7 +252,7 @@ struct dsw_evdev {uint8_t num_queues;int32_t max_inflight; - int32_t credits_on_loan __rte_cache_aligned; + RTE_ATOMIC(int32_t) credits_on_loan __rte_cache_aligned; };#define DSW_CTL_PAUS_REQ (0)
drivers/event/dsw/dsw_event.c +17 -17
@@ -33,7 +33,7 @@ } total_on_loan = -__atomic_load_n (&dsw->credits_on_loan, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&dsw->credits_on_loan, rte_memory_order_relaxed); available = dsw->max_inflight - total_on_loan; acquired_credits =RTE_MAX (missing_credits,DSW_PORT_MIN_CREDITS );
@@ -45,13 +45,13 @@* allocation. */ new_total_on_loan = -__atomic_fetch_add (&dsw->credits_on_loan, acquired_credits, - __ATOMIC_RELAXED) + acquired_credits; +rte_atomic_fetch_add_explicit (&dsw->credits_on_loan, acquired_credits, + rte_memory_order_relaxed) + acquired_credits;if (unlikely (new_total_on_loan > dsw->max_inflight)) {/* Some other port took the last credits */ -__atomic_fetch_sub (&dsw->credits_on_loan, acquired_credits, - __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&dsw->credits_on_loan, acquired_credits, + rte_memory_order_relaxed);return false; }
@@ -77,8 +77,8 @@ port->inflight_credits = leave_credits; -__atomic_fetch_sub (&dsw->credits_on_loan, return_credits, - __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&dsw->credits_on_loan, return_credits, + rte_memory_order_relaxed); DSW_LOG_DP_PORT(DEBUG, port->id, "Returned %d tokens to pool.\n",
@@ -156,19 +156,19 @@int16_t period_load;int16_t new_load; - old_load =__atomic_load_n (&port->load, __ATOMIC_RELAXED); + old_load =rte_atomic_load_explicit (&port->load, rte_memory_order_relaxed); period_load =dsw_port_load_close_period (port, now); new_load = (period_load + old_load*DSW_OLD_LOAD_WEIGHT ) / (DSW_OLD_LOAD_WEIGHT +1 ); -__atomic_store_n (&port->load, new_load, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&port->load, new_load, rte_memory_order_relaxed);/* The load of the recently immigrated flows should hopefully * be reflected the load estimate by now. */ -__atomic_store_n (&port->immigration_load,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&port->immigration_load,0 , rte_memory_order_relaxed); } static void
@@ -390,10 +390,10 @@ struct dsw_queue_flow_burst {for (i =0 ; i < dsw->num_ports; i++) {int16_t measured_load = -__atomic_load_n (&dsw->ports[i].load, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&dsw->ports[i].load, rte_memory_order_relaxed);int32_t immigration_load = -__atomic_load_n (&dsw->ports[i].immigration_load, - __ATOMIC_RELAXED); +rte_atomic_load_explicit (&dsw->ports[i].immigration_load, + rte_memory_order_relaxed);int32_t load = measured_load + immigration_load; load =RTE_MIN (load,DSW_MAX_LOAD );
@@ -523,8 +523,8 @@ struct dsw_queue_flow_burst { target_qfs[*targets_len] = *candidate_qf; (*targets_len)++; -__atomic_fetch_add (&dsw->ports[candidate_port_id].immigration_load, - candidate_flow_load, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&dsw->ports[candidate_port_id].immigration_load, + candidate_flow_load, rte_memory_order_relaxed);return true; }
@@ -882,7 +882,7 @@ struct dsw_queue_flow_burst { } source_port_load = -__atomic_load_n (&source_port->load, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&source_port->load, rte_memory_order_relaxed);if (source_port_load <DSW_MIN_SOURCE_LOAD_FOR_MIGRATION ) { DSW_LOG_DP_PORT(DEBUG, source_port->id, "Load %d is below threshold level %d.\n",
@@ -1301,7 +1301,7 @@ struct dsw_queue_flow_burst {* above the water mark. */ if (unlikely (num_new >0 && -__atomic_load_n (&dsw->credits_on_loan, __ATOMIC_RELAXED) > +rte_atomic_load_explicit (&dsw->credits_on_loan, rte_memory_order_relaxed) > source_port->new_event_threshold))return 0 ;
drivers/event/dsw/dsw_xstats.c +2 -2
@@ -48,7 +48,7 @@ struct dsw_xstats_port {static uint64_t dsw_xstats_dev_credits_on_loan (struct dsw_evdev *dsw) { -return __atomic_load_n (&dsw->credits_on_loan, __ATOMIC_RELAXED); +return rte_atomic_load_explicit (&dsw->credits_on_loan, rte_memory_order_relaxed); }static struct dsw_xstat_dev dsw_dev_xstats[] = {
@@ -126,7 +126,7 @@ struct dsw_xstats_port { {int16_t load; - load =__atomic_load_n (&dsw->ports[port_id].load, __ATOMIC_RELAXED); + load =rte_atomic_load_explicit (&dsw->ports[port_id].load, rte_memory_order_relaxed);return DSW_LOAD_TO_PERCENT (load); }
Signature · 1 line
1.8.3.1
PATCH 27/46 dma/skeleton: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/dma/skeleton/skeleton_dmadev.c | 5 +++-- drivers/dma/skeleton/skeleton_dmadev.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/dma/skeleton/skeleton_dmadev.c +3 -2
@@ -142,7 +142,7 @@else if (desc->op ==SKELDMA_OP_FILL )do_fill (desc); -__atomic_fetch_add (&hw->completed_count,1 , __ATOMIC_RELEASE); +rte_atomic_fetch_add_explicit (&hw->completed_count,1 , rte_memory_order_release); (void )rte_ring_enqueue (hw->desc_completed, (void *)desc); }
@@ -335,7 +335,8 @@RTE_SET_USED (vchan); *status =RTE_DMA_VCHAN_IDLE ; -if (hw->submitted_count !=__atomic_load_n (&hw->completed_count, __ATOMIC_ACQUIRE) +if (hw->submitted_count !=rte_atomic_load_explicit (&hw->completed_count, + rte_memory_order_acquire) || hw->zero_req_count ==0 ) *status =RTE_DMA_VCHAN_ACTIVE ;return 0 ;
drivers/dma/skeleton/skeleton_dmadev.h +1 -1
@@ -81,7 +81,7 @@ struct skeldma_hw {/* Cache delimiter for cpuwork thread's operation data */ char cache2 __rte_cache_aligned;volatile uint32_t zero_req_count; - uint64_t completed_count; + RTE_ATOMIC(uint64_t) completed_count; };#endif /* SKELETON_DMADEV_H */
Signature · 1 line
1.8.3.1
PATCH 28/46 crypto/octeontx: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/crypto/octeontx/otx_cryptodev_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/octeontx/otx_cryptodev_ops.c +2 -2
@@ -652,7 +652,7 @@if (!rsp_info->sched_type)ssows_head_wait (ws); -rte_atomic_thread_fence (__ATOMIC_RELEASE); +rte_atomic_thread_fence (rte_memory_order_release);ssovf_store_pair (add_work, req, ws->grps[rsp_info->queue_id]); }
@@ -896,7 +896,7 @@ pcount =pending_queue_level (pqueue,DEFAULT_CMD_QLEN );/* Ensure pcount isn't read before data lands */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); count = (nb_ops > pcount) ? pcount : nb_ops;
Signature · 1 line
1.8.3.1
PATCH 29/46 common/mlx5: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/common/mlx5/linux/mlx5_nl.c | 5 +-- drivers/common/mlx5/mlx5_common.h | 2 +- drivers/common/mlx5/mlx5_common_mr.c | 16 ++++----- drivers/common/mlx5/mlx5_common_mr.h | 2 +- drivers/common/mlx5/mlx5_common_utils.c | 32 +++++++++--------- drivers/common/mlx5/mlx5_common_utils.h | 6 ++-- drivers/common/mlx5/mlx5_malloc.c | 58 ++++++++++++++++----------------- 7 files changed, 61 insertions(+), 60 deletions(-)
drivers/common/mlx5/linux/mlx5_nl.c +3 -2
@@ -175,10 +175,11 @@ struct mlx5_nl_port_info {uint16_t state;/**< IB device port state (out). */ }; -uint32_t atomic_sn; +RTE_ATOMIC (uint32_t ) atomic_sn;/* Generate Netlink sequence number. */ -#define MLX5_NL_SN_GENERATE (__atomic_fetch_add(&atomic_sn, 1, __ATOMIC_RELAXED) + 1) +#define MLX5_NL_SN_GENERATE (rte_atomic_fetch_add_explicit(&atomic_sn, 1, \ + rte_memory_order_relaxed) + 1)/** * Opens a Netlink socket.
drivers/common/mlx5/mlx5_common.h +1 -1
@@ -195,7 +195,7 @@ enum mlx5_cqe_status {/* Prevent speculative reading of other fields in CQE until * CQE is valid. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);if (unlikely (op_code ==MLX5_CQE_RESP_ERR || op_code ==MLX5_CQE_REQ_ERR ))
drivers/common/mlx5/mlx5_common_mr.c +8 -8
@@ -35,7 +35,7 @@ struct mlx5_range {/** Memory region for a mempool. */ struct mlx5_mempool_mr {struct mlx5_pmd_mr pmd_mr; -uint32_t refcnt;/**< Number of mempools sharing this MR. */ +RTE_ATOMIC (uint32_t ) refcnt;/**< Number of mempools sharing this MR. */ };/* Mempool registration. */
@@ -56,11 +56,11 @@ struct mlx5_mempool_reg { {struct mlx5_mprq_buf *buf = opaque; -if (__atomic_load_n (&buf->refcnt, __ATOMIC_RELAXED) ==1 ) { +if (rte_atomic_load_explicit (&buf->refcnt, rte_memory_order_relaxed) ==1 ) {rte_mempool_put (buf->mp, buf); - }else if (unlikely (__atomic_fetch_sub (&buf->refcnt,1 , - __ATOMIC_RELAXED) -1 ==0 )) { -__atomic_store_n (&buf->refcnt,1 , __ATOMIC_RELAXED); + }else if (unlikely (rte_atomic_fetch_sub_explicit (&buf->refcnt,1 , + rte_memory_order_relaxed) -1 ==0 )) { +rte_atomic_store_explicit (&buf->refcnt,1 , rte_memory_order_relaxed);rte_mempool_put (buf->mp, buf); } }
@@ -1650,7 +1650,7 @@ struct mlx5_mempool_get_extmem_data {unsigned int i;for (i =0 ; i < mpr->mrs_n; i++) -__atomic_fetch_add (&mpr->mrs[i].refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&mpr->mrs[i].refcnt,1 , rte_memory_order_relaxed); }/**
@@ -1665,8 +1665,8 @@ struct mlx5_mempool_get_extmem_data {bool ret = false;for (i =0 ; i < mpr->mrs_n; i++) - ret |=__atomic_fetch_sub (&mpr->mrs[i].refcnt,1 , - __ATOMIC_RELAXED) -1 ==0 ; + ret |=rte_atomic_fetch_sub_explicit (&mpr->mrs[i].refcnt,1 , + rte_memory_order_relaxed) -1 ==0 ;return ret; }
drivers/common/mlx5/mlx5_common_mr.h +1 -1
@@ -93,7 +93,7 @@ struct mlx5_mr_share_cache {/* Multi-Packet RQ buffer header. */ struct mlx5_mprq_buf {struct rte_mempool *mp; -uint16_t refcnt;/* Atomically accessed refcnt. */ +RTE_ATOMIC (uint16_t ) refcnt;/* Atomically accessed refcnt. */ struct rte_mbuf_ext_shared_info shinfos[];/* * Shared information per stride.
drivers/common/mlx5/mlx5_common_utils.c +16 -16
@@ -81,14 +81,14 @@ struct mlx5_list *while (entry !=NULL ) {if (l_const->cb_match (l_const->ctx, entry, ctx) ==0 ) {if (reuse) { - ret =__atomic_fetch_add (&entry->ref_cnt,1 , - __ATOMIC_RELAXED); + ret =rte_atomic_fetch_add_explicit (&entry->ref_cnt,1 , + rte_memory_order_relaxed);DRV_LOG (DEBUG ,"mlx5 list %s entry %p ref: %u." , l_const->name, (void *)entry, entry->ref_cnt); }else if (lcore_index <MLX5_LIST_GLOBAL ) { - ret =__atomic_load_n (&entry->ref_cnt, - __ATOMIC_RELAXED); + ret =rte_atomic_load_explicit (&entry->ref_cnt, + rte_memory_order_relaxed); }if (likely (ret !=0 || lcore_index ==MLX5_LIST_GLOBAL ))return entry;
@@ -151,13 +151,13 @@ struct mlx5_list_entry * {struct mlx5_list_cache *c = l_inconst->cache[lcore_index];struct mlx5_list_entry *entry =LIST_FIRST (&c->h); -uint32_t inv_cnt =__atomic_exchange_n (&c->inv_cnt,0 , - __ATOMIC_RELAXED); +uint32_t inv_cnt =rte_atomic_exchange_explicit (&c->inv_cnt,0 , + rte_memory_order_relaxed);while (inv_cnt !=0 && entry !=NULL ) {struct mlx5_list_entry *nentry =LIST_NEXT (entry, next); -if (__atomic_load_n (&entry->ref_cnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&entry->ref_cnt, rte_memory_order_relaxed) ==0 ) {LIST_REMOVE (entry, next);if (l_const->lcores_share) l_const->cb_clone_free (l_const->ctx, entry);
@@ -217,7 +217,7 @@ struct mlx5_list_entry * entry->lcore_idx = (uint32_t )lcore_index;LIST_INSERT_HEAD (&l_inconst->cache[lcore_index]->h, entry, next); -__atomic_fetch_add (&l_inconst->count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&l_inconst->count,1 , rte_memory_order_relaxed);DRV_LOG (DEBUG ,"MLX5 list %s c%d entry %p new: %u." , l_const->name, lcore_index, (void *)entry, entry->ref_cnt);
@@ -254,7 +254,7 @@ struct mlx5_list_entry * l_inconst->gen_cnt++;rte_rwlock_write_unlock (&l_inconst->lock);LIST_INSERT_HEAD (&l_inconst->cache[lcore_index]->h, local_entry, next); -__atomic_fetch_add (&l_inconst->count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&l_inconst->count,1 , rte_memory_order_relaxed);DRV_LOG (DEBUG ,"mlx5 list %s entry %p new: %u." , l_const->name, (void *)entry, entry->ref_cnt);return local_entry;
@@ -285,7 +285,7 @@ struct mlx5_list_entry * {struct mlx5_list_entry *gentry = entry->gentry; -if (__atomic_fetch_sub (&entry->ref_cnt,1 , __ATOMIC_RELAXED) -1 !=0 ) +if (rte_atomic_fetch_sub_explicit (&entry->ref_cnt,1 , rte_memory_order_relaxed) -1 !=0 )return 1 ;if (entry->lcore_idx == (uint32_t )lcore_idx) {LIST_REMOVE (entry, next);
@@ -294,23 +294,23 @@ struct mlx5_list_entry *else l_const->cb_remove (l_const->ctx, entry); }else { -__atomic_fetch_add (&l_inconst->cache[entry->lcore_idx]->inv_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&l_inconst->cache[entry->lcore_idx]->inv_cnt, +1 , rte_memory_order_relaxed); }if (!l_const->lcores_share) { -__atomic_fetch_sub (&l_inconst->count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&l_inconst->count,1 , rte_memory_order_relaxed);DRV_LOG (DEBUG ,"mlx5 list %s entry %p removed." , l_const->name, (void *)entry);return 0 ; } -if (__atomic_fetch_sub (&gentry->ref_cnt,1 , __ATOMIC_RELAXED) -1 !=0 ) +if (rte_atomic_fetch_sub_explicit (&gentry->ref_cnt,1 , rte_memory_order_relaxed) -1 !=0 )return 1 ;rte_rwlock_write_lock (&l_inconst->lock);if (likely (gentry->ref_cnt ==0 )) {LIST_REMOVE (gentry, next);rte_rwlock_write_unlock (&l_inconst->lock); l_const->cb_remove (l_const->ctx, gentry); -__atomic_fetch_sub (&l_inconst->count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&l_inconst->count,1 , rte_memory_order_relaxed);DRV_LOG (DEBUG ,"mlx5 list %s entry %p removed." , l_const->name, (void *)gentry);return 0 ;
@@ -377,7 +377,7 @@ struct mlx5_list_entry * mlx5_list_get_entry_num(struct mlx5_list *list) {MLX5_ASSERT (list); -return __atomic_load_n (&list->l_inconst.count, __ATOMIC_RELAXED); +return rte_atomic_load_explicit (&list->l_inconst.count, rte_memory_order_relaxed); }/********************* Hash List **********************/
drivers/common/mlx5/mlx5_common_utils.h +3 -3
@@ -29,7 +29,7 @@*/ struct mlx5_list_entry {LIST_ENTRY (mlx5_list_entry) next;/* Entry pointers in the list. */ - uint32_t ref_cnt __rte_aligned(8); /* 0 means, entry is invalid. */ + RTE_ATOMIC(uint32_t) ref_cnt __rte_aligned(8); /* 0 means, entry is invalid. */uint32_t lcore_idx;union {struct mlx5_list_entry *gentry;
@@ -39,7 +39,7 @@ struct mlx5_list_entry {struct mlx5_list_cache { LIST_HEAD(mlx5_list_head, mlx5_list_entry) h; -uint32_t inv_cnt;/* Invalid entries counter. */ +RTE_ATOMIC (uint32_t ) inv_cnt;/* Invalid entries counter. */ } __rte_cache_aligned;/**
@@ -111,7 +111,7 @@ struct mlx5_list_const {struct mlx5_list_inconst {rte_rwlock_t lock;/* read/write lock. */ volatile uint32_t gen_cnt;/* List modification may update it. */ -volatile uint32_t count;/* number of entries in list. */ +volatile RTE_ATOMIC (uint32_t ) count;/* number of entries in list. */ struct mlx5_list_cache *cache[MLX5_LIST_MAX ];/* Lcore cache, last index is the global cache. */ };
drivers/common/mlx5/mlx5_malloc.c +29 -29
121 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 30/46 common/idpf: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/common/idpf/idpf_common_device.h | 6 +++--- drivers/common/idpf/idpf_common_rxtx.c | 14 ++++++++------ drivers/common/idpf/idpf_common_rxtx.h | 2 +- drivers/common/idpf/idpf_common_rxtx_avx512.c | 16 ++++++++-------- 4 files changed, 20 insertions(+), 18 deletions(-)
drivers/common/idpf/idpf_common_device.h +3 -3
@@ -48,7 +48,7 @@ struct idpf_adapter {struct idpf_hw hw;struct virtchnl2_version_info virtchnl_version;struct virtchnl2_get_capabilities caps; -volatile uint32_t pend_cmd;/* pending command not finished */ +volatile RTE_ATOMIC (uint32_t ) pend_cmd;/* pending command not finished */ uint32_t cmd_retval;/* return value of the cmd response from cp */ uint8_t *mbx_resp;/* buffer to store the mailbox response from cp */
@@ -179,8 +179,8 @@ struct idpf_cmd_info { atomic_set_cmd(struct idpf_adapter *adapter, uint32_t ops) { uint32_t op_unk = VIRTCHNL2_OP_UNKNOWN; -bool ret =__atomic_compare_exchange (&adapter->pend_cmd, &op_unk, &ops, -0 , __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); +bool ret =rte_atomic_compare_exchange_strong_explicit (&adapter->pend_cmd, &op_unk, ops, + rte_memory_order_acquire, rte_memory_order_acquire);if (!ret)DRV_LOG (ERR ,"There is incomplete cmd %d" , adapter->pend_cmd);
drivers/common/idpf/idpf_common_rxtx.c +8 -6
@@ -592,8 +592,8 @@ next_avail =0 ; rx_bufq->nb_rx_hold -= delta; }else { -__atomic_fetch_add (&rx_bufq->rx_stats.mbuf_alloc_failed, - nb_desc - next_avail, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rx_bufq->rx_stats.mbuf_alloc_failed, + nb_desc - next_avail, rte_memory_order_relaxed);RX_LOG (DEBUG ,"RX mbuf alloc failed port_id=%u queue_id=%u" , rx_bufq->port_id, rx_bufq->queue_id);return ;
@@ -612,8 +612,8 @@ next_avail += nb_refill; rx_bufq->nb_rx_hold -= nb_refill; }else { -__atomic_fetch_add (&rx_bufq->rx_stats.mbuf_alloc_failed, - nb_desc - next_avail, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rx_bufq->rx_stats.mbuf_alloc_failed, + nb_desc - next_avail, rte_memory_order_relaxed);RX_LOG (DEBUG ,"RX mbuf alloc failed port_id=%u queue_id=%u" , rx_bufq->port_id, rx_bufq->queue_id); }
@@ -1093,7 +1093,8 @@ nmb =rte_mbuf_raw_alloc (rxq->mp);if (unlikely (nmb ==NULL )) { -__atomic_fetch_add (&rxq->rx_stats.mbuf_alloc_failed,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_stats.mbuf_alloc_failed,1 , + rte_memory_order_relaxed);RX_LOG (DEBUG ,"RX mbuf alloc failed port_id=%u " "queue_id=%u" , rxq->port_id, rxq->queue_id);break ;
@@ -1203,7 +1204,8 @@ nmb =rte_mbuf_raw_alloc (rxq->mp);if (unlikely (!nmb)) { -__atomic_fetch_add (&rxq->rx_stats.mbuf_alloc_failed,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_stats.mbuf_alloc_failed,1 , + rte_memory_order_relaxed);RX_LOG (DEBUG ,"RX mbuf alloc failed port_id=%u " "queue_id=%u" , rxq->port_id, rxq->queue_id);break ;
drivers/common/idpf/idpf_common_rxtx.h +1 -1
@@ -97,7 +97,7 @@#define IDPF_RX_SPLIT_BUFQ2_ID 2struct idpf_rx_stats { -uint64_t mbuf_alloc_failed; +RTE_ATOMIC (uint64_t ) mbuf_alloc_failed; };struct idpf_rx_queue {
drivers/common/idpf/idpf_common_rxtx_avx512.c +8 -8
@@ -38,8 +38,8 @@ dma_addr0); } } -__atomic_fetch_add (&rxq->rx_stats.mbuf_alloc_failed, -IDPF_RXQ_REARM_THRESH , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_stats.mbuf_alloc_failed, +IDPF_RXQ_REARM_THRESH , rte_memory_order_relaxed);return ; }struct rte_mbuf *mb0, *mb1, *mb2, *mb3;
@@ -168,8 +168,8 @@ dma_addr0); } } -__atomic_fetch_add (&rxq->rx_stats.mbuf_alloc_failed, -IDPF_RXQ_REARM_THRESH , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_stats.mbuf_alloc_failed, +IDPF_RXQ_REARM_THRESH , rte_memory_order_relaxed);return ; } }
@@ -564,8 +564,8 @@ dma_addr0); } } -__atomic_fetch_add (&rx_bufq->rx_stats.mbuf_alloc_failed, -IDPF_RXQ_REARM_THRESH , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rx_bufq->rx_stats.mbuf_alloc_failed, +IDPF_RXQ_REARM_THRESH , rte_memory_order_relaxed);return ; }
@@ -638,8 +638,8 @@ dma_addr0); } } -__atomic_fetch_add (&rx_bufq->rx_stats.mbuf_alloc_failed, -IDPF_RXQ_REARM_THRESH , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rx_bufq->rx_stats.mbuf_alloc_failed, +IDPF_RXQ_REARM_THRESH , rte_memory_order_relaxed);return ; } }
Signature · 1 line
1.8.3.1
PATCH 31/46 common/iavf: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/common/iavf/iavf_impl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/common/iavf/iavf_impl.c +2 -2
@@ -18,7 +18,7 @@ enum iavf_status u64 size, u32 alignment) { -static uint64_t iavf_dma_memzone_id; +static RTE_ATOMIC (uint64_t ) iavf_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];
@@ -26,7 +26,7 @@ enum iavf_statusreturn IAVF_ERR_PARAM ;snprintf (z_name,sizeof (z_name),"iavf_dma_%" PRIu64, -__atomic_fetch_add (&iavf_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&iavf_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_bounded (z_name, size,SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG , alignment,RTE_PGSIZE_2M );
Signature · 1 line
1.8.3.1
PATCH 32/46 baseband/acc: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/baseband/acc/rte_acc100_pmd.c | 36 +++++++++++++-------------- drivers/baseband/acc/rte_vrb_pmd.c | 46 +++++++++++++++++++++++------------ 2 files changed, 48 insertions(+), 34 deletions(-)
drivers/baseband/acc/rte_acc100_pmd.c +18 -18
@@ -3673,8 +3673,8 @@ desc_idx =acc_desc_idx_tail (q, *dequeued_descs); desc = q->ring_addr + desc_idx; - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)desc, + rte_memory_order_relaxed);/* Check fdone bit */ if (!(atom_desc.rsp.val &ACC_FDONE ))
@@ -3728,8 +3728,8 @@uint16_t current_dequeued_descs =0 , descs_in_tb; desc =acc_desc_tail (q, *dequeued_descs); - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)desc, + rte_memory_order_relaxed);/* Check fdone bit */ if (!(atom_desc.rsp.val &ACC_FDONE ))
@@ -3742,8 +3742,8 @@/* Check if last CB in TB is ready to dequeue (and thus * the whole TB) - checking sdone bit. If not return. */ - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)last_desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)last_desc, + rte_memory_order_relaxed);if (!(atom_desc.rsp.val &ACC_SDONE ))return -1 ;
@@ -3755,8 +3755,8 @@while (i < descs_in_tb) { desc =acc_desc_tail (q, *dequeued_descs); - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)desc, + rte_memory_order_relaxed); rsp.val = atom_desc.rsp.val;rte_bbdev_log_debug ("Resp. desc %p: %x descs %d cbs %d\n" , desc, rsp.val, descs_in_tb, desc->req.numCBs);
@@ -3793,8 +3793,8 @@struct rte_bbdev_dec_op *op; desc =acc_desc_tail (q, dequeued_cbs); - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)desc, + rte_memory_order_relaxed);/* Check fdone bit */ if (!(atom_desc.rsp.val &ACC_FDONE ))
@@ -3846,8 +3846,8 @@struct rte_bbdev_dec_op *op; desc =acc_desc_tail (q, dequeued_cbs); - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)desc, + rte_memory_order_relaxed);/* Check fdone bit */ if (!(atom_desc.rsp.val &ACC_FDONE ))
@@ -3902,8 +3902,8 @@uint8_t cbs_in_tb =1 , cb_idx =0 ; desc =acc_desc_tail (q, dequeued_cbs); - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)desc, + rte_memory_order_relaxed);/* Check fdone bit */ if (!(atom_desc.rsp.val &ACC_FDONE ))
@@ -3919,8 +3919,8 @@/* Check if last CB in TB is ready to dequeue (and thus * the whole TB) - checking sdone bit. If not return. */ - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)last_desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)last_desc, + rte_memory_order_relaxed);if (!(atom_desc.rsp.val &ACC_SDONE ))return -1 ;
@@ -3930,8 +3930,8 @@/* Read remaining CBs if exists */ while (cb_idx < cbs_in_tb) { desc =acc_desc_tail (q, dequeued_cbs); - atom_desc.atom_hdr =__atomic_load_n ((uint64_t *)desc, - __ATOMIC_RELAXED); + atom_desc.atom_hdr = rte_atomic_load_explicit((uint64_t __rte_atomic *)desc, + rte_memory_order_relaxed); rsp.val = atom_desc.rsp.val;rte_bbdev_log_debug ("Resp. desc %p: %x r %d c %d\n" , desc, rsp.val, cb_idx, cbs_in_tb);
drivers/baseband/acc/rte_vrb_pmd.c +30 -16
136 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 33/46 net/txgbe: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/txgbe/txgbe_ethdev.c | 12 +++++++----- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-)
drivers/net/txgbe/txgbe_ethdev.c +7 -5
@@ -595,7 +595,7 @@ static int txgbe_dev_interrupt_action(struct rte_eth_dev *dev,return 0 ; } -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);rte_eth_copy_pci_info (eth_dev, pci_dev); hw->hw_addr = (void *)pci_dev->mem_resource[0 ].addr;
@@ -2834,7 +2834,7 @@ static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,struct txgbe_adapter *ad =TXGBE_DEV_ADAPTER (dev);uint32_t timeout = timeout_ms ? timeout_ms :WARNING_TIMEOUT ; -while (__atomic_load_n (&ad->link_thread_running, __ATOMIC_SEQ_CST)) { +while (rte_atomic_load_explicit (&ad->link_thread_running, rte_memory_order_seq_cst)) {msec_delay (1 ); timeout--;
@@ -2859,7 +2859,7 @@ static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,rte_thread_detach (rte_thread_self ());txgbe_dev_setup_link_alarm_handler (dev); -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);return 0 ; }
@@ -2908,7 +2908,8 @@ static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, }else if (hw->phy.media_type == txgbe_media_type_fiber && dev->data->dev_conf.intr_conf.lsc !=0 ) {txgbe_dev_wait_setup_link_complete (dev,0 ); -if (!__atomic_test_and_set (&ad->link_thread_running, __ATOMIC_SEQ_CST)) { +if (!rte_atomic_exchange_explicit (&ad->link_thread_running,1 , + rte_memory_order_seq_cst)) {/* To avoid race condition between threads, set * the TXGBE_FLAG_NEED_LINK_CONFIG flag only * when there is no link thread running.
@@ -2918,7 +2919,8 @@ static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, "txgbe-link", txgbe_dev_setup_link_thread_handler, dev) < 0) {PMD_DRV_LOG (ERR ,"Create link thread failed!" ); -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , + rte_memory_order_seq_cst); } }else { PMD_DRV_LOG(ERR,
drivers/net/txgbe/txgbe_ethdev.h +1 -1
@@ -372,7 +372,7 @@ struct txgbe_adapter {/* For RSS reta table update */ uint8_t rss_reta_updated; -uint32_t link_thread_running; +RTE_ATOMIC (uint32_t ) link_thread_running;rte_thread_t link_thread_tid; };
drivers/net/txgbe/txgbe_ethdev_vf.c +1 -1
@@ -206,7 +206,7 @@ static int txgbevf_dev_link_update(struct rte_eth_dev *dev,return 0 ; } -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);rte_eth_copy_pci_info (eth_dev, pci_dev); hw->device_id = pci_dev->id.device_id;
Signature · 1 line
1.8.3.1
PATCH 34/46 net/null: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/null/rte_eth_null.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/null/rte_eth_null.c +6 -6
@@ -37,8 +37,8 @@ struct null_queue {struct rte_mempool *mb_pool;struct rte_mbuf *dummy_packet; -uint64_t rx_pkts; -uint64_t tx_pkts; +RTE_ATOMIC (uint64_t ) rx_pkts; +RTE_ATOMIC (uint64_t ) tx_pkts; };struct pmd_options {
@@ -102,7 +102,7 @@ struct pmd_internals { }/* NOTE: review for potential ordering optimization */ -__atomic_fetch_add (&h->rx_pkts, i, __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&h->rx_pkts, i, rte_memory_order_seq_cst);return i; }
@@ -130,7 +130,7 @@ struct pmd_internals { }/* NOTE: review for potential ordering optimization */ -__atomic_fetch_add (&h->rx_pkts, i, __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&h->rx_pkts, i, rte_memory_order_seq_cst);return i; }
@@ -155,7 +155,7 @@ struct pmd_internals {rte_pktmbuf_free (bufs[i]);/* NOTE: review for potential ordering optimization */ -__atomic_fetch_add (&h->tx_pkts, i, __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&h->tx_pkts, i, rte_memory_order_seq_cst);return i; }
@@ -178,7 +178,7 @@ struct pmd_internals { }/* NOTE: review for potential ordering optimization */ -__atomic_fetch_add (&h->tx_pkts, i, __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&h->tx_pkts, i, rte_memory_order_seq_cst);return i; }
Signature · 1 line
1.8.3.1
PATCH 35/46 event/dlb2: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/event/dlb2/dlb2.c | 34 +++++++++++++++++----------------- drivers/event/dlb2/dlb2_priv.h | 10 +++++----- drivers/event/dlb2/dlb2_xstats.c | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-)
drivers/event/dlb2/dlb2.c +17 -17
@@ -1005,7 +1005,7 @@ struct process_local_port_data } dlb2->new_event_limit = config->nb_events_limit; -__atomic_store_n (&dlb2->inflights,0 , __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&dlb2->inflights,0 , rte_memory_order_seq_cst);/* Save number of ports/queues for this event dev */ dlb2->num_ports = config->nb_event_ports;
@@ -2668,10 +2668,10 @@ static int dlb2_num_dir_queues_setup(struct dlb2_eventdev *dlb2) batch_size = credits;if (likely (credits && -__atomic_compare_exchange_n ( +rte_atomic_compare_exchange_strong_explicit ( qm_port->credit_pool[type], - &credits, credits - batch_size, false, - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))) + &credits, credits - batch_size, + rte_memory_order_seq_cst, rte_memory_order_seq_cst)))return batch_size;else return 0 ;
@@ -2687,7 +2687,7 @@ static int dlb2_num_dir_queues_setup(struct dlb2_eventdev *dlb2)/* Replenish credits, saving one quanta for enqueues */ uint16_t val = ev_port->inflight_credits - quanta; -__atomic_fetch_sub (&dlb2->inflights, val, __ATOMIC_SEQ_CST); +rte_atomic_fetch_sub_explicit (&dlb2->inflights, val, rte_memory_order_seq_cst); ev_port->inflight_credits -= val; } }
@@ -2696,8 +2696,8 @@ static int dlb2_num_dir_queues_setup(struct dlb2_eventdev *dlb2) dlb2_check_enqueue_sw_credits(struct dlb2_eventdev *dlb2, struct dlb2_eventdev_port *ev_port) { - uint32_t sw_inflights = __atomic_load_n(&dlb2->inflights, - __ATOMIC_SEQ_CST); + uint32_t sw_inflights = rte_atomic_load_explicit(&dlb2->inflights, + rte_memory_order_seq_cst);const int num =1 ;if (unlikely (ev_port->inflight_max < sw_inflights)) {
@@ -2719,8 +2719,8 @@ static int dlb2_num_dir_queues_setup(struct dlb2_eventdev *dlb2)return 1 ; } -__atomic_fetch_add (&dlb2->inflights, credit_update_quanta, - __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&dlb2->inflights, credit_update_quanta, + rte_memory_order_seq_cst); ev_port->inflight_credits += (credit_update_quanta);if (ev_port->inflight_credits < num) {
@@ -3234,17 +3234,17 @@ static int dlb2_num_dir_queues_setup(struct dlb2_eventdev *dlb2)if (qm_port->dlb2->version ==DLB2_HW_V2 ) { qm_port->cached_ldb_credits += num;if (qm_port->cached_ldb_credits >=2 * batch_size) { -__atomic_fetch_add ( +rte_atomic_fetch_add_explicit ( qm_port->credit_pool[DLB2_LDB_QUEUE ], - batch_size, __ATOMIC_SEQ_CST); + batch_size, rte_memory_order_seq_cst); qm_port->cached_ldb_credits -= batch_size; } }else { qm_port->cached_credits += num;if (qm_port->cached_credits >=2 * batch_size) { -__atomic_fetch_add ( +rte_atomic_fetch_add_explicit ( qm_port->credit_pool[DLB2_COMBINED_POOL ], - batch_size, __ATOMIC_SEQ_CST); + batch_size, rte_memory_order_seq_cst); qm_port->cached_credits -= batch_size; } }
@@ -3252,17 +3252,17 @@ static int dlb2_num_dir_queues_setup(struct dlb2_eventdev *dlb2)if (qm_port->dlb2->version ==DLB2_HW_V2 ) { qm_port->cached_dir_credits += num;if (qm_port->cached_dir_credits >=2 * batch_size) { -__atomic_fetch_add ( +rte_atomic_fetch_add_explicit ( qm_port->credit_pool[DLB2_DIR_QUEUE ], - batch_size, __ATOMIC_SEQ_CST); + batch_size, rte_memory_order_seq_cst); qm_port->cached_dir_credits -= batch_size; } }else { qm_port->cached_credits += num;if (qm_port->cached_credits >=2 * batch_size) { -__atomic_fetch_add ( +rte_atomic_fetch_add_explicit ( qm_port->credit_pool[DLB2_COMBINED_POOL ], - batch_size, __ATOMIC_SEQ_CST); + batch_size, rte_memory_order_seq_cst); qm_port->cached_credits -= batch_size; } }
drivers/event/dlb2/dlb2_priv.h +5 -5
@@ -348,7 +348,7 @@ struct dlb2_port {uint32_t dequeue_depth;enum dlb2_token_pop_mode token_pop_mode;union dlb2_port_config cfg; -uint32_t *credit_pool[DLB2_NUM_QUEUE_TYPES ];/* use __atomic builtins */ +RTE_ATOMIC (uint32_t ) *credit_pool[DLB2_NUM_QUEUE_TYPES ]; union { struct { uint16_t cached_ldb_credits;
@@ -586,7 +586,7 @@ struct dlb2_eventdev {uint32_t xstats_count_mode_dev;uint32_t xstats_count_mode_port;uint32_t xstats_count; -uint32_t inflights;/* use __atomic builtins */ +RTE_ATOMIC (uint32_t ) inflights;/* use __atomic builtins */ uint32_t new_event_limit;int max_num_events_override;int num_dir_credits_override;
@@ -624,14 +624,14 @@ struct dlb2_eventdev {uint16_t max_ldb_credits;uint16_t max_dir_credits;/* use __atomic builtins */ /* shared hw cred */ - uint32_t ldb_credit_pool __rte_cache_aligned; + RTE_ATOMIC(uint32_t) ldb_credit_pool __rte_cache_aligned;/* use __atomic builtins */ /* shared hw cred */ - uint32_t dir_credit_pool __rte_cache_aligned; + RTE_ATOMIC(uint32_t) dir_credit_pool __rte_cache_aligned; };struct {uint16_t max_credits;/* use __atomic builtins */ /* shared hw cred */ - uint32_t credit_pool __rte_cache_aligned; + RTE_ATOMIC(uint32_t) credit_pool __rte_cache_aligned; }; };uint32_t cos_ports[DLB2_COS_NUM_VALS ];/* total ldb ports in each class */
drivers/event/dlb2/dlb2_xstats.c +1 -1
@@ -173,7 +173,7 @@ struct dlb2_xstats_entry {case nb_events_limit:return dlb2->new_event_limit;case inflight_events: -return __atomic_load_n (&dlb2->inflights, __ATOMIC_SEQ_CST); +return rte_atomic_load_explicit (&dlb2->inflights, rte_memory_order_seq_cst);case ldb_pool_size:return dlb2->num_ldb_credits;case dir_pool_size:
Signature · 1 line
1.8.3.1
PATCH 36/46 dma/idxd: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/dma/idxd/idxd_internal.h | 2 +- drivers/dma/idxd/idxd_pci.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/dma/idxd/idxd_internal.h +1 -1
@@ -33,7 +33,7 @@ struct idxd_pci_common {rte_spinlock_t lk;uint8_t wq_cfg_sz; -uint16_t ref_count; +RTE_ATOMIC (uint16_t ) ref_count;volatile struct rte_idxd_bar0 *regs;volatile uint32_t *wq_regs_base;volatile struct rte_idxd_grpcfg *grp_regs;
drivers/dma/idxd/idxd_pci.c +5 -4
@@ -136,7 +136,8 @@* the PCI struct */ /* NOTE: review for potential ordering optimization */ - is_last_wq = (__atomic_fetch_sub (&idxd->u.pci->ref_count,1 , __ATOMIC_SEQ_CST) ==1 ); + is_last_wq = (rte_atomic_fetch_sub_explicit (&idxd->u.pci->ref_count,1 , + rte_memory_order_seq_cst) ==1 );if (is_last_wq) {/* disable the device */ err_code =idxd_pci_dev_command (idxd, idxd_disable_dev);
@@ -330,9 +331,9 @@return ret; } qid =rte_dma_get_dev_id_by_name (qname); - max_qid =__atomic_load_n ( + max_qid =rte_atomic_load_explicit ( &((struct idxd_dmadev *)rte_dma_fp_objs[qid].dev_private)->u.pci->ref_count, - __ATOMIC_SEQ_CST); + rte_memory_order_seq_cst);/* we have queue 0 done, now configure the rest of the queues */ for (qid =1 ; qid < max_qid; qid++) {
@@ -389,7 +390,7 @@free (idxd.u.pci);return ret; } -__atomic_fetch_add (&idxd.u.pci->ref_count,1 , __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&idxd.u.pci->ref_count,1 , rte_memory_order_seq_cst); }return 0 ;
Signature · 1 line
1.8.3.1
PATCH 37/46 crypto/ccp: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/crypto/ccp/ccp_dev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/ccp/ccp_dev.c +4 -4
@@ -116,15 +116,15 @@ struct ccp_queue *static inline void ccp_set_bit (unsigned long *bitmap,int n) { -__atomic_fetch_or (&bitmap[WORD_OFFSET (n)], (1UL <<BIT_OFFSET (n)), - __ATOMIC_SEQ_CST); +rte_atomic_fetch_or_explicit ((unsigned long __rte_atomic *)&bitmap[WORD_OFFSET (n)], + (1UL <<BIT_OFFSET (n)), rte_memory_order_seq_cst); }static inline void ccp_clear_bit (unsigned long *bitmap,int n) { -__atomic_fetch_and (&bitmap[WORD_OFFSET (n)], ~(1UL <<BIT_OFFSET (n)), - __ATOMIC_SEQ_CST); +rte_atomic_fetch_and_explicit ((unsigned long __rte_atomic *)&bitmap[WORD_OFFSET (n)], + ~(1UL <<BIT_OFFSET (n)), rte_memory_order_seq_cst); } static inline uint32_t
Signature · 1 line
1.8.3.1
PATCH 38/46 common/cpt: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/common/cpt/cpt_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/cpt/cpt_common.h +1 -1
@@ -73,7 +73,7 @@ struct cpt_request_info { const unsigned int qsize) {/* Ensure ordering between setting the entry and updating the tail */ -rte_atomic_thread_fence (__ATOMIC_RELEASE); +rte_atomic_thread_fence (rte_memory_order_release); q->tail = (q->tail + cnt) & (qsize -1 ); }
Signature · 1 line
1.8.3.1
PATCH 39/46 bus/vmbus: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/bus/vmbus/vmbus_channel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/bus/vmbus/vmbus_channel.c +5 -4
@@ -19,22 +19,23 @@#include "private.h" static inline void -vmbus_sync_set_bit (volatile uint32_t *addr,uint32_t mask) +vmbus_sync_set_bit (volatile RTE_ATOMIC (uint32_t ) *addr,uint32_t mask) {/* Use GCC builtin which atomic does atomic OR operation */ -__atomic_fetch_or (addr, mask, __ATOMIC_SEQ_CST); +rte_atomic_fetch_or_explicit (addr, mask, rte_memory_order_seq_cst); }static inline void vmbus_set_monitor (const struct vmbus_channel *channel,uint32_t monitor_id) { -uint32_t *monitor_addr, monitor_mask; +RTE_ATOMIC (uint32_t ) *monitor_addr, monitor_mask;unsigned int trigger_index; trigger_index = monitor_id /HV_MON_TRIG_LEN ; monitor_mask =1u << (monitor_id %HV_MON_TRIG_LEN ); - monitor_addr = &channel->monitor_page->trigs[trigger_index].pending; + monitor_addr = + (uint32_t __rte_atomic *)&channel->monitor_page->trigs[trigger_index].pending;vmbus_sync_set_bit (monitor_addr, monitor_mask); }
Signature · 1 line
1.8.3.1
PATCH 40/46 examples: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- examples/bbdev_app/main.c | 13 +++++---- examples/l2fwd-event/l2fwd_common.h | 4 +-- examples/l2fwd-event/l2fwd_event.c | 24 ++++++++-------- examples/l2fwd-jobstats/main.c | 11 ++++---- .../client_server_mp/mp_server/main.c | 6 ++-- examples/server_node_efd/efd_server/main.c | 6 ++-- examples/vhost/main.c | 32 +++++++++++----------- examples/vhost/main.h | 4 +-- examples/vhost/virtio_net.c | 13 +++++---- examples/vhost_blk/vhost_blk.c | 8 +++--- examples/vm_power_manager/channel_monitor.c | 9 +++--- 11 files changed, 68 insertions(+), 62 deletions(-)
examples/bbdev_app/main.c +7 -6
@@ -165,7 +165,7 @@ struct stats_lcore_params { .num_dec_cores = 1, }; -static uint16_t global_exit_flag; +static RTE_ATOMIC (uint16_t ) global_exit_flag;/* display usage */ static inline void
@@ -277,7 +277,7 @@ uint16_t bbdev_parse_number(const char *mask) signal_handler(int signum) {printf ("\nSignal %d received\n" , signum); -__atomic_store_n (&global_exit_flag,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&global_exit_flag,1 , rte_memory_order_relaxed); } static void
@@ -321,7 +321,8 @@ uint16_t bbdev_parse_number(const char *mask)fflush (stdout);for (count =0 ; count <=MAX_CHECK_TIME && - !__atomic_load_n (&global_exit_flag, __ATOMIC_RELAXED); count++) { + !rte_atomic_load_explicit (&global_exit_flag, + rte_memory_order_relaxed); count++) {memset (&link,0 ,sizeof (link)); link_get_err =rte_eth_link_get_nowait (port_id, &link);
@@ -675,7 +676,7 @@ uint16_t bbdev_parse_number(const char *mask) {struct stats_lcore_params *stats_lcore = arg; -while (!__atomic_load_n (&global_exit_flag, __ATOMIC_RELAXED)) { +while (!rte_atomic_load_explicit (&global_exit_flag, rte_memory_order_relaxed)) {print_stats (stats_lcore);rte_delay_ms (500 ); }
@@ -921,7 +922,7 @@ uint16_t bbdev_parse_number(const char *mask)const bool run_decoder = (lcore_conf->core_type & (1 <<RTE_BBDEV_OP_TURBO_DEC )); -while (!__atomic_load_n (&global_exit_flag, __ATOMIC_RELAXED)) { +while (!rte_atomic_load_explicit (&global_exit_flag, rte_memory_order_relaxed)) {if (run_encoder)run_encoding (lcore_conf);if (run_decoder)
@@ -1055,7 +1056,7 @@ uint16_t bbdev_parse_number(const char *mask) .align = alignof(struct rte_mbuf *), }; -__atomic_store_n (&global_exit_flag,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&global_exit_flag,0 , rte_memory_order_relaxed); sigret =signal (SIGTERM , signal_handler);if (sigret ==SIG_ERR )
examples/l2fwd-event/l2fwd_common.h +2 -2
@@ -61,8 +61,8 @@/* Per-port statistics struct */ struct l2fwd_port_statistics {uint64_t dropped; -uint64_t tx; -uint64_t rx; +RTE_ATOMIC (uint64_t ) tx; +RTE_ATOMIC (uint64_t ) rx; } __rte_cache_aligned;/* Event vector attributes */
examples/l2fwd-event/l2fwd_event.c +12 -12
@@ -163,8 +163,8 @@ dst_port = rsrc->dst_ports[mbuf->port];if (timer_period >0 ) -__atomic_fetch_add (&rsrc->port_stats[mbuf->port].rx, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rsrc->port_stats[mbuf->port].rx, +1 , rte_memory_order_relaxed); mbuf->port = dst_port;if (flags &L2FWD_EVENT_UPDT_MAC )
@@ -179,8 +179,8 @@rte_event_eth_tx_adapter_txq_set (mbuf,0 );if (timer_period >0 ) -__atomic_fetch_add (&rsrc->port_stats[mbuf->port].tx, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rsrc->port_stats[mbuf->port].tx, +1 , rte_memory_order_relaxed); }static __rte_always_inline void
@@ -367,8 +367,8 @@ vec->queue =0 ;if (timer_period >0 ) -__atomic_fetch_add (&rsrc->port_stats[mbufs[0 ]->port].rx, - vec->nb_elem, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rsrc->port_stats[mbufs[0 ]->port].rx, + vec->nb_elem, rte_memory_order_relaxed);for (i =0 , j =1 ; i < vec->nb_elem; i++, j++) {if (j < vec->nb_elem)
@@ -382,14 +382,14 @@ }if (timer_period >0 ) -__atomic_fetch_add (&rsrc->port_stats[vec->port].tx, - vec->nb_elem, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rsrc->port_stats[vec->port].tx, + vec->nb_elem, rte_memory_order_relaxed); }else {for (i =0 , j =1 ; i < vec->nb_elem; i++, j++) {if (timer_period >0 ) -__atomic_fetch_add ( +rte_atomic_fetch_add_explicit ( &rsrc->port_stats[mbufs[i]->port].rx,1 , - __ATOMIC_RELAXED); + rte_memory_order_relaxed);if (j < vec->nb_elem) rte_prefetch0(
@@ -406,9 +406,9 @@rte_event_eth_tx_adapter_txq_set (mbufs[i],0 );if (timer_period >0 ) -__atomic_fetch_add ( +rte_atomic_fetch_add_explicit ( &rsrc->port_stats[mbufs[i]->port].tx,1 , - __ATOMIC_RELAXED); + rte_memory_order_relaxed); } } }
examples/l2fwd-jobstats/main.c +6 -5
@@ -80,7 +80,7 @@ struct lcore_queue_conf {struct rte_jobstats idle_job;struct rte_jobstats_context jobs_context; -uint16_t stats_read_pending; +RTE_ATOMIC (uint16_t ) stats_read_pending;rte_spinlock_t lock; } __rte_cache_aligned;/* >8 End of list of queues to be polled for given lcore. */
@@ -151,9 +151,9 @@ struct l2fwd_port_statistics {uint64_t collection_time =rte_get_timer_cycles ();/* Ask forwarding thread to give us stats. */ -__atomic_store_n (&qconf->stats_read_pending,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&qconf->stats_read_pending,1 , rte_memory_order_relaxed);rte_spinlock_lock (&qconf->lock); -__atomic_store_n (&qconf->stats_read_pending,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&qconf->stats_read_pending,0 , rte_memory_order_relaxed);/* Collect context statistics. */ stats_period = ctx->state_time - ctx->start_time;
@@ -522,8 +522,9 @@ struct l2fwd_port_statistics { repeats++; need_manage = qconf->flush_timer.expire < now;/* Check if we was esked to give a stats. */ - stats_read_pending =__atomic_load_n (&qconf->stats_read_pending, - __ATOMIC_RELAXED); + stats_read_pending =rte_atomic_load_explicit ( + &qconf->stats_read_pending, + rte_memory_order_relaxed); need_manage |= stats_read_pending;for (i =0 ; i < qconf->n_rx_port && !need_manage; i++)
examples/multi_process/client_server_mp/mp_server/main.c +3 -3
@@ -157,12 +157,12 @@ struct client_rx_buf { sleep_lcore(__rte_unused void *dummy) {/* Used to pick a display thread - static, so zero-initialised */ -static uint32_t display_stats; +static RTE_ATOMIC (uint32_t ) display_stats;uint32_t status =0 ;/* Only one core should display stats */ -if (__atomic_compare_exchange_n (&display_stats, &status,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { +if (rte_atomic_compare_exchange_strong_explicit (&display_stats, &status,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) {const unsigned sleeptime =1 ;printf ("Core %u displaying statistics\n" ,rte_lcore_id ());
examples/server_node_efd/efd_server/main.c +3 -3
@@ -177,12 +177,12 @@ struct efd_stats { sleep_lcore(__rte_unused void *dummy) {/* Used to pick a display thread - static, so zero-initialised */ -static uint32_t display_stats; +static RTE_ATOMIC (uint32_t ) display_stats;/* Only one core should display stats */ uint32_t display_init =0 ; -if (__atomic_compare_exchange_n (&display_stats, &display_init,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { +if (rte_atomic_compare_exchange_strong_explicit (&display_stats, &display_init,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) {const unsigned int sleeptime =1 ;printf ("Core %u displaying statistics\n" ,rte_lcore_id ());
examples/vhost/main.c +16 -16
@@ -1052,10 +1052,10 @@ static unsigned check_ports_num(unsigned nb_ports) }if (enable_stats) { -__atomic_fetch_add (&dst_vdev->stats.rx_total_atomic,1 , - __ATOMIC_SEQ_CST); -__atomic_fetch_add (&dst_vdev->stats.rx_atomic, ret, - __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&dst_vdev->stats.rx_total_atomic,1 , + rte_memory_order_seq_cst); +rte_atomic_fetch_add_explicit (&dst_vdev->stats.rx_atomic, ret, + rte_memory_order_seq_cst); src_vdev->stats.tx_total++; src_vdev->stats.tx += ret; }
@@ -1072,10 +1072,10 @@ static unsigned check_ports_num(unsigned nb_ports) ret = vdev_queue_ops[vdev->vid].enqueue_pkt_burst (vdev,VIRTIO_RXQ , m, nr_xmit);if (enable_stats) { -__atomic_fetch_add (&vdev->stats.rx_total_atomic, nr_xmit, - __ATOMIC_SEQ_CST); -__atomic_fetch_add (&vdev->stats.rx_atomic, ret, - __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&vdev->stats.rx_total_atomic, nr_xmit, + rte_memory_order_seq_cst); +rte_atomic_fetch_add_explicit (&vdev->stats.rx_atomic, ret, + rte_memory_order_seq_cst); }if (!dma_bind[vid2socketid[vdev->vid]].dmas[VIRTIO_RXQ ].async_enabled) {
@@ -1404,10 +1404,10 @@ static void virtio_tx_offload(struct rte_mbuf *m) }if (enable_stats) { -__atomic_fetch_add (&vdev->stats.rx_total_atomic, rx_count, - __ATOMIC_SEQ_CST); -__atomic_fetch_add (&vdev->stats.rx_atomic, enqueue_count, - __ATOMIC_SEQ_CST); +rte_atomic_fetch_add_explicit (&vdev->stats.rx_total_atomic, rx_count, + rte_memory_order_seq_cst); +rte_atomic_fetch_add_explicit (&vdev->stats.rx_atomic, enqueue_count, + rte_memory_order_seq_cst); }if (!dma_bind[vid2socketid[vdev->vid]].dmas[VIRTIO_RXQ ].async_enabled) {
@@ -1832,10 +1832,10 @@ uint16_t sync_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id, tx = vdev->stats.tx; tx_dropped = tx_total - tx; - rx_total =__atomic_load_n (&vdev->stats.rx_total_atomic, - __ATOMIC_SEQ_CST); - rx =__atomic_load_n (&vdev->stats.rx_atomic, - __ATOMIC_SEQ_CST); + rx_total =rte_atomic_load_explicit (&vdev->stats.rx_total_atomic, + rte_memory_order_seq_cst); + rx =rte_atomic_load_explicit (&vdev->stats.rx_atomic, + rte_memory_order_seq_cst); rx_dropped = rx_total - rx; printf("Statistics for device %d\n"
examples/vhost/main.h +2 -2
@@ -22,8 +22,8 @@struct device_statistics {uint64_t tx;uint64_t tx_total; -uint64_t rx_atomic; -uint64_t rx_total_atomic; +RTE_ATOMIC (uint64_t ) rx_atomic; +RTE_ATOMIC (uint64_t ) rx_total_atomic; };struct vhost_queue {
examples/vhost/virtio_net.c +8 -5
@@ -198,7 +198,8 @@ queue = &dev->queues[queue_id]; vr = &queue->vr; - avail_idx =__atomic_load_n (&vr->avail->idx, __ATOMIC_ACQUIRE); + avail_idx = rte_atomic_load_explicit((uint16_t __rte_atomic *)&vr->avail->idx, + rte_memory_order_acquire); start_idx = queue->last_used_idx; free_entries = avail_idx - start_idx; count =RTE_MIN (count, free_entries);
@@ -231,7 +232,8 @@rte_prefetch0 (&vr->desc[desc_indexes[i+1 ]]); } -__atomic_fetch_add (&vr->used->idx, count, __ATOMIC_RELEASE); + rte_atomic_fetch_add_explicit((uint16_t __rte_atomic *)&vr->used->idx, count, + rte_memory_order_release); queue->last_used_idx += count;rte_vhost_vring_call (dev->vid, queue_id);
@@ -386,8 +388,8 @@ queue = &dev->queues[queue_id]; vr = &queue->vr; - free_entries =__atomic_load_n (&vr->avail->idx, __ATOMIC_ACQUIRE) - - queue->last_avail_idx; + free_entries = rte_atomic_load_explicit((uint16_t __rte_atomic *)&vr->avail->idx, + rte_memory_order_acquire) - queue->last_avail_idx;if (free_entries ==0 )return 0 ;
@@ -442,7 +444,8 @@ queue->last_avail_idx += i; queue->last_used_idx += i; -__atomic_fetch_add (&vr->used->idx, i, __ATOMIC_ACQ_REL); + rte_atomic_fetch_add_explicit((uint16_t __rte_atomic *)&vr->used->idx, i, + rte_memory_order_acq_rel);rte_vhost_vring_call (dev->vid, queue_id);
examples/vhost_blk/vhost_blk.c +4 -4
@@ -85,9 +85,9 @@ struct vhost_blk_ctrlr **/ used->ring[used->idx & (vq->vring.size -1 )].id = task->req_idx; used->ring[used->idx & (vq->vring.size -1 )].len = task->data_len; -rte_atomic_thread_fence (__ATOMIC_SEQ_CST); +rte_atomic_thread_fence (rte_memory_order_seq_cst); used->idx++; -rte_atomic_thread_fence (__ATOMIC_SEQ_CST); +rte_atomic_thread_fence (rte_memory_order_seq_cst);rte_vhost_clr_inflight_desc_split (task->ctrlr->vid, vq->id, used->idx, task->req_idx);
@@ -111,12 +111,12 @@ struct vhost_blk_ctrlr * desc->id = task->buffer_id; desc->addr =0 ; -rte_atomic_thread_fence (__ATOMIC_SEQ_CST); +rte_atomic_thread_fence (rte_memory_order_seq_cst);if (vq->used_wrap_counter) desc->flags |=VIRTQ_DESC_F_AVAIL |VIRTQ_DESC_F_USED ;else desc->flags &= ~(VIRTQ_DESC_F_AVAIL |VIRTQ_DESC_F_USED ); -rte_atomic_thread_fence (__ATOMIC_SEQ_CST); +rte_atomic_thread_fence (rte_memory_order_seq_cst);rte_vhost_clr_inflight_desc_packed (task->ctrlr->vid, vq->id, task->inflight_idx);
examples/vm_power_manager/channel_monitor.c +5 -4
@@ -828,8 +828,9 @@ void channel_monitor_exit(void)return -1 ;uint32_t channel_connected =CHANNEL_MGR_CHANNEL_CONNECTED ; -if (__atomic_compare_exchange_n (&(chan_info->status), &channel_connected, -CHANNEL_MGR_CHANNEL_PROCESSING ,0 , __ATOMIC_RELAXED, __ATOMIC_RELAXED) ==0 ) +if (rte_atomic_compare_exchange_strong_explicit (&(chan_info->status), &channel_connected, +CHANNEL_MGR_CHANNEL_PROCESSING , rte_memory_order_relaxed, + rte_memory_order_relaxed) ==0 )return -1 ;if (pkt->command ==RTE_POWER_CPU_POWER ) {
@@ -934,8 +935,8 @@ void channel_monitor_exit(void)* from management thread */ uint32_t channel_processing =CHANNEL_MGR_CHANNEL_PROCESSING ; -__atomic_compare_exchange_n (&(chan_info->status), &channel_processing, -CHANNEL_MGR_CHANNEL_CONNECTED ,0 , __ATOMIC_RELAXED, __ATOMIC_RELAXED); +rte_atomic_compare_exchange_strong_explicit (&(chan_info->status), &channel_processing, +CHANNEL_MGR_CHANNEL_CONNECTED , rte_memory_order_relaxed, rte_memory_order_relaxed);return 0 ; }
Signature · 1 line
1.8.3.1
PATCH 41/46 app/dumpcap: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- app/dumpcap/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
app/dumpcap/main.c +6 -6
@@ -51,7 +51,7 @@/* command line flags */ static const char *progname; -static bool quit_signal; +static RTE_ATOMIC (bool ) quit_signal;static bool group_read;static bool quiet;static bool use_pcapng = true;
@@ -475,7 +475,7 @@ static void parse_opts(int argc, char **argv)static void signal_handler(int sig_num __rte_unused) { -__atomic_store_n (&quit_signal, true, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&quit_signal, true, rte_memory_order_relaxed); }
@@ -490,7 +490,7 @@ static void statistics_loop(void)printf ("%-15s %10s %10s\n" ,"Interface" ,"Received" ,"Dropped" ); -while (!__atomic_load_n (&quit_signal, __ATOMIC_RELAXED)) { +while (!rte_atomic_load_explicit (&quit_signal, rte_memory_order_relaxed)) {RTE_ETH_FOREACH_DEV (p) {if (rte_eth_dev_get_name_by_port (p, name) <0 )continue ;
@@ -528,7 +528,7 @@ static void statistics_loop(void)static void monitor_primary(void *arg __rte_unused) { -if (__atomic_load_n (&quit_signal, __ATOMIC_RELAXED)) +if (rte_atomic_load_explicit (&quit_signal, rte_memory_order_relaxed))return ;if (rte_eal_primary_proc_alive (NULL )) {
@@ -536,7 +536,7 @@ static void statistics_loop(void) }else {fprintf (stderr,"Primary process is no longer active, exiting...\n" ); -__atomic_store_n (&quit_signal, true, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&quit_signal, true, rte_memory_order_relaxed); } }
@@ -983,7 +983,7 @@ int main(int argc, char **argv)show_count (0 ); } -while (!__atomic_load_n (&quit_signal, __ATOMIC_RELAXED)) { +while (!rte_atomic_load_explicit (&quit_signal, rte_memory_order_relaxed)) {if (process_ring (out, r) <0 ) {fprintf (stderr,"pcapng file write failed; %s\n" ,strerror (errno));
Signature · 1 line
1.8.3.1
PATCH 42/46 app/test: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- app/test/test_bpf.c | 46 ++++++++----- app/test/test_distributor.c | 114 ++++++++++++++++----------------- app/test/test_distributor_perf.c | 4 +- app/test/test_func_reentrancy.c | 28 ++++---- app/test/test_hash_multiwriter.c | 16 ++--- app/test/test_hash_readwrite.c | 74 ++++++++++----------- app/test/test_hash_readwrite_lf_perf.c | 88 ++++++++++++------------- app/test/test_lcores.c | 25 ++++---- app/test/test_lpm_perf.c | 14 ++-- app/test/test_mcslock.c | 12 ++-- app/test/test_mempool_perf.c | 9 +-- app/test/test_pflock.c | 13 ++-- app/test/test_pmd_perf.c | 10 +-- app/test/test_rcu_qsbr_perf.c | 114 +++++++++++++++++---------------- app/test/test_ring_perf.c | 11 ++-- app/test/test_ring_stress_impl.h | 10 +-- app/test/test_rwlock.c | 9 +-- app/test/test_seqlock.c | 6 +- app/test/test_service_cores.c | 24 +++---- app/test/test_spinlock.c | 9 +-- app/test/test_stack_perf.c | 12 ++-- app/test/test_threads.c | 33 +++++----- app/test/test_ticketlock.c | 9 +-- app/test/test_timer.c | 31 +++++---- 24 files changed, 378 insertions(+), 343 deletions(-)
app/test/test_bpf.c +30 -16
@@ -39,8 +39,8 @@*/ struct dummy_offset { -uint64_t u64; -uint32_t u32; +RTE_ATOMIC (uint64_t ) u64; +RTE_ATOMIC (uint32_t ) u32;uint16_t u16;uint8_t u8; };
@@ -1581,32 +1581,46 @@ struct bpf_test {memset (&dfe,0 ,sizeof (dfe)); rv =1 ; -__atomic_fetch_add (&dfe.u32, rv, __ATOMIC_RELAXED); -__atomic_fetch_add (&dfe.u64, rv, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit((uint32_t __rte_atomic *)&dfe.u32, rv, + rte_memory_order_relaxed); + rte_atomic_fetch_add_explicit((uint64_t __rte_atomic *)&dfe.u64, rv, + rte_memory_order_relaxed); rv =-1 ; -__atomic_fetch_add (&dfe.u32, rv, __ATOMIC_RELAXED); -__atomic_fetch_add (&dfe.u64, rv, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit((uint32_t __rte_atomic *)&dfe.u32, rv, + rte_memory_order_relaxed); + rte_atomic_fetch_add_explicit((uint64_t __rte_atomic *)&dfe.u64, rv, + rte_memory_order_relaxed); rv = (int32_t )TEST_FILL_1 ; -__atomic_fetch_add (&dfe.u32, rv, __ATOMIC_RELAXED); -__atomic_fetch_add (&dfe.u64, rv, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit((uint32_t __rte_atomic *)&dfe.u32, rv, + rte_memory_order_relaxed); + rte_atomic_fetch_add_explicit((uint64_t __rte_atomic *)&dfe.u64, rv, + rte_memory_order_relaxed); rv =TEST_MUL_1 ; -__atomic_fetch_add (&dfe.u32, rv, __ATOMIC_RELAXED); -__atomic_fetch_add (&dfe.u64, rv, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit((uint32_t __rte_atomic *)&dfe.u32, rv, + rte_memory_order_relaxed); + rte_atomic_fetch_add_explicit((uint64_t __rte_atomic *)&dfe.u64, rv, + rte_memory_order_relaxed); rv =TEST_MUL_2 ; -__atomic_fetch_add (&dfe.u32, rv, __ATOMIC_RELAXED); -__atomic_fetch_add (&dfe.u64, rv, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit((uint32_t __rte_atomic *)&dfe.u32, rv, + rte_memory_order_relaxed); + rte_atomic_fetch_add_explicit((uint64_t __rte_atomic *)&dfe.u64, rv, + rte_memory_order_relaxed); rv =TEST_JCC_2 ; -__atomic_fetch_add (&dfe.u32, rv, __ATOMIC_RELAXED); -__atomic_fetch_add (&dfe.u64, rv, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit((uint32_t __rte_atomic *)&dfe.u32, rv, + rte_memory_order_relaxed); + rte_atomic_fetch_add_explicit((uint64_t __rte_atomic *)&dfe.u64, rv, + rte_memory_order_relaxed); rv =TEST_JCC_3 ; -__atomic_fetch_add (&dfe.u32, rv, __ATOMIC_RELAXED); -__atomic_fetch_add (&dfe.u64, rv, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit((uint32_t __rte_atomic *)&dfe.u32, rv, + rte_memory_order_relaxed); + rte_atomic_fetch_add_explicit((uint64_t __rte_atomic *)&dfe.u64, rv, + rte_memory_order_relaxed);return cmp_res (__func__,1 , rc, &dfe, dft,sizeof (dfe)); }
app/test/test_distributor.c +57 -57
259 lines not on this page · raw message
app/test/test_distributor_perf.c +2 -2
@@ -31,7 +31,7 @@/* static vars - zero initialized by default */ static volatile int quit; -static volatile unsigned worker_idx; +static volatile RTE_ATOMIC (unsigned int ) worker_idx;struct worker_stats {volatile unsigned handled_packets;
@@ -121,7 +121,7 @@ struct worker_stats {struct rte_distributor *d = arg;unsigned int num =0 ;int i; -unsigned int id =__atomic_fetch_add (&worker_idx,1 , __ATOMIC_RELAXED); +unsigned int id =rte_atomic_fetch_add_explicit (&worker_idx,1 , rte_memory_order_relaxed); struct rte_mbuf *buf[8] __rte_cache_aligned;for (i =0 ; i <8 ; i++)
app/test/test_func_reentrancy.c +15 -13
@@ -53,12 +53,13 @@#define MAX_LCORES (rte_memzone_max_get() / (MAX_ITER_MULTI * 4U)) -static uint32_t obj_count; -static uint32_t synchro; +static RTE_ATOMIC (uint32_t ) obj_count; +static RTE_ATOMIC (uint32_t ) synchro;#define WAIT_SYNCHRO_FOR_WORKERS () do { \ if (lcore_self != rte_get_main_lcore()) \ - rte_wait_until_equal_32(&synchro, 1, __ATOMIC_RELAXED); \ + rte_wait_until_equal_32((uint32_t *)(uintptr_t)&synchro, 1, \ + rte_memory_order_relaxed); \ } while(0)/*
@@ -71,7 +72,8 @@WAIT_SYNCHRO_FOR_WORKERS (); -__atomic_store_n (&obj_count,1 , __ATOMIC_RELAXED);/* silent the check in the caller */ +/* silent the check in the caller */ +rte_atomic_store_explicit (&obj_count,1 , rte_memory_order_relaxed);if (rte_eal_init (0 ,NULL ) !=-1 )return -1 ;
@@ -113,7 +115,7 @@for (i =0 ; i <MAX_ITER_ONCE ; i++) { rp =rte_ring_create ("fr_test_once" ,4096 ,SOCKET_ID_ANY ,0 );if (rp !=NULL ) -__atomic_fetch_add (&obj_count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&obj_count,1 , rte_memory_order_relaxed); }/* create/lookup new ring several times */
@@ -178,7 +180,7 @@ my_obj_init,NULL , SOCKET_ID_ANY, 0);if (mp !=NULL ) -__atomic_fetch_add (&obj_count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&obj_count,1 , rte_memory_order_relaxed); }/* create/lookup new ring several times */
@@ -244,7 +246,7 @@for (i =0 ; i <MAX_ITER_ONCE ; i++) { handle =rte_hash_create (&hash_params);if (handle !=NULL ) -__atomic_fetch_add (&obj_count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&obj_count,1 , rte_memory_order_relaxed); }/* create multiple times simultaneously */
@@ -311,7 +313,7 @@for (i =0 ; i <MAX_ITER_ONCE ; i++) { handle =rte_fbk_hash_create (&fbk_params);if (handle !=NULL ) -__atomic_fetch_add (&obj_count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&obj_count,1 , rte_memory_order_relaxed); }/* create multiple fbk tables simultaneously */
@@ -376,7 +378,7 @@for (i =0 ; i <MAX_ITER_ONCE ; i++) { lpm =rte_lpm_create ("fr_test_once" ,SOCKET_ID_ANY , &config);if (lpm !=NULL ) -__atomic_fetch_add (&obj_count,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&obj_count,1 , rte_memory_order_relaxed); }/* create multiple fbk tables simultaneously */
@@ -437,8 +439,8 @@ struct test_case test_cases[] = {if (pt_case->func ==NULL )return -1 ; -__atomic_store_n (&obj_count,0 , __ATOMIC_RELAXED); -__atomic_store_n (&synchro,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&obj_count,0 , rte_memory_order_relaxed); +rte_atomic_store_explicit (&synchro,0 , rte_memory_order_relaxed); cores =RTE_MIN (rte_lcore_count (),MAX_LCORES );RTE_LCORE_FOREACH_WORKER (lcore_id) {
@@ -448,7 +450,7 @@ struct test_case test_cases[] = {rte_eal_remote_launch (pt_case->func, pt_case->arg, lcore_id); } -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);if (pt_case->func (pt_case->arg) <0 ) ret =-1 ;
@@ -463,7 +465,7 @@ struct test_case test_cases[] = { pt_case->clean (lcore_id); } - count =__atomic_load_n (&obj_count, __ATOMIC_RELAXED); + count =rte_atomic_load_explicit (&obj_count, rte_memory_order_relaxed);if (count !=1 ) {printf ("%s: common object allocated %d times (should be 1)\n" , pt_case->name, count);
app/test/test_hash_multiwriter.c +8 -8
@@ -43,8 +43,8 @@ struct {const uint32_t nb_total_tsx_insertion =4.5 *1024 *1024 ;uint32_t rounded_nb_total_tsx_insertion; -static uint64_t gcycles; -static uint64_t ginsertions; +static RTE_ATOMIC (uint64_t ) gcycles; +static RTE_ATOMIC (uint64_t ) ginsertions;static int use_htm;
@@ -84,8 +84,8 @@ struct { } cycles =rte_rdtsc_precise () - begin; -__atomic_fetch_add (&gcycles, cycles, __ATOMIC_RELAXED); -__atomic_fetch_add (&ginsertions, i - offset, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&gcycles, cycles, rte_memory_order_relaxed); +rte_atomic_fetch_add_explicit (&ginsertions, i - offset, rte_memory_order_relaxed);for (; i < offset + tbl_multiwriter_test_params.nb_tsx_insertion; i++) tbl_multiwriter_test_params.keys[i]
@@ -166,8 +166,8 @@ struct { tbl_multiwriter_test_params.found = found; -__atomic_store_n (&gcycles,0 , __ATOMIC_RELAXED); -__atomic_store_n (&ginsertions,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&gcycles,0 , rte_memory_order_relaxed); +rte_atomic_store_explicit (&ginsertions,0 , rte_memory_order_relaxed);/* Get list of enabled cores */ i =0 ;
@@ -233,8 +233,8 @@ struct {printf ("No key corrupted during multiwriter insertion.\n" );unsigned long long int cycles_per_insertion = -__atomic_load_n (&gcycles, __ATOMIC_RELAXED)/ -__atomic_load_n (&ginsertions, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&gcycles, rte_memory_order_relaxed)/ +rte_atomic_load_explicit (&ginsertions, rte_memory_order_relaxed);printf (" cycles per insertion: %llu\n" , cycles_per_insertion);
app/test/test_hash_readwrite.c +37 -37
154 lines not on this page · raw message
app/test/test_hash_readwrite_lf_perf.c +44 -44
202 lines not on this page · raw message
app/test/test_lcores.c +13 -12
@@ -10,6 +10,7 @@#include <rte_errno.h> #include <rte_lcore.h> #include <rte_thread.h> +#include <rte_stdatomic.h> #include "test.h"
@@ -25,7 +26,7 @@ struct thread_context {enum { Thread_INIT, Thread_ERROR, Thread_DONE } state;bool lcore_id_any;rte_thread_t id; -unsigned int *registered_count; +RTE_ATOMIC (unsigned int ) *registered_count; };static uint32_t thread_loop (void *arg)
@@ -49,10 +50,10 @@ static uint32_t thread_loop(void *arg) t->state = Thread_ERROR; }/* Report register happened to the control thread. */ -__atomic_fetch_add (t->registered_count,1 , __ATOMIC_RELEASE); +rte_atomic_fetch_add_explicit (t->registered_count,1 , rte_memory_order_release);/* Wait for release from the control thread. */ -while (__atomic_load_n (t->registered_count, __ATOMIC_ACQUIRE) !=0 ) +while (rte_atomic_load_explicit (t->registered_count, rte_memory_order_acquire) !=0 )sched_yield ();rte_thread_unregister (); lcore_id =rte_lcore_id ();
@@ -73,7 +74,7 @@ static uint32_t thread_loop(void *arg) {struct thread_context thread_contexts[RTE_MAX_LCORE ];unsigned int non_eal_threads_count; -unsigned int registered_count; +RTE_ATOMIC (unsigned int ) registered_count;struct thread_context *t;unsigned int i;int ret;
@@ -93,7 +94,7 @@ static uint32_t thread_loop(void *arg) }printf ("non-EAL threads count: %u\n" , non_eal_threads_count);/* Wait all non-EAL threads to register. */ -while (__atomic_load_n (®istered_count, __ATOMIC_ACQUIRE) != +while (rte_atomic_load_explicit (®istered_count, rte_memory_order_acquire) != non_eal_threads_count)sched_yield ();
@@ -109,14 +110,14 @@ static uint32_t thread_loop(void *arg)if (rte_thread_create (&t->id,NULL , thread_loop, t) ==0 ) { non_eal_threads_count++;printf ("non-EAL threads count: %u\n" , non_eal_threads_count); -while (__atomic_load_n (®istered_count, __ATOMIC_ACQUIRE) != +while (rte_atomic_load_explicit (®istered_count, rte_memory_order_acquire) != non_eal_threads_count)sched_yield (); } skip_lcore_any:/* Release all threads, and check their states. */ -__atomic_store_n (®istered_count,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (®istered_count,0 , rte_memory_order_release); ret =0 ;for (i =0 ; i < non_eal_threads_count; i++) { t = &thread_contexts[i];
@@ -225,7 +226,7 @@ struct limit_lcore_context {struct thread_context thread_contexts[2 ];unsigned int non_eal_threads_count =0 ;struct limit_lcore_context l[2 ] = {}; -unsigned int registered_count =0 ; +RTE_ATOMIC (unsigned int ) registered_count =0 ;struct thread_context *t;void *handle[2 ] = {};unsigned int i;
@@ -275,7 +276,7 @@ struct limit_lcore_context {if (rte_thread_create (&t->id,NULL , thread_loop, t) !=0 ) goto cleanup_threads; non_eal_threads_count++; -while (__atomic_load_n (®istered_count, __ATOMIC_ACQUIRE) != +while (rte_atomic_load_explicit (®istered_count, rte_memory_order_acquire) != non_eal_threads_count)sched_yield (); if (l[0].init != eal_threads_count + 1 ||
@@ -298,7 +299,7 @@ struct limit_lcore_context {if (rte_thread_create (&t->id,NULL , thread_loop, t) !=0 ) goto cleanup_threads; non_eal_threads_count++; -while (__atomic_load_n (®istered_count, __ATOMIC_ACQUIRE) != +while (rte_atomic_load_explicit (®istered_count, rte_memory_order_acquire) != non_eal_threads_count)sched_yield (); if (l[0].init != eal_threads_count + 2 ||
@@ -315,7 +316,7 @@ struct limit_lcore_context { }rte_lcore_dump (stdout);/* Release all threads, and check their states. */ -__atomic_store_n (®istered_count,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (®istered_count,0 , rte_memory_order_release); ret =0 ;for (i =0 ; i < non_eal_threads_count; i++) { t = &thread_contexts[i];
@@ -337,7 +338,7 @@ struct limit_lcore_context { cleanup_threads:/* Release all threads */ -__atomic_store_n (®istered_count,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (®istered_count,0 , rte_memory_order_release);for (i =0 ; i < non_eal_threads_count; i++) { t = &thread_contexts[i];rte_thread_join (t->id,NULL );
app/test/test_lpm_perf.c +7 -7
@@ -22,8 +22,8 @@struct rte_lpm *lpm;static struct rte_rcu_qsbr *rv;static volatile uint8_t writer_done; -static volatile uint32_t thr_id; -static uint64_t gwrite_cycles; +static volatile RTE_ATOMIC (uint32_t ) thr_id; +static RTE_ATOMIC (uint64_t ) gwrite_cycles;static uint32_t num_writers;/* LPM APIs are not thread safe, use spinlock */
@@ -362,7 +362,7 @@ static void generate_large_route_rule_table(void) {uint32_t tmp_thr_id; - tmp_thr_id =__atomic_fetch_add (&thr_id,1 , __ATOMIC_RELAXED); + tmp_thr_id =rte_atomic_fetch_add_explicit (&thr_id,1 , rte_memory_order_relaxed);if (tmp_thr_id >=RTE_MAX_LCORE )printf ("Invalid thread id %u\n" , tmp_thr_id);
@@ -470,7 +470,7 @@ static void generate_large_route_rule_table(void) total_cycles =rte_rdtsc_precise () - begin; -__atomic_fetch_add (&gwrite_cycles, total_cycles, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&gwrite_cycles, total_cycles, rte_memory_order_relaxed);return 0 ;
@@ -540,9 +540,9 @@ static void generate_large_route_rule_table(void) reader_f = test_lpm_reader; writer_done =0 ; -__atomic_store_n (&gwrite_cycles,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&gwrite_cycles,0 , rte_memory_order_relaxed); -__atomic_store_n (&thr_id,0 , __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&thr_id,0 , rte_memory_order_seq_cst);/* Launch reader threads */ for (i = j; i < num_cores; i++)
@@ -563,7 +563,7 @@ static void generate_large_route_rule_table(void)printf ("Total LPM Adds: %d\n" ,TOTAL_WRITES );printf ("Total LPM Deletes: %d\n" ,TOTAL_WRITES );printf ("Average LPM Add/Del: %" PRIu64" cycles\n" , -__atomic_load_n (&gwrite_cycles, __ATOMIC_RELAXED) +rte_atomic_load_explicit (&gwrite_cycles, rte_memory_order_relaxed) /TOTAL_WRITES ); writer_done =1 ;
app/test/test_mcslock.c +6 -6
@@ -42,7 +42,7 @@static unsigned int count; -static uint32_t synchro; +static RTE_ATOMIC (uint32_t ) synchro;static int test_mcslock_per_core(__rte_unused void *arg)
@@ -75,7 +75,7 @@rte_mcslock_t ml_perf_me;/* wait synchro */ -rte_wait_until_equal_32 (&synchro,1 , __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&synchro,1 , rte_memory_order_relaxed); begin =rte_get_timer_cycles ();while (lcount <MAX_LOOP ) {
@@ -100,14 +100,14 @@const unsigned int lcore =rte_lcore_id ();printf ("\nTest with no lock on single core...\n" ); -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);load_loop_fn (&lock);printf ("Core [%u] Cost Time = %" PRIu64" us\n" , lcore, time_count[lcore]);memset (time_count,0 ,sizeof (time_count));printf ("\nTest with lock on single core...\n" ); -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed); lock =1 ;load_loop_fn (&lock); printf("Core [%u] Cost Time = %"PRIu64" us\n",
@@ -116,11 +116,11 @@printf ("\nTest with lock on %u cores...\n" , (rte_lcore_count ())); -__atomic_store_n (&synchro,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,0 , rte_memory_order_relaxed);rte_eal_mp_remote_launch (load_loop_fn, &lock,SKIP_MAIN );/* start synchro and launch test on main */ -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);load_loop_fn (&lock);rte_eal_mp_wait_lcore ();
app/test/test_mempool_perf.c +5 -4
@@ -88,7 +88,7 @@static int use_external_cache;static unsigned external_cache_size =RTE_MEMPOOL_CACHE_MAX_SIZE ; -static uint32_t synchro; +static RTE_ATOMIC (uint32_t ) synchro;/* number of objects in one bulk operation (get or put) */ static unsigned n_get_bulk;
@@ -188,7 +188,8 @@ struct mempool_test_stats {/* wait synchro for workers */ if (lcore_id !=rte_get_main_lcore ()) -rte_wait_until_equal_32 (&synchro,1 , __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&synchro,1 , + rte_memory_order_relaxed); start_cycles =rte_get_timer_cycles ();
@@ -233,7 +234,7 @@ struct mempool_test_stats {int ret;unsigned cores_save = cores; -__atomic_store_n (&synchro,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,0 , rte_memory_order_relaxed);/* reset stats */ memset (stats,0 ,sizeof (stats));
@@ -258,7 +259,7 @@ struct mempool_test_stats { }/* start synchro and launch test on main */ -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed); ret =per_lcore_mempool_test (mp);
app/test/test_pflock.c +7 -6
@@ -31,7 +31,7 @@static rte_pflock_t sl;static rte_pflock_t sl_tab[RTE_MAX_LCORE ]; -static uint32_t synchro; +static RTE_ATOMIC (uint32_t ) synchro;static int test_pflock_per_core(__rte_unused void *arg)
@@ -69,7 +69,8 @@/* wait synchro for workers */ if (lcore !=rte_get_main_lcore ()) -rte_wait_until_equal_32 (&synchro,1 , __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&synchro,1 , + rte_memory_order_relaxed); begin =rte_rdtsc_precise ();while (lcount <MAX_LOOP ) {
@@ -99,7 +100,7 @@const unsigned int lcore =rte_lcore_id ();printf ("\nTest with no lock on single core...\n" ); -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);load_loop_fn (&lock);printf ("Core [%u] Cost Time = %" PRIu64" us\n" , lcore, time_count[lcore]);
@@ -107,7 +108,7 @@printf ("\nTest with phase-fair lock on single core...\n" ); lock =1 ; -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);load_loop_fn (&lock);printf ("Core [%u] Cost Time = %" PRIu64" us\n" , lcore, time_count[lcore]);
@@ -116,12 +117,12 @@printf ("\nPhase-fair test on %u cores...\n" ,rte_lcore_count ());/* clear synchro and start workers */ -__atomic_store_n (&synchro,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,0 , rte_memory_order_relaxed);if (rte_eal_mp_remote_launch (load_loop_fn, &lock,SKIP_MAIN ) <0 )return -1 ;/* start synchro and launch test on main */ -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);load_loop_fn (&lock);rte_eal_mp_wait_lcore ();
app/test/test_pmd_perf.c +5 -5
@@ -537,7 +537,7 @@ enum {return 0 ; } -static uint64_t start; +static RTE_ATOMIC (uint64_t ) start;static inline int poll_burst (void *args)
@@ -575,7 +575,7 @@ enum { num[portid] = pkt_per_port; } -rte_wait_until_equal_64 (&start,1 , __ATOMIC_ACQUIRE); +rte_wait_until_equal_64 ((uint64_t *)(uintptr_t )&start,1 , rte_memory_order_acquire); cur_tsc =rte_rdtsc ();while (total) {
@@ -629,9 +629,9 @@ enum {/* only when polling first */ if (flags ==SC_BURST_POLL_FIRST ) -__atomic_store_n (&start,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&start,1 , rte_memory_order_relaxed);else -__atomic_store_n (&start,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&start,0 , rte_memory_order_relaxed);/* start polling thread * if in POLL_FIRST mode, poll once launched;
@@ -655,7 +655,7 @@ enum {/* only when polling second */ if (flags ==SC_BURST_XMIT_FIRST ) -__atomic_store_n (&start,1 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&start,1 , rte_memory_order_release);/* wait for polling finished */ diff_tsc =rte_eal_wait_lcore (lcore);
app/test/test_rcu_qsbr_perf.c +59 -55
243 lines not on this page · raw message
app/test/test_ring_perf.c +6 -5
@@ -186,7 +186,7 @@ struct thread_params {void *burst =NULL ;#ifdef RTE_USE_C11_MEM_MODEL -if (__atomic_fetch_add (&lcore_count,1 , __ATOMIC_RELAXED) +1 !=2 ) +if (rte_atomic_fetch_add_explicit (&lcore_count,1 , rte_memory_order_relaxed) +1 !=2 ) #else if (__sync_add_and_fetch(&lcore_count, 1) != 2)#endif
@@ -320,7 +320,7 @@ struct thread_params {return 0 ; } -static uint32_t synchro; +static RTE_ATOMIC (uint32_t ) synchro;static uint64_t queue_count[RTE_MAX_LCORE ];#define TIME_MS 100
@@ -342,7 +342,8 @@ struct thread_params {/* wait synchro for workers */ if (lcore !=rte_get_main_lcore ()) -rte_wait_until_equal_32 (&synchro,1 , __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&synchro,1 , + rte_memory_order_relaxed); begin =rte_get_timer_cycles ();while (time_diff < hz *TIME_MS /1000 ) {
@@ -397,12 +398,12 @@ struct thread_params { param.r = r;/* clear synchro and start workers */ -__atomic_store_n (&synchro,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,0 , rte_memory_order_relaxed);if (rte_eal_mp_remote_launch (lcore_f, ¶m,SKIP_MAIN ) <0 )return -1 ;/* start synchro and launch test on main */ -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);lcore_f (¶m);rte_eal_mp_wait_lcore ();
app/test/test_ring_stress_impl.h +5 -5
@@ -24,7 +24,7 @@ enum { WRK_CMD_RUN, }; -static uint32_t wrk_cmd __rte_cache_aligned = WRK_CMD_STOP; +static RTE_ATOMIC(uint32_t) wrk_cmd __rte_cache_aligned = WRK_CMD_STOP;/* test run-time in seconds */ static const uint32_t run_time =60 ;
@@ -203,7 +203,7 @@ struct ring_elem {* really releasing any data through 'wrk_cmd' to * the worker. */ -while (__atomic_load_n (&wrk_cmd, __ATOMIC_RELAXED) !=WRK_CMD_RUN ) +while (rte_atomic_load_explicit (&wrk_cmd, rte_memory_order_relaxed) !=WRK_CMD_RUN )rte_pause (); cl =rte_rdtsc_precise ();
@@ -246,7 +246,7 @@ struct ring_elem {lcore_stat_update (&la->stats,1 , num, tm0 + tm1, prcs); - }while (__atomic_load_n (&wrk_cmd, __ATOMIC_RELAXED) ==WRK_CMD_RUN ); + }while (rte_atomic_load_explicit (&wrk_cmd, rte_memory_order_relaxed) ==WRK_CMD_RUN ); cl =rte_rdtsc_precise () - cl;if (prcs ==0 )
@@ -360,12 +360,12 @@ struct ring_elem { }/* signal worker to start test */ -__atomic_store_n (&wrk_cmd,WRK_CMD_RUN , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&wrk_cmd,WRK_CMD_RUN , rte_memory_order_release);rte_delay_us (run_time *US_PER_S );/* signal worker to start test */ -__atomic_store_n (&wrk_cmd,WRK_CMD_STOP , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&wrk_cmd,WRK_CMD_STOP , rte_memory_order_release);/* wait for workers and collect stats. */ mc =rte_lcore_id ();
app/test/test_rwlock.c +5 -4
@@ -35,7 +35,7 @@static rte_rwlock_t sl;static rte_rwlock_t sl_tab[RTE_MAX_LCORE ]; -static uint32_t synchro; +static RTE_ATOMIC (uint32_t ) synchro;enum {LC_TYPE_RDLOCK ,
@@ -101,7 +101,8 @@ struct try_rwlock_lcore {/* wait synchro for workers */ if (lcore !=rte_get_main_lcore ()) -rte_wait_until_equal_32 (&synchro,1 , __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&synchro,1 , + rte_memory_order_relaxed); begin =rte_rdtsc_precise ();while (lcount <MAX_LOOP ) {
@@ -134,12 +135,12 @@ struct try_rwlock_lcore {printf ("\nRwlock Perf Test on %u cores...\n" ,rte_lcore_count ());/* clear synchro and start workers */ -__atomic_store_n (&synchro,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,0 , rte_memory_order_relaxed);if (rte_eal_mp_remote_launch (load_loop_fn,NULL ,SKIP_MAIN ) <0 )return -1 ;/* start synchro and launch test on main */ -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);load_loop_fn (NULL );rte_eal_mp_wait_lcore ();
app/test/test_seqlock.c +3 -3
@@ -22,7 +22,7 @@ struct data {struct reader {struct data *data; -uint8_t stop; +RTE_ATOMIC (uint8_t ) stop; };#define WRITER_RUNTIME 2.0/* s */
@@ -79,7 +79,7 @@ struct reader {struct reader *r = arg;int rc =TEST_SUCCESS ; -while (__atomic_load_n (&r->stop, __ATOMIC_RELAXED) ==0 && +while (rte_atomic_load_explicit (&r->stop, rte_memory_order_relaxed) ==0 && rc ==TEST_SUCCESS ) {struct data *data = r->data;bool interrupted;
@@ -115,7 +115,7 @@ struct reader {static void reader_stop (struct reader *reader) { -__atomic_store_n (&reader->stop,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&reader->stop,1 , rte_memory_order_relaxed); }#define NUM_WRITERS 2/* main lcore + one worker */
app/test/test_service_cores.c +12 -12
@@ -59,15 +59,15 @@ static int32_t dummy_mt_unsafe_cb(void *args)* test, because two threads are concurrently in a non-MT safe callback. */ uint32_t *test_params = args; -uint32_t *lock = &test_params[0 ]; + RTE_ATOMIC(uint32_t) *lock = (uint32_t __rte_atomic *)&test_params[0];uint32_t *pass_test = &test_params[1 ];uint32_t exp =0 ; -int lock_taken =__atomic_compare_exchange_n (lock, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED); +int lock_taken =rte_atomic_compare_exchange_strong_explicit (lock, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed);if (lock_taken) {/* delay with the lock held */ rte_delay_ms (250 ); -__atomic_store_n (lock,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (lock,0 , rte_memory_order_relaxed); }else {/* 2nd thread will fail to take lock, so clear pass flag */ *pass_test =0 ;
@@ -86,15 +86,15 @@ static int32_t dummy_mt_safe_cb(void *args)* that 2 threads are running the callback at the same time: MT safe */ uint32_t *test_params = args; -uint32_t *lock = &test_params[0 ]; + RTE_ATOMIC(uint32_t) *lock = (uint32_t __rte_atomic *)&test_params[0];uint32_t *pass_test = &test_params[1 ];uint32_t exp =0 ; -int lock_taken =__atomic_compare_exchange_n (lock, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED); +int lock_taken =rte_atomic_compare_exchange_strong_explicit (lock, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed);if (lock_taken) {/* delay with the lock held */ rte_delay_ms (250 ); -__atomic_store_n (lock,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (lock,0 , rte_memory_order_relaxed); }else {/* 2nd thread will fail to take lock, so set pass flag */ *pass_test =1 ;
@@ -748,15 +748,15 @@ static int32_t dummy_mt_safe_cb(void *args)/* retrieve done flag and lock to add/sub */ uint32_t *done = ¶ms[0 ]; -uint32_t *lock = ¶ms[1 ]; + RTE_ATOMIC(uint32_t) *lock = (uint32_t __rte_atomic *)¶ms[1];while (!*done) { -__atomic_fetch_add (lock,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (lock,1 , rte_memory_order_relaxed);rte_delay_us (500 ); -if (__atomic_load_n (lock, __ATOMIC_RELAXED) >1 ) +if (rte_atomic_load_explicit (lock, rte_memory_order_relaxed) >1 )/* pass: second core has simultaneously incremented */ *done =1 ; -__atomic_fetch_sub (lock,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (lock,1 , rte_memory_order_relaxed); }return 0 ;
app/test/test_spinlock.c +5 -4
@@ -48,7 +48,7 @@static rte_spinlock_recursive_t slr;static unsigned count =0 ; -static uint32_t synchro; +static RTE_ATOMIC (uint32_t ) synchro;static int test_spinlock_per_core(__rte_unused void *arg)
@@ -110,7 +110,8 @@/* wait synchro for workers */ if (lcore !=rte_get_main_lcore ()) -rte_wait_until_equal_32 (&synchro,1 , __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&synchro,1 , + rte_memory_order_relaxed); begin =rte_get_timer_cycles ();while (lcount <MAX_LOOP ) {
@@ -149,11 +150,11 @@printf ("\nTest with lock on %u cores...\n" ,rte_lcore_count ());/* Clear synchro and start workers */ -__atomic_store_n (&synchro,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,0 , rte_memory_order_relaxed);rte_eal_mp_remote_launch (load_loop_fn, &lock,SKIP_MAIN );/* start synchro and launch test on main */ -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);load_loop_fn (&lock);rte_eal_mp_wait_lcore ();
app/test/test_stack_perf.c +6 -6
@@ -23,7 +23,7 @@*/ static volatile unsigned int bulk_sizes[] = {8 ,MAX_BURST }; -static uint32_t lcore_barrier; +static RTE_ATOMIC (uint32_t ) lcore_barrier;struct lcore_pair {unsigned int c1;
@@ -143,8 +143,8 @@ struct thread_args { s = args->s; size = args->sz; -__atomic_fetch_sub (&lcore_barrier,1 , __ATOMIC_RELAXED); -rte_wait_until_equal_32 (&lcore_barrier,0 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&lcore_barrier,1 , rte_memory_order_relaxed); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&lcore_barrier,0 , rte_memory_order_relaxed);uint64_t start =rte_rdtsc ();
@@ -173,7 +173,7 @@ struct thread_args {unsigned int i;for (i =0 ; i <RTE_DIM (bulk_sizes); i++) { -__atomic_store_n (&lcore_barrier,2 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&lcore_barrier,2 , rte_memory_order_relaxed); args[0 ].sz = args[1 ].sz = bulk_sizes[i]; args[0 ].s = args[1 ].s = s;
@@ -206,7 +206,7 @@ struct thread_args {int cnt =0 ;double avg; -__atomic_store_n (&lcore_barrier, n, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&lcore_barrier, n, rte_memory_order_relaxed);RTE_LCORE_FOREACH_WORKER (lcore_id) {if (++cnt >= n)
@@ -300,7 +300,7 @@ struct thread_args {struct lcore_pair cores;struct rte_stack *s; -__atomic_store_n (&lcore_barrier,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&lcore_barrier,0 , rte_memory_order_relaxed); s =rte_stack_create (STACK_NAME ,STACK_SIZE ,rte_socket_id (), flags);if (s ==NULL ) {
app/test/test_threads.c +17 -16
@@ -6,12 +6,13 @@#include <rte_thread.h> #include <rte_debug.h> +#include <rte_stdatomic.h> #include "test.h" RTE_LOG_REGISTER (threads_logtype_test, test.threads,INFO ); -static uint32_t thread_id_ready; +static RTE_ATOMIC (uint32_t ) thread_id_ready;static uint32_t thread_main (void *arg)
@@ -19,9 +20,9 @@if (arg !=NULL ) *(rte_thread_t *)arg =rte_thread_self (); -__atomic_store_n (&thread_id_ready,1 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&thread_id_ready,1 , rte_memory_order_release); -while (__atomic_load_n (&thread_id_ready, __ATOMIC_ACQUIRE) ==1 ) +while (rte_atomic_load_explicit (&thread_id_ready, rte_memory_order_acquire) ==1 ) ;return 0 ;
@@ -37,13 +38,13 @@RTE_TEST_ASSERT (rte_thread_create (&thread_id,NULL , thread_main, &thread_main_id) ==0 ,"Failed to create thread." ); -while (__atomic_load_n (&thread_id_ready, __ATOMIC_ACQUIRE) ==0 ) +while (rte_atomic_load_explicit (&thread_id_ready, rte_memory_order_acquire) ==0 ) ;RTE_TEST_ASSERT (rte_thread_equal (thread_id, thread_main_id) !=0 ,"Unexpected thread id." ); -__atomic_store_n (&thread_id_ready,2 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&thread_id_ready,2 , rte_memory_order_release);RTE_TEST_ASSERT (rte_thread_join (thread_id,NULL ) ==0 ,"Failed to join thread." );
@@ -61,13 +62,13 @@RTE_TEST_ASSERT (rte_thread_create (&thread_id,NULL , thread_main, &thread_main_id) ==0 ,"Failed to create thread." ); -while (__atomic_load_n (&thread_id_ready, __ATOMIC_ACQUIRE) ==0 ) +while (rte_atomic_load_explicit (&thread_id_ready, rte_memory_order_acquire) ==0 ) ;RTE_TEST_ASSERT (rte_thread_equal (thread_id, thread_main_id) !=0 ,"Unexpected thread id." ); -__atomic_store_n (&thread_id_ready,2 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&thread_id_ready,2 , rte_memory_order_release);RTE_TEST_ASSERT (rte_thread_detach (thread_id) ==0 ,"Failed to detach thread." );
@@ -85,7 +86,7 @@RTE_TEST_ASSERT (rte_thread_create (&thread_id,NULL , thread_main,NULL ) ==0 ,"Failed to create thread" ); -while (__atomic_load_n (&thread_id_ready, __ATOMIC_ACQUIRE) ==0 ) +while (rte_atomic_load_explicit (&thread_id_ready, rte_memory_order_acquire) ==0 ) ; priority =RTE_THREAD_PRIORITY_NORMAL ;
@@ -121,7 +122,7 @@RTE_TEST_ASSERT (priority ==RTE_THREAD_PRIORITY_NORMAL ,"Priority set mismatches priority get" ); -__atomic_store_n (&thread_id_ready,2 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&thread_id_ready,2 , rte_memory_order_release);return 0 ; }
@@ -137,7 +138,7 @@RTE_TEST_ASSERT (rte_thread_create (&thread_id,NULL , thread_main,NULL ) ==0 ,"Failed to create thread" ); -while (__atomic_load_n (&thread_id_ready, __ATOMIC_ACQUIRE) ==0 ) +while (rte_atomic_load_explicit (&thread_id_ready, rte_memory_order_acquire) ==0 ) ; RTE_TEST_ASSERT(rte_thread_get_affinity_by_id(thread_id, &cpuset0) == 0,
@@ -190,7 +191,7 @@RTE_TEST_ASSERT (rte_thread_create (&thread_id, &attr, thread_main,NULL ) ==0 ,"Failed to create attributes affinity thread." ); -while (__atomic_load_n (&thread_id_ready, __ATOMIC_ACQUIRE) ==0 ) +while (rte_atomic_load_explicit (&thread_id_ready, rte_memory_order_acquire) ==0 ) ; RTE_TEST_ASSERT(rte_thread_get_affinity_by_id(thread_id, &cpuset1) == 0,
@@ -198,7 +199,7 @@RTE_TEST_ASSERT (memcmp (&cpuset0, &cpuset1,sizeof (rte_cpuset_t)) ==0 ,"Failed to apply affinity attributes" ); -__atomic_store_n (&thread_id_ready,2 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&thread_id_ready,2 , rte_memory_order_release);return 0 ; }
@@ -219,7 +220,7 @@RTE_TEST_ASSERT (rte_thread_create (&thread_id, &attr, thread_main,NULL ) ==0 ,"Failed to create attributes priority thread." ); -while (__atomic_load_n (&thread_id_ready, __ATOMIC_ACQUIRE) ==0 ) +while (rte_atomic_load_explicit (&thread_id_ready, rte_memory_order_acquire) ==0 ) ; RTE_TEST_ASSERT(rte_thread_get_priority(thread_id, &priority) == 0,
@@ -227,7 +228,7 @@RTE_TEST_ASSERT (priority ==RTE_THREAD_PRIORITY_NORMAL ,"Failed to apply priority attributes" ); -__atomic_store_n (&thread_id_ready,2 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&thread_id_ready,2 , rte_memory_order_release);return 0 ; }
@@ -243,13 +244,13 @@ thread_main, &thread_main_id) == 0, "Failed to create thread."); -while (__atomic_load_n (&thread_id_ready, __ATOMIC_ACQUIRE) ==0 ) +while (rte_atomic_load_explicit (&thread_id_ready, rte_memory_order_acquire) ==0 ) ;RTE_TEST_ASSERT (rte_thread_equal (thread_id, thread_main_id) !=0 ,"Unexpected thread id." ); -__atomic_store_n (&thread_id_ready,2 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&thread_id_ready,2 , rte_memory_order_release);RTE_TEST_ASSERT (rte_thread_join (thread_id,NULL ) ==0 ,"Failed to join thread." );
app/test/test_ticketlock.c +5 -4
@@ -48,7 +48,7 @@static rte_ticketlock_recursive_t tlr;static unsigned int count; -static uint32_t synchro; +static RTE_ATOMIC (uint32_t ) synchro;static int test_ticketlock_per_core(__rte_unused void *arg)
@@ -111,7 +111,8 @@/* wait synchro for workers */ if (lcore !=rte_get_main_lcore ()) -rte_wait_until_equal_32 (&synchro,1 , __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&synchro,1 , + rte_memory_order_relaxed); begin =rte_rdtsc_precise ();while (lcore_count[lcore] <MAX_LOOP ) {
@@ -153,11 +154,11 @@printf ("\nTest with lock on %u cores...\n" ,rte_lcore_count ());/* Clear synchro and start workers */ -__atomic_store_n (&synchro,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,0 , rte_memory_order_relaxed);rte_eal_mp_remote_launch (load_loop_fn, &lock,SKIP_MAIN );/* start synchro and launch test on main */ -__atomic_store_n (&synchro,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&synchro,1 , rte_memory_order_relaxed);load_loop_fn (&lock);rte_eal_mp_wait_lcore ();
app/test/test_timer.c +19 -12
@@ -202,7 +202,7 @@ struct mytimerinfo {/* Need to synchronize worker lcores through multiple steps. */ enum {WORKER_WAITING =1 ,WORKER_RUN_SIGNAL ,WORKER_RUNNING ,WORKER_FINISHED }; -static uint16_t lcore_state[RTE_MAX_LCORE ]; +static RTE_ATOMIC (uint16_t ) lcore_state[RTE_MAX_LCORE ];static void main_init_workers (void )
@@ -210,7 +210,8 @@ struct mytimerinfo {unsigned i;RTE_LCORE_FOREACH_WORKER (i) { -__atomic_store_n (&lcore_state[i],WORKER_WAITING , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&lcore_state[i],WORKER_WAITING , + rte_memory_order_relaxed); } }
@@ -220,10 +221,12 @@ struct mytimerinfo {unsigned i;RTE_LCORE_FOREACH_WORKER (i) { -__atomic_store_n (&lcore_state[i],WORKER_RUN_SIGNAL , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&lcore_state[i],WORKER_RUN_SIGNAL , + rte_memory_order_release); }RTE_LCORE_FOREACH_WORKER (i) { -rte_wait_until_equal_16 (&lcore_state[i],WORKER_RUNNING , __ATOMIC_ACQUIRE); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&lcore_state[i],WORKER_RUNNING , + rte_memory_order_acquire); } }
@@ -233,7 +236,8 @@ struct mytimerinfo {unsigned i;RTE_LCORE_FOREACH_WORKER (i) { -rte_wait_until_equal_16 (&lcore_state[i],WORKER_FINISHED , __ATOMIC_ACQUIRE); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&lcore_state[i],WORKER_FINISHED , + rte_memory_order_acquire); } }
@@ -242,8 +246,10 @@ struct mytimerinfo { {unsigned lcore_id =rte_lcore_id (); -rte_wait_until_equal_16 (&lcore_state[lcore_id],WORKER_RUN_SIGNAL , __ATOMIC_ACQUIRE); -__atomic_store_n (&lcore_state[lcore_id],WORKER_RUNNING , __ATOMIC_RELEASE); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&lcore_state[lcore_id],WORKER_RUN_SIGNAL , + rte_memory_order_acquire); +rte_atomic_store_explicit (&lcore_state[lcore_id],WORKER_RUNNING , + rte_memory_order_release); } static void
@@ -251,7 +257,8 @@ struct mytimerinfo { {unsigned lcore_id =rte_lcore_id (); -__atomic_store_n (&lcore_state[lcore_id],WORKER_FINISHED , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&lcore_state[lcore_id],WORKER_FINISHED , + rte_memory_order_release); }
@@ -277,12 +284,12 @@ struct mytimerinfo {unsigned int lcore_id =rte_lcore_id ();unsigned int main_lcore =rte_get_main_lcore ();int32_t my_collisions =0 ; -static uint32_t collisions; +static RTE_ATOMIC (uint32_t ) collisions;if (lcore_id == main_lcore) { cb_count =0 ; test_failed =0 ; -__atomic_store_n (&collisions,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&collisions,0 , rte_memory_order_relaxed); timers =rte_malloc (NULL ,sizeof (*timers) *NB_STRESS2_TIMERS ,0 );if (timers ==NULL ) {printf ("Test Failed\n" );
@@ -310,7 +317,7 @@ struct mytimerinfo { my_collisions++; }if (my_collisions !=0 ) -__atomic_fetch_add (&collisions, my_collisions, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&collisions, my_collisions, rte_memory_order_relaxed);/* wait long enough for timers to expire */ rte_delay_ms (100 );
@@ -324,7 +331,7 @@ struct mytimerinfo {/* now check that we get the right number of callbacks */ if (lcore_id == main_lcore) { - my_collisions =__atomic_load_n (&collisions, __ATOMIC_RELAXED); + my_collisions =rte_atomic_load_explicit (&collisions, rte_memory_order_relaxed);if (my_collisions !=0 )printf ("- %d timer reset collisions (OK)\n" , my_collisions);rte_timer_manage ();
Signature · 1 line
1.8.3.1
PATCH 43/46 app/test-eventdev: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- app/test-eventdev/test_order_atq.c | 4 ++-- app/test-eventdev/test_order_common.c | 5 +++-- app/test-eventdev/test_order_common.h | 8 ++++---- app/test-eventdev/test_order_queue.c | 4 ++-- app/test-eventdev/test_perf_common.h | 6 +++--- 5 files changed, 14 insertions(+), 13 deletions(-)
app/test-eventdev/test_order_atq.c +2 -2
@@ -28,7 +28,7 @@uint16_t event =rte_event_dequeue_burst (dev_id, port, &ev,1 ,0 );if (!event) { -if (__atomic_load_n (outstand_pkts, __ATOMIC_RELAXED) <=0 ) +if (rte_atomic_load_explicit (outstand_pkts, rte_memory_order_relaxed) <=0 )break ;rte_pause ();continue ;
@@ -64,7 +64,7 @@ BURST_SIZE, 0);if (nb_rx ==0 ) { -if (__atomic_load_n (outstand_pkts, __ATOMIC_RELAXED) <=0 ) +if (rte_atomic_load_explicit (outstand_pkts, rte_memory_order_relaxed) <=0 )break ;rte_pause ();continue ;
app/test-eventdev/test_order_common.c +3 -2
@@ -189,7 +189,7 @@evt_err ("failed to allocate t->expected_flow_seq memory" ); goto exp_nomem; } -__atomic_store_n (&t->outstand_pkts, opt->nb_pkts, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&t->outstand_pkts, opt->nb_pkts, rte_memory_order_relaxed); t->err = false; t->nb_pkts = opt->nb_pkts; t->nb_flows = opt->nb_flows;
@@ -296,7 +296,8 @@while (t->err == false) {uint64_t new_cycles =rte_get_timer_cycles (); -int64_t remaining =__atomic_load_n (&t->outstand_pkts, __ATOMIC_RELAXED); +int64_t remaining =rte_atomic_load_explicit (&t->outstand_pkts, + rte_memory_order_relaxed);if (remaining <=0 ) { t->result =EVT_TEST_SUCCESS ;
app/test-eventdev/test_order_common.h +4 -4
@@ -48,7 +48,7 @@ struct test_order {* The atomic_* is an expensive operation,Since it is a functional test, * We are using the atomic_ operation to reduce the code complexity. */ -uint64_t outstand_pkts; +RTE_ATOMIC (uint64_t ) outstand_pkts;enum evt_test_result result;uint32_t nb_flows;uint64_t nb_pkts;
@@ -95,7 +95,7 @@ struct test_order { order_process_stage_1(struct test_order *const t, struct rte_event *const ev, const uint32_t nb_flows, uint32_t *const expected_flow_seq, - uint64_t *const outstand_pkts) + RTE_ATOMIC(uint64_t) *const outstand_pkts) { const uint32_t flow = (uintptr_t)ev->mbuf % nb_flows;/* compare the seqn against expected value */
@@ -113,7 +113,7 @@ struct test_order {*/ expected_flow_seq[flow]++;rte_pktmbuf_free (ev->mbuf); -__atomic_fetch_sub (outstand_pkts,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (outstand_pkts,1 , rte_memory_order_relaxed); }static __rte_always_inline void
@@ -132,7 +132,7 @@ struct test_order {const uint8_t port = w->port_id;\const uint32_t nb_flows = t->nb_flows;\uint32_t *expected_flow_seq = t->expected_flow_seq;\ -uint64_t *outstand_pkts = &t->outstand_pkts;\ +RTE_ATOMIC (uint64_t) *outstand_pkts = &t->outstand_pkts;\if (opt->verbose_level >1 )\printf ("%s(): lcore %d dev_id %d port=%d\n" ,\ __func__,rte_lcore_id (), dev_id, port)
app/test-eventdev/test_order_queue.c +2 -2
@@ -28,7 +28,7 @@uint16_t event =rte_event_dequeue_burst (dev_id, port, &ev,1 ,0 );if (!event) { -if (__atomic_load_n (outstand_pkts, __ATOMIC_RELAXED) <=0 ) +if (rte_atomic_load_explicit (outstand_pkts, rte_memory_order_relaxed) <=0 )break ;rte_pause ();continue ;
@@ -64,7 +64,7 @@ BURST_SIZE, 0);if (nb_rx ==0 ) { -if (__atomic_load_n (outstand_pkts, __ATOMIC_RELAXED) <=0 ) +if (rte_atomic_load_explicit (outstand_pkts, rte_memory_order_relaxed) <=0 )break ;rte_pause ();continue ;
app/test-eventdev/test_perf_common.h +3 -3
@@ -225,7 +225,7 @@ struct perf_elt {* stored before updating the number of * processed packets for worker lcores */ -rte_atomic_thread_fence (__ATOMIC_RELEASE); +rte_atomic_thread_fence (rte_memory_order_release); w->processed_pkts++;if (prod_type ==EVT_PROD_TYPE_EVENT_CRYPTO_ADPTR ) {
@@ -270,7 +270,7 @@ struct perf_elt {/* Release fence here ensures event_prt is stored before updating the number of processed * packets for worker lcores. */ -rte_atomic_thread_fence (__ATOMIC_RELEASE); +rte_atomic_thread_fence (rte_memory_order_release); w->processed_pkts++;if (prod_type ==EVT_PROD_TYPE_EVENT_CRYPTO_ADPTR ) {
@@ -325,7 +325,7 @@ struct perf_elt {/* Release fence here ensures event_prt is stored before updating the number of processed * packets for worker lcores. */ -rte_atomic_thread_fence (__ATOMIC_RELEASE); +rte_atomic_thread_fence (rte_memory_order_release); w->processed_pkts += vec->nb_elem;if (enable_fwd_latency) {
Signature · 1 line
1.8.3.1
PATCH 44/46 app/test-crypto-perf: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- app/test-crypto-perf/cperf_test_latency.c | 6 +++--- app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 10 +++++----- app/test-crypto-perf/cperf_test_throughput.c | 10 +++++----- app/test-crypto-perf/cperf_test_verify.c | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-)
app/test-crypto-perf/cperf_test_latency.c +3 -3
@@ -136,7 +136,7 @@ struct priv_op_data {uint32_t imix_idx =0 ;int ret =0 ; -static uint16_t display_once; +static RTE_ATOMIC (uint16_t ) display_once;if (ctx ==NULL )return 0 ;
@@ -341,8 +341,8 @@ struct priv_op_data {uint16_t exp =0 ;if (ctx->options->csv) { -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed))printf ("\n# lcore, Buffer Size, Burst Size, Pakt Seq #, " "cycles, time (us)" );
app/test-crypto-perf/cperf_test_pmd_cyclecount.c +5 -5
@@ -396,7 +396,7 @@ struct pmd_cyclecount_state { state.lcore =rte_lcore_id (); state.linearize =0 ; -static uint16_t display_once; +static RTE_ATOMIC (uint16_t ) display_once;static bool warmup = true;/*
@@ -443,8 +443,8 @@ struct pmd_cyclecount_state {uint16_t exp =0 ;if (!opts->csv) { -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) printf(PRETTY_HDR_FMT, "lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Enq Retries",
@@ -460,8 +460,8 @@ struct pmd_cyclecount_state { state.cycles_per_enq, state.cycles_per_deq); }else { -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) printf(CSV_HDR_FMT, "# lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Enq Retries",
app/test-crypto-perf/cperf_test_throughput.c +5 -5
@@ -107,7 +107,7 @@ struct cperf_throughput_ctx {uint8_t burst_size_idx =0 ;uint32_t imix_idx =0 ; -static uint16_t display_once; +static RTE_ATOMIC (uint16_t ) display_once;struct rte_crypto_op *ops[ctx->options->max_burst_size];struct rte_crypto_op *ops_processed[ctx->options->max_burst_size];
@@ -277,8 +277,8 @@ struct cperf_throughput_ctx {uint16_t exp =0 ;if (!ctx->options->csv) { -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) printf("%12s%12s%12s%12s%12s%12s%12s%12s%12s%12s\n\n", "lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Failed Enq",
@@ -298,8 +298,8 @@ struct cperf_throughput_ctx { throughput_gbps, cycles_per_packet); }else { -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed))printf ("#lcore id,Buffer Size(B)," "Burst Size,Enqueued,Dequeued,Failed Enq," "Failed Deq,Ops(Millions),Throughput(Gbps),"
app/test-crypto-perf/cperf_test_verify.c +5 -5
@@ -216,7 +216,7 @@ struct cperf_op_result {uint64_t ops_deqd =0 , ops_deqd_total =0 , ops_deqd_failed =0 ;uint64_t ops_failed =0 ; -static uint16_t display_once; +static RTE_ATOMIC (uint16_t ) display_once;uint64_t i;uint16_t ops_unused =0 ;
@@ -370,8 +370,8 @@ struct cperf_op_result {uint16_t exp =0 ;if (!ctx->options->csv) { -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) printf("%12s%12s%12s%12s%12s%12s%12s%12s\n\n", "lcore id", "Buf Size", "Burst size", "Enqueued", "Dequeued", "Failed Enq",
@@ -388,8 +388,8 @@ struct cperf_op_result { ops_deqd_failed, ops_failed); }else { -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed))printf ("\n# lcore id, Buffer Size(B), " "Burst Size,Enqueued,Dequeued,Failed Enq," "Failed Deq,Failed Ops\n" );
Signature · 1 line
1.8.3.1
PATCH 45/46 app/test-compress-perf: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- app/test-compress-perf/comp_perf_test_common.h | 2 +- app/test-compress-perf/comp_perf_test_cyclecount.c | 4 ++-- app/test-compress-perf/comp_perf_test_throughput.c | 10 +++++----- app/test-compress-perf/comp_perf_test_verify.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-)
app/test-compress-perf/comp_perf_test_common.h +1 -1
@@ -14,7 +14,7 @@ struct cperf_mem_resources {uint16_t qp_id;uint8_t lcore_id; -uint16_t print_info_once; +RTE_ATOMIC (uint16_t ) print_info_once;uint32_t total_bufs;uint8_t *compressed_data;
app/test-compress-perf/comp_perf_test_cyclecount.c +2 -2
@@ -498,8 +498,8 @@ struct cperf_cyclecount_ctx {/* * printing information about current compression thread */ -if (__atomic_compare_exchange_n (&ctx->ver.mem.print_info_once, &exp, -1 ,0 , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&ctx->ver.mem.print_info_once, &exp, +1 , rte_memory_order_relaxed, rte_memory_order_relaxed))printf (" lcore: %u," " driver name: %s," " device name: %s,"
app/test-compress-perf/comp_perf_test_throughput.c +5 -5
@@ -336,7 +336,7 @@struct cperf_benchmark_ctx *ctx = test_ctx;struct comp_test_data *test_data = ctx->ver.options;uint32_t lcore =rte_lcore_id (); -static uint16_t display_once; +static RTE_ATOMIC (uint16_t ) display_once;int i, ret =EXIT_SUCCESS ; ctx->ver.mem.lcore_id = lcore;
@@ -345,8 +345,8 @@/* * printing information about current compression thread */ -if (__atomic_compare_exchange_n (&ctx->ver.mem.print_info_once, &exp, -1 ,0 , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (rte_atomic_compare_exchange_strong_explicit (&ctx->ver.mem.print_info_once, &exp, +1 , rte_memory_order_relaxed, rte_memory_order_relaxed))printf (" lcore: %u," " driver name: %s," " device name: %s,"
@@ -413,8 +413,8 @@ } exp =0 ; -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) {printf ("\n%12s%6s%12s%17s%15s%16s\n" ,"lcore id" ,"Level" ,"Comp size" ,"Comp ratio [%]" ,"Comp [Gbps]" ,"Decomp [Gbps]" );
app/test-compress-perf/comp_perf_test_verify.c +3 -3
@@ -396,7 +396,7 @@struct cperf_verify_ctx *ctx = test_ctx;struct comp_test_data *test_data = ctx->options;int ret =EXIT_SUCCESS ; -static uint16_t display_once; +static RTE_ATOMIC (uint16_t ) display_once;uint32_t lcore =rte_lcore_id ();uint16_t exp =0 ;
@@ -452,8 +452,8 @@ test_data->input_data_sz *100 ;if (!ctx->silent) { -if (__atomic_compare_exchange_n (&display_once, &exp,1 ,0 , - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { +if (rte_atomic_compare_exchange_strong_explicit (&display_once, &exp,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) {printf ("%12s%6s%12s%17s\n" ,"lcore id" ,"Level" ,"Comp size" ,"Comp ratio [%]" ); }
Signature · 1 line
1.8.3.1
PATCH 46/46 app/test-bbdev: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- app/test-bbdev/test_bbdev_perf.c | 183 +++++++++++++++++++++++---------------- 1 file changed, 110 insertions(+), 73 deletions(-)
app/test-bbdev/test_bbdev_perf.c +110 -73
@@ -144,7 +144,7 @@ struct test_op_params {uint16_t num_to_process;uint16_t num_lcores;int vector_mask; -uint16_t sync; +RTE_ATOMIC (uint16_t ) sync;struct test_buffers q_bufs[RTE_MAX_NUMA_NODES ][MAX_QUEUES ]; };
@@ -159,9 +159,9 @@ struct thread_params {uint8_t iter_count;double iter_average;double bler; -uint16_t nb_dequeued; -int16_t processing_status; -uint16_t burst_sz; +RTE_ATOMIC (uint16_t ) nb_dequeued; +RTE_ATOMIC (int16_t ) processing_status; +RTE_ATOMIC (uint16_t ) burst_sz;struct test_op_params *op_params;struct rte_bbdev_dec_op *dec_ops[MAX_BURST ];struct rte_bbdev_enc_op *enc_ops[MAX_BURST ];
@@ -3195,56 +3195,64 @@ typedef int (test_case_function)(struct active_device *ad, }if (unlikely (event !=RTE_BBDEV_EVENT_DEQUEUE )) { -__atomic_store_n (&tp->processing_status,TEST_FAILED , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,TEST_FAILED , + rte_memory_order_relaxed);printf ("Dequeue interrupt handler called for incorrect event!\n" );return ; } - burst_sz =__atomic_load_n (&tp->burst_sz, __ATOMIC_RELAXED); + burst_sz =rte_atomic_load_explicit (&tp->burst_sz, rte_memory_order_relaxed); num_ops = tp->op_params->num_to_process;if (test_vector.op_type ==RTE_BBDEV_OP_TURBO_DEC ) deq =rte_bbdev_dequeue_dec_ops (dev_id, queue_id, &tp->dec_ops[ -__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED)], +rte_atomic_load_explicit (&tp->nb_dequeued, + rte_memory_order_relaxed)], burst_sz);else if (test_vector.op_type ==RTE_BBDEV_OP_LDPC_DEC ) deq =rte_bbdev_dequeue_ldpc_dec_ops (dev_id, queue_id, &tp->dec_ops[ -__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED)], +rte_atomic_load_explicit (&tp->nb_dequeued, + rte_memory_order_relaxed)], burst_sz);else if (test_vector.op_type ==RTE_BBDEV_OP_LDPC_ENC ) deq =rte_bbdev_dequeue_ldpc_enc_ops (dev_id, queue_id, &tp->enc_ops[ -__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED)], +rte_atomic_load_explicit (&tp->nb_dequeued, + rte_memory_order_relaxed)], burst_sz);else if (test_vector.op_type ==RTE_BBDEV_OP_FFT ) deq =rte_bbdev_dequeue_fft_ops (dev_id, queue_id, &tp->fft_ops[ -__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED)], +rte_atomic_load_explicit (&tp->nb_dequeued, + rte_memory_order_relaxed)], burst_sz);else if (test_vector.op_type ==RTE_BBDEV_OP_MLDTS ) deq =rte_bbdev_dequeue_mldts_ops (dev_id, queue_id, &tp->mldts_ops[ -__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED)], +rte_atomic_load_explicit (&tp->nb_dequeued, + rte_memory_order_relaxed)], burst_sz);else /*RTE_BBDEV_OP_TURBO_ENC*/ deq =rte_bbdev_dequeue_enc_ops (dev_id, queue_id, &tp->enc_ops[ -__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED)], +rte_atomic_load_explicit (&tp->nb_dequeued, + rte_memory_order_relaxed)], burst_sz);if (deq < burst_sz) {printf ("After receiving the interrupt all operations should be dequeued. Expected: %u, got: %u\n" , burst_sz, deq); -__atomic_store_n (&tp->processing_status,TEST_FAILED , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,TEST_FAILED , + rte_memory_order_relaxed);return ; } -if (__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED) + deq < num_ops) { -__atomic_fetch_add (&tp->nb_dequeued, deq, __ATOMIC_RELAXED); +if (rte_atomic_load_explicit (&tp->nb_dequeued, rte_memory_order_relaxed) + deq < num_ops) { +rte_atomic_fetch_add_explicit (&tp->nb_dequeued, deq, rte_memory_order_relaxed);return ; }
@@ -3288,7 +3296,8 @@ typedef int (test_case_function)(struct active_device *ad,if (ret) {printf ("Buffers validation failed\n" ); -__atomic_store_n (&tp->processing_status,TEST_FAILED , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,TEST_FAILED , + rte_memory_order_relaxed); }switch (test_vector.op_type) {
@@ -3315,7 +3324,8 @@ typedef int (test_case_function)(struct active_device *ad,break ;default :printf ("Unknown op type: %d\n" , test_vector.op_type); -__atomic_store_n (&tp->processing_status,TEST_FAILED , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,TEST_FAILED , + rte_memory_order_relaxed);return ; }
@@ -3324,7 +3334,7 @@ typedef int (test_case_function)(struct active_device *ad, tp->mbps += (((double )(num_ops * tb_len_bits)) /1000000.0 ) / ((double )total_time / (double )rte_get_tsc_hz ()); -__atomic_fetch_add (&tp->nb_dequeued, deq, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&tp->nb_dequeued, deq, rte_memory_order_relaxed); } static int
@@ -3362,10 +3372,11 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -__atomic_store_n (&tp->processing_status,0 , __ATOMIC_RELAXED); -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,0 , rte_memory_order_relaxed); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_dec_op_alloc_bulk (tp->op_params->mp, ops, num_to_process);
@@ -3415,15 +3426,17 @@ typedef int (test_case_function)(struct active_device *ad,* the number of operations is not a multiple of * burst size. */ -__atomic_store_n (&tp->burst_sz, num_to_enq, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->burst_sz, num_to_enq, + rte_memory_order_relaxed);/* Wait until processing of previous batch is * completed */ -rte_wait_until_equal_16 (&tp->nb_dequeued, enqueued, __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->nb_dequeued, enqueued, + rte_memory_order_relaxed); }if (j !=TEST_REPETITIONS -1 ) -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); }return TEST_SUCCESS ;
@@ -3459,10 +3472,11 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -__atomic_store_n (&tp->processing_status,0 , __ATOMIC_RELAXED); -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,0 , rte_memory_order_relaxed); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_dec_op_alloc_bulk (tp->op_params->mp, ops, num_to_process);
@@ -3506,15 +3520,17 @@ typedef int (test_case_function)(struct active_device *ad,* the number of operations is not a multiple of * burst size. */ -__atomic_store_n (&tp->burst_sz, num_to_enq, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->burst_sz, num_to_enq, + rte_memory_order_relaxed);/* Wait until processing of previous batch is * completed */ -rte_wait_until_equal_16 (&tp->nb_dequeued, enqueued, __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->nb_dequeued, enqueued, + rte_memory_order_relaxed); }if (j !=TEST_REPETITIONS -1 ) -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); }return TEST_SUCCESS ;
@@ -3549,10 +3565,11 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -__atomic_store_n (&tp->processing_status,0 , __ATOMIC_RELAXED); -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,0 , rte_memory_order_relaxed); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_enc_op_alloc_bulk (tp->op_params->mp, ops, num_to_process);
@@ -3592,15 +3609,17 @@ typedef int (test_case_function)(struct active_device *ad,* the number of operations is not a multiple of * burst size. */ -__atomic_store_n (&tp->burst_sz, num_to_enq, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->burst_sz, num_to_enq, + rte_memory_order_relaxed);/* Wait until processing of previous batch is * completed */ -rte_wait_until_equal_16 (&tp->nb_dequeued, enqueued, __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->nb_dequeued, enqueued, + rte_memory_order_relaxed); }if (j !=TEST_REPETITIONS -1 ) -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); }return TEST_SUCCESS ;
@@ -3636,10 +3655,11 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -__atomic_store_n (&tp->processing_status,0 , __ATOMIC_RELAXED); -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,0 , rte_memory_order_relaxed); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_enc_op_alloc_bulk (tp->op_params->mp, ops, num_to_process);
@@ -3681,15 +3701,17 @@ typedef int (test_case_function)(struct active_device *ad,* the number of operations is not a multiple of * burst size. */ -__atomic_store_n (&tp->burst_sz, num_to_enq, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->burst_sz, num_to_enq, + rte_memory_order_relaxed);/* Wait until processing of previous batch is * completed */ -rte_wait_until_equal_16 (&tp->nb_dequeued, enqueued, __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->nb_dequeued, enqueued, + rte_memory_order_relaxed); }if (j !=TEST_REPETITIONS -1 ) -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); }return TEST_SUCCESS ;
@@ -3725,10 +3747,11 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -__atomic_store_n (&tp->processing_status,0 , __ATOMIC_RELAXED); -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,0 , rte_memory_order_relaxed); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_fft_op_alloc_bulk (tp->op_params->mp, ops, num_to_process);
@@ -3769,15 +3792,17 @@ typedef int (test_case_function)(struct active_device *ad,* the number of operations is not a multiple of * burst size. */ -__atomic_store_n (&tp->burst_sz, num_to_enq, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->burst_sz, num_to_enq, + rte_memory_order_relaxed);/* Wait until processing of previous batch is * completed */ -rte_wait_until_equal_16 (&tp->nb_dequeued, enqueued, __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->nb_dequeued, enqueued, + rte_memory_order_relaxed); }if (j !=TEST_REPETITIONS -1 ) -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); }return TEST_SUCCESS ;
@@ -3811,10 +3836,11 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -__atomic_store_n (&tp->processing_status,0 , __ATOMIC_RELAXED); -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->processing_status,0 , rte_memory_order_relaxed); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_mldts_op_alloc_bulk (tp->op_params->mp, ops, num_to_process);TEST_ASSERT_SUCCESS (ret,"Allocation failed for %d ops" , num_to_process);
@@ -3851,15 +3877,17 @@ typedef int (test_case_function)(struct active_device *ad,* the number of operations is not a multiple of * burst size. */ -__atomic_store_n (&tp->burst_sz, num_to_enq, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->burst_sz, num_to_enq, + rte_memory_order_relaxed);/* Wait until processing of previous batch is * completed */ -rte_wait_until_equal_16 (&tp->nb_dequeued, enqueued, __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->nb_dequeued, enqueued, + rte_memory_order_relaxed); }if (j !=TEST_REPETITIONS -1 ) -__atomic_store_n (&tp->nb_dequeued,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&tp->nb_dequeued,0 , rte_memory_order_relaxed); }return TEST_SUCCESS ;
@@ -3894,7 +3922,8 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_dec_op_alloc_bulk (tp->op_params->mp, ops_enq, num_ops);TEST_ASSERT_SUCCESS (ret,"Allocation failed for %d ops" , num_ops);
@@ -4013,7 +4042,8 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_dec_op_alloc_bulk (tp->op_params->mp, ops_enq, num_ops);TEST_ASSERT_SUCCESS (ret,"Allocation failed for %d ops" , num_ops);
@@ -4148,7 +4178,8 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_dec_op_alloc_bulk (tp->op_params->mp, ops_enq, num_ops);TEST_ASSERT_SUCCESS (ret,"Allocation failed for %d ops" , num_ops);
@@ -4271,7 +4302,8 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_dec_op_alloc_bulk (tp->op_params->mp, ops_enq, num_ops);TEST_ASSERT_SUCCESS (ret,"Allocation failed for %d ops" , num_ops);
@@ -4402,7 +4434,8 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_enc_op_alloc_bulk (tp->op_params->mp, ops_enq, num_ops);
@@ -4503,7 +4536,8 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_enc_op_alloc_bulk (tp->op_params->mp, ops_enq, num_ops);
@@ -4604,7 +4638,8 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_fft_op_alloc_bulk (tp->op_params->mp, ops_enq, num_ops);TEST_ASSERT_SUCCESS (ret,"Allocation failed for %d ops" , num_ops);
@@ -4702,7 +4737,8 @@ typedef int (test_case_function)(struct active_device *ad, bufs = &tp->op_params->q_bufs[GET_SOCKET (info.socket_id)][queue_id]; -rte_wait_until_equal_16 (&tp->op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_wait_until_equal_16 ((uint16_t *)(uintptr_t )&tp->op_params->sync,SYNC_START , + rte_memory_order_relaxed); ret =rte_bbdev_mldts_op_alloc_bulk (tp->op_params->mp, ops_enq, num_ops);TEST_ASSERT_SUCCESS (ret,"Allocation failed for %d ops" , num_ops);
@@ -4898,7 +4934,7 @@ typedef int (test_case_function)(struct active_device *ad,else return TEST_SKIPPED ; -__atomic_store_n (&op_params->sync,SYNC_WAIT , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&op_params->sync,SYNC_WAIT , rte_memory_order_relaxed);/* Main core is set at first entry */ t_params[0 ].dev_id = ad->dev_id;
@@ -4921,7 +4957,7 @@ typedef int (test_case_function)(struct active_device *ad, &t_params[used_cores++], lcore_id); } -__atomic_store_n (&op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&op_params->sync,SYNC_START , rte_memory_order_relaxed); ret =bler_function (&t_params[0 ]);/* Main core is always used */
@@ -5024,7 +5060,7 @@ typedef int (test_case_function)(struct active_device *ad, throughput_function = throughput_pmd_lcore_enc; } -__atomic_store_n (&op_params->sync,SYNC_WAIT , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&op_params->sync,SYNC_WAIT , rte_memory_order_relaxed);/* Main core is set at first entry */ t_params[0 ].dev_id = ad->dev_id;
@@ -5047,7 +5083,7 @@ typedef int (test_case_function)(struct active_device *ad, &t_params[used_cores++], lcore_id); } -__atomic_store_n (&op_params->sync,SYNC_START , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&op_params->sync,SYNC_START , rte_memory_order_relaxed); ret =throughput_function (&t_params[0 ]);/* Main core is always used */
@@ -5077,29 +5113,30 @@ typedef int (test_case_function)(struct active_device *ad,* Wait for main lcore operations. */ tp = &t_params[0 ]; -while ((__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED) < +while ((rte_atomic_load_explicit (&tp->nb_dequeued, rte_memory_order_relaxed) < op_params->num_to_process) && - (__atomic_load_n (&tp->processing_status, __ATOMIC_RELAXED) != + (rte_atomic_load_explicit (&tp->processing_status, rte_memory_order_relaxed) !=TEST_FAILED ))rte_pause (); tp->ops_per_sec /=TEST_REPETITIONS ; tp->mbps /=TEST_REPETITIONS ; - ret |= (int )__atomic_load_n (&tp->processing_status, __ATOMIC_RELAXED); + ret |= (int )rte_atomic_load_explicit (&tp->processing_status, rte_memory_order_relaxed);/* Wait for worker lcores operations */ for (used_cores =1 ; used_cores < num_lcores; used_cores++) { tp = &t_params[used_cores]; -while ((__atomic_load_n (&tp->nb_dequeued, __ATOMIC_RELAXED) < +while ((rte_atomic_load_explicit (&tp->nb_dequeued, rte_memory_order_relaxed) < op_params->num_to_process) && - (__atomic_load_n (&tp->processing_status, __ATOMIC_RELAXED) != -TEST_FAILED )) + (rte_atomic_load_explicit (&tp->processing_status, + rte_memory_order_relaxed) !=TEST_FAILED ))rte_pause (); tp->ops_per_sec /=TEST_REPETITIONS ; tp->mbps /=TEST_REPETITIONS ; - ret |= (int )__atomic_load_n (&tp->processing_status, __ATOMIC_RELAXED); + ret |= (int )rte_atomic_load_explicit (&tp->processing_status, + rte_memory_order_relaxed); }/* Print throughput if test passed */
Signature · 1 line
1.8.3.1
Quoted 8 lines · On Wed, 20 Mar 2024 13:50:46 -0700 Tyler Retzlaff…
This series converts all non-generic built atomics to use the
rte_atomicmacros that allow optional enablement of standard C11 atomics.Use of generic atomics for non-scalar types are not converted in this change and will be evaluated as a part of a separate series.
Note if this series ends up requiring too much rebasing due to tree churn before it is merged i will break it up into smaller series.
Maybe a coccinelle script to automate this and check/fix future usages?
Quoted 6 lines · Stephen Hemminger
Quoted 3 lines · On Wed, 20 Mar 2024 13:50:46 -0700 Tyler Retzlaff…
This series converts all non-generic built atomics to use the
rte_atomicmacros that allow optional enablement of standard C11 atomics.
Quoted 7 lines
Quoted 5 lines
Use of generic atomics for non-scalar types are not converted in this change and will be evaluated as a part of a separate series.
Note if this series ends up requiring too much rebasing due to tree churn before it is merged i will break it up into smaller series.
Maybe a coccinelle script to automate this and check/fix future usages?
it also isn't strictly a 1:1 replacement so some __atomic_ could be text replaced sometimes you need to evaluate arguments on e.g. compare exchange to pick the right macro, sometimes there are generic vs scalar version to deal with.
we already have a checkpatches check but right now it is (I think) being ignored when merging changes to drivers that have not been converted. so if we get things converted there shouldn't be any further reason to accept series that are being flagged by checkpatches.
Quoted 2 lines
Series-acked-by Stephen Hemminger <[email protected]>
v2 cover use stdatomic API
In reply to Tyler RetzlaffThis series converts all non-generic built atomics to use the rte_atomic macros that allow optional enablement of standard C11 atomics.
Use of generic atomics for non-scalar types are not converted in this change and will be evaluated as a part of a separate series.
Note if this series ends up requiring too much rebasing due to tree churn before it is merged i will break it up into smaller series.
v2:
* drop the net/sfc driver from the series. the sfc driver uses generic __atomic_store not handled by the current macros. the cases where generic __atomic_xxx are used on objects that can't be accepted by __atomic_xxx_n will be addressed in a separate series.
Tyler Retzlaff (45):
net/mlx5: use rte stdatomic API
net/ixgbe: use rte stdatomic API
net/iavf: use rte stdatomic API
net/ice: use rte stdatomic API
net/i40e: use rte stdatomic API
net/hns3: use rte stdatomic API
net/bnxt: use rte stdatomic API
net/cpfl: use rte stdatomic API
net/af_xdp: use rte stdatomic API
net/octeon_ep: use rte stdatomic API
net/octeontx: use rte stdatomic API
net/cxgbe: use rte stdatomic API
net/gve: use rte stdatomic API
net/memif: use rte stdatomic API
net/thunderx: use rte stdatomic API
net/virtio: use rte stdatomic API
net/hinic: use rte stdatomic API
net/idpf: use rte stdatomic API
net/qede: use rte stdatomic API
net/ring: use rte stdatomic API
vdpa/mlx5: use rte stdatomic API
raw/ifpga: use rte stdatomic API
event/opdl: use rte stdatomic API
event/octeontx: use rte stdatomic API
event/dsw: use rte stdatomic API
dma/skeleton: use rte stdatomic API
crypto/octeontx: use rte stdatomic API
common/mlx5: use rte stdatomic API
common/idpf: use rte stdatomic API
common/iavf: use rte stdatomic API
baseband/acc: use rte stdatomic API
net/txgbe: use rte stdatomic API
net/null: use rte stdatomic API
event/dlb2: use rte stdatomic API
dma/idxd: use rte stdatomic API
crypto/ccp: use rte stdatomic API
common/cpt: use rte stdatomic API
bus/vmbus: use rte stdatomic API
examples: use rte stdatomic API
app/dumpcap: use rte stdatomic API
app/test: use rte stdatomic API
app/test-eventdev: use rte stdatomic API
app/test-crypto-perf: use rte stdatomic API
app/test-compress-perf: use rte stdatomic API
app/test-bbdev: use rte stdatomic API
app/dumpcap/main.c | 12 +- app/test-bbdev/test_bbdev_perf.c | 183 +++++++++++++-------- app/test-compress-perf/comp_perf_test_common.h | 2 +- app/test-compress-perf/comp_perf_test_cyclecount.c | 4 +- app/test-compress-perf/comp_perf_test_throughput.c | 10 +- app/test-compress-perf/comp_perf_test_verify.c | 6 +- app/test-crypto-perf/cperf_test_latency.c | 6 +- app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 10 +- app/test-crypto-perf/cperf_test_throughput.c | 10 +- app/test-crypto-perf/cperf_test_verify.c | 10 +- app/test-eventdev/test_order_atq.c | 4 +- app/test-eventdev/test_order_common.c | 5 +- app/test-eventdev/test_order_common.h | 8 +- app/test-eventdev/test_order_queue.c | 4 +- app/test-eventdev/test_perf_common.h | 6 +- app/test/test_bpf.c | 46 ++++-- app/test/test_distributor.c | 114 ++++++------- app/test/test_distributor_perf.c | 4 +- app/test/test_func_reentrancy.c | 28 ++-- app/test/test_hash_multiwriter.c | 16 +- app/test/test_hash_readwrite.c | 74 ++++----- app/test/test_hash_readwrite_lf_perf.c | 88 +++++----- app/test/test_lcores.c | 25 +-- app/test/test_lpm_perf.c | 14 +- app/test/test_mcslock.c | 12 +- app/test/test_mempool_perf.c | 9 +- app/test/test_pflock.c | 13 +- app/test/test_pmd_perf.c | 10 +- app/test/test_rcu_qsbr_perf.c | 114 ++++++------- app/test/test_ring_perf.c | 11 +- app/test/test_ring_stress_impl.h | 10 +- app/test/test_rwlock.c | 9 +- app/test/test_seqlock.c | 6 +- app/test/test_service_cores.c | 24 +-- app/test/test_spinlock.c | 9 +- app/test/test_stack_perf.c | 12 +- app/test/test_threads.c | 33 ++-- app/test/test_ticketlock.c | 9 +- app/test/test_timer.c | 31 ++-- drivers/baseband/acc/rte_acc100_pmd.c | 36 ++-- drivers/baseband/acc/rte_vrb_pmd.c | 46 ++++-- drivers/bus/vmbus/vmbus_channel.c | 9 +- drivers/common/cpt/cpt_common.h | 2 +- drivers/common/iavf/iavf_impl.c | 4 +- drivers/common/idpf/idpf_common_device.h | 6 +- drivers/common/idpf/idpf_common_rxtx.c | 14 +- drivers/common/idpf/idpf_common_rxtx.h | 2 +- drivers/common/idpf/idpf_common_rxtx_avx512.c | 16 +- drivers/common/mlx5/linux/mlx5_nl.c | 5 +- drivers/common/mlx5/mlx5_common.h | 2 +- drivers/common/mlx5/mlx5_common_mr.c | 16 +- drivers/common/mlx5/mlx5_common_mr.h | 2 +- drivers/common/mlx5/mlx5_common_utils.c | 32 ++-- drivers/common/mlx5/mlx5_common_utils.h | 6 +- drivers/common/mlx5/mlx5_malloc.c | 58 +++---- drivers/crypto/ccp/ccp_dev.c | 8 +- drivers/crypto/octeontx/otx_cryptodev_ops.c | 4 +- drivers/dma/idxd/idxd_internal.h | 2 +- drivers/dma/idxd/idxd_pci.c | 9 +- drivers/dma/skeleton/skeleton_dmadev.c | 5 +- drivers/dma/skeleton/skeleton_dmadev.h | 2 +- drivers/event/dlb2/dlb2.c | 34 ++-- drivers/event/dlb2/dlb2_priv.h | 10 +- drivers/event/dlb2/dlb2_xstats.c | 2 +- drivers/event/dsw/dsw_evdev.h | 6 +- drivers/event/dsw/dsw_event.c | 34 ++-- drivers/event/dsw/dsw_xstats.c | 4 +- drivers/event/octeontx/timvf_evdev.h | 8 +- drivers/event/octeontx/timvf_worker.h | 36 ++-- drivers/event/opdl/opdl_ring.c | 80 ++++----- drivers/net/af_xdp/rte_eth_af_xdp.c | 20 ++- drivers/net/bnxt/bnxt_cpr.h | 4 +- drivers/net/bnxt/bnxt_rxq.h | 2 +- drivers/net/bnxt/bnxt_rxr.c | 13 +- drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 2 +- drivers/net/bnxt/bnxt_stats.c | 4 +- drivers/net/cpfl/cpfl_ethdev.c | 8 +- drivers/net/cxgbe/clip_tbl.c | 12 +- drivers/net/cxgbe/clip_tbl.h | 2 +- drivers/net/cxgbe/cxgbe_main.c | 20 +-- drivers/net/cxgbe/cxgbe_ofld.h | 6 +- drivers/net/cxgbe/l2t.c | 12 +- drivers/net/cxgbe/l2t.h | 2 +- drivers/net/cxgbe/mps_tcam.c | 21 +-- drivers/net/cxgbe/mps_tcam.h | 2 +- drivers/net/cxgbe/smt.c | 12 +- drivers/net/cxgbe/smt.h | 2 +- drivers/net/gve/base/gve_osdep.h | 4 +- drivers/net/hinic/hinic_pmd_rx.c | 2 +- drivers/net/hinic/hinic_pmd_rx.h | 2 +- drivers/net/hns3/hns3_cmd.c | 18 +- drivers/net/hns3/hns3_dcb.c | 2 +- drivers/net/hns3/hns3_ethdev.c | 36 ++-- drivers/net/hns3/hns3_ethdev.h | 32 ++-- drivers/net/hns3/hns3_ethdev_vf.c | 60 +++---- drivers/net/hns3/hns3_intr.c | 36 ++-- drivers/net/hns3/hns3_intr.h | 4 +- drivers/net/hns3/hns3_mbx.c | 6 +- drivers/net/hns3/hns3_mp.c | 6 +- drivers/net/hns3/hns3_rxtx.c | 10 +- drivers/net/hns3/hns3_tm.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 4 +- drivers/net/i40e/i40e_rxtx.c | 6 +- drivers/net/i40e/i40e_rxtx_vec_neon.c | 2 +- drivers/net/iavf/iavf.h | 16 +- drivers/net/iavf/iavf_rxtx.c | 4 +- drivers/net/iavf/iavf_rxtx_vec_neon.c | 2 +- drivers/net/iavf/iavf_vchnl.c | 14 +- drivers/net/ice/base/ice_osdep.h | 4 +- drivers/net/ice/ice_dcf.c | 6 +- drivers/net/ice/ice_dcf.h | 2 +- drivers/net/ice/ice_dcf_ethdev.c | 8 +- drivers/net/ice/ice_dcf_parent.c | 16 +- drivers/net/ice/ice_ethdev.c | 12 +- drivers/net/ice/ice_ethdev.h | 2 +- drivers/net/idpf/idpf_ethdev.c | 7 +- drivers/net/ixgbe/ixgbe_ethdev.c | 14 +- drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 4 +- drivers/net/memif/memif.h | 4 +- drivers/net/memif/rte_eth_memif.c | 50 +++--- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 6 +- drivers/net/mlx5/linux/mlx5_verbs.c | 9 +- drivers/net/mlx5/mlx5.c | 9 +- drivers/net/mlx5/mlx5.h | 66 ++++---- drivers/net/mlx5/mlx5_flow.c | 37 +++-- drivers/net/mlx5/mlx5_flow.h | 8 +- drivers/net/mlx5/mlx5_flow_aso.c | 43 +++-- drivers/net/mlx5/mlx5_flow_dv.c | 126 +++++++------- drivers/net/mlx5/mlx5_flow_flex.c | 14 +- drivers/net/mlx5/mlx5_flow_hw.c | 61 +++---- drivers/net/mlx5/mlx5_flow_meter.c | 30 ++-- drivers/net/mlx5/mlx5_flow_quota.c | 32 ++-- drivers/net/mlx5/mlx5_hws_cnt.c | 71 ++++---- drivers/net/mlx5/mlx5_hws_cnt.h | 10 +- drivers/net/mlx5/mlx5_rx.h | 14 +- drivers/net/mlx5/mlx5_rxq.c | 30 ++-- drivers/net/mlx5/mlx5_trigger.c | 2 +- drivers/net/mlx5/mlx5_tx.h | 18 +- drivers/net/mlx5/mlx5_txpp.c | 84 +++++----- drivers/net/mlx5/mlx5_txq.c | 12 +- drivers/net/mlx5/mlx5_utils.c | 10 +- drivers/net/mlx5/mlx5_utils.h | 4 +- drivers/net/null/rte_eth_null.c | 12 +- drivers/net/octeon_ep/cnxk_ep_rx.h | 5 +- drivers/net/octeon_ep/cnxk_ep_tx.c | 5 +- drivers/net/octeon_ep/cnxk_ep_vf.c | 8 +- drivers/net/octeon_ep/otx2_ep_vf.c | 8 +- drivers/net/octeon_ep/otx_ep_common.h | 4 +- drivers/net/octeon_ep/otx_ep_rxtx.c | 6 +- drivers/net/octeontx/octeontx_ethdev.c | 8 +- drivers/net/qede/base/bcm_osal.c | 6 +- drivers/net/ring/rte_eth_ring.c | 8 +- drivers/net/thunderx/nicvf_rxtx.c | 9 +- drivers/net/thunderx/nicvf_struct.h | 4 +- drivers/net/txgbe/txgbe_ethdev.c | 12 +- drivers/net/txgbe/txgbe_ethdev.h | 2 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 2 +- drivers/net/virtio/virtio_ring.h | 4 +- drivers/net/virtio/virtio_user/virtio_user_dev.c | 12 +- drivers/net/virtio/virtqueue.h | 32 ++-- drivers/raw/ifpga/ifpga_rawdev.c | 9 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 24 +-- drivers/vdpa/mlx5/mlx5_vdpa.h | 14 +- drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 46 +++--- drivers/vdpa/mlx5/mlx5_vdpa_lm.c | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 4 +- examples/bbdev_app/main.c | 13 +- examples/l2fwd-event/l2fwd_common.h | 4 +- examples/l2fwd-event/l2fwd_event.c | 24 +-- examples/l2fwd-jobstats/main.c | 11 +- .../client_server_mp/mp_server/main.c | 6 +- examples/server_node_efd/efd_server/main.c | 6 +- examples/vhost/main.c | 32 ++-- examples/vhost/main.h | 4 +- examples/vhost/virtio_net.c | 13 +- examples/vhost_blk/vhost_blk.c | 8 +- examples/vm_power_manager/channel_monitor.c | 9 +- 179 files changed, 1628 insertions(+), 1496 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/45 net/mlx5: use rte stdatomic API
Replace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 6 +- drivers/net/mlx5/linux/mlx5_verbs.c | 9 ++- drivers/net/mlx5/mlx5.c | 9 ++- drivers/net/mlx5/mlx5.h | 66 ++++++++--------- drivers/net/mlx5/mlx5_flow.c | 37 +++++----- drivers/net/mlx5/mlx5_flow.h | 8 +- drivers/net/mlx5/mlx5_flow_aso.c | 43 ++++++----- drivers/net/mlx5/mlx5_flow_dv.c | 126 ++++++++++++++++---------------- drivers/net/mlx5/mlx5_flow_flex.c | 14 ++-- drivers/net/mlx5/mlx5_flow_hw.c | 61 +++++++++------- drivers/net/mlx5/mlx5_flow_meter.c | 30 ++++---- drivers/net/mlx5/mlx5_flow_quota.c | 32 ++++---- drivers/net/mlx5/mlx5_hws_cnt.c | 71 +++++++++--------- drivers/net/mlx5/mlx5_hws_cnt.h | 10 +-- drivers/net/mlx5/mlx5_rx.h | 14 ++-- drivers/net/mlx5/mlx5_rxq.c | 30 ++++---- drivers/net/mlx5/mlx5_trigger.c | 2 +- drivers/net/mlx5/mlx5_tx.h | 18 ++--- drivers/net/mlx5/mlx5_txpp.c | 84 ++++++++++----------- drivers/net/mlx5/mlx5_txq.c | 12 +-- drivers/net/mlx5/mlx5_utils.c | 10 +-- drivers/net/mlx5/mlx5_utils.h | 4 +- 22 files changed, 351 insertions(+), 345 deletions(-)
drivers/net/mlx5/linux/mlx5_ethdev_os.c +3 -3
@@ -1918,9 +1918,9 @@ int mlx5_txpp_map_hca_bar(struct rte_eth_dev *dev)return -ENOTSUP ; }/* Check there is no concurrent mapping in other thread. */ -if (!__atomic_compare_exchange_n (&ppriv->hca_bar, &expected, - base, false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) +if (!rte_atomic_compare_exchange_strong_explicit (&ppriv->hca_bar, &expected, + base, + rte_memory_order_relaxed, rte_memory_order_relaxed))rte_mem_unmap (base,MLX5_ST_SZ_BYTES (initial_seg));return 0 ; }
drivers/net/mlx5/linux/mlx5_verbs.c +5 -4
@@ -1117,7 +1117,7 @@return 0 ; }/* Only need to check refcnt, 0 after "sh" is allocated. */ -if (!!(__atomic_fetch_add (&sh->self_lb.refcnt,1 , __ATOMIC_RELAXED))) { +if (!!(rte_atomic_fetch_add_explicit (&sh->self_lb.refcnt,1 , rte_memory_order_relaxed))) {MLX5_ASSERT (sh->self_lb.ibv_cq && sh->self_lb.qp); priv->lb_used =1 ;return 0 ;
@@ -1163,7 +1163,7 @@claim_zero (mlx5_glue->destroy_cq (sh->self_lb.ibv_cq)); sh->self_lb.ibv_cq = NULL; } -__atomic_fetch_sub (&sh->self_lb.refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&sh->self_lb.refcnt,1 , rte_memory_order_relaxed);return -rte_errno;#else RTE_SET_USED (dev);
@@ -1186,8 +1186,9 @@if (!priv->lb_used)return ; -MLX5_ASSERT (__atomic_load_n (&sh->self_lb.refcnt, __ATOMIC_RELAXED)); -if (!(__atomic_fetch_sub (&sh->self_lb.refcnt,1 , __ATOMIC_RELAXED) -1 )) { +MLX5_ASSERT (rte_atomic_load_explicit (&sh->self_lb.refcnt, rte_memory_order_relaxed)); +if (!(rte_atomic_fetch_sub_explicit (&sh->self_lb.refcnt,1 , + rte_memory_order_relaxed) -1 )) {if (sh->self_lb.qp) {claim_zero (mlx5_glue->destroy_qp (sh->self_lb.qp)); sh->self_lb.qp =NULL ;
drivers/net/mlx5/mlx5.c +5 -4
@@ -855,8 +855,8 @@ ct_pool = mng->pools[idx];for (i =0 ; i <MLX5_ASO_CT_ACTIONS_PER_POOL ; i++) { ct = &ct_pool->actions[i]; - val =__atomic_fetch_sub (&ct->refcnt,1 , - __ATOMIC_RELAXED); + val =rte_atomic_fetch_sub_explicit (&ct->refcnt,1 , + rte_memory_order_relaxed);MLX5_ASSERT (val ==1 );if (val >1 ) cnt++;
@@ -1082,7 +1082,8 @@DRV_LOG (ERR ,"Dynamic flex parser is not supported on HWS" );return -ENOTSUP ; } -if (__atomic_fetch_add (&priv->sh->srh_flex_parser.refcnt,1 , __ATOMIC_RELAXED) +1 >1 ) +if (rte_atomic_fetch_add_explicit (&priv->sh->srh_flex_parser.refcnt,1 , + rte_memory_order_relaxed) +1 >1 )return 0 ; priv->sh->srh_flex_parser.flex.devx_fp =mlx5_malloc (MLX5_MEM_ZERO ,sizeof (struct mlx5_flex_parser_devx ),0 ,SOCKET_ID_ANY );
@@ -1173,7 +1174,7 @@struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_internal_flex_parser_profile *fp = &priv->sh->srh_flex_parser; -if (__atomic_fetch_sub (&fp->refcnt,1 , __ATOMIC_RELAXED) -1 ) +if (rte_atomic_fetch_sub_explicit (&fp->refcnt,1 , rte_memory_order_relaxed) -1 )return ;mlx5_devx_cmd_destroy (fp->flex.devx_fp->devx_obj);mlx5_free (fp->flex.devx_fp);
drivers/net/mlx5/mlx5.h +33 -33
207 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.c +19 -18
@@ -4623,8 +4623,8 @@ struct mlx5_translated_action_handle { shared_rss =mlx5_ipool_get (priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS ], idx); -__atomic_fetch_add (&shared_rss->refcnt,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&shared_rss->refcnt,1 , + rte_memory_order_relaxed);return idx;default :break ;
@@ -7459,7 +7459,7 @@ struct mlx5_list_entry *if (tunnel) { flow->tunnel =1 ; flow->tunnel_id = tunnel->tunnel_id; -__atomic_fetch_add (&tunnel->refctn,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&tunnel->refctn,1 , rte_memory_order_relaxed);mlx5_free (default_miss_ctx.queue); }mlx5_flow_pop_thread_workspace ();
@@ -7470,10 +7470,10 @@ struct mlx5_list_entry *flow_mreg_del_copy_action (dev, flow);flow_drv_destroy (dev, flow);if (rss_desc->shared_rss) -__atomic_fetch_sub (&((struct mlx5_shared_action_rss *) +rte_atomic_fetch_sub_explicit (&((struct mlx5_shared_action_rss *)mlx5_ipool_get (priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS ], - rss_desc->shared_rss))->refcnt,1 , __ATOMIC_RELAXED); + rss_desc->shared_rss))->refcnt,1 , rte_memory_order_relaxed);mlx5_ipool_free (priv->flows[type], idx); rte_errno = ret;/* Restore rte_errno. */ ret = rte_errno;
@@ -7976,7 +7976,8 @@ struct rte_flow * tunnel =mlx5_find_tunnel_id (dev, flow->tunnel_id);RTE_VERIFY (tunnel); -if (!(__atomic_fetch_sub (&tunnel->refctn,1 , __ATOMIC_RELAXED) -1 )) +if (!(rte_atomic_fetch_sub_explicit (&tunnel->refctn,1 , + rte_memory_order_relaxed) -1 ))mlx5_flow_tunnel_free (dev, tunnel); }flow_mreg_del_copy_action (dev, flow);
@@ -9456,7 +9457,7 @@ struct mlx5_flow_workspace* {uint32_t pools_n, us; - pools_n =__atomic_load_n (&sh->sws_cmng.n_valid, __ATOMIC_RELAXED); + pools_n =rte_atomic_load_explicit (&sh->sws_cmng.n_valid, rte_memory_order_relaxed); us =MLX5_POOL_QUERY_FREQ_US / pools_n;DRV_LOG (DEBUG ,"Set alarm for %u pools each %u us" , pools_n, us);if (rte_eal_alarm_set (us, mlx5_flow_query_alarm, sh)) {
@@ -9558,17 +9559,17 @@ struct mlx5_flow_workspace*for (i =0 ; i <MLX5_COUNTERS_PER_POOL ; ++i) { cnt =MLX5_POOL_GET_CNT (pool, i); age_param =MLX5_CNT_TO_AGE (cnt); -if (__atomic_load_n (&age_param->state, - __ATOMIC_RELAXED) !=AGE_CANDIDATE ) +if (rte_atomic_load_explicit (&age_param->state, + rte_memory_order_relaxed) !=AGE_CANDIDATE )continue ;if (cur->data[i].hits != prev->data[i].hits) { -__atomic_store_n (&age_param->sec_since_last_hit,0 , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&age_param->sec_since_last_hit,0 , + rte_memory_order_relaxed);continue ; } -if (__atomic_fetch_add (&age_param->sec_since_last_hit, +if (rte_atomic_fetch_add_explicit (&age_param->sec_since_last_hit, time_delta, - __ATOMIC_RELAXED) + time_delta <= age_param->timeout) + rte_memory_order_relaxed) + time_delta <= age_param->timeout)continue ;/** * Hold the lock first, or if between the
@@ -9579,10 +9580,10 @@ struct mlx5_flow_workspace* priv = rte_eth_devices[age_param->port_id].data->dev_private; age_info =GET_PORT_AGE_INFO (priv);rte_spinlock_lock (&age_info->aged_sl); -if (__atomic_compare_exchange_n (&age_param->state, &expected, -AGE_TMOUT , false, - __ATOMIC_RELAXED, - __ATOMIC_RELAXED)) { +if (rte_atomic_compare_exchange_strong_explicit (&age_param->state, &expected, +AGE_TMOUT , + rte_memory_order_relaxed, + rte_memory_order_relaxed)) {TAILQ_INSERT_TAIL (&age_info->aged_counters, cnt, next);MLX5_AGE_SET (age_info,MLX5_AGE_EVENT_NEW ); }
@@ -11407,7 +11408,7 @@ struct tunnel_db_element_release_ctx { {struct tunnel_db_element_release_ctx *ctx = x; ctx->ret =0 ; -if (!(__atomic_fetch_sub (&tunnel->refctn,1 , __ATOMIC_RELAXED) -1 )) +if (!(rte_atomic_fetch_sub_explicit (&tunnel->refctn,1 , rte_memory_order_relaxed) -1 ))mlx5_flow_tunnel_free (dev, tunnel); }
drivers/net/mlx5/mlx5_flow.h +4 -4
@@ -1049,7 +1049,7 @@ struct mlx5_flow_tunnel {LIST_ENTRY (mlx5_flow_tunnel) chain;struct rte_flow_tunnel app_tunnel;/** app tunnel copy */ uint32_t tunnel_id;/** unique tunnel ID */ -uint32_t refctn; +RTE_ATOMIC (uint32_t ) refctn;struct rte_flow_action action;struct rte_flow_item item;struct mlx5_hlist *groups;/** tunnel groups */
@@ -1470,7 +1470,7 @@ struct rte_flow_pattern_template {struct mlx5dr_match_template *mt;/* mlx5 match template. */ uint64_t item_flags;/* Item layer flags. */ uint64_t orig_item_nb;/* Number of pattern items provided by the user (with END item). */ -uint32_t refcnt;/* Reference counter. */ +RTE_ATOMIC (uint32_t ) refcnt;/* Reference counter. */ /* * If true, then rule pattern should be prepended with * represented_port pattern item.
@@ -1502,7 +1502,7 @@ struct rte_flow_actions_template {uint16_t reformat_off;/* Offset of DR reformat action. */ uint16_t mhdr_off;/* Offset of DR modify header action. */ uint16_t recom_off;/* Offset of DR IPv6 routing push remove action. */ -uint32_t refcnt;/* Reference counter. */ +RTE_ATOMIC (uint32_t ) refcnt;/* Reference counter. */ uint8_t flex_item;/* flex item index. */ };
@@ -1855,7 +1855,7 @@ struct rte_flow_template_table {/* Shared RSS action structure */ struct mlx5_shared_action_rss {ILIST_ENTRY (uint32_t )next;/**< Index to the next RSS structure. */ -uint32_t refcnt;/**< Atomically accessed refcnt. */ +RTE_ATOMIC (uint32_t ) refcnt;/**< Atomically accessed refcnt. */ struct rte_flow_action_rss origin;/**< Original rte RSS action. */ uint8_t key[MLX5_RSS_HASH_KEY_LEN ];/**< RSS hash key. */ struct mlx5_ind_table_obj *ind_tbl;
drivers/net/mlx5/mlx5_flow_aso.c +21 -22
120 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_dv.c +63 -63
307 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_flex.c +7 -7
@@ -86,7 +86,7 @@MLX5_ASSERT (!item->refcnt);MLX5_ASSERT (!item->devx_fp); item->devx_fp =NULL ; -__atomic_store_n (&item->refcnt,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&item->refcnt,0 , rte_memory_order_release); priv->flex_item_map |=1u << idx; } }
@@ -107,7 +107,7 @@MLX5_ASSERT (!item->refcnt);MLX5_ASSERT (!item->devx_fp); item->devx_fp =NULL ; -__atomic_store_n (&item->refcnt,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&item->refcnt,0 , rte_memory_order_release); priv->flex_item_map &= ~(1u << idx);rte_spinlock_unlock (&priv->flex_item_sl); }
@@ -379,7 +379,7 @@return ret; }if (acquire) -__atomic_fetch_add (&flex->refcnt,1 , __ATOMIC_RELEASE); +rte_atomic_fetch_add_explicit (&flex->refcnt,1 , rte_memory_order_release);return ret; }
@@ -414,7 +414,7 @@ rte_errno = -EINVAL ;return -EINVAL ; } -__atomic_fetch_sub (&flex->refcnt,1 , __ATOMIC_RELEASE); +rte_atomic_fetch_sub_explicit (&flex->refcnt,1 , rte_memory_order_release);return 0 ; }
@@ -1337,7 +1337,7 @@ struct rte_flow_item_flex_handle * } flex->devx_fp = container_of(ent, struct mlx5_flex_parser_devx, entry);/* Mark initialized flex item valid. */ -__atomic_fetch_add (&flex->refcnt,1 , __ATOMIC_RELEASE); +rte_atomic_fetch_add_explicit (&flex->refcnt,1 , rte_memory_order_release);return (struct rte_flow_item_flex_handle *)flex; error:
@@ -1378,8 +1378,8 @@ struct rte_flow_item_flex_handle *RTE_FLOW_ERROR_TYPE_ITEM ,NULL , "invalid flex item handle value"); } -if (!__atomic_compare_exchange_n (&flex->refcnt, &old_refcnt,0 ,0 , - __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) { +if (!rte_atomic_compare_exchange_strong_explicit (&flex->refcnt, &old_refcnt,0 , + rte_memory_order_acquire, rte_memory_order_relaxed)) {rte_spinlock_unlock (&priv->flex_item_sl); return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
drivers/net/mlx5/mlx5_flow_hw.c +33 -28
169 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_meter.c +15 -15
@@ -2055,9 +2055,9 @@ struct mlx5_flow_meter_policy * NULL, "Meter profile id not valid.");/* Meter policy must exist. */ if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) { -__atomic_fetch_add +rte_atomic_fetch_add_explicit (&priv->sh->mtrmng->def_policy_ref_cnt, -1 , __ATOMIC_RELAXED); +1 , rte_memory_order_relaxed); domain_bitmap =MLX5_MTR_ALL_DOMAIN_BIT ;if (!priv->sh->config.dv_esw_en) domain_bitmap &= ~MLX5_MTR_DOMAIN_TRANSFER_BIT ;
@@ -2137,7 +2137,7 @@ struct mlx5_flow_meter_policy * fm->is_enable = params->meter_enable; fm->shared = !!shared; fm->color_aware = !!params->use_prev_mtr_color; -__atomic_fetch_add (&fm->profile->ref_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&fm->profile->ref_cnt,1 , rte_memory_order_relaxed);if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) { fm->def_policy =1 ; fm->flow_ipool =mlx5_ipool_create (&flow_ipool_cfg);
@@ -2166,7 +2166,7 @@ struct mlx5_flow_meter_policy * } fm->active_state = params->meter_enable;if (mtr_policy) -__atomic_fetch_add (&mtr_policy->ref_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&mtr_policy->ref_cnt,1 , rte_memory_order_relaxed);return 0 ; error:mlx5_flow_destroy_mtr_tbls (dev, fm);
@@ -2271,8 +2271,8 @@ struct mlx5_flow_meter_policy * NULL, "Failed to create devx meter."); } fm->active_state = params->meter_enable; -__atomic_fetch_add (&fm->profile->ref_cnt,1 , __ATOMIC_RELAXED); -__atomic_fetch_add (&policy->ref_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&fm->profile->ref_cnt,1 , rte_memory_order_relaxed); +rte_atomic_fetch_add_explicit (&policy->ref_cnt,1 , rte_memory_order_relaxed);return 0 ; }#endif
@@ -2295,7 +2295,7 @@ struct mlx5_flow_meter_policy *if (fmp ==NULL )return -1 ;/* Update dependencies. */ -__atomic_fetch_sub (&fmp->ref_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&fmp->ref_cnt,1 , rte_memory_order_relaxed); fm->profile =NULL ;/* Remove from list. */ if (!priv->sh->meter_aso_en) {
@@ -2313,15 +2313,15 @@ struct mlx5_flow_meter_policy * }mlx5_flow_destroy_mtr_tbls (dev, fm);if (fm->def_policy) -__atomic_fetch_sub (&priv->sh->mtrmng->def_policy_ref_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&priv->sh->mtrmng->def_policy_ref_cnt, +1 , rte_memory_order_relaxed);if (priv->sh->meter_aso_en) {if (!fm->def_policy) { mtr_policy =mlx5_flow_meter_policy_find (dev, fm->policy_id,NULL );if (mtr_policy) -__atomic_fetch_sub (&mtr_policy->ref_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&mtr_policy->ref_cnt, +1 , rte_memory_order_relaxed); fm->policy_id =0 ; } fm->def_policy =0 ;
@@ -2424,13 +2424,13 @@ struct mlx5_flow_meter_policy *RTE_MTR_ERROR_TYPE_UNSPECIFIED , NULL, "Meter object is being used.");/* Destroy the meter profile. */ -__atomic_fetch_sub (&fm->profile->ref_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&fm->profile->ref_cnt, +1 , rte_memory_order_relaxed);/* Destroy the meter policy. */ policy =mlx5_flow_meter_policy_find (dev, fm->policy_id,NULL ); -__atomic_fetch_sub (&policy->ref_cnt, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&policy->ref_cnt, +1 , rte_memory_order_relaxed);memset (fm,0 ,sizeof (struct mlx5_flow_meter_info ));return 0 ; }
drivers/net/mlx5/mlx5_flow_quota.c +16 -16
@@ -218,9 +218,9 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict,struct mlx5_quota *quota_obj = sq->elts[(sq->tail + i) & mask].quota_obj; -__atomic_compare_exchange_n ("a_obj->state, &state, -MLX5_QUOTA_STATE_READY , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED); +rte_atomic_compare_exchange_strong_explicit ("a_obj->state, &state, +MLX5_QUOTA_STATE_READY , + rte_memory_order_relaxed, rte_memory_order_relaxed); } }
@@ -278,7 +278,7 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict,rte_spinlock_lock (&sq->sqsl);mlx5_quota_cmd_completion_handle (sq);rte_spinlock_unlock (&sq->sqsl); -if (__atomic_load_n ("a_obj->state, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit ("a_obj->state, rte_memory_order_relaxed) ==MLX5_QUOTA_STATE_READY )return 0 ; }while (poll_cqe_times -=MLX5_ASO_WQE_CQE_RESPONSE_DELAY );
@@ -470,9 +470,9 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict, mlx5_quota_check_ready(struct mlx5_quota *qobj, struct rte_flow_error *error) { uint8_t state = MLX5_QUOTA_STATE_READY; -bool verdict =__atomic_compare_exchange_n - (&qobj->state, &state,MLX5_QUOTA_STATE_WAIT , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED); +bool verdict =rte_atomic_compare_exchange_strong_explicit + (&qobj->state, &state,MLX5_QUOTA_STATE_WAIT , + rte_memory_order_relaxed, rte_memory_order_relaxed); if (!verdict) return rte_flow_error_set(error, EBUSY,
@@ -507,8 +507,8 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict, ret =mlx5_quota_cmd_wqe (dev, qobj, mlx5_quota_wqe_query, qix, work_queue, async_job ? async_job : &sync_job, push,NULL );if (ret) { -__atomic_store_n (&qobj->state,MLX5_QUOTA_STATE_READY , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&qobj->state,MLX5_QUOTA_STATE_READY , + rte_memory_order_relaxed);return rte_flow_error_set (error,EAGAIN ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"try again" ); }
@@ -557,8 +557,8 @@ typedef void (*quota_wqe_cmd_t)(volatile struct mlx5_aso_wqe *restrict, async_job ? async_job : &sync_job, push, (void *)(uintptr_t)update->conf);if (ret) { -__atomic_store_n (&qobj->state,MLX5_QUOTA_STATE_READY , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&qobj->state,MLX5_QUOTA_STATE_READY , + rte_memory_order_relaxed);return rte_flow_error_set (error,EAGAIN ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"try again" ); }
@@ -593,9 +593,9 @@ struct rte_flow_action_handle * NULL, "quota: failed to allocate quota object");return NULL ; } - verdict =__atomic_compare_exchange_n - (&qobj->state, &state,MLX5_QUOTA_STATE_WAIT , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED); + verdict =rte_atomic_compare_exchange_strong_explicit + (&qobj->state, &state,MLX5_QUOTA_STATE_WAIT , + rte_memory_order_relaxed, rte_memory_order_relaxed);if (!verdict) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"quota: new quota object has invalid state" );
@@ -616,8 +616,8 @@ struct rte_flow_action_handle * (void *)(uintptr_t)conf);if (ret) {mlx5_ipool_free (qctx->quota_ipool, id); -__atomic_store_n (&qobj->state,MLX5_QUOTA_STATE_FREE , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&qobj->state,MLX5_QUOTA_STATE_FREE , + rte_memory_order_relaxed);rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"quota: WR failure" );return 0 ;
drivers/net/mlx5/mlx5_hws_cnt.c +35 -36
161 lines not on this page · raw message
drivers/net/mlx5/mlx5_hws_cnt.h +5 -5
@@ -101,7 +101,7 @@ struct mlx5_hws_cnt_pool {LIST_ENTRY (mlx5_hws_cnt_pool) next; struct mlx5_hws_cnt_pool_cfg cfg __rte_cache_aligned; struct mlx5_hws_cnt_dcs_mng dcs_mng __rte_cache_aligned; - uint32_t query_gen __rte_cache_aligned; + RTE_ATOMIC(uint32_t) query_gen __rte_cache_aligned;struct mlx5_hws_cnt *pool;struct mlx5_hws_cnt_raw_data_mng *raw_mng;struct rte_ring *reuse_list;
@@ -134,10 +134,10 @@ enum {/* HWS counter age parameter. */ struct mlx5_hws_age_param { -uint32_t timeout;/* Aging timeout in seconds (atomically accessed). */ -uint32_t sec_since_last_hit; +RTE_ATOMIC (uint32_t ) timeout;/* Aging timeout in seconds (atomically accessed). */ +RTE_ATOMIC (uint32_t ) sec_since_last_hit;/* Time in seconds since last hit (atomically accessed). */ -uint16_t state;/* AGE state (atomically accessed). */ +RTE_ATOMIC (uint16_t ) state;/* AGE state (atomically accessed). */ uint64_t accumulator_last_hits;/* Last total value of hits for comparing. */ uint64_t accumulator_hits;
@@ -426,7 +426,7 @@ struct mlx5_hws_age_param { iidx =mlx5_hws_cnt_iidx (hpool, *cnt_id); hpool->pool[iidx].in_used = false; hpool->pool[iidx].query_gen_when_free = -__atomic_load_n (&hpool->query_gen, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&hpool->query_gen, rte_memory_order_relaxed);if (likely (queue !=NULL ) && cpool->cfg.host_cpool ==NULL ) qcache = hpool->cache->qcache[*queue];if (unlikely (qcache ==NULL )) {
drivers/net/mlx5/mlx5_rx.h +7 -7
@@ -173,7 +173,7 @@ struct mlx5_rxq_ctrl {/* RX queue private data. */ struct mlx5_rxq_priv {uint16_t idx;/* Queue index. */ -uint32_t refcnt;/* Reference counter. */ +RTE_ATOMIC (uint32_t ) refcnt;/* Reference counter. */ struct mlx5_rxq_ctrl *ctrl;/* Shared Rx Queue. */ LIST_ENTRY (mlx5_rxq_priv) owner_entry;/* Entry in shared rxq_ctrl. */ struct mlx5_priv *priv;/* Back pointer to private data. */
@@ -188,7 +188,7 @@ struct mlx5_rxq_priv {/* External RX queue descriptor. */ struct mlx5_external_rxq {uint32_t hw_id;/* Queue index in the Hardware. */ -uint32_t refcnt;/* Reference counter. */ +RTE_ATOMIC (uint32_t ) refcnt;/* Reference counter. */ };/* mlx5_rxq.c */
@@ -412,7 +412,7 @@ uint16_t mlx5_rx_burst_mprq_vec(void *dpdk_rxq, struct rte_mbuf **pkts,struct mlx5_mprq_buf *buf = (*rxq->mprq_bufs)[rq_idx];void *addr; -if (__atomic_load_n (&buf->refcnt, __ATOMIC_RELAXED) >1 ) { +if (rte_atomic_load_explicit (&buf->refcnt, rte_memory_order_relaxed) >1 ) {MLX5_ASSERT (rep !=NULL );/* Replace MPRQ buf. */ (*rxq->mprq_bufs)[rq_idx] = rep;
@@ -524,9 +524,9 @@ uint16_t mlx5_rx_burst_mprq_vec(void *dpdk_rxq, struct rte_mbuf **pkts,void *buf_addr;/* Increment the refcnt of the whole chunk. */ -__atomic_fetch_add (&buf->refcnt,1 , __ATOMIC_RELAXED); -MLX5_ASSERT (__atomic_load_n (&buf->refcnt, - __ATOMIC_RELAXED) <= strd_n +1 ); +rte_atomic_fetch_add_explicit (&buf->refcnt,1 , rte_memory_order_relaxed); +MLX5_ASSERT (rte_atomic_load_explicit (&buf->refcnt, + rte_memory_order_relaxed) <= strd_n +1 ); buf_addr =RTE_PTR_SUB (addr,RTE_PKTMBUF_HEADROOM );/* * MLX5 device doesn't use iova but it is necessary in a
@@ -666,7 +666,7 @@ uint16_t mlx5_rx_burst_mprq_vec(void *dpdk_rxq, struct rte_mbuf **pkts,if (!priv->ext_rxqs || queue_idx <RTE_PMD_MLX5_EXTERNAL_RX_QUEUE_ID_MIN )return false; rxq = &priv->ext_rxqs[queue_idx -RTE_PMD_MLX5_EXTERNAL_RX_QUEUE_ID_MIN ]; -return !!__atomic_load_n (&rxq->refcnt, __ATOMIC_RELAXED); +return !!rte_atomic_load_explicit (&rxq->refcnt, rte_memory_order_relaxed); }#define LWM_COOKIE_RXQID_OFFSET 0
drivers/net/mlx5/mlx5_rxq.c +15 -15
@@ -416,7 +416,7 @@ rte_errno =EINVAL ;return -rte_errno; } -return (__atomic_load_n (&rxq->refcnt, __ATOMIC_RELAXED) ==1 ); +return (rte_atomic_load_explicit (&rxq->refcnt, rte_memory_order_relaxed) ==1 ); }/* Fetches and drops all SW-owned and error CQEs to synchronize CQ. */
@@ -1319,7 +1319,7 @@memset (_m,0 ,sizeof (*buf)); buf->mp = mp; -__atomic_store_n (&buf->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&buf->refcnt,1 , rte_memory_order_relaxed);for (j =0 ; j != strd_n; ++j) { shinfo = &buf->shinfos[j]; shinfo->free_cb = mlx5_mprq_buf_free_cb;
@@ -2037,7 +2037,7 @@ struct mlx5_rxq_priv *struct mlx5_rxq_priv *rxq =mlx5_rxq_get (dev, idx);if (rxq !=NULL ) -__atomic_fetch_add (&rxq->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->refcnt,1 , rte_memory_order_relaxed);return rxq; }
@@ -2059,7 +2059,7 @@ struct mlx5_rxq_priv *if (rxq ==NULL )return 0 ; -return __atomic_fetch_sub (&rxq->refcnt,1 , __ATOMIC_RELAXED) -1 ; +return rte_atomic_fetch_sub_explicit (&rxq->refcnt,1 , rte_memory_order_relaxed) -1 ; }/**
@@ -2138,7 +2138,7 @@ struct mlx5_external_rxq * {struct mlx5_external_rxq *rxq =mlx5_ext_rxq_get (dev, idx); -__atomic_fetch_add (&rxq->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->refcnt,1 , rte_memory_order_relaxed);return rxq; }
@@ -2158,7 +2158,7 @@ struct mlx5_external_rxq * {struct mlx5_external_rxq *rxq =mlx5_ext_rxq_get (dev, idx); -return __atomic_fetch_sub (&rxq->refcnt,1 , __ATOMIC_RELAXED) -1 ; +return rte_atomic_fetch_sub_explicit (&rxq->refcnt,1 , rte_memory_order_relaxed) -1 ; }/**
@@ -2447,8 +2447,8 @@ struct mlx5_ind_table_obj * (memcmp(ind_tbl->queues, queues, ind_tbl->queues_n * sizeof(ind_tbl->queues[0])) == 0)) { -__atomic_fetch_add (&ind_tbl->refcnt,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&ind_tbl->refcnt,1 , + rte_memory_order_relaxed);break ; } }
@@ -2479,7 +2479,7 @@ struct mlx5_ind_table_obj *unsigned int ret;rte_rwlock_write_lock (&priv->ind_tbls_lock); - ret =__atomic_fetch_sub (&ind_tbl->refcnt,1 , __ATOMIC_RELAXED) -1 ; + ret =rte_atomic_fetch_sub_explicit (&ind_tbl->refcnt,1 , rte_memory_order_relaxed) -1 ;if (!ret)LIST_REMOVE (ind_tbl, next);rte_rwlock_write_unlock (&priv->ind_tbls_lock);
@@ -2561,7 +2561,7 @@ struct mlx5_ind_table_obj * }return ret; } -__atomic_fetch_add (&ind_tbl->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&ind_tbl->refcnt,1 , rte_memory_order_relaxed);return 0 ; }
@@ -2626,7 +2626,7 @@ struct mlx5_ind_table_obj * {uint32_t refcnt; - refcnt =__atomic_load_n (&ind_tbl->refcnt, __ATOMIC_RELAXED); + refcnt =rte_atomic_load_explicit (&ind_tbl->refcnt, rte_memory_order_relaxed);if (refcnt <=1 )return 0 ;/*
@@ -3258,8 +3258,8 @@ struct mlx5_hrxq * ext_rxq =mlx5_external_rx_queue_get_validate (port_id, dpdk_idx);if (ext_rxq ==NULL )return -rte_errno; -if (!__atomic_compare_exchange_n (&ext_rxq->refcnt, &unmapped,1 , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { +if (!rte_atomic_compare_exchange_strong_explicit (&ext_rxq->refcnt, &unmapped,1 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) {if (ext_rxq->hw_id != hw_idx) {DRV_LOG (ERR ,"Port %u external RxQ index %u " "is already mapped to HW index (requesting is "
@@ -3296,8 +3296,8 @@ struct mlx5_hrxq * rte_errno =EINVAL ;return -rte_errno; } -if (!__atomic_compare_exchange_n (&ext_rxq->refcnt, &mapped,0 , false, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { +if (!rte_atomic_compare_exchange_strong_explicit (&ext_rxq->refcnt, &mapped,0 , + rte_memory_order_relaxed, rte_memory_order_relaxed)) {DRV_LOG (ERR ,"Port %u external RxQ index %u doesn't exist." , port_id, dpdk_idx); rte_errno =EINVAL ;
drivers/net/mlx5/mlx5_trigger.c +1 -1
@@ -1441,7 +1441,7 @@rte_delay_us_sleep (1000 * priv->rxqs_n);DRV_LOG (DEBUG ,"port %u stopping device" , dev->data->port_id);if (priv->sh->config.dv_flow_en ==2 ) { -if (!__atomic_load_n (&priv->hws_mark_refcnt, __ATOMIC_RELAXED)) +if (!rte_atomic_load_explicit (&priv->hws_mark_refcnt, rte_memory_order_relaxed))flow_hw_rxq_flag_set (dev, false); }else {mlx5_flow_stop_default (dev);
drivers/net/mlx5/mlx5_tx.h +9 -9
@@ -179,7 +179,7 @@ struct mlx5_txq_data { __extension__ struct mlx5_txq_ctrl { LIST_ENTRY(mlx5_txq_ctrl) next; /* Pointer to the next element. */ - uint32_t refcnt; /* Reference counter. */ + RTE_ATOMIC(uint32_t) refcnt; /* Reference counter. */ unsigned int socket; /* CPU socket ID for allocations. */ bool is_hairpin; /* Whether TxQ type is Hairpin. */ unsigned int max_inline_data; /* Max inline data. */
@@ -339,8 +339,8 @@ int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,* the service thread, data should be re-read. */ rte_compiler_barrier (); - ci =__atomic_load_n (&sh->txpp.ts.ci_ts, __ATOMIC_RELAXED); - ts =__atomic_load_n (&sh->txpp.ts.ts, __ATOMIC_RELAXED); + ci =rte_atomic_load_explicit (&sh->txpp.ts.ci_ts, rte_memory_order_relaxed); + ts =rte_atomic_load_explicit (&sh->txpp.ts.ts, rte_memory_order_relaxed);rte_compiler_barrier ();if (!((ts ^ ci) << (64 -MLX5_CQ_INDEX_WIDTH )))break ;
@@ -350,8 +350,8 @@ int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, mts -= ts;if (unlikely (mts >=UINT64_MAX /2 )) {/* We have negative integer, mts is in the past. */ -__atomic_fetch_add (&sh->txpp.err_ts_past, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&sh->txpp.err_ts_past, +1 , rte_memory_order_relaxed);return -1 ; } tick = sh->txpp.tick;
@@ -360,8 +360,8 @@ int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, mts = (mts + tick -1 ) / tick;if (unlikely (mts >= (1 <<MLX5_CQ_INDEX_WIDTH ) /2 -1 )) {/* We have mts is too distant future. */ -__atomic_fetch_add (&sh->txpp.err_ts_future, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&sh->txpp.err_ts_future, +1 , rte_memory_order_relaxed);return -1 ; } mts <<=64 -MLX5_CQ_INDEX_WIDTH ;
@@ -1743,8 +1743,8 @@ int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,/* Convert the timestamp into completion to wait. */ ts = *RTE_MBUF_DYNFIELD(loc->mbuf, txq->ts_offset, uint64_t *);if (txq->ts_last && ts < txq->ts_last) -__atomic_fetch_add (&txq->sh->txpp.err_ts_order, -1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&txq->sh->txpp.err_ts_order, +1 , rte_memory_order_relaxed); txq->ts_last = ts; wqe = txq->wqes + (txq->wqe_ci & txq->wqe_m); sh = txq->sh;
drivers/net/mlx5/mlx5_txpp.c +42 -42
155 lines not on this page · raw message
drivers/net/mlx5/mlx5_txq.c +6 -6
@@ -1108,7 +1108,7 @@ struct mlx5_txq_ctrl * rte_errno =ENOMEM ; goto error; } -__atomic_fetch_add (&tmpl->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&tmpl->refcnt,1 , rte_memory_order_relaxed); tmpl->is_hairpin = false;LIST_INSERT_HEAD (&priv->txqsctrl, tmpl, next);return tmpl;
@@ -1153,7 +1153,7 @@ struct mlx5_txq_ctrl * tmpl->txq.idx = idx; tmpl->hairpin_conf = *hairpin_conf; tmpl->is_hairpin = true; -__atomic_fetch_add (&tmpl->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&tmpl->refcnt,1 , rte_memory_order_relaxed);LIST_INSERT_HEAD (&priv->txqsctrl, tmpl, next);return tmpl; }
@@ -1178,7 +1178,7 @@ struct mlx5_txq_ctrl *if (txq_data) { ctrl = container_of(txq_data, struct mlx5_txq_ctrl, txq); -__atomic_fetch_add (&ctrl->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&ctrl->refcnt,1 , rte_memory_order_relaxed); }return ctrl; }
@@ -1203,7 +1203,7 @@ struct mlx5_txq_ctrl *if (priv->txqs ==NULL || (*priv->txqs)[idx] ==NULL )return 0 ; txq_ctrl = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq); -if (__atomic_fetch_sub (&txq_ctrl->refcnt,1 , __ATOMIC_RELAXED) -1 >1 ) +if (rte_atomic_fetch_sub_explicit (&txq_ctrl->refcnt,1 , rte_memory_order_relaxed) -1 >1 )return 1 ;if (txq_ctrl->obj) { priv->obj_ops.txq_obj_release (txq_ctrl->obj);
@@ -1219,7 +1219,7 @@ struct mlx5_txq_ctrl *txq_free_elts (txq_ctrl); dev->data->tx_queue_state[idx] =RTE_ETH_QUEUE_STATE_STOPPED ; } -if (!__atomic_load_n (&txq_ctrl->refcnt, __ATOMIC_RELAXED)) { +if (!rte_atomic_load_explicit (&txq_ctrl->refcnt, rte_memory_order_relaxed)) {if (!txq_ctrl->is_hairpin)mlx5_mr_btree_free (&txq_ctrl->txq.mr_ctrl.cache_bh);LIST_REMOVE (txq_ctrl, next);
@@ -1249,7 +1249,7 @@ struct mlx5_txq_ctrl *if (!(*priv->txqs)[idx])return -1 ; txq = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq); -return (__atomic_load_n (&txq->refcnt, __ATOMIC_RELAXED) ==1 ); +return (rte_atomic_load_explicit (&txq->refcnt, rte_memory_order_relaxed) ==1 ); }/**
drivers/net/mlx5/mlx5_utils.c +5 -5
@@ -203,7 +203,7 @@ struct mlx5_indexed_pool *struct mlx5_indexed_cache *gc, *lc, *olc =NULL ; lc = pool->cache[cidx]->lc; - gc =__atomic_load_n (&pool->gc, __ATOMIC_RELAXED); + gc =rte_atomic_load_explicit (&pool->gc, rte_memory_order_relaxed);if (gc && lc != gc) {mlx5_ipool_lock (pool);if (lc && !(--lc->ref_cnt))
@@ -266,8 +266,8 @@ struct mlx5_indexed_pool * pool->cache[cidx]->len = fetch_size -1 ;return pool->cache[cidx]->idx[pool->cache[cidx]->len]; } - trunk_idx = lc ?__atomic_load_n (&lc->n_trunk_valid, - __ATOMIC_ACQUIRE) :0 ; + trunk_idx = lc ?rte_atomic_load_explicit (&lc->n_trunk_valid, + rte_memory_order_acquire) :0 ; trunk_n = lc ? lc->n_trunk :0 ; cur_max_idx =mlx5_trunk_idx_offset_get (pool, trunk_idx);/* Check if index reach maximum. */
@@ -332,11 +332,11 @@ struct mlx5_indexed_pool * lc = p; lc->ref_cnt =1 ; pool->cache[cidx]->lc = lc; -__atomic_store_n (&pool->gc, p, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&pool->gc, p, rte_memory_order_relaxed); }/* Add trunk to trunks array. */ lc->trunks[trunk_idx] = trunk; -__atomic_fetch_add (&lc->n_trunk_valid,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&lc->n_trunk_valid,1 , rte_memory_order_relaxed);/* Enqueue half of the index to global. */ ts_idx =mlx5_trunk_idx_offset_get (pool, trunk_idx) +1 ; fetch_size = trunk->free >>1 ;
drivers/net/mlx5/mlx5_utils.h +2 -2
@@ -240,7 +240,7 @@ struct mlx5_indexed_trunk {struct mlx5_indexed_cache {struct mlx5_indexed_trunk **trunks; -volatile uint32_t n_trunk_valid;/* Trunks allocated. */ +volatile RTE_ATOMIC (uint32_t ) n_trunk_valid;/* Trunks allocated. */ uint32_t n_trunk;/* Trunk pointer array size. */ uint32_t ref_cnt;uint32_t len;
@@ -266,7 +266,7 @@ struct mlx5_indexed_pool {uint32_t free_list;/* Index to first free trunk. */ };struct { -struct mlx5_indexed_cache *gc; +RTE_ATOMIC (struct mlx5_indexed_cache *) gc;/* Global cache. */ struct mlx5_ipool_per_lcore *cache[RTE_MAX_LCORE +1 ];/* Local cache. */
Signature · 1 line
1.8.3.1
PATCH v2 2/45 net/ixgbe: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 14 ++++++++------ drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +8 -6
@@ -1130,7 +1130,7 @@ struct rte_ixgbe_xstats_name_off { }/* NOTE: review for potential ordering optimization */ -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);ixgbe_parse_devargs (eth_dev->data->dev_private, pci_dev->device.devargs);rte_eth_copy_pci_info (eth_dev, pci_dev);
@@ -1638,7 +1638,7 @@ static int ixgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) }/* NOTE: review for potential ordering optimization */ -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);ixgbevf_parse_devargs (eth_dev->data->dev_private, pci_dev->device.devargs);
@@ -4203,7 +4203,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,uint32_t timeout = timeout_ms ? timeout_ms :WARNING_TIMEOUT ;/* NOTE: review for potential ordering optimization */ -while (__atomic_load_n (&ad->link_thread_running, __ATOMIC_SEQ_CST)) { +while (rte_atomic_load_explicit (&ad->link_thread_running, rte_memory_order_seq_cst)) {msec_delay (1 ); timeout--;
@@ -4240,7 +4240,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG ;/* NOTE: review for potential ordering optimization */ -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , rte_memory_order_seq_cst);return 0 ; }
@@ -4336,7 +4336,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,if (ixgbe_get_media_type (hw) == ixgbe_media_type_fiber) {ixgbe_dev_wait_setup_link_complete (dev,0 );/* NOTE: review for potential ordering optimization */ -if (!__atomic_test_and_set (&ad->link_thread_running, __ATOMIC_SEQ_CST)) { +if (!rte_atomic_exchange_explicit (&ad->link_thread_running,1 , + rte_memory_order_seq_cst)) {/* To avoid race condition between threads, set * the IXGBE_FLAG_NEED_LINK_CONFIG flag only * when there is no link thread running.
@@ -4348,7 +4349,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,PMD_DRV_LOG (ERR ,"Create link thread failed!" );/* NOTE: review for potential ordering optimization */ -__atomic_clear (&ad->link_thread_running, __ATOMIC_SEQ_CST); +rte_atomic_store_explicit (&ad->link_thread_running,0 , + rte_memory_order_seq_cst); } }else { PMD_DRV_LOG(ERR,
drivers/net/ixgbe/ixgbe_ethdev.h +1 -1
@@ -511,7 +511,7 @@ struct ixgbe_adapter {*/ uint8_t pflink_fullchk;uint8_t mac_ctrl_frame_fwd; -bool link_thread_running; +RTE_ATOMIC (bool ) link_thread_running;rte_thread_t link_thread_tid; };
drivers/net/ixgbe/ixgbe_rxtx.c +2 -2
@@ -1831,7 +1831,7 @@* Use acquire fence to ensure that status_error which includes * DD bit is loaded before loading of other descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); rxd = *rxdp;
@@ -2114,7 +2114,7 @@* Use acquire fence to ensure that status_error which includes * DD bit is loaded before loading of other descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); rxd = *rxdp;
Signature · 1 line
1.8.3.1
PATCH v2 3/45 net/iavf: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/iavf/iavf.h | 16 ++++++++-------- drivers/net/iavf/iavf_rxtx.c | 4 ++-- drivers/net/iavf/iavf_rxtx_vec_neon.c | 2 +- drivers/net/iavf/iavf_vchnl.c | 14 +++++++------- 4 files changed, 18 insertions(+), 18 deletions(-)
drivers/net/iavf/iavf.h +8 -8
@@ -238,8 +238,8 @@ struct iavf_info {struct virtchnl_vlan_caps vlan_v2_caps;uint64_t supported_rxdid;uint8_t *proto_xtr;/* proto xtr type for all queues */ -volatile enum virtchnl_ops pend_cmd;/* pending command not finished */ -uint32_t pend_cmd_count; +volatile RTE_ATOMIC (enum virtchnl_ops ) pend_cmd;/* pending command not finished */ +RTE_ATOMIC (uint32_t ) pend_cmd_count;int cmd_retval;/* return value of the cmd response from PF */ uint8_t *aq_resp;/* buffer to store the adminq response from PF */
@@ -456,13 +456,13 @@ struct iavf_cmd_info { _atomic_set_cmd(struct iavf_info *vf, enum virtchnl_ops ops) {enum virtchnl_ops op_unk =VIRTCHNL_OP_UNKNOWN ; -int ret =__atomic_compare_exchange (&vf->pend_cmd, &op_unk, &ops, -0 , __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); +int ret =rte_atomic_compare_exchange_strong_explicit (&vf->pend_cmd, &op_unk, ops, + rte_memory_order_acquire, rte_memory_order_acquire);if (!ret)PMD_DRV_LOG (ERR ,"There is incomplete cmd %d" , vf->pend_cmd); -__atomic_store_n (&vf->pend_cmd_count,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&vf->pend_cmd_count,1 , rte_memory_order_relaxed);return !ret; }
@@ -472,13 +472,13 @@ struct iavf_cmd_info { _atomic_set_async_response_cmd(struct iavf_info *vf, enum virtchnl_ops ops) {enum virtchnl_ops op_unk =VIRTCHNL_OP_UNKNOWN ; -int ret =__atomic_compare_exchange (&vf->pend_cmd, &op_unk, &ops, -0 , __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); +int ret =rte_atomic_compare_exchange_strong_explicit (&vf->pend_cmd, &op_unk, ops, + rte_memory_order_acquire, rte_memory_order_acquire);if (!ret)PMD_DRV_LOG (ERR ,"There is incomplete cmd %d" , vf->pend_cmd); -__atomic_store_n (&vf->pend_cmd_count,2 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&vf->pend_cmd_count,2 , rte_memory_order_relaxed);return !ret; }
drivers/net/iavf/iavf_rxtx.c +2 -2
@@ -2025,7 +2025,7 @@ struct iavf_txq_ops iavf_txq_release_mbufs_ops[] = { s[j] =rte_le_to_cpu_16 (rxdp[j].wb.status_error0);/* This barrier is to order loads of different words in the descriptor */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* Compute how many contiguous DD bits were set */ for (j =0 , nb_dd =0 ; j <IAVF_LOOK_AHEAD ; j++) {
@@ -2152,7 +2152,7 @@ struct iavf_txq_ops iavf_txq_release_mbufs_ops[] = { }/* This barrier is to order loads of different words in the descriptor */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* Compute how many contiguous DD bits were set */ for (j =0 , nb_dd =0 ; j <IAVF_LOOK_AHEAD ; j++) {
drivers/net/iavf/iavf_rxtx_vec_neon.c +1 -1
@@ -273,7 +273,7 @@ descs[0 ] =vld1q_u64 ((uint64_t *)(rxdp));/* Use acquire fence to order loads of descriptor qwords */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* A.2 reload qword0 to make it ordered after qword1 load */ descs[3 ] =vld1q_lane_u64 ((uint64_t *)(rxdp +3 ), descs[3 ],0 ); descs[2 ] =vld1q_lane_u64 ((uint64_t *)(rxdp +2 ), descs[2 ],0 );
drivers/net/iavf/iavf_vchnl.c +7 -7
@@ -41,7 +41,7 @@ struct iavf_event_element { };struct iavf_event_handler { -uint32_t ndev; +RTE_ATOMIC (uint32_t ) ndev;rte_thread_t tid;int fd[2 ];pthread_mutex_t lock;
@@ -129,7 +129,7 @@ struct iavf_event_handler { {struct iavf_event_handler *handler = &event_handler; -if (__atomic_fetch_add (&handler->ndev,1 , __ATOMIC_RELAXED) +1 !=1 ) +if (rte_atomic_fetch_add_explicit (&handler->ndev,1 , rte_memory_order_relaxed) +1 !=1 )return 0 ;#if defined(RTE_EXEC_ENV_IS_WINDOWS ) &&RTE_EXEC_ENV_IS_WINDOWS !=0 int err =_pipe (handler->fd,MAX_EVENT_PENDING ,O_BINARY );
@@ -137,7 +137,7 @@ struct iavf_event_handler {int err =pipe (handler->fd);#endif if (err !=0 ) { -__atomic_fetch_sub (&handler->ndev,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&handler->ndev,1 , rte_memory_order_relaxed);return -1 ; }
@@ -146,7 +146,7 @@ struct iavf_event_handler {if (rte_thread_create_internal_control (&handler->tid,"iavf-event" , iavf_dev_event_handle,NULL )) { -__atomic_fetch_sub (&handler->ndev,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&handler->ndev,1 , rte_memory_order_relaxed);return -1 ; }
@@ -158,7 +158,7 @@ struct iavf_event_handler { {struct iavf_event_handler *handler = &event_handler; -if (__atomic_fetch_sub (&handler->ndev,1 , __ATOMIC_RELAXED) -1 !=0 ) +if (rte_atomic_fetch_sub_explicit (&handler->ndev,1 , rte_memory_order_relaxed) -1 !=0 )return ;int unused =pthread_cancel ((pthread_t )handler->tid.opaque_id);
@@ -574,8 +574,8 @@ struct iavf_event_handler {/* read message and it's expected one */ if (msg_opc == vf->pend_cmd) {uint32_t cmd_count = -__atomic_fetch_sub (&vf->pend_cmd_count, -1 , __ATOMIC_RELAXED) -1 ; +rte_atomic_fetch_sub_explicit (&vf->pend_cmd_count, +1 , rte_memory_order_relaxed) -1 ;if (cmd_count ==0 )_notify_cmd (vf, msg_ret); }else {
Signature · 1 line
1.8.3.1
PATCH v2 4/45 net/ice: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/ice/base/ice_osdep.h | 4 ++-- drivers/net/ice/ice_dcf.c | 6 +++--- drivers/net/ice/ice_dcf.h | 2 +- drivers/net/ice/ice_dcf_ethdev.c | 8 ++++---- drivers/net/ice/ice_dcf_parent.c | 16 ++++++++-------- drivers/net/ice/ice_ethdev.c | 12 ++++++------ drivers/net/ice/ice_ethdev.h | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-)
drivers/net/ice/base/ice_osdep.h +2 -2
@@ -235,7 +235,7 @@ struct ice_lock { ice_alloc_dma_mem(__rte_unused struct ice_hw *hw, struct ice_dma_mem *mem, u64 size) { - static uint64_t ice_dma_memzone_id; + static RTE_ATOMIC(uint64_t) ice_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];
@@ -243,7 +243,7 @@ struct ice_lock {return NULL ;snprintf (z_name,sizeof (z_name),"ice_dma_%" PRIu64, -__atomic_fetch_add (&ice_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&ice_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_bounded (z_name, size,SOCKET_ID_ANY ,0 ,0 ,RTE_PGSIZE_2M );if (!mz)
drivers/net/ice/ice_dcf.c +3 -3
@@ -764,7 +764,7 @@ struct virtchnl_proto_hdrs ice_dcf_inner_ipv6_sctp_tmplt = {rte_spinlock_init (&hw->vc_cmd_queue_lock);TAILQ_INIT (&hw->vc_cmd_queue); -__atomic_store_n (&hw->vsi_update_thread_num,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->vsi_update_thread_num,0 , rte_memory_order_relaxed); hw->arq_buf =rte_zmalloc ("arq_buf" ,ICE_DCF_AQ_BUF_SZ ,0 );if (hw->arq_buf ==NULL ) {
@@ -888,8 +888,8 @@ struct virtchnl_proto_hdrs ice_dcf_inner_ipv6_sctp_tmplt = { ice_dcf_dev_interrupt_handler, hw);/* Wait for all `ice-thread` threads to exit. */ -while (__atomic_load_n (&hw->vsi_update_thread_num, - __ATOMIC_ACQUIRE) !=0 ) +while (rte_atomic_load_explicit (&hw->vsi_update_thread_num, + rte_memory_order_acquire) !=0 )rte_delay_ms (ICE_DCF_CHECK_INTERVAL );ice_dcf_mode_disable (hw);
drivers/net/ice/ice_dcf.h +1 -1
@@ -105,7 +105,7 @@ struct ice_dcf_hw {void (*vc_event_msg_cb)(struct ice_dcf_hw *dcf_hw,uint8_t *msg,uint16_t msglen); -int vsi_update_thread_num; +RTE_ATOMIC (int ) vsi_update_thread_num;uint8_t *arq_buf;
drivers/net/ice/ice_dcf_ethdev.c +4 -4
@@ -1743,7 +1743,7 @@ static int ice_dcf_xstats_get(struct rte_eth_dev *dev, ice_dcf_adminq_need_retry(struct ice_adapter *ad) {return ad->hw.dcf_enabled && - !__atomic_load_n (&ad->dcf_state_on, __ATOMIC_RELAXED); + !rte_atomic_load_explicit (&ad->dcf_state_on, rte_memory_order_relaxed); }/* Add UDP tunneling port */
@@ -1944,12 +1944,12 @@ static int ice_dcf_xstats_get(struct rte_eth_dev *dev, adapter->real_hw.vc_event_msg_cb = ice_dcf_handle_pf_event_msg;if (ice_dcf_init_hw (eth_dev, &adapter->real_hw) !=0 ) {PMD_INIT_LOG (ERR ,"Failed to init DCF hardware" ); -__atomic_store_n (&parent_adapter->dcf_state_on, false, - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&parent_adapter->dcf_state_on, false, + rte_memory_order_relaxed);return -1 ; } -__atomic_store_n (&parent_adapter->dcf_state_on, true, __ATOMIC_RELAXED); +rte_atomic_store_explicit (&parent_adapter->dcf_state_on, true, rte_memory_order_relaxed);if (ice_dcf_init_parent_adapter (eth_dev) !=0 ) {PMD_INIT_LOG (ERR ,"Failed to init DCF parent adapter" );
drivers/net/ice/ice_dcf_parent.c +8 -8
@@ -123,8 +123,8 @@ struct ice_dcf_reset_event_param { container_of(hw, struct ice_dcf_adapter, real_hw);struct ice_adapter *parent_adapter = &adapter->parent; -__atomic_fetch_add (&hw->vsi_update_thread_num,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&hw->vsi_update_thread_num,1 , + rte_memory_order_relaxed);rte_thread_detach (rte_thread_self ());
@@ -133,8 +133,8 @@ struct ice_dcf_reset_event_param {rte_spinlock_lock (&vsi_update_lock);if (!ice_dcf_handle_vsi_update_event (hw)) { -__atomic_store_n (&parent_adapter->dcf_state_on, true, - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&parent_adapter->dcf_state_on, true, + rte_memory_order_relaxed);ice_dcf_update_vf_vsi_map (&adapter->parent.hw, hw->num_vfs, hw->vf_vsi_map); }
@@ -156,8 +156,8 @@ struct ice_dcf_reset_event_param {free (param); -__atomic_fetch_sub (&hw->vsi_update_thread_num,1 , - __ATOMIC_RELEASE); +rte_atomic_fetch_sub_explicit (&hw->vsi_update_thread_num,1 , + rte_memory_order_release);return 0 ; }
@@ -269,8 +269,8 @@ struct ice_dcf_reset_event_param {PMD_DRV_LOG (DEBUG ,"VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE event : VF%u with VSI num %u" , pf_msg->event_data.vf_vsi_map.vf_id, pf_msg->event_data.vf_vsi_map.vsi_id); -__atomic_store_n (&parent_adapter->dcf_state_on, false, - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&parent_adapter->dcf_state_on, false, + rte_memory_order_relaxed);start_vsi_reset_thread (dcf_hw, true, pf_msg->event_data.vf_vsi_map.vf_id);break ;
drivers/net/ice/ice_ethdev.c +6 -6
@@ -4062,9 +4062,9 @@ static int ice_init_rss(struct ice_pf *pf)struct rte_eth_link *src = &dev->data->dev_link;/* NOTE: review for potential ordering optimization */ -if (!__atomic_compare_exchange_n ((uint64_t *)dst, (uint64_t *)dst, - *(uint64_t *)src,0 , - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) + if (!rte_atomic_compare_exchange_strong_explicit((uint64_t __rte_atomic *)dst, + (uint64_t *)dst, *(uint64_t *)src, + rte_memory_order_seq_cst, rte_memory_order_seq_cst))return -1 ;return 0 ;
@@ -4078,9 +4078,9 @@ static int ice_init_rss(struct ice_pf *pf)struct rte_eth_link *src = link;/* NOTE: review for potential ordering optimization */ -if (!__atomic_compare_exchange_n ((uint64_t *)dst, (uint64_t *)dst, - *(uint64_t *)src,0 , - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) + if (!rte_atomic_compare_exchange_strong_explicit((uint64_t __rte_atomic *)dst, + (uint64_t *)dst, *(uint64_t *)src, + rte_memory_order_seq_cst, rte_memory_order_seq_cst))return -1 ;return 0 ;
drivers/net/ice/ice_ethdev.h +1 -1
@@ -621,7 +621,7 @@ struct ice_adapter {struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS ];struct ice_rss_prof_info rss_prof_info[ICE_MAX_PTGS ];/* True if DCF state of the associated PF is on */ -bool dcf_state_on; +RTE_ATOMIC (bool ) dcf_state_on;/* Set bit if the engine is disabled */ unsigned long disabled_engine_mask;struct ice_parser *psr;
Signature · 1 line
1.8.3.1
PATCH v2 5/45 net/i40e: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/i40e/i40e_ethdev.c | 4 ++-- drivers/net/i40e/i40e_rxtx.c | 6 +++--- drivers/net/i40e/i40e_rxtx_vec_neon.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -4687,7 +4687,7 @@ enum i40e_status_code u64 size, u32 alignment) { -static uint64_t i40e_dma_memzone_id; +static RTE_ATOMIC (uint64_t ) i40e_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];
@@ -4695,7 +4695,7 @@ enum i40e_status_codereturn I40E_ERR_PARAM ;snprintf (z_name,sizeof (z_name),"i40e_dma_%" PRIu64, -__atomic_fetch_add (&i40e_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&i40e_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_bounded (z_name, size,SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG , alignment,RTE_PGSIZE_2M );if (!mz)
drivers/net/i40e/i40e_rxtx.c +3 -3
@@ -486,7 +486,7 @@ }/* This barrier is to order loads of different words in the descriptor */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* Compute how many status bits were set */ for (j =0 , nb_dd =0 ; j <I40E_LOOK_AHEAD ; j++) {
@@ -745,7 +745,7 @@* Use acquire fence to ensure that qword1 which includes DD * bit is loaded before loading of other descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); rxd = *rxdp; nb_hold++;
@@ -867,7 +867,7 @@* Use acquire fence to ensure that qword1 which includes DD * bit is loaded before loading of other descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire); rxd = *rxdp; nb_hold++;
drivers/net/i40e/i40e_rxtx_vec_neon.c +1 -1
@@ -425,7 +425,7 @@ descs[0 ] =vld1q_u64 ((uint64_t *)(rxdp));/* Use acquire fence to order loads of descriptor qwords */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* A.2 reload qword0 to make it ordered after qword1 load */ descs[3 ] =vld1q_lane_u64 ((uint64_t *)(rxdp +3 ), descs[3 ],0 ); descs[2 ] =vld1q_lane_u64 ((uint64_t *)(rxdp +2 ), descs[2 ],0 );
Signature · 1 line
1.8.3.1
PATCH v2 6/45 net/hns3: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/hns3/hns3_cmd.c | 18 ++++++------ drivers/net/hns3/hns3_dcb.c | 2 +- drivers/net/hns3/hns3_ethdev.c | 36 +++++++++++------------ drivers/net/hns3/hns3_ethdev.h | 32 ++++++++++----------- drivers/net/hns3/hns3_ethdev_vf.c | 60 +++++++++++++++++++-------------------- drivers/net/hns3/hns3_intr.c | 36 +++++++++++------------ drivers/net/hns3/hns3_intr.h | 4 +-- drivers/net/hns3/hns3_mbx.c | 6 ++-- drivers/net/hns3/hns3_mp.c | 6 ++-- drivers/net/hns3/hns3_rxtx.c | 10 +++---- drivers/net/hns3/hns3_tm.c | 4 +-- 11 files changed, 107 insertions(+), 107 deletions(-)
drivers/net/hns3/hns3_cmd.c +9 -9
@@ -44,12 +44,12 @@ hns3_allocate_dma_mem(struct hns3_hw *hw, struct hns3_cmq_ring *ring, uint64_t size, uint32_t alignment) { - static uint64_t hns3_dma_memzone_id; + static RTE_ATOMIC(uint64_t) hns3_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];snprintf (z_name,sizeof (z_name),"hns3_dma_%" PRIu64, -__atomic_fetch_add (&hns3_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&hns3_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_bounded (z_name, size,SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG , alignment,RTE_PGSIZE_2M );
@@ -198,8 +198,8 @@hns3_err (hw,"wrong cmd addr(%0x) head (%u, %u-%u)" , addr, head, csq->next_to_use, csq->next_to_clean);if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -__atomic_store_n (&hw->reset.disable_cmd,1 , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , + rte_memory_order_relaxed);hns3_schedule_delayed_reset (HNS3_DEV_HW_TO_ADAPTER (hw)); }
@@ -313,7 +313,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)if (hns3_cmd_csq_done (hw))return 0 ; -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) {hns3_err (hw,"Don't wait for reply because of disable_cmd" );return -EBUSY ;
@@ -360,7 +360,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)int retval;uint32_t ntc; -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed))return -EBUSY ;rte_spinlock_lock (&hw->cmq.csq.lock);
@@ -747,7 +747,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw) ret = -EBUSY ; goto err_cmd_init; } -__atomic_store_n (&hw->reset.disable_cmd,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,0 , rte_memory_order_relaxed); ret =hns3_cmd_query_firmware_version_and_capability (hw);if (ret) {
@@ -790,7 +790,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)return 0 ; err_cmd_init: -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);return ret; }
@@ -819,7 +819,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw)if (!hns->is_vf) (void )hns3_firmware_compat_config (hw, false); -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);/* * A delay is added to ensure that the register cleanup operations
drivers/net/hns3/hns3_dcb.c +1 -1
@@ -648,7 +648,7 @@* and configured directly to the hardware in the RESET_STAGE_RESTORE * stage of the reset process. */ -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 ) {for (i =0 ; i < hw->rss_ind_tbl_size; i++) rss_cfg->rss_indirection_tbl[i] = i % hw->alloc_rss_size;
drivers/net/hns3/hns3_ethdev.c +18 -18
@@ -99,7 +99,7 @@ struct hns3_intr_state { };static enum hns3_reset_level hns3_get_reset_level (struct hns3_adapter *hns, -uint64_t *levels); +RTE_ATOMIC (uint64_t ) *levels);static int hns3_dev_mtu_set (struct rte_eth_dev *dev,uint16_t mtu);static int hns3_vlan_pvid_configure (struct hns3_adapter *hns,uint16_t pvid,int on);
@@ -134,7 +134,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, {struct hns3_hw *hw = &hns->hw; -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);hns3_atomic_set_bit (HNS3_IMP_RESET , &hw->reset.pending); *vec_val =BIT (HNS3_VECTOR0_IMPRESET_INT_B ); hw->reset.stats.imp_cnt++;
@@ -148,7 +148,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, {struct hns3_hw *hw = &hns->hw; -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);hns3_atomic_set_bit (HNS3_GLOBAL_RESET , &hw->reset.pending); *vec_val =BIT (HNS3_VECTOR0_GLOBALRESET_INT_B ); hw->reset.stats.global_cnt++;
@@ -1151,7 +1151,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* ensure that the hardware configuration remains unchanged before and * after reset. */ -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 ) { hw->port_base_vlan_cfg.state =HNS3_PORT_BASE_VLAN_DISABLE ; hw->port_base_vlan_cfg.pvid =HNS3_INVALID_PVID ; }
@@ -1175,7 +1175,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* we will restore configurations to hardware in hns3_restore_vlan_table * and hns3_restore_vlan_conf later. */ -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 ) { ret =hns3_vlan_pvid_configure (hns,HNS3_INVALID_PVID ,0 );if (ret) {hns3_err (hw,"pvid set fail in pf, ret =%d" , ret);
@@ -5059,7 +5059,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,int ret;PMD_INIT_FUNC_TRACE (); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed))return -EBUSY ;rte_spinlock_lock (&hw->lock);
@@ -5150,7 +5150,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* during reset and is required to be released after the reset is * completed. */ -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 )hns3_dev_release_mbufs (hns); ret =hns3_cfg_mac_mode (hw, false);
@@ -5158,7 +5158,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,return ret; hw->mac.link_status =RTE_ETH_LINK_DOWN ; -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed) ==0 ) {hns3_configure_all_mac_addr (hns, true); ret =hns3_reset_all_tqps (hns);if (ret) {
@@ -5184,7 +5184,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,hns3_stop_rxtx_datapath (dev);rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed) ==0 ) {hns3_tm_dev_stop_proc (hw);hns3_config_mac_tnl_int (hw, false);hns3_stop_tqps (hw);
@@ -5577,7 +5577,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, last_req =hns3_get_reset_level (hns, &hw->reset.pending);if (last_req ==HNS3_NONE_RESET || last_req < new_req) { -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed);hns3_schedule_delayed_reset (hns);hns3_warn (hw,"High level reset detected, delay do reset" );return true;
@@ -5677,7 +5677,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, }static enum hns3_reset_level -hns3_get_reset_level (struct hns3_adapter *hns,uint64_t *levels) +hns3_get_reset_level (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels) {struct hns3_hw *hw = &hns->hw;enum hns3_reset_level reset_level =HNS3_NONE_RESET ;
@@ -5737,7 +5737,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* any mailbox handling or command to firmware is only valid * after hns3_cmd_init is called. */ -__atomic_store_n (&hw->reset.disable_cmd,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,1 , rte_memory_order_relaxed); hw->reset.stats.request_cnt++;break ;case HNS3_IMP_RESET :
@@ -5792,7 +5792,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* from table space. Hence, for function reset software intervention is * required to delete the entries */ -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED) ==0 ) +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed) ==0 )hns3_configure_all_mc_mac_addr (hns, true);rte_spinlock_unlock (&hw->lock);
@@ -5913,10 +5913,10 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,* The interrupt may have been lost. It is necessary to handle * the interrupt to recover from the error. */ -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) ==SCHEDULE_DEFERRED ) { -__atomic_store_n (&hw->reset.schedule,SCHEDULE_REQUESTED , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_REQUESTED , + rte_memory_order_relaxed);hns3_err (hw,"Handling interrupts in delayed tasks" );hns3_interrupt_handler (&rte_eth_devices[hw->data->port_id]); reset_level =hns3_get_reset_level (hns, &hw->reset.pending);
@@ -5925,7 +5925,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,hns3_atomic_set_bit (HNS3_IMP_RESET , &hw->reset.pending); } } -__atomic_store_n (&hw->reset.schedule,SCHEDULE_NONE , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_NONE , rte_memory_order_relaxed);/* * Check if there is any ongoing reset in the hardware. This status can
@@ -6576,7 +6576,7 @@ static int hns3_remove_mc_mac_addr(struct hns3_hw *hw, hw->adapter_state =HNS3_NIC_INITIALIZED ; -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) ==SCHEDULE_PENDING ) {hns3_err (hw,"Reschedule reset service after dev_init" );hns3_schedule_reset (hns);
drivers/net/hns3/hns3_ethdev.h +16 -16
@@ -401,17 +401,17 @@ enum hns3_schedule {struct hns3_reset_data {enum hns3_reset_stage stage; -uint16_t schedule; +RTE_ATOMIC (uint16_t ) schedule;/* Reset flag, covering the entire reset process */ -uint16_t resetting; +RTE_ATOMIC (uint16_t ) resetting;/* Used to disable sending cmds during reset */ -uint16_t disable_cmd; +RTE_ATOMIC (uint16_t ) disable_cmd;/* The reset level being processed */ enum hns3_reset_level level;/* Reset level set, each bit represents a reset level */ -uint64_t pending; +RTE_ATOMIC (uint64_t ) pending;/* Request reset level set, from interrupt or mailbox */ -uint64_t request; +RTE_ATOMIC (uint64_t ) request;int attempts;/* Reset failure retry */ int retries;/* Timeout failure retry in reset_post */ /*
@@ -499,7 +499,7 @@ struct hns3_hw {* by dev_set_link_up() or dev_start(). */ bool set_link_down; -unsigned int secondary_cnt;/* Number of secondary processes init'd. */ +RTE_ATOMIC (unsigned int ) secondary_cnt;/* Number of secondary processes init'd. */ struct hns3_tqp_stats tqp_stats;/* Include Mac stats | Rx stats | Tx stats */ struct hns3_mac_stats mac_stats;
@@ -844,7 +844,7 @@ struct hns3_vf {struct hns3_adapter *adapter;/* Whether PF support push link status change to VF */ -uint16_t pf_push_lsc_cap; +RTE_ATOMIC (uint16_t ) pf_push_lsc_cap;/* * If PF support push link status change, VF still need send request to
@@ -853,7 +853,7 @@ struct hns3_vf {*/ uint16_t req_link_info_cnt; -uint16_t poll_job_started;/* whether poll job is started */ +RTE_ATOMIC (uint16_t ) poll_job_started;/* whether poll job is started */ };struct hns3_adapter {
@@ -997,32 +997,32 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg) hns3_read_reg((a)->io_base, (reg))static inline uint64_t -hns3_atomic_test_bit (unsigned int nr,volatile uint64_t *addr) +hns3_atomic_test_bit (unsigned int nr,volatile RTE_ATOMIC (uint64_t ) *addr) {uint64_t res; - res = (__atomic_load_n (addr, __ATOMIC_RELAXED) & (1UL << nr)) !=0 ; + res = (rte_atomic_load_explicit (addr, rte_memory_order_relaxed) & (1UL << nr)) !=0 ;return res; }static inline void -hns3_atomic_set_bit (unsigned int nr,volatile uint64_t *addr) +hns3_atomic_set_bit (unsigned int nr,volatile RTE_ATOMIC (uint64_t ) *addr) { -__atomic_fetch_or (addr, (1UL << nr), __ATOMIC_RELAXED); +rte_atomic_fetch_or_explicit (addr, (1UL << nr), rte_memory_order_relaxed); }static inline void -hns3_atomic_clear_bit (unsigned int nr,volatile uint64_t *addr) +hns3_atomic_clear_bit (unsigned int nr,volatile RTE_ATOMIC (uint64_t ) *addr) { -__atomic_fetch_and (addr, ~(1UL << nr), __ATOMIC_RELAXED); +rte_atomic_fetch_and_explicit (addr, ~(1UL << nr), rte_memory_order_relaxed); }static inline uint64_t -hns3_test_and_clear_bit (unsigned int nr,volatile uint64_t *addr) +hns3_test_and_clear_bit (unsigned int nr,volatile RTE_ATOMIC (uint64_t ) *addr) {uint64_t mask = (1UL << nr); -return __atomic_fetch_and (addr, ~mask, __ATOMIC_RELAXED) & mask; +return rte_atomic_fetch_and_explicit (addr, ~mask, rte_memory_order_relaxed) & mask; }int
drivers/net/hns3/hns3_ethdev_vf.c +30 -30
202 lines not on this page · raw message
drivers/net/hns3/hns3_intr.c +18 -18
@@ -2033,7 +2033,7 @@ enum hns3_hw_err_report_type {static int hns3_handle_hw_error (struct hns3_adapter *hns,struct hns3_cmd_desc *desc, -int num,uint64_t *levels, +int num,RTE_ATOMIC (uint64_t ) *levels,enum hns3_hw_err_report_type err_type) {const struct hns3_hw_error_desc *err = pf_ras_err_tbl;
@@ -2104,7 +2104,7 @@ enum hns3_hw_err_report_type { }void -hns3_handle_msix_error (struct hns3_adapter *hns,uint64_t *levels) +hns3_handle_msix_error (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels) {uint32_t mpf_bd_num, pf_bd_num, bd_num;struct hns3_hw *hw = &hns->hw;
@@ -2151,7 +2151,7 @@ enum hns3_hw_err_report_type { }void -hns3_handle_ras_error (struct hns3_adapter *hns,uint64_t *levels) +hns3_handle_ras_error (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels) {uint32_t mpf_bd_num, pf_bd_num, bd_num;struct hns3_hw *hw = &hns->hw;
@@ -2402,7 +2402,7 @@ enum hns3_hw_err_report_type { hw->reset.request =0 ; hw->reset.pending =0 ; hw->reset.resetting =0 ; -__atomic_store_n (&hw->reset.disable_cmd,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.disable_cmd,0 , rte_memory_order_relaxed); hw->reset.wait_data =rte_zmalloc ("wait_data" ,sizeof (struct hns3_wait_data ),0 );if (!hw->reset.wait_data) {
@@ -2419,8 +2419,8 @@ enum hns3_hw_err_report_type {/* Reschedule the reset process after successful initialization */ if (hw->adapter_state ==HNS3_NIC_UNINITIALIZED ) { -__atomic_store_n (&hw->reset.schedule,SCHEDULE_PENDING , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_PENDING , + rte_memory_order_relaxed);return ; }
@@ -2428,15 +2428,15 @@ enum hns3_hw_err_report_type {return ;/* Schedule restart alarm if it is not scheduled yet */ -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) ==SCHEDULE_REQUESTED )return ; -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) ==SCHEDULE_DEFERRED )rte_eal_alarm_cancel (hw->reset.ops->reset_service, hns); -__atomic_store_n (&hw->reset.schedule,SCHEDULE_REQUESTED , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_REQUESTED , + rte_memory_order_relaxed);rte_eal_alarm_set (SWITCH_CONTEXT_US , hw->reset.ops->reset_service, hns); }
@@ -2453,11 +2453,11 @@ enum hns3_hw_err_report_type {return ; } -if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) != +if (rte_atomic_load_explicit (&hw->reset.schedule, rte_memory_order_relaxed) !=SCHEDULE_NONE )return ; -__atomic_store_n (&hw->reset.schedule,SCHEDULE_DEFERRED , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hw->reset.schedule,SCHEDULE_DEFERRED , + rte_memory_order_relaxed);rte_eal_alarm_set (DEFERRED_SCHED_US , hw->reset.ops->reset_service, hns); }
@@ -2537,7 +2537,7 @@ enum hns3_hw_err_report_type { }static void -hns3_clear_reset_level (struct hns3_hw *hw,uint64_t *levels) +hns3_clear_reset_level (struct hns3_hw *hw,RTE_ATOMIC (uint64_t ) *levels) {uint64_t merge_cnt = hw->reset.stats.merge_cnt;uint64_t tmp;
@@ -2633,7 +2633,7 @@ enum hns3_hw_err_report_type {* Regardless of whether the execution is successful or not, the * flow after execution must be continued. */ -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) (void )hns3_cmd_init (hw); reset_fail: hw->reset.attempts =0 ;
@@ -2661,7 +2661,7 @@ enum hns3_hw_err_report_type {int ret;if (hw->reset.stage ==RESET_STAGE_NONE ) { -__atomic_store_n (&hns->hw.reset.resetting,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hns->hw.reset.resetting,1 , rte_memory_order_relaxed); hw->reset.stage =RESET_STAGE_DOWN ;hns3_report_reset_begin (hw); ret = hw->reset.ops->stop_service (hns);
@@ -2750,7 +2750,7 @@ enum hns3_hw_err_report_type {hns3_notify_reset_ready (hw, false);hns3_clear_reset_level (hw, &hw->reset.pending);hns3_clear_reset_status (hw); -__atomic_store_n (&hns->hw.reset.resetting,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hns->hw.reset.resetting,0 , rte_memory_order_relaxed); hw->reset.attempts =0 ; hw->reset.stats.success_cnt++; hw->reset.stage =RESET_STAGE_NONE ;
@@ -2812,7 +2812,7 @@ enum hns3_hw_err_report_type { hw->reset.mbuf_deferred_free = false; }rte_spinlock_unlock (&hw->lock); -__atomic_store_n (&hns->hw.reset.resetting,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&hns->hw.reset.resetting,0 , rte_memory_order_relaxed); hw->reset.stage =RESET_STAGE_NONE ;hns3_clock_gettime (&tv);timersub (&tv, &hw->reset.start_time, &tv_delta);
drivers/net/hns3/hns3_intr.h +2 -2
@@ -171,8 +171,8 @@ struct hns3_hw_error_desc { };int hns3_enable_hw_error_intr (struct hns3_adapter *hns,bool en); -void hns3_handle_msix_error (struct hns3_adapter *hns,uint64_t *levels); -void hns3_handle_ras_error (struct hns3_adapter *hns,uint64_t *levels); +void hns3_handle_msix_error (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels); +void hns3_handle_ras_error (struct hns3_adapter *hns,RTE_ATOMIC (uint64_t ) *levels);void hns3_config_mac_tnl_int (struct hns3_hw *hw,bool en);void hns3_handle_error (struct hns3_adapter *hns);
drivers/net/hns3/hns3_mbx.c +3 -3
@@ -65,7 +65,7 @@ mbx_time_limit = (uint32_t )hns->mbx_time_limit_ms *US_PER_MS ;while (wait_time < mbx_time_limit) { -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) {hns3_err (hw,"Don't wait for mbx response because of " "disable_cmd" );return -EBUSY ;
@@ -382,7 +382,7 @@rte_spinlock_lock (&hw->cmq.crq.lock);while (!hns3_cmd_crq_empty (hw)) { -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) {rte_spinlock_unlock (&hw->cmq.crq.lock);return ; }
@@ -457,7 +457,7 @@ }while (!hns3_cmd_crq_empty (hw)) { -if (__atomic_load_n (&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.disable_cmd, rte_memory_order_relaxed)) {rte_spinlock_unlock (&hw->cmq.crq.lock);return ; }
drivers/net/hns3/hns3_mp.c +3 -3
@@ -151,7 +151,7 @@int i;if (rte_eal_process_type () ==RTE_PROC_SECONDARY || -__atomic_load_n (&hw->secondary_cnt, __ATOMIC_RELAXED) ==0 ) +rte_atomic_load_explicit (&hw->secondary_cnt, rte_memory_order_relaxed) ==0 )return ;if (!mp_req_type_is_valid (type)) {
@@ -277,7 +277,7 @@ void hns3_mp_req_stop_rxtx(struct rte_eth_dev *dev) ret);return ret; } -__atomic_fetch_add (&hw->secondary_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&hw->secondary_cnt,1 , rte_memory_order_relaxed); }else { ret =hns3_mp_init_primary ();if (ret) {
@@ -297,7 +297,7 @@ void hns3_mp_uninit(struct rte_eth_dev *dev)struct hns3_hw *hw =HNS3_DEV_PRIVATE_TO_HW (dev->data->dev_private);if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) -__atomic_fetch_sub (&hw->secondary_cnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&hw->secondary_cnt,1 , rte_memory_order_relaxed); process_data.eth_dev_cnt--;if (process_data.eth_dev_cnt ==0 ) {
drivers/net/hns3/hns3_rxtx.c +5 -5
@@ -4464,7 +4464,7 @@struct hns3_adapter *hns = eth_dev->data->dev_private;if (hns->hw.adapter_state ==HNS3_NIC_STARTED && -__atomic_load_n (&hns->hw.reset.resetting, __ATOMIC_RELAXED) ==0 ) { +rte_atomic_load_explicit (&hns->hw.reset.resetting, rte_memory_order_relaxed) ==0 ) { eth_dev->rx_pkt_burst =hns3_get_rx_function (eth_dev); eth_dev->rx_descriptor_status = hns3_dev_rx_descriptor_status; eth_dev->tx_pkt_burst = hw->set_link_down ?
@@ -4530,7 +4530,7 @@rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) {hns3_err (hw,"fail to start Rx queue during resetting." );rte_spinlock_unlock (&hw->lock);return -EIO ;
@@ -4586,7 +4586,7 @@rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) {hns3_err (hw,"fail to stop Rx queue during resetting." );rte_spinlock_unlock (&hw->lock);return -EIO ;
@@ -4615,7 +4615,7 @@rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) {hns3_err (hw,"fail to start Tx queue during resetting." );rte_spinlock_unlock (&hw->lock);return -EIO ;
@@ -4648,7 +4648,7 @@rte_spinlock_lock (&hw->lock); -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) {hns3_err (hw,"fail to stop Tx queue during resetting." );rte_spinlock_unlock (&hw->lock);return -EIO ;
drivers/net/hns3/hns3_tm.c +2 -2
@@ -1051,7 +1051,7 @@if (error ==NULL )return -EINVAL ; -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) { error->type =RTE_TM_ERROR_TYPE_UNSPECIFIED ; error->message ="device is resetting" ;/* don't goto fail_clear, user may try later */
@@ -1141,7 +1141,7 @@if (error ==NULL )return -EINVAL ; -if (__atomic_load_n (&hw->reset.resetting, __ATOMIC_RELAXED)) { +if (rte_atomic_load_explicit (&hw->reset.resetting, rte_memory_order_relaxed)) { error->type =RTE_TM_ERROR_TYPE_UNSPECIFIED ; error->message ="device is resetting" ;return -EBUSY ;
Signature · 1 line
1.8.3.1
PATCH v2 7/45 net/bnxt: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/bnxt/bnxt_cpr.h | 4 ++-- drivers/net/bnxt/bnxt_rxq.h | 2 +- drivers/net/bnxt/bnxt_rxr.c | 13 ++++++++----- drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 2 +- drivers/net/bnxt/bnxt_stats.c | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-)
drivers/net/bnxt/bnxt_cpr.h +2 -2
@@ -107,7 +107,7 @@ struct bnxt_cp_ring_info {/** * Check validity of a completion ring entry. If the entry is valid, include a -* C11 __ATOMIC_ACQUIRE fence to ensure that subsequent loads of fields in the +* C11 rte_memory_order_acquire fence to ensure that subsequent loads of fields in the * completion are not hoisted by the compiler or by the CPU to come before the * loading of the "valid" field. *
@@ -130,7 +130,7 @@ struct bnxt_cp_ring_info { expected = !(raw_cons & ring_size); valid = !!(rte_le_to_cpu_32 (c->info3_v) &CMPL_BASE_V );if (valid == expected) { -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);return true; }return false;
drivers/net/bnxt/bnxt_rxq.h +1 -1
@@ -40,7 +40,7 @@ struct bnxt_rx_queue {struct bnxt_rx_ring_info *rx_ring;struct bnxt_cp_ring_info *cp_ring;struct rte_mbuf fake_mbuf; -uint64_t rx_mbuf_alloc_fail; +RTE_ATOMIC (uint64_t ) rx_mbuf_alloc_fail;uint8_t need_realloc;const struct rte_memzone *mz; };
drivers/net/bnxt/bnxt_rxr.c +8 -5
@@ -49,7 +49,8 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq, rx_buf = &rxr->rx_buf_ring[prod]; mbuf =__bnxt_alloc_rx_data (rxq->mb_pool);if (!mbuf) { -__atomic_fetch_add (&rxq->rx_mbuf_alloc_fail,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_mbuf_alloc_fail,1 , + rte_memory_order_relaxed);/* If buff has failed already, setting this again won't hurt */ rxq->need_realloc =1 ;return -ENOMEM ;
@@ -86,7 +87,8 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq, mbuf =__bnxt_alloc_rx_data (rxq->mb_pool);if (!mbuf) { -__atomic_fetch_add (&rxq->rx_mbuf_alloc_fail,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_mbuf_alloc_fail,1 , + rte_memory_order_relaxed);/* If buff has failed already, setting this again won't hurt */ rxq->need_realloc =1 ;return -ENOMEM ;
@@ -465,7 +467,8 @@ static inline struct rte_mbuf *bnxt_tpa_end(struct rte_mbuf *new_data =__bnxt_alloc_rx_data (rxq->mb_pool);RTE_ASSERT (new_data !=NULL );if (!new_data) { -__atomic_fetch_add (&rxq->rx_mbuf_alloc_fail,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_mbuf_alloc_fail,1 , + rte_memory_order_relaxed);return NULL ; } tpa_info->mbuf = new_data;
@@ -1677,8 +1680,8 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq) rxr->tpa_info[i].mbuf =__bnxt_alloc_rx_data (rxq->mb_pool);if (!rxr->tpa_info[i].mbuf) { -__atomic_fetch_add (&rxq->rx_mbuf_alloc_fail,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&rxq->rx_mbuf_alloc_fail,1 , + rte_memory_order_relaxed);return -ENOMEM ; } }
drivers/net/bnxt/bnxt_rxtx_vec_neon.c +1 -1
@@ -240,7 +240,7 @@ rxcmp1[0 ] =vld1q_u32 ((void *)&cpr->cp_desc_ring[cons +1 ]);/* Use acquire fence to order loads of descriptor words. */ -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);/* Reload lower 64b of descriptors to make it ordered after info3_v. */ rxcmp1[3] = vreinterpretq_u32_u64(vld1q_lane_u64 ((void *)&cpr->cp_desc_ring[cons + 7],
drivers/net/bnxt/bnxt_stats.c +2 -2
@@ -663,7 +663,7 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev,bnxt_fill_rte_eth_stats_ext (bnxt_stats, &ring_stats, i, true); bnxt_stats->rx_nombuf += -__atomic_load_n (&rxq->rx_mbuf_alloc_fail, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&rxq->rx_mbuf_alloc_fail, rte_memory_order_relaxed); } num_q_stats = RTE_MIN(bp->tx_cp_nr_rings,
@@ -724,7 +724,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,bnxt_fill_rte_eth_stats (bnxt_stats, &ring_stats, i, true); bnxt_stats->rx_nombuf += -__atomic_load_n (&rxq->rx_mbuf_alloc_fail, __ATOMIC_RELAXED); +rte_atomic_load_explicit (&rxq->rx_mbuf_alloc_fail, rte_memory_order_relaxed); } num_q_stats = RTE_MIN(bp->tx_cp_nr_rings,
Signature · 1 line
1.8.3.1
PATCH v2 8/45 net/cpfl: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/cpfl/cpfl_ethdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/cpfl/cpfl_ethdev.c +5 -3
@@ -300,8 +300,9 @@ struct rte_cpfl_xstats_name_off {for (i =0 ; i < dev->data->nb_rx_queues; i++) { cpfl_rxq = dev->data->rx_queues[i]; - mbuf_alloc_failed +=__atomic_load_n (&cpfl_rxq->base.rx_stats.mbuf_alloc_failed, - __ATOMIC_RELAXED); + mbuf_alloc_failed += +rte_atomic_load_explicit (&cpfl_rxq->base.rx_stats.mbuf_alloc_failed, + rte_memory_order_relaxed); }return mbuf_alloc_failed;
@@ -349,7 +350,8 @@ struct rte_cpfl_xstats_name_off {for (i =0 ; i < dev->data->nb_rx_queues; i++) { cpfl_rxq = dev->data->rx_queues[i]; -__atomic_store_n (&cpfl_rxq->base.rx_stats.mbuf_alloc_failed,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&cpfl_rxq->base.rx_stats.mbuf_alloc_failed,0 , + rte_memory_order_relaxed); } }
Signature · 1 line
1.8.3.1
PATCH v2 9/45 net/af_xdp: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/af_xdp/rte_eth_af_xdp.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +11 -9
@@ -116,7 +116,7 @@ struct xsk_umem_info {const struct rte_memzone *mz;struct rte_mempool *mb_pool;void *buffer; -uint8_t refcnt; +RTE_ATOMIC (uint8_t ) refcnt;uint32_t max_xsks; };
@@ -995,7 +995,8 @@ static int link_xdp_prog_with_dev(int ifindex, int fd, __u32 flags)break ;xsk_socket__delete (rxq->xsk); -if (__atomic_fetch_sub (&rxq->umem->refcnt,1 , __ATOMIC_ACQUIRE) -1 ==0 ) +if (rte_atomic_fetch_sub_explicit (&rxq->umem->refcnt,1 , + rte_memory_order_acquire) -1 ==0 )xdp_umem_destroy (rxq->umem);/* free pkt_tx_queue */
@@ -1097,8 +1098,8 @@ static inline uintptr_t get_base_addr(struct rte_mempool *mp, uint64_t *align) ret =-1 ; goto out; } -if (__atomic_load_n (&internals->rx_queues[i].umem->refcnt, - __ATOMIC_ACQUIRE)) { +if (rte_atomic_load_explicit (&internals->rx_queues[i].umem->refcnt, + rte_memory_order_acquire)) { *umem = internals->rx_queues[i].umem; goto out; }
@@ -1131,11 +1132,11 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,return NULL ;if (umem !=NULL && -__atomic_load_n (&umem->refcnt, __ATOMIC_ACQUIRE) < +rte_atomic_load_explicit (&umem->refcnt, rte_memory_order_acquire) < umem->max_xsks) {AF_XDP_LOG (INFO ,"%s,qid%i sharing UMEM\n" , internals->if_name, rxq->xsk_queue_idx); -__atomic_fetch_add (&umem->refcnt,1 , __ATOMIC_ACQUIRE); +rte_atomic_fetch_add_explicit (&umem->refcnt,1 , rte_memory_order_acquire); } }
@@ -1177,7 +1178,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, mb_pool->name, umem->max_xsks); } -__atomic_store_n (&umem->refcnt,1 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&umem->refcnt,1 , rte_memory_order_release); }return umem;
@@ -1606,7 +1607,8 @@ struct msg_internal {if (rxq->umem ==NULL )return -ENOMEM ; txq->umem = rxq->umem; - reserve_before =__atomic_load_n (&rxq->umem->refcnt, __ATOMIC_ACQUIRE) <=1 ; + reserve_before =rte_atomic_load_explicit (&rxq->umem->refcnt, + rte_memory_order_acquire) <=1 ;#if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG ) ret =rte_pktmbuf_alloc_bulk (rxq->umem->mb_pool, fq_bufs, reserve_size);
@@ -1723,7 +1725,7 @@ struct msg_internal { out_xsk:xsk_socket__delete (rxq->xsk); out_umem: -if (__atomic_fetch_sub (&rxq->umem->refcnt,1 , __ATOMIC_ACQUIRE) -1 ==0 ) +if (rte_atomic_fetch_sub_explicit (&rxq->umem->refcnt,1 , rte_memory_order_acquire) -1 ==0 )xdp_umem_destroy (rxq->umem);return ret;
Signature · 1 line
1.8.3.1
PATCH v2 10/45 net/octeon_ep: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/octeon_ep/cnxk_ep_rx.h | 5 +++-- drivers/net/octeon_ep/cnxk_ep_tx.c | 5 +++-- drivers/net/octeon_ep/cnxk_ep_vf.c | 8 ++++---- drivers/net/octeon_ep/otx2_ep_vf.c | 8 ++++---- drivers/net/octeon_ep/otx_ep_common.h | 4 ++-- drivers/net/octeon_ep/otx_ep_rxtx.c | 6 ++++-- 6 files changed, 20 insertions(+), 16 deletions(-)
drivers/net/octeon_ep/cnxk_ep_rx.h +3 -2
@@ -98,7 +98,7 @@* This adds an extra local variable, but almost halves the * number of PCIe writes. */ - val =__atomic_load_n (droq->pkts_sent_ism, __ATOMIC_RELAXED); + val =rte_atomic_load_explicit (droq->pkts_sent_ism, rte_memory_order_relaxed); new_pkts = val - droq->pkts_sent_prev; droq->pkts_sent_prev = val;
@@ -111,7 +111,8 @@rte_mb ();rte_write64 (OTX2_SDP_REQUEST_ISM , droq->pkts_sent_reg); -while (__atomic_load_n (droq->pkts_sent_ism, __ATOMIC_RELAXED) >= val) { +while (rte_atomic_load_explicit (droq->pkts_sent_ism, + rte_memory_order_relaxed) >= val) {rte_write64 (OTX2_SDP_REQUEST_ISM , droq->pkts_sent_reg);rte_mb (); }
drivers/net/octeon_ep/cnxk_ep_tx.c +3 -2
@@ -15,7 +15,7 @@* This adds an extra local variable, but almost halves the * number of PCIe writes. */ - val =__atomic_load_n (iq->inst_cnt_ism, __ATOMIC_RELAXED); + val =rte_atomic_load_explicit (iq->inst_cnt_ism, rte_memory_order_relaxed); iq->inst_cnt += val - iq->inst_cnt_prev; iq->inst_cnt_prev = val;
@@ -27,7 +27,8 @@rte_mb ();rte_write64 (OTX2_SDP_REQUEST_ISM , iq->inst_cnt_reg); -while (__atomic_load_n (iq->inst_cnt_ism, __ATOMIC_RELAXED) >= val) { +while (rte_atomic_load_explicit (iq->inst_cnt_ism, + rte_memory_order_relaxed) >= val) {rte_write64 (OTX2_SDP_REQUEST_ISM , iq->inst_cnt_reg);rte_mb (); }
drivers/net/octeon_ep/cnxk_ep_vf.c +4 -4
@@ -150,10 +150,10 @@rte_write64 (ism_addr, (uint8_t *)otx_ep->hw_addr +CNXK_EP_R_IN_CNTS_ISM (iq_no)); iq->inst_cnt_ism = - (uint32_t *)((uint8_t *)otx_ep->ism_buffer_mz->addr + (uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr +CNXK_EP_IQ_ISM_OFFSET (iq_no));otx_ep_err ("SDP_R[%d] INST Q ISM virt: %p, dma: 0x%" PRIX64 , iq_no, - (void *)iq->inst_cnt_ism, ism_addr); + (void *)(uintptr_t )iq->inst_cnt_ism, ism_addr); *iq->inst_cnt_ism =0 ; iq->inst_cnt_prev =0 ; iq->partial_ih = ((uint64_t )otx_ep->pkind) <<36 ;
@@ -235,10 +235,10 @@rte_write64 (ism_addr, (uint8_t *)otx_ep->hw_addr +CNXK_EP_R_OUT_CNTS_ISM (oq_no)); droq->pkts_sent_ism = - (uint32_t *)((uint8_t *)otx_ep->ism_buffer_mz->addr + (uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr +CNXK_EP_OQ_ISM_OFFSET (oq_no));otx_ep_err ("SDP_R[%d] OQ ISM virt: %p dma: 0x%" PRIX64 , - oq_no, (void *)droq->pkts_sent_ism, ism_addr); + oq_no, (void *)(uintptr_t )droq->pkts_sent_ism, ism_addr); *droq->pkts_sent_ism =0 ; droq->pkts_sent_prev =0 ;
drivers/net/octeon_ep/otx2_ep_vf.c +4 -4
@@ -300,10 +300,10 @@ static int otx2_vf_enable_rxq_intr(struct otx_ep_device *otx_epvf,oct_ep_write64 (ism_addr, (uint8_t *)otx_ep->hw_addr +SDP_VF_R_IN_CNTS_ISM (iq_no)); iq->inst_cnt_ism = - (uint32_t *)((uint8_t *)otx_ep->ism_buffer_mz->addr + (uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr +OTX2_EP_IQ_ISM_OFFSET (iq_no));otx_ep_err ("SDP_R[%d] INST Q ISM virt: %p, dma: 0x%x" , iq_no, - (void *)iq->inst_cnt_ism, + (void *)(uintptr_t )iq->inst_cnt_ism, (unsigned int )ism_addr); *iq->inst_cnt_ism =0 ; iq->inst_cnt_prev =0 ;
@@ -386,10 +386,10 @@ static int otx2_vf_enable_rxq_intr(struct otx_ep_device *otx_epvf,oct_ep_write64 (ism_addr, (uint8_t *)otx_ep->hw_addr +SDP_VF_R_OUT_CNTS_ISM (oq_no)); droq->pkts_sent_ism = - (uint32_t *)((uint8_t *)otx_ep->ism_buffer_mz->addr + (uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr +OTX2_EP_OQ_ISM_OFFSET (oq_no));otx_ep_err ("SDP_R[%d] OQ ISM virt: %p, dma: 0x%x" , oq_no, - (void *)droq->pkts_sent_ism, + (void *)(uintptr_t )droq->pkts_sent_ism, (unsigned int )ism_addr); *droq->pkts_sent_ism =0 ; droq->pkts_sent_prev =0 ;
drivers/net/octeon_ep/otx_ep_common.h +2 -2
@@ -218,7 +218,7 @@ struct otx_ep_iq_config {*/ struct otx_ep_instr_queue {/* Location in memory updated by SDP ISM */ -uint32_t *inst_cnt_ism; +RTE_ATOMIC (uint32_t ) *inst_cnt_ism;struct rte_mbuf **mbuf_list;/* Pointer to the Virtual Base addr of the input ring. */ uint8_t *base_addr;
@@ -413,7 +413,7 @@ struct otx_ep_droq {uint8_t ism_ena;/* Pointer to host memory copy of output packet count, set by ISM */ -uint32_t *pkts_sent_ism; +RTE_ATOMIC (uint32_t) *pkts_sent_ism;uint32_t pkts_sent_prev;/* Statistics for this DROQ. */
drivers/net/octeon_ep/otx_ep_rxtx.c +4 -2
@@ -475,7 +475,8 @@rte_mb ();rte_write64 (OTX2_SDP_REQUEST_ISM , iq->inst_cnt_reg); -while (__atomic_load_n (iq->inst_cnt_ism, __ATOMIC_RELAXED) >= val) { +while (rte_atomic_load_explicit (iq->inst_cnt_ism, + rte_memory_order_relaxed) >= val) {rte_write64 (OTX2_SDP_REQUEST_ISM , iq->inst_cnt_reg);rte_mb (); }
@@ -871,7 +872,8 @@rte_mb ();rte_write64 (OTX2_SDP_REQUEST_ISM , droq->pkts_sent_reg); -while (__atomic_load_n (droq->pkts_sent_ism, __ATOMIC_RELAXED) >= val) { +while (rte_atomic_load_explicit (droq->pkts_sent_ism, + rte_memory_order_relaxed) >= val) {rte_write64 (OTX2_SDP_REQUEST_ISM , droq->pkts_sent_reg);rte_mb (); }
Signature · 1 line
1.8.3.1
PATCH v2 11/45 net/octeontx: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/octeontx/octeontx_ethdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/octeontx/octeontx_ethdev.c +4 -4
@@ -31,7 +31,7 @@/* Useful in stopping/closing event device if no of * eth ports are using it. */ -uint16_t evdev_refcnt; +RTE_ATOMIC (uint16_t ) evdev_refcnt;#define OCTEONTX_QLM_MODE_SGMII 7#define OCTEONTX_QLM_MODE_XFI 12
@@ -559,7 +559,7 @@ enum octeontx_link_speed {return 0 ;/* Stopping/closing event device once all eth ports are closed. */ -if (__atomic_fetch_sub (&evdev_refcnt,1 , __ATOMIC_ACQUIRE) -1 ==0 ) { +if (rte_atomic_fetch_sub_explicit (&evdev_refcnt,1 , rte_memory_order_acquire) -1 ==0 ) {rte_event_dev_stop (nic->evdev);rte_event_dev_close (nic->evdev); }
@@ -1593,7 +1593,7 @@ static void build_xstat_names(struct rte_eth_xstat_name *xstat_names) nic->pko_vfid = pko_vfid; nic->port_id = port; nic->evdev = evdev; -__atomic_fetch_add (&evdev_refcnt,1 , __ATOMIC_ACQUIRE); +rte_atomic_fetch_add_explicit (&evdev_refcnt,1 , rte_memory_order_acquire); res =octeontx_port_open (nic);if (res <0 )
@@ -1844,7 +1844,7 @@ static void build_xstat_names(struct rte_eth_xstat_name *xstat_names) } } -__atomic_store_n (&evdev_refcnt,0 , __ATOMIC_RELEASE); +rte_atomic_store_explicit (&evdev_refcnt,0 , rte_memory_order_release);/* * Do 1:1 links for ports & queues. All queues would be mapped to * one port. If there are more ports than queues, then some ports
Signature · 1 line
1.8.3.1
PATCH v2 12/45 net/cxgbe: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/cxgbe/clip_tbl.c | 12 ++++++------ drivers/net/cxgbe/clip_tbl.h | 2 +- drivers/net/cxgbe/cxgbe_main.c | 20 ++++++++++---------- drivers/net/cxgbe/cxgbe_ofld.h | 6 +++--- drivers/net/cxgbe/l2t.c | 12 ++++++------ drivers/net/cxgbe/l2t.h | 2 +- drivers/net/cxgbe/mps_tcam.c | 21 +++++++++++---------- drivers/net/cxgbe/mps_tcam.h | 2 +- drivers/net/cxgbe/smt.c | 12 ++++++------ drivers/net/cxgbe/smt.h | 2 +- 10 files changed, 46 insertions(+), 45 deletions(-)
drivers/net/cxgbe/clip_tbl.c +6 -6
@@ -55,7 +55,7 @@ void cxgbe_clip_release(struct rte_eth_dev *dev, struct clip_entry *ce)int ret;t4_os_lock (&ce->lock); -if (__atomic_fetch_sub (&ce->refcnt,1 , __ATOMIC_RELAXED) -1 ==0 ) { +if (rte_atomic_fetch_sub_explicit (&ce->refcnt,1 , rte_memory_order_relaxed) -1 ==0 ) { ret =clip6_release_mbox (dev, ce->addr);if (ret)dev_debug (adap,"CLIP FW DEL CMD failed: %d" , ret);
@@ -79,7 +79,7 @@ static struct clip_entry *find_or_alloc_clipe(struct clip_tbl *c,unsigned int clipt_size = c->clipt_size;for (e = &c->cl_list[0 ], end = &c->cl_list[clipt_size]; e != end; ++e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) {if (!first_free) first_free = e; }else {
@@ -114,12 +114,12 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev, ce =find_or_alloc_clipe (ctbl, lip);if (ce) {t4_os_lock (&ce->lock); -if (__atomic_load_n (&ce->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&ce->refcnt, rte_memory_order_relaxed) ==0 ) {rte_memcpy (ce->addr, lip,sizeof (ce->addr));if (v6) { ce->type =FILTER_TYPE_IPV6 ; -__atomic_store_n (&ce->refcnt,1 , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&ce->refcnt,1 , + rte_memory_order_relaxed); ret =clip6_get_mbox (dev, lip);if (ret) dev_debug(adap,
@@ -129,7 +129,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev, ce->type =FILTER_TYPE_IPV4 ; } }else { -__atomic_fetch_add (&ce->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&ce->refcnt,1 , rte_memory_order_relaxed); }t4_os_unlock (&ce->lock); }
drivers/net/cxgbe/clip_tbl.h +1 -1
@@ -13,7 +13,7 @@ struct clip_entry {enum filter_type type;/* entry type */ u32 addr[4 ];/* IPV4 or IPV6 address */ rte_spinlock_t lock;/* entry lock */ -u32 refcnt;/* entry reference count */ +RTE_ATOMIC (u32) refcnt;/* entry reference count */ };struct clip_tbl {
drivers/net/cxgbe/cxgbe_main.c +10 -10
@@ -418,15 +418,15 @@ void cxgbe_remove_tid(struct tid_info *t, unsigned int chan, unsigned int tid,if (t->tid_tab[tid]) { t->tid_tab[tid] =NULL ; -__atomic_fetch_sub (&t->conns_in_use,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&t->conns_in_use,1 , rte_memory_order_relaxed);if (t->hash_base && tid >= t->hash_base) {if (family ==FILTER_TYPE_IPV4 ) -__atomic_fetch_sub (&t->hash_tids_in_use,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&t->hash_tids_in_use,1 , + rte_memory_order_relaxed); }else {if (family ==FILTER_TYPE_IPV4 ) -__atomic_fetch_sub (&t->tids_in_use,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_sub_explicit (&t->tids_in_use,1 , + rte_memory_order_relaxed); } }
@@ -448,15 +448,15 @@ void cxgbe_insert_tid(struct tid_info *t, void *data, unsigned int tid, t->tid_tab[tid] = data;if (t->hash_base && tid >= t->hash_base) {if (family ==FILTER_TYPE_IPV4 ) -__atomic_fetch_add (&t->hash_tids_in_use,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&t->hash_tids_in_use,1 , + rte_memory_order_relaxed); }else {if (family ==FILTER_TYPE_IPV4 ) -__atomic_fetch_add (&t->tids_in_use,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&t->tids_in_use,1 , + rte_memory_order_relaxed); } -__atomic_fetch_add (&t->conns_in_use,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&t->conns_in_use,1 , rte_memory_order_relaxed); }/**
drivers/net/cxgbe/cxgbe_ofld.h +3 -3
@@ -60,10 +60,10 @@ struct tid_info {unsigned int atids_in_use;/* TIDs in the TCAM */ -u32 tids_in_use; +RTE_ATOMIC (u32) tids_in_use;/* TIDs in the HASH */ -u32 hash_tids_in_use; -u32 conns_in_use; +RTE_ATOMIC (u32) hash_tids_in_use; +RTE_ATOMIC (u32) conns_in_use; rte_spinlock_t atid_lock __rte_cache_aligned;rte_spinlock_t ftid_lock;
drivers/net/cxgbe/l2t.c +6 -6
@@ -14,8 +14,8 @@*/ void cxgbe_l2t_release (struct l2t_entry *e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) !=0 ) -__atomic_fetch_sub (&e->refcnt,1 , __ATOMIC_RELAXED); +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) !=0 ) +rte_atomic_fetch_sub_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }/**
@@ -112,7 +112,7 @@ static struct l2t_entry *find_or_alloc_l2e(struct l2t_data *d, u16 vlan,struct l2t_entry *first_free =NULL ;for (e = &d->l2tab[0 ], end = &d->l2tab[d->l2t_size]; e != end; ++e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) {if (!first_free) first_free = e; }else {
@@ -151,18 +151,18 @@ static struct l2t_entry *t4_l2t_alloc_switching(struct rte_eth_dev *dev, e =find_or_alloc_l2e (d, vlan, port, eth_addr);if (e) {t4_os_lock (&e->lock); -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) { e->state =L2T_STATE_SWITCHING ; e->vlan = vlan; e->lport = port;rte_memcpy (e->dmac, eth_addr,RTE_ETHER_ADDR_LEN ); -__atomic_store_n (&e->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&e->refcnt,1 , rte_memory_order_relaxed); ret =write_l2e (dev, e,0 , !L2T_LPBK , !L2T_ARPMISS );if (ret <0 )dev_debug (adap,"Failed to write L2T entry: %d" , ret); }else { -__atomic_fetch_add (&e->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }t4_os_unlock (&e->lock); }
drivers/net/cxgbe/l2t.h +1 -1
@@ -30,7 +30,7 @@ struct l2t_entry {u8 lport;/* destination port */ u8 dmac[RTE_ETHER_ADDR_LEN ];/* destination MAC address */ rte_spinlock_t lock;/* entry lock */ -u32 refcnt;/* entry reference count */ +RTE_ATOMIC (u32) refcnt;/* entry reference count */ };struct l2t_data {
drivers/net/cxgbe/mps_tcam.c +11 -10
@@ -76,7 +76,7 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr,t4_os_write_lock (&mpstcam->lock); entry =cxgbe_mpstcam_lookup (adap->mpstcam, eth_addr, mask);if (entry) { -__atomic_fetch_add (&entry->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&entry->refcnt,1 , rte_memory_order_relaxed);t4_os_write_unlock (&mpstcam->lock);return entry->idx; }
@@ -98,7 +98,7 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr, entry = &mpstcam->entry[ret];memcpy (entry->eth_addr, eth_addr,RTE_ETHER_ADDR_LEN );memcpy (entry->mask, mask,RTE_ETHER_ADDR_LEN ); -__atomic_store_n (&entry->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,1 , rte_memory_order_relaxed); entry->state =MPS_ENTRY_USED ;if (cxgbe_update_free_idx (mpstcam))
@@ -147,7 +147,7 @@ int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr)* provided value is -1 */ if (entry->state ==MPS_ENTRY_UNUSED ) { -__atomic_store_n (&entry->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,1 , rte_memory_order_relaxed); entry->state =MPS_ENTRY_USED ; }
@@ -165,7 +165,7 @@ static inline void reset_mpstcam_entry(struct mps_tcam_entry *entry) {memset (entry->eth_addr,0 ,RTE_ETHER_ADDR_LEN );memset (entry->mask,0 ,RTE_ETHER_ADDR_LEN ); -__atomic_store_n (&entry->refcnt,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,0 , rte_memory_order_relaxed); entry->state =MPS_ENTRY_UNUSED ; }
@@ -190,12 +190,13 @@ int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx)return -EINVAL ; } -if (__atomic_load_n (&entry->refcnt, __ATOMIC_RELAXED) ==1 ) +if (rte_atomic_load_explicit (&entry->refcnt, rte_memory_order_relaxed) ==1 ) ret =t4_free_raw_mac_filt (adap, pi->viid, entry->eth_addr, entry->mask, idx,1 , pi->port_id, false);else - ret =__atomic_fetch_sub (&entry->refcnt,1 , __ATOMIC_RELAXED) -1 ; + ret =rte_atomic_fetch_sub_explicit (&entry->refcnt,1 , + rte_memory_order_relaxed) -1 ;if (ret ==0 ) {reset_mpstcam_entry (entry);
@@ -222,7 +223,7 @@ int cxgbe_mpstcam_rawf_enable(struct port_info *pi)t4_os_write_lock (&t->lock); rawf_idx = adap->params.rawf_start + pi->port_id; entry = &t->entry[rawf_idx]; -if (__atomic_load_n (&entry->refcnt, __ATOMIC_RELAXED) ==1 ) +if (rte_atomic_load_explicit (&entry->refcnt, rte_memory_order_relaxed) ==1 ) goto out_unlock; ret = t4_alloc_raw_mac_filt(adap, pi->viid, entry->eth_addr,
@@ -231,7 +232,7 @@ int cxgbe_mpstcam_rawf_enable(struct port_info *pi)if (ret <0 ) goto out_unlock; -__atomic_store_n (&entry->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,1 , rte_memory_order_relaxed); out_unlock:t4_os_write_unlock (&t->lock);
@@ -253,7 +254,7 @@ int cxgbe_mpstcam_rawf_disable(struct port_info *pi)t4_os_write_lock (&t->lock); rawf_idx = adap->params.rawf_start + pi->port_id; entry = &t->entry[rawf_idx]; -if (__atomic_load_n (&entry->refcnt, __ATOMIC_RELAXED) !=1 ) +if (rte_atomic_load_explicit (&entry->refcnt, rte_memory_order_relaxed) !=1 ) goto out_unlock; ret = t4_free_raw_mac_filt(adap, pi->viid, entry->eth_addr,
@@ -262,7 +263,7 @@ int cxgbe_mpstcam_rawf_disable(struct port_info *pi)if (ret <0 ) goto out_unlock; -__atomic_store_n (&entry->refcnt,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&entry->refcnt,0 , rte_memory_order_relaxed); out_unlock:t4_os_write_unlock (&t->lock);
drivers/net/cxgbe/mps_tcam.h +1 -1
@@ -29,7 +29,7 @@ struct mps_tcam_entry {u8 mask[RTE_ETHER_ADDR_LEN ];struct mpstcam_table *mpstcam;/* backptr */ -u32 refcnt; +RTE_ATOMIC (u32) refcnt; };struct mpstcam_table {
drivers/net/cxgbe/smt.c +6 -6
@@ -119,7 +119,7 @@ static struct smt_entry *find_or_alloc_smte(struct smt_data *s, u8 *smac)struct smt_entry *e, *end, *first_free =NULL ;for (e = &s->smtab[0 ], end = &s->smtab[s->smt_size]; e != end; ++e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) {if (!first_free) first_free = e; }else {
@@ -156,7 +156,7 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev, e =find_or_alloc_smte (s, smac);if (e) {t4_os_lock (&e->lock); -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) ==0 ) { e->pfvf = pfvf;rte_memcpy (e->src_mac, smac,RTE_ETHER_ADDR_LEN ); ret =write_smt_entry (dev, e);
@@ -168,9 +168,9 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev, goto out_write_unlock; } e->state =SMT_STATE_SWITCHING ; -__atomic_store_n (&e->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }else { -__atomic_fetch_add (&e->refcnt,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }t4_os_unlock (&e->lock); }
@@ -195,8 +195,8 @@ struct smt_entry *cxgbe_smt_alloc_switching(struct rte_eth_dev *dev, u8 *smac)void cxgbe_smt_release (struct smt_entry *e) { -if (__atomic_load_n (&e->refcnt, __ATOMIC_RELAXED) !=0 ) -__atomic_fetch_sub (&e->refcnt,1 , __ATOMIC_RELAXED); +if (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_relaxed) !=0 ) +rte_atomic_fetch_sub_explicit (&e->refcnt,1 , rte_memory_order_relaxed); }/**
drivers/net/cxgbe/smt.h +1 -1
@@ -23,7 +23,7 @@ struct smt_entry {u16 pfvf;u16 hw_idx;u8 src_mac[RTE_ETHER_ADDR_LEN ]; -u32 refcnt; +RTE_ATOMIC (u32) refcnt;rte_spinlock_t lock; };
Signature · 1 line
1.8.3.1
PATCH v2 13/45 net/gve: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/gve/base/gve_osdep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/gve/base/gve_osdep.h +2 -2
@@ -135,7 +135,7 @@ struct gve_dma_mem {static inline void *gve_alloc_dma_mem (struct gve_dma_mem *mem,u64 size) { -static uint16_t gve_dma_memzone_id; +static RTE_ATOMIC (uint16_t ) gve_dma_memzone_id;const struct rte_memzone *mz =NULL ;char z_name[RTE_MEMZONE_NAMESIZE ];
@@ -143,7 +143,7 @@ struct gve_dma_mem {return NULL ;snprintf (z_name,sizeof (z_name),"gve_dma_%u" , -__atomic_fetch_add (&gve_dma_memzone_id,1 , __ATOMIC_RELAXED)); +rte_atomic_fetch_add_explicit (&gve_dma_memzone_id,1 , rte_memory_order_relaxed)); mz =rte_memzone_reserve_aligned (z_name, size,SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG ,PAGE_SIZE );
Signature · 1 line
1.8.3.1
PATCH v2 14/45 net/memif: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/memif/memif.h | 4 ++-- drivers/net/memif/rte_eth_memif.c | 50 +++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 27 deletions(-)
drivers/net/memif/memif.h +2 -2
@@ -169,9 +169,9 @@ typedef struct __rte_packed __rte_aligned(128)uint32_t cookie;/**< MEMIF_COOKIE */ uint16_t flags;/**< flags */ #define MEMIF_RING_FLAG_MASK_INT 1/**< disable interrupt mode */ -uint16_t head;/**< pointer to ring buffer head */ +RTE_ATOMIC (uint16_t ) head;/**< pointer to ring buffer head */ MEMIF_CACHELINE_ALIGN_MARK (cacheline1); -uint16_t tail;/**< pointer to ring buffer tail */ +RTE_ATOMIC (uint16_t ) tail;/**< pointer to ring buffer tail */ MEMIF_CACHELINE_ALIGN_MARK (cacheline2);memif_desc_t desc[0 ];/**< buffer descriptors */ } memif_ring_t;
drivers/net/memif/rte_eth_memif.c +25 -25
156 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 15/45 net/thunderx: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/thunderx/nicvf_rxtx.c | 9 +++++---- drivers/net/thunderx/nicvf_struct.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/thunderx/nicvf_rxtx.c +5 -4
@@ -374,8 +374,8 @@NICVF_RX_ASSERT ((unsigned int )to_fill <= (qlen_mask - (nicvf_addr_read (rbdr->rbdr_status) &NICVF_RBDR_COUNT_MASK ))); - next_tail =__atomic_fetch_add (&rbdr->next_tail, to_fill, - __ATOMIC_ACQUIRE); + next_tail =rte_atomic_fetch_add_explicit (&rbdr->next_tail, to_fill, + rte_memory_order_acquire); ltail = next_tail;for (i =0 ; i < to_fill; i++) {struct rbdr_entry_t *entry = desc + (ltail & qlen_mask);
@@ -385,9 +385,10 @@ ltail++; } -rte_wait_until_equal_32 (&rbdr->tail, next_tail, __ATOMIC_RELAXED); +rte_wait_until_equal_32 ((uint32_t *)(uintptr_t )&rbdr->tail, next_tail, + rte_memory_order_relaxed); -__atomic_store_n (&rbdr->tail, ltail, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&rbdr->tail, ltail, rte_memory_order_release);nicvf_addr_write (door, to_fill);return to_fill; }
drivers/net/thunderx/nicvf_struct.h +2 -2
@@ -20,8 +20,8 @@ struct nicvf_rbdr {struct rbdr_entry_t *desc;nicvf_iova_addr_t phys;uint32_t buffsz; -uint32_t tail; -uint32_t next_tail; +RTE_ATOMIC (uint32_t ) tail; +RTE_ATOMIC (uint32_t ) next_tail;uint32_t head;uint32_t qlen_mask; } __rte_cache_aligned;
Signature · 1 line
1.8.3.1
PATCH v2 16/45 net/virtio: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/virtio/virtio_ring.h | 4 +-- drivers/net/virtio/virtio_user/virtio_user_dev.c | 12 ++++----- drivers/net/virtio/virtqueue.h | 32 ++++++++++++------------ 3 files changed, 24 insertions(+), 24 deletions(-)
drivers/net/virtio/virtio_ring.h +2 -2
@@ -59,7 +59,7 @@ struct vring_used_elem {struct vring_used {uint16_t flags; -uint16_t idx; +RTE_ATOMIC (uint16_t ) idx;struct vring_used_elem ring[]; };
@@ -70,7 +70,7 @@ struct vring_packed_desc {uint64_t addr;uint32_t len;uint16_t id; -uint16_t flags; +RTE_ATOMIC (uint16_t ) flags; };#define RING_EVENT_FLAGS_ENABLE 0x0
drivers/net/virtio/virtio_user/virtio_user_dev.c +6 -6
@@ -948,7 +948,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)static inline int desc_is_avail (struct vring_packed_desc *desc,bool wrap_counter) { -uint16_t flags =__atomic_load_n (&desc->flags, __ATOMIC_ACQUIRE); +uint16_t flags =rte_atomic_load_explicit (&desc->flags, rte_memory_order_acquire);return wrap_counter == !!(flags &VRING_PACKED_DESC_F_AVAIL ) && wrap_counter != !!(flags &VRING_PACKED_DESC_F_USED );
@@ -1037,8 +1037,8 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)if (vq->used_wrap_counter) flags |=VRING_PACKED_DESC_F_AVAIL_USED ; -__atomic_store_n (&vring->desc[vq->used_idx].flags, flags, - __ATOMIC_RELEASE); +rte_atomic_store_explicit (&vring->desc[vq->used_idx].flags, flags, + rte_memory_order_release); vq->used_idx += n_descs;if (vq->used_idx >= dev->queue_size) {
@@ -1057,9 +1057,9 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)struct vring *vring = &dev->vrings.split[queue_idx];/* Consume avail ring, using used ring idx as first one */ -while (__atomic_load_n (&vring->used->idx, __ATOMIC_RELAXED) +while (rte_atomic_load_explicit (&vring->used->idx, rte_memory_order_relaxed) != vring->avail->idx) { - avail_idx =__atomic_load_n (&vring->used->idx, __ATOMIC_RELAXED) + avail_idx =rte_atomic_load_explicit (&vring->used->idx, rte_memory_order_relaxed) & (vring->num -1 ); desc_idx = vring->avail->ring[avail_idx];
@@ -1070,7 +1070,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) uep->id = desc_idx; uep->len = n_descs; -__atomic_fetch_add (&vring->used->idx,1 , __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&vring->used->idx,1 , rte_memory_order_relaxed); } }
drivers/net/virtio/virtqueue.h +16 -16
@@ -37,7 +37,7 @@ virtio_mb(uint8_t weak_barriers) {if (weak_barriers) -rte_atomic_thread_fence (__ATOMIC_SEQ_CST); +rte_atomic_thread_fence (rte_memory_order_seq_cst);else rte_mb (); }
@@ -46,7 +46,7 @@ virtio_rmb(uint8_t weak_barriers) {if (weak_barriers) -rte_atomic_thread_fence (__ATOMIC_ACQUIRE); +rte_atomic_thread_fence (rte_memory_order_acquire);else rte_io_rmb (); }
@@ -55,7 +55,7 @@ virtio_wmb(uint8_t weak_barriers) {if (weak_barriers) -rte_atomic_thread_fence (__ATOMIC_RELEASE); +rte_atomic_thread_fence (rte_memory_order_release);else rte_io_wmb (); }
@@ -67,12 +67,12 @@uint16_t flags;if (weak_barriers) { -/* x86 prefers to using rte_io_rmb over __atomic_load_n as it reports +/* x86 prefers to using rte_io_rmb over rte_atomic_load_explicit as it reports * a better perf(~1.5%), which comes from the saved branch by the compiler. * The if and else branch are identical on the platforms except Arm. */ #ifdef RTE_ARCH_ARM - flags =__atomic_load_n (&dp->flags, __ATOMIC_ACQUIRE); + flags =rte_atomic_load_explicit (&dp->flags, rte_memory_order_acquire);#else flags = dp->flags;rte_io_rmb ();
@@ -90,12 +90,12 @@ uint16_t flags, uint8_t weak_barriers) {if (weak_barriers) { -/* x86 prefers to using rte_io_wmb over __atomic_store_n as it reports +/* x86 prefers to using rte_io_wmb over rte_atomic_store_explicit as it reports * a better perf(~1.5%), which comes from the saved branch by the compiler. * The if and else branch are identical on the platforms except Arm. */ #ifdef RTE_ARCH_ARM -__atomic_store_n (&dp->flags, flags, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&dp->flags, flags, rte_memory_order_release);#else rte_io_wmb (); dp->flags = flags;
@@ -425,7 +425,7 @@ struct virtqueue *virtqueue_alloc(struct virtio_hw *hw, uint16_t index,if (vq->hw->weak_barriers) {/** -* x86 prefers to using rte_smp_rmb over __atomic_load_n as it +* x86 prefers to using rte_smp_rmb over rte_atomic_load_explicit as it * reports a slightly better perf, which comes from the saved * branch by the compiler. * The if and else branches are identical with the smp and io
@@ -435,8 +435,8 @@ struct virtqueue *virtqueue_alloc(struct virtio_hw *hw, uint16_t index, idx = vq->vq_split.ring.used->idx;rte_smp_rmb ();#else - idx =__atomic_load_n (&(vq)->vq_split.ring.used->idx, - __ATOMIC_ACQUIRE); + idx =rte_atomic_load_explicit (&(vq)->vq_split.ring.used->idx, + rte_memory_order_acquire);#endif }else { idx = vq->vq_split.ring.used->idx;
@@ -454,7 +454,7 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx, vq_update_avail_idx(struct virtqueue *vq) {if (vq->hw->weak_barriers) { -/* x86 prefers to using rte_smp_wmb over __atomic_store_n as +/* x86 prefers to using rte_smp_wmb over rte_atomic_store_explicit as * it reports a slightly better perf, which comes from the * saved branch by the compiler. * The if and else branches are identical with the smp and
@@ -464,8 +464,8 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx,rte_smp_wmb (); vq->vq_split.ring.avail->idx = vq->vq_avail_idx;#else -__atomic_store_n (&vq->vq_split.ring.avail->idx, - vq->vq_avail_idx, __ATOMIC_RELEASE); +rte_atomic_store_explicit (&vq->vq_split.ring.avail->idx, + vq->vq_avail_idx, rte_memory_order_release);#endif }else {rte_io_wmb ();
@@ -528,8 +528,8 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx,#ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP #define VIRTQUEUE_DUMP (vq) do { \ uint16_t used_idx, nused; \ - used_idx = __atomic_load_n(&(vq)->vq_split.ring.used->idx, \ - __ATOMIC_RELAXED); \ + used_idx = rte_atomic_load_explicit(&(vq)->vq_split.ring.used->idx, \ + rte_memory_order_relaxed); \ nused = (uint16_t)(used_idx - (vq)->vq_used_cons_idx); \ if (virtio_with_packed_queue((vq)->hw)) { \ PMD_INIT_LOG(DEBUG, \
@@ -546,7 +546,7 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx," avail.flags=0x%x; used.flags=0x%x" , \ (vq)->vq_nentries, (vq)->vq_free_cnt, nused, (vq)->vq_desc_head_idx, \ (vq)->vq_split.ring.avail->idx, (vq)->vq_used_cons_idx, \ -__atomic_load_n (&(vq)->vq_split.ring.used->idx, __ATOMIC_RELAXED), \ +rte_atomic_load_explicit (&(vq)->vq_split.ring.used->idx, rte_memory_order_relaxed), \ (vq)->vq_split.ring.avail->flags, (vq)->vq_split.ring.used->flags); \ } while (0) #else
Signature · 1 line
1.8.3.1
PATCH v2 17/45 net/hinic: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/hinic/hinic_pmd_rx.c | 2 +- drivers/net/hinic/hinic_pmd_rx.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/hinic/hinic_pmd_rx.c +1 -1
@@ -1004,7 +1004,7 @@ u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16 nb_pkts)while (pkts < nb_pkts) {/* 2. current ci is done */ rx_cqe = &rxq->rx_cqe[sw_ci]; - status =__atomic_load_n (&rx_cqe->status, __ATOMIC_ACQUIRE); + status =rte_atomic_load_explicit (&rx_cqe->status, rte_memory_order_acquire);if (!HINIC_GET_RX_DONE_BE (status))break ;
drivers/net/hinic/hinic_pmd_rx.h +1 -1
@@ -29,7 +29,7 @@ struct hinic_rq_ctrl { };struct hinic_rq_cqe { -u32 status; +RTE_ATOMIC (u32) status;u32 vlan_len;u32 offload_type;u32 rss_hash;
Signature · 1 line
1.8.3.1
PATCH v2 18/45 net/idpf: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/idpf/idpf_ethdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/idpf/idpf_ethdev.c +4 -3
@@ -259,8 +259,8 @@ struct rte_idpf_xstats_name_off {for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; - mbuf_alloc_failed +=__atomic_load_n (&rxq->rx_stats.mbuf_alloc_failed, - __ATOMIC_RELAXED); + mbuf_alloc_failed +=rte_atomic_load_explicit (&rxq->rx_stats.mbuf_alloc_failed, + rte_memory_order_relaxed); }return mbuf_alloc_failed;
@@ -308,7 +308,8 @@ struct rte_idpf_xstats_name_off {for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; -__atomic_store_n (&rxq->rx_stats.mbuf_alloc_failed,0 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&rxq->rx_stats.mbuf_alloc_failed,0 , + rte_memory_order_relaxed); } }
Signature · 1 line
1.8.3.1
PATCH v2 19/45 net/qede: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/qede/base/bcm_osal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/qede/base/bcm_osal.c +3 -3
@@ -51,11 +51,11 @@ void osal_poll_mode_dpc(osal_int_ptr_t hwfn_cookie)/* Counter to track current memzone allocated */ static uint16_t ecore_mz_count; -static uint32_t ref_cnt; +static RTE_ATOMIC (uint32_t ) ref_cnt;int ecore_mz_mapping_alloc (void ) { -if (__atomic_fetch_add (&ref_cnt,1 , __ATOMIC_RELAXED) ==0 ) { +if (rte_atomic_fetch_add_explicit (&ref_cnt,1 , rte_memory_order_relaxed) ==0 ) { ecore_mz_mapping =rte_calloc ("ecore_mz_map" ,rte_memzone_max_get (),sizeof (struct rte_memzone *),0 ); }
@@ -68,7 +68,7 @@ int ecore_mz_mapping_alloc(void)void ecore_mz_mapping_free (void ) { -if (__atomic_fetch_sub (&ref_cnt,1 , __ATOMIC_RELAXED) -1 ==0 ) { +if (rte_atomic_fetch_sub_explicit (&ref_cnt,1 , rte_memory_order_relaxed) -1 ==0 ) {rte_free (ecore_mz_mapping); ecore_mz_mapping =NULL ; }
Signature · 1 line
1.8.3.1
PATCH v2 20/45 net/ring: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/net/ring/rte_eth_ring.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ring/rte_eth_ring.c +4 -4
@@ -44,8 +44,8 @@ enum dev_action {struct ring_queue {struct rte_ring *rng; -uint64_t rx_pkts; -uint64_t tx_pkts; +RTE_ATOMIC (uint64_t ) rx_pkts; +RTE_ATOMIC (uint64_t ) tx_pkts; };struct pmd_internals {
@@ -82,7 +82,7 @@ struct pmd_internals {if (r->rng->flags &RING_F_SC_DEQ ) r->rx_pkts += nb_rx;else -__atomic_fetch_add (&r->rx_pkts, nb_rx, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&r->rx_pkts, nb_rx, rte_memory_order_relaxed);return nb_rx; }
@@ -96,7 +96,7 @@ struct pmd_internals {if (r->rng->flags &RING_F_SP_ENQ ) r->tx_pkts += nb_tx;else -__atomic_fetch_add (&r->tx_pkts, nb_tx, __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&r->tx_pkts, nb_tx, rte_memory_order_relaxed);return nb_tx; }
Signature · 1 line
1.8.3.1
PATCH v2 21/45 vdpa/mlx5: use rte stdatomic API
In reply to Tyler RetzlaffReplace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API.
--- drivers/vdpa/mlx5/mlx5_vdpa.c | 24 +++++++++--------- drivers/vdpa/mlx5/mlx5_vdpa.h | 14 +++++------ drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 46 +++++++++++++++++------------------ drivers/vdpa/mlx5/mlx5_vdpa_lm.c | 4 ++- drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 4 ++- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 4 ++- 6 files changed, 52 insertions(+), 44 deletions(-)
drivers/vdpa/mlx5/mlx5_vdpa.c +13 -11
@@ -261,8 +261,8 @@uint32_t timeout =0 ;/* Check and wait all close tasks done. */ -while (__atomic_load_n (&priv->dev_close_progress, - __ATOMIC_RELAXED) !=0 && timeout <1000 ) { +while (rte_atomic_load_explicit (&priv->dev_close_progress, + rte_memory_order_relaxed) !=0 && timeout <1000 ) {rte_delay_us_sleep (10000 ); timeout++; }
@@ -294,8 +294,8 @@ priv->last_c_thrd_idx =0 ; else priv->last_c_thrd_idx++; -__atomic_store_n (&priv->dev_close_progress, -1 , __ATOMIC_RELAXED); +rte_atomic_store_explicit (&priv->dev_close_progress, +1 , rte_memory_order_relaxed); if (mlx5_vdpa_task_add(priv, priv->last_c_thrd_idx, MLX5_VDPA_TASK_DEV_CLOSE_NOWAIT,
@@ -319,8 +319,8 @@if (!priv->connected)mlx5_vdpa_dev_cache_clean (priv); priv->vid =0 ; -__atomic_store_n (&priv->dev_close_progress,0 , - __ATOMIC_RELAXED); +rte_atomic_store_explicit (&priv->dev_close_progress,0 , + rte_memory_order_relaxed); priv->state =MLX5_VDPA_STATE_PROBED ;DRV_LOG (INFO ,"vDPA device %d was closed." , vid);return ret;
@@ -664,7 +664,9 @@static int mlx5_vdpa_virtq_resource_prepare (struct mlx5_vdpa_priv *priv) { -uint32_t remaining_cnt =0 , err_cnt =0 , task_num =0 ; +RTE_ATOMIC (uint32_t ) remaining_cnt =0 ; +RTE_ATOMIC (uint32_t ) err_cnt =0 ; +uint32_t task_num =0 ;uint32_t max_queues, index, thrd_idx, data[1 ];struct mlx5_vdpa_virtq *virtq;
@@ -847,8 +849,8 @@if (conf_thread_mng.initializer_priv == priv)if (mlx5_vdpa_mult_threads_create ()) goto error; -__atomic_fetch_add (&conf_thread_mng.refcnt,1 , - __ATOMIC_RELAXED); +rte_atomic_fetch_add_explicit (&conf_thread_mng.refcnt,1 , + rte_memory_order_relaxed); }if (mlx5_vdpa_create_dev_resources (priv)) goto error;
@@ -937,8 +939,8 @@if (priv->vdev)rte_vdpa_unregister_device (priv->vdev);if (priv->use_c_thread) -if (__atomic_fetch_sub (&conf_thread_mng.refcnt, -1 , __ATOMIC_RELAXED) ==1 ) +if (rte_atomic_fetch_sub_explicit (&conf_thread_mng.refcnt, +1 , rte_memory_order_relaxed) ==1 )mlx5_vdpa_mult_threads_destroy (true);rte_free (priv); }
drivers/vdpa/mlx5/mlx5_vdpa.h +7 -7
@@ -93,8 +93,8 @@ enum mlx5_vdpa_task_type {struct mlx5_vdpa_task {struct mlx5_vdpa_priv *priv;enum mlx5_vdpa_task_type type; -uint32_t *remaining_cnt; -uint32_t *err_cnt; +RTE_ATOMIC (uint32_t ) *remaining_cnt; +RTE_ATOMIC (uint32_t ) *err_cnt;uint32_t idx; } __rte_packed __rte_aligned(4);
@@ -107,7 +107,7 @@ struct mlx5_vdpa_c_thread {struct mlx5_vdpa_conf_thread_mng {void *initializer_priv; -uint32_t refcnt; +RTE_ATOMIC (uint32_t ) refcnt;uint32_t max_thrds;pthread_mutex_t cthrd_lock;struct mlx5_vdpa_c_thread cthrd[MLX5_VDPA_MAX_C_THRD ];
@@ -212,7 +212,7 @@ struct mlx5_vdpa_priv {uint64_t features;/* Negotiated features. */ uint16_t log_max_rqt_size;uint16_t last_c_thrd_idx; -uint16_t dev_close_progress; +RTE_ATOMIC (uint16_t ) dev_close_progress;uint16_t num_mrs;/* Number of memory regions. */ struct mlx5_vdpa_steer steer;struct mlx5dv_var *var;
@@ -581,13 +581,13 @@ int mlx5_vdpa_dirty_bitmap_set(struct mlx5_vdpa_priv *priv, uint64_t log_base, mlx5_vdpa_task_add(struct mlx5_vdpa_priv *priv, uint32_t thrd_idx, enum mlx5_vdpa_task_type task_type, - uint32_t *remaining_cnt, uint32_t *err_cnt, + RTE_ATOMIC(uint32_t) *remaining_cnt, RTE_ATOMIC(uint32_t) *err_cnt, void **task_data, uint32_t num);int mlx5_vdpa_register_mr (struct mlx5_vdpa_priv *priv,uint32_t idx);bool -mlx5_vdpa_c_thread_wait_bulk_tasks_done (uint32_t *remaining_cnt, -uint32_t *err_cnt,uint32_t sleep_time); +mlx5_vdpa_c_thread_wait_bulk_tasks_done (RTE_ATOMIC (uint32_t ) *remaining_cnt, +RTE_ATOMIC (uint32_t ) *err_cnt,uint32_t sleep_time);int mlx5_vdpa_virtq_setup (struct mlx5_vdpa_priv *priv,int index,bool reg_kick);void
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c +23 -23
114 lines not on this page · raw message
drivers/vdpa/mlx5/mlx5_vdpa_lm.c +3 -1
@@ -92,7 +92,9 @@int mlx5_vdpa_lm_log (struct mlx5_vdpa_priv *priv) { -uint32_t remaining_cnt =0 , err_cnt =0 , task_num =0 ; +RTE_ATOMIC (uint32_t ) remaining_cnt =0 ; +RTE_ATOMIC (uint32_t ) err_cnt =0 ; +uint32_t task_num =0 ;uint32_t i, thrd_idx, data[1 ];struct mlx5_vdpa_virtq *virtq;uint64_t features;
drivers/vdpa/mlx5/mlx5_vdpa_mem.c +3 -1
@@ -279,7 +279,9 @@uint8_t mode =0 ;int ret = -rte_errno;uint32_t i, thrd_idx, data[1 ]; -uint32_t remaining_cnt =0 , err_cnt =0 , task_num =0 ; +RTE_ATOMIC (uint32_t ) remaining_cnt =0 ; +RTE_ATOMIC (uint32_t ) err_cnt =0 ; +uint32_t task_num =0 ;struct rte_vhost_memory *mem =mlx5_vdpa_vhost_mem_regions_prepare (priv->vid, &mode, &priv->vmem_info.size, &priv->vmem_info.gcd, &priv->vmem_info.entries_num);
drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +3 -1
@@ -666,7 +666,9 @@ {int ret =rte_vhost_get_negotiated_features (priv->vid, &priv->features);uint16_t nr_vring =rte_vhost_get_vring_num (priv->vid); -uint32_t remaining_cnt =0 , err_cnt =0 , task_num =0 ; +RTE_ATOMIC (uint32_t ) remaining_cnt =0 ; +RTE_ATOMIC (uint32_t ) err_cnt =0 ; +uint32_t task_num =0 ;uint32_t i, thrd_idx, data[1 ];struct mlx5_vdpa_virtq *virtq;struct rte_vhost_vring vq;
Signature · 1 line
1.8.3.1