diff options
author | Florin Coras <fcoras@cisco.com> | 2019-03-21 13:54:53 -0700 |
---|---|---|
committer | Florin Coras <fcoras@cisco.com> | 2019-03-21 13:56:02 -0700 |
commit | 4b76112dc43b775abd3deb2d9f65458ca08424ee (patch) | |
tree | 1251f033f1162b1ef24be81ed8d6f3d48d8ef1ed /src/vnet/session/application_interface.h | |
parent | 192b13f96d6b4d1b4cbbb64a3d447329bf2ba900 (diff) |
session/fifo: make event unset atomic
Ensures that fifo cursize loads cannot be speculated to before the event
unset.
Change-Id: Ia7c20c510d58f26a8e9b82d3982c6d4143a3a4d6
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application_interface.h')
-rw-r--r-- | src/vnet/session/application_interface.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 56d034e18ed..8323e72e768 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -475,9 +475,10 @@ app_send_dgram_raw (svm_fifo_t * f, app_session_transport_t * at, rv = svm_fifo_enqueue_nowait (f, sizeof (hdr), (u8 *) & hdr); ASSERT (rv == sizeof (hdr)); - if ((rv = svm_fifo_enqueue_nowait (f, actual_write, data)) > 0) + rv = svm_fifo_enqueue_nowait (f, actual_write, data); + if (do_evt) { - if (do_evt && svm_fifo_set_event (f)) + if (rv > 0 && svm_fifo_set_event (f)) app_send_io_evt_to_vpp (vpp_evt_q, f->master_session_index, evt_type, noblock); } @@ -499,9 +500,10 @@ app_send_stream_raw (svm_fifo_t * f, svm_msg_q_t * vpp_evt_q, u8 * data, { int rv; - if ((rv = svm_fifo_enqueue_nowait (f, len, data)) > 0) + rv = svm_fifo_enqueue_nowait (f, len, data); + if (do_evt) { - if (do_evt && svm_fifo_set_event (f)) + if (rv > 0 && svm_fifo_set_event (f)) app_send_io_evt_to_vpp (vpp_evt_q, f->master_session_index, evt_type, noblock); } |