summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_common.c6
-rw-r--r--src/svm/message_queue.c5
-rw-r--r--src/vnet/session/application_interface.h5
-rw-r--r--src/vnet/session/session.c15
4 files changed, 7 insertions, 24 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.c b/src/plugins/hs_apps/sapi/vpp_echo_common.c
index 013affd0420..deeb3b14d93 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_common.c
+++ b/src/plugins/hs_apps/sapi/vpp_echo_common.c
@@ -463,12 +463,6 @@ echo_send_rpc (echo_main_t * em, void *fp, void *arg, u32 opaque)
return -2;
}
msg = svm_msg_q_alloc_msg_w_ring (em->rpc_msq_queue, 0);
- if (PREDICT_FALSE (svm_msg_q_msg_is_invalid (&msg)))
- {
- ECHO_LOG (1, "RPC msg is invalid");
- svm_msg_q_unlock (em->rpc_msq_queue);
- return -2;
- }
evt = (echo_rpc_msg_t *) svm_msg_q_msg_data (em->rpc_msq_queue, &msg);
evt->arg = arg;
evt->opaque = opaque;
diff --git a/src/svm/message_queue.c b/src/svm/message_queue.c
index a40c4a46a39..6113450e7cb 100644
--- a/src/svm/message_queue.c
+++ b/src/svm/message_queue.c
@@ -127,11 +127,6 @@ svm_msg_q_lock_and_alloc_msg_w_ring (svm_msg_q_t * mq, u32 ring_index,
return -2;
}
*msg = svm_msg_q_alloc_msg_w_ring (mq, ring_index);
- if (PREDICT_FALSE (svm_msg_q_msg_is_invalid (msg)))
- {
- svm_msg_q_unlock (mq);
- return -2;
- }
}
else
{
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 6cc1af4d78b..bacac61e81f 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -428,11 +428,6 @@ app_send_io_evt_to_vpp (svm_msg_q_t * mq, u32 session_index, u8 evt_type,
return -2;
}
msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING);
- if (PREDICT_FALSE (svm_msg_q_msg_is_invalid (&msg)))
- {
- svm_msg_q_unlock (mq);
- return -2;
- }
evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
evt->session_index = session_index;
evt->event_type = evt_type;
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 72f4ab747d7..61d61b93c5d 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -41,17 +41,11 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index,
svm_msg_q_unlock (mq);
return -2;
}
- msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING);
- if (PREDICT_FALSE (svm_msg_q_msg_is_invalid (&msg)))
- {
- svm_msg_q_unlock (mq);
- return -2;
- }
- evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
- evt->event_type = evt_type;
switch (evt_type)
{
case SESSION_CTRL_EVT_RPC:
+ msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING);
+ evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
evt->rpc_args.fp = data;
evt->rpc_args.arg = args;
break;
@@ -59,11 +53,15 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index,
case SESSION_IO_EVT_TX:
case SESSION_IO_EVT_TX_FLUSH:
case SESSION_IO_EVT_BUILTIN_RX:
+ msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING);
+ evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
evt->session_index = *(u32 *) data;
break;
case SESSION_IO_EVT_BUILTIN_TX:
case SESSION_CTRL_EVT_CLOSE:
case SESSION_CTRL_EVT_RESET:
+ msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING);
+ evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
evt->session_handle = session_handle ((session_t *) data);
break;
default:
@@ -71,6 +69,7 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index,
svm_msg_q_unlock (mq);
return -1;
}
+ evt->event_type = evt_type;
svm_msg_q_add_and_unlock (mq, &msg);
return 0;