aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-10 08:17:03 -0800
committerDave Barach <openvpp@barachs.net>2018-01-11 22:06:14 +0000
commitaf0ff5af0cd471033169e63c6111d23cd801928c (patch)
tree26abdbe9637ec38416ea819bc8d0ad1e0a19dfe1 /src/vnet
parentee7e1f50726490990b593b850857b3877c9a687f (diff)
api: fix handlers that explicitly depend on svm queue
Fixes the remainig apis that explicitly check svm queue length. Change-Id: I6055c7c50050affee3098e162e15fb12c205e5db Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ip/ip_api.c52
-rw-r--r--src/vnet/l2/l2_fib.c16
-rw-r--r--src/vnet/mfib/mfib_signal.c4
-rw-r--r--src/vnet/mfib/mfib_signal.h6
4 files changed, 38 insertions, 40 deletions
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 2ea1e411764..f4db43c9df6 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -1824,7 +1824,7 @@ static void
}
void
-vl_mfib_signal_send_one (svm_queue_t * q,
+vl_mfib_signal_send_one (vl_api_registration_t * reg,
u32 context, const mfib_signal_t * mfs)
{
vl_api_mfib_signal_details_t *mp;
@@ -1873,21 +1873,19 @@ vl_mfib_signal_send_one (svm_queue_t * q,
mp->ip_packet_len = 0;
}
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
static void
vl_api_mfib_signal_dump_t_handler (vl_api_mfib_signal_dump_t * mp)
{
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
- while (q->cursize < q->maxsize && mfib_signal_send_one (q, mp->context))
+ while (vl_api_can_send_msg (reg) && mfib_signal_send_one (reg, mp->context))
;
}
@@ -2107,7 +2105,7 @@ handle_ip4_arp_event (u32 pool_index)
vlib_main_t *vm = vam->vlib_main;
vl_api_ip4_arp_event_t *event;
vl_api_ip4_arp_event_t *mp;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
/* Client can cancel, die, etc. */
if (pool_is_free_index (vam->arp_events, pool_index))
@@ -2115,8 +2113,8 @@ handle_ip4_arp_event (u32 pool_index)
event = pool_elt_at_index (vam->arp_events, pool_index);
- q = vl_api_client_index_to_input_queue (event->client_index);
- if (!q)
+ reg = vl_api_client_index_to_registration (event->client_index);
+ if (!reg)
{
(void) vnet_add_del_ip4_arp_change_event
(vnm, arp_change_delete_callback,
@@ -2126,11 +2124,11 @@ handle_ip4_arp_event (u32 pool_index)
return;
}
- if (q->cursize < q->maxsize)
+ if (vl_api_can_send_msg (reg))
{
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memcpy (mp, event, sizeof (*mp));
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
else
{
@@ -2156,7 +2154,7 @@ handle_ip6_nd_event (u32 pool_index)
vlib_main_t *vm = vam->vlib_main;
vl_api_ip6_nd_event_t *event;
vl_api_ip6_nd_event_t *mp;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
/* Client can cancel, die, etc. */
if (pool_is_free_index (vam->nd_events, pool_index))
@@ -2164,8 +2162,8 @@ handle_ip6_nd_event (u32 pool_index)
event = pool_elt_at_index (vam->nd_events, pool_index);
- q = vl_api_client_index_to_input_queue (event->client_index);
- if (!q)
+ reg = vl_api_client_index_to_registration (event->client_index);
+ if (!reg)
{
(void) vnet_add_del_ip6_nd_change_event
(vnm, nd_change_delete_callback,
@@ -2175,11 +2173,11 @@ handle_ip6_nd_event (u32 pool_index)
return;
}
- if (q->cursize < q->maxsize)
+ if (vl_api_can_send_msg (reg))
{
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memcpy (mp, event, sizeof (*mp));
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
else
{
@@ -2331,9 +2329,9 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
/* *INDENT-OFF* */
pool_foreach(reg, vpe_api_main.wc_ip4_arp_events_registrations,
({
- svm_queue_t *q;
- q = vl_api_client_index_to_input_queue (reg->client_index);
- if (q && q->cursize < q->maxsize)
+ vl_api_registration_t *vl_reg;
+ vl_reg = vl_api_client_index_to_registration (reg->client_index);
+ if (reg && vl_api_can_send_msg (vl_reg))
{
vl_api_ip4_arp_event_t * event = vl_msg_api_alloc (sizeof *event);
memset (event, 0, sizeof *event);
@@ -2344,7 +2342,7 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
event->address = arp_events[i].ip4;
event->sw_if_index = htonl(arp_events[i].sw_if_index);
memcpy(event->new_mac, arp_events[i].mac, sizeof event->new_mac);
- vl_msg_api_send_shmem (q, (u8 *) &event);
+ vl_api_send_msg (vl_reg, (u8 *) event);
}
}));
/* *INDENT-ON* */
@@ -2370,9 +2368,9 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
/* *INDENT-OFF* */
pool_foreach(reg, vpe_api_main.wc_ip6_nd_events_registrations,
({
- svm_queue_t *q;
- q = vl_api_client_index_to_input_queue (reg->client_index);
- if (q && q->cursize < q->maxsize)
+ vl_api_registration_t *vl_reg;
+ vl_reg = vl_api_client_index_to_registration (reg->client_index);
+ if (vl_reg && vl_api_can_send_msg (vl_reg))
{
vl_api_ip6_nd_event_t * event = vl_msg_api_alloc (sizeof *event);
memset (event, 0, sizeof *event);
@@ -2383,7 +2381,7 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
memcpy(event->address, nd_events[i].ip6.as_u8, sizeof event->address);
event->sw_if_index = htonl(nd_events[i].sw_if_index);
memcpy(event->new_mac, nd_events[i].mac, sizeof event->new_mac);
- vl_msg_api_send_shmem (q, (u8 *) &event);
+ vl_api_send_msg (vl_reg, (u8 *) event);
}
}));
/* *INDENT-ON* */
diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c
index 66bb8e3f3c7..55cffc8047c 100644
--- a/src/vnet/l2/l2_fib.c
+++ b/src/vnet/l2/l2_fib.c
@@ -962,12 +962,12 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only)
u32 client = lm->client_pid;
u32 cl_idx = lm->client_index;
vl_api_l2_macs_event_t *mp = 0;
- svm_queue_t *q = 0;
+ vl_api_registration_t *reg = 0;
if (client)
{
mp = allocate_mac_evt_buf (client, cl_idx);
- q = vl_api_client_index_to_input_queue (lm->client_index);
+ reg = vl_api_client_index_to_registration (lm->client_index);
}
for (i = 0; i < h->nbuckets; i++)
@@ -1016,15 +1016,15 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only)
if (PREDICT_FALSE (evt_idx >= fm->max_macs_in_event))
{
/* event message full, send it and start a new one */
- if (q && (q->cursize < q->maxsize))
+ if (reg && vl_api_can_send_msg (reg))
{
mp->n_macs = htonl (evt_idx);
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
mp = allocate_mac_evt_buf (client, cl_idx);
}
else
{
- if (q)
+ if (reg)
clib_warning ("MAC event to pid %d queue stuffed!"
" %d MAC entries lost", client,
evt_idx);
@@ -1101,14 +1101,14 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only)
/* send any outstanding mac event message else free message buffer */
if (evt_idx)
{
- if (q && (q->cursize < q->maxsize))
+ if (reg && vl_api_can_send_msg (reg))
{
mp->n_macs = htonl (evt_idx);
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
else
{
- if (q)
+ if (reg)
clib_warning ("MAC event to pid %d queue stuffed!"
" %d MAC entries lost", client, evt_idx);
vl_msg_api_free (mp);
diff --git a/src/vnet/mfib/mfib_signal.c b/src/vnet/mfib/mfib_signal.c
index 38e4bbabb3c..ce9a664c548 100644
--- a/src/vnet/mfib/mfib_signal.c
+++ b/src/vnet/mfib/mfib_signal.c
@@ -91,7 +91,7 @@ mfib_signal_lock_release (void)
}
int
-mfib_signal_send_one (struct _svm_queue *q,
+mfib_signal_send_one (struct vl_api_registration_ *reg,
u32 context)
{
u32 li, si;
@@ -121,7 +121,7 @@ mfib_signal_send_one (struct _svm_queue *q,
~MFIB_ITF_FLAG_SIGNAL_PRESENT);
- vl_mfib_signal_send_one(q, context, mfs);
+ vl_mfib_signal_send_one(reg, context, mfs);
/*
* with the lock held, return the resoruces of the signals posted
diff --git a/src/vnet/mfib/mfib_signal.h b/src/vnet/mfib/mfib_signal.h
index 4dd60a6dace..f6609b3d8c1 100644
--- a/src/vnet/mfib/mfib_signal.h
+++ b/src/vnet/mfib/mfib_signal.h
@@ -47,12 +47,12 @@ extern void mfib_signal_remove_itf(const mfib_itf_t *mfi);
extern void mfib_signal_module_init(void);
-struct _svm_queue;
+struct vl_api_registration_;
-extern void vl_mfib_signal_send_one(struct _svm_queue *q,
+extern void vl_mfib_signal_send_one(struct vl_api_registration_ *q,
u32 context,
const mfib_signal_t *mfs);
-extern int mfib_signal_send_one(struct _svm_queue *q,
+extern int mfib_signal_send_one(struct vl_api_registration_ *reg,
u32 context);
#endif