aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session-apps/echo_client.c
diff options
context:
space:
mode:
authorSirshak Das <sirshak.das@arm.com>2018-10-03 22:53:51 +0000
committerDamjan Marion <dmarion@me.com>2018-10-19 07:10:47 +0000
commit2f6d7bb93c157b874efb79a2d1583a4c368bf89a (patch)
tree05dc2867c598cbb8d711f074b4b0eb62dd464f41 /src/vnet/session-apps/echo_client.c
parentbf3443b0f852f5a4c551d12f926defbd047f2161 (diff)
vppinfra: add atomic macros for __sync builtins
This is first part of addition of atomic macros with only macros for __sync builtins. - Based on earlier patch by Damjan (https://gerrit.fd.io/r/#/c/10729/) Additionally - clib_atomic_release macro added and used in the absence of any memory barrier. - clib_atomic_bool_cmp_and_swap added Change-Id: Ie4e48c1e184a652018d1d0d87c4be80ddd180a3b Original-patch-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Sirshak Das <sirshak.das@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> Reviewed-by: Steve Capper <steve.capper@arm.com>
Diffstat (limited to 'src/vnet/session-apps/echo_client.c')
-rw-r--r--src/vnet/session-apps/echo_client.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index 1ece0196dde..c3d838d49cc 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -263,8 +263,8 @@ echo_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
{
stream_session_t *s;
- __sync_fetch_and_add (&ecm->tx_total, sp->bytes_sent);
- __sync_fetch_and_add (&ecm->rx_total, sp->bytes_received);
+ clib_atomic_fetch_add (&ecm->tx_total, sp->bytes_sent);
+ clib_atomic_fetch_add (&ecm->rx_total, sp->bytes_received);
s = session_get_from_handle_if_valid (sp->vpp_session_handle);
if (s)
@@ -276,7 +276,7 @@ echo_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vec_delete (connections_this_batch, 1, i);
i--;
- __sync_fetch_and_add (&ecm->ready_connections, -1);
+ clib_atomic_fetch_add (&ecm->ready_connections, -1);
}
else
{
@@ -408,7 +408,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
}
vec_add1 (ecm->connection_index_by_thread[thread_index], session_index);
- __sync_fetch_and_add (&ecm->ready_connections, 1);
+ clib_atomic_fetch_add (&ecm->ready_connections, 1);
if (ecm->ready_connections == ecm->expected_connections)
{
ecm->run_test = ECHO_CLIENTS_RUNNING;