aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-06-28 12:45:12 -0700
committerDave Barach <openvpp@barachs.net>2019-06-29 00:30:41 +0000
commit2d379d8cc7612c2a29670aa66d3d2b0a4007b951 (patch)
tree01b42acc4676025013e878295fce9e4a12c0a747 /src
parente3bbf5b565132515800dc4e7a137875d9865a5a6 (diff)
svm: rename fifo tx notifications to reflect use
Type: refactor Change-Id: I651db44acdcb666a9c63e1037352cf88c68795b5 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/hs_apps/sapi/quic_echo.c4
-rw-r--r--src/plugins/quic/quic.c14
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c2
-rw-r--r--src/svm/svm_fifo.h84
-rw-r--r--src/vcl/vppcom.c16
-rw-r--r--src/vnet/session/session.c4
-rw-r--r--src/vnet/session/session_node.c2
7 files changed, 63 insertions, 63 deletions
diff --git a/src/plugins/hs_apps/sapi/quic_echo.c b/src/plugins/hs_apps/sapi/quic_echo.c
index 3c9ddcc102d..fa8e69febde 100644
--- a/src/plugins/hs_apps/sapi/quic_echo.c
+++ b/src/plugins/hs_apps/sapi/quic_echo.c
@@ -638,7 +638,7 @@ echo_session_dequeue_notify (echo_session_t * s)
int rv;
rv = app_send_io_evt_to_vpp (s->vpp_evt_q, s->rx_fifo->master_session_index,
SESSION_IO_EVT_RX, SVM_Q_WAIT);
- svm_fifo_clear_tx_ntf (s->rx_fifo);
+ svm_fifo_clear_deq_ntf (s->rx_fifo);
if (rv)
ECHO_FAIL ("app_send_io_evt_to_vpp errored %d", rv);
}
@@ -825,7 +825,7 @@ recv_data_chunk (echo_main_t * em, echo_session_t * s, u8 * rx_buf)
n_read = app_recv_stream ((app_session_t *) s, rx_buf, vec_len (rx_buf));
if (n_read <= 0)
return 0;
- if (svm_fifo_needs_tx_ntf (s->rx_fifo, n_read))
+ if (svm_fifo_needs_deq_ntf (s->rx_fifo, n_read))
echo_session_dequeue_notify (s);
if (em->test_return_packets)
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 93c01628e80..a990d0448bf 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -586,9 +586,9 @@ quic_accept_stream (void *s)
quicly_reset_stream (stream, QUIC_APP_ALLOCATION_ERROR);
return;
}
- svm_fifo_add_want_tx_ntf (stream_session->rx_fifo,
- SVM_FIFO_WANT_TX_NOTIF_IF_FULL |
- SVM_FIFO_WANT_TX_NOTIF_IF_EMPTY);
+ svm_fifo_add_want_deq_ntf (stream_session->rx_fifo,
+ SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL |
+ SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY);
rv = app_worker_accept_notify (app_wrk, stream_session);
if (rv)
@@ -1243,9 +1243,9 @@ quic_connect_new_stream (session_endpoint_cfg_t * sep)
return app_worker_connect_notify (app_wrk, NULL, sep->opaque);
}
- svm_fifo_add_want_tx_ntf (stream_session->rx_fifo,
- SVM_FIFO_WANT_TX_NOTIF_IF_FULL |
- SVM_FIFO_WANT_TX_NOTIF_IF_EMPTY);
+ svm_fifo_add_want_deq_ntf (stream_session->rx_fifo,
+ SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL |
+ SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY);
stream_session->session_state = SESSION_STATE_READY;
if (app_worker_connect_notify (app_wrk, stream_session, sep->opaque))
@@ -1842,7 +1842,7 @@ quic_custom_app_rx_callback (transport_connection_t * tc)
session_t *stream_session = session_get (tc->s_index, tc->thread_index);
QUIC_DBG (2, "Received app READ notification");
quic_ack_rx_data (stream_session);
- svm_fifo_reset_tx_ntf (stream_session->rx_fifo);
+ svm_fifo_reset_has_deq_ntf (stream_session->rx_fifo);
return 0;
}
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index 4d4c4c37170..6cb8ff08b7f 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -333,7 +333,7 @@ openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session)
}
}
- if (svm_fifo_needs_tx_ntf (app_session->tx_fifo, wrote))
+ if (svm_fifo_needs_deq_ntf (app_session->tx_fifo, wrote))
session_dequeue_notify (app_session);
if (wrote < deq_max)
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h
index ce73be2d0f0..9b23d7e8e6f 100644
--- a/src/svm/svm_fifo.h
+++ b/src/svm/svm_fifo.h
@@ -40,13 +40,13 @@ typedef struct
#define SVM_FIFO_INVALID_INDEX ((u32)~0)
#define SVM_FIFO_MAX_EVT_SUBSCRIBERS 7
-typedef enum svm_fifo_tx_ntf_
+typedef enum svm_fifo_deq_ntf_
{
- SVM_FIFO_NO_TX_NOTIF = 0,
- SVM_FIFO_WANT_TX_NOTIF = 1,
- SVM_FIFO_WANT_TX_NOTIF_IF_FULL = 2,
- SVM_FIFO_WANT_TX_NOTIF_IF_EMPTY = 4,
-} svm_fifo_tx_ntf_t;
+ SVM_FIFO_NO_DEQ_NOTIF = 0, /**< No notification requested */
+ SVM_FIFO_WANT_DEQ_NOTIF = 1, /**< Notify on dequeue */
+ SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL = 2, /**< Notify on transition from full */
+ SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY = 4, /**< Notify on transition to empty */
+} svm_fifo_deq_ntf_t;
typedef struct
{
@@ -100,8 +100,8 @@ typedef struct _svm_fifo
u32 head; /**< fifo head position/byte */
svm_fifo_chunk_t *head_chunk; /**< tracks chunk where head lands */
svm_fifo_chunk_t *ooo_deq; /**< last chunk used for ooo dequeue */
- volatile u32 want_tx_ntf; /**< producer wants nudge */
- volatile u32 has_tx_ntf;
+ volatile u32 want_deq_ntf; /**< producer wants nudge */
+ volatile u32 has_deq_ntf;
CLIB_CACHE_LINE_ALIGN_MARK (producer);
u32 tail; /**< fifo tail position/byte */
@@ -741,97 +741,97 @@ svm_fifo_unset_event (svm_fifo_t * f)
}
/**
- * Set specific want tx notification flag
+ * Set specific want notification flag
*
- * For list of flags see @ref svm_fifo_tx_ntf_t
+ * For list of flags see @ref svm_fifo_deq_ntf_t
*
* @param f fifo
* @param ntf_type type of notification requested
*/
static inline void
-svm_fifo_add_want_tx_ntf (svm_fifo_t * f, u8 ntf_type)
+svm_fifo_add_want_deq_ntf (svm_fifo_t * f, u8 ntf_type)
{
- f->want_tx_ntf |= ntf_type;
+ f->want_deq_ntf |= ntf_type;
}
/**
- * Clear specific want tx notification flag
+ * Clear specific want notification flag
*
- * For list of flags see @ref svm_fifo_tx_ntf_t
+ * For list of flags see @ref svm_fifo_ntf_t
*
* @param f fifo
* @param ntf_type type of notification to be cleared
*/
static inline void
-svm_fifo_del_want_tx_ntf (svm_fifo_t * f, u8 ntf_type)
+svm_fifo_del_want_deq_ntf (svm_fifo_t * f, u8 ntf_type)
{
- f->want_tx_ntf &= ~ntf_type;
+ f->want_deq_ntf &= ~ntf_type;
}
/**
- * Clear the want tx notification flag and set has tx notification
+ * Clear the want notification flag and set has notification
*
- * Should be used after enqueuing a tx event. This clears the
- * SVM_FIFO_WANT_TX_NOTIF flag but it does not clear
- * SVM_FIFO_WANT_TX_NOTIF_IF_FULL. If the latter was set, has_tx_ntf is
- * set to avoid enqueueing tx events for for all dequeue operations until
+ * Should be used after enqueuing an event. This clears the
+ * SVM_FIFO_WANT_NOTIF flag but it does not clear
+ * SVM_FIFO_WANT_NOTIF_IF_FULL. If the latter was set, has_ntf is
+ * set to avoid enqueueing events for for all dequeue operations until
* it is manually cleared.
*
* @param f fifo
*/
static inline void
-svm_fifo_clear_tx_ntf (svm_fifo_t * f)
+svm_fifo_clear_deq_ntf (svm_fifo_t * f)
{
- /* Set the flag if want_tx_notif_if_full was the only ntf requested */
- f->has_tx_ntf = f->want_tx_ntf == SVM_FIFO_WANT_TX_NOTIF_IF_FULL;
- svm_fifo_del_want_tx_ntf (f, SVM_FIFO_WANT_TX_NOTIF);
+ /* Set the flag if want_notif_if_full was the only ntf requested */
+ f->has_deq_ntf = f->want_deq_ntf == SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL;
+ svm_fifo_del_want_deq_ntf (f, SVM_FIFO_WANT_DEQ_NOTIF);
}
/**
- * Clear has tx notification flag
+ * Clear has notification flag
*
- * The fifo generates only one event per SVM_FIFO_WANT_TX_NOTIF_IF_FULL
- * request and sets has_tx_ntf. To received new events the flag must be
+ * The fifo generates only one event per SVM_FIFO_WANT_NOTIF_IF_FULL
+ * request and sets has_ntf. To received new events the flag must be
* cleared using this function.
*
* @param f fifo
*/
static inline void
-svm_fifo_reset_tx_ntf (svm_fifo_t * f)
+svm_fifo_reset_has_deq_ntf (svm_fifo_t * f)
{
- f->has_tx_ntf = 0;
+ f->has_deq_ntf = 0;
}
/**
- * Check if fifo needs tx notification
+ * Check if fifo needs dequeue notification
*
- * Determines based on tx notification request flags and state of the fifo if
- * a tx io event should be generated.
+ * Determines based on notification request flags and state of the fifo if
+ * an event should be generated.
*
* @param f fifo
* @param n_last_deq number of bytes last dequeued
- * @return 1 if tx io event should be generated, 0 otherwise
+ * @return 1 if event should be generated, 0 otherwise
*/
static inline u8
-svm_fifo_needs_tx_ntf (svm_fifo_t * f, u32 n_last_deq)
+svm_fifo_needs_deq_ntf (svm_fifo_t * f, u32 n_last_deq)
{
- u8 want_ntf = f->want_tx_ntf;
+ u8 want_ntf = f->want_deq_ntf;
- if (PREDICT_TRUE (want_ntf == SVM_FIFO_NO_TX_NOTIF))
+ if (PREDICT_TRUE (want_ntf == SVM_FIFO_NO_DEQ_NOTIF))
return 0;
- else if (want_ntf & SVM_FIFO_WANT_TX_NOTIF)
+ else if (want_ntf & SVM_FIFO_WANT_DEQ_NOTIF)
return 1;
- if (want_ntf & SVM_FIFO_WANT_TX_NOTIF_IF_FULL)
+ if (want_ntf & SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL)
{
u32 max_deq = svm_fifo_max_dequeue_cons (f);
u32 nitems = f->nitems;
- if (!f->has_tx_ntf && max_deq < nitems
+ if (!f->has_deq_ntf && max_deq < nitems
&& max_deq + n_last_deq >= nitems)
return 1;
}
- if (want_ntf & SVM_FIFO_WANT_TX_NOTIF_IF_EMPTY)
+ if (want_ntf & SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY)
{
- if (!f->has_tx_ntf && svm_fifo_is_empty (f))
+ if (!f->has_deq_ntf && svm_fifo_is_empty (f))
return 1;
}
return 0;
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 8a05e3fde16..9a351d8aca6 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1535,11 +1535,11 @@ vppcom_session_read_internal (uint32_t session_handle, void *buf, int n,
svm_fifo_unset_event (s->rx_fifo);
/* Cut-through sessions might request tx notifications on rx fifos */
- if (PREDICT_FALSE (rx_fifo->want_tx_ntf))
+ if (PREDICT_FALSE (rx_fifo->want_deq_ntf))
{
app_send_io_evt_to_vpp (s->vpp_evt_q, s->rx_fifo->master_session_index,
SESSION_IO_EVT_RX, SVM_Q_WAIT);
- svm_fifo_reset_tx_ntf (s->rx_fifo);
+ svm_fifo_reset_has_deq_ntf (s->rx_fifo);
}
VDBG (2, "session %u[0x%llx]: read %d bytes from (%p)", s->session_index,
@@ -1703,7 +1703,7 @@ vppcom_session_write_inline (uint32_t session_handle, void *buf, size_t n,
}
while (svm_fifo_is_full_prod (tx_fifo))
{
- svm_fifo_add_want_tx_ntf (tx_fifo, SVM_FIFO_WANT_TX_NOTIF);
+ svm_fifo_add_want_deq_ntf (tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
if (vcl_session_is_closing (s))
return vcl_session_closing_error (s);
svm_msg_q_lock (mq);
@@ -2023,7 +2023,7 @@ vppcom_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
bits_set++;
}
else
- svm_fifo_add_want_tx_ntf (session->tx_fifo, SVM_FIFO_WANT_TX_NOTIF);
+ svm_fifo_add_want_deq_ntf (session->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
}));
check_rd:
@@ -2232,8 +2232,8 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
vep_session->vep.next_sh = session_handle;
if (session->tx_fifo)
- svm_fifo_add_want_tx_ntf (session->tx_fifo,
- SVM_FIFO_WANT_TX_NOTIF_IF_FULL);
+ svm_fifo_add_want_deq_ntf (session->tx_fifo,
+ SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
VDBG (1, "EPOLL_CTL_ADD: vep_sh %u, sh %u, events 0x%x, data 0x%llx!",
vep_handle, session_handle, event->events, event->data.u64);
@@ -2317,7 +2317,7 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
session->is_vep_session = 0;
if (session->tx_fifo)
- svm_fifo_del_want_tx_ntf (session->tx_fifo, SVM_FIFO_NO_TX_NOTIF);
+ svm_fifo_del_want_deq_ntf (session->tx_fifo, SVM_FIFO_NO_DEQ_NOTIF);
VDBG (1, "EPOLL_CTL_DEL: vep_idx %u, sh %u!", vep_handle,
session_handle);
@@ -2371,7 +2371,7 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
add_event = 1;
events[*num_ev].events |= EPOLLOUT;
session_evt_data = session->vep.ev.data.u64;
- svm_fifo_reset_tx_ntf (session->tx_fifo);
+ svm_fifo_reset_has_deq_ntf (session->tx_fifo);
break;
case SESSION_CTRL_EVT_ACCEPTED:
session = vcl_session_accepted (wrk,
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 3a6d7e29e45..3732e4cb708 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -449,7 +449,7 @@ session_tx_fifo_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
rv = svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
- if (svm_fifo_needs_tx_ntf (s->tx_fifo, max_bytes))
+ if (svm_fifo_needs_deq_ntf (s->tx_fifo, max_bytes))
session_dequeue_notify (s);
return rv;
@@ -549,7 +549,7 @@ session_dequeue_notify (session_t * s)
return session_notify_subscribers (app_wrk->app_index, s,
s->tx_fifo, SESSION_IO_EVT_TX);
- svm_fifo_clear_tx_ntf (s->tx_fifo);
+ svm_fifo_clear_deq_ntf (s->tx_fifo);
return 0;
}
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 8d01938ad85..8abfb2f510f 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -795,7 +795,7 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
if (svm_fifo_set_event (ctx->s->tx_fifo))
vec_add1 (wrk->pending_event_vector, *e);
- if (svm_fifo_needs_tx_ntf (ctx->s->tx_fifo, ctx->max_len_to_snd))
+ if (svm_fifo_needs_deq_ntf (ctx->s->tx_fifo, ctx->max_len_to_snd))
session_dequeue_notify (ctx->s);
}
return SESSION_TX_OK;