aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp/lisp_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/lisp-cp/lisp_api.c')
-rw-r--r--src/vnet/lisp-cp/lisp_api.c147
1 files changed, 55 insertions, 92 deletions
diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c
index 9946f28f131..cb21dd1b155 100644
--- a/src/vnet/lisp-cp/lisp_api.c
+++ b/src/vnet/lisp-cp/lisp_api.c
@@ -420,7 +420,6 @@ vl_api_lisp_use_petr_t_handler (vl_api_lisp_use_petr_t * mp)
static void
vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp)
{
- svm_queue_t *q = NULL;
vl_api_show_lisp_use_petr_reply_t *rmp = NULL;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
mapping_t *m;
@@ -430,12 +429,6 @@ vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp)
u8 status = 0;
gid_address_t addr;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
memset (&addr, 0, sizeof (addr));
status = lcm->flags & LISP_FLAG_USE_PETR;
if (status)
@@ -583,7 +576,8 @@ send_reply:
static void
send_lisp_locator_details (lisp_cp_main_t * lcm,
- locator_t * loc, svm_queue_t * q, u32 context)
+ locator_t * loc, vl_api_registration_t * reg,
+ u32 context)
{
vl_api_lisp_locator_details_t *rmp;
@@ -605,25 +599,23 @@ send_lisp_locator_details (lisp_cp_main_t * lcm,
rmp->priority = loc->priority;
rmp->weight = loc->weight;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_lisp_locator_dump_t_handler (vl_api_lisp_locator_dump_t * mp)
{
u8 *ls_name = 0;
- svm_queue_t *q = 0;
+ vl_api_registration_t *reg = 0;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
locator_set_t *lsit = 0;
locator_t *loc = 0;
u32 ls_index = ~0, *locit = 0;
uword *p = 0;
- 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;
if (mp->is_index_set)
ls_index = htonl (mp->ls_index);
@@ -647,7 +639,7 @@ vl_api_lisp_locator_dump_t_handler (vl_api_lisp_locator_dump_t * mp)
vec_foreach (locit, lsit->locator_indices)
{
loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
- send_lisp_locator_details (lcm, loc, q, mp->context);
+ send_lisp_locator_details (lcm, loc, reg, mp->context);
};
out:
vec_free (ls_name);
@@ -656,7 +648,8 @@ out:
static void
send_lisp_locator_set_details (lisp_cp_main_t * lcm,
locator_set_t * lsit,
- svm_queue_t * q, u32 context, u32 ls_index)
+ vl_api_registration_t * reg, u32 context,
+ u32 ls_index)
{
vl_api_lisp_locator_set_details_t *rmp;
u8 *str = 0;
@@ -680,22 +673,20 @@ send_lisp_locator_set_details (lisp_cp_main_t * lcm,
vec_free (str);
}
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t * mp)
{
- svm_queue_t *q = NULL;
+ vl_api_registration_t *reg;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
locator_set_t *lsit = NULL;
u8 filter;
- 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;
filter = mp->filter;
/* *INDENT-OFF* */
@@ -706,7 +697,7 @@ vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t * mp)
{
continue;
}
- send_lisp_locator_set_details (lcm, lsit, q, mp->context,
+ send_lisp_locator_set_details (lcm, lsit, reg, mp->context,
lsit - lcm->locator_set_pool);
}));
/* *INDENT-ON* */
@@ -766,7 +757,8 @@ fid_type_to_api_type (fid_address_t * fid)
static void
send_lisp_eid_table_details (mapping_t * mapit,
- svm_queue_t * q, u32 context, u8 filter)
+ vl_api_registration_t * reg, u32 context,
+ u8 filter)
{
fid_address_t *fid;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
@@ -854,23 +846,21 @@ send_lisp_eid_table_details (mapping_t * mapit,
rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
memcpy (rmp->key, mapit->key, vec_len (mapit->key));
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
{
u32 mi;
- svm_queue_t *q = NULL;
+ vl_api_registration_t *reg;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
mapping_t *mapit = NULL;
gid_address_t _eid, *eid = &_eid;
- 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;
if (mp->eid_set)
{
@@ -884,7 +874,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
return;
mapit = pool_elt_at_index (lcm->mapping_pool, mi);
- send_lisp_eid_table_details (mapit, q, mp->context,
+ send_lisp_eid_table_details (mapit, reg, mp->context,
0 /* ignore filter */ );
}
else
@@ -892,7 +882,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
/* *INDENT-OFF* */
pool_foreach (mapit, lcm->mapping_pool,
({
- send_lisp_eid_table_details(mapit, q, mp->context,
+ send_lisp_eid_table_details(mapit, reg, mp->context,
mp->filter);
}));
/* *INDENT-ON* */
@@ -900,7 +890,8 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
}
static void
-send_lisp_map_server_details (ip_address_t * ip, svm_queue_t * q, u32 context)
+send_lisp_map_server_details (ip_address_t * ip, vl_api_registration_t * reg,
+ u32 context)
{
vl_api_lisp_map_server_details_t *rmp = NULL;
@@ -927,31 +918,29 @@ send_lisp_map_server_details (ip_address_t * ip, svm_queue_t * q, u32 context)
}
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_lisp_map_server_dump_t_handler (vl_api_lisp_map_server_dump_t * mp)
{
- svm_queue_t *q = NULL;
+ vl_api_registration_t *reg;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
lisp_msmr_t *mr;
- 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;
vec_foreach (mr, lcm->map_servers)
{
- send_lisp_map_server_details (&mr->address, q, mp->context);
+ send_lisp_map_server_details (&mr->address, reg, mp->context);
}
}
static void
send_lisp_map_resolver_details (ip_address_t * ip,
- svm_queue_t * q, u32 context)
+ vl_api_registration_t * reg, u32 context)
{
vl_api_lisp_map_resolver_details_t *rmp = NULL;
@@ -978,30 +967,29 @@ send_lisp_map_resolver_details (ip_address_t * ip,
}
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_lisp_map_resolver_dump_t_handler (vl_api_lisp_map_resolver_dump_t * mp)
{
- svm_queue_t *q = NULL;
+ vl_api_registration_t *reg;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
lisp_msmr_t *mr;
- 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;
vec_foreach (mr, lcm->map_resolvers)
{
- send_lisp_map_resolver_details (&mr->address, q, mp->context);
+ send_lisp_map_resolver_details (&mr->address, reg, mp->context);
}
}
static void
-send_eid_table_map_pair (hash_pair_t * p, svm_queue_t * q, u32 context)
+send_eid_table_map_pair (hash_pair_t * p, vl_api_registration_t * reg,
+ u32 context)
{
vl_api_lisp_eid_table_map_details_t *rmp = NULL;
@@ -1012,23 +1000,21 @@ send_eid_table_map_pair (hash_pair_t * p, svm_queue_t * q, u32 context)
rmp->vni = clib_host_to_net_u32 (p->key);
rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
vl_api_lisp_eid_table_map_dump_t_handler (vl_api_lisp_eid_table_map_dump_t *
mp)
{
- svm_queue_t *q = NULL;
+ vl_api_registration_t *reg;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
hash_pair_t *p;
uword *vni_table = 0;
- 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;
if (mp->is_l2)
{
@@ -1042,13 +1028,13 @@ vl_api_lisp_eid_table_map_dump_t_handler (vl_api_lisp_eid_table_map_dump_t *
/* *INDENT-OFF* */
hash_foreach_pair (p, vni_table,
({
- send_eid_table_map_pair (p, q, mp->context);
+ send_eid_table_map_pair (p, reg, mp->context);
}));
/* *INDENT-ON* */
}
static void
-send_eid_table_vni (u32 vni, svm_queue_t * q, u32 context)
+send_eid_table_vni (u32 vni, vl_api_registration_t * reg, u32 context)
{
vl_api_lisp_eid_table_vni_details_t *rmp = 0;
@@ -1057,7 +1043,7 @@ send_eid_table_vni (u32 vni, svm_queue_t * q, u32 context)
rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS);
rmp->context = context;
rmp->vni = clib_host_to_net_u32 (vni);
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
@@ -1161,14 +1147,12 @@ vl_api_lisp_eid_table_vni_dump_t_handler (vl_api_lisp_eid_table_vni_dump_t *
{
hash_pair_t *p;
u32 *vnis = 0;
- svm_queue_t *q = 0;
+ vl_api_registration_t *reg = 0;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- 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;
/* *INDENT-OFF* */
hash_foreach_pair (p, lcm->table_id_by_vni,
@@ -1183,7 +1167,7 @@ vl_api_lisp_eid_table_vni_dump_t_handler (vl_api_lisp_eid_table_vni_dump_t *
hash_foreach_pair (p, vnis,
({
- send_eid_table_vni (p->key, q, mp->context);
+ send_eid_table_vni (p->key, reg, mp->context);
}));
/* *INDENT-ON* */
@@ -1193,16 +1177,9 @@ vl_api_lisp_eid_table_vni_dump_t_handler (vl_api_lisp_eid_table_vni_dump_t *
static void
vl_api_show_lisp_status_t_handler (vl_api_show_lisp_status_t * mp)
{
- svm_queue_t *q = NULL;
vl_api_show_lisp_status_reply_t *rmp = NULL;
int rv = 0;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
/* *INDENT-OFF* */
REPLY_MACRO2(VL_API_SHOW_LISP_STATUS_REPLY,
({
@@ -1216,19 +1193,12 @@ static void
vl_api_lisp_get_map_request_itr_rlocs_t_handler
(vl_api_lisp_get_map_request_itr_rlocs_t * mp)
{
- svm_queue_t *q = NULL;
vl_api_lisp_get_map_request_itr_rlocs_reply_t *rmp = NULL;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
locator_set_t *loc_set = 0;
u8 *tmp_str = 0;
int rv = 0;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
if (~0 == lcm->mreq_itr_rlocs)
{
tmp_str = format (0, " ");
@@ -1254,7 +1224,6 @@ static void
static void
vl_api_show_lisp_pitr_t_handler (vl_api_show_lisp_pitr_t * mp)
{
- svm_queue_t *q = NULL;
vl_api_show_lisp_pitr_reply_t *rmp = NULL;
lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
mapping_t *m;
@@ -1262,12 +1231,6 @@ vl_api_show_lisp_pitr_t_handler (vl_api_show_lisp_pitr_t * mp)
u8 *tmp_str = 0;
int rv = 0;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
u8 is_enabled = (lcm->flags & LISP_FLAG_PITR_MODE)
&& lcm->pitr_map_index != ~0;