aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-04-22 09:25:12 +0200
committerKeith Burns <alagalah@gmail.com>2016-04-27 12:51:55 +0000
commitb3656ea0b847ef7bd1a19d2915cdd5938f32b314 (patch)
tree9d7a7f5dfc505971e2388523d71c86bc79a6be56
parent0666dc47d9a04c1c40d3ad17c053e6224c5ee248 (diff)
HONEYCOMB-10: Add missing context parameter to *details structs
Some of the *details structures defined in vpe.api did not have the context parameter that is used for request<->reply matching. Without the context, it is difficult for upper layers (users of vpp binary apis) to identify which reply or details message belongs to which request Tested manually using vat Change-Id: I5fda54a891b68349f80c87fae06009791a028147 Signed-off-by: Maros Marsalek <mmarsale@cisco.com> Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rw-r--r--vpp/api/api.c26
-rw-r--r--vpp/api/vpe.api6
2 files changed, 24 insertions, 8 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c
index 829a70fd903..b7f2a16bcaf 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -2428,7 +2428,8 @@ static void vl_api_sw_interface_clear_stats_t_handler (
static void send_sw_interface_details (vpe_api_main_t * am,
unix_shared_memory_queue_t *q,
vnet_sw_interface_t * swif,
- u8 * interface_name)
+ u8 * interface_name,
+ u32 context)
{
vl_api_sw_interface_details_t * mp;
vnet_hw_interface_t * hi;
@@ -2449,6 +2450,7 @@ static void send_sw_interface_details (vpe_api_main_t * am,
mp->link_speed = ((hi->flags & VNET_HW_INTERFACE_FLAG_SPEED_MASK) >>
VNET_HW_INTERFACE_FLAG_SPEED_SHIFT);
mp->link_mtu = ntohs(hi->max_packet_bytes);
+ mp->context = context;
strncpy ((char *) mp->interface_name,
(char *) interface_name, ARRAY_LEN(mp->interface_name)-1);
@@ -2568,7 +2570,7 @@ static void vl_api_sw_interface_dump_t_handler (
if (mp->name_filter_valid == 0 ||
strcasestr((char *) name_string, (char *) filter_string)) {
- send_sw_interface_details (am, q, swif, name_string);
+ send_sw_interface_details (am, q, swif, name_string, mp->context);
send_sw_interface_flags (am, q, swif);
}
_vec_len (name_string) = 0;
@@ -3690,7 +3692,8 @@ static void vl_api_sw_interface_vhost_user_details_t_handler (
#if DPDK > 0
static void send_sw_interface_vhost_user_details (vpe_api_main_t * am,
unix_shared_memory_queue_t *q,
- vhost_user_intf_details_t * vui)
+ vhost_user_intf_details_t * vui,
+ u32 context)
{
vl_api_sw_interface_vhost_user_details_t * mp;
@@ -3703,6 +3706,7 @@ static void send_sw_interface_vhost_user_details (vpe_api_main_t * am,
mp->is_server = vui->is_server;
mp->num_regions = ntohl(vui->num_regions);
mp->sock_errno = ntohl(vui->sock_errno);
+ mp->context = context;
strncpy ((char *) mp->sock_filename,
(char *) vui->sock_filename, ARRAY_LEN(mp->sock_filename)-1);
@@ -3735,7 +3739,7 @@ vl_api_sw_interface_vhost_user_dump_t_handler (
return;
vec_foreach (vuid, ifaces) {
- send_sw_interface_vhost_user_details (am, q, vuid);
+ send_sw_interface_vhost_user_details (am, q, vuid, mp->context);
}
vec_free(ifaces);
#endif
@@ -3744,7 +3748,8 @@ vl_api_sw_interface_vhost_user_dump_t_handler (
static void send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am,
unix_shared_memory_queue_t *q,
l2t_session_t *s,
- l2t_main_t * lm)
+ l2t_main_t * lm,
+ u32 context)
{
vl_api_sw_if_l2tpv3_tunnel_details_t * mp;
u8 * if_name = NULL;
@@ -3769,6 +3774,7 @@ static void send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am,
clib_memcpy(mp->client_address, &s->client_address, sizeof(s->client_address));
clib_memcpy(mp->our_address, &s->our_address, sizeof(s->our_address));
mp->l2_sublayer_present = s->l2_sublayer_present;
+ mp->context = context;
vl_msg_api_send_shmem (q, (u8 *)&mp);
}
@@ -3866,7 +3872,7 @@ vl_api_sw_if_l2tpv3_tunnel_dump_t_handler (
pool_foreach (session, lm->sessions,
({
- send_sw_if_l2tpv3_tunnel_details (am, q, session, lm);
+ send_sw_if_l2tpv3_tunnel_details (am, q, session, lm, mp->context);
}));
}
@@ -3952,7 +3958,8 @@ static void vl_api_l2_fib_table_entry_t_handler (
static void send_l2fib_table_entry (vpe_api_main_t * am,
unix_shared_memory_queue_t *q,
l2fib_entry_key_t * l2fe_key,
- l2fib_entry_result_t * l2fe_res)
+ l2fib_entry_result_t * l2fe_res,
+ u32 context)
{
vl_api_l2_fib_table_entry_t * mp;
@@ -3967,6 +3974,7 @@ static void send_l2fib_table_entry (vpe_api_main_t * am,
mp->static_mac = l2fe_res->fields.static_mac;
mp->filter_mac = l2fe_res->fields.filter;
mp->bvi_mac = l2fe_res->fields.bvi;
+ mp->context = context;
vl_msg_api_send_shmem (q, (u8 *)&mp);
}
@@ -4002,7 +4010,7 @@ vl_api_l2_fib_table_dump_t_handler (vl_api_l2_fib_table_dump_t *mp)
vec_foreach_index (ni, l2fe_key) {
send_l2fib_table_entry (am, q, vec_elt_at_index(l2fe_key, ni),
- vec_elt_at_index(l2fe_res, ni));
+ vec_elt_at_index(l2fe_res, ni), mp->context);
}
vec_free(l2fe_key);
vec_free(l2fe_res);
@@ -5397,6 +5405,7 @@ vl_api_map_domain_dump_t_handler
rmp->ip6_src_len = d->ip6_src_len;
rmp->mtu = htons(d->mtu);
rmp->is_translation = (d->flags & MAP_DOMAIN_TRANSLATION);
+ rmp->context = mp->context;
vl_msg_api_send_shmem (q, (u8 *)&rmp);
}));
@@ -5437,6 +5446,7 @@ vl_api_map_rule_dump_t_handler
rmp->_vl_msg_id = ntohs(VL_API_MAP_RULE_DETAILS);
rmp->psid = htons(i);
clib_memcpy(rmp->ip6_dst, &dst, sizeof(rmp->ip6_dst));
+ rmp->context = mp->context;
vl_msg_api_send_shmem(q, (u8 *)&rmp);
}
}
diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api
index afad1c25d0b..50f971416bc 100644
--- a/vpp/api/vpe.api
+++ b/vpp/api/vpe.api
@@ -67,6 +67,7 @@ define want_interface_events_reply {
@param vtr_tag2
*/
manual_java define sw_interface_details {
+ u32 context;
u32 sw_if_index;
/* index of sup interface (e.g. hw interface).
@@ -1683,6 +1684,7 @@ define l2tpv3_set_tunnel_cookies_reply {
};
manual_java define sw_if_l2tpv3_tunnel_details {
+ u32 context;
u32 sw_if_index;
u8 interface_name[64];
u8 client_address [16];
@@ -1984,6 +1986,7 @@ define nsh_gre_add_del_tunnel_reply {
@param num_regions - number of used memory regions
*/
manual_java define sw_interface_vhost_user_details {
+ u32 context;
u32 sw_if_index;
u8 interface_name[64];
u32 virtio_net_hdr_sz;
@@ -2034,6 +2037,7 @@ define ip_dump {
@param bvi_mac - the mac address is a bridge virtual interface
*/
manual_java define l2_fib_table_entry {
+ u32 context;
u32 bd_id;
u64 mac;
u32 sw_if_index;
@@ -3037,6 +3041,7 @@ define map_domain_dump {
};
manual_java define map_domain_details {
+ u32 context;
u32 domain_index;
u8 ip6_prefix[16];
u8 ip4_prefix[4];
@@ -3059,6 +3064,7 @@ define map_rule_dump {
};
manual_java define map_rule_details {
+ u32 context;
u8 ip6_dst[16];
u16 psid;
};