aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-09-18 09:56:21 -0700
committerFlorin Coras <fcoras@cisco.com>2023-09-18 10:22:35 -0700
commitae036d3b7d911788a9ead084bf89dd72c763d9f1 (patch)
treed682e732bfaea388cdb1b8f4ddcb0e20a80f565f /src/vcl/vppcom.c
parent604c627dc31473ead17d5011fb43d6609af2b752 (diff)
vcl: unset fifo evt before size check
For blocking sessions, if fifo event still active before size check it could lead to vpp not generating an event because of race to check flag in vpp and to eventually unset flag in vcl. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I0e350b9ff92a4e08a9249345ae224589c09d305b
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r--src/vcl/vppcom.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 4b2f1f15fbe..e929fa1b6e3 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -2052,13 +2052,13 @@ vppcom_session_read_internal (uint32_t session_handle, void *buf, int n,
if (svm_fifo_is_empty_cons (rx_fifo))
{
+ if (is_ct)
+ svm_fifo_unset_event (s->rx_fifo);
+ svm_fifo_unset_event (rx_fifo);
if (is_nonblocking)
{
if (vcl_session_is_closing (s))
return vcl_session_closing_error (s);
- if (is_ct)
- svm_fifo_unset_event (s->rx_fifo);
- svm_fifo_unset_event (rx_fifo);
return VPPCOM_EWOULDBLOCK;
}
while (svm_fifo_is_empty_cons (rx_fifo))
@@ -2164,11 +2164,13 @@ vppcom_session_read_segments (uint32_t session_handle,
if (svm_fifo_is_empty_cons (rx_fifo))
{
+ if (is_ct)
+ svm_fifo_unset_event (s->rx_fifo);
+ svm_fifo_unset_event (rx_fifo);
if (is_nonblocking)
{
- if (is_ct)
- svm_fifo_unset_event (s->rx_fifo);
- svm_fifo_unset_event (rx_fifo);
+ if (vcl_session_is_closing (s))
+ return vcl_session_closing_error (s);
return VPPCOM_EWOULDBLOCK;
}
while (svm_fifo_is_empty_cons (rx_fifo))