aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-10-28 21:22:04 -0700
committerFlorin Coras <florin.coras@gmail.com>2020-10-29 22:01:47 +0000
commit62877029aac3e05a1e1db579aeaad42bca5a70a4 (patch)
tree43668b91d5d7e6e9206ffa75d1eaa055e5883f48 /src/vcl/vppcom.c
parent06ac4bbc3234d8538b12c5b7c101a3ee56616e2a (diff)
vcl: support fifo segments with ct sessions
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Icf0194f569da88f26a4cba29d8fe75a0bddfc144
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r--src/vcl/vppcom.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 95d8b41bccb..fd866155b4d 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1991,16 +1991,15 @@ vppcom_session_read_segments (uint32_t session_handle,
is_nonblocking = vcl_session_has_attr (s, VCL_SESS_ATTR_NONBLOCK);
is_ct = vcl_session_is_ct (s);
mq = wrk->app_event_queue;
- rx_fifo = s->rx_fifo;
+ rx_fifo = is_ct ? s->ct_rx_fifo : s->rx_fifo;
s->flags &= ~VCL_SESSION_F_HAS_RX_EVT;
- if (is_ct)
- svm_fifo_unset_event (s->rx_fifo);
-
if (svm_fifo_is_empty_cons (rx_fifo))
{
if (is_nonblocking)
{
+ if (is_ct)
+ svm_fifo_unset_event (s->rx_fifo);
svm_fifo_unset_event (rx_fifo);
return VPPCOM_EWOULDBLOCK;
}
@@ -2009,6 +2008,8 @@ vppcom_session_read_segments (uint32_t session_handle,
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);
svm_msg_q_lock (mq);
if (svm_msg_q_is_empty (mq))
@@ -2030,9 +2031,11 @@ vppcom_session_read_segments (uint32_t session_handle,
if (svm_fifo_max_dequeue_cons (rx_fifo) == n_read)
{
- svm_fifo_unset_event (s->rx_fifo);
+ if (is_ct)
+ svm_fifo_unset_event (s->rx_fifo);
+ svm_fifo_unset_event (rx_fifo);
if (svm_fifo_max_dequeue_cons (rx_fifo) != n_read
- && svm_fifo_set_event (s->rx_fifo)
+ && svm_fifo_set_event (rx_fifo)
&& vcl_session_has_attr (s, VCL_SESS_ATTR_NONBLOCK))
{
session_event_t *e;
@@ -2051,12 +2054,14 @@ vppcom_session_free_segments (uint32_t session_handle, uint32_t n_bytes)
{
vcl_worker_t *wrk = vcl_worker_get_current ();
vcl_session_t *s;
+ u8 is_ct;
s = vcl_session_get_w_handle (wrk, session_handle);
if (PREDICT_FALSE (!s || (s->flags & VCL_SESSION_F_IS_VEP)))
return;
- svm_fifo_dequeue_drop (s->rx_fifo, n_bytes);
+ is_ct = vcl_session_is_ct (s);
+ svm_fifo_dequeue_drop (is_ct ? s->ct_rx_fifo : s->rx_fifo, n_bytes);
ASSERT (s->rx_bytes_pending < n_bytes);
s->rx_bytes_pending -= n_bytes;